Repository: phoenix
Updated Branches:
  refs/heads/calcite faff90afd -> b8c8a4f50


PHOENIX-3303 Handle Date/Time/Timestamp objects and interval types in 
RexNode-to-Expression translation


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/b8c8a4f5
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/b8c8a4f5
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/b8c8a4f5

Branch: refs/heads/calcite
Commit: b8c8a4f5076a3ef8c841141a38d3ce641503fc48
Parents: faff90a
Author: maryannxue <maryann....@gmail.com>
Authored: Tue Sep 20 10:33:57 2016 -0700
Committer: maryannxue <maryann....@gmail.com>
Committed: Tue Sep 20 10:33:57 2016 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/phoenix/calcite/CalciteUtils.java    | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b8c8a4f5/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java 
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java
index 8bce4cd..668da12 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java
@@ -1,7 +1,9 @@
 package org.apache.phoenix.calcite;
 
 import java.sql.SQLException;
+import java.sql.Timestamp;
 import java.util.Arrays;
+import java.util.GregorianCalendar;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -128,6 +130,9 @@ public class CalciteUtils {
         if (isArrayType) {
             sqlTypeName = ((ArraySqlType) 
relDataType).getComponentType().getSqlTypeName();
         }
+        if (SqlTypeName.INTERVAL_TYPES.contains(sqlTypeName)) {
+            sqlTypeName = SqlTypeName.DECIMAL;
+        }
         final int ordinal = sqlTypeName.getJdbcOrdinal();
         if (ordinal >= PDataType.ARRAY_TYPE_BASE) {
             throw new UnsupportedOperationException(
@@ -605,6 +610,8 @@ public class CalciteUtils {
                                    o = ((NlsString) o).getValue();
                                } else if (o instanceof ByteString) {
                                    o = ((ByteString) o).getBytes();
+                               } else if (o instanceof GregorianCalendar) {
+                                   o = new Timestamp(((GregorianCalendar) 
o).getTimeInMillis());
                                }
                                try {
                     return LiteralExpression.newConstant(o, targetType);

Reply via email to