File tree Expand file tree Collapse file tree 7 files changed +176
-94
lines changed
Expand file tree Collapse file tree 7 files changed +176
-94
lines changed Original file line number Diff line number Diff line change @@ -230,6 +230,13 @@ bool HiveConfig::readStatsBasedFilterReorderDisabled(
230230 config_->get <bool >(kReadStatsBasedFilterReorderDisabled , false ));
231231}
232232
233+ bool HiveConfig::isRequestedTypeCheckEnabled (
234+ const config::ConfigBase* session) const {
235+ return session->get <bool >(
236+ kEnableRequestedTypeCheckSession ,
237+ config_->get <bool >(kEnableRequestedTypeCheck , true ));
238+ }
239+
233240std::string HiveConfig::hiveLocalDataPath () const {
234241 return config_->get <std::string>(kLocalDataPath , " " );
235242}
Original file line number Diff line number Diff line change @@ -187,6 +187,11 @@ class HiveConfig {
187187 static constexpr const char * kLocalDataPath = " hive_local_data_path" ;
188188 static constexpr const char * kLocalFileFormat = " hive_local_file_format" ;
189189
190+ static constexpr const char * kEnableRequestedTypeCheck =
191+ " enable-requested-type-check" ;
192+ static constexpr const char * kEnableRequestedTypeCheckSession =
193+ " enable_requested_type_check" ;
194+
190195 InsertExistingPartitionsBehavior insertExistingPartitionsBehavior (
191196 const config::ConfigBase* session) const ;
192197
@@ -258,6 +263,10 @@ class HiveConfig {
258263 bool readStatsBasedFilterReorderDisabled (
259264 const config::ConfigBase* session) const ;
260265
266+ // / Whether to enable requested type check in the ReaderBase::convertType.
267+ // / Returns true by default.
268+ bool isRequestedTypeCheckEnabled (const config::ConfigBase* session) const ;
269+
261270 // / Returns the file system path containing local data. If non-empty,
262271 // / initializes LocalHiveConnectorMetadata to provide metadata for the tables
263272 // / in the directory.
Original file line number Diff line number Diff line change @@ -603,6 +603,8 @@ void configureReaderOptions(
603603 }
604604
605605 readerOptions.setFileFormat (hiveSplit->fileFormat );
606+ readerOptions.setEnableRequestedTypeCheck (
607+ hiveConfig->isRequestedTypeCheckEnabled (sessionProperties));
606608 }
607609}
608610
Original file line number Diff line number Diff line change @@ -643,6 +643,11 @@ Each query can override the config by setting corresponding query session proper
643643 - bool
644644 - true
645645 - Reads timestamp partition value as local time if true. Otherwise, reads as UTC.
646+ * - enable-requested-type-check
647+ - enable_requested_type_check
648+ - bool
649+ - true
650+ - Whether to enable requested type check in the `ReaderBase::convertType `. True by default.
646651
647652``ORC File Format Configuration ``
648653^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change @@ -600,6 +600,10 @@ class ReaderOptions : public io::ReaderOptions {
600600 return randomSkip_;
601601 }
602602
603+ bool enableRequestedTypeCheck () const {
604+ return enableRequestedTypeCheck_;
605+ }
606+
603607 void setRandomSkip (std::shared_ptr<random::RandomSkipTracker> randomSkip) {
604608 randomSkip_ = std::move (randomSkip);
605609 }
@@ -636,6 +640,10 @@ class ReaderOptions : public io::ReaderOptions {
636640 allowEmptyFile_ = value;
637641 }
638642
643+ void setEnableRequestedTypeCheck (bool enableRequestedTypeCheck) {
644+ enableRequestedTypeCheck_ = enableRequestedTypeCheck;
645+ }
646+
639647 private:
640648 uint64_t tailLocation_;
641649 FileFormat fileFormat_;
@@ -653,6 +661,7 @@ class ReaderOptions : public io::ReaderOptions {
653661 bool adjustTimestampToTimezone_{false };
654662 bool selectiveNimbleReaderEnabled_{false };
655663 bool allowEmptyFile_{false };
664+ bool enableRequestedTypeCheck_{true };
656665};
657666
658667struct WriterOptions {
You can’t perform that action at this time.
0 commit comments