zhztheplayer commented on a change in pull request #1014: [CALCITE-2804] fix 
casting to timestamps because of malformed dimensi…
URL: https://github.com/apache/calcite/pull/1014#discussion_r256895426
 
 

 ##########
 File path: 
druid/src/main/java/org/apache/calcite/adapter/druid/DruidExpressions.java
 ##########
 @@ -159,7 +159,7 @@ public static String toDruidExpression(
   }
 
   public static String fromColumn(String columnName) {
-    return DruidQuery.format("\"%s\"", columnName);
+    return DruidQuery.format("%s", columnName);
 
 Review comment:
   > The expression call is already inside a json string. So I'm not sure it 
needs escape characters
   
   Sorry I am a little confused with this. What I'm seeing is that your change 
removes the double quote of identifiers from the generated Druid expression. 
Suppose previously the generated expression is 
   ```
   timestamp_format("\\u0000\\u0001\\u0002",'yyyy-MM-dd','America/New_York')
   ```
   , now it would become
   ```
   timestamp_format(\\u0000\\u0001\\u0002,'yyyy-MM-dd','America/New_York')
   ```
   Obviously it is an invalid expression because the parser[1] does not accept 
a `\\u0000\\u0001\\u0002` as identifier.
   
   [1] 
https://github.com/apache/incubator-druid/blob/1f299408114d35a7101eb59fdcc3b6c9e30d8286/core/src/main/antlr4/org/apache/druid/math/expr/antlr/Expr.g4#L36
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to