git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Timestamp as a parameter of UDF


Hello,

I am trying to create UDF with java.sql.Timestamp as a parameter:

public static QueryableTable getTable(
@Parameter(name = "Projection") String projection,
@Parameter(name = "Query") String query,
@Parameter(name = "Test Timestamp") Timestamp timestamp)

But when using following UDF like this:
SELECT * FROM TABLE(MYUDF('ID','',  TIMESTAMP '2013-01-01 01:01:01'))

I've got following exception and wondering whether I am missing something
or having date/time as a parameter is not fully supported yet?

[INFO] [talledLocalContainer] java.lang.AssertionError: value 2013-01-01
01:01:01 does not match type class java.sql.Timestamp
[INFO] [talledLocalContainer] at
org.apache.calcite.linq4j.tree.ConstantExpression.<init>(ConstantExpression.java:49)
[INFO] [talledLocalContainer] at
org.apache.calcite.linq4j.tree.Expressions.constant(Expressions.java:588)
[INFO] [talledLocalContainer] at
org.apache.calcite.linq4j.tree.OptimizeShuttle.visit(OptimizeShuttle.java:278)
[INFO] [talledLocalContainer] at
org.apache.calcite.linq4j.tree.UnaryExpression.accept(UnaryExpression.java:37)
[INFO] [talledLocalContainer] at
org.apache.calcite.linq4j.tree.GotoStatement.accept(GotoStatement.java:60)
[INFO] [talledLocalContainer] at
org.apache.calcite.linq4j.tree.BlockBuilder.optimize(BlockBuilder.java:438)
[INFO] [talledLocalContainer] at
org.apache.calcite.linq4j.tree.BlockBuilder.toBlock(BlockBuilder.java:322)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.validate.SqlUserDefinedTableMacro.coerce(SqlUserDefinedTableMacro.java:190)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.validate.SqlUserDefinedTableMacro.convertArguments(SqlUserDefinedTableMacro.java:110)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.validate.SqlUserDefinedTableFunction.getRowType(SqlUserDefinedTableFunction.java:70)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.validate.ProcedureNamespace.validateImpl(ProcedureNamespace.java:62)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:971)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:950)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3036)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3018)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3288)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:971)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:950)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:216)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:925)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:629)
[INFO] [talledLocalContainer] at
org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:553)
[INFO] [talledLocalContainer] at
org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:264)
[INFO] [talledLocalContainer] at
org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:230)
[INFO] [talledLocalContainer] at
org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:774)
[INFO] [talledLocalContainer] at
org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:638)
[INFO] [talledLocalContainer] at
org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:608)
[INFO] [talledLocalContainer] at
org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:238)
[INFO] [talledLocalContainer] at
org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:220)
[INFO] [talledLocalContainer] at
org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:209)
[INFO] [talledLocalContainer] at
org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:96)
[INFO] [talledLocalContainer] at
org.apache.calcite.avatica.AvaticaConnection.prepareStatement(AvaticaConnection.java:175)

-- 
Piotr Bojko
http://about.me/ptr.bojko