[jira] [Commented] (CALCITE-2276) Calcite unable to parse ROW value constructor in certain scenario

2018-04-24 Thread Shuyi Chen (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16451672#comment-16451672
 ] 

Shuyi Chen commented on CALCITE-2276:
-

I recalled in standard SQL, ROW(...) and (...) is equivalent and ROW is 
optional. 

[~michaelmior], [~julianhyde] do you want take on this? Otherwise, I can take a 
look at it while working on 
[CALCITE-2251|https://issues.apache.org/jira/browse/CALCITE-2251] as this will 
need some fix in the parser.

> Calcite unable to parse ROW value constructor in certain scenario
> -
>
> Key: CALCITE-2276
> URL: https://issues.apache.org/jira/browse/CALCITE-2276
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: Shuyi Chen
>Assignee: Julian Hyde
>Priority: Major
>
> h2. Original dev mailing list question:
> Now for our production, we can parse a query successfully like this :
> {code}
> -- correlated IN subquery
> -- TC 01.01
> SELECT t1a,
>t1b,
>t1h
> FROM   t1
> WHERE  ( t1a, t1h ) NOT IN (SELECT t2a,
>t2h
> FROM   t2
> WHERE  t2a = t1a
> ORDER  BY t2a)
> AND t1a = 'val1a'
> {code}
> but if we add in `Row`:
> {code}
> -- correlated IN subquery
> -- TC 01.01
> SELECT t1a,
>t1b,
>t1h
> FROM   t1
> WHERE  ROW( t1a, t1h ) NOT IN (SELECT t2a,
>t2h
> FROM   t2
> WHERE  t2a = t1a
> ORDER  BY t2a)
> AND t1a = 'val1a'
> {code}
>  it will throw exception:
> {noformat}
> Caused by: org.apache.calcite.sql.parser.SqlParseException: ROW expression
> encountered in illegal context
>   at 
> org.apache.calcite.sql.parser.impl.SqlParserImpl.convertException(SqlParserImpl.java:351)
>   at 
> org.apache.calcite.sql.parser.impl.SqlParserImpl.normalizeException(SqlParserImpl.java:133)
>   at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:138)
>   at org.apache.calcite.sql.parser.SqlParser.parseStmt(SqlParser.java:163)
>   at 
> org.apache.flink.table.calcite.FlinkPlannerImpl.parse(FlinkPlannerImpl.scala:81)
> ... 8 more
> {noformat}
> For the success query, if we exec parsed AST tree rootNode.toString(), it
> will return a query like:
> {code}
> SELECT `t1a`,
>`t1b`,
>`t1h`
> FROM `t1`
> WHERE ROW(`t1a`, `t1h`) NOT IN (SELECT `t2a`, `t2h`
> FROM `t2`
> WHERE `t2a` = `t1a`
> ORDER BY `t2a`)
> AND `t1a` = 'val1a'
> {code}
> This is inconsistent  by Calcite itself semantic.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CALCITE-2279) Druid adapter duplicate binary expression

2018-04-24 Thread Kevin Risden (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16451538#comment-16451538
 ] 

Kevin Risden commented on CALCITE-2279:
---

Initially brought up here: 
https://lists.apache.org/thread.html/2dfb83c2a54f82f36bd5bf27f4144fbeee209770fc963f9d92210071@%3Cdev.calcite.apache.org%3E

