Skip to content

Commit 71857e0

Browse files
authored
ESQL Add some tests for sorting the date nanos union type (#117567) (#117586)
1 parent 18c13e7 commit 71857e0

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/union_types.csv-spec

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,65 @@ sample_data_ts_nanos | 2023-10-23T12:27:28.948123456Z | 172.21.2.113 | 27648
626626
sample_data_ts_nanos | 2023-10-23T12:15:03.360123456Z | 172.21.2.162 | 3450233 | Connected to 10.1.0.3
627627
;
628628

629+
multiIndex sort millis and nanos as nanos
630+
required_capability: to_date_nanos
631+
required_capability: union_types
632+
required_capability: metadata_fields
633+
required_capability: union_types_remove_fields
634+
635+
FROM sample_data, sample_data_ts_nanos METADATA _index
636+
| EVAL ts = TO_DATE_NANOS(@timestamp)
637+
| KEEP _index, ts, client_ip, event_duration, message
638+
| SORT ts DESC
639+
;
640+
641+
_index:keyword | ts:date_nanos | client_ip:ip | event_duration:long | message:keyword
642+
sample_data_ts_nanos | 2023-10-23T13:55:01.543123456Z | 172.21.3.15 | 1756467 | Connected to 10.1.0.1
643+
sample_data | 2023-10-23T13:55:01.543000000Z | 172.21.3.15 | 1756467 | Connected to 10.1.0.1
644+
sample_data_ts_nanos | 2023-10-23T13:53:55.832123456Z | 172.21.3.15 | 5033755 | Connection error
645+
sample_data | 2023-10-23T13:53:55.832000000Z | 172.21.3.15 | 5033755 | Connection error
646+
sample_data_ts_nanos | 2023-10-23T13:52:55.015123456Z | 172.21.3.15 | 8268153 | Connection error
647+
sample_data | 2023-10-23T13:52:55.015000000Z | 172.21.3.15 | 8268153 | Connection error
648+
sample_data_ts_nanos | 2023-10-23T13:51:54.732123456Z | 172.21.3.15 | 725448 | Connection error
649+
sample_data | 2023-10-23T13:51:54.732000000Z | 172.21.3.15 | 725448 | Connection error
650+
sample_data_ts_nanos | 2023-10-23T13:33:34.937123456Z | 172.21.0.5 | 1232382 | Disconnected
651+
sample_data | 2023-10-23T13:33:34.937000000Z | 172.21.0.5 | 1232382 | Disconnected
652+
sample_data_ts_nanos | 2023-10-23T12:27:28.948123456Z | 172.21.2.113 | 2764889 | Connected to 10.1.0.2
653+
sample_data | 2023-10-23T12:27:28.948000000Z | 172.21.2.113 | 2764889 | Connected to 10.1.0.2
654+
sample_data_ts_nanos | 2023-10-23T12:15:03.360123456Z | 172.21.2.162 | 3450233 | Connected to 10.1.0.3
655+
sample_data | 2023-10-23T12:15:03.360000000Z | 172.21.2.162 | 3450233 | Connected to 10.1.0.3
656+
;
657+
658+
multiIndex sort millis and nanos as millis
659+
required_capability: to_date_nanos
660+
required_capability: union_types
661+
required_capability: metadata_fields
662+
required_capability: union_types_remove_fields
663+
664+
FROM sample_data, sample_data_ts_nanos METADATA _index
665+
| EVAL ts = TO_DATETIME(@timestamp)
666+
| KEEP _index, ts, client_ip, event_duration, message
667+
| SORT ts DESC, _index DESC
668+
;
669+
670+
_index:keyword | ts:datetime | client_ip:ip | event_duration:long | message:keyword
671+
sample_data_ts_nanos | 2023-10-23T13:55:01.543Z | 172.21.3.15 | 1756467 | Connected to 10.1.0.1
672+
sample_data | 2023-10-23T13:55:01.543Z | 172.21.3.15 | 1756467 | Connected to 10.1.0.1
673+
sample_data_ts_nanos | 2023-10-23T13:53:55.832Z | 172.21.3.15 | 5033755 | Connection error
674+
sample_data | 2023-10-23T13:53:55.832Z | 172.21.3.15 | 5033755 | Connection error
675+
sample_data_ts_nanos | 2023-10-23T13:52:55.015Z | 172.21.3.15 | 8268153 | Connection error
676+
sample_data | 2023-10-23T13:52:55.015Z | 172.21.3.15 | 8268153 | Connection error
677+
sample_data_ts_nanos | 2023-10-23T13:51:54.732Z | 172.21.3.15 | 725448 | Connection error
678+
sample_data | 2023-10-23T13:51:54.732Z | 172.21.3.15 | 725448 | Connection error
679+
sample_data_ts_nanos | 2023-10-23T13:33:34.937Z | 172.21.0.5 | 1232382 | Disconnected
680+
sample_data | 2023-10-23T13:33:34.937Z | 172.21.0.5 | 1232382 | Disconnected
681+
sample_data_ts_nanos | 2023-10-23T12:27:28.948Z | 172.21.2.113 | 2764889 | Connected to 10.1.0.2
682+
sample_data | 2023-10-23T12:27:28.948Z | 172.21.2.113 | 2764889 | Connected to 10.1.0.2
683+
sample_data_ts_nanos | 2023-10-23T12:15:03.360Z | 172.21.2.162 | 3450233 | Connected to 10.1.0.3
684+
sample_data | 2023-10-23T12:15:03.360Z | 172.21.2.162 | 3450233 | Connected to 10.1.0.3
685+
;
686+
687+
629688
multiIndexTsNanosRenameToNanosWithFiltering
630689
required_capability: to_date_nanos
631690
required_capability: date_nanos_binary_comparison

0 commit comments

Comments
 (0)