[jira] [Created] (CALCITE-5507) HAVING alias failed when aggregate function in condition

2023-01-28 Thread Jiajun Xie (Jira)
Jiajun Xie created CALCITE-5507:
---

 Summary: HAVING alias failed when aggregate function in condition
 Key: CALCITE-5507
 URL: https://issues.apache.org/jira/browse/CALCITE-5507
 Project: Calcite
  Issue Type: Improvement
Reporter: Jiajun Xie


We know that calcite can support HAVING alias by setting 
SqlConformanceEnum.LENIENT
{code:java}
sql("select count(empno) as e from emp having e > 10")
.withConformance(lenient).ok(); {code}
but when I add one aggregate function in HAVING clause, it will fail.
{code:java}
sql("select count(empno) as e from emp having ^e^ > 10 and count(empno) > 10 ")
    .withConformance(lenient).fails("Column 'E' not found in any table"); 
// I think it should be ok{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: [ANNOUNCE] Benchao Li joins Calcite PMC

2023-01-28 Thread Gavin Ray
Congratulations Benchao!!!

On Sat, Jan 28, 2023, 9:08 AM Benchao Li  wrote:

> Thanks everyone!
>
> It's a great honor for me to join the Calcite PMC! Looking forward for more
> interactions with the community.
>
>
>
> 163  于2023年1月28日周六 21:45写道:
>
> > Congratulations Benchao!
> >
> > > 2023年1月27日 18:35,Ruben Q L  写道:
> > >
> > > Congratulations Benchao!
> >
> >
>
> --
>
> Best,
> Benchao Li
>


Re: [ANNOUNCE] Benchao Li joins Calcite PMC

2023-01-28 Thread Benchao Li
Thanks everyone!

It's a great honor for me to join the Calcite PMC! Looking forward for more
interactions with the community.



163  于2023年1月28日周六 21:45写道:

> Congratulations Benchao!
>
> > 2023年1月27日 18:35,Ruben Q L  写道:
> >
> > Congratulations Benchao!
>
>

-- 

Best,
Benchao Li


Re: [ANNOUNCE] Benchao Li joins Calcite PMC

2023-01-28 Thread 163
Congratulations Benchao!

> 2023年1月27日 18:35,Ruben Q L  写道:
> 
> Congratulations Benchao!



Re: [ANNOUNCE] Benchao Li joins Calcite PMC

2023-01-28 Thread Jiajun Xie
Congrats, Benchao!

Thanks for your help and your contributions!

On Sat, 28 Jan 2023 at 09:48, Chunwei Lei  wrote:

> Congrats, Benchao!
>
> Best,
> Chunwei
>
>
> On Fri, Jan 27, 2023 at 9:01 PM Michael Mior  wrote:
>
> > Congratulations and welcome Benchao!
> >
> > --
> > Michael Mior
> > mm...@apache.org
> >
> >
> > On Fri, Jan 27, 2023 at 4:51 AM Stamatis Zampetakis 
> > wrote:
> >
> > > I am pleased to announce that Benchao has accepted an invitation to
> join
> > > the Calcite PMC. Benchao has been a consistent and helpful figure in
> > > the Calcite community for which we are very grateful. We look forward
> to
> > > the continued contributions and support.
> > >
> > > Please join me in congratulating Benchao!
> > >
> > > Stamatis (on behalf of the Calcite PMC)
> > >
> >
>


[jira] [Created] (CALCITE-5506) RelToSqlConverter get error result because RelFieldTrimmer lost aggregate function

2023-01-28 Thread Jiajun Xie (Jira)
Jiajun Xie created CALCITE-5506:
---

 Summary: RelToSqlConverter get error result because 
RelFieldTrimmer lost aggregate function
 Key: CALCITE-5506
 URL: https://issues.apache.org/jira/browse/CALCITE-5506
 Project: Calcite
  Issue Type: Improvement
  Components: core
Reporter: Jiajun Xie


