Skip to content

Commit

Permalink
Fix ORC related failed UT (oap-project#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxu14 authored and glutenperfbot committed Jan 9, 2024
1 parent ac387bd commit e7110e1
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 3 deletions.
1 change: 1 addition & 0 deletions velox/connectors/hive/HiveConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ std::unique_ptr<core::PartitionFunction> HivePartitionFunctionSpec::create(
void HiveConnectorFactory::initialize() {
static bool once = []() {
dwio::common::registerFileSinks();
dwrf::registerOrcReaderFactory();
dwrf::registerDwrfReaderFactory();
dwrf::registerDwrfWriterFactory();
// Meta's buck build system needs this check.
Expand Down
4 changes: 2 additions & 2 deletions velox/dwio/dwrf/common/FileMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ class FooterWrapper : public ProtoWrapperBase {

// TODO: ORC has not supported column statistics yet
int statisticsSize() const {
return format_ == DwrfFormat::kDwrf ? dwrfPtr()->statistics_size() : 0;
return format_ == DwrfFormat::kDwrf ? dwrfPtr()->statistics_size()
: orcPtr()->statistics_size();
}

const ::google::protobuf::RepeatedPtrField<
Expand All @@ -438,7 +439,6 @@ class FooterWrapper : public ProtoWrapperBase {

const ::facebook::velox::dwrf::proto::ColumnStatistics& statistics(
int index) const {
VELOX_CHECK_EQ(format_, DwrfFormat::kDwrf);
return dwrfPtr()->statistics(index);
}

Expand Down
8 changes: 8 additions & 0 deletions velox/dwio/dwrf/reader/DwrfReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,4 +1113,12 @@ void unregisterDwrfReaderFactory() {
dwio::common::unregisterReaderFactory(dwio::common::FileFormat::DWRF);
}

void registerOrcReaderFactory() {
dwio::common::registerReaderFactory(std::make_shared<OrcReaderFactory>());
}

void unregisterOrcReaderFactory() {
dwio::common::unregisterReaderFactory(dwio::common::FileFormat::ORC);
}

} // namespace facebook::velox::dwrf
15 changes: 15 additions & 0 deletions velox/dwio/dwrf/reader/DwrfReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,23 @@ class DwrfReaderFactory : public dwio::common::ReaderFactory {
}
};

class OrcReaderFactory : public dwio::common::ReaderFactory {
public:
OrcReaderFactory() : ReaderFactory(dwio::common::FileFormat::ORC) {}

std::unique_ptr<dwio::common::Reader> createReader(
std::unique_ptr<dwio::common::BufferedInput> input,
const dwio::common::ReaderOptions& options) override {
return DwrfReader::create(std::move(input), options);
}
};

void registerDwrfReaderFactory();

void unregisterDwrfReaderFactory();

void registerOrcReaderFactory();

void unregisterOrcReaderFactory();

} // namespace facebook::velox::dwrf
4 changes: 4 additions & 0 deletions velox/dwio/dwrf/reader/SelectiveDecimalColumnReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ class SelectiveDecimalColumnReader : public SelectiveColumnReader {

void getValues(RowSet rows, VectorPtr* result) override;

bool hasBulkPath() const override {
return false;
}

private:
template <bool kDense>
void readHelper(RowSet rows);
Expand Down
6 changes: 5 additions & 1 deletion velox/dwio/dwrf/reader/SelectiveIntegerDirectColumnReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ class SelectiveIntegerDirectColumnReader
}

bool hasBulkPath() const override {
return true;
if (format == velox::dwrf::DwrfFormat::kOrc) {
return false; // RLEv2 does't support FastPath yet
} else {
return true;
}
}

void seekToRowGroup(uint32_t index) override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ class SelectiveStringDictionaryColumnReader

uint64_t skip(uint64_t numValues) override;

bool hasBulkPath() const override {
if (version_ == velox::dwrf::RleVersion_1) {
return true;
} else {
return false; // RLEv2 does't support FastPath yet
}
}

void read(vector_size_t offset, RowSet rows, const uint64_t* incomingNulls)
override;

Expand Down

0 comments on commit e7110e1

Please sign in to comment.