Repository navigation
Conversation
When the WHERE clause has two inclusive upper bounds on time, such as time <= 10 AND time <= 5 or time BETWEEN 1 AND 10 AND time <= 5, the gap fill took the larger one as its end time. It then output windows after the end of the range that the WHERE clause selects. Take the smaller one, as is already done for two exclusive upper bounds.
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.
Description
When the WHERE clause of a
date_bin_gapfillquery has two inclusive upper bounds on time, the gap fill ends at the larger one. It then outputs windows after the range that the WHERE clause selects:This returns windows up to 13:00, although no row after 10:00 can match. The same happens with
time <= a AND time <= bin either order.GapFillStartAndEndTimeExtractVisitor.Context.updateEndTimekeeps the tighter bound in every other case: the smaller of two<bounds, and the right one when<and<=are mixed. For two<=bounds it usedMath.max(GapFillStartAndEndTimeExtractVisitor.java:278).Change
Use
Math.minfor two<=bounds.#18590, a draft, adds a test class with the same name for the
Longboundary cases. None of its tests reaches this line, so if both go in, the second one only needs the two classes merged into one file.Verification
GapFillStartAndEndTimeExtractVisitorTestchecks the inferred range for two upper bounds in both orders,BETWEENwith<=, mixed<and<=, and the same cases for lower bounds. On master2cd3b07,testTighterUpperBoundIsUsedfails withexpected:<5> but was:<10>and passes with the change. The lower-bound test passes in both cases.twoUpperBoundsGapFillTestinIoTDBGapFillTableITruns the query above, and the same query withtime >= ... AND time <= 13:00 AND time <= 10:00.IoTDBGapFillTableITpasses with-PTableSimpleITand-PTableClusterIT(1C3D). Without the change the new test fails at the first query, which returns more than the seven expected rows.apache/iotdb:2.0.11-standalone, which has the same line, both queries return ten windows on the IT's data, from 04:00 to 13:00. With the changed visitor class iniotdb-server-2.0.11.jarthey return the seven expected rows.spotless:checkpasses for datanode and integration-test.This PR has:
Key changed/added classes (or packages if there are too many classes) in this PR
GapFillStartAndEndTimeExtractVisitorIoTDBGapFillTableIT,GapFillStartAndEndTimeExtractVisitorTest