SQL: Make error msg for validation of 2nd arg of PERCENTILE[_RANK] consistent (#37937)

Use `first` and `second` instead of `1st` and `2nd`.
This commit is contained in:
Marios Trivyzas 2019-01-29 21:20:09 +02:00 committed by GitHub
parent 8e5f9c4b14
commit e9332331a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -43,7 +43,7 @@ public class Percentile extends NumericAggregate implements EnclosedAgg {
@Override
protected TypeResolution resolveType() {
if (!percent.foldable()) {
return new TypeResolution(format(null, "2nd argument of PERCENTILE must be a constant, received [{}]",
return new TypeResolution(format(null, "Second argument of PERCENTILE must be a constant, received [{}]",
Expressions.name(percent)));
}

View File

@ -43,7 +43,7 @@ public class PercentileRank extends AggregateFunction implements EnclosedAgg {
@Override
protected TypeResolution resolveType() {
if (!value.foldable()) {
return new TypeResolution(format(null, "2nd argument of PERCENTILE_RANK must be a constant, received [{}]",
return new TypeResolution(format(null, "Second argument of PERCENTILE_RANK must be a constant, received [{}]",
Expressions.name(value)));
}

View File

@ -538,12 +538,12 @@ public class VerifierErrorMessagesTests extends ESTestCase {
}
public void testErrorMessageForPercentileWithSecondArgBasedOnAField() {
assertEquals("1:8: 2nd argument of PERCENTILE must be a constant, received [ABS(int)]",
assertEquals("1:8: Second argument of PERCENTILE must be a constant, received [ABS(int)]",
error("SELECT PERCENTILE(int, ABS(int)) FROM test"));
}
public void testErrorMessageForPercentileRankWithSecondArgBasedOnAField() {
assertEquals("1:8: 2nd argument of PERCENTILE_RANK must be a constant, received [ABS(int)]",
assertEquals("1:8: Second argument of PERCENTILE_RANK must be a constant, received [ABS(int)]",
error("SELECT PERCENTILE_RANK(int, ABS(int)) FROM test"));
}
}