DSIExtSimpleBooleanExprHandler Class Reference

Define an abstract class that simplifies the process of passing down a list of "simple" Boolean expressions as a filters or join conditions. More...

Inherits Simba::SQLEngine::DSIExtAbstractBooleanExprHandler.

List of all members.

Public Member Functions

virtual bool CanHandleMoreClauses ()=0
 Ask whether the handler is able to handle more Passdown() calls.
virtual SharedPtr
< DSIExtResultSet
TakeResult ()=0
 Get the result set representing the result of applying the operations successfully.
virtual ~DSIExtSimpleBooleanExprHandler ()
 Destructor.

Protected Member Functions

 DSIExtSimpleBooleanExprHandler ()
 Constructor.
virtual bool PassdownComparison (AEComparison *in_node)
 Pass down the given Boolean expression representing a filter or join condition.
virtual bool PassdownInPredicate (AEInPredicate *in_node)
 Pass down the given Boolean expression representing a filter or join condition.
virtual bool PassdownNot (AENot *in_node)
 Pass down the given Boolean expression representing a filter or join condition.
virtual bool PassdownNullPredicate (AENullPredicate *in_node)
 Pass down the given Boolean expression representing a filter or join condition.
virtual bool PassdownSimpleComparison (DSIExtColumnRef &in_leftExpr, DSIExtColumnRef &in_rightExpr, SEComparisonType in_compOp)=0
 Pass down the given Boolean expression representing a filter or join condition.
virtual bool PassdownSimpleComparison (DSIExtColumnRef &in_leftExpr, LiteralValue in_rightExpr, SEComparisonType in_compOp)=0
 Pass down the given Boolean expression representing a filter or join condition.
virtual bool PassdownSimpleInPredicate (DSIExtColumnRef &in_column, LiteralVector &in_literals)=0
 Pass down the given Boolean expression representing a filter or join condition.
virtual bool PassdownSimpleNullPredicate (DSIExtColumnRef &in_column, bool in_isNull)=0
 Pass down a <null predicate>.

Detailed Description

Define an abstract class that simplifies the process of passing down a list of "simple" Boolean expressions as a filters or join conditions.

The following is the list of "simple" Boolean expressions,

1) <comparison predicate> of these forms,

2) <in predicate> of this form,

3) <not predicate> of this form,

4) <null predicate> of this form,

An implementation wishing to support a subset of the Boolean expressions listed above should extend this class directly and should only need to provide implementations for the pure virtual methods. If more complicated Boolean expressions need to be supported, consider extending DSIExtAbstractBooleanExprHandler directly.


Constructor & Destructor Documentation

virtual ~DSIExtSimpleBooleanExprHandler (  )  [virtual]

Destructor.

DSIExtSimpleBooleanExprHandler (  )  [protected]

Constructor.


Member Function Documentation

virtual bool CanHandleMoreClauses (  )  [pure virtual]

Ask whether the handler is able to handle more Passdown() calls.

After each Passdown() call, this method is called. It allows the handler to stop the Passdown process if the handler is able to make the decision upon observing certain Boolean expressions. Essentially, it gives the customer handler the ability to "short circuit" the pass down process.

For example, if a handler is used for passing down a JOIN operation and once the JOIN is handled, it will not allow any more JOIN conditions to be passed down. To avoid being asked by the SQL engine whether it can handle more clauses, the implementation for the JOIN handler could simply returns false after a JOIN condition is handled.

Returns:
True if the handler is able to handle more conditions, false otherwise.

Implements DSIExtAbstractBooleanExprHandler.

virtual bool PassdownComparison ( AEComparison in_node  )  [protected, virtual]

Pass down the given Boolean expression representing a filter or join condition.

The implementation provides support only for the following forms of comparison:

  • <column_reference> <compOp> <literal>, and
  • <literal> <compOp> <column_reference>, and
  • <column_reference> <compOp> <column_reference>

