Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit c945add

Browse files
committed
Add test
1 parent 674a501 commit c945add

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

quesma/testdata/clients/clover.go

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,4 +1113,103 @@ var CloverTests = []testdata.AggregationTestCase{
11131113
"aggr__q__time_buckets__key_0"
11141114
ORDER BY "aggr__q__time_buckets__key_0" ASC`,
11151115
},
1116+
{
1117+
TestName: "todo",
1118+
QueryRequestJson: `
1119+
{
1120+
"aggs": {
1121+
"q": {
1122+
"aggs": {
1123+
"time": {
1124+
"aggs": {
1125+
"cardinality(a.b.keyword)": {
1126+
"cardinality": {
1127+
"field": "a.b.keyword"
1128+
}
1129+
}
1130+
},
1131+
"date_histogram": {
1132+
"field": "@timestamp",
1133+
"fixed_interval": "12h",
1134+
"min_doc_count": 0,
1135+
"time_zone": "Europe/Warsaw"
1136+
}
1137+
}
1138+
},
1139+
"filters": {
1140+
"filters": {
1141+
"(a.b:*c* OR a.b:*d*)": {
1142+
"query_string": {
1143+
"query": "(a.b:*c* OR a.b:*d*)"
1144+
}
1145+
}
1146+
}
1147+
},
1148+
}
1149+
},
1150+
"runtime_mappings": {},
1151+
"size": 0,
1152+
"timeout": "30000ms",
1153+
"track_total_hits": true
1154+
}`,
1155+
ExpectedResponse: `
1156+
{
1157+
"took": 0,
1158+
"timed_out": false,
1159+
"_shards": {
1160+
"total": 1,
1161+
"successful": 1,
1162+
"failed": 0,
1163+
"skipped": 0
1164+
},
1165+
"hits": {
1166+
"total": {
1167+
"value": 14074,
1168+
"relation": "eq"
1169+
},
1170+
"max_score": null,
1171+
"hits": []
1172+
},
1173+
"aggregations": {
1174+
"q": {
1175+
"buckets": {
1176+
"(a.b:*c* OR a.b:*d*)": {
1177+
"doc_count": 14074,
1178+
"time": {
1179+
"buckets": [
1180+
{
1181+
"key_as_string": "2024-10-13T10:00:00.000",
1182+
"key": 1728813600000,
1183+
"doc_count": 319,
1184+
"cardinality(a.b.keyword)": {
1185+
"value": 672
1186+
}
1187+
}
1188+
]
1189+
}
1190+
}
1191+
}
1192+
}
1193+
}
1194+
}`,
1195+
ExpectedPancakeResults: []model.QueryResultRow{
1196+
{Cols: []model.QueryResultCol{
1197+
model.NewQueryResultCol("aggr__q__count", int64(14074)),
1198+
model.NewQueryResultCol("aggr__q__time__key_0", int64(1728856800000/43200000)),
1199+
model.NewQueryResultCol("aggr__q__time__count", int64(319)),
1200+
model.NewQueryResultCol("metric__q__time__cardinality(a.b.keyword)_col_0", int64(672)),
1201+
}},
1202+
},
1203+
ExpectedPancakeSQL: `
1204+
SELECT sum(count(*)) OVER () AS "aggr__q__count",
1205+
toInt64((toUnixTimestamp64Milli("@timestamp")+timeZoneOffset(toTimezone(
1206+
"@timestamp", 'Europe/Warsaw'))*1000) / 43200000) AS "aggr__q__time__key_0",
1207+
count(*) AS "aggr__q__time__count",
1208+
uniq("a.b") AS "metric__q__time__cardinality(a.b.keyword)_col_0"
1209+
FROM __quesma_table_name
1210+
WHERE (("a.b" ILIKE '%c%') OR "a.b" ILIKE '%d%')
1211+
GROUP BY toInt64((toUnixTimestamp64Milli("@timestamp")+timeZoneOffset(toTimezone
1212+
("@timestamp", 'Europe/Warsaw'))*1000) / 43200000) AS "aggr__q__time__key_0"
1213+
ORDER BY "aggr__q__time__key_0" ASC`,
1214+
},
11161215
}

0 commit comments

Comments
 (0)