HuaHuaY commented on code in PR #50807:
URL: https://github.com/apache/arrow/pull/50807#discussion_r3805461857
##########
cpp/src/parquet/metadata.cc:
##########
@@ -2101,16 +2063,22 @@ class FileMetaDataBuilder::FileMetaDataBuilderImpl {
metadata_->__set_version(file_version);
metadata_->__set_created_by(properties_->created_by());
- // Users cannot set the `ColumnOrder` since we do not have user defined
sort order
- // in the spec yet.
- // We always default to `TYPE_DEFINED_ORDER`. We can expose it in
- // the API once we have user defined sort orders in the Parquet format.
- // TypeDefinedOrder implies choose SortOrder based on
ConvertedType/PhysicalType
- format::TypeDefinedOrder type_defined_order;
- format::ColumnOrder column_order;
- column_order.__set_TYPE_ORDER(type_defined_order);
- column_order.__isset.TYPE_ORDER = true;
- metadata_->column_orders.resize(schema_->num_columns(), column_order);
+ metadata_->column_orders.reserve(schema_->num_columns());
+ for (int column_index = 0; column_index < schema_->num_columns();
++column_index) {
+ format::ColumnOrder column_order;
+ switch (schema_->Column(column_index)->column_order().get_order()) {
+ case ColumnOrder::TYPE_DEFINED_ORDER:
+ column_order.__set_TYPE_ORDER(format::TypeDefinedOrder{});
+ break;
+ case ColumnOrder::IEEE_754_TOTAL_ORDER:
+ column_order.__set_IEEE_754_TOTAL_ORDER(format::IEEE754TotalOrder{});
+ break;
+ case ColumnOrder::UNDEFINED:
Review Comment:
Here is writer-only code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]