> Druid adapter duplicate binary expression
> -
>
> Key: CALCITE-2279
> URL: https://issues.apache.org/jira/browse/CALCITE-2279
> Project: Calcite
>  Issue Type: Bug
>  Components: druid
>Reporter: Kevin Risden
>Priority: Major
> Fix For: 1.17.0
>
>
> I was looking into Error Prone [1] checking for Calcite and it found what 
> looks like a bug in Druid Adapter. The output is as follows
>  
> {quote}DruidJsonFilter.java:[324,9] [IdentityBinaryExpression] A binary 
> expression where both operands are the same is usually incorrect; the value 
> of this expression is equivalent to `lhs.getType().getFamily() == 
> SqlTypeFamily.NUMERIC`.
> [ERROR]     (see 
> [http://errorprone.info/bugpattern/IdentityBinaryExpression]){quote}
>  
> The DruidJsonFilter [2] has left and right hand the exact same.
>  
> [1] [http://errorprone.info/]
> [2] 
> [https://github.com/apache/calcite/blob/master/druid/src/main/java/org/apache/calcite/adapter/druid/DruidJsonFilter.java#L323]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (CALCITE-2279) Druid adapter duplicate binary expression

2018-04-24 Thread Kevin Risden (JIRA)

 [ 
https://issues.apache.org/jira/browse/CALCITE-2279?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kevin Risden updated CALCITE-2279:
--
Summary: Druid adapter duplicate binary expression  (was: Druid adapter 
duplicates binary expression)

> Druid adapter duplicate binary expression
> -
>
> Key: CALCITE-2279
> URL: https://issues.apache.org/jira/browse/CALCITE-2279
> Project: Calcite
>  Issue Type: Bug
>  Components: druid
>Reporter: Kevin Risden
>Priority: Major
> Fix For: 1.17.0
>
>
> I was looking into Error Prone [1] checking for Calcite and it found what 
> looks like a bug in Druid Adapter. The output is as follows
>  
> {quote}DruidJsonFilter.java:[324,9] [IdentityBinaryExpression] A binary 
> expression where both operands are the same is usually incorrect; the value 
> of this expression is equivalent to `lhs.getType().getFamily() == 
> SqlTypeFamily.NUMERIC`.
> [ERROR]     (see 
> [http://errorprone.info/bugpattern/IdentityBinaryExpression]){quote}
>  
> The DruidJsonFilter [2] has left and right hand the exact same.
>  
> [1] [http://errorprone.info/]
> [2] 
> [https://github.com/apache/calcite/blob/master/druid/src/main/java/org/apache/calcite/adapter/druid/DruidJsonFilter.java#L323]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Assigned] (CALCITE-2279) Druid adapter duplicates binary expression

2018-04-24 Thread Kevin Risden (JIRA)

 [ 
https://issues.apache.org/jira/browse/CALCITE-2279?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kevin Risden reassigned CALCITE-2279:
-

Assignee: (was: Julian Hyde)

> Druid adapter duplicates binary expression
> --
>
> Key: CALCITE-2279
> URL: https://issues.apache.org/jira/browse/CALCITE-2279
> Project: Calcite
>  Issue Type: Bug
>  Components: druid
>Reporter: Kevin Risden
>Priority: Major
> Fix For: 1.17.0
>
>
> I was looking into Error Prone [1] checking for Calcite and it found what 
> looks like a bug in Druid Adapter. The output is as follows
>  
> {quote}DruidJsonFilter.java:[324,9] [IdentityBinaryExpression] A binary 
> expression where both operands are the same is usually incorrect; the value 
> of this expression is equivalent to `lhs.getType().getFamily() == 
> SqlTypeFamily.NUMERIC`.
> [ERROR]     (see 
> [http://errorprone.info/bugpattern/IdentityBinaryExpression]){quote}
>  
> The DruidJsonFilter [2] has left and right hand the exact same.
>  
> [1] [http://errorprone.info/]
> [2] 
> [https://github.com/apache/calcite/blob/master/druid/src/main/java/org/apache/calcite/adapter/druid/DruidJsonFilter.java#L323]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (CALCITE-2279) Druid adapter duplicates binary expression

2018-04-24 Thread Kevin Risden (JIRA)
Kevin Risden created CALCITE-2279:
-

 Summary: Druid adapter duplicates binary expression
 Key: CALCITE-2279
 URL: https://issues.apache.org/jira/browse/CALCITE-2279
 Project: Calcite
  Issue Type: Bug
  Components: druid
Reporter: Kevin Risden
Assignee: Julian Hyde
 Fix For: 1.17.0


I was looking into Error Prone [1] checking for Calcite and it found what looks 
like a bug in Druid Adapter. The output is as follows
 
{quote}DruidJsonFilter.java:[324,9] [IdentityBinaryExpression] A binary 
expression where both operands are the same is usually incorrect; the value of 
this expression is equivalent to `lhs.getType().getFamily() == 
SqlTypeFamily.NUMERIC`.
[ERROR]     (see 
[http://errorprone.info/bugpattern/IdentityBinaryExpression]){quote}
 
The DruidJsonFilter [2] has left and right hand the exact same.
 
[1] [http://errorprone.info/]
[2] 
[https://github.com/apache/calcite/blob/master/druid/src/main/java/org/apache/calcite/adapter/druid/DruidJsonFilter.java#L323]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (CALCITE-2278) AggregateJoinTransposeRule fails to split agg call for unique input with agg call

2018-04-24 Thread Haisheng Yuan (JIRA)

 [ 
https://issues.apache.org/jira/browse/CALCITE-2278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Haisheng Yuan updated CALCITE-2278:
---
Description: 
For the following query:
{code:java}
select A.job, B.mgr, A.deptno,
 max(B.hiredate1) as hiredate1, sum(B.comm1) as comm1
 from sales.emp as A
 join (select mgr, sal, max(hiredate) as hiredate1,
 sum(comm) as comm1 from sales.emp group by mgr, sal) as B
 on A.sal=B.sal
 group by A.job, B.mgr, A.deptno{code}
 

Exception is thrown out:

 

 
{noformat}
java.lang.IndexOutOfBoundsException: index (7) must be less than size (6)
at 
com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:310)
 at 
com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:293)
 at 
com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:67)
 at 
org.apache.calcite.sql.SqlSplittableAggFunction$AbstractSumSplitter.topSplit(SqlSplittableAggFunction.java:246)
 at 
org.apache.calcite.rel.rules.AggregateJoinTransposeRule.onMatch(AggregateJoinTransposeRule.java:332)
 at 
org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:317)
 at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:556)
 at org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:415)
 at 
org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:252)
 at 
org.apache.calcite.plan.hep.HepInstruction$RuleInstance.execute(HepInstruction.java:127)
 at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:211)
 at org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:198)
 at 
org.apache.calcite.test.RelOptTestBase.checkPlanning(RelOptTestBase.java:170)
 
{noformat}
 

  was:
For the following query:

```

select A.job, B.mgr, A.deptno,
max(B.hiredate1) as hiredate1, sum(B.comm1) as comm1
from sales.emp as A
join (select mgr, sal, max(hiredate) as hiredate1,
 sum(comm) as comm1 from sales.emp group by mgr, sal) as B
on A.sal=B.sal
group by A.job, B.mgr, A.deptno

```

 

Exception is thrown out:

```

java.lang.IndexOutOfBoundsException: index (7) must be less than size (6)

at 
com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:310)
 at 
com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:293)
 at 
com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:67)
 at 
org.apache.calcite.sql.SqlSplittableAggFunction$AbstractSumSplitter.topSplit(SqlSplittableAggFunction.java:246)
 at 
org.apache.calcite.rel.rules.AggregateJoinTransposeRule.onMatch(AggregateJoinTransposeRule.java:332)
 at 
org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:317)
 at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:556)
 at org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:415)
 at 
org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:252)
 at 
org.apache.calcite.plan.hep.HepInstruction$RuleInstance.execute(HepInstruction.java:127)
 at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:211)
 at org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:198)
 at 
org.apache.calcite.test.RelOptTestBase.checkPlanning(RelOptTestBase.java:170)

```


> AggregateJoinTransposeRule fails to split agg call for unique input with agg 
> call
> -
>
> Key: CALCITE-2278
> URL: https://issues.apache.org/jira/browse/CALCITE-2278
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: Haisheng Yuan
>Assignee: Julian Hyde
>Priority: Major
>
> For the following query:
> {code:java}
> select A.job, B.mgr, A.deptno,
>  max(B.hiredate1) as hiredate1, sum(B.comm1) as comm1
>  from sales.emp as A
>  join (select mgr, sal, max(hiredate) as hiredate1,
>  sum(comm) as comm1 from sales.emp group by mgr, sal) as B
>  on A.sal=B.sal
>  group by A.job, B.mgr, A.deptno{code}
>  
> Exception is thrown out:
>  
>  
> {noformat}
> java.lang.IndexOutOfBoundsException: index (7) must be less than size (6)
> at 
> com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:310)
>  at 
> com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:293)
>  at 
> com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:67)
>  at 
> org.apache.calcite.sql.SqlSplittableAggFunction$AbstractSumSplitter.topSplit(SqlSplittableAggFunction.java:246)
>  at 
> org.apache.calcite.rel.rules.AggregateJoinTransposeRule.onMatch(AggregateJoinTransposeRule.java:332)
>  at 
> org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:317)
>  at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:556)
>  at 

[jira] [Updated] (CALCITE-2278) AggregateJoinTransposeRule fails to split agg call for unique input with agg call

2018-04-24 Thread Haisheng Yuan (JIRA)

 [ 
https://issues.apache.org/jira/browse/CALCITE-2278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Haisheng Yuan updated CALCITE-2278:
---
Description: 
For the following query:
{code:java}
select A.job, B.mgr, A.deptno,
 max(B.hiredate1) as hiredate1, sum(B.comm1) as comm1
 from sales.emp as A
 join (select mgr, sal, max(hiredate) as hiredate1,
 sum(comm) as comm1 from sales.emp group by mgr, sal) as B
 on A.sal=B.sal
 group by A.job, B.mgr, A.deptno{code}
 

Exception is thrown out: 
{noformat}
java.lang.IndexOutOfBoundsException: index (7) must be less than size (6)
at 
com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:310)
 at 
com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:293)
 at 
com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:67)
 at 
org.apache.calcite.sql.SqlSplittableAggFunction$AbstractSumSplitter.topSplit(SqlSplittableAggFunction.java:246)
 at 
org.apache.calcite.rel.rules.AggregateJoinTransposeRule.onMatch(AggregateJoinTransposeRule.java:332)
 at 
org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:317)
 at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:556)
 at org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:415)
 at 
