-
Notifications
You must be signed in to change notification settings - Fork 190
[BUG] bin with bins parameter fails on field @timestamp #4317
Copy link
Copy link
Closed
Labels
PPLPiped processing languagePiped processing languagebugSomething isn't workingSomething isn't workingcalcitecalcite migration releatedcalcite migration releated
Description
*What is the bug?
bin command supports different parameters like span, bins...
It works fine when using bin on @timestamp with parameter span:
source=events | bin @timestamp span=3m
But got failure when using parameter bins:
source=events | bin @timestamp bins=3
it gets error:
{
"error": {
"reason": "There was internal problem at backend",
"details": "java.sql.SQLException: Error while preparing plan [LogicalSystemLimit(fetch=[10000], type=[QUERY_SIZE_LIMIT])\n LogicalProject(host=[$0], cpu_usage=[$2], region=[$3], @timestamp=[WIDTH_BUCKET($1, 3, -(MAX($1) OVER (), MIN($1) OVER ()), MAX($1) OVER ())])\n CalciteLogicalIndexScan(table=[[OpenSearch, events]])\n]",
"type": "RuntimeException"
},
"status": 500
}
and the stracktrace in the backend log:
Suppressed: java.lang.RuntimeException: while resolving method 'minus[class java.lang.String, class java.lang.String]' in class class org.apache.calcite.runtime.SqlFunctions
at org.apache.calcite.linq4j.tree.Types.lookupMethod(Types.java:297) ~[?:?]
at org.apache.calcite.linq4j.tree.Expressions.call(Expressions.java:453) ~[?:?]
at org.apache.calcite.adapter.enumerable.RexImpTable$BinaryImplementor.implementSafe(RexImpTable.java:3197) ~[?:?]
...
...
How can one reproduce the bug?
Steps to reproduce the behavior:
- Add logs:
POST localhost:9200/events/_bulk/
{"index":{"_id":"1"}}
{"@timestamp":"2024-07-01T00:00:00","host":"web-01","cpu_usage":45.2,"region":"us-east"}
{"index":{"_id":"2"}}
{"@timestamp":"2024-07-01T00:01:00","host":"web-02","cpu_usage":38.7,"region":"us-west"}
{"index":{"_id":"3"}}
{"@timestamp":"2024-07-01T00:02:00","host":"web-01","cpu_usage":55.3,"region":"us-east"}
{"index":{"_id":"4"}}
{"@timestamp":"2024-07-01T00:03:00","host":"db-01","cpu_usage":42.1,"region":"eu-west"}
{"index":{"_id":"5"}}
{"@timestamp":"2024-07-01T00:04:00","host":"web-02","cpu_usage":41.8,"region":"us-west"}
- Enable calcite
PUT localhost:9200/_plugins/_query/settings
{
"transient": {
"plugins.calcite.enabled": true,
"plugins.calcite.pushdown.enabled": true,
"plugins.calcite.fallback.allowed": false
}
}
- Query with above failed PPL and got error.
What is your host/environment?
- OS: MacOS
- Version 3.2.0
- Plugins
Do you have any screenshots?
If applicable, add screenshots to help explain your problem.
Do you have any additional context?
Add any other context about the problem.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
PPLPiped processing languagePiped processing languagebugSomething isn't workingSomething isn't workingcalcitecalcite migration releatedcalcite migration releated
Type
Projects
Status
Done