You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ji...@apache.org on 2021/02/09 23:47:30 UTC

[incubator-pinot] branch pinot-time-spec created (now b0a03fb)

This is an automated email from the ASF dual-hosted git repository.

jihao pushed a change to branch pinot-time-spec
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git.


      at b0a03fb  [TE] escape Pinot timespect SQL query

This branch includes the following new commits:

     new b0a03fb  [TE] escape Pinot timespect SQL query

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[incubator-pinot] 01/01: [TE] escape Pinot timespect SQL query

Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jihao pushed a commit to branch pinot-time-spec
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit b0a03fba93fef7669df6c87738bc7099c415bd1a
Author: Jihao Zhang <ji...@linkedin.com>
AuthorDate: Tue Feb 9 15:46:44 2021 -0800

    [TE] escape Pinot timespect SQL query
---
 .../pinot/thirdeye/datasource/pinot/PinotDataSourceTimeQuery.java      | 3 ++-
 .../main/java/org/apache/pinot/thirdeye/datasource/pinot/SqlUtils.java | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/PinotDataSourceTimeQuery.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/PinotDataSourceTimeQuery.java
index b4abdb0..50651cf 100644
--- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/PinotDataSourceTimeQuery.java
+++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/PinotDataSourceTimeQuery.java
@@ -85,7 +85,8 @@ public class PinotDataSourceTimeQuery {
       String timeClause = SqlUtils
           .getBetweenClause(new DateTime(0, DateTimeZone.UTC), new DateTime(cutoffTime, DateTimeZone.UTC), timeSpec, dataset);
 
-      String maxTimeSql = String.format(TIME_QUERY_TEMPLATE, functionName, timeSpec.getColumnName(), dataset, timeClause);
+      String maxTimeSql = SqlUtils.escapeSqlReservedKeywords(
+          String.format(TIME_QUERY_TEMPLATE, functionName, timeSpec.getColumnName(), dataset, timeClause));
       PinotQuery maxTimePinotQuery = new PinotQuery(maxTimeSql, dataset);
 
       ThirdEyeResultSetGroup resultSetGroup;
diff --git a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/SqlUtils.java b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/SqlUtils.java
index b418252..5171bb8 100644
--- a/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/SqlUtils.java
+++ b/thirdeye/thirdeye-pinot/src/main/java/org/apache/pinot/thirdeye/datasource/pinot/SqlUtils.java
@@ -198,7 +198,7 @@ public class SqlUtils {
     return escapeSqlReservedKeywords(dimensionAsMetricPql);
   }
 
-  private static String escapeSqlReservedKeywords(String query) {
+  public static String escapeSqlReservedKeywords(String query) {
     // escape all reserve keywords with double quotes
     return RESERVED_KEYWORD_PATTERN.matcher(query).replaceAll(RESERVED_KEYWORD_REPLACEMENT);
   }


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