@@ -70,7 +70,8 @@ std::unique_ptr<dwio::common::FileSink> createHiveFileSink(
7070 const std::shared_ptr<const HiveConfig>& hiveConfig,
7171 memory::MemoryPool* sinkPool,
7272 io::IoStatistics* ioStats,
73- IoStats* fileSystemStats) {
73+ IoStats* fileSystemStats,
74+ const std::unordered_map<std::string, std::string>& storageParameters) {
7475 return dwio::common::FileSink::create (
7576 path,
7677 {
@@ -81,6 +82,7 @@ std::unique_ptr<dwio::common::FileSink> createHiveFileSink(
8182 .metricLogger = dwio::common::MetricsLog::voidLog (),
8283 .stats = ioStats,
8384 .fileSystemStats = fileSystemStats,
85+ .storageParameters = storageParameters,
8486 });
8587}
8688
@@ -430,7 +432,8 @@ HiveInsertTableHandle::HiveInsertTableHandle(
430432 // if there's no data. This is useful when the table is bucketed, but the
431433 // engine handles ensuring a 1 to 1 mapping from task to bucket.
432434 const bool ensureFiles,
433- std::shared_ptr<const FileNameGenerator> fileNameGenerator)
435+ std::shared_ptr<const FileNameGenerator> fileNameGenerator,
436+ const std::unordered_map<std::string, std::string>& storageParameters)
434437 : inputColumns_(std::move(inputColumns)),
435438 locationHandle_(std::move(locationHandle)),
436439 storageFormat_(storageFormat),
@@ -440,6 +443,7 @@ HiveInsertTableHandle::HiveInsertTableHandle(
440443 writerOptions_(writerOptions),
441444 ensureFiles_(ensureFiles),
442445 fileNameGenerator_(std::move(fileNameGenerator)),
446+ storageParameters_(storageParameters),
443447 partitionChannels_(computePartitionChannels(inputColumns_)),
444448 nonPartitionChannels_(computeNonPartitionChannels(inputColumns_)) {
445449 if (compressionKind.has_value ()) {
@@ -1077,7 +1081,8 @@ std::unique_ptr<dwio::common::Writer> HiveDataSink::createWriterForIndex(
10771081 hiveConfig_,
10781082 info->sinkPool .get (),
10791083 ioStats_[writerIndex].get (),
1080- fileSystemStats_.get ()),
1084+ fileSystemStats_.get (),
1085+ insertTableHandle_->storageParameters ()),
10811086 options);
10821087 return maybeCreateBucketSortWriter (writerIndex, std::move (writer));
10831088}
@@ -1369,6 +1374,13 @@ folly::dynamic HiveInsertTableHandle::serialize() const {
13691374 params[key] = value;
13701375 }
13711376 obj[" serdeParameters" ] = params;
1377+
1378+ folly::dynamic storageParams = folly::dynamic::object;
1379+ for (const auto & [key, value] : storageParameters_) {
1380+ storageParams[key] = value;
1381+ }
1382+ obj[" storageParameters" ] = storageParams;
1383+
13721384 obj[" ensureFiles" ] = ensureFiles_;
13731385 obj[" fileNameGenerator" ] = fileNameGenerator_->serialize ();
13741386 return obj;
@@ -1400,6 +1412,13 @@ HiveInsertTableHandlePtr HiveInsertTableHandle::create(
14001412 serdeParameters.emplace (pair.first .asString (), pair.second .asString ());
14011413 }
14021414
1415+ std::unordered_map<std::string, std::string> storageParameters;
1416+ if (obj.count (" storageParameters" ) > 0 ) {
1417+ for (const auto & pair : obj[" storageParameters" ].items ()) {
1418+ storageParameters.emplace (pair.first .asString (), pair.second .asString ());
1419+ }
1420+ }
1421+
14031422 bool ensureFiles = obj[" ensureFiles" ].asBool ();
14041423
14051424 auto fileNameGenerator =
@@ -1413,7 +1432,8 @@ HiveInsertTableHandlePtr HiveInsertTableHandle::create(
14131432 serdeParameters,
14141433 nullptr , // writerOptions is not serializable
14151434 ensureFiles,
1416- fileNameGenerator);
1435+ fileNameGenerator,
1436+ storageParameters);
14171437}
14181438
14191439void HiveInsertTableHandle::registerSerDe () {
0 commit comments