What & why
The math folder udf/table/math/ currently has only E, Log2, and Round —
noticeably thin. Adding SIGN (the sign of a number), CBRT (cube root), and
TRUNC (truncate to N decimals) is a quick win that meaningfully fills out the
SQL toolbox.
数学函数目录现在只有 E、Log2、Round 三个,明显偏薄。补上 SIGN(符号)、
CBRT(立方根)、TRUNC(截断到指定小数位),花不了多少时间,却能明显补全 SQL 表达力。
The task
sign(x) → -1 / 0 / 1
cbrt(x) → cube root
trunc(x, d) → truncate (not round) to d decimal places
Where to look
- Follow
udf/table/math/Round.java; in the same folder add Sign.java,
Cbrt.java, Trunc.java (extend UDF, add @Description).
- Register them in
BuildInSqlFunctionTable.java.
- Add tests under
query/ + expect/ in geaflow-dsl-runtime, covering
negative numbers, zero, and null.
Done when
What & why
The math folder
udf/table/math/currently has onlyE,Log2, andRound—noticeably thin. Adding
SIGN(the sign of a number),CBRT(cube root), andTRUNC(truncate to N decimals) is a quick win that meaningfully fills out theSQL toolbox.
数学函数目录现在只有
E、Log2、Round三个,明显偏薄。补上SIGN(符号)、CBRT(立方根)、TRUNC(截断到指定小数位),花不了多少时间,却能明显补全 SQL 表达力。The task
sign(x)→ -1 / 0 / 1cbrt(x)→ cube roottrunc(x, d)→ truncate (not round) toddecimal placesWhere to look
udf/table/math/Round.java; in the same folder addSign.java,Cbrt.java,Trunc.java(extendUDF, add@Description).BuildInSqlFunctionTable.java.query/+expect/ingeaflow-dsl-runtime, coveringnegative numbers, zero, and null.
Done when
truncvsroundclearly distinguished (truncate ≠ round) — show an example in the PR