-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
Description
Due to the name mismatch between
Lines 37 to 40 in 2efd224
| @Override | |
| protected String mathFunction() { | |
| return "signum"; | |
| } |
and
Lines 260 to 262 in 08da5bb
| public static Double sign(Number value) { | |
| return MathOperation.SIGN.apply(value); | |
| } |
The SIGN/SIGNUM function fail when used in GROUP BY or ORDER BY.
To reproduce:
SELECT SIGNUM(salary - 50000) sig FROM test_emp GROUP BY sig
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "compile error",
"script_stack": [
"InternalSqlScriptUtils.signum(InternalSqlScript ...",
" ^---- HERE"
],
"script": "InternalSqlScriptUtils.signum(InternalSqlScriptUtils.sub(InternalSqlScriptUtils.docValue(doc,params.v0),params.v1))",
"lang": "painless"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "test_emp",
"node": "uzOJf9yTSGGYtJILcwpG5Q",
"reason": {
"type": "script_exception",
"reason": "compile error",
"script_stack": [
"InternalSqlScriptUtils.signum(InternalSqlScript ...",
" ^---- HERE"
],
"script": "InternalSqlScriptUtils.signum(InternalSqlScriptUtils.sub(InternalSqlScriptUtils.docValue(doc,params.v0),params.v1))",
"lang": "painless",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "method [org.elasticsearch.xpack.sql.expression.function.scalar.whitelist.InternalSqlScriptUtils, signum/1] not found"
}
}
}
]
},
"status": 400
}