[jira] [Resolved] (CALCITE-1390) Properties object is modified by Avatica JDBC Driver

2016-09-27 Thread Josh Elser (JIRA)

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

Josh Elser resolved CALCITE-1390.
-
Resolution: Fixed

Fixed in 
https://git1-us-west.apache.org/repos/asf?p=calcite.git;a=commit;h=8aa11626ea3e87ec4f06bc383eb452a77cc695e5.
 Thanks for letting us know about the issue, [~prabhjyotsi...@apache.com].

> Properties object is modified by Avatica JDBC Driver
> 
>
> Key: CALCITE-1390
> URL: https://issues.apache.org/jira/browse/CALCITE-1390
> Project: Calcite
>  Issue Type: Bug
>  Components: avatica
>Reporter: Prabhjyot Singh
>Assignee: Josh Elser
> Fix For: avatica-1.9.0
>
>
> Creating this JIRA from mail thread 
> https://lists.apache.org/thread.html/5029f1f09c95a76b6e60a0f80e6f145dedf0b51cfdc08b964fb3b060@%3Cuser.phoenix.apache.org%3E
> I'm using DriverManager.getConnection(url, properties) using following 
> properties 
> {code}
> url -> "jdbc:phoenix:thin:url=http://prabhu-3.novalocal:8765;serialization 
> =PROTOBUF"  
> {code}
> {code}
> properties -> 
> 0 = {java.util.Hashtable$Entry@1491} "user" -> "phoenixuser" 
> 1 = {java.util.Hashtable$Entry@1492} "password" -> 
> 2 = {java.util.Hashtable$Entry@1493} "url" -> 
> "jdbc:phoenix:thin:url=http://prabhu-3.novalocal:8765;serialization 
> =PROTOBUF" 
> 3 = {java.util.Hashtable$Entry@1494} "hbase.client.retries.number" -> "4" 
> 4 = {java.util.Hashtable$Entry@1495} "driver" -> 
> "org.apache.phoenix.jdbc.PhoenixDriver"  
> {code}
> With the above propert/setting/config it returns a connection to the URL 
> specified, but it also modifies my properties object to following  
> {code}
> properties -> 
> 0 = {java.util.Hashtable$Entry@2361} "serialization" -> "PROTOBUF" 
> 1 = {java.util.Hashtable$Entry@2362} "user" -> "phoenixuser" 
> 2 = {java.util.Hashtable$Entry@2363} "password" -> 
> *3 = {java.util.Hashtable$Entry@2364} "url" -> 
> "http://prabhu-3.novalocal:8765 "* 
> 4 = {java.util.Hashtable$Entry@2365} "hbase.client.retries.number" -> "4" 
> 5 = {java.util.Hashtable$Entry@2366} "driver" -> 
> "org.apache.phoenix.jdbc.PhoenixDriver"   
> {code}
> The above only happens if I'm using *thin-client*. Is this the expected 
> behaviour ?  
> I plan to use this "properties" object after getting the connection for 
> something else. 
> Also, I'm using following in my maven dependency 
> "org.apache.phoenix:phoenix-server-client:4.7.0-HBase-1.1" 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CALCITE-1392) Unable to specify time granularity for Druid

2016-09-27 Thread Julian Hyde (JIRA)

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

Julian Hyde commented on CALCITE-1392:
--

Did you tell Calcite that "__time" is the timestamp column? If you did, then 
its type should be TIMESTAMP and FLOOR should work. If you didn't, its type 
will be VARCHAR.

> Unable to specify time granularity for Druid
> 
>
> Key: CALCITE-1392
> URL: https://issues.apache.org/jira/browse/CALCITE-1392
> Project: Calcite
>  Issue Type: Bug
>  Components: druid
>Affects Versions: 1.9.0
>Reporter: Maciej Bryński
>Assignee: Julian Hyde
>
> Druid 0.9.1.1
> Calcite 1.9.0
> I'm trying to calculate count per day.
> What I'm doing wrong ?
> {code}
> !connect 
> jdbc:calcite:schemaFactory=org.apache.calcite.adapter.druid.DruidSchemaFactory
>  admin admin
> 0: jdbc:calcite:schemaFactory=org.apache.calc> !describe "table"
> +---+-++-+---+---+-+---+++--+-++---+--+
> | TABLE_CAT | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME | DATA_TYPE | TYPE_NAME 
> | COLUMN_SIZE | BUFFER_LENGTH | DECIMAL_DIGITS | NUM_PREC_RADIX | NULLABLE | 
> REMARKS | COLUMN_DEF | SQL_DATA_TYPE | SQL_DATETIME_SUB |
> +---+-++-+---+---+-+---+++--+-++---+--+
> |   | adhoc   | table  | __time  | -5| BIGINT| -1 
>  |   | null   | 10 | 1|   
>   ||   |  |
> |
> |   | adhoc   | table| count   | -5| BIGINT| 
> -1  |   | null   | 10 | 1|
>  ||   |  
> 0: jdbc:calcite:schemaFactory=org.apache.calc> select sum("count") from 
> "table" group by floor("__time" to DAY);
> 2016-09-27 21:50:26,770 [main] ERROR - 
> org.apache.calcite.sql.validate.SqlValidatorException: Cannot apply 'FLOOR' 
> to arguments of type 'FLOOR(, )'. Supported form(s): 
> 'FLOOR()'
> 'FLOOR()'
> 'FLOOR( TO )'
> 'FLOOR( TO )'
> 'FLOOR( TO )'
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (CALCITE-1392) Unable to specify time granularity for Druid

2016-09-27 Thread JIRA

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

Maciej Bryński updated CALCITE-1392:

Description: 
Druid 0.9.1.1
Calcite 1.9.0

I'm trying to calculate count per day.
What I'm doing wrong ?

{code}
!connect 
jdbc:calcite:schemaFactory=org.apache.calcite.adapter.druid.DruidSchemaFactory 
admin admin
0: jdbc:calcite:schemaFactory=org.apache.calc> !describe "table"
+---+-++-+---+---+-+---+++--+-++---+--+
| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME | DATA_TYPE | TYPE_NAME | 
COLUMN_SIZE | BUFFER_LENGTH | DECIMAL_DIGITS | NUM_PREC_RADIX | NULLABLE | 
REMARKS | COLUMN_DEF | SQL_DATA_TYPE | SQL_DATETIME_SUB |
+---+-++-+---+---+-+---+++--+-++---+--+
|   | adhoc   | flink_imp  | __time  | -5| BIGINT| 
-1  |   | null   | 10 | 1|  
   ||   |  |
|
|   | adhoc   | flink_imp  | count   | -5| BIGINT| 
-1  |   | null   | 10 | 1|  
   ||   |  

0: jdbc:calcite:schemaFactory=org.apache.calc> select sum("count") from "table" 
group by floor("__time" to DAY);
2016-09-27 21:50:26,770 [main] ERROR - 
org.apache.calcite.sql.validate.SqlValidatorException: Cannot apply 'FLOOR' to 
arguments of type 'FLOOR(, )'. Supported form(s): 
'FLOOR()'
'FLOOR()'
'FLOOR( TO )'
'FLOOR( TO )'
'FLOOR( TO )'
{code}

  was:
Druid 0.9.1.1
Calcite 1.9.0

I'm trying to calculate count per day.
What I'm doing wrong ?

