[GitHub] [incubator-pinot] npawar commented on a change in pull request #5406: Adding support to execute functions during query compilation

2020-05-22 Thread GitBox


npawar commented on a change in pull request #5406:
URL: https://github.com/apache/incubator-pinot/pull/5406#discussion_r429501906



##
File path: 
pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
##
@@ -593,29 +596,77 @@ private static Expression toExpression(SqlNode node) {
   // Move on to process default logic.
 }
   default:
-SqlBasicCall funcSqlNode = (SqlBasicCall) node;
-String funcName = funcSqlNode.getOperator().getKind().name();
-if (funcSqlNode.getOperator().getKind() == SqlKind.OTHER_FUNCTION) {
-  funcName = funcSqlNode.getOperator().getName();
+return evaluateFunctionExpression((SqlBasicCall) node);
+}
+  }
+
+  private static String extractFunctionName(SqlBasicCall funcSqlNode) {
+String funcName = funcSqlNode.getOperator().getKind().name();
+if (funcSqlNode.getOperator().getKind() == SqlKind.OTHER_FUNCTION) {
+  funcName = funcSqlNode.getOperator().getName();
+}
+if (funcName.equalsIgnoreCase(SqlKind.COUNT.toString()) && 
(funcSqlNode.getFunctionQuantifier() != null)

Review comment:
   i didn't quite follow why there is special casing for  DISTINCTCOUNT ?





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:
us...@infra.apache.org



-
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org



[GitHub] [incubator-pinot] npawar commented on a change in pull request #5406: Adding support to execute functions during query compilation

2020-05-22 Thread GitBox


npawar commented on a change in pull request #5406:
URL: https://github.com/apache/incubator-pinot/pull/5406#discussion_r429500477



##
File path: 
pinot-common/src/main/java/org/apache/pinot/common/function/DateTimeFunctions.java
##
@@ -216,4 +217,18 @@ static String toDateTime(Long millis, String pattern) {
   static Long fromDateTime(String dateTimeString, String pattern) {
 return 
DateTimePatternHandler.parseDateTimeStringToEpochMillis(dateTimeString, 
pattern);
   }
+
+  /**
+   * Return current time as epoch millis
+   */
+  static Long now() {
+return System.currentTimeMillis();
+  }
+
+  /**
+   * Return epoch millis value based on a given date time string and it's 
corresponding format.
+   */
+  public static Long formatDatetime(String input, String format) {

Review comment:
   this function is the same as `fromDateTime` on line 217. Do we need both?





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:
us...@infra.apache.org



-
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org