Here is a sql

 
{code:java}
select  l.v as l_cost
from    (
            select  0 as v,
                    1 as k
        ) l
join    (
    select  sum("cost") as v,
                    1 as k
    from    (
        select 1 as "cost"
        union
        select 2 as "cost"
        )
) r
on l.k = r.k {code}
Before trimming, the RelNode is 

 

 
{code:java}
LogicalProject(L_COST=[$0])
  LogicalJoin(condition=[=($1, $3)], joinType=[inner])
    LogicalValues(tuples=[[{ 0, 1 }]])
    LogicalProject(V=[$0], K=[1])
      LogicalAggregate(group=[{}], V=[SUM($0)]) 
         LogicalUnion(all=[false])
          LogicalValues(tuples=[[{ 1 }]])
          LogicalValues(tuples=[[{ 2 }]]) {code}
After trimming, the RelNode is

 

 
{code:java}
LogicalProject(L_COST=[$0])
  LogicalJoin(condition=[=($1, $2)], joinType=[inner])
    LogicalValues(tuples=[[{ 0, 1 }]])
    LogicalProject(K=[1]) 
      LogicalAggregate(group=[{}], DUMMY=[COUNT()]) 
        LogicalUnion(all=[false])
          LogicalValues(tuples=[[{ 1 }]])
          LogicalValues(tuples=[[{ 2 }]]){code}
 

If we convert trimmed RelNode to sql, the sql will be
{code:java}
SELECT *
FROM 
  (VALUES (0, 1)) AS "t" ("V", "K")
INNER JOIN 
  (SELECT 1 AS "K" -- Missing SUM()
   FROM (SELECT *
 FROM (VALUES (1)) AS "t" ("cost")
 UNION
 SELECT *
 FROM (VALUES (2)) AS "t" ("cost")) AS "t2"
  ) AS "t4" 
ON "t"."K" = "t4"."K" {code}
The origin sql only has one row result, but the new sql that be trimmed has two 
row result.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: several JavaCC warnings "Choice conflict involving two expansions"

2023-01-28 Thread Alessandro Solimando
Thanks Julian, I have logged CALCITE-5505
 to keep this under our
radar.

Best regards,
Alessandro

On Sat, 28 Jan 2023 at 00:26, Julian Hyde  wrote:

