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 void
bindValue(String key, PropertyValue value)
Query
buildAlternativeQuery()
Try to convert the query to an alternative form, specially a "union".boolean
containsUnfilteredFullTextCondition()
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')".Query
copyOf()
returns a clone of the current object.Result
executeQuery()
List<String>
getBindVariableNames()
Query[]
getChildren()
int
getColumnIndex(String columnName)
ColumnImpl[]
getColumns()
double
getEstimatedCost()
Get the estimated cost.String
getIndexCostInfo()
Get the index cost as a JSON string.Optional<Long>
getLimit()
Optional<Long>
getOffset()
String
getPlan()
Get the query plan.QueryStatsData.QueryExecutionStats
getQueryExecutionStats()
Iterator<ResultRowImpl>
getRows()
int
getSelectorIndex(String selectorName)
String[]
getSelectorNames()
long
getSize()
Get the size if known.long
getSize(Result.SizePrecision precision, long max)
Get the size if known.String
getStatement()
Tree
getTree(String path)
void
init()
Initialize the query.boolean
isInit()
boolean
isInternal()
boolean
isMeasureOrExplainEnabled()
boolean
isPotentiallySlow()
Whether the query is potentially slow.boolean
isSortedByIndex()
Returns whether the results will be sorted by index.void
prepare()
Prepare the query.void
setExecutionContext(ExecutionContext context)
void
setExplain(boolean explain)
void
setInternal(boolean isInternal)
void
setLimit(long limit)
void
setMeasure(boolean measure)
void
setOffset(long offset)
void
setOrderings(OrderingImpl[] orderings)
void
setQueryOptions(QueryOptions options)
Set the query option to be used for this query.void
setTraversalEnabled(boolean traversal)
String
toString()
void
verifyNotPotentiallySlow()
Verify the query is not potentially slow.
-
-
-
Method Detail
-
setExecutionContext
public void setExecutionContext(ExecutionContext context)
- Specified by:
setExecutionContext
in interfaceQuery
-
setOrderings
public void setOrderings(OrderingImpl[] orderings)
- Specified by:
setOrderings
in interfaceQuery
-
bindValue
public void bindValue(String key, PropertyValue value)
-
setTraversalEnabled
public void setTraversalEnabled(boolean traversal)
- Specified by:
setTraversalEnabled
in interfaceQuery
-
setQueryOptions
public void setQueryOptions(QueryOptions options)
Description copied from interface:Query
Set the query option to be used for this query.- Specified by:
setQueryOptions
in interfaceQuery
- Parameters:
options
- the options
-
prepare
public void prepare()
Description copied from interface:Query
Prepare the query. The cost is estimated and the execution plan is decided here.
-
getEstimatedCost
public double getEstimatedCost()
Description copied from interface:Query
Get the estimated cost.- Specified by:
getEstimatedCost
in interfaceQuery
- Returns:
- the estimated cost
-
getBindVariableNames
public List<String> getBindVariableNames()
- Specified by:
getBindVariableNames
in interfaceQuery
-
getColumns
public ColumnImpl[] getColumns()
- Specified by:
getColumns
in interfaceQuery
-
getSelectorNames
public String[] getSelectorNames()
- Specified by:
getSelectorNames
in interfaceQuery
-
getSelectorIndex
public int getSelectorIndex(String selectorName)
- Specified by:
getSelectorIndex
in interfaceQuery
-
getSize
public long getSize()
Description copied from interface:Query
Get the size if known.
-
getSize
public long getSize(Result.SizePrecision precision, long max)
Description copied from interface:Query
Get the size if known.
-
setExplain
public void setExplain(boolean explain)
- Specified by:
setExplain
in interfaceQuery
-
setMeasure
public void setMeasure(boolean measure)
- Specified by:
setMeasure
in interfaceQuery
-
init
public void init()
Description copied from interface:Query
Initialize 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:
executeQuery
in interfaceQuery
-
getPlan
public String getPlan()
Description copied from interface:Query
Get the query plan. The query must already be prepared.
-
getIndexCostInfo
public String getIndexCostInfo()
Description copied from interface:Query
Get the index cost as a JSON string. The query must already be prepared.- Specified by:
getIndexCostInfo
in interfaceQuery
- Returns:
- the index cost
-
isMeasureOrExplainEnabled
public boolean isMeasureOrExplainEnabled()
- Specified by:
isMeasureOrExplainEnabled
in interfaceQuery
-
getColumnIndex
public int getColumnIndex(String columnName)
- Specified by:
getColumnIndex
in interfaceQuery
-
getRows
public Iterator<ResultRowImpl> getRows()
-
setInternal
public void setInternal(boolean isInternal)
- Specified by:
setInternal
in interfaceQuery
-
isSortedByIndex
public boolean isSortedByIndex()
Description copied from interface:Query
Returns whether the results will be sorted by index. The query must already be prepared.- Specified by:
isSortedByIndex
in interfaceQuery
- Returns:
- if sorted by index
-
buildAlternativeQuery
public Query buildAlternativeQuery()
Description copied from interface:Query
Try 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:
buildAlternativeQuery
in interfaceQuery
- Returns:
this
if no conversions are possible or a new instance of aQuery
. Cannot return null.
-
copyOf
public Query copyOf() throws IllegalStateException
Description copied from interface:Query
returns a clone of the current object. Will throw an exception in case it's invoked in a non appropriate moment. For example the default
QueryImpl
cannot be cloned once theQuery.init()
has been executed.May return null if not implemented.
- Specified by:
copyOf
in interfaceQuery
- Returns:
- a clone of self
- Throws:
IllegalStateException
-
isInit
public boolean isInit()
-
getStatement
public String getStatement()
- Specified by:
getStatement
in 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:
isInternal
in interfaceQuery
- Returns:
true
if the current query is internal.false
otherwise.
-
containsUnfilteredFullTextCondition
public boolean containsUnfilteredFullTextCondition()
Description copied from interface:Query
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')".- Specified by:
containsUnfilteredFullTextCondition
in interfaceQuery
- Returns:
- true if yes
-
isPotentiallySlow
public boolean isPotentiallySlow()
Description copied from interface:Query
Whether the query is potentially slow. Only supported for prepared queries.- Specified by:
isPotentiallySlow
in interfaceQuery
- Returns:
- true if traversal is the only option
-
verifyNotPotentiallySlow
public void verifyNotPotentiallySlow()
Description copied from interface:Query
Verify the query is not potentially slow. Only supported for prepared queries.- Specified by:
verifyNotPotentiallySlow
in interfaceQuery
-
getChildren
public Query[] getChildren()
-
getQueryExecutionStats
public QueryStatsData.QueryExecutionStats getQueryExecutionStats()
- Specified by:
getQueryExecutionStats
in interfaceQuery
-
-