@@ -209,7 +209,8 @@ class HiveIcebergTest : public HiveConnectorTestBase {
209
209
}
210
210
}
211
211
212
- splits.emplace_back (makeIcebergSplit (baseFilePath, deleteFiles));
212
+ auto icebergSplits = makeIcebergSplit (baseFilePath, 3 , deleteFiles);
213
+ splits.insert (splits.end (), icebergSplits.begin (), icebergSplits.end ());
213
214
}
214
215
215
216
std::string duckdbSql =
@@ -335,8 +336,9 @@ class HiveIcebergTest : public HiveConnectorTestBase {
335
336
return vectors;
336
337
}
337
338
338
- std::shared_ptr<ConnectorSplit> makeIcebergSplit (
339
+ std::vector<std:: shared_ptr<ConnectorSplit> > makeIcebergSplit (
339
340
const std::string& dataFilePath,
341
+ const uint32_t splitCount = 1 ,
340
342
const std::vector<IcebergDeleteFile>& deleteFiles = {}) {
341
343
std::unordered_map<std::string, std::optional<std::string>> partitionKeys;
342
344
std::unordered_map<std::string, std::string> customSplitInfo;
@@ -346,17 +348,24 @@ class HiveIcebergTest : public HiveConnectorTestBase {
346
348
->openFileForRead (dataFilePath);
347
349
const int64_t fileSize = file->size ();
348
350
349
- return std::make_shared<HiveIcebergSplit>(
350
- kHiveConnectorId ,
351
- dataFilePath,
352
- fileFomat_,
353
- 0 ,
354
- fileSize,
355
- partitionKeys,
356
- std::nullopt,
357
- customSplitInfo,
358
- nullptr ,
359
- deleteFiles);
351
+ std::vector<std::shared_ptr<ConnectorSplit>> splits;
352
+ const uint64_t splitSize = std::ceil ((fileSize) / splitCount);
353
+
354
+ for (int i = 0 ; i < splitCount; ++i) {
355
+ splits.emplace_back (std::make_shared<HiveIcebergSplit>(
356
+ kHiveConnectorId ,
357
+ dataFilePath,
358
+ fileFomat_,
359
+ i * splitSize,
360
+ splitSize,
361
+ partitionKeys,
362
+ std::nullopt,
363
+ customSplitInfo,
364
+ nullptr ,
365
+ deleteFiles));
366
+ }
367
+
368
+ return splits;
360
369
}
361
370
362
371
std::string getDuckDBQuery (
@@ -657,6 +666,8 @@ TEST_F(HiveIcebergTest, positionalDeletesMultipleSplits) {
657
666
assertMultipleSplits (makeRandomIncreasingValues (0 , 20000 ), 10 , 3 );
658
667
assertMultipleSplits (makeContinuousIncreasingValues (0 , 20000 ), 10 , 3 );
659
668
assertMultipleSplits ({}, 10 , 3 );
669
+
670
+ assertMultipleSplits (makeContinuousIncreasingValues (0 , 5000 ), 1 , 3 );
660
671
}
661
672
662
673
} // namespace facebook::velox::connector::hive::iceberg
0 commit comments