[jira] [Commented] (CALCITE-2054) Parser error on trivial UPDATE with dynamic parameters

2017-11-19 Thread Enrico Olivelli (JIRA)

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

Enrico Olivelli commented on CALCITE-2054:
--

Maybe another alternative option would be to implement a flag to allow unknown 
type for dynamic parameters, letting the implementation to deal with casts

this will allow queries like
select ? as 'foo', a,b from my table which are not possible at the moment

> Parser error on trivial UPDATE with dynamic parameters
> --
>
> Key: CALCITE-2054
> URL: https://issues.apache.org/jira/browse/CALCITE-2054
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.15.0
>Reporter: Enrico Olivelli
>Assignee: Julian Hyde
>
> with a simple UPDATE like:
> UPDATE mytable set a=? where b=1
> I get the error below.
> The "Table" is a ModifiableTable + ScannableTable, with "a" of type INTEGER 
> and "b" of type VARCHAR
> Any hint ?
> Thank you
> Enrico
> {code}
> org.apache.calcite.runtime.CalciteContextException: At line 1, column 30: 
> Illegal use of dynamic parameter
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
> at 
> org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463)
> at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:803)
> at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:788)
> at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:4651)
> at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.inferUnknownTypes(SqlValidatorImpl.java:1694)
> at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.inferUnknownTypes(SqlValidatorImpl.java:1769)
> at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem(SqlValidatorImpl.java:457)
> at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.expandStar(SqlValidatorImpl.java:347)
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectList(SqlToRelConverter.java:3709)
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:663)
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:620)
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertUpdate(SqlToRelConverter.java:3398)
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3048)
> at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:556)
> at org.apache.calcite.prepare.PlannerImpl.rel(PlannerImpl.java:240)
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Created] (CALCITE-2061) Support for dynamic parameters in offset/fetch (limit)

2017-11-19 Thread Enrico Olivelli (JIRA)
Enrico Olivelli created CALCITE-2061:


 Summary: Support for dynamic parameters in offset/fetch (limit)
 Key: CALCITE-2061
 URL: https://issues.apache.org/jira/browse/CALCITE-2061
 Project: Calcite
  Issue Type: Improvement
  Components: core
Affects Versions: 1.15.0
Reporter: Enrico Olivelli
Assignee: Julian Hyde
Priority: Critical


Fetch/Offset already support RexNode, it will be useful to support Dynamic 
parameters as well.

This implementation is needed to be able to run Yahoo YCSB JDBC benchmarks 
which does large use of this syntax
select  LIMIT ?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CALCITE-2061) Support for dynamic parameters in offset/fetch (limit)

2017-11-19 Thread Enrico Olivelli (JIRA)

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

Enrico Olivelli commented on CALCITE-2061:
--

[~michaelmior] [~julianhyde] I would like to pick this up. I am starting an 
implementation, for me is blocker

> Support for dynamic parameters in offset/fetch (limit)
> --
>
> Key: CALCITE-2061
> URL: https://issues.apache.org/jira/browse/CALCITE-2061
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Affects Versions: 1.15.0
>Reporter: Enrico Olivelli
>Assignee: Julian Hyde
>Priority: Critical
>
> Fetch/Offset already support RexNode, it will be useful to support Dynamic 
> parameters as well.
> This implementation is needed to be able to run Yahoo YCSB JDBC benchmarks 
> which does large use of this syntax
> select  LIMIT ?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CALCITE-1940) Implement dialect specific support for sequences

2017-11-19 Thread Julian Hyde (JIRA)

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

Julian Hyde commented on CALCITE-1940:
--

[~christian.beikov], Is there any chance this change (or part of it) will be 
ready for release 1.15?

> Implement dialect specific support for sequences
> 
>
> Key: CALCITE-1940
> URL: https://issues.apache.org/jira/browse/CALCITE-1940
> Project: Calcite
>  Issue Type: Improvement
>Reporter: Christian Beikov
>Assignee: Julian Hyde
>
> The Calcite parser and validator already supports sequences but the push down 
> to the JDBC level is currently limited. SInce sequences are not supported on 
> all DBMS every sql dialect should have the possibility to render it's own way 
> of extracting sequence information or incrementing the value.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CALCITE-2053) Overloaded user-defined functions that have Double and BigDecimal arguments will goes wrong

2017-11-19 Thread yuqi (JIRA)

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

yuqi commented on CALCITE-2053:
---

yes, similar to CALCITE-1881, but it does exist and has not been fixed

> Overloaded user-defined functions that have Double and BigDecimal arguments 
> will goes wrong
> ---
>
> Key: CALCITE-2053
> URL: https://issues.apache.org/jira/browse/CALCITE-2053
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.13.0
>Reporter: yuqi
>Assignee: Julian Hyde
>
> We define a udf function class have two function as follows 
> {code:java}
> public double toDouble(Double var) {
>   return var;
> }
> 
>  public double toDouble(BigDecimal var) {
>   return var.doubleValue();
> }
> {code}
> when use it in sql like:
> {code:sql}
> select sum(price) from tb;
> {code}
> where price is a double value in table tb, exception occurs:
> {code:java}
> java.lang.AssertionError: DECIMAL(19, 0)
>   at 
> org.apache.calcite.sql.type.SqlTypeExplicitPrecedenceList.compareTypePrecedence(SqlTypeExplicitPrecedenceList.java:154)
>   at org.apache.calcite.sql.SqlUtil.bestMatch(SqlUtil.java:626)
>   at 
> org.apache.calcite.sql.SqlUtil.filterRoutinesByTypePrecedence(SqlUtil.java:592)
>   at 
> org.apache.calcite.sql.SqlUtil.lookupSubjectRoutines(SqlUtil.java:446)
>   at org.apache.calcite.sql.SqlUtil.lookupRoutine(SqlUtil.java:371)
>   at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:245)
>   at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:223)
>   at 
> org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5371)
>   at 
> org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5358)
>   at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:138)
>   at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1592)
>   at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1577)
>   at org.apache.calcite.sql.SqlNode.validateExpr(SqlNode.java:236)
>   at org.apache.calcite.sql.SqlOperator.validateCall(SqlOperator.java:407)
>   at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.validateCall(SqlValidatorImpl.java:5081)
>   at org.apache.calcite.sql.SqlCall.validate(SqlCall.java:115)
>   at org.apache.calcite.sql.SqlNode.validateExpr(SqlNode.java:235)
>   at org.apache.calcite.sql.SqlOperator.validateCall(SqlOperator.java:407)
>   at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.validateCall(SqlValidatorImpl.java:5081)
>   at org.apache.calcite.sql.SqlCall.validate(SqlCall.java:115)
>   at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:901)
>   at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:611)
>   at 
> org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:551)
>   at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:263)
>   at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:229)
>   at 
> org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:786)
>   at 
> org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:640)
>   at 
> org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:610)
>   at 
> org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:221)
>   at 
> org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:603)
>   at 
> org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:638)
>   at 
> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:149)
>   at 
> org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:218)
>   at 
> org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:564)
>   at 
> org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1337)
>   at 
> org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1320)
>   at 
> org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1284)
>   at 
> org.apache.calcite.test.UdfTest.testDoubleAndDecimal(UdfTest.java:896)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
>