-
Notifications
You must be signed in to change notification settings - Fork 190
[BUG] Span millisecond incorrectly converted to microsecond interval #4550
Copy link
Copy link
Closed
Labels
PPLPiped processing languagePiped processing languagebugSomething isn't workingSomething isn't working
Description
What is the bug?
When using span=X milliseconds in timechart commands, the span unit is incorrectly converted to IntervalUnit.MICROSECOND by PlanUtils.spanUnitToIntervalUnit(). The root cause is that the IntervalUnit enum does not include a MILLISECOND value, only MICROSECOND.
How can one reproduce the bug?
Steps to reproduce the behavior:
- Execute a PPL query with timechart using millisecond span:
source=logs | timechart span=500ms count() - The span calculation will use microsecond interval unit instead of millisecond, causing incorrect time bucketing.
What is the expected behavior?
- IntervalUnit enum should include a
MILLISECONDvalue PlanUtilsshould correctly convert betweenSpanUnit.MILLISECONDandIntervalUnit.MILLISECOND
Do you have any additional context?
Impact: This bug also blocks the implementation of millisecond support in the timechart per_* functions (per_second, per_minute, per_hour, per_day). The per_* function transformation logic calculates span width in seconds instead of millisecond, leading to incorrect results when a millisecond span is used.
source=test_data_2023 | timechart span=1ms per_second(packets);
fetched rows / total rows = 5/5
+---------------------+-----------------------+
| @timestamp | per_second(packets) |
|---------------------+-----------------------|
| 2023-10-08 10:00:00 | null |
| 2023-10-08 10:00:05 | null |
| 2023-10-08 10:00:30 | null |
| 2023-10-08 10:00:40 | null |
| 2023-10-08 10:00:50 | null |
+---------------------+-----------------------+
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
PPLPiped processing languagePiped processing languagebugSomething isn't workingSomething isn't working
Type
Projects
Status
Done