Class IcebergUtil

java.lang.Object
io.trino.plugin.iceberg.IcebergUtil

public final class IcebergUtil extends Object
  • Field Details

  • 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

      public static Map<String,Object> getIcebergTableProperties(org.apache.iceberg.Table icebergTable)
    • 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

      public static org.apache.iceberg.Schema schemaFromHandles(List<IcebergColumnHandle> columns)
    • getIdentityPartitions

      public static Map<org.apache.iceberg.PartitionField,Integer> getIdentityPartitions(org.apache.iceberg.PartitionSpec partitionSpec)
    • primitiveFieldTypes

      public static Map<Integer,org.apache.iceberg.types.Type.PrimitiveType> primitiveFieldTypes(org.apache.iceberg.Schema schema)
    • getFileFormat

      public static IcebergFileFormat getFileFormat(org.apache.iceberg.Table table)
    • getFileFormat

      public static IcebergFileFormat getFileFormat(Map<String,String> storageProperties)
    • getTableComment

      public static Optional<String> getTableComment(org.apache.iceberg.Table table)
    • quotedTableName

      public static String quotedTableName(SchemaTableName name)
    • canEnforceColumnConstraintInSpecs

      public static boolean canEnforceColumnConstraintInSpecs(TypeOperators typeOperators, org.apache.iceberg.Table table, Set<Integer> partitionSpecIds, IcebergColumnHandle columnHandle, Domain domain)
    • deserializePartitionValue

      public static Object deserializePartitionValue(Type type, String valueString, String name)
    • 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. null partition values are represented with Optional.empty().
    • getPartitionKeys

      public static Map<Integer,Optional<String>> getPartitionKeys(org.apache.iceberg.StructLike partition, org.apache.iceberg.PartitionSpec spec)
    • getLocationProvider

      public static org.apache.iceberg.io.LocationProvider getLocationProvider(SchemaTableName schemaTableName, String tableLocation, Map<String,String> storageProperties)
    • schemaFromMetadata

      public static org.apache.iceberg.Schema schemaFromMetadata(List<ColumnMetadata> columns)
    • newCreateTableTransaction

      public static org.apache.iceberg.Transaction newCreateTableTransaction(TrinoCatalog catalog, ConnectorTableMetadata tableMetadata, ConnectorSession session)
    • firstSnapshot

      public static Optional<org.apache.iceberg.Snapshot> firstSnapshot(org.apache.iceberg.Table table)
      Find the first snapshot in the table. First snapshot is the last snapshot in snapshot parents chain starting at Table.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 id baseSnapshotId. Returns empty if table history expiration makes it impossible to find the snapshot.
      Throws:
      IllegalArgumentException - when table has no snapshot, baseSnapshotId is not a valid snapshot in the table or the baseSnapshotId is 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

      public static int parseVersion(String metadataFileName) throws TrinoException
      Throws:
      TrinoException
    • fixBrokenMetadataLocation

      public static String fixBrokenMetadataLocation(String location)
    • fileName

      public static String fileName(String path)
    • commit

      public static void commit(org.apache.iceberg.SnapshotUpdate<?> update, ConnectorSession session)
    • buildTableScan

      public static org.apache.iceberg.TableScan buildTableScan(org.apache.iceberg.Table icebergTable, org.apache.iceberg.MetadataTableType metadataTableType)
    • columnNameToPositionInSchema

      public static Map<String,Integer> columnNameToPositionInSchema(org.apache.iceberg.Schema schema)