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 @@ -604,6 +604,8 @@ void configureReaderOptions(
604604 }
605605
606606 readerOptions.setFileFormat (hiveSplit->fileFormat );
607+ readerOptions.setEnableRequestedTypeCheck (
608+ hiveConfig->isRequestedTypeCheckEnabled (sessionProperties));
607609 }
608610}
609611
Original file line number Diff line number Diff line change @@ -676,6 +676,11 @@ Each query can override the config by setting corresponding query session proper
676676 - bool
677677 - true
678678 - Reads timestamp partition value as local time if true. Otherwise, reads as UTC.
679+ * - enable-requested-type-check
680+ - enable_requested_type_check
681+ - bool
682+ - true
683+ - Whether to enable requested type check in the `ReaderBase::convertType `. True by default.
679684
680685``ORC File Format Configuration ``
681686^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change @@ -629,6 +629,10 @@ class ReaderOptions : public io::ReaderOptions {
629629 return randomSkip_;
630630 }
631631
632+ bool enableRequestedTypeCheck () const {
633+ return enableRequestedTypeCheck_;
634+ }
635+
632636 void setRandomSkip (std::shared_ptr<random::RandomSkipTracker> randomSkip) {
633637 randomSkip_ = std::move (randomSkip);
634638 }
@@ -665,6 +669,10 @@ class ReaderOptions : public io::ReaderOptions {
665669 allowEmptyFile_ = value;
666670 }
667671
672+ void setEnableRequestedTypeCheck (bool enableRequestedTypeCheck) {
673+ enableRequestedTypeCheck_ = enableRequestedTypeCheck;
674+ }
675+
668676 private:
669677 uint64_t tailLocation_;
670678 FileFormat fileFormat_;
@@ -682,6 +690,7 @@ class ReaderOptions : public io::ReaderOptions {
682690 bool adjustTimestampToTimezone_{false };
683691 bool selectiveNimbleReaderEnabled_{false };
684692 bool allowEmptyFile_{false };
693+ bool enableRequestedTypeCheck_{true };
685694};
686695
687696struct WriterOptions {
You can’t perform that action at this time.
0 commit comments