Skip to content

Commit

Permalink
feat:add single party func floor (#135)
Browse files Browse the repository at this point in the history
在SCQL中实现单方算子floor
#115
  • Loading branch information
cs1317 authored Aug 10, 2023
1 parent dd76c6f commit 7696715
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/expression/expression_to_stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (c ExprConverter) convertScalarFunction(dialect format.Dialect, expr *Scala
return &ast.FuncCallExpr{FnName: model.NewCIStr(dialect.GetSpecialFuncName(ast.Ifnull)), Args: children}, nil
case ast.If:
return &ast.FuncCallExpr{FnName: model.NewCIStr(ast.If), Args: children}, nil
case ast.Cos, ast.Abs, ast.Round, ast.Log10, ast.Ceil:
case ast.Cos, ast.Abs, ast.Round, ast.Log10, ast.Ceil, ast.Floor:
return &ast.FuncCallExpr{FnName: model.NewCIStr(expr.FuncName.L), Args: children}, nil
}
switch expr.Function.(type) {
Expand Down
11 changes: 9 additions & 2 deletions pkg/planner/core/testdata/runsql_in.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,20 @@
"skip_projection": false,
"rewritten_sql": "select round(tbl_1.aggregate_float_0) as a from alice.tbl_1"
},
{ "sql": "select log10(aggregate_float_0) as a from alice.tbl_1",
{
"sql": "select log10(aggregate_float_0) as a from alice.tbl_1",
"skip_projection": false,
"rewritten_sql": "select log10(tbl_1.aggregate_float_0) as a from alice.tbl_1"
},
{ "sql": "select ceil(aggregate_float_0) as a from alice.tbl_1",
{
"sql": "select ceil(aggregate_float_0) as a from alice.tbl_1",
"skip_projection": false,
"rewritten_sql": "select ceil(tbl_1.aggregate_float_0) as a from alice.tbl_1"
},
{
"sql": "select floor(aggregate_float_0) as a from alice.tbl_1",
"skip_projection": false,
"rewritten_sql": "select floor(tbl_1.aggregate_float_0) as a from alice.tbl_1"
}
]
}
Expand Down

0 comments on commit 7696715

Please sign in to comment.