<commit_before>package com.virtusa.gto.insight.nyql

import com.virtusa.gto.insight.nyql.utils.QUtils

/**
 * @author <NAME>
 */

class Table {

    /**
     * Represents any table replaceable with any table in joins.
     */
    static final Table ANY_TABLE = new Table()

    private Map<String, Column> __allColumns = new HashMap<>()

    QContext _ctx = null

    def __name = ''
    def __alias = null

    def __resultOf

    /**
     * This is cross join.
     *
     * @param t other table to be joined with
     * @return new join instance
     */
    def JOIN(Table t) {
        return INNER_JOIN(t)
    }

    /**
     * Inner join
     *
     * @param t other table to be joined with.
     * @return new join instance
     */
    def INNER_JOIN(Table t) {
        return QUtils.mergeJoinClauses(_ctx, this, t, 'INNER_JOIN')
    }

    def LEFT_OUTER_JOIN(Table t) {
        return QUtils.mergeJoinClauses(_ctx, this, t, 'LEFT_OUTER_JOIN')
    }

    def RIGHT_OUTER_JOIN(Table t) {
        return QUtils.mergeJoinClauses(_ctx, this, t, 'RIGHT_OUTER_JOIN')
    }

    def RIGHT_JOIN(Table t) {
        return QUtils.mergeJoinClauses(_ctx, this, t, 'RIGHT_JOIN')
    }

    def LEFT_JOIN(Table t) {
        return QUtils.mergeJoinClauses(_ctx, this, t, 'LEFT_JOIN')
    }

    def alias(String newName) {
        __alias = newName
        if (_ctx != null) {
            _ctx.tables.rename(__name, newName)
        }
        return this
    }

    boolean __isResultOf() {
        return __resultOf != null
    }

    def __aliasDefined() {
        return __alias != null
    }

    Column COLUMN(String name) {
        Column oCol = __allColumns.get(name)
        if (oCol != null) {
            return oCol
        }
        Column col = new Column(__name: name, _owner: this, _ctx: _ctx)
        __allColumns.put(name, col)
        return col
    }

    def propertyMissing(String name) {
        return COLUMN(name)
    }
<commit_msg>columns can take as duplicate<commit_after>package com.virtusa.gto.insight.nyql

import com.virtusa.gto.insight.nyql.utils.QUtils

/**
 * @author <NAME>
 */

class Table {

    /**
     * Represents any table replaceable with any table in joins.
     */
    static final Table ANY_TABLE = new Table()

    private Map<String, Column> __allColumns = new HashMap<>()

    QContext _ctx = null

    def __name = ''
    def __alias = null

    def __resultOf

    /**
     * This is cross join.
     *
     * @param t other table to be joined with
     * @return new join instance
     */
    def JOIN(Table t) {
        return INNER_JOIN(t)
    }

    /**
     * Inner join
     *
     * @param t other table to be joined with.
     * @return new join instance
     */
    def INNER_JOIN(Table t) {
        return QUtils.mergeJoinClauses(_ctx, this, t, 'INNER_JOIN')
    }

    def LEFT_OUTER_JOIN(Table t) {
        return QUtils.mergeJoinClauses(_ctx, this, t, 'LEFT_OUTER_JOIN')
    }

    def RIGHT_OUTER_JOIN(Table t) {
        return QUtils.mergeJoinClauses(_ctx, this, t, 'RIGHT_OUTER_JOIN')
    }

    def RIGHT_JOIN(Table t) {
        return QUtils.mergeJoinClauses(_ctx, this, t, 'RIGHT_JOIN')
    }

    def LEFT_JOIN(Table t) {
        return QUtils.mergeJoinClauses(_ctx, this, t, 'LEFT_JOIN')
    }

    def alias(String newName) {
        __alias = newName
        if (_ctx != null) {
            _ctx.tables.rename(__name, newName)
        }
        return this
    }

    boolean __isResultOf() {
        return __resultOf != null
    }

    def __aliasDefined() {
        return __alias != null
    }

    Column COLUMN_ALIAS(String name, String alias) {
        Column column = new Column(__name: name, __alias: alias, _owner: this, _ctx: _ctx)
        __allColumns.put(name + "::" + alias, column)
        return column
    }

    Column COLUMN(String name) {
        Column oCol = __allColumns.get(name)
        if (oCol != null) {
            return oCol
        }
        Column col = new Column(__name: name, _owner: this, _ctx: _ctx)
        __allColumns.put(name, col)
        return col
    }

    def propertyMissing(String name) {
        return COLUMN(name)
    }

{'fraction_non_alphanumeric': 0.100748973181928, 'fraction_numerical': 0.0, 'mean_word_length': 2.103448275862069, 'pattern_counts': {'":': 1, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5450390', 'n_tokens_mistral': 1386, 'n_tokens_neox': 1347, 'n_words': 355}