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
context.getScan().addColumn(column.getFamilyName().getBytes(), column.getName().getBytes());
}
Expression expression = ref.newColumnExpression();
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.