Search in sources :

Example 1 with StringConcatExpression

use of org.apache.phoenix.expression.StringConcatExpression in project phoenix by apache.

the class ExpressionCompiler method visitLeave.

@Override
public Expression visitLeave(StringConcatParseNode node, List<Expression> children) throws SQLException {
    final StringConcatExpression expression = new StringConcatExpression(children);
    for (int i = 0; i < children.size(); i++) {
        ParseNode childNode = node.getChildren().get(i);
        if (childNode instanceof BindParseNode) {
            context.getBindManager().addParamMetaData((BindParseNode) childNode, expression);
        }
        PDataType type = children.get(i).getDataType();
        if (type == PVarbinary.INSTANCE) {
            throw new SQLExceptionInfo.Builder(SQLExceptionCode.TYPE_NOT_SUPPORTED_FOR_OPERATOR).setMessage("Concatenation does not support " + type + " in expression" + node).build().buildException();
        }
    }
    ImmutableBytesWritable ptr = context.getTempPtr();
    if (ExpressionUtil.isConstant(expression)) {
        return ExpressionUtil.getConstantExpression(expression, ptr);
    }
    return wrapGroupByExpression(expression);
}
Also used : StringConcatExpression(org.apache.phoenix.expression.StringConcatExpression) ImmutableBytesWritable(org.apache.hadoop.hbase.io.ImmutableBytesWritable) PDataType(org.apache.phoenix.schema.types.PDataType) BindParseNode(org.apache.phoenix.parse.BindParseNode) ModulusParseNode(org.apache.phoenix.parse.ModulusParseNode) LikeParseNode(org.apache.phoenix.parse.LikeParseNode) UDFParseNode(org.apache.phoenix.parse.UDFParseNode) ComparisonParseNode(org.apache.phoenix.parse.ComparisonParseNode) SequenceValueParseNode(org.apache.phoenix.parse.SequenceValueParseNode) InListParseNode(org.apache.phoenix.parse.InListParseNode) AndParseNode(org.apache.phoenix.parse.AndParseNode) ExistsParseNode(org.apache.phoenix.parse.ExistsParseNode) SubtractParseNode(org.apache.phoenix.parse.SubtractParseNode) NotParseNode(org.apache.phoenix.parse.NotParseNode) DivideParseNode(org.apache.phoenix.parse.DivideParseNode) StringConcatParseNode(org.apache.phoenix.parse.StringConcatParseNode) OrParseNode(org.apache.phoenix.parse.OrParseNode) ParseNode(org.apache.phoenix.parse.ParseNode) LiteralParseNode(org.apache.phoenix.parse.LiteralParseNode) FunctionParseNode(org.apache.phoenix.parse.FunctionParseNode) RowValueConstructorParseNode(org.apache.phoenix.parse.RowValueConstructorParseNode) MultiplyParseNode(org.apache.phoenix.parse.MultiplyParseNode) ColumnParseNode(org.apache.phoenix.parse.ColumnParseNode) CaseParseNode(org.apache.phoenix.parse.CaseParseNode) CastParseNode(org.apache.phoenix.parse.CastParseNode) AddParseNode(org.apache.phoenix.parse.AddParseNode) SubqueryParseNode(org.apache.phoenix.parse.SubqueryParseNode) ArithmeticParseNode(org.apache.phoenix.parse.ArithmeticParseNode) IsNullParseNode(org.apache.phoenix.parse.IsNullParseNode) SQLExceptionInfo(org.apache.phoenix.exception.SQLExceptionInfo) BindParseNode(org.apache.phoenix.parse.BindParseNode)

Aggregations

ImmutableBytesWritable (org.apache.hadoop.hbase.io.ImmutableBytesWritable)1 SQLExceptionInfo (org.apache.phoenix.exception.SQLExceptionInfo)1 StringConcatExpression (org.apache.phoenix.expression.StringConcatExpression)1 AddParseNode (org.apache.phoenix.parse.AddParseNode)1 AndParseNode (org.apache.phoenix.parse.AndParseNode)1 ArithmeticParseNode (org.apache.phoenix.parse.ArithmeticParseNode)1 BindParseNode (org.apache.phoenix.parse.BindParseNode)1 CaseParseNode (org.apache.phoenix.parse.CaseParseNode)1 CastParseNode (org.apache.phoenix.parse.CastParseNode)1 ColumnParseNode (org.apache.phoenix.parse.ColumnParseNode)1 ComparisonParseNode (org.apache.phoenix.parse.ComparisonParseNode)1 DivideParseNode (org.apache.phoenix.parse.DivideParseNode)1 ExistsParseNode (org.apache.phoenix.parse.ExistsParseNode)1 FunctionParseNode (org.apache.phoenix.parse.FunctionParseNode)1 InListParseNode (org.apache.phoenix.parse.InListParseNode)1 IsNullParseNode (org.apache.phoenix.parse.IsNullParseNode)1 LikeParseNode (org.apache.phoenix.parse.LikeParseNode)1 LiteralParseNode (org.apache.phoenix.parse.LiteralParseNode)1 ModulusParseNode (org.apache.phoenix.parse.ModulusParseNode)1 MultiplyParseNode (org.apache.phoenix.parse.MultiplyParseNode)1