| author | lzhang | 2012-02-07 00:58:41 (EST) |
|---|---|---|
| committer | mwu | 2012-02-07 00:58:41 (EST) |
| commit | 8c4ebf05257461c672334947188989b158ceb1a2 (patch) (side-by-side diff) | |
| tree | d6a275830728da88aaa0b0cef179ae01122df03e | |
| parent | 03d1bbcd402fea793891ddccf5229a13c49bceb7 (diff) | |
| download | org.eclipse.birt-8c4ebf05257461c672334947188989b158ceb1a2.zip org.eclipse.birt-8c4ebf05257461c672334947188989b158ceb1a2.tar.gz org.eclipse.birt-8c4ebf05257461c672334947188989b158ceb1a2.tar.bz2 | |
- Summary:
Ted issue 45822: Report refuses to run if a group key expression
references a data binding with a formula
- Description of Issue:
If the group key refers to a data column binding whose expression is
complex column reference string, disable progressive viewing.
- TED(s) Resolved:
45822
- Regression ( Yes/No ):
No
- Code Owner Team:
DtE
- Code Reviewers:
Mingxia Wu
- Project ID:
1577
- Manual Test Description:
None
- Tests Automated Cases Executed:
None
- Special Notes:
None
| -rw-r--r-- | data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/executor/QueryExecutionStrategyUtil.java | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/executor/QueryExecutionStrategyUtil.java b/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/executor/QueryExecutionStrategyUtil.java index 2c9ccd8..37793ea 100644 --- a/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/executor/QueryExecutionStrategyUtil.java +++ b/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/executor/QueryExecutionStrategyUtil.java @@ -80,6 +80,8 @@ public final class QueryExecutionStrategyUtil if ( group.getSubqueries( ) != null && group.getSubqueries( ).size( ) > 0 ) return Strategy.Complex; + if ( !isDirectColumnRefGroupKey( group, query ) ) + return Strategy.Complex; if( group.getFilters( ).isEmpty( ) && group.getSorts( ).isEmpty( ) && !query.getQueryExecutionHints( ).doSortBeforeGrouping( )) continue; if( opt.acceptGroupSorting( ) ) @@ -212,4 +214,73 @@ public final class QueryExecutionStrategyUtil return hasAggregation?Strategy.SimpleLookingFoward:Strategy.SimpleNoLookingFoward; } + + private static boolean isDirectColumnRefGroupKey(IGroupDefinition group,IQueryDefinition query ) + { + String expr = getGroupKeyExpression(group); + String dataSetExpr; + try + { + dataSetExpr = getDataSetExpr( expr,query ); + } + catch (DataException e) + { + dataSetExpr = null; + } + try + { + if( dataSetExpr != null && ExpressionUtil.getColumnName( dataSetExpr ) == null && ExpressionUtil.getColumnBindingName(dataSetExpr) == null) + { + return false; + } + } + catch (BirtException e) + { + return false; + } + return true; + } + + + private static String getGroupKeyExpression(IGroupDefinition src) + { + String expr = src.getKeyColumn( ); + if ( expr == null ) + { + expr = src.getKeyExpression( ); + } + else + { + expr = getColumnRefExpression( expr ); + } + return expr; + } + + private static String getColumnRefExpression( String expr ) + { + return ExpressionUtil.createJSRowExpression( expr ); + } + + private static String getDataSetExpr( String rowExpr,IQueryDefinition query ) throws DataException + { + String dataSetExpr = null ; + try + { + String bindingName = ExpressionUtil.getColumnBindingName( rowExpr ); + Object binding = query.getBindings( ).get( bindingName ); + if( binding != null ) + { + IBaseExpression expr = ( (IBinding) binding ).getExpression( ); + if( expr != null && expr instanceof IScriptExpression ) + { + dataSetExpr = ( ( IScriptExpression )expr ).getText( ); + } + } + return dataSetExpr; + } + catch ( BirtException e ) + { + throw DataException.wrap( e ); + } + } } |

