Skip to content

Commit

Permalink
[BugFix] Fix create table use order by case sensitive
Browse files Browse the repository at this point in the history
Signed-off-by: meegoo <[email protected]>
  • Loading branch information
meegoo committed Oct 31, 2024
1 parent 3b3a67f commit 4b34b73
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import javax.validation.constraints.NotNull;

public class OlapTableFactory implements AbstractTableFactory {
Expand Down Expand Up @@ -179,7 +180,9 @@ public Table createTable(LocalMetastore metastore, Database db, CreateTableStmt
Set<Integer> addedSortKey = new HashSet<>();
List<String> baseSchemaNames = baseSchema.stream().map(Column::getName).collect(Collectors.toList());
for (String column : stmt.getSortKeys()) {
int idx = baseSchemaNames.indexOf(column);
int idx = IntStream.range(0, baseSchemaNames.size())
.filter(i -> baseSchemaNames.get(i).equalsIgnoreCase(column))
.findFirst().orElse(-1);
if (idx == -1) {
throw new DdlException("Invalid column '" + column + "': not exists in all columns.");
}
Expand Down

0 comments on commit 4b34b73

Please sign in to comment.