Package io.trino.plugin.iceberg
Class IcebergUtil
java.lang.Object
io.trino.plugin.iceberg.IcebergUtil
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.iceberg.TableScanbuildTableScan(org.apache.iceberg.Table icebergTable, org.apache.iceberg.MetadataTableType metadataTableType) static booleancanEnforceColumnConstraintInSpecs(TypeOperators typeOperators, org.apache.iceberg.Table table, Set<Integer> partitionSpecIds, IcebergColumnHandle columnHandle, Domain domain) columnNameToPositionInSchema(org.apache.iceberg.Schema schema) static voidcommit(org.apache.iceberg.SnapshotUpdate<?> update, ConnectorSession session) static ObjectdeserializePartitionValue(Type type, String valueString, String name) static Stringstatic Optional<org.apache.iceberg.Snapshot>firstSnapshot(org.apache.iceberg.Table table) Find the first snapshot in the table.static Optional<org.apache.iceberg.Snapshot>firstSnapshotAfter(org.apache.iceberg.Table table, long baseSnapshotId) static StringfixBrokenMetadataLocation(String location) static IcebergColumnHandlegetColumnHandle(org.apache.iceberg.types.Types.NestedField column, TypeManager typeManager) static List<ColumnMetadata>getColumnMetadatas(org.apache.iceberg.Schema schema, TypeManager typeManager) static List<IcebergColumnHandle>getColumns(org.apache.iceberg.Schema schema, TypeManager typeManager) static IcebergFileFormatgetFileFormat(Map<String, String> storageProperties) static IcebergFileFormatgetFileFormat(org.apache.iceberg.Table table) getIcebergTableProperties(org.apache.iceberg.Table icebergTable) static org.apache.iceberg.TablegetIcebergTableWithMetadata(TrinoCatalog catalog, IcebergTableOperationsProvider tableOperationsProvider, ConnectorSession session, SchemaTableName table, org.apache.iceberg.TableMetadata tableMetadata) getIdentityPartitions(org.apache.iceberg.PartitionSpec partitionSpec) static org.apache.iceberg.io.LocationProvidergetLocationProvider(SchemaTableName schemaTableName, String tableLocation, Map<String, String> storageProperties) getPartitionKeys(org.apache.iceberg.FileScanTask scanTask) Returns a map from fieldId to serialized partition value containing entries for all identity partitions.getPartitionKeys(org.apache.iceberg.StructLike partition, org.apache.iceberg.PartitionSpec spec) static longgetSnapshotIdAsOfTime(org.apache.iceberg.Table table, long epochMillis) getTableComment(org.apache.iceberg.Table table) static org.apache.iceberg.TableloadIcebergTable(TrinoCatalog catalog, IcebergTableOperationsProvider tableOperationsProvider, ConnectorSession session, SchemaTableName table) static org.apache.iceberg.TransactionnewCreateTableTransaction(TrinoCatalog catalog, ConnectorTableMetadata tableMetadata, ConnectorSession session) static intparseVersion(String metadataFileName) primitiveFieldTypes(org.apache.iceberg.Schema schema) static Stringstatic org.apache.iceberg.SchemaschemaFromHandles(List<IcebergColumnHandle> columns) static org.apache.iceberg.SchemaschemaFromMetadata(List<ColumnMetadata> columns) static voidvalidateTableCanBeDropped(org.apache.iceberg.Table table)
-
Field Details
-
TRINO_TABLE_METADATA_INFO_VALID_FOR
- See Also:
-
COLUMN_TRINO_NOT_NULL_PROPERTY
- See Also:
-
COLUMN_TRINO_TYPE_ID_PROPERTY
- See Also:
-
METADATA_FOLDER_NAME
- See Also:
-
METADATA_FILE_EXTENSION
- See Also:
-
-
Method Details
-
loadIcebergTable
public static org.apache.iceberg.Table loadIcebergTable(TrinoCatalog catalog, IcebergTableOperationsProvider tableOperationsProvider, ConnectorSession session, SchemaTableName table) -
getIcebergTableWithMetadata
public static org.apache.iceberg.Table getIcebergTableWithMetadata(TrinoCatalog catalog, IcebergTableOperationsProvider tableOperationsProvider, ConnectorSession session, SchemaTableName table, org.apache.iceberg.TableMetadata tableMetadata) -
getIcebergTableProperties
-
getColumns
public static List<IcebergColumnHandle> getColumns(org.apache.iceberg.Schema schema, TypeManager typeManager) -
getColumnMetadatas
public static List<ColumnMetadata> getColumnMetadatas(org.apache.iceberg.Schema schema, TypeManager typeManager) -
getColumnHandle
public static IcebergColumnHandle getColumnHandle(org.apache.iceberg.types.Types.NestedField column, TypeManager typeManager) -
schemaFromHandles
-
getIdentityPartitions
-
primitiveFieldTypes
-
getFileFormat
-
getFileFormat
-
getTableComment
-
quotedTableName
-
canEnforceColumnConstraintInSpecs
public static boolean canEnforceColumnConstraintInSpecs(TypeOperators typeOperators, org.apache.iceberg.Table table, Set<Integer> partitionSpecIds, IcebergColumnHandle columnHandle, Domain domain) -
deserializePartitionValue
-
getPartitionKeys
public static Map<Integer,Optional<String>> getPartitionKeys(org.apache.iceberg.FileScanTask scanTask) Returns a map from fieldId to serialized partition value containing entries for all identity partitions.nullpartition values are represented withOptional.empty(). -
getPartitionKeys
-
getLocationProvider
public static org.apache.iceberg.io.LocationProvider getLocationProvider(SchemaTableName schemaTableName, String tableLocation, Map<String, String> storageProperties) -
schemaFromMetadata
-
newCreateTableTransaction
public static org.apache.iceberg.Transaction newCreateTableTransaction(TrinoCatalog catalog, ConnectorTableMetadata tableMetadata, ConnectorSession session) -
firstSnapshot
Find the first snapshot in the table. First snapshot is the last snapshot in snapshot parents chain starting atTable.currentSnapshot().- Returns:
- First (oldest) Snapshot reachable from
Table.currentSnapshot()or empty if table history expiration makes it impossible to find the snapshot. - Throws:
IllegalArgumentException- when table has no snapshot.
-
firstSnapshotAfter
public static Optional<org.apache.iceberg.Snapshot> firstSnapshotAfter(org.apache.iceberg.Table table, long baseSnapshotId) - Returns:
- First (oldest) snapshot that is reachable from
Table.currentSnapshot()but is not reachable from snapshot with idbaseSnapshotId. Returns empty if table history expiration makes it impossible to find the snapshot. - Throws:
IllegalArgumentException- when table has no snapshot,baseSnapshotIdis not a valid snapshot in the table or thebaseSnapshotIdis the current snapshot.
-
getSnapshotIdAsOfTime
public static long getSnapshotIdAsOfTime(org.apache.iceberg.Table table, long epochMillis) -
validateTableCanBeDropped
public static void validateTableCanBeDropped(org.apache.iceberg.Table table) -
parseVersion
- Throws:
TrinoException
-
fixBrokenMetadataLocation
-
fileName
-
commit
-
buildTableScan
public static org.apache.iceberg.TableScan buildTableScan(org.apache.iceberg.Table icebergTable, org.apache.iceberg.MetadataTableType metadataTableType) -
columnNameToPositionInSchema
-