{code}
!connect 
jdbc:calcite:schemaFactory=org.apache.calcite.adapter.druid.DruidSchemaFactory 
admin admin
0: jdbc:calcite:schemaFactory=org.apache.calc> !describe "flink_imp"
+---+-++-+---+---+-+---+++--+-++---+--+
| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME | DATA_TYPE | TYPE_NAME | 
COLUMN_SIZE | BUFFER_LENGTH | DECIMAL_DIGITS | NUM_PREC_RADIX | NULLABLE | 
REMARKS | COLUMN_DEF | SQL_DATA_TYPE | SQL_DATETIME_SUB |
+---+-++-+---+---+-+---+++--+-++---+--+
|   | adhoc   | flink_imp  | __time  | -5| BIGINT| 
-1  |   | null   | 10 | 1|  
   ||   |  |
|
|   | adhoc   | flink_imp  | count   | -5| BIGINT| 
-1  |   | null   | 10 | 1|  
   ||   |  

0: jdbc:calcite:schemaFactory=org.apache.calc> select sum("count") from "table" 
group by floor("__time" to DAY);
2016-09-27 21:50:26,770 [main] ERROR - 
org.apache.calcite.sql.validate.SqlValidatorException: Cannot apply 'FLOOR' to 
arguments of type 'FLOOR(, )'. Supported form(s): 
'FLOOR()'
'FLOOR()'
'FLOOR( TO )'
'FLOOR( TO )'
'FLOOR( TO )'
{code}


> Unable to specify time granularity for Druid
> 
>
> Key: CALCITE-1392
> URL: https://issues.apache.org/jira/browse/CALCITE-1392
> Project: Calcite
>  Issue Type: Bug
>  Components: druid
>Affects Versions: 1.9.0
>Reporter: Maciej Bryński
>Assignee: Julian Hyde
>
> Druid 0.9.1.1
> Calcite 1.9.0
> I'm trying to calculate count per day.
> What I'm doing wrong ?
> {code}
> !connect 
> jdbc:calcite:schemaFactory=org.apache.calcite.adapter.druid.DruidSchemaFactory
>  admin admin
> 0: jdbc:calcite:schemaFactory=org.apache.calc> !describe "table"
> +---+-++-+---+---+-+---+++--+-++---+--+
> | TABLE_CAT | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME | DATA_TYPE | TYPE_NAME 
> | COLUMN_SIZE | BUFFER_LENGTH | DECIMAL_DIGITS | NUM_PREC_RADIX | NULLABLE | 
> REMARKS | COLUMN_DEF | SQL_DATA_TYPE | SQL_DATETIME_SUB |
> +---+-++-+---+---+-+---+++--+-++---+--+
> |   | adhoc   | flink_imp  | __time  | -5 

[jira] [Commented] (CALCITE-1121) Druid adapter

2016-09-27 Thread JIRA

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

Maciej Bryński commented on CALCITE-1121:
-

Calcite 1.9.0

https://issues.apache.org/jira/browse/CALCITE-1392

> Druid adapter
> -
>
> Key: CALCITE-1121
> URL: https://issues.apache.org/jira/browse/CALCITE-1121
> Project: Calcite
>  Issue Type: Bug
>  Components: druid
>Reporter: Julian Hyde
>Assignee: Julian Hyde
> Fix For: 1.8.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CALCITE-1121) Druid adapter

2016-09-27 Thread Julian Hyde (JIRA)

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

Julian Hyde commented on CALCITE-1121:
--

Can you log a new issue please? Also, state which version of Calcite you are 
using.

> Druid adapter
> -
>
> Key: CALCITE-1121
> URL: https://issues.apache.org/jira/browse/CALCITE-1121
> Project: Calcite
>  Issue Type: Bug
>  Components: druid
>Reporter: Julian Hyde
>Assignee: Julian Hyde
> Fix For: 1.8.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CALCITE-1121) Druid adapter

2016-09-27 Thread JIRA

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

Maciej Bryński commented on CALCITE-1121:
-

PS. Druid version 0.9.1.1

> Druid adapter
> -
>
> Key: CALCITE-1121
> URL: https://issues.apache.org/jira/browse/CALCITE-1121
> Project: Calcite
>  Issue Type: Bug
>  Components: druid
>Reporter: Julian Hyde
>Assignee: Julian Hyde
> Fix For: 1.8.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CALCITE-1121) Druid adapter

2016-09-27 Thread Julian Hyde (JIRA)

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

Julian Hyde commented on CALCITE-1121:
--

The best documentation we have is the test: 
https://github.com/apache/calcite/blob/master/druid/src/test/java/org/apache/calcite/test/DruidAdapterIT.java.

> Druid adapter
> -
>
> Key: CALCITE-1121
> URL: https://issues.apache.org/jira/browse/CALCITE-1121
> Project: Calcite
>  Issue Type: Bug
>  Components: druid
>Reporter: Julian Hyde
>Assignee: Julian Hyde
> Fix For: 1.8.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CALCITE-1121) Druid adapter

2016-09-27 Thread JIRA

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

Maciej Bryński commented on CALCITE-1121:
-

[~julianhyde]
Is there any documentation how to create queries ?
For example I'd like to set time granularity of query.

> Druid adapter
> -
>
> Key: CALCITE-1121
> URL: https://issues.apache.org/jira/browse/CALCITE-1121
> Project: Calcite
>  Issue Type: Bug
>  Components: druid
>Reporter: Julian Hyde
>Assignee: Julian Hyde
> Fix For: 1.8.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (CALCITE-1369) Display a list of Avatica clients on the website

2016-09-27 Thread Julian Hyde (JIRA)

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

Julian Hyde updated CALCITE-1369:
-
Component/s: site

> Display a list of Avatica clients on the website
> 
>
> Key: CALCITE-1369
> URL: https://issues.apache.org/jira/browse/CALCITE-1369
> Project: Calcite
>  Issue Type: Improvement
>  Components: avatica, site
>Reporter: Francis Chuang
>Assignee: Francis Chuang
>Priority: Minor
> Fix For: avatica-1.9.0
>
>
> I think it would be really neat to have a well organized list of Avatica 
> clients on the website. This would make clients much more discoverable and 
> make Avatica and Calcite much more easier for people to get started with. For 
> example, Kafka has a wiki page with their clients here: 
> https://cwiki.apache.org/confluence/display/KAFKA/Clients
> 1. Most of the clients currently available (the .NET and python ones) are 
> currently targeted towards Apache Phoenix. Should we include these clients? 
> If not, is there a process for reaching out to their maintainers to see if 
> they are interested in generalising them to target Avatica?
> 2. Is there any process for including a client on such a page? Should anyone 
> be able to add the client, or do we need explicit permission from the 
> maintainers?
> 3. To reduce friction, is it viable to have a wiki page, so that maintainers 
> can easily add their own clients?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Resolved] (CALCITE-1381) Function quantifier should be retained in a cloned Sql call

2016-09-27 Thread Julian Hyde (JIRA)

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

Julian Hyde resolved CALCITE-1381.
--
   Resolution: Fixed
Fix Version/s: 1.10.0

Fixed in http://git-wip-us.apache.org/repos/asf/calcite/commit/8d9a5d24. Thanks 
for the patch, [~zhengd]!

