All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bigdata.bop.solutions.IGroupByState Maven / Gradle / Ivy

/**

Copyright (C) SYSTAP, LLC DBA Blazegraph 2006-2016.  All rights reserved.

Contact:
     SYSTAP, LLC DBA Blazegraph
     2501 Calvert ST NW #106
     Washington, DC 20008
     [email protected]

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
/*
 * Created on Jul 27, 2011
 */

package com.bigdata.bop.solutions;

import java.util.LinkedHashSet;

import com.bigdata.bop.IConstraint;
import com.bigdata.bop.IValueExpression;
import com.bigdata.bop.IVariable;
import com.bigdata.bop.aggregate.IAggregate;

/**
 * The state associated with a validated aggregation operator.
 * 
 * @author Bryan Thompson
 * @version $Id$
 */
public interface IGroupByState {

    /**
     * The ordered array of value expressions which define the basis for
     * aggregating solutions into groups.
     */
    public IValueExpression[] getGroupByClause();

    /**
     * Top-level variables in the GROUP_BY clause in the order in which they
     * were declared. Computed value expressions which are not bound on a
     * variable explicitly are NOT reported here.
     */
    public LinkedHashSet> getGroupByVars();
    
    /**
     * The value expressions to be projected out of the SELECT clause.
     */
    public IValueExpression[] getSelectClause();

    /**
     * Top-level variables in the SELECT clause in the order in which they were
     * declared. 
     */
    public LinkedHashSet> getSelectVars();
    
    /**
     * Optional constraints applied to the aggregated solutions.
     */
    public IConstraint[] getHavingClause();

    /**
     * Variables for which we will need column projections. For example, given
     * SELECT SUM(DISTINCT ?x), SUM(?y), this would report
     * {?x,?y}. The variables will be reported in the order they
     * were encountered during a left-to-right scan of the SELECT expressions
     * followed by a left-to-right scan of the HAVING constraints.
     */
    public LinkedHashSet> getColumnVars();

//    /**
//     * Variables for which we will need column projections of the distinct
//     * values. For example, given SELECT SUM(DISTINCT ?x), SUM(?y),
//     * this would report {?x}. The variables will be reported in
//     * the order they were encountered during a left-to-right scan of the SELECT
//     * expressions followed by a left-to-right scan of the HAVING constraints.
//     */
//    public LinkedHashSet> getDistinctColumnVars();

    /**
     * true iff any aggregate functions will be applied to the
     * DISTINCT values arising from their inner value expression in either the
     * SELECT or HAVING clause. When false certain optimizations
     * are possible.
     */
    public boolean isAnyDistinct();

    /**
     * true iff any aggregate expression uses a reference to
     * another aggregate expression in the select clause. When
     * false certain optimizations are possible (parallel
     * evaluation of the aggregates across the column projections).
     */
    public boolean isSelectDependency();

    /**
     * true if any aggregate expression nests another aggregate
     * expression. For example:
     * 
     * 
     * SUM(?x+AVG(?x))
     * 
* * is a nested aggregation expression but: * *
     * SUM(?x+1)
     * 
* * and * *
     * 1+SUM(?x)+AVG(?x)
     * 
* * are not nested aggregation expressions. When false certain * optimizations may be possible. */ public boolean isNestedAggregates(); /** * true if none of the value expressions in the optional HAVING * clause use {@link IAggregate} functions. When true certain * optimizations are possible. *

* For example, the following query does not use an {@link IAggregate} * function in the HAVING clause. Instead, it references an aggregate * defined in the SELECT clause. * *

     * SELECT SUM(?y) as ?x
     * GROUP BY ?z
     * HAVING ?x > 10
     * 
* * As a degenerate case, this is also true when there is no * HAVING clause. */ public boolean isSimpleHaving(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy