[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 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 
org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSq

[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: java.lang.AssertionError: Internal

[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 inv

[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 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\"))";
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: java.lang.AssertionErr

[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 Julian Hyde (JIRA)

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

Julian Hyde updated CALCITE-1388:
-
Fix Version/s: (was: 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
>
> 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)