Skip to content

Commit

Permalink
SQL: Lowercase es data type (mapping) returned from SQL Commands (#37531
Browse files Browse the repository at this point in the history
)

To follow the ES convention, convert the es data type, returned as
column `mapping` from SQL Commands, to lowercase.

Fixes: #37521
  • Loading branch information
matriv committed Jan 16, 2019
1 parent ac284e8 commit 9c43365
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 174 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,9 @@ public void testShowTablesWithLimitedAccessUnaccessableIndex() throws Exception

public void testDescribeWorksAsAdmin() throws Exception {
Map<String, List<String>> expected = new TreeMap<>();
expected.put("a", asList("BIGINT", "LONG"));
expected.put("b", asList("BIGINT", "LONG"));
expected.put("c", asList("BIGINT", "LONG"));
expected.put("a", asList("BIGINT", "long"));
expected.put("b", asList("BIGINT", "long"));
expected.put("c", asList("BIGINT", "long"));
actions.expectDescribe(expected, null);
createAuditLogAsserter()
.expectSqlCompositeActionFieldCaps("test_admin", "test")
Expand Down Expand Up @@ -434,7 +434,7 @@ public void testDescribeWithWrongAccess() throws Exception {
public void testDescribeSingleFieldGranted() throws Exception {
createUser("only_a", "read_test_a");

actions.expectDescribe(singletonMap("a", asList("BIGINT", "LONG")), "only_a");
actions.expectDescribe(singletonMap("a", asList("BIGINT", "long")), "only_a");
createAuditLogAsserter()
.expectSqlCompositeActionFieldCaps("only_a", "test")
.assertLogs();
Expand All @@ -444,8 +444,8 @@ public void testDescribeSingleFieldExcepted() throws Exception {
createUser("not_c", "read_test_a_and_b");

Map<String, List<String>> expected = new TreeMap<>();
expected.put("a", asList("BIGINT", "LONG"));
expected.put("b", asList("BIGINT", "LONG"));
expected.put("a", asList("BIGINT", "long"));
expected.put("b", asList("BIGINT", "long"));
actions.expectDescribe(expected, "not_c");
createAuditLogAsserter()
.expectSqlCompositeActionFieldCaps("not_c", "test")
Expand Down
86 changes: 43 additions & 43 deletions x-pack/plugin/sql/qa/src/main/resources/alias.csv-spec
Original file line number Diff line number Diff line change
Expand Up @@ -28,55 +28,55 @@ DESCRIBE test_alias;

column | type | mapping
--------------------+---------------+---------------
birth_date |TIMESTAMP |DATE
dep |STRUCT |NESTED
dep.dep_id |VARCHAR |KEYWORD
dep.dep_name |VARCHAR |TEXT
dep.dep_name.keyword|VARCHAR |KEYWORD
dep.from_date |TIMESTAMP |DATE
dep.to_date |TIMESTAMP |DATE
emp_no |INTEGER |INTEGER
extra |STRUCT |OBJECT
extra.info |STRUCT |OBJECT
extra.info.gender |VARCHAR |KEYWORD
extra_gender |VARCHAR |KEYWORD
extra_no |INTEGER |INTEGER
first_name |VARCHAR |TEXT
first_name.keyword |VARCHAR |KEYWORD
gender |VARCHAR |KEYWORD
hire_date |TIMESTAMP |DATE
languages |TINYINT |BYTE
last_name |VARCHAR |TEXT
last_name.keyword |VARCHAR |KEYWORD
salary |INTEGER |INTEGER
birth_date |TIMESTAMP |date
dep |STRUCT |nested
dep.dep_id |VARCHAR |keyword
dep.dep_name |VARCHAR |text
dep.dep_name.keyword|VARCHAR |keyword
dep.from_date |TIMESTAMP |date
dep.to_date |TIMESTAMP |date
emp_no |INTEGER |integer
extra |STRUCT |object
extra.info |STRUCT |object
extra.info.gender |VARCHAR |keyword
extra_gender |VARCHAR |keyword
extra_no |INTEGER |integer
first_name |VARCHAR |text
first_name.keyword |VARCHAR |keyword
gender |VARCHAR |keyword
hire_date |TIMESTAMP |date
languages |TINYINT |byte
last_name |VARCHAR |text
last_name.keyword |VARCHAR |keyword
salary |INTEGER |integer
;

describePattern
DESCRIBE "test_*";

column | type | mapping
--------------------+---------------+---------------
birth_date |TIMESTAMP |DATE
dep |STRUCT |NESTED
dep.dep_id |VARCHAR |KEYWORD
dep.dep_name |VARCHAR |TEXT
dep.dep_name.keyword|VARCHAR |KEYWORD
dep.from_date |TIMESTAMP |DATE
dep.to_date |TIMESTAMP |DATE
emp_no |INTEGER |INTEGER
extra |STRUCT |OBJECT
extra.info |STRUCT |OBJECT
extra.info.gender |VARCHAR |KEYWORD
extra_gender |VARCHAR |KEYWORD
extra_no |INTEGER |INTEGER
first_name |VARCHAR |TEXT
first_name.keyword |VARCHAR |KEYWORD
gender |VARCHAR |KEYWORD
hire_date |TIMESTAMP |DATE
languages |TINYINT |BYTE
last_name |VARCHAR |TEXT
last_name.keyword |VARCHAR |KEYWORD
salary |INTEGER |INTEGER
birth_date |TIMESTAMP |date
dep |STRUCT |nested
dep.dep_id |VARCHAR |keyword
dep.dep_name |VARCHAR |text
dep.dep_name.keyword|VARCHAR |keyword
dep.from_date |TIMESTAMP |date
dep.to_date |TIMESTAMP |date
emp_no |INTEGER |integer
extra |STRUCT |object
extra.info |STRUCT |object
extra.info.gender |VARCHAR |keyword
extra_gender |VARCHAR |keyword
extra_no |INTEGER |integer
first_name |VARCHAR |text
first_name.keyword |VARCHAR |keyword
gender |VARCHAR |keyword
hire_date |TIMESTAMP |date
languages |TINYINT |byte
last_name |VARCHAR |text
last_name.keyword |VARCHAR |keyword
salary |INTEGER |integer
;

showAlias
Expand Down Expand Up @@ -115,4 +115,4 @@ gender:s | p1:d

F | 10099.52
M | 10096.0
;
;
148 changes: 74 additions & 74 deletions x-pack/plugin/sql/qa/src/main/resources/command.csv-spec
Original file line number Diff line number Diff line change
Expand Up @@ -228,78 +228,78 @@ DESCRIBE LIKE 'test_emp';

column | type | mapping
--------------------+---------------+---------------
birth_date |TIMESTAMP |DATE
dep |STRUCT |NESTED
dep.dep_id |VARCHAR |KEYWORD
dep.dep_name |VARCHAR |TEXT
dep.dep_name.keyword|VARCHAR |KEYWORD
dep.from_date |TIMESTAMP |DATE
dep.to_date |TIMESTAMP |DATE
emp_no |INTEGER |INTEGER
extra |STRUCT |OBJECT
extra.info |STRUCT |OBJECT
extra.info.gender |VARCHAR |KEYWORD
extra_gender |VARCHAR |KEYWORD
extra_no |INTEGER |INTEGER
first_name |VARCHAR |TEXT
first_name.keyword |VARCHAR |KEYWORD
gender |VARCHAR |KEYWORD
hire_date |TIMESTAMP |DATE
languages |TINYINT |BYTE
last_name |VARCHAR |TEXT
last_name.keyword |VARCHAR |KEYWORD
salary |INTEGER |INTEGER
birth_date |TIMESTAMP |date
dep |STRUCT |nested
dep.dep_id |VARCHAR |keyword
dep.dep_name |VARCHAR |text
dep.dep_name.keyword|VARCHAR |keyword
dep.from_date |TIMESTAMP |date
dep.to_date |TIMESTAMP |date
emp_no |INTEGER |integer
extra |STRUCT |object
extra.info |STRUCT |object
extra.info.gender |VARCHAR |keyword
extra_gender |VARCHAR |keyword
extra_no |INTEGER |integer
first_name |VARCHAR |text
first_name.keyword |VARCHAR |keyword
gender |VARCHAR |keyword
hire_date |TIMESTAMP |date
languages |TINYINT |byte
last_name |VARCHAR |text
last_name.keyword |VARCHAR |keyword
salary |INTEGER |integer
;

describeMultiLike
DESCRIBE LIKE 'test_emp%';

column | type | mapping
--------------------+---------------+---------------
birth_date |TIMESTAMP |DATE
dep |STRUCT |NESTED
dep.dep_id |VARCHAR |KEYWORD
dep.dep_name |VARCHAR |TEXT
dep.dep_name.keyword|VARCHAR |KEYWORD
dep.from_date |TIMESTAMP |DATE
dep.to_date |TIMESTAMP |DATE
emp_no |INTEGER |INTEGER
extra |STRUCT |OBJECT
extra.info |STRUCT |OBJECT
extra.info.gender |VARCHAR |KEYWORD
extra_gender |VARCHAR |KEYWORD
extra_no |INTEGER |INTEGER
first_name |VARCHAR |TEXT
first_name.keyword |VARCHAR |KEYWORD
gender |VARCHAR |KEYWORD
hire_date |TIMESTAMP |DATE
languages |TINYINT |BYTE
last_name |VARCHAR |TEXT
last_name.keyword |VARCHAR |KEYWORD
salary |INTEGER |INTEGER
birth_date |TIMESTAMP |date
dep |STRUCT |nested
dep.dep_id |VARCHAR |keyword
dep.dep_name |VARCHAR |text
dep.dep_name.keyword|VARCHAR |keyword
dep.from_date |TIMESTAMP |date
dep.to_date |TIMESTAMP |date
emp_no |INTEGER |integer
extra |STRUCT |object
extra.info |STRUCT |object
extra.info.gender |VARCHAR |keyword
extra_gender |VARCHAR |keyword
extra_no |INTEGER |integer
first_name |VARCHAR |text
first_name.keyword |VARCHAR |keyword
gender |VARCHAR |keyword
hire_date |TIMESTAMP |date
languages |TINYINT |byte
last_name |VARCHAR |text
last_name.keyword |VARCHAR |keyword
salary |INTEGER |integer
;

describeSimpleIdentifier
DESCRIBE "test_emp";

column | type | mapping
--------------------+---------------+---------------
birth_date |TIMESTAMP |DATE
dep |STRUCT |NESTED
dep.dep_id |VARCHAR |KEYWORD
dep.dep_name |VARCHAR |TEXT
dep.dep_name.keyword|VARCHAR |KEYWORD
dep.from_date |TIMESTAMP |DATE
dep.to_date |TIMESTAMP |DATE
emp_no |INTEGER |INTEGER
first_name |VARCHAR |TEXT
first_name.keyword |VARCHAR |KEYWORD
gender |VARCHAR |KEYWORD
hire_date |TIMESTAMP |DATE
languages |TINYINT |BYTE
last_name |VARCHAR |TEXT
last_name.keyword |VARCHAR |KEYWORD
salary |INTEGER |INTEGER
birth_date |TIMESTAMP |date
dep |STRUCT |nested
dep.dep_id |VARCHAR |keyword
dep.dep_name |VARCHAR |text
dep.dep_name.keyword|VARCHAR |keyword
dep.from_date |TIMESTAMP |date
dep.to_date |TIMESTAMP |date
emp_no |INTEGER |integer
first_name |VARCHAR |text
first_name.keyword |VARCHAR |keyword
gender |VARCHAR |keyword
hire_date |TIMESTAMP |date
languages |TINYINT |byte
last_name |VARCHAR |text
last_name.keyword |VARCHAR |keyword
salary |INTEGER |integer
;


Expand All @@ -310,20 +310,20 @@ DESCRIBE "test_*,-test_alias*";

column | type | mapping
--------------------+---------------+---------------
birth_date |TIMESTAMP |DATE
dep |STRUCT |NESTED
dep.dep_id |VARCHAR |KEYWORD
dep.dep_name |VARCHAR |TEXT
dep.dep_name.keyword|VARCHAR |KEYWORD
dep.from_date |TIMESTAMP |DATE
dep.to_date |TIMESTAMP |DATE
emp_no |INTEGER |INTEGER
first_name |VARCHAR |TEXT
first_name.keyword |VARCHAR |KEYWORD
gender |VARCHAR |KEYWORD
hire_date |TIMESTAMP |DATE
languages |TINYINT |BYTE
last_name |VARCHAR |TEXT
last_name.keyword |VARCHAR |KEYWORD
salary |INTEGER |INTEGER
birth_date |TIMESTAMP |date
dep |STRUCT |nested
dep.dep_id |VARCHAR |keyword
dep.dep_name |VARCHAR |text
dep.dep_name.keyword|VARCHAR |keyword
dep.from_date |TIMESTAMP |date
dep.to_date |TIMESTAMP |date
emp_no |INTEGER |integer
first_name |VARCHAR |text
first_name.keyword |VARCHAR |keyword
gender |VARCHAR |keyword
hire_date |TIMESTAMP |date
languages |TINYINT |byte
last_name |VARCHAR |text
last_name.keyword |VARCHAR |keyword
salary |INTEGER |integer
;
64 changes: 32 additions & 32 deletions x-pack/plugin/sql/qa/src/main/resources/docs.csv-spec
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ DESCRIBE emp;

column | type | mapping
--------------------+---------------+---------------
birth_date |TIMESTAMP |DATE
dep |STRUCT |NESTED
dep.dep_id |VARCHAR |KEYWORD
dep.dep_name |VARCHAR |TEXT
dep.dep_name.keyword|VARCHAR |KEYWORD
dep.from_date |TIMESTAMP |DATE
dep.to_date |TIMESTAMP |DATE
emp_no |INTEGER |INTEGER
first_name |VARCHAR |TEXT
first_name.keyword |VARCHAR |KEYWORD
gender |VARCHAR |KEYWORD
hire_date |TIMESTAMP |DATE
languages |TINYINT |BYTE
last_name |VARCHAR |TEXT
last_name.keyword |VARCHAR |KEYWORD
salary |INTEGER |INTEGER
birth_date |TIMESTAMP |date
dep |STRUCT |nested
dep.dep_id |VARCHAR |keyword
dep.dep_name |VARCHAR |text
dep.dep_name.keyword|VARCHAR |keyword
dep.from_date |TIMESTAMP |date
dep.to_date |TIMESTAMP |date
emp_no |INTEGER |integer
first_name |VARCHAR |text
first_name.keyword |VARCHAR |keyword
gender |VARCHAR |keyword
hire_date |TIMESTAMP |date
languages |TINYINT |byte
last_name |VARCHAR |text
last_name.keyword |VARCHAR |keyword
salary |INTEGER |integer

// end::describeTable
;
Expand All @@ -53,22 +53,22 @@ SHOW COLUMNS IN emp;

column | type | mapping
--------------------+---------------+---------------
birth_date |TIMESTAMP |DATE
dep |STRUCT |NESTED
dep.dep_id |VARCHAR |KEYWORD
dep.dep_name |VARCHAR |TEXT
dep.dep_name.keyword|VARCHAR |KEYWORD
dep.from_date |TIMESTAMP |DATE
dep.to_date |TIMESTAMP |DATE
emp_no |INTEGER |INTEGER
first_name |VARCHAR |TEXT
first_name.keyword |VARCHAR |KEYWORD
gender |VARCHAR |KEYWORD
hire_date |TIMESTAMP |DATE
languages |TINYINT |BYTE
last_name |VARCHAR |TEXT
last_name.keyword |VARCHAR |KEYWORD
salary |INTEGER |INTEGER
birth_date |TIMESTAMP |date
dep |STRUCT |nested
dep.dep_id |VARCHAR |keyword
dep.dep_name |VARCHAR |text
dep.dep_name.keyword|VARCHAR |keyword
dep.from_date |TIMESTAMP |date
dep.to_date |TIMESTAMP |date
emp_no |INTEGER |integer
first_name |VARCHAR |text
first_name.keyword |VARCHAR |keyword
gender |VARCHAR |keyword
hire_date |TIMESTAMP |date
languages |TINYINT |byte
last_name |VARCHAR |text
last_name.keyword |VARCHAR |keyword
salary |INTEGER |integer

// end::showColumns
;
Expand Down
Loading

0 comments on commit 9c43365

Please sign in to comment.