In other words, no expressions other than column references and literal values are supported.

A sub-class only needs to provide an implementation for the protected method PassdownSimpleComparison(). Also, the sub-class does not need to deal with comparisons in the form of <literal> <compOp> <column_reference> since this method translates them into an equivalent form of <column_reference> <reversed_compOp> <literal>.

Note that TakeResult() will still be called, even if this function returns false, to allow for the DSII to partially handle filters and have the SQLEngine handle the rest.

Parameters:
in_node The root of the Boolean expression. Cannot be NULL. (NOT OWN)
Returns:
True if the Boolean expression is successfully passed down, false otherwise.

Reimplemented from DSIExtAbstractBooleanExprHandler.

virtual bool PassdownInPredicate ( AEInPredicate in_node  )  [protected, virtual]

Pass down the given Boolean expression representing a filter or join condition.

The implementation provides support only for the following form of <in predicate>:

<column_reference> IN (<literal>, <literal>, ...)

That is, the only allowed expression for the first operand is a column reference and the only allowed expression for the second operand is a list of literal values.

This method calls PassdownSimpleInPredicate() to support the operation. A sub-class should provide implementation for PassdownSimpleInPredicate() if the only form of <in predicate> that is to be supported is as documented here. Otherwise, override this method.

Note that TakeResult() will still be called, even if this function returns false, to allow for the DSII to partially handle filters and have the SQLEngine handle the rest.

Parameters:
in_node The root of the Boolean expression. Cannot be NULL. (NOT OWN)
Returns:
True if the Boolean expression successfully passed down, false otherwise.

Reimplemented from DSIExtAbstractBooleanExprHandler.

virtual bool PassdownNot ( AENot in_node  )  [protected, virtual]

Pass down the given Boolean expression representing a filter or join condition.

The implementation provides support only for the following form of <not>:

<column_reference> IS NOT NULL.

In other words, no value expression other than a null predicate with a column reference is supported.

A sub-class only needs to provide implementation for the protected method PassdownSimpleNullPredicate().

Parameters:
in_node The root of the Boolean expression. Cannot be NULL. (NOT OWN)
Returns:
True if the Boolean expression is successfully passed down, false otherwise.

Reimplemented from DSIExtAbstractBooleanExprHandler.

virtual bool PassdownNullPredicate ( AENullPredicate in_node  )  [protected, virtual]

Pass down the given Boolean expression representing a filter or join condition.

The implementation provides support only for the following form of <null predicate>:

<column_reference> IS NULL.

In other words, no value expression other than a column reference is supported.

A sub-class only needs to provide implementation for the protected method PassdownSimpleNullPredicate().

Note that TakeResult() will still be called, even if this function returns false, to allow for the DSII to partially handle filters and have the SQLEngine handle the rest.

Parameters:
in_node The root of the Boolean expression. Cannot be NULL. (NOT OWN)
Returns:
True if the Boolean expression is successfully passed down, false otherwise.

Reimplemented from DSIExtAbstractBooleanExprHandler.

virtual bool PassdownSimpleComparison ( DSIExtColumnRef in_leftExpr,
DSIExtColumnRef in_rightExpr,
SEComparisonType  in_compOp 
) [protected, pure virtual]

Pass down the given Boolean expression representing a filter or join condition.

The Boolean expression is a comparison of the following form:

<in_leftExpr> <in_compOp> <in_rightExpr>

This method is called by PassdownComparison(AEComparison*) when both operands are column references.

Note that TakeResult() will still be called, even if this function returns false, to allow for the DSII to partially handle filters and have the SQLEngine handle the rest.

Parameters:
in_leftExpr Left side expression. Cannot be NULL. (NOT OWN)
in_rightExpr Right side expression. Cannot be NULL. (NOT OWN)
in_compOp The comparison operator to apply to the expressions.
Returns:
True if the Boolean expression is successfully passed down, false otherwise.
virtual bool PassdownSimpleComparison ( DSIExtColumnRef in_leftExpr,
LiteralValue  in_rightExpr,
SEComparisonType  in_compOp 
) [protected, pure virtual]

