TimeBoundary: Use cursor when datasource is not a regular table.#14151
Merged
clintropolis merged 2 commits intoapache:masterfrom Apr 27, 2023
Merged
TimeBoundary: Use cursor when datasource is not a regular table.#14151clintropolis merged 2 commits intoapache:masterfrom
clintropolis merged 2 commits intoapache:masterfrom
Conversation
Fixes a bug where TimeBoundary could return incorrect results with INNER Join or inline data.
| .build() | ||
| ), | ||
| "j0.", | ||
| equalsCondition(makeExpression("CAST(\"m1\", 'LONG')"), makeColumnExpression("j0.cnt")), |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation
| .build() | ||
| ), | ||
| "j0.", | ||
| equalsCondition(makeExpression("CAST(\"m1\", 'LONG')"), makeColumnExpression("j0.cnt")), |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation
|
|
||
| if (canUseAdapterMinMaxTime(query, adapter)) { | ||
| if (!query.isMaxTime()) { | ||
| minTime = adapter.getMinTime(); |
Contributor
There was a problem hiding this comment.
should we update the docs or even the method name for StorageAdapter#getMinTime and StorageAdapter#getMaxTime to say that
- getMinTime can return a value that is lower than the actual min time of the data
- getMaxTime can return a value that is higher than the actual max time of the data
Contributor
Author
There was a problem hiding this comment.
Javadoc sounds like a good idea to me. It's @PublicApi so we should keep the method name as-is.
I added this to StorageAdapter#getMinTime, and similar text to getMaxTime as well:
/**
* Metadata-only operation that returns a lower bound on
* {@link org.apache.druid.segment.column.ColumnHolder#TIME_COLUMN_NAME} values for this adapter. May be earlier than
* the actual minimum data timestamp.
*
* For {@link QueryableIndexStorageAdapter} and {@link org.apache.druid.segment.incremental.IncrementalIndexStorageAdapter}
* specifically, which back regular tables (i.e. {@link org.apache.druid.query.TableDataSource}), this method
* contract is tighter: it does return the actual minimum data timestamp. This fact is leveraged by
* {@link org.apache.druid.query.timeboundary.TimeBoundaryQuery} to return results using metadata only.
*/
clintropolis
pushed a commit
to clintropolis/druid
that referenced
this pull request
May 1, 2023
…che#14151) * TimeBoundary: Use cursor when datasource is not a regular table. Fixes a bug where TimeBoundary could return incorrect results with INNER Join or inline data. * Addl Javadocs.
clintropolis
added a commit
that referenced
this pull request
May 2, 2023
) (#14191) * TimeBoundary: Use cursor when datasource is not a regular table. Fixes a bug where TimeBoundary could return incorrect results with INNER Join or inline data. * Addl Javadocs. Co-authored-by: Gian Merlino <gianmerlino@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a bug where TimeBoundary could return incorrect results with INNER Join or inline data.