[jira] [Commented] (CALCITE-3229) UnsupportedOperationException for UPDATE with IN query

2019-08-06 Thread Chunwei Lei (JIRA)


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

Chunwei Lei commented on CALCITE-3229:
--

Thanks, [~danny0405].

I found CALCITE-2427 causes this problem after I spent some time on 
investigating this.  For the query 
{code:java}
update emp set empno = 1 where empno in (select empno from emp where 
empno=2){code}
, {{EMPNO}} which is the left operand of {{IN}} expression is not a validated 
node(but {{EMP.EMPNO}} is a validated node). Therefore the type of it may be 
null which would cause UnsupportedOperationException. I opened a pull request 
for it: [https://github.com/apache/calcite/pull/1358]. 

> UnsupportedOperationException for UPDATE with IN query
> --
>
> Key: CALCITE-3229
> URL: https://issues.apache.org/jira/browse/CALCITE-3229
> Project: Calcite
>  Issue Type: Bug
>Reporter: Chunwei Lei
>Assignee: Danny Chan
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Query 2- "UPDATE tblspace1.table1 set n1=1000" + "WHERE k1 in (SELECT fk FROM 
> tblspace1.table2 WHERE k2=?)" java.lang.UnsupportedOperationException: class 
> org.apache.calcite.sql.SqlBasicCall: `K1` IN (SELECT `table2`.`fk` AS `FK` 
> FROM `tblspace1`.`table2` AS `TABLE2` WHERE `table2`.`k2` = ?) at 
> org.apache.calcite.util.Util.needToImplement(Util.java:967) at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.getValidatedNodeType(SqlValidatorImpl.java:1579)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.findSubQueries(SqlToRelConverter.java:1802)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.findSubQueries(SqlToRelConverter.java:1776)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.replaceSubQueries(SqlToRelConverter.java:1011)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertUpdate(SqlToRelConverter.java:3570)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3172)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:563)
>  at org.apache.calcite.prepare.PlannerImpl.rel(PlannerImpl.java:254)
>  
> From the thread 
> [https://lists.apache.org/thread.html/67cb614ddd123a9092fdf37ace279eb563838b045a5554ad0005f030@%3Cdev.calcite.apache.org%3E]



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Commented] (CALCITE-3229) UnsupportedOperationException for UPDATE with IN query

2019-08-04 Thread Danny Chan (JIRA)


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

Danny Chan commented on CALCITE-3229:
-

I will, but maybe too busy to look into this issue this week ;)

> UnsupportedOperationException for UPDATE with IN query
> --
>
> Key: CALCITE-3229
> URL: https://issues.apache.org/jira/browse/CALCITE-3229
> Project: Calcite
>  Issue Type: Bug
>Reporter: Chunwei Lei
>Assignee: Danny Chan
>Priority: Major
>
> Query 2- "UPDATE tblspace1.table1 set n1=1000" + "WHERE k1 in (SELECT fk FROM 
> tblspace1.table2 WHERE k2=?)" java.lang.UnsupportedOperationException: class 
> org.apache.calcite.sql.SqlBasicCall: `K1` IN (SELECT `table2`.`fk` AS `FK` 
> FROM `tblspace1`.`table2` AS `TABLE2` WHERE `table2`.`k2` = ?) at 
> org.apache.calcite.util.Util.needToImplement(Util.java:967) at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.getValidatedNodeType(SqlValidatorImpl.java:1579)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.findSubQueries(SqlToRelConverter.java:1802)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.findSubQueries(SqlToRelConverter.java:1776)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.replaceSubQueries(SqlToRelConverter.java:1011)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertUpdate(SqlToRelConverter.java:3570)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3172)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:563)
>  at org.apache.calcite.prepare.PlannerImpl.rel(PlannerImpl.java:254)
>  
> From the thread 
> [https://lists.apache.org/thread.html/67cb614ddd123a9092fdf37ace279eb563838b045a5554ad0005f030@%3Cdev.calcite.apache.org%3E]



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


[jira] [Commented] (CALCITE-3229) UnsupportedOperationException for UPDATE with IN query

2019-08-04 Thread Chunwei Lei (JIRA)


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

Chunwei Lei commented on CALCITE-3229:
--

[~danny0405], could you please look into this issue since you are interested?

> UnsupportedOperationException for UPDATE with IN query
> --
>
> Key: CALCITE-3229
> URL: https://issues.apache.org/jira/browse/CALCITE-3229
> Project: Calcite
>  Issue Type: Bug
>Reporter: Chunwei Lei
>Priority: Major
>
> Query 2- "UPDATE tblspace1.table1 set n1=1000" + "WHERE k1 in (SELECT fk FROM 
> tblspace1.table2 WHERE k2=?)" java.lang.UnsupportedOperationException: class 
> org.apache.calcite.sql.SqlBasicCall: `K1` IN (SELECT `table2`.`fk` AS `FK` 
> FROM `tblspace1`.`table2` AS `TABLE2` WHERE `table2`.`k2` = ?) at 
> org.apache.calcite.util.Util.needToImplement(Util.java:967) at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.getValidatedNodeType(SqlValidatorImpl.java:1579)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.findSubQueries(SqlToRelConverter.java:1802)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.findSubQueries(SqlToRelConverter.java:1776)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.replaceSubQueries(SqlToRelConverter.java:1011)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertUpdate(SqlToRelConverter.java:3570)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3172)
>  at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:563)
>  at org.apache.calcite.prepare.PlannerImpl.rel(PlannerImpl.java:254)
>  
> From the thread 
> [https://lists.apache.org/thread.html/67cb614ddd123a9092fdf37ace279eb563838b045a5554ad0005f030@%3Cdev.calcite.apache.org%3E]



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)