@@ -113,74 +113,6 @@ class IndexLookupJoinTest : public IndexLookupJoinTestBase,
113
113
ASSERT_EQ (plan->toString (true , true ), copy->toString (true , true ));
114
114
}
115
115
116
- // Create index table with the given key and value inputs.
117
- std::shared_ptr<TestIndexTable> createIndexTable (
118
- int numEqualJoinKeys,
119
- const RowVectorPtr& keyData,
120
- const RowVectorPtr& valueData) {
121
- const auto keyType =
122
- std::dynamic_pointer_cast<const RowType>(keyData->type ());
123
- VELOX_CHECK_GE (keyType->size (), 1 );
124
- VELOX_CHECK_GE (keyType->size (), numEqualJoinKeys);
125
- auto valueType =
126
- std::dynamic_pointer_cast<const RowType>(valueData->type ());
127
- VELOX_CHECK_GE (valueType->size (), 1 );
128
- const auto numRows = keyData->size ();
129
- VELOX_CHECK_EQ (numRows, valueData->size ());
130
-
131
- std::vector<std::unique_ptr<VectorHasher>> hashers;
132
- hashers.reserve (numEqualJoinKeys);
133
- std::vector<VectorPtr> keyVectors;
134
- keyVectors.reserve (numEqualJoinKeys);
135
- for (auto i = 0 ; i < numEqualJoinKeys; ++i) {
136
- hashers.push_back (std::make_unique<VectorHasher>(keyType->childAt (i), i));
137
- keyVectors.push_back (keyData->childAt (i));
138
- }
139
-
140
- std::vector<TypePtr> dependentTypes;
141
- std::vector<VectorPtr> dependentVectors;
142
- for (int i = numEqualJoinKeys; i < keyType->size (); ++i) {
143
- dependentTypes.push_back (keyType->childAt (i));
144
- dependentVectors.push_back (keyData->childAt (i));
145
- }
146
- for (int i = 0 ; i < valueType->size (); ++i) {
147
- dependentTypes.push_back (valueType->childAt (i));
148
- dependentVectors.push_back (valueData->childAt (i));
149
- }
150
-
151
- // Create the table.
152
- auto table = HashTable<false >::createForJoin (
153
- std::move (hashers),
154
- /* dependentTypes=*/ dependentTypes,
155
- /* allowDuplicates=*/ true ,
156
- /* hasProbedFlag=*/ false ,
157
- /* minTableSizeForParallelJoinBuild=*/ 1 ,
158
- pool_.get ());
159
-
160
- // Insert data into the row container.
161
- auto * rowContainer = table->rows ();
162
- std::vector<DecodedVector> decodedVectors;
163
- for (auto & vector : keyData->children ()) {
164
- decodedVectors.emplace_back (*vector);
165
- }
166
- for (auto & vector : valueData->children ()) {
167
- decodedVectors.emplace_back (*vector);
168
- }
169
-
170
- for (auto row = 0 ; row < numRows; ++row) {
171
- auto * newRow = rowContainer->newRow ();
172
-
173
- for (auto col = 0 ; col < decodedVectors.size (); ++col) {
174
- rowContainer->store (decodedVectors[col], row, newRow, col);
175
- }
176
- }
177
-
178
- // Build the table index.
179
- table->prepareJoinTable ({}, BaseHashTable::kNoSpillInputStartPartitionBit );
180
- return std::make_shared<TestIndexTable>(
181
- std::move (keyType), std::move (valueType), std::move (table));
182
- }
183
-
184
116
// Makes index table handle with the specified index table and async lookup
185
117
// flag.
186
118
std::shared_ptr<TestIndexTableHandle> makeIndexTableHandle (
@@ -795,8 +727,11 @@ TEST_P(IndexLookupJoinTest, equalJoin) {
795
727
createDuckDbTable (" t" , probeVectors);
796
728
createDuckDbTable (" u" , {tableData.tableData });
797
729
798
- const auto indexTable = createIndexTable (
799
- /* numEqualJoinKeys=*/ 3 , tableData.keyData , tableData.valueData );
730
+ const auto indexTable = TestIndexTable::create (
731
+ /* numEqualJoinKeys=*/ 3 ,
732
+ tableData.keyData ,
733
+ tableData.valueData ,
734
+ *pool ());
800
735
const auto indexTableHandle =
801
736
makeIndexTableHandle (indexTable, GetParam ().asyncLookup );
802
737
auto planNodeIdGenerator = std::make_shared<core::PlanNodeIdGenerator>();
@@ -1250,8 +1185,11 @@ TEST_P(IndexLookupJoinTest, betweenJoinCondition) {
1250
1185
createDuckDbTable (" t" , probeVectors);
1251
1186
createDuckDbTable (" u" , {tableData.tableData });
1252
1187
1253
- const auto indexTable = createIndexTable (
1254
- /* numEqualJoinKeys=*/ 2 , tableData.keyData , tableData.valueData );
1188
+ const auto indexTable = TestIndexTable::create (
1189
+ /* numEqualJoinKeys=*/ 2 ,
1190
+ tableData.keyData ,
1191
+ tableData.valueData ,
1192
+ *pool ());
1255
1193
const auto indexTableHandle =
1256
1194
makeIndexTableHandle (indexTable, GetParam ().asyncLookup );
1257
1195
auto planNodeIdGenerator = std::make_shared<core::PlanNodeIdGenerator>();
@@ -1571,8 +1509,11 @@ TEST_P(IndexLookupJoinTest, inJoinCondition) {
1571
1509
createDuckDbTable (" t" , probeVectors);
1572
1510
createDuckDbTable (" u" , {tableData.tableData });
1573
1511
1574
- const auto indexTable = createIndexTable (
1575
- /* numEqualJoinKeys=*/ 2 , tableData.keyData , tableData.valueData );
1512
+ const auto indexTable = TestIndexTable::create (
1513
+ /* numEqualJoinKeys=*/ 2 ,
1514
+ tableData.keyData ,
1515
+ tableData.valueData ,
1516
+ *pool ());
1576
1517
const auto indexTableHandle =
1577
1518
makeIndexTableHandle (indexTable, GetParam ().asyncLookup );
1578
1519
auto planNodeIdGenerator = std::make_shared<core::PlanNodeIdGenerator>();
@@ -1622,8 +1563,8 @@ DEBUG_ONLY_TEST_P(IndexLookupJoinTest, connectorError) {
1622
1563
}
1623
1564
}));
1624
1565
1625
- const auto indexTable = createIndexTable (
1626
- /* numEqualJoinKeys=*/ 3 , tableData.keyData , tableData.valueData );
1566
+ const auto indexTable = TestIndexTable::create (
1567
+ /* numEqualJoinKeys=*/ 3 , tableData.keyData , tableData.valueData , * pool () );
1627
1568
const auto indexTableHandle =
1628
1569
makeIndexTableHandle (indexTable, GetParam ().asyncLookup );
1629
1570
auto planNodeIdGenerator = std::make_shared<core::PlanNodeIdGenerator>();
@@ -1691,8 +1632,8 @@ DEBUG_ONLY_TEST_P(IndexLookupJoinTest, prefetch) {
1691
1632
asyncLookupWait.await ([&] { return !asyncLookupWaitFlag.load (); });
1692
1633
}));
1693
1634
1694
- const auto indexTable = createIndexTable (
1695
- /* numEqualJoinKeys=*/ 3 , tableData.keyData , tableData.valueData );
1635
+ const auto indexTable = TestIndexTable::create (
1636
+ /* numEqualJoinKeys=*/ 3 , tableData.keyData , tableData.valueData , * pool () );
1696
1637
const auto indexTableHandle =
1697
1638
makeIndexTableHandle (indexTable, GetParam ().asyncLookup );
1698
1639
auto planNodeIdGenerator = std::make_shared<core::PlanNodeIdGenerator>();
@@ -1790,8 +1731,11 @@ TEST_P(IndexLookupJoinTest, outputBatchSizeWithInnerJoin) {
1790
1731
createDuckDbTable (" t" , probeVectors);
1791
1732
createDuckDbTable (" u" , {tableData.tableData });
1792
1733
1793
- const auto indexTable = createIndexTable (
1794
- /* numEqualJoinKeys=*/ 3 , tableData.keyData , tableData.valueData );
1734
+ const auto indexTable = TestIndexTable::create (
1735
+ /* numEqualJoinKeys=*/ 3 ,
1736
+ tableData.keyData ,
1737
+ tableData.valueData ,
1738
+ *pool ());
1795
1739
const auto indexTableHandle =
1796
1740
makeIndexTableHandle (indexTable, GetParam ().asyncLookup );
1797
1741
auto planNodeIdGenerator = std::make_shared<core::PlanNodeIdGenerator>();
@@ -1895,8 +1839,11 @@ TEST_P(IndexLookupJoinTest, outputBatchSizeWithLeftJoin) {
1895
1839
createDuckDbTable (" t" , probeVectors);
1896
1840
createDuckDbTable (" u" , {tableData.tableData });
1897
1841
1898
- const auto indexTable = createIndexTable (
1899
- /* numEqualJoinKeys=*/ 3 , tableData.keyData , tableData.valueData );
1842
+ const auto indexTable = TestIndexTable::create (
1843
+ /* numEqualJoinKeys=*/ 3 ,
1844
+ tableData.keyData ,
1845
+ tableData.valueData ,
1846
+ *pool ());
1900
1847
const auto indexTableHandle =
1901
1848
makeIndexTableHandle (indexTable, GetParam ().asyncLookup );
1902
1849
auto planNodeIdGenerator = std::make_shared<core::PlanNodeIdGenerator>();
@@ -1967,8 +1914,8 @@ DEBUG_ONLY_TEST_P(IndexLookupJoinTest, runtimeStats) {
1967
1914
std::this_thread::sleep_for (std::chrono::milliseconds (100 )); // NOLINT
1968
1915
}));
1969
1916
1970
- const auto indexTable = createIndexTable (
1971
- /* numEqualJoinKeys=*/ 3 , tableData.keyData , tableData.valueData );
1917
+ const auto indexTable = TestIndexTable::create (
1918
+ /* numEqualJoinKeys=*/ 3 , tableData.keyData , tableData.valueData , * pool () );
1972
1919
const auto indexTableHandle =
1973
1920
makeIndexTableHandle (indexTable, GetParam ().asyncLookup );
1974
1921
auto planNodeIdGenerator = std::make_shared<core::PlanNodeIdGenerator>();
@@ -2057,8 +2004,8 @@ TEST_P(IndexLookupJoinTest, barrier) {
2057
2004
createDuckDbTable (" t" , probeVectors);
2058
2005
createDuckDbTable (" u" , {tableData.tableData });
2059
2006
2060
- const auto indexTable = createIndexTable (
2061
- /* numEqualJoinKeys=*/ 3 , tableData.keyData , tableData.valueData );
2007
+ const auto indexTable = TestIndexTable::create (
2008
+ /* numEqualJoinKeys=*/ 3 , tableData.keyData , tableData.valueData , * pool () );
2062
2009
const auto indexTableHandle =
2063
2010
makeIndexTableHandle (indexTable, GetParam ().asyncLookup );
2064
2011
auto planNodeIdGenerator = std::make_shared<core::PlanNodeIdGenerator>();
@@ -2128,8 +2075,8 @@ TEST_P(IndexLookupJoinTest, joinFuzzer) {
2128
2075
createDuckDbTable (" t" , probeVectors);
2129
2076
createDuckDbTable (" u" , {tableData.tableData });
2130
2077
2131
- const auto indexTable = createIndexTable (
2132
- /* numEqualJoinKeys=*/ 1 , tableData.keyData , tableData.valueData );
2078
+ const auto indexTable = TestIndexTable::create (
2079
+ /* numEqualJoinKeys=*/ 1 , tableData.keyData , tableData.valueData , * pool () );
2133
2080
const auto indexTableHandle =
2134
2081
makeIndexTableHandle (indexTable, GetParam ().asyncLookup );
2135
2082
auto planNodeIdGenerator = std::make_shared<core::PlanNodeIdGenerator>();
0 commit comments