Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ORC related failed UT #417

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions velox/connectors/hive/HiveConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,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 @@ -1108,4 +1108,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 @@ -365,8 +365,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