> Function quantifier should be retained in a cloned Sql call 
> 
>
> Key: CALCITE-1381
> URL: https://issues.apache.org/jira/browse/CALCITE-1381
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.8.0, 1.6.0
>Reporter: zhengdong
>Assignee: Julian Hyde
>Priority: Minor
> Fix For: 1.10.0
>
> Attachments: 
> 0001-Override-clone-method-in-SqlBasicCall-to-fix-Nullif-function.patch, 
> CALCITE-1381-Function-quantifier-should-be-retained-.patch, 
> CALCITE-1381-Function-quantifier-should-be-retained-.patch
>
>
> I found Calcite can’t execute queries like {{select nullif(count(distinct 
> colunm),0) from table}}, and dumped ‘Plan after trimming unused fields’ like 
> this:
> {noformat}
> LogicalProject(NAME=[$0], GENDER=[CASE(=($1, 0), null, CAST($2):BIGINT)])
>   LogicalAggregate(group=[{0}], agg#0=[COUNT(DISTINCT $1)], agg#1=[COUNT($1)])
> LogicalProject(NAME=[$1], GENDER=[$3])
>   CsvTableScan(table=[[SALES, EMPS]], fields=[[0, 1, 2, 3, 4, 5, 6, 7, 8, 
> 9]])
> {noformat}
> Then, I checked SqlNullifFunction rewriteCall method which used 
> SqlNode.clone(SqlParserPos pos) method to create SqlCase call.
> Finally, I guess the root cause may be that the clone(SqlParserPos pos) 
> method discard the functionQuantifier which holds such as ‘distinct’ symbol 
> when create new SqlCall instance.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CALCITE-1342) ProjectPusher should use rel factories when creating new rels, e.g. project/filter

2016-09-27 Thread Julian Hyde (JIRA)

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

Julian Hyde commented on CALCITE-1342:
--

FYI, this commit broke QuidemTest, viz, it changed some plans in {{misc.iq}}. 
(I'm not sure how we missed it, but at least the plan changes were 
improvements!) Fixed the test in 
http://git-wip-us.apache.org/repos/asf/calcite/commit/b5b9e53a.

> ProjectPusher should use rel factories when creating new rels, e.g. 
> project/filter
> --
>
> Key: CALCITE-1342
> URL: https://issues.apache.org/jira/browse/CALCITE-1342
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Reporter: MinJi Kim
>Assignee: Julian Hyde
> Fix For: 1.9.0
>
>
> I was playing around with some new ideas in drill, and wanted to use 
> ProjectPusher, which has a lot of useful utility functions.  ProjectPusher 
> returns new nodes, but they are LogicalProjects/LogicalFilters.  It would be 
> more useful if the user of ProjectPusher could specify the rel factories to 
> use.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CALCITE-1390) property object is being modified

2016-09-27 Thread Josh Elser (JIRA)

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

Josh Elser commented on CALCITE-1390:
-

bq. The above only happens if I'm using thin-client. Is this the expected 
behaviour ? 

And yes, this expected. The options passed in via the URL to DriverManager are 
added to the properties. You just should not be seeing this as the caller.

> property object is being modified
> -
>
> Key: CALCITE-1390
> URL: https://issues.apache.org/jira/browse/CALCITE-1390
> Project: Calcite
>  Issue Type: Bug
>  Components: avatica
>Reporter: Prabhjyot Singh
>Assignee: Josh Elser
> Fix For: avatica-1.9.0
>
>
> Creating this JIRA from mail thread 
> https://lists.apache.org/thread.html/5029f1f09c95a76b6e60a0f80e6f145dedf0b51cfdc08b964fb3b060@%3Cuser.phoenix.apache.org%3E
> I'm using DriverManager.getConnection(url, properties) using following 
> properties 
> {code}
> url -> "jdbc:phoenix:thin:url=http://prabhu-3.novalocal:8765;serialization 
> =PROTOBUF"  
> {code}
> {code}
> properties -> 
> 0 = {java.util.Hashtable$Entry@1491} "user" -> "phoenixuser" 
> 1 = {java.util.Hashtable$Entry@1492} "password" -> 
> 2 = {java.util.Hashtable$Entry@1493} "url" -> 
> "jdbc:phoenix:thin:url=http://prabhu-3.novalocal:8765;serialization 
> =PROTOBUF" 
> 3 = {java.util.Hashtable$Entry@1494} "hbase.client.retries.number" -> "4" 
> 4 = {java.util.Hashtable$Entry@1495} "driver" -> 
> "org.apache.phoenix.jdbc.PhoenixDriver"  
> {code}
> With the above propert/setting/config it returns a connection to the URL 
> specified, but it also modifies my properties object to following  
> {code}
> properties -> 
> 0 = {java.util.Hashtable$Entry@2361} "serialization" -> "PROTOBUF" 
> 1 = {java.util.Hashtable$Entry@2362} "user" -> "phoenixuser" 
> 2 = {java.util.Hashtable$Entry@2363} "password" -> 
> *3 = {java.util.Hashtable$Entry@2364} "url" -> 
> "http://prabhu-3.novalocal:8765 "* 
> 4 = {java.util.Hashtable$Entry@2365} "hbase.client.retries.number" -> "4" 
> 5 = {java.util.Hashtable$Entry@2366} "driver" -> 
> "org.apache.phoenix.jdbc.PhoenixDriver"   
> {code}
> The above only happens if I'm using *thin-client*. Is this the expected 
> behaviour ?  
> I plan to use this "properties" object after getting the connection for 
> something else. 
> Also, I'm using following in my maven dependency 
> "org.apache.phoenix:phoenix-server-client:4.7.0-HBase-1.1" 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CALCITE-1389) Add rule to perform rewriting of queries using materialized views with joins

2016-09-27 Thread Jesus Camacho Rodriguez (JIRA)

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

Jesus Camacho Rodriguez commented on CALCITE-1389:
--

[~michaelmior], I think you are missing some files in the PR (at least the rule 
itself)?

> Add rule to perform rewriting of queries using materialized views with joins
> 
>
> Key: CALCITE-1389
> URL: https://issues.apache.org/jira/browse/CALCITE-1389
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Reporter: Michael Mior
>Assignee: Michael Mior
>
>  I've been looking into implementing the approach from the following paper. 
> It's very nicely written and easy to follow. It also doesn't require trying 
> different join permutations. I'm starting with several additional 
> restrictions (only equijoins, no aggregations, etc.)
> ftp://ftp.cse.buffalo.edu/users/azhang/disc/SIGMOD/pdf-files/331/202-optimizing.pdf
> Thanks to [~jcamachorodriguez] for his help in sorting out some issues with 
> the rule so far.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CALCITE-1390) property object is being modified

2016-09-27 Thread Josh Elser (JIRA)

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

Josh Elser commented on CALCITE-1390:
-

