generated from amazon-archives/__template_Custom
-
Notifications
You must be signed in to change notification settings - Fork 176
Closed
Labels
PPLPiped processing languagePiped processing languagebugSomething isn't workingSomething isn't working
Description
Aggregation fails when grouping by timestamp-derived fields
Bug Description
There is an issue in the stats/aggregation logic when grouping by timestamp-related fields. This affects both the bin
command with timestamp aggregation and direct timestamp field manipulation.
Steps to Reproduce
Minimal Reproduction Case
source=time_test | eval t = unix_timestamp(@timestamp) | stats count() by t
Original Failing Test Case
source=opensearch-sql_test_index_time_data | bin @timestamp span=4h | stats count() by @timestamp | sort @timestamp | head 3
Current Behavior
Both queries fail with aggregation errors, indicating the problem is in the stats command aggregation logic,
Expected Behavior
stats count() by t
should successfully group by the timestamp-derived field and return aggregated countsbin @timestamp span=4h | stats count() by @timestamp
should successfully bin timestamps into 4-hour intervals and aggregate counts
Test Case for Verification
@Test
public void testTimestampAggregationIssue() throws IOException {
// Simple case - should work
JSONObject result = executeQuery(
"source=time_test | eval t = unix_timestamp(@timestamp) | stats count() by t"
);
// Bin case - should also work
JSONObject binResult = executeQuery(
"source=opensearch-sql_test_index_time_data | bin @timestamp span=4h | stats count() by @timestamp"
);
}
Metadata
Metadata
Assignees
Labels
PPLPiped processing languagePiped processing languagebugSomething isn't workingSomething isn't working
Type
Projects
Status
Done