Skip to content
Closed
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
7 changes: 7 additions & 0 deletions velox/connectors/hive/HiveConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@ bool HiveConfig::readStatsBasedFilterReorderDisabled(
config_->get<bool>(kReadStatsBasedFilterReorderDisabled, false));
}

bool HiveConfig::isRequestedTypeCheckEnabled(
const config::ConfigBase* session) const {
return session->get<bool>(
kEnableRequestedTypeCheckSession,
config_->get<bool>(kEnableRequestedTypeCheck, true));
}

std::string HiveConfig::hiveLocalDataPath() const {
return config_->get<std::string>(kLocalDataPath, "");
}
Expand Down
9 changes: 9 additions & 0 deletions velox/connectors/hive/HiveConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ class HiveConfig {
static constexpr const char* kLocalDataPath = "hive_local_data_path";
static constexpr const char* kLocalFileFormat = "hive_local_file_format";

static constexpr const char* kEnableRequestedTypeCheck =
"enable-requested-type-check";
static constexpr const char* kEnableRequestedTypeCheckSession =
"enable_requested_type_check";

InsertExistingPartitionsBehavior insertExistingPartitionsBehavior(
const config::ConfigBase* session) const;

Expand Down Expand Up @@ -258,6 +263,10 @@ class HiveConfig {
bool readStatsBasedFilterReorderDisabled(
const config::ConfigBase* session) const;

/// Whether to enable requested type check in the ReaderBase::convertType.
/// Returns true by default.
bool isRequestedTypeCheckEnabled(const config::ConfigBase* session) const;

/// Returns the file system path containing local data. If non-empty,
/// initializes LocalHiveConnectorMetadata to provide metadata for the tables
/// in the directory.
Expand Down
2 changes: 2 additions & 0 deletions velox/connectors/hive/HiveConnectorUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,8 @@ void configureReaderOptions(
}

readerOptions.setFileFormat(hiveSplit->fileFormat);
readerOptions.setEnableRequestedTypeCheck(
hiveConfig->isRequestedTypeCheckEnabled(sessionProperties));
}
}

Expand Down
5 changes: 5 additions & 0 deletions velox/docs/configs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,11 @@ Each query can override the config by setting corresponding query session proper
- bool
- true
- Reads timestamp partition value as local time if true. Otherwise, reads as UTC.
* - enable-requested-type-check
- enable_requested_type_check
- bool
- true
- Whether to enable requested type check in the `ReaderBase::convertType`. True by default.

``ORC File Format Configuration``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
9 changes: 9 additions & 0 deletions velox/dwio/common/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,10 @@ class ReaderOptions : public io::ReaderOptions {
return randomSkip_;
}

bool enableRequestedTypeCheck() const {
return enableRequestedTypeCheck_;
}

void setRandomSkip(std::shared_ptr<random::RandomSkipTracker> randomSkip) {
randomSkip_ = std::move(randomSkip);
}
Expand Down Expand Up @@ -636,6 +640,10 @@ class ReaderOptions : public io::ReaderOptions {
allowEmptyFile_ = value;
}

void setEnableRequestedTypeCheck(bool enableRequestedTypeCheck) {
enableRequestedTypeCheck_ = enableRequestedTypeCheck;
}

private:
uint64_t tailLocation_;
FileFormat fileFormat_;
Expand All @@ -653,6 +661,7 @@ class ReaderOptions : public io::ReaderOptions {
bool adjustTimestampToTimezone_{false};
bool selectiveNimbleReaderEnabled_{false};
bool allowEmptyFile_{false};
bool enableRequestedTypeCheck_{true};
};

struct WriterOptions {
Expand Down
Loading
Loading