> Good catch. Yes, we want to stay on top of these kinds of warnings.
> (See broken windows theory [1].) Probably introduced by
> https://issues.apache.org/jira/browse/CALCITE-5450. Probably missing
> one or two LOOKAHEAD directives in the parser. Can you log a JIRA case
> please.
>
> Julian
>
> [1] https://en.wikipedia.org/wiki/Broken_windows_theory
>
>
> On Fri, Jan 27, 2023 at 9:50 AM Alessandro Solimando
>  wrote:
> >
> > Hello everyone,
> > while checking CI logs I have noticed that we have lots of JavaCC
> warnings
> > related to ambiguous prefixes in the productions of one of our grammars.
> >
> > They also seem related to time functions, for which I have seen several
> > related developments for BigQuery lately.
> >
> > Have we verified that our grammar is still behaving properly under this
> > situation? Have we considered increasing the lookahead value as
> suggested?
> > Shall we open a Jira ticket to have a closer look?
> >
> > Here is an example of CI logs showing the problem (although it is
> > reproducible locally):
> >
> https://ci-builds.apache.org/job/Calcite/job/Calcite-sonar/job/main/18/consoleFull
> >
> >
> > In what follows the extract that is relevant to the discussion at hand:
> >
> > > > Task :core:javaCCMain
> > > Java Compiler Compiler Version 4.0 (Parser Generator)
> > > (type "javacc" with no arguments for help)
> > > Reading from file
> > >
> /home/jenkins/jenkins-agent/workspace/Calcite_Calcite-sonar_main/core/build/fmpp/fmppMain/javacc/Parser.jj
> > > . . .
> > > Warning: Output directory
> > >
> "/home/jenkins/jenkins-agent/workspace/Calcite_Calcite-sonar_main/core/build/javacc/javaCCMain/org/apache/calcite/sql/parser/impl"
> > > does not exist. Creating the directory.
> > > Note: UNICODE_INPUT option is specified. Please make sure you create
> the
> > > parser/lexer using a Reader with the correct character encoding.
> > > Warning: Choice conflict involving two expansions at
> > >  line 4930, column 5 and line 4956, column 5 respectively.
> > >  A common prefix is: "MICROSECOND"
> > >  Consider using a lookahead of 2 for earlier expansion.
> > > Warning: Choice conflict involving two expansions at
> > >  line 4931, column 5 and line 4956, column 5 respectively.
> > >  A common prefix is: "MILLISECOND"
> > >  Consider using a lookahead of 2 for earlier expansion.
> > > Warning: Choice conflict involving two expansions at
> > >  line 4936, column 5 and line 4956, column 5 respectively.
> > >  A common prefix is: "DOW"
> > >  Consider using a lookahead of 2 for earlier expansion.
> > > Warning: Choice conflict involving two expansions at
> > >  line 4937, column 5 and line 4956, column 5 respectively.
> > >  A common prefix is: "DOY"
> > >  Consider using a lookahead of 2 for earlier expansion.
> > > Warning: Choice conflict involving two expansions at
> > >  line 4938, column 5 and line 4956, column 5 respectively.
> > >  A common prefix is: "ISODOW"
> > >  Consider using a lookahead of 2 for earlier expansion.
> > > Warning: Choice conflict involving two expansions at
> > >  line 4939, column 5 and line 4956, column 5 respectively.
> > >  A common prefix is: "ISOYEAR"
> > >  Consider using a lookahead of 2 for earlier expansion.
> > > Warning: Choice conflict involving two expansions at
> > >  line 4940, column 5 and line 4956, column 5 respectively.
> > >  A common prefix is: "WEEK"
> > >  Consider using a lookahead of 2 for earlier expansion.
> > > Warning: Choice conflict involving two expansions at
> > >  line 4950, column 5 and line 4956, column 5 respectively.
> > >  A common prefix is: "QUARTER"
> > >  Consider using a lookahead of 2 for earlier expansion.
> > > Warning: Choice conflict involving two expansions at
> > >  line 4952, column 5 and line 4956, column 5 respectively.
> > >  A common prefix is: "EPOCH"
> > >  Consider using a lookahead of 2 for earlier expansion.
> > > Warning: Choice conflict involving two expansions at
> > >  line 4953, column 5 and line 4956, column 5 respectively.
> > >  A common prefix is: "DECADE"
> > >  Consider using a lookahead of 2 for earlier expansion.
> > > Warning: Choice conflict involving two expansions at
> > >  line 4954, column 5 and line 4956, column 5 respectively.
> > >  A common prefix is: "CENTURY"
> > >  Consider using a lookahead of 2 for earlier expansion.
> > > Warning: Choice conflict involving two expansions at
> > >  line 4955, column 5 and line 4956, column 5 respectively.
> > >  A common prefix is: "MILLENNIUM"
> > >  

[jira] [Created] (CALCITE-5505) JavaCC warns about missing LOOKAHEAD directives in Parser.jj

2023-01-28 Thread Alessandro Solimando (Jira)
Alessandro Solimando created CALCITE-5505:
-

 Summary: JavaCC warns about missing LOOKAHEAD directives in 
Parser.jj
 Key: CALCITE-5505
 URL: https://issues.apache.org/jira/browse/CALCITE-5505
 Project: Calcite
  Issue Type: Bug
  Components: core
Affects Versions: 1.32.0
Reporter: Alessandro Solimando


