net.sf.farrago.query
Class ScalarSubqueryConverter
java.lang.Object
net.sf.farrago.query.ScalarSubqueryConverter
- All Implemented Interfaces:
- SubqueryConverter
public class ScalarSubqueryConverter
- extends Object
- implements SubqueryConverter
ScalarSubqueryConverter converts subqueries to scalar constants by evaulating
them and passing back the resulting constant expression. By doing so, this
means that the statement containing the subquery can no longer be cached.
This class can also be used to convert EXISTS subqueries by replacing the
EXISTS with a boolean value indicating whether the subquery returns zero
(FALSE) or at least one (TRUE) row.
- Version:
- $Id: //open/dev/farrago/src/net/sf/farrago/query/ScalarSubqueryConverter.java#4 $
- Author:
- Zelaine Fong
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
stmt
private final FarragoSessionPreparingStmt stmt
ScalarSubqueryConverter
public ScalarSubqueryConverter(FarragoSessionPreparingStmt stmt)
canConvertSubquery
public boolean canConvertSubquery()
- Specified by:
canConvertSubquery
in interface SubqueryConverter
- Returns:
- true if the subquery can be converted
convertSubquery
public RexNode convertSubquery(SqlCall subquery,
SqlToRelConverter parentConverter,
boolean isExists,
boolean isExplain)
- Description copied from interface:
SubqueryConverter
- Converts the subquery to an equivalent expression.
- Specified by:
convertSubquery
in interface SubqueryConverter
- Parameters:
subquery
- the SqlNode tree corresponding to a subqueryparentConverter
- sqlToRelConverter of the parent queryisExists
- whether the subquery is part of an EXISTS expressionisExplain
- whether the subquery is part of an EXPLAIN PLAN
statement
- Returns:
- the equivalent expression or null if the subquery couldn't be
converted