org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:252)
 at 
org.apache.calcite.plan.hep.HepInstruction$RuleInstance.execute(HepInstruction.java:127)
 at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:211)
 at org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:198)
 at 
org.apache.calcite.test.RelOptTestBase.checkPlanning(RelOptTestBase.java:170)
 
{noformat}
 

  was:
For the following query:
{code:java}
select A.job, B.mgr, A.deptno,
 max(B.hiredate1) as hiredate1, sum(B.comm1) as comm1
 from sales.emp as A
 join (select mgr, sal, max(hiredate) as hiredate1,
 sum(comm) as comm1 from sales.emp group by mgr, sal) as B
 on A.sal=B.sal
 group by A.job, B.mgr, A.deptno{code}
 

Exception is thrown out:

 

 
{noformat}
java.lang.IndexOutOfBoundsException: index (7) must be less than size (6)
at 
com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:310)
 at 
com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:293)
 at 
com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:67)
 at 
org.apache.calcite.sql.SqlSplittableAggFunction$AbstractSumSplitter.topSplit(SqlSplittableAggFunction.java:246)
 at 
org.apache.calcite.rel.rules.AggregateJoinTransposeRule.onMatch(AggregateJoinTransposeRule.java:332)
 at 
org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:317)
 at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:556)
 at org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:415)
 at 
