AshinGau commented on code in PR #12833:
URL: https://github.com/apache/doris/pull/12833#discussion_r976552276
##########
be/src/vec/exec/format/parquet/schema_desc.cpp:
##########
@@ -150,6 +152,70 @@ void FieldDescriptor::parse_physical_field(const
tparquet::SchemaElement& physic
physical_field->physical_type = physical_schema.type;
_physical_fields.push_back(physical_field);
physical_field->physical_column_index = _physical_fields.size() - 1;
+ if (physical_schema.__isset.logicalType) {
+ physical_field->type =
convert_to_doris_type(physical_schema.logicalType);
+ } else if (physical_schema.__isset.converted_type) {
+ physical_field->type =
convert_to_doris_type(physical_schema.converted_type);
+ }
+}
+
+TypeDescriptor FieldDescriptor::convert_to_doris_type(tparquet::LogicalType
logicalType) {
+ TypeDescriptor type;
+ if (logicalType.__isset.STRING) {
+ // TODO: len?
+ type.type = TYPE_STRING;
+ } else if (logicalType.__isset.DECIMAL) {
+ type.type = TYPE_DECIMALV2;
+ type.precision = logicalType.DECIMAL.precision;
+ type.scale = logicalType.DECIMAL.scale;
+ } else if (logicalType.__isset.DATE) {
+ type.type = TYPE_DATE;
+ } else if (logicalType.__isset.INTEGER) {
+ type.type = TYPE_INT;
+ } else if (logicalType.__isset.TIME) {
+ type.type = TYPE_TIMEV2;
+ } else if (logicalType.__isset.TIMESTAMP) {
+ type.type = TYPE_DATETIMEV2;
+ } else {
+ LOG(WARNING) << "Not supported parquet LogicalType";
+ }
+ return type;
+}
+
+TypeDescriptor
FieldDescriptor::convert_to_doris_type(tparquet::ConvertedType::type
convertedType) {
+ TypeDescriptor type;
+ switch (convertedType) {
+ case tparquet::ConvertedType::type::DECIMAL:
+ // TODO: precision and scale?
Review Comment:
`FieldSchema.parquet_schema` has precision and scale.
##########
be/src/vec/exec/format/parquet/schema_desc.cpp:
##########
@@ -150,6 +152,70 @@ void FieldDescriptor::parse_physical_field(const
tparquet::SchemaElement& physic
physical_field->physical_type = physical_schema.type;
_physical_fields.push_back(physical_field);
physical_field->physical_column_index = _physical_fields.size() - 1;
+ if (physical_schema.__isset.logicalType) {
+ physical_field->type =
convert_to_doris_type(physical_schema.logicalType);
+ } else if (physical_schema.__isset.converted_type) {
+ physical_field->type =
convert_to_doris_type(physical_schema.converted_type);
+ }
+}
+
+TypeDescriptor FieldDescriptor::convert_to_doris_type(tparquet::LogicalType
logicalType) {
+ TypeDescriptor type;
+ if (logicalType.__isset.STRING) {
+ // TODO: len?
+ type.type = TYPE_STRING;
+ } else if (logicalType.__isset.DECIMAL) {
+ type.type = TYPE_DECIMALV2;
Review Comment:
`TYPE_DECIMALV2` has fixed precision and scale
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]