DSIExtSimpleAggregationHandler Class Reference

Defines an abstract class to further simplify the process of passing down an AGGREGATION operation. More...

Inherits Simba::SQLEngine::DSIExtAbstractAggregationHandler.

List of all members.

Public Member Functions

virtual ~DSIExtSimpleAggregationHandler ()
 Destructor.

Protected Member Functions

virtual SharedPtr
< DSIExtResultSet
CreateResult ()=0
 Create the table that represents the aggregation result.
 DSIExtSimpleAggregationHandler ()
 Constructor.
virtual bool SetAggregateColumn (SEAggrFunctionID in_aggrFnID, simba_uint16 in_colIndex, bool in_withDistinct)=0
 Set an aggregation function from the AGGREGATE_LIST.
virtual bool SetAggregateFn (SEAggrFunctionID in_aggrFnID, AEValueExpr *in_argExpr, bool in_withDistinct)
 Set one aggregation function from the AGGREGATE_LIST.
virtual bool SetAggregateFn (SEAggrFunctionID in_aggrFnID)=0
 Set one aggregation function from the AGGREGATE_LIST that operates on a table.
virtual bool SetAggregateLiteral (SEAggrFunctionID in_aggrFnID, AELiteral *in_argExpr, bool in_withDistinct)=0
 Set an aggregation function from the AGGREGATE_LIST.
virtual bool SetCustomAggregateColumn (const simba_wstring &in_aggrFnName, simba_uint16 in_colIndex, bool in_withDistinct)
 Set a custom 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 SetCustomAggregateLiteral (const simba_wstring &in_aggrFnName, AELiteral *in_argExpr, bool in_withDistinct)
 Set a custom aggregation function from the AGGREGATE_LIST.
virtual bool SetGroupingColumn (simba_uint16 in_colIndex)=0
 Set the column reference from the GROUPING_LIST.
virtual bool SetGroupingExpr (AEValueExpr *in_node)
 Set one expression from the GROUPING_LIST.

Detailed Description

Defines an abstract class to further simplify the process of passing down an AGGREGATION operation.

It does that by making the following "simplified" assumptions:

For example, the following queries are supported: 1. select C1, C2, AVG(C3) + SUM(C4) from T1 group by C1, C2 2. select C1, SUM(1.1) from T1 group by C1 3. select SUM(1.1) from T1 group by C1

The following queries are not supported: 1. select C1, SUM(C2 + C3) from T1 group by C1 2. select C1 + 1.0, SUM(C2) from T1 group by C1 + 1.0

An implementation wishing to support grouping by column only and aggregating on either columns or literals as stated above should extend this class directly and should only need to provide implementations for the pure virtual methods. If more complicated grouping and/or aggregating expressions need to be supported, it should extend DSIExtAbstractAggregationHandler directly.

The result returned from CreateResult(), if the aggregation was successfully passed down, should contain one column for each call to SetAggregate*(), 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


Constructor & Destructor Documentation

virtual ~DSIExtSimpleAggregationHandler (  )  [virtual]

Destructor.

