if ( ( src.getKeyColumn( ) == null || src.getKeyColumn( ) .trim( ) .length( ) == 0 ) && ( src.getKeyExpression( ) == null || src.getKeyExpression( ) .trim( ) .length( ) == 0 ) ) throw new DataException( ResourceConstants.BAD_GROUP_EXPRESSION );
validateGroupExpression( src );
	private void populateGrouping( Context cx ) throws DataException	{		List groups = this.baseQueryDefn.getGroups( );		if ( groups != null && !groups.isEmpty( ) )		{			IQuery.GroupSpec[] groupSpecs = new IQuery.GroupSpec[groups.size( )];			Iterator it = groups.iterator( );			for ( int i = 0; it.hasNext( ); i++ )			{				IGroupDefinition src = (IGroupDefinition) it.next( );				if ( ( src.getKeyColumn( ) == null || src.getKeyColumn( )						.trim( )						.length( ) == 0 )						&& ( src.getKeyExpression( ) == null || src.getKeyExpression( )								.trim( )								.length( ) == 0 ) )					throw new DataException( ResourceConstants.BAD_GROUP_EXPRESSION );									String expr = getGroupKeyExpression( src );				String groupName = "";				if ( expr.trim( ).equalsIgnoreCase( "row[0]" )						|| expr.trim( )								.equalsIgnoreCase( "row._rowPosition" )						|| expr.trim( ).equalsIgnoreCase( "dataSetRow[0]" )						|| expr.trim( )								.equalsIgnoreCase( "dataSetRow._rowPosition" ) )				{					groupName = "_{$TEMP_GROUP_" + i + "ROWID$}_";				}				else				{					groupName = "_{$TEMP_GROUP_" + i + "$}_";				}								if ( ( src.getInterval( ) != IGroupDefinition.NO_INTERVAL )						&& ( src.getIntervalRange( ) != 0 ) )				{					try					{												expr = ExpressionUtil.createGroupByExpression( src.getInterval( ),								src.getIntervalStart( ),								getGroupKeyExpression( src ),								src.getIntervalRange( ),								getColumnDataType(cx, expr));											}					catch(BirtException be)					{						throw DataException.wrap( be );					}				}				IQuery.GroupSpec dest = QueryExecutorUtil.groupDefnToSpec( cx,						src,						expr,						groupName,						-1 );				groupSpecs[i] = dest;				if ( ( dest.getInterval( ) != IGroupDefinition.NO_INTERVAL )						&& ( dest.getIntervalRange( ) != 0 ) )				{					if (dest.getInterval( ) == IGroupDefinition.STRING_PREFIX_INTERVAL)					{						temporaryComputedColumns.add( new ComputedColumn( groupName,								expr,								DataType.STRING_TYPE ) );					}					else					{						temporaryComputedColumns.add( new ComputedColumn( groupName,								expr,								DataType.INTEGER_TYPE ) );					}									}				else				{					temporaryComputedColumns.add( new ComputedColumn( groupName,							expr,							QueryExecutorUtil.getTempComputedColumnType( groupSpecs[i].getInterval( ) ) ) );				}			}			odiQuery.setGrouping( Arrays.asList( groupSpecs ) );		}	}