SQL: Add examples fo muting sql/csv integ tests (#47291)

Add examples of failures for both sql and csv integeration
tests and instructions on how to mute them.

(cherry picked from commit 591bba46516d770f5fc95a4c536dd7448b74dd49)
This commit is contained in:
Marios Trivyzas 2019-10-01 09:11:34 +03:00
parent 170b102ab5
commit fa0b1b641a
No known key found for this signature in database
GPG Key ID: 8817B46B0CF36A3F
41 changed files with 168 additions and 9 deletions

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.sql-spec
// //
// Custom sorting/ordering on aggregates // Custom sorting/ordering on aggregates
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Aggs not supported by H2 / traditional SQL stores // Aggs not supported by H2 / traditional SQL stores
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.sql-spec
// //
// Group-By // Group-By
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
tableAlias tableAlias
SELECT emp_no, first_name FROM test_alias ORDER BY emp_no LIMIT 6; SELECT emp_no, first_name FROM test_alias ORDER BY emp_no LIMIT 6;

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Arithmetic tests outside H2 // Arithmetic tests outside H2
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.sql-spec
// //
// Arithmetic tests // Arithmetic tests
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.sql-spec
// Next 4 SELECTs in this file are related to https://github.com/elastic/elasticsearch/issues/32589 // Next 4 SELECTs in this file are related to https://github.com/elastic/elasticsearch/issues/32589
// H2 is Locale sensitive, while ES-SQL is not (so far) // H2 is Locale sensitive, while ES-SQL is not (so far)
selectInsertWithLcaseAndLengthWithOrderBy selectInsertWithLcaseAndLengthWithOrderBy

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Test of explicit column types // Test of explicit column types
// the columns can be specified as <ColumnName:ColumnType> or as <ColumnName> // the columns can be specified as <ColumnName:ColumnType> or as <ColumnName>
@ -13,4 +15,4 @@ gender:s | p1:l
M | 10096 M | 10096
F | 10099 F | 10099
null | 10019 null | 10019
; ;

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Commands // Commands
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
caseField caseField
SELECT emp_no, CASE WHEN emp_no - 10000 < 10 THEN 'First 10' ELSE 'Second 10' END as "case" FROM test_emp WHERE emp_no >= 10005 SELECT emp_no, CASE WHEN emp_no - 10000 < 10 THEN 'First 10' ELSE 'Second 10' END as "case" FROM test_emp WHERE emp_no >= 10005
ORDER BY emp_no LIMIT 10; ORDER BY emp_no LIMIT 10;

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Date // Date
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Unfortunately H2 doesn't support INTERVAL type, // Unfortunately H2 doesn't support INTERVAL type,
// hence why all INTERVAL tests need to be done manually // hence why all INTERVAL tests need to be done manually
@ -402,4 +404,4 @@ SELECT DOM(birth_date + INTERVAL 5 YEAR) x, COUNT(*) c FROM test_emp GROUP BY x
7 |5 7 |5
1 |5 1 |5
null |10 null |10
; ;

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// DateTime // DateTime
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.sql-spec
// //
// DateTime // DateTime
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// CSV spec used by the docs // CSV spec used by the docs
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// CSV spec used by the geo docs // CSV spec used by the geo docs
// //

View File

@ -23,4 +23,53 @@ foo,2.5,3
bar,3.5,4 bar,3.5,4
tar,4.5,5 tar,4.5,5
; ;
// repeat the above // repeat the above
// Test failure example:
// org.elasticsearch.xpack.sql.qa.single_node.JdbcCsvSpecIT > test {pivot.testAverageWithOneValueAndLimit} FAILED
// java.lang.AssertionError: Elasticsearch [JdbcResultSet:row 4:cursor size 2:[languages<type=[BYTE]>, 'F'<type=[DOUBLE]>]] still has data after [3] entries:
// 3 | 53660.0
// at __randomizedtesting.SeedInfo.seed([81AF0740AC9F7D95:9FB389A0263106D]:0)
// at org.elasticsearch.xpack.sql.qa.single_node.JdbcCsvSpecIT.pivot.testAverageWithOneValueAndLimit(pivot.csv-spec:95)
// REPRODUCE WITH: ./gradlew ':x-pack:plugin:sql:qa:single-node:integTestRunner' --tests "org.elasticsearch.xpack.sql.qa.single_node.JdbcCsvSpecIT" -Dtests.method="test {pivot.testAverageWithOneValueAndLimit}" -Dtests.seed=81AF0740AC9F7D95 -Dtests.security.manager=true -Dtests.locale=yo -Dtests.timezone=Etc/GMT-10 -Dcompiler.java=12 -Druntime.java=11
// Muting test example:
// The name of the file which contains the failing test can be found by 2 components:
// - JdbcCsvSpecIT shows that it's a .csv-spec suffixed file
// - The name of the file is the part before the . so in our case: {pivot.testAverageWithOneValueAndLimit} => pivot
// Which in our example gives: pivot.csv-spec
//
// You can also find the whole name in the stacktrace of the exception along with the line where the failed test resides:
// at org.elasticsearch.xpack.sql.qa.single_node.JdbcCsvSpecIT.pivot.testAverageWithOneValueAndLimit(pivot.csv-spec:95)
//
//
// BEFORE (file: pivot.csv-spec):
//----------------------------------------------
// averageWithOneValueAndLimit
// schema::languages:bt|'F':d
// SELECT * FROM (SELECT languages, gender, salary FROM test_emp) PIVOT (AVG(salary) FOR gender IN ('F')) LIMIT 3;
//
// languages | 'F'
// ---------------+------------------
// null |62140.666666666664
// 1 |47073.25
// 2 |50684.4
// ;
//----------------------------------------------
//
//
// AFTER (muted), Just add the suffix -Ignore to the test name and a comment pointing to the Github issue:
//----------------------------------------------
// // AwaitsFix https://github.com/elastic/elasticsearch/issues/47080
// averageWithOneValueAndLimit-Ignore
// schema::languages:bt|'F':d
// SELECT * FROM (SELECT languages, gender, salary FROM test_emp) PIVOT (AVG(salary) FOR gender IN ('F')) LIMIT 3;
//
// languages | 'F'
// ---------------+------------------
// null |62140.666666666664
// 1 |47073.25
// 2 |50684.4
// ;
// ---------------------------------------------

View File

@ -5,4 +5,36 @@ name
// SQL query to be executed against H2 and ES // SQL query to be executed against H2 and ES
SELECT COUNT(*) FROM "emp"; SELECT COUNT(*) FROM "emp";
// repeat the above // repeat the above
// Test failure example:
// org.elasticsearch.xpack.sql.qa.security.JdbcSqlSpecIT > test {agg.testGroupByOnText} FAILED
// org.h2.jdbc.JdbcSQLException: Column "gender2" not found; SQL statement:
// SELECT gender g FROM "test_emp" GROUP BY gender2 ORDER BY gender ASC [42122-197]
// at __randomizedtesting.SeedInfo.seed([880F4E292A732941:5B71F3848F44B9]:0)
// at org.elasticsearch.xpack.sql.qa.security.JdbcSqlSpecIT.agg.testGroupByOnText(agg.sql-spec:11)
// REPRODUCE WITH: ./gradlew ':x-pack:plugin:sql:qa:security:without-ssl:integTestRunner' --tests "org.elasticsearch.xpack.sql.qa.security.JdbcSqlSpecIT" -Dtests.method="test {agg.testGroupByOnText}" -Dtests.seed=BB1082EEC0023E5C -Dtests.security.manager=true -Dtests.locale=pt-TL -Dtests.timezone=MST7MDT -Dcompiler.java=12 -Druntime.java=12
// Muting test example:
// The name of the file which contains the failing test can be found by 2 components:
// - JdbcSqlSpecIT shows that it's a .sql-spec suffixed file
// - The name of the file is the part before the . so in our case: agg.testGroupByOnText => agg
// Which in our example gives: agg.sql-spec
//
// You can also find the whole name in the stacktrace of the exception along with the line where the failed test resides:
// at org.elasticsearch.xpack.sql.qa.security.JdbcSqlSpecIT.agg.testGroupByOnText(agg.sql-spec:11)
//
// BEFORE (file: agg.sql-spec):
//----------------------------------------------
// groupByOnText
// SELECT gender g FROM "test_emp" GROUP BY gender ORDER BY gender ASC;
//----------------------------------------------
//
//
// AFTER (muted), Just add the suffix -Ignore to the test name and a comment pointing to the Github issue:
//----------------------------------------------
// // AwaitsFix https://github.com/elastic/elasticsearch/issues/33519
// groupByOnText-Ignore
// SELECT gender g FROM "test_emp" GROUP BY gender ORDER BY gender ASC;
// ---------------------------------------------

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Tests testing field alias (introduced in ES 6.4) // Tests testing field alias (introduced in ES 6.4)
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Filter // Filter
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.sql-spec
// //
// Filter // Filter
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Full-text // Full-text
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
bitLengthGroupByAndOrderBy bitLengthGroupByAndOrderBy
SELECT BIT_LENGTH(first_name), COUNT(*) count FROM "test_emp" GROUP BY BIT_LENGTH(first_name) ORDER BY BIT_LENGTH(first_name) LIMIT 10; SELECT BIT_LENGTH(first_name), COUNT(*) count FROM "test_emp" GROUP BY BIT_LENGTH(first_name) ORDER BY BIT_LENGTH(first_name) LIMIT 10;

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Commands on geo test data // Commands on geo test data
// //
@ -301,4 +303,4 @@ SELECT ST_Y(ST_WKTToSQL('LINESTRING (200 100, 300 400)')) y;
y:d y:d
100.0 100.0
// end::y // end::y
; ;

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.sql-spec
// //
// Commands on geo test data // Commands on geo test data
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Tests for IP fields // Tests for IP fields
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// this one doesn't work in H2 at all // this one doesn't work in H2 at all
truncateWithAsciiHavingAndOrderBy truncateWithAsciiHavingAndOrderBy
SELECT TRUNCATE(ASCII(LEFT(first_name, 1)), 1), COUNT(*) count FROM test_emp GROUP BY ASCII(LEFT(first_name, 1)) HAVING COUNT(*) > 5 ORDER BY TRUNCATE(ASCII(LEFT(first_name, 1)), 1) DESC; SELECT TRUNCATE(ASCII(LEFT(first_name, 1)), 1), COUNT(*) count FROM test_emp GROUP BY ASCII(LEFT(first_name, 1)) HAVING COUNT(*) > 5 ORDER BY TRUNCATE(ASCII(LEFT(first_name, 1)), 1) DESC;

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.sql-spec
// //
// Math // Math
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Nested documents // Nested documents
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Null expressions // Null expressions
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.sql-spec
// //
// Null conditionals // Null conditionals
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Commands on OGC data // Commands on OGC data
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.sql-spec
// //
// Basic GEO SELECT // Basic GEO SELECT
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
averageWithOneValue averageWithOneValue
schema::languages:bt|'F':d schema::languages:bt|'F':d
SELECT * FROM (SELECT languages, gender, salary FROM test_emp) PIVOT (AVG(salary) FOR gender IN ('F')); SELECT * FROM (SELECT languages, gender, salary FROM test_emp) PIVOT (AVG(salary) FOR gender IN ('F'));
@ -188,4 +190,4 @@ null |31070.0
3 |26830.0 3 |26830.0
4 |24646.0 4 |24646.0
5 |23353.0 5 |23353.0
; ;

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// SELECT with = and != // SELECT with = and !=
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.sql-spec
// //
// Basic SELECT // Basic SELECT
// //

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Geo-specific Sys Commands // Geo-specific Sys Commands
// //
@ -13,4 +15,4 @@ integTest|null |geo |location_no_dv |114 |GEO_PO
integTest|null |geo |region |12 |KEYWORD |32766 |2147483647 |null |null |1 |null |null |12 |0 |2147483647 |5 |YES |null |null |null |null |NO |NO integTest|null |geo |region |12 |KEYWORD |32766 |2147483647 |null |null |1 |null |null |12 |0 |2147483647 |5 |YES |null |null |null |null |NO |NO
integTest|null |geo |region_point |12 |KEYWORD |32766 |2147483647 |null |null |1 |null |null |12 |0 |2147483647 |6 |YES |null |null |null |null |NO |NO integTest|null |geo |region_point |12 |KEYWORD |32766 |2147483647 |null |null |1 |null |null |12 |0 |2147483647 |6 |YES |null |null |null |null |NO |NO
integTest|null |geo |shape |114 |SHAPE |2147483647 |2147483647 |null |null |1 |null |null |114 |0 |null |7 |YES |null |null |null |null |NO |NO integTest|null |geo |shape |114 |SHAPE |2147483647 |2147483647 |null |null |1 |null |null |114 |0 |null |7 |YES |null |null |null |null |NO |NO
; ;

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Sys Commands // Sys Commands
// //
@ -118,4 +120,4 @@ integTest |null |test_emp_copy |languages |-6 |B
integTest |null |test_emp_copy |last_name |12 |TEXT |2147483647 |2147483647 |null |null |1 |null |null |12 |0 |2147483647 |14 |YES |null |null |null |null |NO |NO integTest |null |test_emp_copy |last_name |12 |TEXT |2147483647 |2147483647 |null |null |1 |null |null |12 |0 |2147483647 |14 |YES |null |null |null |null |NO |NO
integTest |null |test_emp_copy |last_name.keyword |12 |KEYWORD |32766 |2147483647 |null |null |1 |null |null |12 |0 |2147483647 |15 |YES |null |null |null |null |NO |NO integTest |null |test_emp_copy |last_name.keyword |12 |KEYWORD |32766 |2147483647 |null |null |1 |null |null |12 |0 |2147483647 |15 |YES |null |null |null |null |NO |NO
integTest |null |test_emp_copy |salary |4 |INTEGER |11 |4 |null |10 |1 |null |null |4 |0 |null |16 |YES |null |null |null |null |NO |NO integTest |null |test_emp_copy |salary |4 |INTEGER |11 |4 |null |10 |1 |null |null |4 |0 |null |16 |YES |null |null |null |null |NO |NO
; ;

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// Frozen indices tests // Frozen indices tests
// //
@ -56,4 +58,4 @@ SELECT KURTOSIS(emp_no) k, SKEWNESS(salary) s FROM FROZEN frozen_emp;
k:d | s:d k:d | s:d
1.7997599759975997 | 0.2707722118423227 1.7997599759975997 | 0.2707722118423227
; ;

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.sql-spec
stringAscii stringAscii
SELECT ASCII(first_name) s FROM "test_emp" WHERE emp_no < 10010 ORDER BY emp_no; SELECT ASCII(first_name) s FROM "test_emp" WHERE emp_no < 10010 ORDER BY emp_no;

View File

@ -1,3 +1,5 @@
// To mute tests follow example in file: example.csv-spec
// //
// TIME // TIME
// //