[DISCUSS] Towards Calcite 1.22.0

2020-02-19 Thread Danny Chan
Hi all, Approximately 5 months have passed from the previous release (Calcite 1.21.0) and I was thinking that it is the time to have the next release by the end of February. To do this I think we should try to have an RC around the 24 of February(the next Monday). The progress towards the next

How to optimize repeated RelNode Structures? (CALCITE-3806)

2020-02-19 Thread Anjali Shrishrimal
Hi everybody, I would like to have your suggestions on CALCITE-3806. Asking it here as suggested by Julian. If RelNode tree contains a subtree whose result can be obtained by some other part of the same tree, can we optimize it ? and how to express it in plan ? For example, Let's say

[DISCUSS] Towards Calcite 1.22.0

2020-02-19 Thread Danny Chan
Hi all, Approximately 5 months have passed from the previous release (Calcite 1.21.0) and I was thinking that it is the time to have the next release by the end of February. To do this I think we should try to have an RC around the 24 of February(the next Monday). The progress towards the next

[DISCUSS] Towards Calcite 1.22.0

2020-02-19 Thread Danny Chan
Hi all, Approximately 5 months has passed from the previous release (Calcite 1.21.0) and I was thinking that it is the time to have the next release by the end of February. To do this I think we should try to have an RC around the 24 of  February(the next Monday). The progress towards the next

Calcite equivalent for Select CONVERT date formatter

2020-02-19 Thread Suresh Krishnan
Hi Team, We are having trouble finding the right approach to convert the date fields using calcite. We are looking for something that will give us the below SQL equivalent SELECT CONVERT(varchar(12), GETDATE(), 101) - 06/29/2009 We have tried creating a rexNode using

Calcite-Master - Build # 1615 - Failure

