You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2020/01/30 02:53:30 UTC

[GitHub] [druid] liliuleo93 opened a new issue #9289: Use String comparison on timestamp when query PostgresMetadataStorage

liliuleo93 opened a new issue #9289: Use String comparison on timestamp when query PostgresMetadataStorage
URL: https://github.com/apache/druid/issues/9289
 
 
   Looks like [here](https://github.com/apache/druid/blob/fe24402b3fac5c498a816868f7b2f22a67742349/server/src/main/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinator.java#L203) Druid parse time interval to string to generate sql, and [here](https://github.com/apache/druid/blob/fe24402b3fac5c498a816868f7b2f22a67742349/server/src/main/java/org/apache/druid/metadata/SQLMetadataConnector.java#L267) use `VARCHAR(255)` as start and end. So the sql will compare time as string, e.g `140000-01-01 < 2020-01-01`.
   
   I found this problem happens in some unit tests. Like, [here](https://github.com/apache/druid/blob/fe24402b3fac5c498a816868f7b2f22a67742349/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/SinglePhaseParallelIndexingTest.java#L203) and [here](https://github.com/apache/druid/blob/fe24402b3fac5c498a816868f7b2f22a67742349/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/SinglePhaseParallelIndexingTest.java#L216), interval `null` will be transfer to `Intervals.ETERNITY` which is `-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z`, and then we will use this `Intervals.ETERNITY` to query metadata storage for segments, which return empty. So in these tests [oldSegments](https://github.com/apache/druid/blob/fe24402b3fac5c498a816868f7b2f22a67742349/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/SinglePhaseParallelIndexingTest.java#L185) and [newSegments](https://github.com/apache/druid/blob/fe24402b3fac5c498a816868f7b2f22a67742349/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/SinglePhaseParallelIndexingTest.java#L192) are all empty.
   
   Due to there are so many place use `Intervals.ETERNITY`, not sure whether some place else will also suffer this problem.
   
   ### Affected Version
   
   both 0.16 and 0.17, the link I posted above is 0.17
   
   ### Description
   
   Described above

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


With regards,
Apache Git Services

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