<commit_before>/* This file is part of VoltDB.
 * Copyright (C) 2008-2012 VoltDB Inc.
 *
 * VoltDB 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, either version 3 of the License, or
 * (at your option) any later version.
 *
 * VoltDB 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 VoltDB.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.voltdb.expressions;

import org.json_voltpatches.JSONException;
import org.json_voltpatches.JSONObject;
import org.json_voltpatches.JSONStringer;
import org.voltdb.catalog.Database;
import org.voltdb.types.ExpressionType;

/**
 *
 */
public class TupleValueExpression extends AbstractValueExpression {

    public enum Members {
        COLUMN_IDX,
        TABLE_NAME,
        COLUMN_NAME,
        COLUMN_ALIAS
    }

    protected int m_columnIndex = -1;
    protected String m_tableName = null;
    protected String m_columnName = null;
    protected String m_columnAlias = null;

    private boolean m_hasAggregate = false;


    public boolean hasAggregate() {
        return m_hasAggregate;
    }

    public void setHasAggregate(boolean m_hasAggregate) {
        this.m_hasAggregate = m_hasAggregate;
    }

    public TupleValueExpression() {
        super(ExpressionType.VALUE_TUPLE);
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        TupleValueExpression clone = (TupleValueExpression)super.clone();
        clone.m_columnIndex = m_columnIndex;
        clone.m_tableName = m_tableName;
        clone.m_columnName = m_columnName;
        clone.m_columnAlias = m_columnAlias;
        return clone;
    }

    @Override
    public void validate() throws Exception {
        super.validate();

        if ((m_right != null) || (m_left != null))
            throw new Exception("ERROR: A value expression has child expressions for '" + this + "'");

        // Column Index
        if (m_columnIndex < 0) {<commit_msg>Add a comment for TupleValueExpression<commit_after>/* This file is part of VoltDB.
 * Copyright (C) 2008-2012 VoltDB Inc.
 *
 * VoltDB 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, either version 3 of the License, or
 * (at your option) any later version.
 *
 * VoltDB 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 VoltDB.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.voltdb.expressions;

import org.json_voltpatches.JSONException;
import org.json_voltpatches.JSONObject;
import org.json_voltpatches.JSONStringer;
import org.voltdb.catalog.Database;
import org.voltdb.types.ExpressionType;

/**
 *
 */
public class TupleValueExpression extends AbstractValueExpression {

    public enum Members {
        COLUMN_IDX,
        TABLE_NAME,
        COLUMN_NAME,
        COLUMN_ALIAS
    }

    protected int m_columnIndex = -1;
    protected String m_tableName = null;
    protected String m_columnName = null;
    protected String m_columnAlias = null;

    private boolean m_hasAggregate = false;

    /// Only set for the special case of an aggregate function result used in an "ORDER BY" clause.
    /// This TupleValueExpression represents the corresponding "column" in the aggregate's generated output TEMP table.
    public boolean hasAggregate() {
        return m_hasAggregate;
    }

    public void setHasAggregate(boolean m_hasAggregate) {
        this.m_hasAggregate = m_hasAggregate;
    }

    public TupleValueExpression() {
        super(ExpressionType.VALUE_TUPLE);
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        TupleValueExpression clone = (TupleValueExpression)super.clone();
        clone.m_columnIndex = m_columnIndex;
        clone.m_tableName = m_tableName;
        clone.m_columnName = m_columnName;
        clone.m_columnAlias = m_columnAlias;
        return clone;
    }

    @Override
    public void validate() throws Exception {
        super.validate();

        if ((m_right != null) || (m_left != null))
            throw new Exception("ERROR: A value expression has child expressions for '" + this + "'");

        // Column Index
        if (m_columnIndex < 0) {
{'fraction_non_alphanumeric': 0.07503100454733361, 'fraction_numerical': 0.0045473336089293095, 'mean_word_length': 3.128839590443686, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5105893', 'n_tokens_mistral': 1367, 'n_tokens_neox': 1342, 'n_words': 460}