You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xi...@apache.org on 2020/08/28 20:08:59 UTC

[incubator-pinot] branch fixing_transform_udf_parsing_in_calcite_sql created (now 9a0f765)

This is an automated email from the ASF dual-hosted git repository.

xiangfu pushed a change to branch fixing_transform_udf_parsing_in_calcite_sql
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git.


      at 9a0f765  Fixing the issue that transform UDFs are parsed as function name 'OTHER', not the real function names

This branch includes the following new commits:

     new 9a0f765  Fixing the issue that transform UDFs are parsed as function name 'OTHER', not the real function names

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[incubator-pinot] 01/01: Fixing the issue that transform UDFs are parsed as function name 'OTHER', not the real function names

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiangfu pushed a commit to branch fixing_transform_udf_parsing_in_calcite_sql
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 9a0f765ab6ea0e0f310718ba6434da5061ce55a3
Author: Xiang Fu <fx...@gmail.com>
AuthorDate: Fri Aug 28 13:08:33 2020 -0700

    Fixing the issue that transform UDFs are parsed as function name 'OTHER', not the real function names
---
 .../java/org/apache/pinot/sql/parsers/CalciteSqlParser.java |  1 +
 .../apache/pinot/sql/parsers/CalciteSqlCompilerTest.java    | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java b/pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
index 883834e..5275a1a 100644
--- a/pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
+++ b/pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
@@ -767,6 +767,7 @@ public class CalciteSqlParser {
           functionName = AggregationFunctionType.COUNT.name();
         }
         break;
+      case OTHER:
       case OTHER_FUNCTION:
         functionName = functionNode.getOperator().getName().toUpperCase();
         break;
diff --git a/pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java b/pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java
index 25203f2..c025d6b 100644
--- a/pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java
@@ -731,6 +731,19 @@ public class CalciteSqlCompilerTest {
   }
 
   @Test
+  public void testTimeTransformFunction() {
+    PinotQuery pinotQuery = CalciteSqlParser
+        .compileToPinotQuery("  select hour(ts), d1, sum(m1) from baseballStats group by hour(ts), d1");
+    Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperator(), "HOUR");
+    Assert.assertEquals(pinotQuery.getSelectList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "ts");
+    Assert.assertEquals(pinotQuery.getSelectList().get(1).getIdentifier().getName(), "d1");
+    Assert.assertEquals(pinotQuery.getSelectList().get(2).getFunctionCall().getOperator(), "SUM");
+    Assert.assertEquals(pinotQuery.getGroupByList().get(0).getFunctionCall().getOperator(), "HOUR");
+    Assert.assertEquals(pinotQuery.getGroupByList().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(), "ts");
+    Assert.assertEquals(pinotQuery.getGroupByList().get(1).getIdentifier().getName(), "d1");
+  }
+
+  @Test
   public void testSqlDistinctQueryCompilation() {
     // test single column DISTINCT
     String sql = "SELECT DISTINCT c1 FROM foo";


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