[bugfix](hive)fix the error message when creating hive table for 2.1 (#35975)

bp #35833
This commit is contained in:
wuwenchi
2024-06-06 16:32:10 +08:00
committed by GitHub
parent cd808c3ea0
commit 726377a65c
2 changed files with 17 additions and 3 deletions

View File

@ -204,10 +204,10 @@ public class PartitionTableInfo {
}
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()`");