JavaCC is reporting several warnings for insufficient lookahead for Parser.jj, 
an example of log displaying the warnings is here: 
[https://ci-builds.apache.org/job/Calcite/job/Calcite-sonar/job/main/18/consoleFull]
 

Here is the relevant extract from the aforementioned log file:
{noformat}
> Task :core:javaCCMain
Java Compiler Compiler Version 4.0 (Parser Generator)
(type "javacc" with no arguments for help)
Reading from file 
/home/jenkins/jenkins-agent/workspace/Calcite_Calcite-sonar_main/core/build/fmpp/fmppMain/javacc/Parser.jj
 . . .
Warning: Output directory 
"/home/jenkins/jenkins-agent/workspace/Calcite_Calcite-sonar_main/core/build/javacc/javaCCMain/org/apache/calcite/sql/parser/impl"
 does not exist. Creating the directory.
Note: UNICODE_INPUT option is specified. Please make sure you create the 
parser/lexer using a Reader with the correct character encoding.
Warning: Choice conflict involving two expansions at
         line 4930, column 5 and line 4956, column 5 respectively.
         A common prefix is: "MICROSECOND"
         Consider using a lookahead of 2 for earlier expansion.
Warning: Choice conflict involving two expansions at
         line 4931, column 5 and line 4956, column 5 respectively.
         A common prefix is: "MILLISECOND"
         Consider using a lookahead of 2 for earlier expansion.
Warning: Choice conflict involving two expansions at
         line 4936, column 5 and line 4956, column 5 respectively.
         A common prefix is: "DOW"
         Consider using a lookahead of 2 for earlier expansion.
Warning: Choice conflict involving two expansions at
         line 4937, column 5 and line 4956, column 5 respectively.
         A common prefix is: "DOY"
         Consider using a lookahead of 2 for earlier expansion.
Warning: Choice conflict involving two expansions at
         line 4938, column 5 and line 4956, column 5 respectively.
         A common prefix is: "ISODOW"
         Consider using a lookahead of 2 for earlier expansion.
Warning: Choice conflict involving two expansions at
         line 4939, column 5 and line 4956, column 5 respectively.
         A common prefix is: "ISOYEAR"
         Consider using a lookahead of 2 for earlier expansion.
Warning: Choice conflict involving two expansions at
         line 4940, column 5 and line 4956, column 5 respectively.
         A common prefix is: "WEEK"
         Consider using a lookahead of 2 for earlier expansion.
Warning: Choice conflict involving two expansions at
         line 4950, column 5 and line 4956, column 5 respectively.
         A common prefix is: "QUARTER"
         Consider using a lookahead of 2 for earlier expansion.
Warning: Choice conflict involving two expansions at
         line 4952, column 5 and line 4956, column 5 respectively.
         A common prefix is: "EPOCH"
         Consider using a lookahead of 2 for earlier expansion.
Warning: Choice conflict involving two expansions at
         line 4953, column 5 and line 4956, column 5 respectively.
         A common prefix is: "DECADE"
         Consider using a lookahead of 2 for earlier expansion.
Warning: Choice conflict involving two expansions at
         line 4954, column 5 and line 4956, column 5 respectively.
         A common prefix is: "CENTURY"
         Consider using a lookahead of 2 for earlier expansion.
Warning: Choice conflict involving two expansions at
         line 4955, column 5 and line 4956, column 5 respectively.
         A common prefix is: "MILLENNIUM"
         Consider using a lookahead of 2 for earlier expansion.
Warning: Choice conflict involving two expansions at
         line 6549, column 9 and line 6551, column 9 respectively.
         A common prefix is: "WEEK" "("
         Consider using a lookahead of 3 or more for earlier expansion.
File "TokenMgrError.java" does not exist.  Will create one.
File "ParseException.java" does not exist.  Will create one.
File "Token.java" does not exist.  Will create one.
File "SimpleCharStream.java" does not exist.  Will create one.
Parser generated with 0 errors and 14 warnings.{noformat}
We are probably missing one or two LOOKAHEAD directives in the parser.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)