adarshsanjeev commented on code in PR #12386:
URL: https://github.com/apache/druid/pull/12386#discussion_r862865326


##########
sql/src/main/java/org/apache/druid/sql/calcite/parser/DruidSqlParserUtils.java:
##########
@@ -167,4 +189,89 @@ public static Granularity 
convertSqlNodeToGranularity(SqlNode sqlNode) throws Pa
         TimeFloorOperatorConversion.SQL_FUNCTION_NAME
     ));
   }
+
+  public static List<String> validateQueryAndConvertToIntervals(
+      SqlNode replaceTimeQuery,
+      Granularity granularity,
+      DateTimeZone dateTimeZone
+  ) throws ValidationException
+  {
+    if (replaceTimeQuery instanceof SqlLiteral && 
"all".equalsIgnoreCase(((SqlLiteral) replaceTimeQuery).toValue())) {
+      return ImmutableList.of("all");
+    }
+
+    DimFilter dimFilter = convertQueryToDimFilter(replaceTimeQuery, 
dateTimeZone);
+    if 
(!ImmutableSet.of(ColumnHolder.TIME_COLUMN_NAME).equals(dimFilter.getRequiredColumns()))
 {
+      throw new ValidationException("Only " + ColumnHolder.TIME_COLUMN_NAME + 
" column is supported in OVERWRITE WHERE clause");
+    }
+
+    Filtration filtration = Filtration.create(dimFilter);
+    filtration = MoveTimeFiltersToIntervals.instance().apply(filtration);
+    List<Interval> intervals = filtration.getIntervals();

Review Comment:
   I didn't fully understand what filter left means.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to