public interface Candidate
Modifier and Type | Method and Description |
---|---|
void |
addAnswerableMeasurePhraseIndices(int index)
Add `index` as answerable index in a pre-decided list of queried phrases.
|
boolean |
contains(Candidate candidate)
Returns true if this candidate contains the given candidate
|
default Candidate |
copy()
Clones this candidate
|
default Set<org.apache.lens.cube.parse.QueriedPhraseContext> |
coveredPhrases(Set<org.apache.lens.cube.parse.QueriedPhraseContext> phrases)
Filters phrases that are covered by this candidate
|
default Set<Integer> |
decideMeasurePhrasesToAnswer(Set<Integer> measurePhraseIndices) |
boolean |
evaluateCompleteness(TimeRange timeRange,
TimeRange queriedTimeRange,
boolean failOnPartialData)
Calculates if this candidate can answer the query for given time range based on actual data registered with
the underlying candidate storages.
|
Candidate |
explode()
Explode this candidate into another candidate.
|
Set<Integer> |
getAnswerableMeasurePhraseIndices()
Gets the index positions of answerable measure phrases in CubeQueryContext#selectPhrases
|
Collection<? extends Candidate> |
getChildren()
Returns child candidates of this candidate if any.
|
default int |
getChildrenCount()
Count of children
|
Optional<Date> |
getColumnEndTime(String column)
This method should give end time of a column, if there's any.
|
Collection<String> |
getColumns()
Returns all the fact columns
|
Optional<Date> |
getColumnStartTime(String column)
This method should give start time of a column, if there's any.
|
default org.apache.hadoop.conf.Configuration |
getConf()
Utility method to return the configuration of its cube query context.
|
OptionalDouble |
getCost() |
default <T extends CubeInterface> |
getCube()
Utility method to return cube of its cube query context
|
default CubeMetastoreClient |
getCubeMetastoreClient()
Utility method to return the metastore client of its cube query context
|
CubeQueryContext |
getCubeQueryContext()
A candidate always works along with its cube query context.
|
Date |
getEndTime()
End Time for this candidate (calculated based on schema)
|
Set<FactPartition> |
getParticipatingPartitions()
Returns the set of fact partitions that will participate in this candidate.
|
Date |
getStartTime()
Start Time for this candidate (calculated based on schema)
|
default boolean |
hasColumn(String column)
Returns whether this candidate has the asked column or not
|
default boolean |
isColumnPresentAndValidForRange(String column)
Utility method for clubbing column contains check and column range validity check.
|
default boolean |
isColumnValidForRange(String column)
Utility method for checking column time range validity.
|
default boolean |
isCompletelyValidForTimeRanges(List<TimeRange> timeRanges)
Returns true if the Candidate is valid for all the timeranges based on its start and end times.
|
boolean |
isDimAttributeEvaluable(String dim)
Checks whether a dim attribute is evaluable by this candidate
|
boolean |
isExpressionEvaluable(org.apache.lens.cube.parse.ExpressionResolver.ExpressionContext expressionContext)
Checks whether an expression is evaluable by this candidate
1.
|
boolean |
isExpressionEvaluable(String expr)
Checks whether an expression is evaluable by this candidate
1.
|
default boolean |
isPartiallyValidForTimeRange(TimeRange timeRange)
Utility method for checking whether this candidate is partially valid for the given time range
|
default boolean |
isPartiallyValidForTimeRanges(List<TimeRange> timeRanges)
Utility method to check whether this candidate is partially valid for any of the given time ranges
|
boolean |
isPhraseAnswerable(org.apache.lens.cube.parse.QueriedPhraseContext phrase)
Checks whether the given queries phrase is evaluable by this candidate
|
boolean |
isTimeRangeCoverable(TimeRange timeRange)
Is time range coverable based on start and end times configured in schema for the composing storage candidates
and valid update periods.
|
default QueryWriterContext |
toQueryWriterContext(Map<Dimension,CandidateDim> dimsToQuery,
CubeQueryContext rootCubeQueryContext)
Get query writer context from the candidate.
|
default void |
updateStorageCandidateQueriablePhraseIndices(List<org.apache.lens.cube.parse.QueriedPhraseContext> qpcList)
Default method to update querieble phrase indices in candidate
|
Collection<String> getColumns()
default boolean hasColumn(String column)
column
- column to checkDate getStartTime()
Date getEndTime()
default boolean isCompletelyValidForTimeRanges(List<TimeRange> timeRanges)
timeRanges
- time ranges to checkdefault boolean isPartiallyValidForTimeRanges(List<TimeRange> timeRanges)
timeRanges
- time ranges to checkdefault boolean isPartiallyValidForTimeRange(TimeRange timeRange)
timeRange
- time range to checkOptionalDouble getCost()
boolean contains(Candidate candidate)
candidate
- candidate to checkCollection<? extends Candidate> getChildren()
default int getChildrenCount()
boolean isTimeRangeCoverable(TimeRange timeRange) throws LensException
evaluateCompleteness(TimeRange, TimeRange, boolean)
.
isTimeRangeCoverable checks the the possibility of covering time range from schema perspective by using valid
storages/update periods while evaluateCompleteness checks if a time range can be covered based on
registered partitions. So isTimeRangeCoverable = false implies evaluateCompleteness = false but vice versa is
not true.timeRange
- The time range to checkLensException
- propagated exceptionsboolean evaluateCompleteness(TimeRange timeRange, TimeRange queriedTimeRange, boolean failOnPartialData) throws LensException
getParticipatingPartitions()
.timeRange
- : TimeRange to check completeness for. TimeRange consists of start time, end time and the
partition columnqueriedTimeRange
- : User quried timerangefailOnPartialData
- : fail fast if the candidate can answer the query only partiallyLensException
Set<FactPartition> getParticipatingPartitions()
evaluateCompleteness(TimeRange, TimeRange, boolean)
boolean isExpressionEvaluable(org.apache.lens.cube.parse.ExpressionResolver.ExpressionContext expressionContext)
expressionContext
- Expression to be evaluated for Candidateboolean isExpressionEvaluable(String expr)
expr
- Expression to be evaluated for Candidateboolean isDimAttributeEvaluable(String dim) throws LensException
dim
- dim attributeLensException
- propageted exceptionSet<Integer> getAnswerableMeasurePhraseIndices()
default Candidate copy() throws LensException
LensException
- propagated exceptionboolean isPhraseAnswerable(org.apache.lens.cube.parse.QueriedPhraseContext phrase) throws LensException
phrase
- Phrase to checkLensException
- propagated exceptionvoid addAnswerableMeasurePhraseIndices(int index)
index
- index to mark as answerabledefault void updateStorageCandidateQueriablePhraseIndices(List<org.apache.lens.cube.parse.QueriedPhraseContext> qpcList) throws LensException
qpcList
- List of queries phrasesLensException
- propagated exceptiondefault boolean isColumnPresentAndValidForRange(String column)
column
- column name to checkdefault boolean isColumnValidForRange(String column)
column
- column to checkOptional<Date> getColumnStartTime(String column)
column
- column nameOptional<Date> getColumnEndTime(String column)
column
- column nameCubeQueryContext getCubeQueryContext()
default org.apache.hadoop.conf.Configuration getConf()
default CubeMetastoreClient getCubeMetastoreClient()
default <T extends CubeInterface> T getCube()
T
- a subclass of CubeInterfacedefault Set<org.apache.lens.cube.parse.QueriedPhraseContext> coveredPhrases(Set<org.apache.lens.cube.parse.QueriedPhraseContext> phrases) throws LensException
phrases
- queried phrases to checkLensException
- propagated exceptionCandidate explode() throws LensException
LensException
default QueryWriterContext toQueryWriterContext(Map<Dimension,CandidateDim> dimsToQuery, CubeQueryContext rootCubeQueryContext) throws LensException
dimsToQuery
- Dimensions and corresponding picked CandidateDim for queryrootCubeQueryContext
- Root query context.LensException
- exception to be propagateddefault Set<Integer> decideMeasurePhrasesToAnswer(Set<Integer> measurePhraseIndices) throws LensException
LensException
Copyright © 2014–2018 Apache Software Foundation. All rights reserved.