You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2020/06/01 10:23:59 UTC

[GitHub] [calcite] neoremind commented on a change in pull request #1990: [CALCITE-4026] When the cassandra primary key is of type bigint,the query will report an error

neoremind commented on a change in pull request #1990:
URL: https://github.com/apache/calcite/pull/1990#discussion_r433155542



##########
File path: cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraFilter.java
##########
@@ -174,14 +174,13 @@ private String translateMatch(RexNode condition) {
       }
     }
 
-    /** Convert the value of a literal to a string.
+    /** Returns the value of the literal.
      *
      * @param literal Literal to translate
-     * @return String representation of the literal
+     * @return The value of the literal in the form of the actual type.
      */
-    private static String literalValue(RexLiteral literal) {
-      Object value = literal.getValue2();
-      return String.valueOf(value);
+    private static Object literalValue(RexLiteral literal) {
+      return literal.getValue2();
     }

Review comment:
       For problem 2. Even if C* adapter supports precision, in avatica, `DateTimeUtils` handles milliseconds timestamp as below and neglects the precision, so that the string returned losses precision.
   ```
    /** Helper for CAST({timestamp} AS VARCHAR(n)). */
     public static String unixTimestampToString(long timestamp) {
       return unixTimestampToString(timestamp, 0);
     }
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org