Looks like this is happening (depending on how your look at it) with 
{{UnregisteredDriver#connect(String, Properties)}} not copying the properties 
or {{ConnectStringParser#parse(String, Properties)}} altering the properties 
that were passed in.

I think changing {{ConnectStringParser#parseInternal(Properties)}} to make a 
copy of the properties that are passed in would be a simple fix.

> property object is being modified
> -
>
> Key: CALCITE-1390
> URL: https://issues.apache.org/jira/browse/CALCITE-1390
> Project: Calcite
>  Issue Type: Bug
>  Components: avatica
>Reporter: Prabhjyot Singh
>Assignee: Josh Elser
> Fix For: avatica-1.9.0
>
>
> Creating this JIRA from mail thread 
> https://lists.apache.org/thread.html/5029f1f09c95a76b6e60a0f80e6f145dedf0b51cfdc08b964fb3b060@%3Cuser.phoenix.apache.org%3E
> I'm using DriverManager.getConnection(url, properties) using following 
> properties 
> {code}
> url -> "jdbc:phoenix:thin:url=http://prabhu-3.novalocal:8765;serialization 
> =PROTOBUF"  
> {code}
> {code}
> properties -> 
> 0 = {java.util.Hashtable$Entry@1491} "user" -> "phoenixuser" 
> 1 = {java.util.Hashtable$Entry@1492} "password" -> 
> 2 = {java.util.Hashtable$Entry@1493} "url" -> 
> "jdbc:phoenix:thin:url=http://prabhu-3.novalocal:8765;serialization 
> =PROTOBUF" 
> 3 = {java.util.Hashtable$Entry@1494} "hbase.client.retries.number" -> "4" 
> 4 = {java.util.Hashtable$Entry@1495} "driver" -> 
> "org.apache.phoenix.jdbc.PhoenixDriver"  
> {code}
> With the above propert/setting/config it returns a connection to the URL 
> specified, but it also modifies my properties object to following  
> {code}
> properties -> 
> 0 = {java.util.Hashtable$Entry@2361} "serialization" -> "PROTOBUF" 
> 1 = {java.util.Hashtable$Entry@2362} "user" -> "phoenixuser" 
> 2 = {java.util.Hashtable$Entry@2363} "password" -> 
> *3 = {java.util.Hashtable$Entry@2364} "url" -> 
> "http://prabhu-3.novalocal:8765 "* 
> 4 = {java.util.Hashtable$Entry@2365} "hbase.client.retries.number" -> "4" 
> 5 = {java.util.Hashtable$Entry@2366} "driver" -> 
> "org.apache.phoenix.jdbc.PhoenixDriver"   
> {code}
> The above only happens if I'm using *thin-client*. Is this the expected 
> behaviour ?  
> I plan to use this "properties" object after getting the connection for 
> something else. 
> Also, I'm using following in my maven dependency 
> "org.apache.phoenix:phoenix-server-client:4.7.0-HBase-1.1" 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Moved] (CALCITE-1390) property object is being modified

2016-09-27 Thread Josh Elser (JIRA)

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

Josh Elser moved PHOENIX-3315 to CALCITE-1390:
--

Fix Version/s: (was: 4.9.0)
   avatica-1.9.0
 Workflow: jira  (was: no-reopen-closed, patch-avail)
  Key: CALCITE-1390  (was: PHOENIX-3315)
  Project: Calcite  (was: Phoenix)

> property object is being modified
> -
>
> Key: CALCITE-1390
> URL: https://issues.apache.org/jira/browse/CALCITE-1390
> Project: Calcite
>  Issue Type: Bug
>  Components: avatica
>Reporter: Prabhjyot Singh
>Assignee: Josh Elser
> Fix For: avatica-1.9.0
>
>
> Creating this JIRA from mail thread 
> https://lists.apache.org/thread.html/5029f1f09c95a76b6e60a0f80e6f145dedf0b51cfdc08b964fb3b060@%3Cuser.phoenix.apache.org%3E
> I'm using DriverManager.getConnection(url, properties) using following 
> properties 
> {code}
> url -> "jdbc:phoenix:thin:url=http://prabhu-3.novalocal:8765;serialization 
> =PROTOBUF"  
> {code}
> {code}
> properties -> 
> 0 = {java.util.Hashtable$Entry@1491} "user" -> "phoenixuser" 
> 1 = {java.util.Hashtable$Entry@1492} "password" -> 
> 2 = {java.util.Hashtable$Entry@1493} "url" -> 
> "jdbc:phoenix:thin:url=http://prabhu-3.novalocal:8765;serialization 
> =PROTOBUF" 
> 3 = {java.util.Hashtable$Entry@1494} "hbase.client.retries.number" -> "4" 
> 4 = {java.util.Hashtable$Entry@1495} "driver" -> 
> "org.apache.phoenix.jdbc.PhoenixDriver"  
> {code}
> With the above propert/setting/config it returns a connection to the URL 
> specified, but it also modifies my properties object to following  
> {code}
> properties -> 
> 0 = {java.util.Hashtable$Entry@2361} "serialization" -> "PROTOBUF" 
> 1 = {java.util.Hashtable$Entry@2362} "user" -> "phoenixuser" 
> 2 = {java.util.Hashtable$Entry@2363} "password" -> 
> *3 = {java.util.Hashtable$Entry@2364} "url" -> 
> "http://prabhu-3.novalocal:8765 "* 
> 4 = {java.util.Hashtable$Entry@2365} "hbase.client.retries.number" -> "4" 
> 5 = {java.util.Hashtable$Entry@2366} "driver" -> 
> "org.apache.phoenix.jdbc.PhoenixDriver"   
> {code}
> The above only happens if I'm using *thin-client*. Is this the expected 
> behaviour ?  
> I plan to use this "properties" object after getting the connection for 
> something else. 
> Also, I'm using following in my maven dependency 
> "org.apache.phoenix:phoenix-server-client:4.7.0-HBase-1.1" 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CALCITE-1389) Add rule to perform rewriting of queries using materialized views with joins

2016-09-27 Thread Michael Mior (JIRA)

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

Michael Mior commented on CALCITE-1389:
---

Pull request available on GitHub.

https://github.com/apache/calcite/pull/284

> Add rule to perform rewriting of queries using materialized views with joins
> 
>
> Key: CALCITE-1389
> URL: https://issues.apache.org/jira/browse/CALCITE-1389
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Reporter: Michael Mior
>Assignee: Michael Mior
>
>  I've been looking into implementing the approach from the following paper. 
> It's very nicely written and easy to follow. It also doesn't require trying 
> different join permutations. I'm starting with several additional 
> restrictions (only equijoins, no aggregations, etc.)
> ftp://ftp.cse.buffalo.edu/users/azhang/disc/SIGMOD/pdf-files/331/202-optimizing.pdf
> Thanks to [~jcamachorodriguez] for his help in sorting out some issues with 
> the rule so far.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (CALCITE-1389) Add rule to perform rewriting of queries using materialized views with joins

2016-09-27 Thread Michael Mior (JIRA)
Michael Mior created CALCITE-1389:
-

 Summary: Add rule to perform rewriting of queries using 
materialized views with joins
 Key: CALCITE-1389
 URL: https://issues.apache.org/jira/browse/CALCITE-1389
 Project: Calcite
  Issue Type: Improvement
  Components: core
Reporter: Michael Mior
Assignee: Michael Mior


 I've been looking into implementing the approach from the following paper. 
It's very nicely written and easy to follow. It also doesn't require trying 
different join permutations. I'm starting with several additional restrictions 
(only equijoins, no aggregations, etc.)

ftp://ftp.cse.buffalo.edu/users/azhang/disc/SIGMOD/pdf-files/331/202-optimizing.pdf

Thanks to [~jcamachorodriguez] for his help in sorting out some issues with the 
rule so far.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CALCITE-1388) Error during RelNode to sql string conversion

2016-09-27 Thread Julian Hyde (JIRA)

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

Julian Hyde commented on CALCITE-1388:
--

Great. I've marked it "in progress". (Sadly we have a lot of open bugs we'd 
love to fix but the only resources to fix them come from the community.)

> Error during RelNode to sql string conversion
> -
>
> Key: CALCITE-1388
> URL: https://issues.apache.org/jira/browse/CALCITE-1388
> Project: Calcite
>  Issue Type: Bug
>  Components: core
> Environment: Oracle JDK 1.8
>Reporter: Viktor Batytskyi
>Assignee: Julian Hyde
>
> The following query contains ROLLUP operator in GROUP BY clause. 
> {code:sql}
> SELECT player_id, video_id, SUM(clicks)
> FROM Table
> GROUP BY ROLLUP((player_id, video_id))
> {code}
> After the sql string is parsed and validated by executing: 
> {code}
>   val planner = Frameworks.getPlanner(config)
>   val sqlNode = planner.parse(mockedSql)
>   val validatedSql = planner.validate(sqlNode)
>   val relExpression = planner.rel(validatedSql).project()
> {code}
> The resulting relExpression can't be transformed back to a query:
> {code}
> private val VERTICA = SqlDialect.DatabaseProduct.VERTICA.getDialect
> .
> val sql = new RelToSqlConverter(VERTICA).visitChild(0, 
> relExpression).asQuery.toSqlString(VERTICA).getSql
> {code}
> The exception is thrown:
> {code}
> Caused by: java.lang.reflect.InvocationTargetException: null
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
>   ... 29 common frames omitted
> Caused by: java.lang.AssertionError: Internal error: While invoking method 
> 'public org.apache.calcite.rel.rel2sql.SqlImplementor$Result 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(org.apache.calcite.rel.core.Project)'
>   at org.apache.calcite.util.Util.newInternal(Util.java:792)
>   at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:534)
>   at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:80)
>   at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitChild(RelToSqlConverter.java:84)
>   at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:125)
>   ... 34 common frames omitted
> Caused by: java.lang.reflect.InvocationTargetException: null
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
>   ... 37 common frames omitted
> Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
>   at java.util.ArrayList.rangeCheck(ArrayList.java:653)
>   at java.util.ArrayList.get(ArrayList.java:429)
>   at org.apache.calcite.sql.SqlNodeList.get(SqlNodeList.java:93)
>   at 
> org.apache.calcite.rel.rel2sql.SqlImplementor$Result$1.field(SqlImplementor.java:781)
>   at 
> org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:450)
>   at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:133)
>   ... 42 common frames omitted
> {code}
> The failure can be tested by (RelToSqlConverterTest of Calcite Core project):
> {code:java}
>   @Test public void testSimpleRollup() {
> String query = "select \"product_id\"\n" +
> "from \"product\"\n" +
> "group by rollup((\"product_id\"))";
> String expected = "select \"product_id\"\n" +
> "from \"product\"\n" +
> "group by rollup((\"product_id\"))";
> sql(query).ok(expected);
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (CALCITE-1388) Error during RelNode to sql string conversion

2016-09-27 Thread Viktor Batytskyi (JIRA)

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

Viktor Batytskyi commented on CALCITE-1388:
---

I suppose that the issue is worth fixing in a next release, as rollup() 
operator is not usable at all. :)
Yep, I'm trying to come up with a patch.

