-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fixes #53001 Adds support for querying indices without columns. Previously, such queries failed. (cherry picked from commit 6f93303)
- Loading branch information
Lukas Wegmann
committed
Jun 23, 2021
1 parent
0637218
commit ae96371
Showing
15 changed files
with
124 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
x-pack/plugin/sql/qa/server/src/main/resources/empty-mapping.csv-spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
// the following queries all return no rows in H2 | ||
|
||
selectConstAggregationWithGroupBy | ||
SELECT 1 a, COUNT(*) b, MAX(1) c FROM empty_mapping GROUP BY a; | ||
|
||
a:i | b:l | c:i | ||
---------------+---------------+--------------- | ||
1 |2 |1 | ||
; | ||
|
||
subselectWithConst | ||
SELECT 1, * FROM (SELECT * FROM empty_mapping) s; | ||
|
||
1:i | ||
--------------- | ||
1 | ||
1 | ||
; | ||
|
||
subselectWithInnerConst | ||
SELECT * FROM (SELECT 1, * FROM empty_mapping) s; | ||
|
||
1:i | ||
--------------- | ||
1 | ||
1 | ||
; |
22 changes: 22 additions & 0 deletions
22
x-pack/plugin/sql/qa/server/src/main/resources/empty-mapping.sql-spec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
selectStar | ||
SELECT * FROM empty_mapping; | ||
selectStarWithFilter | ||
SELECT * FROM empty_mapping WHERE 2 > 1; | ||
selectStarWithFilterAndLimit | ||
SELECT * FROM empty_mapping WHERE 1 > 2 LIMIT 10; | ||
|
||
selectCount | ||
SELECT COUNT(*) FROM empty_mapping; | ||
// awaits fix: https://github.com/elastic/elasticsearch/issues/74311 | ||
// selectCountWithWhere | ||
// SELECT COUNT(*) FROM empty_mapping WHERE 1 + 1 = 3; | ||
|
||
selectConst | ||
SELECT 1, 2, 3 FROM empty_mapping; | ||
selectConstAggregation | ||
SELECT MAX(1), SUM(2) FROM empty_mapping; | ||
|
||
// fails in H2 with a syntax error but cannot be tested in CSV spec because datasets without columns cannot be parsed | ||
// awaits fix: https://github.com/elastic/elasticsearch/issues/39895 (latest H2 version can run the query) | ||
// subselect | ||
// SELECT * FROM (SELECT * FROM empty_mapping) s; |
5 changes: 5 additions & 0 deletions
5
x-pack/plugin/sql/qa/server/src/main/resources/setup_empty_mapping.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
DROP TABLE IF EXISTS "empty_mapping"; | ||
CREATE TABLE "empty_mapping" (); | ||
|
||
INSERT INTO "empty_mapping" DEFAULT VALUES; | ||
INSERT INTO "empty_mapping" DEFAULT VALUES; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters