This is an automated email from the ASF dual-hosted git repository. jark pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
commit d10fbd96f6b97312d74dbc644f3354fd3558a697 Author: JingsongLi <lzljs3620...@aliyun.com> AuthorDate: Thu Jul 25 16:27:59 2019 +0800 [FLINK-13237][table-planner-blink] Fix sqrt conversion in RexNodeConverter --- .../apache/flink/table/planner/expressions/RexNodeConverter.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/expressions/RexNodeConverter.java b/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/expressions/RexNodeConverter.java index a3d85e7..68b7b7f 100644 --- a/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/expressions/RexNodeConverter.java +++ b/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/expressions/RexNodeConverter.java @@ -34,6 +34,7 @@ import org.apache.flink.table.expressions.TypeLiteralExpression; import org.apache.flink.table.expressions.UnresolvedCallExpression; import org.apache.flink.table.expressions.UnresolvedReferenceExpression; import org.apache.flink.table.expressions.ValueLiteralExpression; +import org.apache.flink.table.expressions.utils.ApiExpressionUtils; import org.apache.flink.table.functions.AggregateFunction; import org.apache.flink.table.functions.AggregateFunctionDefinition; import org.apache.flink.table.functions.BuiltInFunctionDefinitions; @@ -97,6 +98,7 @@ import org.apache.calcite.util.TimestampWithTimeZoneString; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.HashSet; @@ -241,7 +243,9 @@ public class RexNodeConverter implements ExpressionVisitor<RexNode> { conversionsOfBuiltInFunc .put(BuiltInFunctionDefinitions.POWER, exprs -> convert(FlinkSqlOperatorTable.POWER, exprs)); conversionsOfBuiltInFunc.put(BuiltInFunctionDefinitions.MOD, exprs -> convert(FlinkSqlOperatorTable.MOD, exprs)); - conversionsOfBuiltInFunc.put(BuiltInFunctionDefinitions.SQRT, exprs -> convert(FlinkSqlOperatorTable.SQRT, exprs)); + conversionsOfBuiltInFunc.put(BuiltInFunctionDefinitions.SQRT, exprs -> + relBuilder.call(FlinkSqlOperatorTable.POWER, + convertCallChildren(Arrays.asList(exprs.get(0), ApiExpressionUtils.valueLiteral(0.5))))); conversionsOfBuiltInFunc .put(BuiltInFunctionDefinitions.MINUS_PREFIX, exprs -> convert(FlinkSqlOperatorTable.UNARY_MINUS, exprs)); conversionsOfBuiltInFunc.put(BuiltInFunctionDefinitions.SIN, exprs -> convert(FlinkSqlOperatorTable.SIN, exprs));