> Error during RelNode to sql string conversion
> -
>
> Key: CALCITE-1388
> URL: https://issues.apache.org/jira/browse/CALCITE-1388
> Project: Calcite
>  Issue Type: Bug
>  Components: core
> Environment: Oracle JDK 1.8
>Reporter: Viktor Batytskyi
>Assignee: Julian Hyde
>
> The following query contains ROLLUP operator in GROUP BY clause. 
> {code:sql}
> SELECT player_id, video_id, SUM(clicks)
> FROM Table
> GROUP BY ROLLUP((player_id, video_id))
> {code}
> After the sql string is parsed and validated by executing: 
> {code}
>   val planner = Frameworks.getPlanner(config)
>   val sqlNode = planner.parse(mockedSql)
>   val validatedSql = planner.validate(sqlNode)
>   val relExpression = planner.rel(validatedSql).project()
> {code}
> The resulting relExpression can't be transformed back to a query:
> {code}
> private val VERTICA = SqlDialect.DatabaseProduct.VERTICA.getDialect
> .
> val sql = new RelToSqlConverter(VERTICA).visitChild(0, 
> relExpression).asQuery.toSqlString(VERTICA).getSql
> {code}
> The exception is thrown:
> {code}
> Caused by: java.lang.reflect.InvocationTargetException: null
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
>   ... 29 common frames omitted
> Caused by: java.lang.AssertionError: Internal error: While invoking method 
> 'public org.apache.calcite.rel.rel2sql.SqlImplementor$Result 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(org.apache.calcite.rel.core.Project)'
>   at org.apache.calcite.util.Util.newInternal(Util.java:792)
>   at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:534)
>   at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:80)
>   at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitChild(RelToSqlConverter.java:84)
>   at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:125)
>   ... 34 common frames omitted
> Caused by: java.lang.reflect.InvocationTargetException: null
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
>   ... 37 common frames omitted
> Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
>   at java.util.ArrayList.rangeCheck(ArrayList.java:653)
>   at java.util.ArrayList.get(ArrayList.java:429)
>   at org.apache.calcite.sql.SqlNodeList.get(SqlNodeList.java:93)
>   at 
> org.apache.calcite.rel.rel2sql.SqlImplementor$Result$1.field(SqlImplementor.java:781)
>   at 
> org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:450)
>   at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:133)
>   ... 42 common frames omitted
> {code}
> The failure can be tested by (RelToSqlConverterTest of Calcite Core project):
> {code:java}
>   @Test public void testSimpleRollup() {
> String query = "select \"product_id\"\n" +
> "from \"product\"\n" +
> "group by rollup((\"product_id\"))";
> String expected = "select \"product_id\"\n" +
> "from \"product\"\n" +
> "group by rollup((\"product_id\"))";
> sql(query).ok(expected);
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (CALCITE-1388) Error during RelNode to sql string conversion

2016-09-27 Thread Viktor Batytskyi (JIRA)

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

Viktor Batytskyi updated CALCITE-1388:
--
Fix Version/s: next

> Error during RelNode to sql string conversion
> -
>
> Key: CALCITE-1388
> URL: https://issues.apache.org/jira/browse/CALCITE-1388
> Project: Calcite
>  Issue Type: Bug
>  Components: core
> Environment: Oracle JDK 1.8
>Reporter: Viktor Batytskyi
>Assignee: Julian Hyde
> Fix For: next
>
>
> The following query contains ROLLUP operator in GROUP BY clause. 
> {code:sql}
> SELECT player_id, video_id, SUM(clicks)
> FROM Table
> GROUP BY ROLLUP((player_id, video_id))
> {code}
> After the sql string is parsed and validated by executing: 
> {code}
>   val planner = Frameworks.getPlanner(config)
>   val sqlNode = planner.parse(mockedSql)
>   val validatedSql = planner.validate(sqlNode)
>   val relExpression = planner.rel(validatedSql).project()
> {code}
> The resulting relExpression can't be transformed back to a query:
> {code}
> private val VERTICA = SqlDialect.DatabaseProduct.VERTICA.getDialect
> .
> val sql = new RelToSqlConverter(VERTICA).visitChild(0, 
> relExpression).asQuery.toSqlString(VERTICA).getSql
> {code}
> The exception is thrown:
> {code}
> Caused by: java.lang.reflect.InvocationTargetException: null
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
>   ... 29 common frames omitted
> Caused by: java.lang.AssertionError: Internal error: While invoking method 
> 'public org.apache.calcite.rel.rel2sql.SqlImplementor$Result 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(org.apache.calcite.rel.core.Project)'
>   at org.apache.calcite.util.Util.newInternal(Util.java:792)
>   at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:534)
>   at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:80)
>   at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitChild(RelToSqlConverter.java:84)
>   at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:125)
>   ... 34 common frames omitted
> Caused by: java.lang.reflect.InvocationTargetException: null
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
>   ... 37 common frames omitted
> Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
>   at java.util.ArrayList.rangeCheck(ArrayList.java:653)
>   at java.util.ArrayList.get(ArrayList.java:429)
>   at org.apache.calcite.sql.SqlNodeList.get(SqlNodeList.java:93)
>   at 
> org.apache.calcite.rel.rel2sql.SqlImplementor$Result$1.field(SqlImplementor.java:781)
>   at 
> org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:450)
>   at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:133)
>   ... 42 common frames omitted
> {code}
> The failure can be tested by (RelToSqlConverterTest of Calcite Core project):
> {code:java}
>   @Test public void testSimpleRollup() {
> String query = "select \"product_id\"\n" +
> "from \"product\"\n" +
> "group by rollup((\"product_id\"))";
> String expected = "select \"product_id\"\n" +
> "from \"product\"\n" +
> "group by rollup((\"product_id\"))";
> sql(query).ok(expected);
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (CALCITE-1388) Error during RelNode to sql string conversion

2016-09-27 Thread Viktor Batytskyi (JIRA)

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

Viktor Batytskyi updated CALCITE-1388:
--
Description: 
The following query contains ROLLUP operator in GROUP BY clause. 
{code:sql}
SELECT player_id, video_id, SUM(clicks)
FROM Table
GROUP BY ROLLUP((player_id, video_id))
{code}

After the sql string is parsed and validated by executing: 
{code}
  val planner = Frameworks.getPlanner(config)
  val sqlNode = planner.parse(mockedSql)
  val validatedSql = planner.validate(sqlNode)
  val relExpression = planner.rel(validatedSql).project()
{code}

The resulting relExpression can't be transformed back to a query:
{code}
private val VERTICA = SqlDialect.DatabaseProduct.VERTICA.getDialect

.

val sql = new RelToSqlConverter(VERTICA).visitChild(0, 
relExpression).asQuery.toSqlString(VERTICA).getSql
{code}

The exception is thrown:
{code}
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 29 common frames omitted
Caused by: java.lang.AssertionError: Internal error: While invoking method 
'public org.apache.calcite.rel.rel2sql.SqlImplementor$Result 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(org.apache.calcite.rel.core.Project)'
at org.apache.calcite.util.Util.newInternal(Util.java:792)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:534)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:80)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitChild(RelToSqlConverter.java:84)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:125)
... 34 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 37 common frames omitted
Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at org.apache.calcite.sql.SqlNodeList.get(SqlNodeList.java:93)
at 
org.apache.calcite.rel.rel2sql.SqlImplementor$Result$1.field(SqlImplementor.java:781)
at 
org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:450)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:133)
... 42 common frames omitted
{code}



