DSIExtAbstractAggregationHandler Class Reference

Defines an abstract class to facilitate the process of passing down of a relational AGGREGATION operation. More...

Inherits Simba::SQLEngine::IAggregationHandler.

Inherited by DSIExtSimpleAggregationHandler.

List of all members.

Public Member Functions

virtual SharedPtr
< DSIExtResultSet
Passdown (AEAggregate *in_node)
 Pass down the given AGGREGATION operation.
virtual ~DSIExtAbstractAggregationHandler ()
 Destructor.

Protected Member Functions

virtual SharedPtr
< DSIExtResultSet
CreateResult ()=0
 Create the table that represents the aggregation result.
 DSIExtAbstractAggregationHandler ()
 Constructor.
virtual bool SetAggregateFn (SEAggrFunctionID in_aggrFnID)=0
 Set one aggregation function from the AGGREGATE_LIST that operates on a table.
virtual bool SetAggregateFn (SEAggrFunctionID in_aggrFnID, AEValueExpr *in_argExpr, bool in_withDistinct)=0
 Set one aggregation function from the AGGREGATE_LIST.
virtual bool SetCustomAggregateFn (const simba_wstring &in_funName, AEValueExpr *in_argExpr, bool in_withDistinct)
 Set one custom aggregation function from the AGGREGATE_LIST. This would be a custom aggregate, not supported by the SQLEngine, but implemented by the DSII.
virtual bool SetGroupingExpr (AEValueExpr *in_node)=0
 Set one expression from the GROUPING_LIST.

Detailed Description

Defines an abstract class to facilitate the process of passing down of a relational AGGREGATION operation.

The design assumes the following process of passing down an AGGREGATION operation: 1. Add expressions from the GROUPING_LIST one by one by calling SetGroupingExpr(). If one of the expressions is failed to set, the process is aborted. 2. Set aggregate functions from the AGGREGATE_LIST one by one by calling SetAggregateFn(). If one of the aggregate functions is failed to set, the process is aborted. 3. Create the table representing the aggregation result by calling CreateResult(). 4. If there is a filter that operates on the aggregated result, SimbaEngine will attempt to pass down the filter to the returned table. See IBooleanExprHandler and the sub-classes for details on how a filter is passed down.

An implementation wishing to support "complicated" aggregate and grouping expressions such as the following should extend this class directly. It should provide implementations for the pure virtual methods only.

The result returned from CreateResult(), if the aggregation was successfully passed down, should contain one column for each call to SetAggregateFn(), in the same order that it was set by the function call. If there are no items set by SetGroupingExpr(), then the result should only have a single row. Otherwise, there should be one row for each group specified by the items set by SetGroupingExpr(). For example, the following query:

would have two columns, one for C1 and one for COUNT(*), and should return a row for every different value of C1. If the table was as follows:

C1 | C2 --- | --- A | B A | D B | E

then the returned result should look like the following:

C1 | COUNT(*) --- | -------- A | 2 B | 1

If a column is in the GROUPING_LIST but not in the SELECT_LIST, it should still be included in the select list of the result generated from the aggregation handler. The SQLEngine will simply not ask this column for data during data retrieval. Note that the columns and expressions should still appear in the select list in the same order the Set*() functions are called.


Constructor & Destructor Documentation

virtual ~DSIExtAbstractAggregationHandler (  )  [virtual]

Destructor.

DSIExtAbstractAggregationHandler (  )  [protected]

Constructor.


Member Function Documentation

virtual SharedPtr<DSIExtResultSet> CreateResult (  )  [protected, pure virtual]

Create the table that represents the aggregation result.

Returns:
The table that represents the aggregation result on success, NULL otherwise.

Implemented in DSIExtSimpleAggregationHandler.

virtual SharedPtr<DSIExtResultSet> Passdown ( AEAggregate in_node  )  [virtual]

Pass down the given AGGREGATION operation.

This implementation assumes the processing model documented at the beginning of this class. A sub-class should provide implementations for the pure virtual methods defined in the protected scope of this class if the processing models applies. In other words, a sub-class should try not to override this method.

Parameters:
in_node The aggregation operation node. Cannot be NULL. (NOT OWN)
Returns:
the table that represents the aggregation result if successful, NULL otherwise.

Implements IAggregationHandler.

virtual bool SetAggregateFn ( SEAggrFunctionID  in_aggrFnID  )  [protected, pure virtual]

Set one aggregation function from the AGGREGATE_LIST that operates on a table.

The implementation _MUST_ ensure that any previous SetAggregateFn() and SetGroupingExpr() operations are undone if this method returns false.

Currently, the only supported aggregate function by SimbaEngine of this form is "count(*)".

Parameters:
in_aggrFnID The ID of the aggregate function. Currently, the only supported value is SE_FUNCT_COUNT_STAR.
Returns:
True if the aggregation function is set successfully, false otherwise.

Implemented in DSIExtSimpleAggregationHandler.

virtual bool SetAggregateFn ( SEAggrFunctionID  in_aggrFnID,
AEValueExpr in_argExpr,
bool  in_withDistinct 
) [protected, pure virtual]

Set one aggregation function from the AGGREGATE_LIST.

The implementation _MUST_ ensure that any previous SetAggregateFn() and SetGroupingExpr() operations are undone if this method returns false.

Parameters:
in_aggrFnID The ID of the aggregate function.
in_argExpr The argument for the aggregate function. (NOT OWN)
in_withDistinct Whether to aggregate on distinct values of in_argExpr.
Returns:
True if the aggregation function is set successfully, false otherwise.

Implemented in DSIExtSimpleAggregationHandler.

virtual bool SetCustomAggregateFn ( const simba_wstring in_funName,
AEValueExpr in_argExpr,
bool  in_withDistinct 
) [protected, virtual]

Set one custom aggregation function from the AGGREGATE_LIST. This would be a custom aggregate, not supported by the SQLEngine, but implemented by the DSII.

The default implementation of this method returns false. Drivers that support custom aggregate functions must override this method.

The implementation _MUST_ ensure that any previous SetAggregateFn() and SetGroupingExpr() operations are undone if this method returns false.

Parameters:
in_funName The custom aggregate function name.
in_argExpr The argument for the aggregate function. (NOT OWN)
in_withDistinct Whether to aggregate on distinct values of in_argExpr.
Returns:
True if the aggregation function is set successfully, false otherwise.

Reimplemented in DSIExtSimpleAggregationHandler.

virtual bool SetGroupingExpr ( AEValueExpr in_node  )  [protected, pure virtual]

Set one expression from the GROUPING_LIST.

The implementation _MUST_ ensure that any previous SetAggregateFn() and SetGroupingExpr() operations are undone if this method returns false.

Parameters:
in_node An expression from the GROUPING_LIST. Cannot be NULL. (NOT OWN)
Returns:
True if the grouping expression is set successfully, false otherwise.

Implemented in DSIExtSimpleAggregationHandler.


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

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