You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Rajeshbabu Chintaguntla (JIRA)" <ji...@apache.org> on 2017/01/05 18:38:58 UTC

[jira] [Commented] (PHOENIX-3568) Handle row timestamp columns properly in phoenix calcite

    [ https://issues.apache.org/jira/browse/PHOENIX-3568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15802141#comment-15802141 ] 

Rajeshbabu Chintaguntla commented on PHOENIX-3568:
--------------------------------------------------

[~maryannxue] [~jamestaylor] fyi.

> Handle row timestamp columns properly in phoenix calcite
> --------------------------------------------------------
>
>                 Key: PHOENIX-3568
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3568
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Rajeshbabu Chintaguntla
>            Assignee: Rajeshbabu Chintaguntla
>              Labels: calcite
>
> If we don't pass row time stamp column value phoenix pass 0 initially while preparing Mutations the the value will be replaced with mutation timestamp. But with Phoenix Calcite we are passing null so the test cases related to row timestamp are failing with the following errors.
> {noformat}
> java.sql.SQLException: java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of at least 8 bytes, but had 0
> 	at org.apache.phoenix.end2end.UpsertSelectIT.testRowTimestampColWithViewsIndexesAndSaltedTables(UpsertSelectIT.java:1125)
> Caused by: java.lang.RuntimeException: java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of at least 8 bytes, but had 0
> 	at org.apache.phoenix.end2end.UpsertSelectIT.testRowTimestampColWithViewsIndexesAndSaltedTables(UpsertSelectIT.java:1125)
> Caused by: java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of at least 8 bytes, but had 0
> 	at org.apache.phoenix.end2end.UpsertSelectIT.testRowTimestampColWithViewsIndexesAndSaltedTables(UpsertSelectIT.java:1125)
> {noformat}
> I think as a fix while preparing bind expressions if it's null we need to prepare proper literal expression. So that the remaining things will be taken care by Phoenix itself.
> {noformat}
>         for (int i = 0; i< projects.size() ; i++) {
>             RexNode project = projects.get(i);
>             if(table.getRowTimestampColPos()!= -1 && ((i + specialColumns) == table.getRowTimestampColPos()) && project.toString() == "null") {
>                 PColumn pColumn = table.getPKColumns().get(table.getRowTimestampColPos());
>                 LiteralParseNode literal = UpsertCompiler.getNodeForRowTimestampColumn(pColumn);
>                 try {
>                     exprs.add(LiteralExpression.newConstant(literal.getValue(), pColumn.getDataType(), pColumn.getSortOrder(), Determinism.ALWAYS));
>                 } catch (SQLException e) {
>                     throw new RuntimeException(e);
>                 }
>             } else {
>                 exprs.add(CalciteUtils.toExpression(project, implementor));
>             }
>         }
>         TupleProjector tupleProjector = implementor.project(exprs);
> {noformat}



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