You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/02/02 22:02:59 UTC

[GitHub] [incubator-pinot] akshayrai commented on a change in pull request #6528: [TE] SQL migration - escape the keywords

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



##########
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:
       Rather than maintaining a reserved keyword list, it might be better to escape every dimension?




----------------------------------------------------------------
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



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