The failure can be tested by (RelToSqlConverterTest of Calcite Core project):
{code:java}
  @Test public void testSimpleRollup() {
String query = "select \"product_id\"\n" +
"from \"product\"\n" +
"group by rollup((\"product_id\"))";
String expected = "select \"product_id\"\n" +
"from \"product\"\n" +
"group by rollup((\"product_id\"))";
sql(query).ok(expected);
  }
{code}

  was:
The following query contains ROLLUP operator in GROUP BY clause. 
{code:sql}
SELECT player_id, video_id, SUM(clicks)
FROM Table
GROUP BY ROLLUP((player_id, video_id))
{code}

After the sql string is parsed and validated by executing: 
{code}
  val planner = Frameworks.getPlanner(config)
  val sqlNode = planner.parse(mockedSql)
  val validatedSql = planner.validate(sqlNode)
  val relExpression = planner.rel(validatedSql).project()
{code}

The resulting relExpression can't be transformed back to a query:
{code}
private val VERTICA = SqlDialect.DatabaseProduct.VERTICA.getDialect

.

val sql = new RelToSqlConverter(VERTICA).visitChild(0, 
relExpression).asQuery.toSqlString(VERTICA).getSql
{code}

The exception is thrown:
{code}
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 29 common frames omitted
Caused 

[jira] [Updated] (CALCITE-1388) Error during RelNode to sql string conversion

2016-09-27 Thread Viktor Batytskyi (JIRA)

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

Viktor Batytskyi updated CALCITE-1388:
--
Description: 
The following query contains ROLLUP operator in GROUP BY clause. 
{code:sql}
SELECT player_id, video_id, SUM(clicks)
FROM Table
GROUP BY ROLLUP((player_id, video_id))
{code}

After the sql string is parsed and validated by executing: 
{code}
  val planner = Frameworks.getPlanner(config)
  val sqlNode = planner.parse(mockedSql)
  val validatedSql = planner.validate(sqlNode)
  val relExpression = planner.rel(validatedSql).project()
{code}

The resulting relExpression can't be transformed back to a query:
{code}
private val VERTICA = SqlDialect.DatabaseProduct.VERTICA.getDialect

.

val sql = new RelToSqlConverter(VERTICA).visitChild(0, 
relExpression).asQuery.toSqlString(VERTICA).getSql
{code}

The exception is thrown:
{code}
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 29 common frames omitted
Caused by: java.lang.AssertionError: Internal error: While invoking method 
'public org.apache.calcite.rel.rel2sql.SqlImplementor$Result 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(org.apache.calcite.rel.core.Project)'
at org.apache.calcite.util.Util.newInternal(Util.java:792)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:534)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:80)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitChild(RelToSqlConverter.java:84)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:125)
... 34 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 37 common frames omitted
Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at org.apache.calcite.sql.SqlNodeList.get(SqlNodeList.java:93)
at 
org.apache.calcite.rel.rel2sql.SqlImplementor$Result$1.field(SqlImplementor.java:781)
at 
org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:450)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:133)
... 42 common frames omitted
{code}



The failure can be tested by (RelToSqlConverterTest):
{code:java}
  @Test public void testSimpleRollup() {
String query = "select \"product_id\"\n" +
"from \"product\"\n" +
"group by rollup((\"product_id\"))";
String expected = "select \"product_id\"\n" +
"from \"product\"\n" +
"group by rollup((\"product_id\"))";
sql(query).ok(expected);
  }
{code}

  was:
The following query contains ROLLUP operator in GROUP BY clause. 
{code:sql}
SELECT player_id, video_id, SUM(clicks)
FROM Table
GROUP BY ROLLUP((player_id, video_id))
{code}

After the sql string is parsed and validated by executing: 
{code}
  val planner = Frameworks.getPlanner(config)
  val sqlNode = planner.parse(mockedSql)
  val validatedSql = planner.validate(sqlNode)
  val relExpression = planner.rel(validatedSql).project()
{code}

