From 5f385d91558aa3e6cfd852789ae33055122a133f Mon Sep 17 00:00:00 2001 From: Igor Motov Date: Wed, 27 Sep 2017 18:19:07 -0400 Subject: [PATCH] SQL: Disable column type autodetection in CSV tests (elastic/x-pack-elasticsearch#2634) Related to elastic/x-pack-elasticsearch#2608 Original commit: elastic/x-pack-elasticsearch@d1a45eab157cae8bf83bf0b8d11aa4efa4bcdb68 --- .../xpack/qa/sql/jdbc/CsvSpecTestCase.java | 3 +++ qa/sql/src/main/resources/agg.csv-spec | 16 ++++++++-------- qa/sql/src/main/resources/command.csv-spec | 14 +++++++------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/qa/sql/src/main/java/org/elasticsearch/xpack/qa/sql/jdbc/CsvSpecTestCase.java b/qa/sql/src/main/java/org/elasticsearch/xpack/qa/sql/jdbc/CsvSpecTestCase.java index 3747e5b2c8f..6ae5201c43d 100644 --- a/qa/sql/src/main/java/org/elasticsearch/xpack/qa/sql/jdbc/CsvSpecTestCase.java +++ b/qa/sql/src/main/java/org/elasticsearch/xpack/qa/sql/jdbc/CsvSpecTestCase.java @@ -95,6 +95,9 @@ public abstract class CsvSpecTestCase extends SpecBaseIntegrationTestCase { String header = bufferedReader.readLine(); if (!header.contains(":")) { // No type information in headers, no need to parse columns - trigger auto-detection + // TODO: Remove when type autodetection in JDBC CSV is fixed + // See https://sourceforge.net/p/csvjdbc/discussion/56965/thread/6a910831/ for more info + fail("The autodetection of types in JDBC CSV is currently broken. Please specify explicit types"); return new Tuple<>(expectedResults,""); } try (StringWriter writer = new StringWriter()) { diff --git a/qa/sql/src/main/resources/agg.csv-spec b/qa/sql/src/main/resources/agg.csv-spec index 11d471c7fd4..b84ba44bffc 100644 --- a/qa/sql/src/main/resources/agg.csv-spec +++ b/qa/sql/src/main/resources/agg.csv-spec @@ -5,7 +5,7 @@ singlePercentileWithoutComma SELECT gender, PERCENTILE(emp_no, 97) p1 FROM test_emp GROUP BY gender; -gender | p1 +gender:s | p1:d M | 10095.6112 F | 10099.1936 ; @@ -13,7 +13,7 @@ F | 10099.1936 singlePercentileWithComma SELECT gender, PERCENTILE(emp_no, 97.76) p1 FROM test_emp GROUP BY gender; -gender | p1 +gender:s | p1:d M | 10095.6112 F | 10099.1936 ; @@ -21,7 +21,7 @@ F | 10099.1936 multiplePercentilesOneWithCommaOneWithout SELECT gender, PERCENTILE(emp_no, 92.45) p1, PERCENTILE(emp_no, 91) p2 FROM test_emp GROUP BY gender; -gender | p1 | p2 +gender:s | p1:d | p2:d M | 10090.319 | 10087.68 F | 10095.128 | 10093.52 ; @@ -29,7 +29,7 @@ F | 10095.128 | 10093.52 multiplePercentilesWithoutComma SELECT gender, PERCENTILE(emp_no, 91) p1, PERCENTILE(emp_no, 89) p2 FROM test_emp GROUP BY gender; -gender | p1 | p2 +gender:s | p1:d | p2:d M | 10087.68 | 10085.18 F | 10093.52 | 10092.08 ; @@ -37,7 +37,7 @@ F | 10093.52 | 10092.08 multiplePercentilesWithComma SELECT gender, PERCENTILE(emp_no, 85.7) p1, PERCENTILE(emp_no, 94.3) p2 FROM test_emp GROUP BY gender; -gender | p1 | p2 +gender:s | p1:d | p2:d M | 10083.134 | 10091.932 F | 10088.852 | 10097.792 ; @@ -45,7 +45,7 @@ F | 10088.852 | 10097.792 percentileRank SELECT gender, PERCENTILE_RANK(emp_no, 10025) rank FROM test_emp GROUP BY gender; -gender | rank +gender:s | rank:d M | 23.41269841269841 F | 26.351351351351347 ; @@ -53,7 +53,7 @@ F | 26.351351351351347 multiplePercentileRanks SELECT gender, PERCENTILE_RANK(emp_no, 10030.0) rank1, PERCENTILE_RANK(emp_no, 10025) rank2 FROM test_emp GROUP BY gender; -gender | rank1 | rank2 +gender:s | rank1:d | rank2:d M | 29.365079365079367 | 23.41269841269841 F | 29.93762993762994 | 26.351351351351347 ; @@ -61,7 +61,7 @@ F | 29.93762993762994 | 26.351351351351347 multiplePercentilesAndPercentileRank SELECT gender, PERCENTILE(emp_no, 97.76) p1, PERCENTILE(emp_no, 93.3) p2, PERCENTILE_RANK(emp_no, 10025) rank FROM test_emp GROUP BY gender; -gender | p1 | p2 | rank +gender:s | p1:d | p2:d | rank:d M | 10095.6112 | 10090.846 | 23.41269841269841 F | 10099.1936 | 10096.351999999999 | 26.351351351351347 ; \ No newline at end of file diff --git a/qa/sql/src/main/resources/command.csv-spec b/qa/sql/src/main/resources/command.csv-spec index e87563f4fd7..1c33640faf5 100644 --- a/qa/sql/src/main/resources/command.csv-spec +++ b/qa/sql/src/main/resources/command.csv-spec @@ -6,7 +6,7 @@ showFunctions SHOW FUNCTIONS; - name | type + name:s | type:s AVG |AGGREGATE COUNT |AGGREGATE MAX |AGGREGATE @@ -64,7 +64,7 @@ TAN |SCALAR showFunctionsWithExactMatch SHOW FUNCTIONS LIKE 'ABS'; - name | type + name:s | type:s ABS |SCALAR ; @@ -72,7 +72,7 @@ ABS |SCALAR showFunctionsWithPatternWildcard SHOW FUNCTIONS LIKE 'A%'; - name | type + name:s | type:s AVG |AGGREGATE ABS |SCALAR ACOS |SCALAR @@ -83,7 +83,7 @@ ATAN |SCALAR showFunctionsWithPatternChar SHOW FUNCTIONS LIKE 'A__'; - name | type + name:s | type:s AVG |AGGREGATE ABS |SCALAR ; @@ -91,7 +91,7 @@ ABS |SCALAR showFunctions SHOW FUNCTIONS '%DAY%'; - name | type + name:s | type:s DAY_OF_MONTH |SCALAR DAY |SCALAR DAY_OF_WEEK |SCALAR @@ -103,7 +103,7 @@ MINUTE_OF_DAY |SCALAR showTables SHOW TABLES; - table + table:s test_emp ; @@ -112,7 +112,7 @@ test_emp describe DESCRIBE "test_emp"; - column | type + column:s | type:s birth_date |TIMESTAMP emp_no |INTEGER first_name |VARCHAR