Jibing-Li commented on code in PR #12833:
URL: https://github.com/apache/doris/pull/12833#discussion_r976674691


##########
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:
   I suppose here should use fixed precision and scale as well? 27, 9



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to