Skip to content

Commit 6281442

Browse files
authored
Remove parameters from Glue partition columns (#697)
* Remove parameters from partition columns in Glue * fix tests
1 parent 50b33c4 commit 6281442

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

xtable-api/src/main/java/org/apache/xtable/spi/sync/CatalogSync.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ public SyncResult syncTable(
6969
tableIdentifier.getId(),
7070
table.getBasePath(),
7171
table.getTableFormat(),
72-
catalogSyncClient.getClass().getName());
72+
catalogSyncClient.getClass().getName(),
73+
e);
7374
results.add(
7475
getCatalogSyncFailureStatus(
7576
catalogSyncClient.getCatalogId(), catalogSyncClient.getClass().getName(), e));

xtable-aws/src/main/java/org/apache/xtable/glue/GlueSchemaExtractor.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,13 @@ public List<Column> getPartitionColumns(InternalTable table, Map<String, Column>
250250
*/
251251
return getPartitionKeys(table).stream()
252252
.map(
253-
pKey ->
254-
columnsMap.getOrDefault(pKey, Column.builder().name(pKey).type("string").build()))
253+
pKey -> {
254+
Column column = columnsMap.get(pKey);
255+
return Column.builder()
256+
.name(pKey)
257+
.type(column != null ? column.type() : "string")
258+
.build();
259+
})
255260
.collect(Collectors.toList());
256261
}
257262

xtable-aws/src/test/java/org/apache/xtable/glue/GlueCatalogSyncTestBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public class GlueCatalogSyncTestBase {
9696
getInternalField("booleanField", "boolean", InternalType.BOOLEAN)))
9797
.build();
9898
protected static final List<Column> PARTITION_KEYS =
99-
Collections.singletonList(getColumn(TableFormat.DELTA, "partitionField", "string"));
99+
Collections.singletonList(getColumn("partitionField", "string"));
100100
protected static final List<Column> DELTA_GLUE_SCHEMA =
101101
Arrays.asList(
102102
getColumn(TableFormat.DELTA, "intField", "int"),

xtable-aws/src/test/java/org/apache/xtable/glue/TestGlueSchemaExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public class TestGlueSchemaExtractor extends TestSchemaExtractorBase {
9292
.partitionFieldNames(Collections.singletonList("dateOfBirth"))
9393
.build();
9494

95-
private static Column getColumn(String name, String type) {
95+
public static Column getColumn(String name, String type) {
9696
return Column.builder().name(name).type(type).build();
9797
}
9898

0 commit comments

Comments
 (0)