/** * Converts IcebergTable to TableDto. * * @param name qualified name * @param table iceberg table object * @param tableLoc iceberg table metadata location * @param auditInfo audit information * @return Metacat table Info */ public TableInfo fromIcebergTableToTableInfo(final QualifiedName name, final com.netflix.iceberg.Table table, final String tableLoc, final AuditInfo auditInfo) { final List<FieldInfo> allFields = this.hiveTypeConverter.icebergeSchemaTofieldDtos(table.schema(), table.spec().fields()); final Map<String, String> tableParameters = new HashMap<>(); tableParameters.put(DirectSqlTable.PARAM_TABLE_TYPE, DirectSqlTable.ICEBERG_TABLE_TYPE); tableParameters.put(DirectSqlTable.PARAM_METADATA_LOCATION, tableLoc); //adding iceberg table properties tableParameters.putAll(table.properties()); return TableInfo.builder().fields(allFields) .metadata(tableParameters) .serde(StorageInfo.builder().uri(table.location()).build()) .name(name).auditInfo(auditInfo) .build(); }
/** * Converts IcebergTable to TableDto. * * @param name qualified name * @param table iceberg table object * @param tableLoc iceberg table metadata location * @param auditInfo audit information * @return Metacat table Info */ public TableInfo fromIcebergTableToTableInfo(final QualifiedName name, final com.netflix.iceberg.Table table, final String tableLoc, final AuditInfo auditInfo) { final List<FieldInfo> allFields = this.hiveTypeConverter.icebergeSchemaTofieldDtos(table.schema(), table.spec().fields()); final Map<String, String> tableParameters = new HashMap<>(); tableParameters.put(DirectSqlTable.PARAM_TABLE_TYPE, DirectSqlTable.ICEBERG_TABLE_TYPE); tableParameters.put(DirectSqlTable.PARAM_METADATA_LOCATION, tableLoc); //adding iceberg table properties tableParameters.putAll(table.properties()); return TableInfo.builder().fields(allFields) .metadata(tableParameters) .serde(StorageInfo.builder().uri(table.location()).build()) .name(name).auditInfo(auditInfo) .build(); }
if (null != table.getTableType() && table.getTableType().equals(TableType.VIRTUAL_VIEW.name())) { return TableInfo.builder() .serde(toStorageInfo(table.getSd(), table.getOwner())).fields(allFields) .metadata(table.getParameters()).name(name).auditInfo(auditInfo) .view(ViewInfo.builder(). } else { return TableInfo.builder() .serde(toStorageInfo(table.getSd(), table.getOwner())).fields(allFields) .metadata(table.getParameters()).name(name).auditInfo(auditInfo) .build();
if (null != table.getTableType() && table.getTableType().equals(TableType.VIRTUAL_VIEW.name())) { return TableInfo.builder() .serde(toStorageInfo(table.getSd(), table.getOwner())).fields(allFields) .metadata(table.getParameters()).name(name).auditInfo(auditInfo) .view(ViewInfo.builder(). } else { return TableInfo.builder() .serde(toStorageInfo(table.getSd(), table.getOwner())).fields(allFields) .metadata(table.getParameters()).name(name).auditInfo(auditInfo) .build();
@Override public TableInfo toTableInfo(final QualifiedName tableName, final Table table) { return TableInfo.builder().name(tableName).fields(toFields(table)).auditInfo(toAuditInfo(table)) .serde(toStorageInfo(table)).build(); }