[ 
https://issues.apache.org/jira/browse/FLINK-3574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15184889#comment-15184889
 ] 

Dawid Wysakowicz commented on FLINK-3574:
-----------------------------------------

I thought about a logic as described by you in {{getCallGenerator}}, but right 
know we can't specify signature with NUMERIC type cause {{NumericTypeInfo}} is 
an abstract class thus it cannot be instantiated.

Regarding the two ways of processing I meant sth different. Have a look at 
those two code snippets:  

RexNodeTranslator:
{code}
      case UnaryMinus(child) =>
        val c = toRexNode(child, relBuilder)
        relBuilder.call(SqlStdOperatorTable.UNARY_MINUS, c)

      // Scalar functions
      case Call(name, args@_*) =>
        val rexArgs = args.map(toRexNode(_, relBuilder))
        val sqlOperator = toSqlOperator(name)
        relBuilder.call(sqlOperator, rexArgs)
{code}

CodeGenerator:
{code}
      case OR =>
        operands.reduceLeft { (left: GeneratedExpression, right: 
GeneratedExpression) =>
          requireBoolean(left)
          requireBoolean(right)
          generateOr(nullCheck, left, right)
        }

      case call: SqlOperator =>
        val callGen = ScalarFunctions.getCallGenerator(call, 
operands.map(_.resultType))
        callGen
          .getOrElse(throw new CodeGenException(s"Unsupported call: $call"))
          .generate(this, operands)
{code}

In both snippets UnaryMinus and OR could be expressed in the case call block 
using appropriate CallGenerator. My question is should we replace whole match 
block with the invocation to {{getCallGenerator}}

> Implement math functions for Table API
> --------------------------------------
>
>                 Key: FLINK-3574
>                 URL: https://issues.apache.org/jira/browse/FLINK-3574
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API
>            Reporter: Timo Walther
>            Assignee: Dawid Wysakowicz
>
> {code}
> MOD
> EXP
> POWER
> LN
> LOG10
> ABS
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to