Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ public void validatePartitionInfo(
}
List<ColumnDefinition> partitionInSchema = columns.subList(
columns.size() - partitionColumns.size(), columns.size());
if (partitionInSchema.stream().anyMatch(p -> !partitionColumns.contains(p.getName()))) {
throw new AnalysisException("The partition field must be at the end of the schema.");
}
for (int i = 0; i < partitionInSchema.size(); i++) {
if (!partitionColumns.contains(partitionInSchema.get(i).getName())) {
throw new AnalysisException("The partition field must be at the end of the schema.");
}
if (!partitionInSchema.get(i).getName().equals(partitionColumns.get(i))) {
throw new AnalysisException("The order of partition fields in the schema "
+ "must be consistent with the order defined in `PARTITIONED BY LIST()`");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -884,5 +884,19 @@ public void testPartitionCheckForHive() {
} catch (Exception e) {
Assertions.assertEquals("partition key par1 is not exists", e.getMessage());
}

try {
getCreateTableStmt("CREATE TABLE `tb11`(\n"
+ " `c1` bigint,\n"
+ " `par1` int,\n"
+ " `par2` int,\n"
+ " `par3` int\n"
+ ") ENGINE = hive PARTITION BY LIST (\n"
+ " par1, par2\n"
+ ")();");
Assertions.assertTrue(false);
} catch (Exception e) {
Assertions.assertEquals("The partition field must be at the end of the schema.", e.getMessage());
}
}
}