/** * Convert from data source to partitionInfo. * * @param segment segment object * @return partition info object */ public PartitionInfo getPartitionInfoFromSegment(final Segment segment) { final Map<String, String> metadata = new HashMap<>(); metadata.put(DruidConfigConstants.LOADSPEC_KEY, segment.getLoadSpec().getKeys().toString()); metadata.put(DruidConfigConstants.LOADSPEC_BUCKET, segment.getLoadSpec().getBucket()); metadata.put(DruidConfigConstants.LOADSPEC_TYPE, segment.getLoadSpec().getType()); metadata.put(DruidConfigConstants.DIMENSIONS, segment.getDimensions()); metadata.put(DruidConfigConstants.METRICS, segment.getMetric()); final StorageInfo storageInfo = StorageInfo.builder().uri(segment.getLoadSpec().getUri()).build(); return PartitionInfo.builder().metadata(metadata).serde(storageInfo).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(); }
/** * 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(); }
tableName.getTableName(), partitionName)) .serde(StorageInfo.builder().uri( getIcebergPartitionURI(tableName.getDatabaseName(), tableName.getTableName(),
tableName.getTableName(), partitionName)) .serde(StorageInfo.builder().uri( getIcebergPartitionURI(tableName.getDatabaseName(), tableName.getTableName(),
private StorageInfo toStorageInfo(final StorageDescriptor sd, final String owner) { if (sd == null) { return new StorageInfo(); } if (sd.getSerdeInfo() != null) { return StorageInfo.builder().owner(owner) .uri(sd.getLocation()) .inputFormat(sd.getInputFormat()) .outputFormat(sd.getOutputFormat()) .parameters(sd.getParameters()) .serializationLib(sd.getSerdeInfo().getSerializationLib()) .serdeInfoParameters(sd.getSerdeInfo().getParameters()) .build(); } return StorageInfo.builder().owner(owner).uri(sd.getLocation()).inputFormat(sd.getInputFormat()) .outputFormat(sd.getOutputFormat()).parameters(sd.getParameters()).build(); }
private StorageInfo toStorageInfo(final StorageDescriptor sd, final String owner) { if (sd == null) { return new StorageInfo(); } if (sd.getSerdeInfo() != null) { return StorageInfo.builder().owner(owner) .uri(sd.getLocation()) .inputFormat(sd.getInputFormat()) .outputFormat(sd.getOutputFormat()) .parameters(sd.getParameters()) .serializationLib(sd.getSerdeInfo().getSerializationLib()) .serdeInfoParameters(sd.getSerdeInfo().getParameters()) .build(); } return StorageInfo.builder().owner(owner).uri(sd.getLocation()).inputFormat(sd.getInputFormat()) .outputFormat(sd.getOutputFormat()).parameters(sd.getParameters()).build(); }