The resulting relExpression can't be transformed back to a query:
{code}
private val VERTICA = SqlDialect.DatabaseProduct.VERTICA.getDialect

.

val sql = new RelToSqlConverter(VERTICA).visitChild(0, 
relExpression).asQuery.toSqlString(VERTICA).getSql
{code}

The exception is thrown:
{code}
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 29 common frames omitted
Caused by: 

[jira] [Updated] (CALCITE-1388) Error during RelNode to sql string conversion

2016-09-27 Thread Viktor Batytskyi (JIRA)

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

Viktor Batytskyi updated CALCITE-1388:
--
Description: 
The following query contains ROLLUP operator in GROUP BY clause. 
{code:sql}
SELECT player_id, video_id, SUM(clicks)
FROM Table
GROUP BY ROLLUP((player_id, video_id))
{code}

After the sql string is parsed and validated by executing: 
{code}
  val planner = Frameworks.getPlanner(config)
  val sqlNode = planner.parse(mockedSql)
  val validatedSql = planner.validate(sqlNode)
  val relExpression = planner.rel(validatedSql).project()
{code}

The resulting relExpression can't be transformed back to a query:
{code}
private val VERTICA = SqlDialect.DatabaseProduct.VERTICA.getDialect

.

val sql = new RelToSqlConverter(VERTICA).visitChild(0, 
relExpression).asQuery.toSqlString(VERTICA).getSql
{code}

The exception is thrown:
{code}
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 29 common frames omitted
Caused by: java.lang.AssertionError: Internal error: While invoking method 
'public org.apache.calcite.rel.rel2sql.SqlImplementor$Result 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(org.apache.calcite.rel.core.Project)'
at org.apache.calcite.util.Util.newInternal(Util.java:792)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:534)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:80)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitChild(RelToSqlConverter.java:84)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:125)
... 34 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 37 common frames omitted
Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at org.apache.calcite.sql.SqlNodeList.get(SqlNodeList.java:93)
at 
org.apache.calcite.rel.rel2sql.SqlImplementor$Result$1.field(SqlImplementor.java:781)
at 
org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:450)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:133)
... 42 common frames omitted
{code}



The failure can be tested by (RelToSqlConverterTest):
{code:java}
  @Test public void testSimpleRollup() {
String query = "select \"product_id\"\n" +
"from \"product\"\n" +
"group by rollup((\"product_id\"))";
String expected = "select \"product_id\"\n" +
"from \"product\"\n" +
"group by rollup((\"product_id\"))";
  }
{code}

  was:
The following query contains ROLLUP operator in GROUP BY clause. 
{code:sql}
SELECT player_id, video_id, SUM(clicks)
FROM Table
GROUP BY ROLLUP((player_id, video_id))
{code}

After the sql string is parsed and validated by executing: 
{code}
  val planner = Frameworks.getPlanner(config)
  val sqlNode = planner.parse(mockedSql)
  val validatedSql = planner.validate(sqlNode)
  val relExpression = planner.rel(validatedSql).project()
{code}

The resulting relExpression can't be transformed back to a query:
{code}
private val VERTICA = SqlDialect.DatabaseProduct.VERTICA.getDialect

.

val sql = new RelToSqlConverter(VERTICA).visitChild(0, 
relExpression).asQuery.toSqlString(VERTICA).getSql
{code}

The exception is thrown:
{code}
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 29 common frames omitted
Caused by: java.lang.AssertionError: Internal error: While 

[jira] [Updated] (CALCITE-1388) Error during RelNode to sql string conversion

2016-09-27 Thread Viktor Batytskyi (JIRA)

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

Viktor Batytskyi updated CALCITE-1388:
--
Description: 
The following query contains ROLLUP operator in GROUP BY clause. 
{code:sql}
SELECT player_id, video_id, SUM(clicks)
FROM Table
GROUP BY ROLLUP((player_id, video_id))
{code}

After the sql string is parsed and validated by executing: 
{code}
  val planner = Frameworks.getPlanner(config)
  val sqlNode = planner.parse(mockedSql)
  val validatedSql = planner.validate(sqlNode)
  val relExpression = planner.rel(validatedSql).project()
{code}

The resulting relExpression can't be transformed back to a query:
{code}
private val VERTICA = SqlDialect.DatabaseProduct.VERTICA.getDialect

.

val sql = new RelToSqlConverter(VERTICA).visitChild(0, 
relExpression).asQuery.toSqlString(VERTICA).getSql
{code}

The exception is thrown:
{code}
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 29 common frames omitted
Caused by: java.lang.AssertionError: Internal error: While invoking method 
'public org.apache.calcite.rel.rel2sql.SqlImplementor$Result 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(org.apache.calcite.rel.core.Project)'
at org.apache.calcite.util.Util.newInternal(Util.java:792)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:534)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:80)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitChild(RelToSqlConverter.java:84)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:125)
... 34 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 37 common frames omitted
Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at org.apache.calcite.sql.SqlNodeList.get(SqlNodeList.java:93)
at 
org.apache.calcite.rel.rel2sql.SqlImplementor$Result$1.field(SqlImplementor.java:781)
at 
org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:450)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:133)
... 42 common frames omitted
{code}


  was:
The following query contains ROLLUP operator in GROUP BY clause. 
{code:sql}
SELECT player_id, video_id, SUM(clicks)
FROM Table
GROUP BY ROLLUP((player_id, video_id))
{code}

After the sql string is parsed and validated by executing: 
{code}
  val planner = Frameworks.getPlanner(config)
  val sqlNode = planner.parse(mockedSql)
  val validatedSql = planner.validate(sqlNode)
  val relExpression = planner.rel(validatedSql).project()
{code}

The resulting relExpression can't be transformed back to a query:
{code}
private val VERTICA = SqlDialect.DatabaseProduct.VERTICA.getDialect

.

val sql = new RelToSqlConverter(VERTICA).visitChild(0, 
relNode).asQuery.toSqlString(VERTICA).getSql
{code}

The exception is thrown:
{code}
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 29 common frames omitted
Caused by: java.lang.AssertionError: Internal error: While invoking method 
'public org.apache.calcite.rel.rel2sql.SqlImplementor$Result 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(org.apache.calcite.rel.core.Project)'
at org.apache.calcite.util.Util.newInternal(Util.java:792)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:534)
at 

[jira] [Updated] (CALCITE-1388) Error during RelNode to sql string conversion

2016-09-27 Thread Viktor Batytskyi (JIRA)

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

Viktor Batytskyi updated CALCITE-1388:
--
Summary: Error during RelNode to sql string conversion  (was: Error during 
RelNode to sql conversion)

