a-rafay commented on a change in pull request #2444:
URL: https://github.com/apache/calcite/pull/2444#discussion_r658340696
##########
File path:
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
##########
@@ -1500,6 +1504,37 @@ private void handleOffsetFetch(@Nullable SqlNode offset,
@Nullable SqlNode fetch
return node;
}
+ private void validatePercentileFunctions(SqlCall call) {
+ if (call.getOperandList().size() == 2) {
+ SqlBasicCall sqlBasicCall = null;
+ SqlNodeList list = null;
+ SqlNode node1 = call.getOperandList().get(0);
+ SqlNode node2 = call.getOperandList().get(1);
+ if (node1 instanceof SqlBasicCall) {
+ sqlBasicCall = (SqlBasicCall) node1;
+ } else if (node2 instanceof SqlBasicCall) {
+ sqlBasicCall = (SqlBasicCall) node2;
+ }
+ if (node1 instanceof SqlNodeList) {
+ list = (SqlNodeList) node1;
+ } else if (node2 instanceof SqlNodeList) {
+ list = (SqlNodeList) node2;
+ }
+
+ if (sqlBasicCall != null && list != null
+ && sqlBasicCall.getOperator() instanceof SqlBasicAggFunction) {
+ SqlBasicAggFunction agg = (SqlBasicAggFunction)
sqlBasicCall.getOperator();
+ if (agg.isPercentile()) {
+ // Validate that Percentile function have a single ORDER BY
expression
+ if (list.getList().size() != 1) {
Review comment:
I figured it out. Let me know if the new place for validating this seems
ok.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]