Package org.apache.jackrabbit.oak.query
Class UnionQueryImpl
- java.lang.Object
-
- org.apache.jackrabbit.oak.query.UnionQueryImpl
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbindValue(String key, PropertyValue value)QuerybuildAlternativeQuery()Try to convert the query to an alternative form, specially a "union".booleancontainsUnfilteredFullTextCondition()Whether the condition contains a fulltext condition that can not be applied to the filter, for example because it is part of an "or" condition of the form "where a=1 or contains(., 'x')".QuerycopyOf()returns a clone of the current object.ResultexecuteQuery()List<String>getBindVariableNames()Query[]getChildren()intgetColumnIndex(String columnName)ColumnImpl[]getColumns()doublegetEstimatedCost()Get the estimated cost.StringgetIndexCostInfo()Get the index cost as a JSON string.Optional<Long>getLimit()Optional<Long>getOffset()StringgetPlan()Get the query plan.QueryStatsData.QueryExecutionStatsgetQueryExecutionStats()Iterator<ResultRowImpl>getRows()intgetSelectorIndex(String selectorName)String[]getSelectorNames()longgetSize()Get the size if known.longgetSize(Result.SizePrecision precision, long max)Get the size if known.StringgetStatement()TreegetTree(String path)voidinit()Initialize the query.booleanisInit()booleanisInternal()booleanisMeasureOrExplainEnabled()booleanisPotentiallySlow()Whether the query is potentially slow.booleanisSortedByIndex()Returns whether the results will be sorted by index.voidprepare()Prepare the query.voidsetExecutionContext(ExecutionContext context)voidsetExplain(boolean explain)voidsetInternal(boolean isInternal)voidsetLimit(long limit)voidsetMeasure(boolean measure)voidsetOffset(long offset)voidsetOrderings(OrderingImpl[] orderings)voidsetQueryOptions(QueryOptions options)Set the query option to be used for this query.voidsetTraversalEnabled(boolean traversal)StringtoString()voidverifyNotPotentiallySlow()Verify the query is not potentially slow.
-
-
-
Method Detail
-
setExecutionContext
public void setExecutionContext(ExecutionContext context)
- Specified by:
setExecutionContextin interfaceQuery
-
setOrderings
public void setOrderings(OrderingImpl[] orderings)
- Specified by:
setOrderingsin interfaceQuery
-
bindValue
public void bindValue(String key, PropertyValue value)
-
setTraversalEnabled
public void setTraversalEnabled(boolean traversal)
- Specified by:
setTraversalEnabledin interfaceQuery
-
setQueryOptions
public void setQueryOptions(QueryOptions options)
Description copied from interface:QuerySet the query option to be used for this query.- Specified by:
setQueryOptionsin interfaceQuery- Parameters:
options- the options
-
prepare
public void prepare()
Description copied from interface:QueryPrepare the query. The cost is estimated and the execution plan is decided here.
-
getEstimatedCost
public double getEstimatedCost()
Description copied from interface:QueryGet the estimated cost.- Specified by:
getEstimatedCostin interfaceQuery- Returns:
- the estimated cost
-
getBindVariableNames
public List<String> getBindVariableNames()
- Specified by:
getBindVariableNamesin interfaceQuery
-
getColumns
public ColumnImpl[] getColumns()
- Specified by:
getColumnsin interfaceQuery
-
getSelectorNames
public String[] getSelectorNames()
- Specified by:
getSelectorNamesin interfaceQuery
-
getSelectorIndex
public int getSelectorIndex(String selectorName)
- Specified by:
getSelectorIndexin interfaceQuery
-
getSize
public long getSize()
Description copied from interface:QueryGet the size if known.
-
getSize
public long getSize(Result.SizePrecision precision, long max)
Description copied from interface:QueryGet the size if known.
-
setExplain
public void setExplain(boolean explain)
- Specified by:
setExplainin interfaceQuery
-
setMeasure
public void setMeasure(boolean measure)
- Specified by:
setMeasurein interfaceQuery
-
init
public void init()
Description copied from interface:QueryInitialize the query. This will 'wire' selectors into constraints, and collect bind variable names. It will also simplify expressions if possible, but will not prepare the query.
-
executeQuery
public Result executeQuery()
- Specified by:
executeQueryin interfaceQuery
-
getPlan
public String getPlan()
Description copied from interface:QueryGet the query plan. The query must already be prepared.
-
getIndexCostInfo
public String getIndexCostInfo()
Description copied from interface:QueryGet the index cost as a JSON string. The query must already be prepared.- Specified by:
getIndexCostInfoin interfaceQuery- Returns:
- the index cost
-
isMeasureOrExplainEnabled
public boolean isMeasureOrExplainEnabled()
- Specified by:
isMeasureOrExplainEnabledin interfaceQuery
-
getColumnIndex
public int getColumnIndex(String columnName)
- Specified by:
getColumnIndexin interfaceQuery
-
getRows
public Iterator<ResultRowImpl> getRows()
-
setInternal
public void setInternal(boolean isInternal)
- Specified by:
setInternalin interfaceQuery
-
isSortedByIndex
public boolean isSortedByIndex()
Description copied from interface:QueryReturns whether the results will be sorted by index. The query must already be prepared.- Specified by:
isSortedByIndexin interfaceQuery- Returns:
- if sorted by index
-
buildAlternativeQuery
public Query buildAlternativeQuery()
Description copied from interface:QueryTry to convert the query to an alternative form, specially a "union". To avoid any potential error due to state variables perform the conversion before theQuery.init().- Specified by:
buildAlternativeQueryin interfaceQuery- Returns:
thisif no conversions are possible or a new instance of aQuery. Cannot return null.
-
copyOf
public Query copyOf() throws IllegalStateException
Description copied from interface:Queryreturns a clone of the current object. Will throw an exception in case it's invoked in a non appropriate moment. For example the default
QueryImplcannot be cloned once theQuery.init()has been executed.May return null if not implemented.
- Specified by:
copyOfin interfaceQuery- Returns:
- a clone of self
- Throws:
IllegalStateException
-
isInit
public boolean isInit()
-
getStatement
public String getStatement()
- Specified by:
getStatementin interfaceQuery- Returns:
- the original statement as it was used to construct the object. If not provided the toString() will be used instead.
-
isInternal
public boolean isInternal()
- Specified by:
isInternalin interfaceQuery- Returns:
trueif the current query is internal.falseotherwise.
-
containsUnfilteredFullTextCondition
public boolean containsUnfilteredFullTextCondition()
Description copied from interface:QueryWhether the condition contains a fulltext condition that can not be applied to the filter, for example because it is part of an "or" condition of the form "where a=1 or contains(., 'x')".- Specified by:
containsUnfilteredFullTextConditionin interfaceQuery- Returns:
- true if yes
-
isPotentiallySlow
public boolean isPotentiallySlow()
Description copied from interface:QueryWhether the query is potentially slow. Only supported for prepared queries.- Specified by:
isPotentiallySlowin interfaceQuery- Returns:
- true if traversal is the only option
-
verifyNotPotentiallySlow
public void verifyNotPotentiallySlow()
Description copied from interface:QueryVerify the query is not potentially slow. Only supported for prepared queries.- Specified by:
verifyNotPotentiallySlowin interfaceQuery
-
getChildren
public Query[] getChildren()
-
getQueryExecutionStats
public QueryStatsData.QueryExecutionStats getQueryExecutionStats()
- Specified by:
getQueryExecutionStatsin interfaceQuery
-
-