org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:252)
 at 
org.apache.calcite.plan.hep.HepInstruction$RuleInstance.execute(HepInstruction.java:127)
 at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:211)
 at org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:198)
 at 
org.apache.calcite.test.RelOptTestBase.checkPlanning(RelOptTestBase.java:170)
 
{noformat}
 


> AggregateJoinTransposeRule fails to split agg call for unique input with agg 
> call
> -
>
> Key: CALCITE-2278
> URL: https://issues.apache.org/jira/browse/CALCITE-2278
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: Haisheng Yuan
>Assignee: Julian Hyde
>Priority: Major
>
> For the following query:
> {code:java}
> select A.job, B.mgr, A.deptno,
>  max(B.hiredate1) as hiredate1, sum(B.comm1) as comm1
>  from sales.emp as A
>  join (select mgr, sal, max(hiredate) as hiredate1,
>  sum(comm) as comm1 from sales.emp group by mgr, sal) as B
>  on A.sal=B.sal
>  group by A.job, B.mgr, A.deptno{code}
>  
> Exception is thrown out: 
> {noformat}
> java.lang.IndexOutOfBoundsException: index (7) must be less than size (6)
> at 
> com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:310)
>  at 
> com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:293)
>  at 
> com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:67)
>  at 
> org.apache.calcite.sql.SqlSplittableAggFunction$AbstractSumSplitter.topSplit(SqlSplittableAggFunction.java:246)
>  at 
> org.apache.calcite.rel.rules.AggregateJoinTransposeRule.onMatch(AggregateJoinTransposeRule.java:332)
>  at 
> org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:317)
>  at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:556)
>  at 

[jira] [Created] (CALCITE-2278) AggregateJoinTransposeRule fails to split agg call for unique input with agg call

2018-04-24 Thread Haisheng Yuan (JIRA)
Haisheng Yuan created CALCITE-2278:
--

 Summary: AggregateJoinTransposeRule fails to split agg call for 
unique input with agg call
 Key: CALCITE-2278
 URL: https://issues.apache.org/jira/browse/CALCITE-2278
 Project: Calcite
  Issue Type: Bug
  Components: core
Reporter: Haisheng Yuan
Assignee: Julian Hyde


For the following query:

