@Override protected ColumnRef resolveColumn(ColumnParseNode node) throws SQLException { ColumnRef ref = super.resolveColumn(node); isCaseSensitive = isCaseSensitive && node.isCaseSensitive(); return ref; }
@Override public Void visit(ColumnParseNode node) throws SQLException { ColumnRef ref = context.getResolver().resolveColumn(node.getSchemaName(), node.getTableName(), node.getName()); boolean isAggregateColumn = groupBy.getExpressions().indexOf(ref.newColumnExpression(node.isTableNameCaseSensitive(), node.isCaseSensitive())) >= 0; if (hasOnlyAggregateColumns == null) { hasOnlyAggregateColumns = isAggregateColumn; } else { hasOnlyAggregateColumns &= isAggregateColumn; } return null; }
@Override public ParseNode visit(ColumnParseNode node) throws SQLException { if (multiTable && node.getAlias() != null && node.getTableName() != null && SchemaUtil.normalizeIdentifier(node.getAlias()).equals(node.getName())) { node = NODE_FACTORY.column(TableName.create(node.getSchemaName(), node.getTableName()), node.isCaseSensitive() ? '"' + node.getName() + '"' : node.getName(), node.isCaseSensitive() ? '"' + node.getFullName() + '"' : node.getFullName()); } return super.visit(node); }
@Override public Expression visit(ColumnParseNode node) throws SQLException { ColumnRef ref = resolveColumn(node); TableRef tableRef = ref.getTableRef(); Expression newColumnExpression = ref.newColumnExpression(node.isTableNameCaseSensitive(), node.isCaseSensitive()); if (tableRef.equals(context.getCurrentTable()) && !SchemaUtil.isPKColumn(ref.getColumn())) { byte[] cq = tableRef.getTable().getImmutableStorageScheme() == ImmutableStorageScheme.SINGLE_CELL_ARRAY_WITH_OFFSETS ? QueryConstants.SINGLE_KEYVALUE_COLUMN_QUALIFIER_BYTES : ref.getColumn().getColumnQualifierBytes(); // track the where condition columns. Later we need to ensure the Scan in HRS scans these column CFs context.addWhereConditionColumn(ref.getColumn().getFamilyName().getBytes(), cq); } return newColumnExpression; }
@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 ref = super.resolveColumn(node); isCaseSensitive = isCaseSensitive && node.isCaseSensitive(); return ref; }
@Override public Void visit(ColumnParseNode node) throws SQLException { ColumnRef ref = context.getResolver().resolveColumn(node.getSchemaName(), node.getTableName(), node.getName()); boolean isAggregateColumn = groupBy.getExpressions().indexOf(ref.newColumnExpression(node.isTableNameCaseSensitive(), node.isCaseSensitive())) >= 0; if (hasOnlyAggregateColumns == null) { hasOnlyAggregateColumns = isAggregateColumn; } else { hasOnlyAggregateColumns &= isAggregateColumn; } return null; }
@Override public Void visit(ColumnParseNode node) throws SQLException { ColumnRef ref = context.getResolver().resolveColumn(node.getSchemaName(), node.getTableName(), node.getName()); boolean isAggregateColumn = groupBy.getExpressions().indexOf(ref.newColumnExpression(node.isTableNameCaseSensitive(), node.isCaseSensitive())) >= 0; if (hasOnlyAggregateColumns == null) { hasOnlyAggregateColumns = isAggregateColumn; } else { hasOnlyAggregateColumns &= isAggregateColumn; } return null; }
@Override public ParseNode visit(ColumnParseNode node) throws SQLException { if (multiTable && node.getAlias() != null && node.getTableName() != null && SchemaUtil.normalizeIdentifier(node.getAlias()).equals(node.getName())) { node = NODE_FACTORY.column(TableName.create(node.getSchemaName(), node.getTableName()), node.isCaseSensitive() ? '"' + node.getName() + '"' : node.getName(), node.isCaseSensitive() ? '"' + node.getFullName() + '"' : node.getFullName()); } return super.visit(node); }
@Override public ParseNode visit(ColumnParseNode node) throws SQLException { if (multiTable && node.getAlias() != null && node.getTableName() != null && SchemaUtil.normalizeIdentifier(node.getAlias()).equals(node.getName())) { node = NODE_FACTORY.column(TableName.create(node.getSchemaName(), node.getTableName()), node.isCaseSensitive() ? '"' + node.getName() + '"' : node.getName(), node.isCaseSensitive() ? '"' + node.getFullName() + '"' : node.getFullName()); } return super.visit(node); }
@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(); Expression newColumnExpression = ref.newColumnExpression(node.isTableNameCaseSensitive(), node.isCaseSensitive()); if (tableRef.equals(context.getCurrentTable()) && !SchemaUtil.isPKColumn(ref.getColumn())) { byte[] cq = tableRef.getTable().getImmutableStorageScheme() == ImmutableStorageScheme.SINGLE_CELL_ARRAY_WITH_OFFSETS ? QueryConstants.SINGLE_KEYVALUE_COLUMN_QUALIFIER_BYTES : ref.getColumn().getColumnQualifierBytes(); // track the where condition columns. Later we need to ensure the Scan in HRS scans these column CFs context.addWhereConditionColumn(ref.getColumn().getFamilyName().getBytes(), cq); } return newColumnExpression; }
@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(); Expression newColumnExpression = ref.newColumnExpression(node.isTableNameCaseSensitive(), node.isCaseSensitive()); if (tableRef.equals(context.getCurrentTable())) { if (!SchemaUtil.isPKColumn(ref.getColumn())) { byte[] cq = tableRef.getTable().getImmutableStorageScheme() == ImmutableStorageScheme.SINGLE_CELL_ARRAY_WITH_OFFSETS ? QueryConstants.SINGLE_KEYVALUE_COLUMN_QUALIFIER_BYTES : ref.getColumn().getColumnQualifierBytes(); // track the where condition columns. Later we need to ensure the Scan in HRS scans these column CFs context.addWhereConditionColumn(ref.getColumn().getFamilyName().getBytes(), cq); } else { context.addFilterConditionsPKColumns(ref); } } return newColumnExpression; }