Skip to content

Commit f8ca703

Browse files
More tests
1 parent d059447 commit f8ca703

File tree

1 file changed

+168
-0
lines changed
  • x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql

1 file changed

+168
-0
lines changed

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/10_basic.yml

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,5 +711,173 @@ version is not allowed:
711711
- length: {values.1: 0 }
712712
- length: {values.2: 0 }
713713

714+
---
715+
"Drop all columns after eval where false":
716+
- requires:
717+
test_runner_features: [capabilities, allowed_warnings_regex]
718+
capabilities:
719+
- method: POST
720+
path: /_query
721+
parameters: []
722+
capabilities: [fix_no_columns]
723+
reason: "plans witn no columns only recently supported"
724+
725+
- do:
726+
allowed_warnings_regex:
727+
- "No limit defined, adding default limit of \\[.*\\]"
728+
esql.query:
729+
body:
730+
query: 'from test | keep color | eval c = 1 | drop c, color | where false'
731+
732+
- length: {columns: 0}
733+
- length: {values: 0}
734+
735+
---
736+
"Drop all columns with inline stats ":
737+
- requires:
738+
test_runner_features: [capabilities, allowed_warnings_regex]
739+
capabilities:
740+
- method: POST
741+
path: /_query
742+
parameters: []
743+
capabilities: [fix_no_columns]
744+
reason: "plans witn no columns only recently supported"
745+
746+
- do:
747+
allowed_warnings_regex:
748+
- "No limit defined, adding default limit of \\[.*\\]"
749+
esql.query:
750+
body:
751+
query: 'from test | keep color | drop color | eval x = 1 | inline stats a = count(), b = max(x) | limit 3'
752+
753+
- length: {columns: 3}
754+
- match: { columns.0.name: "x" }
755+
- match: { columns.1.name: "a" }
756+
- match: { columns.2.name: "b" }
757+
- length: {values: 3}
758+
- match: {values.0: [1, 40, 1]}
759+
- match: {values.1: [1, 40, 1]}
760+
- match: {values.2: [1, 40, 1]}
761+
762+
---
763+
"Drop all columns with inline stats and by":
764+
- requires:
765+
test_runner_features: [capabilities, allowed_warnings_regex]
766+
capabilities:
767+
- method: POST
768+
path: /_query
769+
parameters: []
770+
capabilities: [fix_no_columns]
771+
reason: "plans witn no columns only recently supported"
772+
773+
- do:
774+
allowed_warnings_regex:
775+
- "No limit defined, adding default limit of \\[.*\\]"
776+
esql.query:
777+
body:
778+
query: 'from test | keep color | drop color | eval x = 1, y = 1 | inline stats a = count(), b = max(x) by y | limit 3'
714779

780+
- length: {columns: 4}
781+
- match: { columns.0.name: "x" }
782+
- match: { columns.1.name: "a" }
783+
- match: { columns.2.name: "b" }
784+
- match: { columns.3.name: "y" }
785+
- length: {values: 3}
786+
- match: {values.0: [1, 40, 1, 1]}
787+
- match: {values.1: [1, 40, 1, 1]}
788+
- match: {values.2: [1, 40, 1, 1]}
789+
790+
---
791+
"Drop all columns with mutiple indices":
792+
- requires:
793+
test_runner_features: [ capabilities, allowed_warnings_regex ]
794+
capabilities:
795+
- method: POST
796+
path: /_query
797+
parameters: [ ]
798+
capabilities: [ fix_no_columns ]
799+
reason: "plans witn no columns only recently supported"
800+
801+
- do:
802+
allowed_warnings_regex:
803+
- "No limit defined, adding default limit of \\[.*\\]"
804+
esql.query:
805+
body:
806+
query: 'from test* | keep color | drop color | eval x = 1, y = 1 | inline stats a = count(), b = max(x) by y | limit 3'
807+
- length: { columns: 4 }
808+
- match: { columns.0.name: "x" }
809+
- match: { columns.1.name: "a" }
810+
- match: { columns.2.name: "b" }
811+
- match: { columns.3.name: "y" }
812+
- length: { values: 3 }
813+
- match: {values.0: [1, 43, 1, 1]}
814+
- match: {values.1: [1, 43, 1, 1]}
815+
- match: {values.2: [1, 43, 1, 1]}
816+
817+
---
818+
"Drop all columns with fork":
819+
- requires:
820+
test_runner_features: [ capabilities, allowed_warnings_regex ]
821+
capabilities:
822+
- method: POST
823+
path: /_query
824+
parameters: [ ]
825+
capabilities: [ fix_no_columns ]
826+
reason: "plans witn no columns only recently supported"
827+
828+
- do:
829+
allowed_warnings_regex:
830+
- "No limit defined, adding default limit of \\[.*\\]"
831+
esql.query:
832+
body:
833+
query: 'from test | keep color | drop color | fork (stats c=count()) (stats c=count())'
834+
835+
- length: { columns: 2 }
836+
- match: { columns.0.name: "c" }
837+
- match: { columns.1.name: "_fork" }
838+
- length: { values: 2 }
839+
- match: {values.0.0: 40}
840+
- match: {values.1.0: 40}
841+
842+
843+
---
844+
"Drop all columns with fork drop all":
845+
- requires:
846+
test_runner_features: [ capabilities, allowed_warnings_regex ]
847+
capabilities:
848+
- method: POST
849+
path: /_query
850+
parameters: [ ]
851+
capabilities: [ fix_no_columns ]
852+
reason: "plans witn no columns only recently supported"
853+
- do:
854+
allowed_warnings_regex:
855+
- "No limit defined, adding default limit of \\[.*\\]"
856+
esql.query:
857+
body:
858+
query: 'from test | keep color | drop color | fork (stats c=count()) (stats c=count()) | drop _fork*, c'
859+
860+
- length: { columns: 0 }
861+
- length: { values: 2 }
862+
863+
864+
---
865+
"Drop all columns with fork drop all count":
866+
- requires:
867+
test_runner_features: [ capabilities, allowed_warnings_regex ]
868+
capabilities:
869+
- method: POST
870+
path: /_query
871+
parameters: [ ]
872+
capabilities: [ fix_no_columns ]
873+
reason: "plans witn no columns only recently supported"
874+
- do:
875+
allowed_warnings_regex:
876+
- "No limit defined, adding default limit of \\[.*\\]"
877+
esql.query:
878+
body:
879+
query: 'from test | keep color | drop color | fork (stats c=count()) (stats c=count()) | drop _fork*, c | stats count(*)'
715880

881+
- length: { columns: 1 }
882+
- length: { values: 1 }
883+
- match: {values.0.0: 2}

0 commit comments

Comments
 (0)