Github user hyunsik commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/819#discussion_r43659788
  
    --- Diff: 
tajo-plan/src/main/java/org/apache/tajo/plan/util/EvalNodeToExprConverter.java 
---
    @@ -143,34 +144,59 @@ protected EvalNode visitBinaryEval(Object o, 
Stack<EvalNode> stack, BinaryEval b
     
       @Override
       protected EvalNode visitConst(Object o, ConstEval evalNode, 
Stack<EvalNode> stack) {
    +    exprs.push(convertDatumToExpr(evalNode.getValueType().getType(), 
evalNode.getValue()));
    +    return super.visitConst(o, evalNode, stack);
    +  }
    +
    +  @Override
    +  protected EvalNode visitRowConstant(Object o, RowConstantEval evalNode, 
Stack<EvalNode> stack) {
    +    Expr[] values = new Expr[evalNode.getValues().length];
    +    for (int i = 0; i < evalNode.getValues().length; i++) {
    +      Datum datum = evalNode.getValues()[i];
    +      values[i] = convertDatumToExpr(datum.type(), datum);
    +    }
    +    ValueListExpr expr = new ValueListExpr(values);
    +    exprs.push(expr);
    +
    +    return super.visitRowConstant(o, evalNode, stack);
    +  }
    +
    +  /**
    +   * Convert specified Datum to Expr
    +   *
    +   * @param type value type
    +   * @param datum target datum
    +   * @return converted datum
    +   */
    +  private Expr convertDatumToExpr(TajoDataTypes.Type type, Datum datum) {
         Expr value = null;
         DateValue dateValue;
         TimeValue timeValue;
     
    -    switch (evalNode.getValueType().getType()) {
    +    switch (type) {
           case NULL_TYPE:
             value = new NullLiteral();
             break;
           case BOOLEAN:
    -        value = new LiteralValue(evalNode.getValue().asChars(), 
LiteralValue.LiteralType.Boolean);
    +        value = new LiteralValue(datum.asChars(), 
LiteralValue.LiteralType.Boolean);
    --- End diff --
    
    The cases for ``BOOLEAN, ... TEXT`` can be simplified after getting a 
proper LiteralValue type.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to