in src/main/java/org/apache/paimon/trino/TrinoMetadata.java [115:141]
public Optional<ConnectorTableLayout> getInsertLayout(
ConnectorSession session, ConnectorTableHandle tableHandle) {
TrinoTableHandle trinoTableHandle = (TrinoTableHandle) tableHandle;
Table table = trinoTableHandle.table(catalog);
if (!(table instanceof FileStoreTable)) {
throw new IllegalArgumentException(table.getClass() + " is not supported");
}
FileStoreTable storeTable = (FileStoreTable) table;
BucketMode bucketMode = storeTable.bucketMode();
switch (bucketMode) {
case HASH_FIXED:
try {
return Optional.of(
new ConnectorTableLayout(
new TrinoPartitioningHandle(
InstantiationUtil.serializeObject(storeTable.schema())),
storeTable.schema().bucketKeys(),
false));
} catch (IOException e) {
throw new RuntimeException(e);
}
case BUCKET_UNAWARE:
return Optional.empty();
default:
throw new IllegalArgumentException("Unknown table bucket mode: " + bucketMode);
}
}