kfaraz commented on code in PR #13310:
URL: https://github.com/apache/druid/pull/13310#discussion_r1015865106


##########
server/src/main/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinator.java:
##########
@@ -232,7 +232,10 @@ private Set<SegmentIdWithShardSpec> 
getPendingSegmentsForIntervalWithHandle(
     final ResultIterator<byte[]> dbSegments =
         handle.createQuery(
             StringUtils.format(
-                "SELECT payload FROM %1$s WHERE dataSource = :dataSource AND 
start <= :end and %2$send%2$s >= :start",
+                // This query might fail if the year has a different number of 
digits
+                // See https://github.com/apache/druid/pull/11582 for a 
similar issue
+                // Using long for these timestamps instead of varchar would 
give correct time comparisons
+                "SELECT payload FROM %1$s WHERE dataSource = :dataSource AND 
start < :end and %2$send%2$s > :start",

Review Comment:
   We are trying to avoid selecting intervals that only abut the search 
interval and don't have an actual overlap. Such intervals eventually get 
filtered out via the check on `interval.overlaps(identifier.getInterval())` but 
only after the costly deserialization.
   
   I have updated the description, which gives an example of such an interval.
   This is still not a complete fix as the query can return incorrect results 
in cases where a string comparison of the two intervals is not feasible.



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