Skip to content

Commit

Permalink
Support automatic type coercion in Delta table creation
Browse files Browse the repository at this point in the history
  • Loading branch information
krvikash authored and Praveen2112 committed Mar 21, 2024
1 parent f7db654 commit e9adf94
Show file tree
Hide file tree
Showing 2 changed files with 306 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
import static io.trino.spi.type.IntegerType.INTEGER;
import static io.trino.spi.type.RealType.REAL;
import static io.trino.spi.type.SmallintType.SMALLINT;
import static io.trino.spi.type.TimestampType.TIMESTAMP_MICROS;
import static io.trino.spi.type.TinyintType.TINYINT;
import static io.trino.spi.type.TypeUtils.isFloatingPointNaN;
import static io.trino.spi.type.VarbinaryType.VARBINARY;
Expand Down Expand Up @@ -607,6 +608,15 @@ public ConnectorTableProperties getTableProperties(ConnectorSession session, Con
ImmutableList.of());
}

@Override
public Optional<Type> getSupportedType(ConnectorSession session, Map<String, Object> tableProperties, Type type)
{
if (type instanceof TimestampType) {
return Optional.of(TIMESTAMP_MICROS);
}
return Optional.empty();
}

@Override
public SchemaTableName getTableName(ConnectorSession session, ConnectorTableHandle table)
{
Expand Down
Loading

0 comments on commit e9adf94

Please sign in to comment.