Re: JDBC limit in sub query - use row_number and filter

2019-04-15 Thread Andrew O
Thanks for the pointers, I'll take a further look. Andrew On Mon, 15 Apr 2019, 20:08 Julian Hyde, wrote: > If you decide to write a RelOptRule, your rule could perhaps match > RelNode(Sort) rather than Sort, and therefore the rule will not fire at the > top-level. > > However, you could also d

Re: What is the exactly definition as an equi join ?

2019-04-15 Thread Yuzhao Chen
Now many compute engine do not use Calcite EnumerableXXXs and only use the logical node for planning, after all, the Enumerables are implementations are only specific to Calcite, I still think Calcite need to give more accurate definitions for what equi join is. Best, Danny Chan 在 2019年4月16日 +0

[jira] [Created] (CALCITE-3004) ProjectSetOpTransposeRule pushes RexOver down incorrectly

2019-04-15 Thread Hongze Zhang (JIRA)
Hongze Zhang created CALCITE-3004: - Summary: ProjectSetOpTransposeRule pushes RexOver down incorrectly Key: CALCITE-3004 URL: https://issues.apache.org/jira/browse/CALCITE-3004 Project: Calcite

Re: How to rewrite <>ANY subqueries

2019-04-15 Thread Julian Hyde
If you are lucky, it will be sufficient to use the the same intermediate values that are used to execute NOT IN: * does the value occur in the sub-query? * how many values does the sub-query return? * how many null values does the sub-query return? If you know that x is not one of the values retur

How to rewrite <>ANY subqueries

2019-04-15 Thread Vineet Garg
Hello folks, I am currently stuck on a problem and I wonder if the SQL folks here could help me make progress. There is a bug in CALCITE where subqueries with =ANY and <>ANY are transformed incorrectly (CALCITE-2986 ). I was able to figure out

[jira] [Created] (CALCITE-3003) AssertionError when GROUP BY nested field

2019-04-15 Thread Will Yu (JIRA)
Will Yu created CALCITE-3003: Summary: AssertionError when GROUP BY nested field Key: CALCITE-3003 URL: https://issues.apache.org/jira/browse/CALCITE-3003 Project: Calcite Issue Type: Improvement

[jira] [Created] (CALCITE-3002) Case statement fails with: SqlValidatorException: Cannot apply '=' to arguments of type ' = '.

2019-04-15 Thread Egor Ryashin (JIRA)
Egor Ryashin created CALCITE-3002: - Summary: Case statement fails with: SqlValidatorException: Cannot apply '=' to arguments of type ' = '. Key: CALCITE-3002 URL: https://issues.apache.org/jira/browse/CALCITE-3002

Re: JDBC limit in sub query - use row_number and filter

2019-04-15 Thread Julian Hyde
If you decide to write a RelOptRule, your rule could perhaps match RelNode(Sort) rather than Sort, and therefore the rule will not fire at the top-level. However, you could also do the transformation on RelToSqlConverter, which is a more conventional visitor; you can look at the stack to see wh

JDBC limit in sub query - use row_number and filter

2019-04-15 Thread Andrew O
I am trying out Calcite against a DBMS that does not support the limit syntax in nested / sub queries. (The JOOQ blog captures more details / examples at: https://www.jooq.org/doc/3.1/manual/sql-building/sql-statements/select-statement/limit-clause/#N467A6 ) I'm interested in how I could have si

Re: Join, SemiJoin, Correlate

2019-04-15 Thread Julian Hyde
I haven’t reviewed the change, but let’s strike a balance between backwards compatibility and progress. We should allow breaking changes if they make a significant improvement. Of course we should mark APIs deprecated for one or two releases, if possible. > On Apr 15, 2019, at 2:01 AM, Yuzhao

[jira] [Created] (CALCITE-3001) Upgrade to Apache Druid 0.14.0-incubating

2019-04-15 Thread Nishant Bangarwa (JIRA)
Nishant Bangarwa created CALCITE-3001: - Summary: Upgrade to Apache Druid 0.14.0-incubating Key: CALCITE-3001 URL: https://issues.apache.org/jira/browse/CALCITE-3001 Project: Calcite Issue

Re: What is the exactly definition as an equi join ?

2019-04-15 Thread Ruben Q L
Danny, I have seen the full picture and I have actually changed mind: If I am not mistaken, currently the way to make your example (and mine) to work as an EquiJoin is using intermediate projections (so that RexCall / RexFieldAccess "becomes" RexInputRef): Select A.a, B.b from A join B on cast(A.

Re: What is the exactly definition as an equi join ?

2019-04-15 Thread Yuzhao Chen
Thx Ruben, the issue really answer my questions, I encounter this when dong CALCITE-2969, when I refactor SemiJoinRule, I think not only RexFieldAccess, any RexCall should fit into this case, only if the RexCall function is deterministic, what do you think ? Best, Danny Chan 在 2019年4月15日 +0800

Re: What is the exactly definition as an equi join ?

2019-04-15 Thread Ruben Q L
Danny, In the context of https://issues.apache.org/jira/browse/CALCITE-2898, a discussion about this topic was started. In that ticket I pointed out that Calcite does not recognize "RexFieldAccess = RexInputRef" as an EquiJoin condition (even though the RexFieldAccess itself is referencing a RexInp

Re: What is the exactly definition as an equi join ?

2019-04-15 Thread Yuzhao Chen
For the example I gave, the join condition is push down with RelOptUtil.pushDownJoinConditions(), but when we new a join info [1], we only decide if the join is EquiJoin if all the operands of operator <=> is inputRef, which is the question i ask here. [1]  https://github.com/apache/calcite/blo

Re: What is the exactly definition as an equi join ?

2019-04-15 Thread Xiening Dai
I think Calcite always pushes down equal join conditions. In SqlToRelConverter.createJoin(), before ruction returns, it calls RelOptUtil.pushDownJoinConditions(). So in your example, the cast expression will be pushed down and it will still be an equal join. > On Apr 15, 2019, at 5:40 PM, Yuzha

What is the exactly definition as an equi join ?

2019-04-15 Thread Yuzhao Chen
If we checkout the java doc for Calcite EuqiJoin, there is definition for it: > for any join whose condition is based on column equality But what about if there are function calls in the equi condition operands ? For example: Should we consider Select A.a, B.b from A join B on cast(A.a as int) =

Re: Join, SemiJoin, Correlate

2019-04-15 Thread Yuzhao Chen
I also have this question when i was doing this patch, cause Enumerable nodes are physical operators(implementation) and should be specific to Calcite. So in the beginning i didn’t classify them as public APIs and only keep the constructors and methods for logical nodes. Well this searching is

[jira] [Created] (CALCITE-3000) Improve SqlUserDefinedFunction and SqlUserDefinedTableFunction to support override method call

2019-04-15 Thread pengzhiwei (JIRA)
pengzhiwei created CALCITE-3000: --- Summary: Improve SqlUserDefinedFunction and SqlUserDefinedTableFunction to support override method call Key: CALCITE-3000 URL: https://issues.apache.org/jira/browse/CALCITE-3000

[jira] [Created] (CALCITE-2999) Can't get the right column value in LogicalSort

2019-04-15 Thread yuqi (JIRA)
yuqi created CALCITE-2999: - Summary: Can't get the right column value in LogicalSort Key: CALCITE-2999 URL: https://issues.apache.org/jira/browse/CALCITE-2999 Project: Calcite Issue Type: Bug