DSIExtSimpleAggregationHandler (  )  [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.

Implements DSIExtAbstractAggregationHandler.

virtual bool SetAggregateColumn ( SEAggrFunctionID  in_aggrFnID,
simba_uint16  in_colIndex,
bool  in_withDistinct 
) [protected, pure virtual]

Set an aggregation function from the AGGREGATE_LIST.

The aggregation function is in the form of:

AGGREGATE_FN( column_reference )

This method is called by SetAggregateFn(SEAggrFunctionID, AEValueExpr*, bool) when the expression is a column reference.

The implementation _MUST_ ensure that any previous successful invocations of any of the following methods are undone if this method returns false:

Parameters:
in_aggrFnID The ID of the aggregate function.
in_colIndex The index of the column to perform aggregation on.
in_withDistinct Whether to aggregate on distinct values of in_argExpr.
Returns:
True if the aggregation function is set successfully, false otherwise.
virtual bool SetAggregateFn ( SEAggrFunctionID  in_aggrFnID,
AEValueExpr in_argExpr,
bool  in_withDistinct 
) [protected, virtual]

Set one aggregation function from the AGGREGATE_LIST.

The only supported form of aggregate function is:

AGGREGATE_FN( column_reference | literal )

This method calls SetAggregateColumn() and SetAggregateLiteral() when the given expression is a column reference and literal value respectively. It returns false for any other expressions.

A sub-class should _NOT_ need to override this method.

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.

Implements DSIExtAbstractAggregationHandler.

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

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

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

The implementation _MUST_ ensure that any previous successful invocations of any of the following methods are undone if this method returns false:

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.

Implements DSIExtAbstractAggregationHandler.

virtual bool SetAggregateLiteral ( SEAggrFunctionID  in_aggrFnID,
AELiteral in_argExpr,
bool  in_withDistinct 
) [protected, pure virtual]

Set an aggregation function from the AGGREGATE_LIST.

The aggregation function is in the form of:

AGGREGATE_FN( literal )

This method is called by SetAggregateFn(SEAggrFunctionID, AEValueExpr*, bool) when the expression is a literal value.

The implementation _MUST_ ensure that any previous successful invocations of any of the following methods 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.
virtual bool SetCustomAggregateColumn ( const simba_wstring in_aggrFnName,
simba_uint16  in_colIndex,
bool  in_withDistinct 
) [protected, virtual]

Set a custom aggregation function from the AGGREGATE_LIST.

The aggregation function is in the form of:

CUSTOM_AGGREGATE_FN( column_reference )

This method is called by SetCustomAggregateFn(simba_wsting, AEValueExpr*, bool) when the expression is a column reference.

The default implementation of this method returns false. DSII's that support custom aggregates must override this method.

The implementation _MUST_ ensure that any previous successful invocations of any of the following methods are undone if this method returns false,

Parameters:
in_aggrFnName The name 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.
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 only supported form of aggregate function is:

AGGREGATE_FN( column_reference | literal )

This method calls SetCustomAggregateColumn() and SetCustomAggregateLiteral() when the given expression is a column reference and literal value respectively. It returns false for any other expressions.

A sub-class should _NOT_ need to override this method.

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 from DSIExtAbstractAggregationHandler.

virtual bool SetCustomAggregateLiteral ( const simba_wstring in_aggrFnName,
AELiteral in_argExpr,
bool  in_withDistinct 
) [protected, virtual]

Set a custom aggregation function from the AGGREGATE_LIST.

The aggregation function is in the form of:

CUSTOM_AGGREGATE_FN( literal )

This method is called by SetCustomAggregateFn(simba_wsting, AEValueExpr*, bool) when the expression is a literal value.

The default implementation of this method returns false. DSII's that support custom aggregates must override this method.

The implementation _MUST_ ensure that any previous successful invocations of any of the following methods are undone if this method returns false,

Parameters:
in_aggrFnName The name 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.
virtual bool SetGroupingColumn ( simba_uint16  in_colIndex  )  [protected, pure virtual]

Set the column reference from the GROUPING_LIST.

This method is called by SetGroupingExpr(AEValueExpr*) when the expression is a column reference.

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.

The implementation _MUST_ ensure that any previous successful invocations of any of the following methods are undone if this method returns false:

Parameters:
in_colIndex The 0-based index of the column to group on. The column index is the index into the parent table of the column.
Returns:
True if the grouping expression is set successfully, false otherwise.
virtual bool SetGroupingExpr ( AEValueExpr in_node  )  [protected, virtual]

Set one expression from the GROUPING_LIST.

This method calls SetGroupingColumn() to support grouping by column names only. For any other expressions, this method returns false.

A sub-class should _NOT_ need to override this method.

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.

Implements DSIExtAbstractAggregationHandler.


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