wenhuitang commented on a change in pull request #1990:
URL: https://github.com/apache/calcite/pull/1990#discussion_r435115515
##########
File path:
cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraFilter.java
##########
@@ -174,14 +180,26 @@ 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) {
+ Comparable value = RexLiteral.value(literal);
+ switch (literal.getTypeName()) {
+ case TIMESTAMP:
+ case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
+ assert value instanceof TimestampString;
+ final SimpleDateFormat dateFormatter =
+ getDateFormatter(TIMESTAMP3_FORMAT_WITH_TIME_ZONE);
Review comment:
> The variable name `TIMESTAMP3_FORMAT_WITH_TIME_ZONE` is a little
confusing. Can we use `ISO_TIME_FORMAT` directly?
ISO 8601 format has several kinds of formats.
DateTimeUtils#TIMESTAMP_FORMAT_STRING also follows iso date string format.
How about using TIMESTAMP_FORMAT_STRING with different labels? Such as
TIMESTAMP_FORMAT_STRING1 and TIMESTAMP_FORMAT_STRING2.
----------------------------------------------------------------
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:
[email protected]