phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maryann Xue (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-3355) Register Phoenix built-in functions as Calcite functions
Date Tue, 25 Oct 2016 20:25:58 GMT

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

Maryann Xue commented on PHOENIX-3355:
--------------------------------------

[~rajeshbabu], Take a closer look at the plan with default values. Calcite interpret the default
value as a special sql operator "DEFAULT()", and we did not handle that operator in our translation
logic yet. So try adding the following to your CalciteUtils.java, and it'll work fine.
{code}
@@ -734,6 +734,18 @@ public class CalciteUtils {
                 }
             }
         });
+               EXPRESSION_MAP.put(SqlKind.DEFAULT, new ExpressionFactory() {
+            @SuppressWarnings("rawtypes")
+            @Override
+            public Expression newExpression(RexNode node, PhoenixRelImplementor implementor)
{
+                PDataType targetType = relDataTypeToPDataType(node.getType());
+                try {
+                    return LiteralExpression.newConstant(null, targetType);
+                } catch (SQLException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+               });
         EXPRESSION_MAP.put(SqlKind.OTHER_FUNCTION, new ExpressionFactory() {
             @Override
             public Expression newExpression(RexNode node,
{code}

> Register Phoenix built-in functions as Calcite functions
> --------------------------------------------------------
>
>                 Key: PHOENIX-3355
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3355
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>            Assignee: Eric Lomore
>              Labels: calcite
>         Attachments: PHOENIX-3355.wip
>
>
> We should register all Phoenix built-in functions that don't exist in Calcite.



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

Mime
View raw message