jihaozh commented on a change in pull request #6528:
URL: https://github.com/apache/incubator-pinot/pull/6528#discussion_r568990857



##########
File path: 
thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/SqlUtils.java
##########
@@ -189,9 +195,13 @@ public static String 
getDimensionAsMetricSql(ThirdEyeRequest request, MetricFunc
         request.getGroupBy(), request.getGroupByTimeGranularity(), 
dataTimeSpec,
         metricNamesList, metricNamesColumnsList, metricValuesColumn, 
request.getLimit());
 
-    return dimensionAsMetricPql;
+    return escapeSqlReservedKeywords(dimensionAsMetricPql);
   }
 
+  private static String escapeSqlReservedKeywords(String query) {
+    // escape all reserve keywords with double quotes
+    return 
RESERVED_KEYWORD_PATTERN.matcher(query).replaceAll(RESERVED_KEYWORD_REPLACEMENT);

Review comment:
       Actually, it is pretty standard to escape the keyword only. Adopted this 
code from a library.




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to