Skip to content

Commit e933233

Browse files
authored
SQL: Make error msg for validation of 2nd arg of PERCENTILE[_RANK] consistent (#37937)
Use `first` and `second` instead of `1st` and `2nd`.
1 parent 8e5f9c4 commit e933233

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/function/aggregate/Percentile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public Percentile replaceChildren(List<Expression> newChildren) {
4343
@Override
4444
protected TypeResolution resolveType() {
4545
if (!percent.foldable()) {
46-
return new TypeResolution(format(null, "2nd argument of PERCENTILE must be a constant, received [{}]",
46+
return new TypeResolution(format(null, "Second argument of PERCENTILE must be a constant, received [{}]",
4747
Expressions.name(percent)));
4848
}
4949

x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/function/aggregate/PercentileRank.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public Expression replaceChildren(List<Expression> newChildren) {
4343
@Override
4444
protected TypeResolution resolveType() {
4545
if (!value.foldable()) {
46-
return new TypeResolution(format(null, "2nd argument of PERCENTILE_RANK must be a constant, received [{}]",
46+
return new TypeResolution(format(null, "Second argument of PERCENTILE_RANK must be a constant, received [{}]",
4747
Expressions.name(value)));
4848
}
4949

x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/analysis/analyzer/VerifierErrorMessagesTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,12 +538,12 @@ public void testAggsInHistogram() {
538538
}
539539

540540
public void testErrorMessageForPercentileWithSecondArgBasedOnAField() {
541-
assertEquals("1:8: 2nd argument of PERCENTILE must be a constant, received [ABS(int)]",
541+
assertEquals("1:8: Second argument of PERCENTILE must be a constant, received [ABS(int)]",
542542
error("SELECT PERCENTILE(int, ABS(int)) FROM test"));
543543
}
544544

545545
public void testErrorMessageForPercentileRankWithSecondArgBasedOnAField() {
546-
assertEquals("1:8: 2nd argument of PERCENTILE_RANK must be a constant, received [ABS(int)]",
546+
assertEquals("1:8: Second argument of PERCENTILE_RANK must be a constant, received [ABS(int)]",
547547
error("SELECT PERCENTILE_RANK(int, ABS(int)) FROM test"));
548548
}
549549
}

0 commit comments

Comments
 (0)