|
19 | 19 | #include "velox/connectors/hive/FileConfig.h" |
20 | 20 | #include "velox/connectors/hive/HiveConnectorSplit.h" |
21 | 21 | #include "velox/connectors/hive/HiveConnectorUtil.h" |
| 22 | +#include "velox/connectors/hive/iceberg/IcebergSplit.h" |
| 23 | +#include "velox/connectors/hive/iceberg/IcebergSplitReader.h" |
22 | 24 |
|
23 | 25 | namespace facebook::velox::connector::hive { |
24 | 26 |
|
| 27 | +std::unique_ptr<FileSplitReader> HiveSplitReader::create( |
| 28 | + const std::shared_ptr<const HiveConnectorSplit>& hiveSplit, |
| 29 | + const FileTableHandlePtr& tableHandle, |
| 30 | + const std::unordered_map<std::string, FileColumnHandlePtr>* partitionKeys, |
| 31 | + const ConnectorQueryCtx* connectorQueryCtx, |
| 32 | + const std::shared_ptr<const FileConfig>& fileConfig, |
| 33 | + const RowTypePtr& readerOutputType, |
| 34 | + const std::shared_ptr<io::IoStatistics>& ioStatistics, |
| 35 | + const std::shared_ptr<IoStats>& ioStats, |
| 36 | + FileHandleFactory* fileHandleFactory, |
| 37 | + folly::Executor* ioExecutor, |
| 38 | + const std::shared_ptr<common::ScanSpec>& scanSpec, |
| 39 | + const std::unordered_map<std::string, FileColumnHandlePtr>* infoColumns, |
| 40 | + std::vector<column_index_t> bucketChannels, |
| 41 | + const common::SubfieldFilters* subfieldFiltersForValidation) { |
| 42 | + // Create the SplitReader based on hiveSplit->customSplitInfo["table_format"] |
| 43 | + if (hiveSplit->customSplitInfo.count("table_format") > 0 && |
| 44 | + hiveSplit->customSplitInfo.at("table_format") == "hive-iceberg") { |
| 45 | + auto icebergSplit = |
| 46 | + std::dynamic_pointer_cast<const iceberg::HiveIcebergSplit>(hiveSplit); |
| 47 | + VELOX_CHECK_NOT_NULL( |
| 48 | + icebergSplit, |
| 49 | + "Expected HiveIcebergSplit for table_format=hive-iceberg"); |
| 50 | + return std::make_unique<iceberg::IcebergSplitReader>( |
| 51 | + icebergSplit, |
| 52 | + tableHandle, |
| 53 | + partitionKeys, |
| 54 | + connectorQueryCtx, |
| 55 | + fileConfig, |
| 56 | + readerOutputType, |
| 57 | + ioStatistics, |
| 58 | + ioStats, |
| 59 | + fileHandleFactory, |
| 60 | + ioExecutor, |
| 61 | + scanSpec); |
| 62 | + } else { |
| 63 | + return std::make_unique<HiveSplitReader>( |
| 64 | + hiveSplit, |
| 65 | + tableHandle, |
| 66 | + partitionKeys, |
| 67 | + connectorQueryCtx, |
| 68 | + fileConfig, |
| 69 | + readerOutputType, |
| 70 | + ioStatistics, |
| 71 | + ioStats, |
| 72 | + fileHandleFactory, |
| 73 | + ioExecutor, |
| 74 | + scanSpec, |
| 75 | + infoColumns, |
| 76 | + std::move(bucketChannels)); |
| 77 | + } |
| 78 | +} |
| 79 | + |
25 | 80 | HiveSplitReader::HiveSplitReader( |
26 | 81 | const std::shared_ptr<const HiveConnectorSplit>& hiveSplit, |
27 | 82 | const FileTableHandlePtr& tableHandle, |
|
0 commit comments