Skip to content

Commit

Permalink
[#1317] fix(trino-connector): Support Fixed type conversion (#1318)
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?

1. Suppoort type 'Fixed' in Trino connector `GeneralDataTypeTransformer`
 
### Why are the changes needed?

Fixed type is needed by Iceberg type.

Fix: #1317 

### Does this PR introduce _any_ user-facing change?

N/A

### How was this patch tested?

IT.
  • Loading branch information
yuqi1129 authored and web-flow committed Jan 8, 2024
1 parent 00e5ebb commit 2a029dd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ private ColumnDTO[] createIcebergFullTypeColumns() {
ColumnDTO[] columnDTO = createFullTypeColumns();

Set<String> unsupportedType =
Sets.newHashSet("ByteType", "ShortType", "VarCharType", "FixedCharType", "FixedType");
Sets.newHashSet("ByteType", "ShortType", "VarCharType", "FixedCharType");
return Arrays.stream(columnDTO)
.filter(c -> !unsupportedType.contains(c.name()))
.toArray(ColumnDTO[]::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

/** Type transformer between Hive and Trino */
public class HiveDataTypeTransformer extends GeneralDataTypeTransformer {
// Hive varchar max length of 65535
// Max length of Hive varchar is 65535
private static final int HIVE_VARCHAR_MAX_LENGTH = 65535;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.datastrato.gravitino.rel.types.Type.Name;
import com.datastrato.gravitino.rel.types.Types;
import com.datastrato.gravitino.trino.connector.util.GeneralDataTypeTransformer;
import io.trino.spi.type.VarbinaryType;

/** Type transformer between Iceberg and Trino */
public class IcebergDataTypeTransformer extends GeneralDataTypeTransformer {
Expand All @@ -21,4 +22,12 @@ public Type getGravitinoType(io.trino.spi.type.Type type) {
}
return gravitinoType;
}

@Override
public io.trino.spi.type.Type getTrinoType(Type type) {
if (Name.FIXED == type.name()) {
return VarbinaryType.VARBINARY;
}
return super.getTrinoType(type);
}
}

0 comments on commit 2a029dd

Please sign in to comment.