```

select A.job, B.mgr, A.deptno,
max(B.hiredate1) as hiredate1, sum(B.comm1) as comm1
from sales.emp as A
join (select mgr, sal, max(hiredate) as hiredate1,
 sum(comm) as comm1 from sales.emp group by mgr, sal) as B
on A.sal=B.sal
group by A.job, B.mgr, A.deptno

```

 

Exception is thrown out:

```

java.lang.IndexOutOfBoundsException: index (7) must be less than size (6)

at 
com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:310)
 at 
com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:293)
 at 
com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:67)
 at 
org.apache.calcite.sql.SqlSplittableAggFunction$AbstractSumSplitter.topSplit(SqlSplittableAggFunction.java:246)
 at 
org.apache.calcite.rel.rules.AggregateJoinTransposeRule.onMatch(AggregateJoinTransposeRule.java:332)
 at 
org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:317)
 at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:556)
 at org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:415)
 at 
org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:252)
 at 
org.apache.calcite.plan.hep.HepInstruction$RuleInstance.execute(HepInstruction.java:127)
 at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:211)
 at org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:198)
 at 
org.apache.calcite.test.RelOptTestBase.checkPlanning(RelOptTestBase.java:170)

```



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CALCITE-2277) Skip SemiJoin operator in materialized view-based rewriting algorithm

2018-04-24 Thread Julian Hyde (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2277?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16450205#comment-16450205
 ] 

Julian Hyde commented on CALCITE-2277:
--

We knew that making SemiJoin extend Join was going to cause these kinds of 
problems. (Not that it was the wrong decision.) [~jcamachorodriguez], can you 
do a quick scan of other rules to see if this problem might exist elsewhere.

> Skip SemiJoin operator in materialized view-based rewriting algorithm
> -
>
> Key: CALCITE-2277
> URL: https://issues.apache.org/jira/browse/CALCITE-2277
> Project: Calcite
>  Issue Type: Bug
>Affects Versions: 1.16.0
>Reporter: Jesus Camacho Rodriguez
>Assignee: Jesus Camacho Rodriguez
>Priority: Major
> Fix For: 1.17.0
>
>
> {{AbstractMaterializedViewRule}} is not recognizing the difference between 
> SemiJoin and Join operator, since SemiJoin inherits from Join. This can lead 
> to incorrect rewriting and errors in the rewriting logic.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Resolved] (CALCITE-2277) Skip SemiJoin operator in materialized view-based rewriting algorithm

2018-04-24 Thread Jesus Camacho Rodriguez (JIRA)

 [ 
https://issues.apache.org/jira/browse/CALCITE-2277?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jesus Camacho Rodriguez resolved CALCITE-2277.
--
Resolution: Fixed

For now, bailing out to prevent any incorrect result. If we want to support 
SemiJoin, algorithm will need to be extended, this may be done in a follow-up.

Fixed in http://git-wip-us.apache.org/repos/asf/calcite/commit/fd5dc8adf .

> Skip SemiJoin operator in materialized view-based rewriting algorithm
> -
>
> Key: CALCITE-2277
> URL: https://issues.apache.org/jira/browse/CALCITE-2277
> Project: Calcite
>  Issue Type: Bug
>Affects Versions: 1.16.0
>Reporter: Jesus Camacho Rodriguez
>Assignee: Jesus Camacho Rodriguez
>Priority: Major
> Fix For: 1.17.0
>
>
> {{AbstractMaterializedViewRule}} is not recognizing the difference between 
> SemiJoin and Join operator, since SemiJoin inherits from Join. This can lead 
> to incorrect rewriting and errors in the rewriting logic.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (CALCITE-2277) Skip SemiJoin operator in materialized view-based rewriting algorithm

2018-04-24 Thread Jesus Camacho Rodriguez (JIRA)
Jesus Camacho Rodriguez created CALCITE-2277:


 Summary: Skip SemiJoin operator in materialized view-based 
rewriting algorithm
 Key: CALCITE-2277
 URL: https://issues.apache.org/jira/browse/CALCITE-2277
 Project: Calcite
  Issue Type: Bug
Affects Versions: 1.16.0
Reporter: Jesus Camacho Rodriguez
Assignee: Jesus Camacho Rodriguez
 Fix For: 1.17.0


{{AbstractMaterializedViewRule}} is not recognizing the difference between 
SemiJoin and Join operator, since SemiJoin inherits from Join. This can lead to 
incorrect rewriting and errors in the rewriting logic.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Resolved] (CALCITE-1362) Filter aboved Join should consider the join key equivalence to push through

