|
| 1 | +setup: |
| 2 | + - do: |
| 3 | + indices.create: |
| 4 | + index: time_test |
| 5 | + - do: |
| 6 | + query.settings: |
| 7 | + body: |
| 8 | + transient: |
| 9 | + plugins.calcite.enabled : true |
| 10 | + |
| 11 | + - do: |
| 12 | + bulk: |
| 13 | + refresh: true |
| 14 | + body: |
| 15 | + - '{"index": {"_index": "time_test"}}' |
| 16 | + - '{"category":"A","value":1000,"@timestamp":"2024-01-01T00:00:00Z"}' |
| 17 | + - '{"index": {"_index": "time_test"}}' |
| 18 | + - '{"category":"B","value":2000,"@timestamp":"2024-01-01T00:05:00Z"}' |
| 19 | + - '{"index": {"_index": "time_test"}}' |
| 20 | + - '{"category":"A","value":1500,"@timestamp":"2024-01-01T00:10:00Z"}' |
| 21 | + - '{"index": {"_index": "time_test"}}' |
| 22 | + - '{"category":"C","value":3000,"@timestamp":"2024-01-01T00:20:00Z"}' |
| 23 | + |
| 24 | +--- |
| 25 | +teardown: |
| 26 | + - do: |
| 27 | + query.settings: |
| 28 | + body: |
| 29 | + transient: |
| 30 | + plugins.calcite.enabled : false |
| 31 | + |
| 32 | +--- |
| 33 | +"Test span aggregation with field name collision - basic case": |
| 34 | + - skip: |
| 35 | + features: |
| 36 | + - headers |
| 37 | + - allowed_warnings |
| 38 | + - do: |
| 39 | + headers: |
| 40 | + Content-Type: 'application/json' |
| 41 | + ppl: |
| 42 | + body: |
| 43 | + query: source=time_test | stats count() by span(value, 1000) as value |
| 44 | + |
| 45 | + - match: { total: 3 } |
| 46 | + - match: { schema: [{"name": "count()", "type": "bigint"}, {"name": "value", "type": "bigint"}] } |
| 47 | + - match: { datarows: [[2, 1000], [1, 2000], [1, 3000]] } |
| 48 | + |
| 49 | +--- |
| 50 | +"Test span aggregation with field name collision - multiple aggregations": |
| 51 | + - skip: |
| 52 | + features: |
| 53 | + - headers |
| 54 | + - allowed_warnings |
| 55 | + - do: |
| 56 | + headers: |
| 57 | + Content-Type: 'application/json' |
| 58 | + ppl: |
| 59 | + body: |
| 60 | + query: source=time_test | stats count(), avg(value) by span(value, 1000) as value |
| 61 | + |
| 62 | + - match: { total: 3 } |
| 63 | + - match: { schema: [{"name": "count()", "type": "bigint"}, {"name": "avg(value)", "type": "double"}, {"name": "value", "type": "bigint"}] } |
| 64 | + - match: { datarows: [[2, 1250.0, 1000], [1, 2000.0, 2000], [1, 3000.0, 3000]] } |
| 65 | + |
| 66 | +--- |
| 67 | +"Test span aggregation without name collision - multiple group-by": |
| 68 | + - skip: |
| 69 | + features: |
| 70 | + - headers |
| 71 | + - allowed_warnings |
| 72 | + - do: |
| 73 | + headers: |
| 74 | + Content-Type: 'application/json' |
| 75 | + ppl: |
| 76 | + body: |
| 77 | + query: source=time_test | stats count() by span(@timestamp, 10min) as @timestamp, category, value |
| 78 | + |
| 79 | + - match: { total: 4 } |
| 80 | + - match: { schema: [{"name": "count()", "type": "bigint"}, {"name": "@timestamp", "type": "timestamp"}, {"name": "category", "type": "string"}, {"name": "value", "type": "bigint"}] } |
| 81 | + - match: { datarows: [[1, "2024-01-01 00:00:00", "A", 1000], [1, "2024-01-01 00:10:00", "A", 1500], [1, "2024-01-01 00:00:00", "B", 2000], [1, "2024-01-01 00:20:00", "C", 3000]] } |
| 82 | + |
| 83 | +--- |
| 84 | +"Test span aggregation with duplicated group keys": |
| 85 | + - skip: |
| 86 | + features: |
| 87 | + - headers |
| 88 | + - allowed_warnings |
| 89 | + - do: |
| 90 | + headers: |
| 91 | + Content-Type: 'application/json' |
| 92 | + ppl: |
| 93 | + body: |
| 94 | + query: source=time_test | stats count() by value, value, span(@timestamp, 10min) as @timestamp |
| 95 | + |
| 96 | + - match: { total: 4 } |
| 97 | + - match: { schema: [{"name": "count()", "type": "bigint"}, {"name": "@timestamp", "type": "timestamp"}, {"name": "value", "type": "bigint"}, {"name": "value0", "type": "bigint"}] } |
| 98 | + - match: { datarows: [[1, "2024-01-01 00:00:00", 1000, 1000], [1, "2024-01-01 00:10:00", 1500, 1500], [1, "2024-01-01 00:00:00", 2000, 2000], [1, "2024-01-01 00:20:00", 3000, 3000]] } |
0 commit comments