Pass down the given Boolean expression representing a filter or join condition.

The Boolean expression is a comparison of the following form,

<in_leftExpr> <in_compOp> <in_rightExpr>

This method is called by PassdownComparison(AEComparison*) in one of two situations:

  • The left operand is a column reference and right operand is a literal value.
  • The right operand is a column reference and left operand is a literal value. The comparison operator will be reversed before calling this method in this case.

Note that TakeResult() will still be called, even if this function returns false, to allow for the DSII to partially handle filters and have the SQLEngine handle the rest.

Parameters:
in_leftExpr Left side expression. Cannot be NULL. (NOT OWN)
in_rightExpr Right side expression. Cannot be NULL. (NOT OWN)
in_compOp The comparison operator to apply to the expressions.
Returns:
True if the Boolean expression is successfully passed down, false otherwise.
virtual bool PassdownSimpleInPredicate ( DSIExtColumnRef in_column,
LiteralVector in_literals 
) [protected, pure virtual]

Pass down the given Boolean expression representing a filter or join condition.

It should only support <in predicate> of this form:

<in_column> IN (in_literals)

This method is called by PassdownInPredicate(AEInPredicate*) when the list of expressions are all literal values.

If a sub-class only wishes to support <in predicate> of the form seen here, it should only need to provide an implementation for this method only. Otherwise, it needs to override PassdownInPredicate(AEInPredicate*) and provide a default implementation (that simply returns false) for this method.

Note that TakeResult() will still be called, even if this function returns false, to allow for the DSII to partially handle filters and have the SQLEngine handle the rest.

Parameters:
in_column The left operand of the predicate. Cannot be NULL. (NOT OWN)
in_literals A list of literal values. Cannot be NULL. (NOT OWN)
Returns:
True if the Boolean expression is successfully passed down, false otherwise.
virtual bool PassdownSimpleNullPredicate ( DSIExtColumnRef in_column,
bool  in_isNull 
) [protected, pure virtual]

Pass down a <null predicate>.

This method is called by PassdownNullPredicate(AENullPredicate*) or PassdownNot(AENot*) to support the <null predicate> of this form:

<in_column> IS [NOT] NULL.

This method is called by PassdownNullPredicate(AENullPredicate*) for the "IS NULL" case when the expression is a column reference. This method is called by PassdownNot(AENot*) for the "IS NOT NULL" case when the expression is a column reference.

Note that TakeResult() will still be called, even if this function returns false, to allow for the DSII to partially handle filters and have the SQLEngine handle the rest.

Parameters:
in_column The column expression. Cannot be NULL. (NOT OWN)
in_isNull True for "IS NULL", false for "IS NOT NULL".
Returns:
True if the Boolean expression is successfully passed down, false otherwise.
virtual SharedPtr<DSIExtResultSet> TakeResult (  )  [pure virtual]

Get the result set representing the result of applying the operations successfully.

NOTE:

1) Passdown() will be called at least once before this method will be called. Note that Passdown() can return false and TakeResult() will still be called, to allow the DSII to partially filter a result and have the SQLEngine complete the rest of the filtering.

2) The result set returned can be the same table used to create this IBooleanExprHandler object (

See also:
DSIExtOperationHandlerFactory::CreateFilterHandler()). If a new result set is returned, it _MUST_ have the same ordered list of columns as the original result set. The SQLEngine will update all columns that reference the original result set to point to the new result set.
Returns:
The result set representing the result of applying the operations on success, NULL if no filtering has occurred.

Implements DSIExtAbstractBooleanExprHandler.


The documentation for this class was generated from the following file:

Generated on Wed May 17 14:21:18 2017 for SimbaEngine 10.1.3.1011 by simba