public class StorageCandidate extends Object implements Candidate, CandidateTable
Constructor and Description |
---|
StorageCandidate(CubeInterface cube,
FactTable fact,
String storageName,
CubeQueryContext cubeQueryContext) |
StorageCandidate(StorageCandidate sc) |
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
|
StorageCandidate |
copy()
Clones this candidate
|
Set<Integer> |
decideMeasurePhrasesToAnswer(Set<Integer> measureIndices) |
boolean |
equals(Object obj) |
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.
|
String |
getAliasForTable(String alias) |
Set<Integer> |
getAnswerableMeasurePhraseIndices()
Gets the index positions of answerable measure phrases in CubeQueryContext#selectPhrases
|
AbstractCubeTable |
getBaseTable()
Get base table of the candidate table
|
Collection<Candidate> |
getChildren()
Returns child candidates of this candidate if any.
|
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.
|
OptionalDouble |
getCost() |
CubeInterface |
getCube()
Utility method to return cube of its cube query context
|
CubeQueryContext |
getCubeQueryContext()
A candidate always works along with its cube query context.
|
Map<String,Map<String,Float>> |
getDataCompletenessMap()
This map holds Tags (A tag refers to one or more measures) that have incomplete (below configured threshold) data.
|
Date |
getEndTime()
End Time for this candidate (calculated based on schema)
|
FactTable |
getFact()
Participating fact, storage and dimensions for this StorageCandidate
|
String |
getFromString() |
String |
getName()
Name of this storage candidate = storageName_factName
|
Set<String> |
getNonExistingPartitions()
Non existing partitions
|
int |
getNumQueriedParts() |
Set<FactPartition> |
getParticipatingPartitions()
Returns the set of fact partitions that will participate in this candidate.
|
TreeSet<UpdatePeriod> |
getParticipatingUpdatePeriods()
These are the update periods that finally participate in partitions.
|
Set<Dimension> |
getQueriedDims() |
Map<TimeRange,String> |
getRangeToExtraWhereFallBack() |
Map<TimeRange,Set<FactPartition>> |
getRangeToPartitions() |
String |
getResolvedName() |
Date |
getStartTime()
Start Time for this candidate (calculated based on schema)
|
String |
getStorageName() |
String |
getStorageString(String alias)
Get storage string of the base table alias passed
|
String |
getStorageTable()
Get storage table corresponding to this candidate
|
AbstractCubeTable |
getTable()
Get candidate table
|
Map<String,CandidateTablePruneCause.SkipUpdatePeriodCode> |
getUpdatePeriodRejectionCause() |
TreeSet<UpdatePeriod> |
getValidUpdatePeriods()
Valid update periods populated by Phase 1.
|
int |
hashCode() |
boolean |
isDimAttributeEvaluable(String dim)
Checks whether a dim attribute is evaluable by this candidate
|
boolean |
isExpressionEvaluable(org.apache.lens.cube.parse.ExpressionResolver.ExpressionContext expr)
Checks whether an expression is evaluable by this candidate
1.
|
boolean |
isExpressionEvaluable(String expr)
Checks whether an expression is evaluable by this candidate
1.
|
boolean |
isPhraseAnswerable(org.apache.lens.cube.parse.QueriedPhraseContext phrase)
Checks whether the given queries phrase is evaluable by this candidate
|
boolean |
isStorageTblsAtUpdatePeriodLevel()
This will be true if this storage candidate has multiple storage tables (one per update period)
https://issues.apache.org/jira/browse/LENS-1386
|
boolean |
isTimeRangeCoverable(TimeRange timeRange)
Is time range coverable based on valid update periods of this storage candidate
|
void |
setFromString(String fromString) |
void |
setName(String name)
Name of this storage candidate = storageName_factName
|
void |
setResolvedName(String resolvedName)
This is the storage table specific name.
|
void |
setUpdatePeriodRejectionCause(Map<String,CandidateTablePruneCause.SkipUpdatePeriodCode> updatePeriodRejectionCause) |
Collection<StorageCandidate> |
splitAtUpdatePeriodLevelIfReq()
Splits the Storage Candidates into multiple Storage Candidates if storage candidate has multiple
storage tables (one per update period)
|
StorageCandidateHQLContext |
toQueryWriterContext(Map<Dimension,CandidateDim> dimsToQuery,
CubeQueryContext rootCubeQueryContext)
Get query writer context from the candidate.
|
String |
toString() |
coveredPhrases, getChildrenCount, getConf, getCubeMetastoreClient, hasColumn, isColumnPresentAndValidForRange, isColumnValidForRange, isCompletelyValidForTimeRanges, isPartiallyValidForTimeRange, isPartiallyValidForTimeRanges, updateStorageCandidateQueriablePhraseIndices
public StorageCandidate(StorageCandidate sc) throws LensException
LensException
public StorageCandidate(CubeInterface cube, FactTable fact, String storageName, CubeQueryContext cubeQueryContext) throws LensException
LensException
public void addAnswerableMeasurePhraseIndices(int index)
Candidate
addAnswerableMeasurePhraseIndices
in interface Candidate
index
- index to mark as answerablepublic Candidate explode() throws LensException
Candidate
explode
in interface Candidate
LensException
public String getStorageString(String alias)
CandidateTable
getStorageString
in interface CandidateTable
public AbstractCubeTable getBaseTable()
CandidateTable
getBaseTable
in interface CandidateTable
public StorageCandidate copy() throws LensException
Candidate
copy
in interface Candidate
LensException
- propagated exceptionpublic boolean isPhraseAnswerable(org.apache.lens.cube.parse.QueriedPhraseContext phrase) throws LensException
Candidate
isPhraseAnswerable
in interface Candidate
phrase
- Phrase to checkLensException
- propagated exceptionpublic AbstractCubeTable getTable()
CandidateTable
getTable
in interface CandidateTable
public Optional<Date> getColumnStartTime(String column)
Candidate
getColumnStartTime
in interface Candidate
column
- column namepublic Optional<Date> getColumnEndTime(String column)
Candidate
getColumnEndTime
in interface Candidate
column
- column namepublic Collection<String> getColumns()
Candidate
getColumns
in interface Candidate
getColumns
in interface CandidateTable
public OptionalDouble getCost()
public boolean contains(Candidate candidate)
Candidate
public Collection<Candidate> getChildren()
Candidate
getChildren
in interface Candidate
public boolean evaluateCompleteness(TimeRange timeRange, TimeRange queriedTimeRange, boolean failOnPartialData) throws LensException
Candidate
Candidate.getParticipatingPartitions()
.evaluateCompleteness
in interface Candidate
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
public Set<FactPartition> getParticipatingPartitions()
Candidate
Candidate.evaluateCompleteness(TimeRange, TimeRange, boolean)
getParticipatingPartitions
in interface Candidate
getParticipatingPartitions
in interface CandidateTable
public boolean isExpressionEvaluable(org.apache.lens.cube.parse.ExpressionResolver.ExpressionContext expr)
Candidate
isExpressionEvaluable
in interface Candidate
expr
- Expression to be evaluated for Candidatepublic boolean isExpressionEvaluable(String expr)
Candidate
isExpressionEvaluable
in interface Candidate
expr
- Expression to be evaluated for Candidatepublic boolean isDimAttributeEvaluable(String dim) throws LensException
Candidate
isDimAttributeEvaluable
in interface Candidate
dim
- dim attributeLensException
- propageted exceptionpublic boolean isTimeRangeCoverable(TimeRange timeRange) throws LensException
isTimeRangeCoverable
in interface Candidate
timeRange
- LensException
public String getResolvedName()
public Collection<StorageCandidate> splitAtUpdatePeriodLevelIfReq() throws LensException
LensException
public StorageCandidateHQLContext toQueryWriterContext(Map<Dimension,CandidateDim> dimsToQuery, CubeQueryContext rootCubeQueryContext) throws LensException
Candidate
toQueryWriterContext
in interface Candidate
dimsToQuery
- Dimensions and corresponding picked CandidateDim for queryrootCubeQueryContext
- Root query context.LensException
- exception to be propagatedpublic Set<Integer> decideMeasurePhrasesToAnswer(Set<Integer> measureIndices)
decideMeasurePhrasesToAnswer
in interface Candidate
@Generated(value="lombok") public CubeQueryContext getCubeQueryContext()
Candidate
getCubeQueryContext
in interface Candidate
@Generated(value="lombok") public String getName()
@Generated(value="lombok") public void setName(String name)
@Generated(value="lombok") public void setResolvedName(String resolvedName)
@Generated(value="lombok") public TreeSet<UpdatePeriod> getValidUpdatePeriods()
@Generated(value="lombok") public TreeSet<UpdatePeriod> getParticipatingUpdatePeriods()
getParticipatingPartitions()
@Generated(value="lombok") public Map<String,CandidateTablePruneCause.SkipUpdatePeriodCode> getUpdatePeriodRejectionCause()
@Generated(value="lombok") public void setUpdatePeriodRejectionCause(Map<String,CandidateTablePruneCause.SkipUpdatePeriodCode> updatePeriodRejectionCause)
@Generated(value="lombok") public Set<Dimension> getQueriedDims()
@Generated(value="lombok") public Map<String,Map<String,Float>> getDataCompletenessMap()
@Generated(value="lombok") public FactTable getFact()
@Generated(value="lombok") public String getStorageName()
@Generated(value="lombok") public String getStorageTable()
CandidateTable
getStorageTable
in interface CandidateTable
@Generated(value="lombok") public Map<TimeRange,Set<FactPartition>> getRangeToPartitions()
@Generated(value="lombok") public Map<TimeRange,String> getRangeToExtraWhereFallBack()
@Generated(value="lombok") public Set<Integer> getAnswerableMeasurePhraseIndices()
Candidate
getAnswerableMeasurePhraseIndices
in interface Candidate
@Generated(value="lombok") public String getFromString()
@Generated(value="lombok") public void setFromString(String fromString)
@Generated(value="lombok") public CubeInterface getCube()
Candidate
@Generated(value="lombok") public Date getStartTime()
Candidate
getStartTime
in interface Candidate
@Generated(value="lombok") public Date getEndTime()
Candidate
getEndTime
in interface Candidate
@Generated(value="lombok") public Set<String> getNonExistingPartitions()
@Generated(value="lombok") public boolean isStorageTblsAtUpdatePeriodLevel()
@Generated(value="lombok") public int getNumQueriedParts()
Copyright © 2014–2018 Apache Software Foundation. All rights reserved.