This repository was archived by the owner on May 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 93
Lens 1381 #20
Open
prongs
wants to merge
14
commits into
master
Choose a base branch
from
lens-1381
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Lens 1381 #20
Changes from 2 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
b6f0cc3
Initial chnages for Union
4af769e
feature upadte 2 with query writing flow completed (Few test cases ne…
975fa2c
Deleted deprecated classes, Fixed Checkstyles, Fixed test cases, Fixe…
b26632a
Fixed test cases and findbug
4d49359
Fix failing TestCases in org.apache.lens.server.query.QueryAPIErrorRe…
2aaf6e0
LENS-1389: Back Merge with master and fix lens-cube tests
prongs de464fa
LENS-1399: Union Query rewrite incorrect in case of select expression…
rajitha703 112af59
LENS-1400: Convert CubeTestSetup to setup using xml files instead of …
prongs 363f132
LENS-1397: Support query rewrite for separate table per update period…
guptapuneet d45c538
LENS-1403 : Measures getting repeated in inner select of union query
sushilmohanty 8868b06
LENS-1389: Back Merge with master
prongs 3ba2fad
Merge with master
prongs 72c20ff
merge with upstream/lens-1381
prongs cb5e2a7
Addressed final reviews and fixed checkstyle error
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
107 changes: 107 additions & 0 deletions
107
lens-cube/src/main/java/org/apache/lens/cube/parse/Candidate.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| package org.apache.lens.cube.parse; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.Collection; | ||
| import java.util.Date; | ||
| import java.util.Set; | ||
|
|
||
| import org.apache.lens.cube.metadata.FactPartition; | ||
| import org.apache.lens.cube.metadata.TimeRange; | ||
| import org.apache.lens.server.api.error.LensException; | ||
|
|
||
| /** | ||
| * This interface represents candidates that are involved in different phases of query rewriting. | ||
| * At the lowest level, Candidate is represented by a StorageCandidate that has a fact on a storage | ||
| * and other joined dimensions (if any) that are required to answer the query or part of the query. | ||
| * At a higher level Candidate can also be a Join or a Union Candidate representing join or union | ||
| * between other candidates | ||
| * | ||
| * Different Re-writers will work on applicable candidates to produce a final candidate which will be used | ||
| * for generating the re-written query. | ||
| */ | ||
| public interface Candidate { | ||
|
|
||
| /** | ||
| * Returns all the fact columns | ||
| * | ||
| * @return | ||
| */ | ||
| Collection<String> getColumns(); | ||
|
|
||
| /** | ||
| * Start Time for this candidate (calculated based on schema) | ||
| * | ||
| * @return | ||
| */ | ||
| Date getStartTime(); | ||
|
|
||
| /** | ||
| * End Time for this candidate (calculated based on schema) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hope this is exclusive? in line with our usage of half-open ranges everywhere. |
||
| * | ||
| * @return | ||
| */ | ||
| Date getEndTime(); | ||
|
|
||
| /** | ||
| * Returns the cost of this candidate | ||
| * | ||
| * @return | ||
| */ | ||
| double getCost(); | ||
|
|
||
| /** | ||
| * Returns true if this candidate contains the given candidate | ||
| * | ||
| * @param candidate | ||
| * @return | ||
| */ | ||
| boolean contains(Candidate candidate); | ||
|
|
||
| /** | ||
| * Returns child candidates of this candidate if any. | ||
| * Note: StorageCandidate will return null | ||
| * | ||
| * @return | ||
| */ | ||
| Collection<Candidate> getChildren(); | ||
|
|
||
| /** | ||
| * Calculates if this candidate can answer the query for given time range based on actual data registered with | ||
| * the underlying candidate storages. This method will also update any internal candidate data structures that are | ||
| * required for writing the re-written query and to answer {@link #getParticipatingPartitions()}. | ||
| * | ||
| * @param timeRange : TimeRange to check completeness for. TimeRange consists of start time, end time and the | ||
| * partition column | ||
| * @param queriedTimeRange : User quried timerange | ||
| * @param failOnPartialData : fail fast if the candidate can answer the query only partially | ||
| * @return true if this Candidate can answer query for the given time range. | ||
| */ | ||
| boolean evaluateCompleteness(TimeRange timeRange, TimeRange queriedTimeRange, boolean failOnPartialData) | ||
| throws LensException; | ||
|
|
||
| /** | ||
| * Returns the set of fact partitions that will participate in this candidate. | ||
| * Note: This method can be called only after call to | ||
| * {@link #evaluateCompleteness(TimeRange, TimeRange, boolean)} | ||
| * | ||
| * @return | ||
| */ | ||
| Set<FactPartition> getParticipatingPartitions(); | ||
|
|
||
| /** | ||
| * Checks whether an expression is evaluable by a candidate | ||
| * 1. For a JoinCandidate, atleast one of the child candidates should be able to answer the expression | ||
| * 2. For a UnionCandidate, all child candidates should answer the expression | ||
| * | ||
| * @param expr | ||
| * @return | ||
| */ | ||
| boolean isExpressionEvaluable(ExpressionResolver.ExpressionContext expr); | ||
|
|
||
| /** | ||
| * Gets the index positions of answerable measure phrases in CubeQueryContext#selectPhrases | ||
| * @return | ||
| */ | ||
| Set<Integer> getAnswerableMeasurePhraseIndices(); | ||
|
|
||
| } | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used in lookahead.