2020-02-19 Thread Apache Jenkins Server
The Apache Jenkins build system has built Calcite-Master (build #1615) Status: Failure Check console output at https://builds.apache.org/job/Calcite-Master/1615/ to view the results.

Re: limitations on the SQLs executed

2020-02-19 Thread Yang Liu
Hi all, Dive into docs and I find the getJoinRowCount seems the very thing I am

Re: How to trace a column back to its original column

2020-02-19 Thread JiaTao Tao
Hi Igor org.apache.calcite.rel.metadata.RelMetadataQuery#getColumnOrigins may help Regards! Aron Tao Seliverstov Igor 于2020年2月19日周三 下午11:16写道: > This case each NID column is a calculated value - origin erases. > > You may try to infer origin walking through SQL AST recursively > > I can’t

[jira] [Created] (CALCITE-3807) checkForSatisfiedConverters() is unnecessary

2020-02-19 Thread Xiening Dai (Jira)
Xiening Dai created CALCITE-3807: Summary: checkForSatisfiedConverters() is unnecessary Key: CALCITE-3807 URL: https://issues.apache.org/jira/browse/CALCITE-3807 Project: Calcite Issue

Re: Translation of SQL EXISTS

2020-02-19 Thread Julian Hyde
Agreed, it should be in reverse order. Translate to semi-join (or anti-join for NOT EXISTS), then optionally use a rule to rewrite semi- or anti-join to Join+Aggregate. Note that if the EXISTS is in a disjunction (e.g. "delete from orders where exists (select null from order_items where ...) or

Re: Re: Translation of SQL EXISTS

2020-02-19 Thread Haisheng Yuan
Hi Christian, Yes, I do agree it is better to generate SEMI/ANTI during Sql-to-Rel conversion if possible. With regard to the missing Rel-to-Sql conversion for SEMI/ANTI joins, you can log a JIRA and open a pull request for it, people are happy to take a look. - Haisheng

Re: Translation of SQL EXISTS

2020-02-19 Thread Christian Beikov
Hey Haisheng, it is nice to have a rule that detects such patterns but do you agree that it would be better to generate SEMI- and ANTI-joins already during Sql-to-Rel conversion? I implemented the Rel-to-Sql conversion for SEMI- and ANTI-join and it seems to work for my use cases, but it

Re: How to trace a column back to its original column

2020-02-19 Thread Rui Wang
If you have to traverse the whole AST/Rel tree to find original columns, this thread discussed that before: https://lists.apache.org/thread.html/11b66dd7f389f0b6e6bce54ad2d7b49a8a0bdd3be4784c441bfafb81%40%3Cdev.calcite.apache.org%3E -Rui On Wed, Feb 19, 2020 at 7:16 AM Seliverstov Igor wrote:

Re: Translation of SQL EXISTS

2020-02-19 Thread Haisheng Yuan
Hi Christian, For the query in your example, Calcite first generates inner join plan with aggregate child, then through SemJoinRule transform the inner join to semi or antisemi join. The reason to have inner join is that it allows join commutativity, which is good for generating a potential

Re: Correlation with a variable

2020-02-19 Thread Julian Hyde
When you say "keep the plan as independent as possible from statement and other parts of the execution", if you propose to achieve that by adding names into the RexNodes representing parameters, I don't agree. I think that RelNode/RexNode should operate based on internal offsets (retaining names,

Re: How to trace a column back to its original column

2020-02-19 Thread Seliverstov Igor
This case each NID column is a calculated value - origin erases. You may try to infer origin walking through SQL AST recursively I can’t come up with another way. Regards, Igor > 19 февр. 2020 г., в 15:02, JiaTao Tao написал(а): > > Thanks a lot > > But I found if the select is from the

Build failed in Jenkins: Calcite-Snapshots #115

2020-02-19 Thread Apache Jenkins Server
See Changes: [yuzhao.cyz] Following [CALCITE-3763] Fix slow test failure (DonnyZone) [yuzhao.cyz] [CALCITE-3801] Deprecate SqlToRelConverter.Config#isConvertTableAccess [yuzhao.cyz] [CALCITE-2707] Information

Translation of SQL EXISTS

2020-02-19 Thread Christian Beikov
Hello, I'm a bit confused about how the SQL EXISTS predicate is translated. I'd assume that an EXISTS is translated in relational algebra to a SEMI- and NOT EXISTS to an ANTI-join, but it's not. PlannerImpl p = new PlannerImpl(config); SqlNode sqlNode = p.parse("delete from _order o where

Re: How to trace a column back to its original column

2020-02-19 Thread JiaTao Tao
Thanks a lot But I found if the select is from the subquery, `getFieldOrigins` returns null, because you can not find the table(see in the pic.). String sql = "SELECT T1.NAME,\n" + " T1.NID,\n" + " T2.NID,\n" + " T2.COMPANY\n"

Re: How to trace a column back to its original column

2020-02-19 Thread JiaTao Tao
Thanks a lot! seems I can use org.apache.calcite.rel.metadata.RelMetadataQuery#getColumnOrigin. Regards! Aron Tao Walaa Eldin Moustafa 于2020年2月19日周三 下午2:36写道: > You might check out this class [1]. > > [1] >

[jira] [Created] (CALCITE-3806) How to optimize repeated RelNode Structures ?

2020-02-19 Thread anjali shrishrimal (Jira)
anjali shrishrimal created CALCITE-3806: --- Summary: How to optimize repeated RelNode Structures ? Key: CALCITE-3806 URL: https://issues.apache.org/jira/browse/CALCITE-3806 Project: Calcite

Re: How to trace a column back to its original column

2020-02-19 Thread Seliverstov Igor
Aron Tao, I think you need the next two methods: org.apache.calcite.sql.validate.SqlValidatorImpl#getFieldOrigins java.sql.ResultSetMetaData#getTableName Regards, Igor > 19 февр. 2020 г., в 10:29, JiaTao Tao написал(а): > > Hi > Thanks a lot. > Can you give more details, say which

Re: Correlation with a variable

2020-02-19 Thread Stamatis Zampetakis
I don't know if there is already an issue around this topic, I think not. Now regarding point (b) I would prefer to keep the plan as independent as possible from statement and other parts of the execution. Other than that I encountered a few use-cases where named parameters may be a better fit:

Parse PostgreSQL query using Calcite-BABEL

2020-02-19 Thread Shivraj Singh
Hi, Need little more help like I am using calcite-babel for parsing the query: I have a SQL query: *select * from my_table1 dwm INNER JOIN my_table2 wl ON (dwm.id = wl.id ) where dwm.time - 'timeinterval'::interval* and this is my config for using BABEL: *