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

rongr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new eed8e233ea [backward compat] fix catalog skipping (#9069)
eed8e233ea is described below

commit eed8e233ea99762c5e3f00377d97824dffda8187
Author: Rong Rong <[email protected]>
AuthorDate: Mon Jul 18 21:07:36 2022 -0700

    [backward compat] fix catalog skipping (#9069)
    
    Co-authored-by: Rong Rong <[email protected]>
---
 pinot-common/src/main/codegen/config.fmpp                      |  2 +-
 .../org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java   | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/pinot-common/src/main/codegen/config.fmpp 
b/pinot-common/src/main/codegen/config.fmpp
index c83241a6a1..0b1f558e89 100644
--- a/pinot-common/src/main/codegen/config.fmpp
+++ b/pinot-common/src/main/codegen/config.fmpp
@@ -164,7 +164,7 @@ data: {
       "DEC"
       "DECIMAL"
       "DECLARE"
-#     "DEFAULT"
+      "DEFAULT_"
       "DEFERRABLE"
       "DEFERRED"
 #     "DEFINE"
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 a022d1bb8f..cd88b02d8a 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
@@ -2501,6 +2501,16 @@ public class CalciteSqlCompilerTest {
     Assert.assertTrue(pinotQuery.getQueryOptions().containsKey("skipUpsert"));
   }
 
+  @Test
+  public void testCatalogNameResolvedToDefault() {
+    // Pinot doesn't support catalog. However, for backward compatibility, if 
a catalog is provided, we will resolve
+    // the table from our default catalog. this means `a.foo` will be 
equivalent to `foo`.
+    PinotQuery randomCatalogQuery = 
CalciteSqlParser.compileToPinotQuery("SELECT count(*) FROM rand_catalog.foo");
+    PinotQuery defaultCatalogQuery = 
CalciteSqlParser.compileToPinotQuery("SELECT count(*) FROM default.foo");
+    Assert.assertEquals(randomCatalogQuery.getDataSource().getTableName(), 
"rand_catalog.foo");
+    Assert.assertEquals(defaultCatalogQuery.getDataSource().getTableName(), 
"default.foo");
+  }
+
   @Test
   public void testInvalidQueryWithSemicolon() {
     Assert.expectThrows(SqlCompilationException.class, () -> 
CalciteSqlParser.compileToPinotQuery(";"));


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to