> Error during RelNode to sql string conversion
> -
>
> Key: CALCITE-1388
> URL: https://issues.apache.org/jira/browse/CALCITE-1388
> Project: Calcite
>  Issue Type: Bug
>  Components: core
> Environment: Oracle JDK 1.8
>Reporter: Viktor Batytskyi
>Assignee: Julian Hyde
>
> The following query contains ROLLUP operator in GROUP BY clause. 
> {code:sql}
> SELECT player_id, video_id, SUM(clicks)
> FROM Table
> GROUP BY ROLLUP((player_id, video_id))
> {code}
> After the sql string is parsed and validated by executing: 
> {code}
>   val planner = Frameworks.getPlanner(config)
>   val sqlNode = planner.parse(mockedSql)
>   val validatedSql = planner.validate(sqlNode)
>   val relExpression = planner.rel(validatedSql).project()
> {code}
> The resulting relExpression can't be transformed back to a query:
> {code}
> private val VERTICA = SqlDialect.DatabaseProduct.VERTICA.getDialect
> .
> val sql = new RelToSqlConverter(VERTICA).visitChild(0, 
> relNode).asQuery.toSqlString(VERTICA).getSql
> {code}
> The exception is thrown:
> {code}
> Caused by: java.lang.reflect.InvocationTargetException: null
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
>   ... 29 common frames omitted
> Caused by: java.lang.AssertionError: Internal error: While invoking method 
> 'public org.apache.calcite.rel.rel2sql.SqlImplementor$Result 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(org.apache.calcite.rel.core.Project)'
>   at org.apache.calcite.util.Util.newInternal(Util.java:792)
>   at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:534)
>   at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:80)
>   at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitChild(RelToSqlConverter.java:84)
>   at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:125)
>   ... 34 common frames omitted
> Caused by: java.lang.reflect.InvocationTargetException: null
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
>   ... 37 common frames omitted
> Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
>   at java.util.ArrayList.rangeCheck(ArrayList.java:653)
>   at java.util.ArrayList.get(ArrayList.java:429)
>   at org.apache.calcite.sql.SqlNodeList.get(SqlNodeList.java:93)
>   at 
> org.apache.calcite.rel.rel2sql.SqlImplementor$Result$1.field(SqlImplementor.java:781)
>   at 
> org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:450)
>   at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:133)
>   ... 42 common frames omitted
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (CALCITE-1388) Error during RelNode to sql conversion

2016-09-27 Thread Viktor Batytskyi (JIRA)

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

Viktor Batytskyi updated CALCITE-1388:
--
Description: 
The following query contains ROLLUP operator in GROUP BY clause. 
{code:sql}
SELECT player_id, video_id, SUM(clicks)
FROM Table
GROUP BY ROLLUP((player_id, video_id))
{code}

After the sql string is parsed and validated by executing: 
{code}
  val planner = Frameworks.getPlanner(config)
  val sqlNode = planner.parse(mockedSql)
  val validatedSql = planner.validate(sqlNode)
  val relExpression = planner.rel(validatedSql).project()
{code}

The resulting relExpression can't be transformed back to a query:
{code}
  private val VERTICA = SqlDialect.DatabaseProduct.VERTICA.getDialect

val sql = new RelToSqlConverter(VERTICA).visitChild(0, 
relNode).asQuery.toSqlString(VERTICA).getSql
{code}

The exception is thrown:
{code}
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 29 common frames omitted
Caused by: java.lang.AssertionError: Internal error: While invoking method 
'public org.apache.calcite.rel.rel2sql.SqlImplementor$Result 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(org.apache.calcite.rel.core.Project)'
at org.apache.calcite.util.Util.newInternal(Util.java:792)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:534)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:80)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitChild(RelToSqlConverter.java:84)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:125)
... 34 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 37 common frames omitted
Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at org.apache.calcite.sql.SqlNodeList.get(SqlNodeList.java:93)
at 
org.apache.calcite.rel.rel2sql.SqlImplementor$Result$1.field(SqlImplementor.java:781)
at 
org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:450)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:133)
... 42 common frames omitted
{code}


  was:
The following query contains ROLLUP operator in GROUP BY clause. 
{code:sql}
SELECT player_id, video_id, SUM(clicks)
FROM Table
GROUP BY ROLLUP((player_id, video_id))
{code}

After the sql string is parsed and validated by executing: 
{code:scala}
  val planner = Frameworks.getPlanner(config)
  val sqlNode = planner.parse(mockedSql)
  val validatedSql = planner.validate(sqlNode)
  val relExpression = planner.rel(validatedSql).project()
{code}

The resulting relExpression can't be transformed back to a query:
{code:scala}
  private val VERTICA = SqlDialect.DatabaseProduct.VERTICA.getDialect

val sql = new RelToSqlConverter(VERTICA).visitChild(0, 
relNode).asQuery.toSqlString(VERTICA).getSql
{code}

The exception is thrown:
{code}
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 29 common frames omitted
Caused by: java.lang.AssertionError: Internal error: While invoking method 
'public org.apache.calcite.rel.rel2sql.SqlImplementor$Result 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(org.apache.calcite.rel.core.Project)'
at org.apache.calcite.util.Util.newInternal(Util.java:792)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:534)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:80)

[jira] [Updated] (CALCITE-1388) Error during RelNode to sql conversion

2016-09-27 Thread Viktor Batytskyi (JIRA)

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

Viktor Batytskyi updated CALCITE-1388:
--
Description: 
The following query contains ROLLUP operator in GROUP BY clause. 
{code:sql}
SELECT player_id, video_id, SUM(clicks)
FROM Table
GROUP BY ROLLUP((player_id, video_id))
{code}

After the sql string is parsed and validated by executing: 
{code:scala}
  val planner = Frameworks.getPlanner(config)
  val sqlNode = planner.parse(mockedSql)
  val validatedSql = planner.validate(sqlNode)
  val relExpression = planner.rel(validatedSql).project()
{code}

The resulting relExpression can't be transformed back to a query:
{code:scala}
  private val VERTICA = SqlDialect.DatabaseProduct.VERTICA.getDialect

val sql = new RelToSqlConverter(VERTICA).visitChild(0, 
relNode).asQuery.toSqlString(VERTICA).getSql
{code}

The exception is thrown:
{code}
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 29 common frames omitted
Caused by: java.lang.AssertionError: Internal error: While invoking method 
'public org.apache.calcite.rel.rel2sql.SqlImplementor$Result 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(org.apache.calcite.rel.core.Project)'
at org.apache.calcite.util.Util.newInternal(Util.java:792)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:534)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:80)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visitChild(RelToSqlConverter.java:84)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:125)
... 34 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 37 common frames omitted
Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at org.apache.calcite.sql.SqlNodeList.get(SqlNodeList.java:93)
at 
org.apache.calcite.rel.rel2sql.SqlImplementor$Result$1.field(SqlImplementor.java:781)
at 
org.apache.calcite.rel.rel2sql.SqlImplementor$Context.toSql(SqlImplementor.java:450)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:133)
... 42 common frames omitted
{code}


  was:
The following query contains ROLLUP operator in GROUP BY clause. 
```
SELECT player_id, video_id, SUM(clicks)
FROM Table
GROUP BY ROLLUP((player_id, video_id))
```
After the string sql is parsed and validated by executing: 
```
  val planner = Frameworks.getPlanner(config)
  val sqlNode = planner.parse(mockedSql)
  val validatedSql = planner.validate(sqlNode)
  val relExpression = planner.rel(validatedSql).project()
```

The resulting relExpression can't be transformed back to a query:

  private val VERTICA = SqlDialect.DatabaseProduct.VERTICA.getDialect

val sql = new RelToSqlConverter(VERTICA).visitChild(0, 
relNode).asQuery.toSqlString(VERTICA).getSql
 

The exception is thrown:
```
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:531)
... 29 common frames omitted
Caused by: java.lang.AssertionError: Internal error: While invoking method 
'public org.apache.calcite.rel.rel2sql.SqlImplementor$Result 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(org.apache.calcite.rel.core.Project)'
at org.apache.calcite.util.Util.newInternal(Util.java:792)
at org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:534)
at 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:80)
at