Jackie-Jiang commented on a change in pull request #4216: PQL -> SQL 
enhancement - phase 1 - new Pinot Query Struct
URL: https://github.com/apache/incubator-pinot/pull/4216#discussion_r290997224
 
 

 ##########
 File path: 
pinot-common/src/main/java/org/apache/pinot/common/request/transform/TransformExpressionTree.java
 ##########
 @@ -75,34 +104,27 @@ public static String getStandardExpression(AstNode 
astNode) {
     }
   }
 
-  // Enum for expression represented by the tree.
-  public enum ExpressionType {
-    FUNCTION, IDENTIFIER, LITERAL
-  }
-
-  private final ExpressionType _expressionType;
-  private final String _value;
-  private final List<TransformExpressionTree> _children;
-
-  public TransformExpressionTree(AstNode root) {
-    if (root instanceof FunctionCallAstNode) {
-      _expressionType = ExpressionType.FUNCTION;
-      _value = ((FunctionCallAstNode) root).getName().toLowerCase();
-      _children = new ArrayList<>();
-      for (AstNode child : root.getChildren()) {
-        _children.add(new TransformExpressionTree(child));
+  public static Expression getExpression(AstNode astNode) {
+    if (astNode instanceof IdentifierAstNode) {
+      // Column name
+      return RequestUtils.getIdentifierExpression(((IdentifierAstNode) 
astNode).getName());
+    } else if (astNode instanceof FunctionCallAstNode) {
+      // Function expression
+      Expression expression =
+          RequestUtils.getFunctionExpression(((FunctionCallAstNode) 
astNode).getName());
+      Function func = expression.getFunctionCall();
+      if (astNode.getChildren() != null) {
 
 Review comment:
   (nit) cache "astNode.getChildren()"?

----------------------------------------------------------------
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


With regards,
Apache Git Services

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

Reply via email to