Skip to content

Commit 1649365

Browse files
committed
Add write_time_adjusted_to_utc_ property to parquet::ArrowWriterProperties
1 parent 2214848 commit 1649365

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

cpp/src/parquet/properties.h

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,8 @@ class PARQUET_EXPORT ArrowWriterProperties {
11611161
compliant_nested_types_(true),
11621162
engine_version_(V2),
11631163
use_threads_(kArrowDefaultUseThreads),
1164-
executor_(NULLPTR) {}
1164+
executor_(NULLPTR),
1165+
write_time_adjusted_to_utc_(false) {}
11651166
virtual ~Builder() = default;
11661167

11671168
/// \brief Disable writing legacy int96 timestamps (default disabled).
@@ -1256,12 +1257,28 @@ class PARQUET_EXPORT ArrowWriterProperties {
12561257
return this;
12571258
}
12581259

1260+
/// \brief Write time32 and time64 columns whose isAdjustedToUTC field is true.
1261+
///
1262+
/// \note Does not apply to timestamp columns.
1263+
Builder* enable_time_adjusted_to_utc() {
1264+
write_time_adjusted_to_utc_ = true;
1265+
return this;
1266+
}
1267+
1268+
/// \brief Write time32 and time64 columns with isAdjustedToUTC set to false.
1269+
///
1270+
/// \note Does not apply to timestamp columns.
1271+
Builder* disable_time_adjusted_to_utc() {
1272+
write_time_adjusted_to_utc_ = false;
1273+
return this;
1274+
}
1275+
12591276
/// Create the final properties.
12601277
std::shared_ptr<ArrowWriterProperties> build() {
12611278
return std::shared_ptr<ArrowWriterProperties>(new ArrowWriterProperties(
12621279
write_timestamps_as_int96_, coerce_timestamps_enabled_, coerce_timestamps_unit_,
12631280
truncated_timestamps_allowed_, store_schema_, compliant_nested_types_,
1264-
engine_version_, use_threads_, executor_));
1281+
engine_version_, use_threads_, executor_, write_time_adjusted_to_utc_));
12651282
}
12661283

12671284
private:
@@ -1277,6 +1294,8 @@ class PARQUET_EXPORT ArrowWriterProperties {
12771294

12781295
bool use_threads_;
12791296
::arrow::internal::Executor* executor_;
1297+
1298+
bool write_time_adjusted_to_utc_;
12801299
};
12811300

12821301
bool support_deprecated_int96_timestamps() const { return write_timestamps_as_int96_; }
@@ -1310,14 +1329,17 @@ class PARQUET_EXPORT ArrowWriterProperties {
13101329
/// \brief Returns the executor used to write columns in parallel.
13111330
::arrow::internal::Executor* executor() const;
13121331

1332+
bool write_time_adjusted_to_utc() const { return write_time_adjusted_to_utc_; }
1333+
13131334
private:
13141335
explicit ArrowWriterProperties(bool write_nanos_as_int96,
13151336
bool coerce_timestamps_enabled,
13161337
::arrow::TimeUnit::type coerce_timestamps_unit,
13171338
bool truncated_timestamps_allowed, bool store_schema,
13181339
bool compliant_nested_types,
13191340
EngineVersion engine_version, bool use_threads,
1320-
::arrow::internal::Executor* executor)
1341+
::arrow::internal::Executor* executor,
1342+
bool write_time_adjusted_to_utc)
13211343
: write_timestamps_as_int96_(write_nanos_as_int96),
13221344
coerce_timestamps_enabled_(coerce_timestamps_enabled),
13231345
coerce_timestamps_unit_(coerce_timestamps_unit),
@@ -1326,7 +1348,8 @@ class PARQUET_EXPORT ArrowWriterProperties {
13261348
compliant_nested_types_(compliant_nested_types),
13271349
engine_version_(engine_version),
13281350
use_threads_(use_threads),
1329-
executor_(executor) {}
1351+
executor_(executor),
1352+
write_time_adjusted_to_utc_(write_time_adjusted_to_utc) {}
13301353

13311354
const bool write_timestamps_as_int96_;
13321355
const bool coerce_timestamps_enabled_;
@@ -1337,6 +1360,7 @@ class PARQUET_EXPORT ArrowWriterProperties {
13371360
const EngineVersion engine_version_;
13381361
const bool use_threads_;
13391362
::arrow::internal::Executor* executor_;
1363+
const bool write_time_adjusted_to_utc_;
13401364
};
13411365

13421366
/// \brief State object used for writing Arrow data directly to a Parquet

0 commit comments

Comments
 (0)