2018-04-24 Thread Vitalii Diravka (JIRA)

 [ 
https://issues.apache.org/jira/browse/CALCITE-1362?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vitalii Diravka resolved CALCITE-1362.
--
Resolution: Not A Problem
  Assignee: Vitalii Diravka  (was: Julian Hyde)

Closed since the combination of FilterIntoJoinRule and 
JoinPushTransitivePredicatesRule solves current issue.

> Filter aboved Join should consider the join key equivalence to push through 
> 
>
> Key: CALCITE-1362
> URL: https://issues.apache.org/jira/browse/CALCITE-1362
> Project: Calcite
>  Issue Type: Improvement
>Reporter: wei lin
>Assignee: Vitalii Diravka
>Priority: Major
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> currently the FilterIntoJoinRule does not consider the join key equivalence. 
> we should consider that and push more condition into children. i will do it 
> and provide the patch later. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Closed] (CALCITE-1993) Possible bug - NPE when using H2

2018-04-24 Thread Piotr Bojko (JIRA)

 [ 
https://issues.apache.org/jira/browse/CALCITE-1993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Piotr Bojko closed CALCITE-1993.

Resolution: Cannot Reproduce

[~julianhyde] I am closing this.

> Possible bug - NPE when using H2
> 
>
> Key: CALCITE-1993
> URL: https://issues.apache.org/jira/browse/CALCITE-1993
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.13.0
> Environment: JIRA Container. Developed code is part of JIRA addon.
>Reporter: Piotr Bojko
>Assignee: Julian Hyde
>Priority: Major
>
> I've receiving NPE When using Calcite. My code is as follows
> {code:java}
> @Autowired
> public CalciteBootstrap(DatasourceProvider datasourceProvider) throws 
> SQLException {
> this.datasource = datasourceProvider.fetchDatasource();
> log.debug("Datasource fetched - {}", datasource);
> this.connection = createRootSchema();
> this.schema = JdbcSchema.create(connection.getRootSchema(), "PUBLIC", 
> datasource, null, null);
> connection.getRootSchema().add("jira", schema);
> connection.createStatement().executeQuery("select * from 
> jira.PROJECT_KEY");
> }
> private CalciteConnection createRootSchema() {
> try {
> Class.forName("org.apache.calcite.jdbc.Driver");
> Properties info = new Properties();
> info.setProperty("lex", "JAVA");
> Connection connection = DriverManager.getConnection("jdbc:calcite:", 
> info);
> CalciteConnection calciteConnection
>   = connection.unwrap(CalciteConnection.class);
> return calciteConnection;
> } catch (SQLException | ClassNotFoundException ex) {
> throw new RuntimeException(ex);
> }
> }
> {code}
> And NPE:
> {noformat}
> [INFO] [talledLocalContainer] java.sql.SQLException: Error while executing 
> SQL "select * from jira.PROJECT_KEY": null
> [INFO] [talledLocalContainer]   at 
> org.apache.calcite.avatica.Helper.createException(Helper.java:56)
> [INFO] [talledLocalContainer]   at 
> org.apache.calcite.avatica.Helper.createException(Helper.java:41)
> [INFO] [talledLocalContainer]   at 
> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
> [INFO] [talledLocalContainer]   at 
> org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:218)
> [INFO] [talledLocalContainer]   at 
> com.codedoers.jira.smartql.QueryController.request(QueryController.java:23)
> ...
> [INFO] [talledLocalContainer] Caused by: java.lang.NullPointerException
> [INFO] [talledLocalContainer]   at Baz.bind(Unknown Source)
> [INFO] [talledLocalContainer]   at 
> org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:335)
> [INFO] [talledLocalContainer]   at 
> org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:294)
> [INFO] [talledLocalContainer]   at 
> org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:559)
> [INFO] [talledLocalContainer]   at 
> org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:550)
> [INFO] [talledLocalContainer]   at 
> org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:67)
> [INFO] [talledLocalContainer]   at 
> org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:44)
> [INFO] [talledLocalContainer]   at 
> org.apache.calcite.avatica.AvaticaConnection$1.execute(AvaticaConnection.java:630)
> [INFO] [talledLocalContainer]   at 
> org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:607)
> [INFO] [talledLocalContainer]   at 
> org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:638)
> [INFO] [talledLocalContainer]   at 
> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:149)
> [INFO] [talledLocalContainer]   ... 240 more
> {noformat}
> I am developing an addon for JIRA, hence the container is JIRA. DB is H2. I 
> am borrowing JIRAs datasource for Calcite.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)