[opt](paimon) support mapping Paimon column type "Row" to Doris type "Struct" (#34239)

backport: #33786
This commit is contained in:
苏小刚
2024-04-28 19:38:50 +08:00
committed by GitHub
parent 1fda68f738
commit 11039ade7b
5 changed files with 42 additions and 6 deletions

View File

@ -39,9 +39,12 @@ import org.apache.paimon.types.ArrayType;
import org.apache.paimon.types.DataField;
import org.apache.paimon.types.DecimalType;
import org.apache.paimon.types.MapType;
import org.apache.paimon.types.RowType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
public class PaimonExternalTable extends ExternalTable {
@ -131,6 +134,13 @@ public class PaimonExternalTable extends ExternalTable {
MapType mapType = (MapType) dataType;
return new org.apache.doris.catalog.MapType(
paimonTypeToDorisType(mapType.getKeyType()), paimonTypeToDorisType(mapType.getValueType()));
case ROW:
RowType rowType = (RowType) dataType;
List<DataField> fields = rowType.getFields();
return new org.apache.doris.catalog.StructType(fields.stream()
.map(field -> new org.apache.doris.catalog.StructField(field.name(),
paimonTypeToDorisType(field.type())))
.collect(Collectors.toCollection(ArrayList::new)));
case TIME_WITHOUT_TIME_ZONE:
return Type.UNSUPPORTED;
default: