@Override protected ColumnRef resolveColumn(ColumnParseNode node) throws SQLException { ColumnRef columnRef = super.resolveColumn(node); if (isTopLevel()) { this.columnRef = columnRef; } return columnRef; }
@Override protected ColumnRef resolveColumn(ColumnParseNode node) throws SQLException { ColumnRef ref = super.resolveColumn(node); isCaseSensitive = isCaseSensitive && node.isCaseSensitive(); return ref; }
@Override protected ColumnRef resolveColumn(ColumnParseNode node) throws SQLException { ColumnRef ref = super.resolveColumn(node); isColumnReferenced.set(ref.getColumn().getPosition()); return ref; } }
@Override protected ColumnRef resolveColumn(ColumnParseNode node) throws SQLException { ColumnRef ref = super.resolveColumn(node); PTable table = ref.getTable(); // Track if we need to compare KeyValue during filter evaluation // using column family. If the column qualifier is enough, we // just use that. try { if (!SchemaUtil.isPKColumn(ref.getColumn())) { table.getColumnForColumnName(ref.getColumn().getName().getString()); } } catch (AmbiguousColumnException e) { disambiguateWithFamily = true; } return ref; } }
@Override public Expression visit(ColumnParseNode node) throws SQLException { ColumnRef ref = resolveColumn(node); TableRef tableRef = ref.getTableRef(); ImmutableBytesWritable ptr = context.getTempPtr(); PColumn column = ref.getColumn(); // If we have an UPDATABLE view, then we compile those view constants (i.e. columns in equality constraints // in the view) to constants. This allows the optimize to optimize out reference to them in various scenarios. // If the column is matched in a WHERE clause against a constant not equal to it's constant, then the entire // query would become degenerate. if (!resolveViewConstants && IndexUtil.getViewConstantValue(column, ptr)) { return LiteralExpression.newConstant(column.getDataType().toObject(ptr), column.getDataType()); } if (tableRef.equals(context.getCurrentTable()) && !SchemaUtil.isPKColumn(column)) { // project only kv columns addColumn(column); } Expression expression = ref.newColumnExpression(node.isTableNameCaseSensitive(), node.isCaseSensitive()); Expression wrappedExpression = wrapGroupByExpression(expression); // If we're in an aggregate expression // and we're not in the context of an aggregate function // and we didn't just wrap our column reference // then we're mixing aggregate and non aggregate expressions in the same expression. // This catches cases like this: SELECT sum(a_integer) + a_integer FROM atable GROUP BY a_string if (isAggregate && aggregateFunction == null && wrappedExpression == expression) { throwNonAggExpressionInAggException(expression.toString()); } return wrappedExpression; }
@Override protected ColumnRef resolveColumn(ColumnParseNode node) throws SQLException { ColumnRef ref = super.resolveColumn(node); isCaseSensitive = isCaseSensitive && node.isCaseSensitive(); return ref; }
@Override protected ColumnRef resolveColumn(ColumnParseNode node) throws SQLException { ColumnRef columnRef = super.resolveColumn(node); if (isTopLevel()) { this.columnRef = columnRef; } return columnRef; }
@Override protected ColumnRef resolveColumn(ColumnParseNode node) throws SQLException { ColumnRef columnRef = super.resolveColumn(node); if (isTopLevel()) { this.columnRef = columnRef; } return columnRef; }
@Override protected ColumnRef resolveColumn(ColumnParseNode node) throws SQLException { ColumnRef ref = super.resolveColumn(node); isCaseSensitive = isCaseSensitive && node.isCaseSensitive(); return ref; }
@Override protected ColumnRef resolveColumn(ColumnParseNode node) throws SQLException { ColumnRef ref = super.resolveColumn(node); isColumnReferenced.set(ref.getColumn().getPosition()); return ref; } }
@Override protected ColumnRef resolveColumn(ColumnParseNode node) throws SQLException { ColumnRef ref = super.resolveColumn(node); isColumnReferenced.set(ref.getColumn().getPosition()); return ref; } }
@Override public Expression visit(ColumnParseNode node) throws SQLException { ColumnRef ref = resolveColumn(node); TableRef tableRef = ref.getTableRef(); ImmutableBytesWritable ptr = context.getTempPtr(); PColumn column = ref.getColumn(); // If we have an UPDATABLE view, then we compile those view constants (i.e. columns in equality constraints // in the view) to constants. This allows the optimize to optimize out reference to them in various scenarios. // If the column is matched in a WHERE clause against a constant not equal to it's constant, then the entire // query would become degenerate. if (!resolveViewConstants && IndexUtil.getViewConstantValue(column, ptr)) { return LiteralExpression.newConstant(column.getDataType().toObject(ptr), column.getDataType()); } if (tableRef.equals(context.getCurrentTable()) && !SchemaUtil.isPKColumn(column)) { // project only kv columns addColumn(column); } Expression expression = ref.newColumnExpression(node.isTableNameCaseSensitive(), node.isCaseSensitive()); Expression wrappedExpression = wrapGroupByExpression(expression); // If we're in an aggregate expression // and we're not in the context of an aggregate function // and we didn't just wrap our column reference // then we're mixing aggregate and non aggregate expressions in the same expression. // This catches cases like this: SELECT sum(a_integer) + a_integer FROM atable GROUP BY a_string if (isAggregate && aggregateFunction == null && wrappedExpression == expression) { throwNonAggExpressionInAggException(expression.toString()); } return wrappedExpression; }
@Override public Expression visit(ColumnParseNode node) throws SQLException { ColumnRef ref = resolveColumn(node); TableRef tableRef = ref.getTableRef(); ImmutableBytesWritable ptr = context.getTempPtr(); PColumn column = ref.getColumn(); // If we have an UPDATABLE view, then we compile those view constants (i.e. columns in equality constraints // in the view) to constants. This allows the optimize to optimize out reference to them in various scenarios. // If the column is matched in a WHERE clause against a constant not equal to it's constant, then the entire // query would become degenerate. if (!resolveViewConstants && IndexUtil.getViewConstantValue(column, ptr)) { return LiteralExpression.newConstant(column.getDataType().toObject(ptr), column.getDataType()); } if (tableRef.equals(context.getCurrentTable()) && !SchemaUtil.isPKColumn(column)) { // project only kv columns addColumn(column); } Expression expression = ref.newColumnExpression(node.isTableNameCaseSensitive(), node.isCaseSensitive()); Expression wrappedExpression = wrapGroupByExpression(expression); // If we're in an aggregate expression // and we're not in the context of an aggregate function // and we didn't just wrap our column reference // then we're mixing aggregate and non aggregate expressions in the same expression. // This catches cases like this: SELECT sum(a_integer) + a_integer FROM atable GROUP BY a_string if (isAggregate && aggregateFunction == null && wrappedExpression == expression) { throwNonAggExpressionInAggException(expression.toString()); } return wrappedExpression; }
@Override protected ColumnRef resolveColumn(ColumnParseNode node) throws SQLException { ColumnRef ref = super.resolveColumn(node); PTable table = ref.getTable(); // if current table in the context is local index and table in column reference is global means // the column is not present in the local index. If where condition contains the column // not present in the index then we need to go through main table for each row in index and get the // missing column which is like full scan of index table and data table. Which is // inefficient. Then we can skip this plan. if (context.getCurrentTable().getTable().getIndexType() == IndexType.LOCAL && (table.getIndexType() == null || table.getIndexType() == IndexType.GLOBAL)) { String schemaNameStr = table.getSchemaName()==null?null:table.getSchemaName().getString(); String tableNameStr = table.getTableName()==null?null:table.getTableName().getString(); throw new ColumnNotFoundException(schemaNameStr, tableNameStr, null, ref.getColumn().getName().getString()); } // Track if we need to compare KeyValue during filter evaluation // using column family. If the column qualifier is enough, we // just use that. try { if (!SchemaUtil.isPKColumn(ref.getColumn())) { table.getColumnForColumnName(ref.getColumn().getName().getString()); } } catch (AmbiguousColumnException e) { disambiguateWithFamily = true; } return ref; } }
@Override protected ColumnRef resolveColumn(ColumnParseNode node) throws SQLException { ColumnRef ref = super.resolveColumn(node); PTable table = ref.getTable(); // if current table in the context is local index and table in column reference is global means // the column is not present in the local index. If where condition contains the column // not present in the index then we need to go through main table for each row in index and get the // missing column which is like full scan of index table and data table. Which is // inefficient. Then we can skip this plan. if (context.getCurrentTable().getTable().getIndexType() == IndexType.LOCAL && (table.getIndexType() == null || table.getIndexType() == IndexType.GLOBAL)) { String schemaNameStr = table.getSchemaName()==null?null:table.getSchemaName().getString(); String tableNameStr = table.getTableName()==null?null:table.getTableName().getString(); throw new ColumnNotFoundException(schemaNameStr, tableNameStr, null, ref.getColumn().getName().getString()); } // Track if we need to compare KeyValue during filter evaluation // using column family. If the column qualifier is enough, we // just use that. try { if (!SchemaUtil.isPKColumn(ref.getColumn())) { table.getColumnForColumnName(ref.getColumn().getName().getString()); } } catch (AmbiguousColumnException e) { disambiguateWithFamily = true; } return ref; } }