Skip to content

Commit

Permalink
Added tests for V3 text reader issues fixes (#589)
Browse files Browse the repository at this point in the history
Tests:
DRILL_4814_table_function.sql
DRILL_5487_truncated_last_row.sql
DRILL_6952_enable_v3_text_reader_default_value.sql
DRILL_6952_implicit_columns.sql
DRILL_7034_window function.sql

Also:
- Changed tests extension to .sql.
- Aligned the code inside textReadGroup.json.
  • Loading branch information
agozhiy authored and agirish committed Jun 24, 2019
1 parent bc1888b commit 13f42bf
Show file tree
Hide file tree
Showing 40 changed files with 88 additions and 29 deletions.
6 changes: 6 additions & 0 deletions conf/plugin-templates/common/dfs-storage-plugin.template
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,12 @@
"extensions" : [ "csv" ],
"delimiter" : ","
},
"csvh": {
"type": "text",
"extensions": [ "csvh" ],
"extractHeader": true,
"delimiter": ","
},
"tsv" : {
"type" : "text",
"extensions" : [ "tsv" ],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
id,region,comment
0,AFRICA,lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to

2,ASIA,ges. thinly even pinto beans ca
3,EUROPE,
4,MIDDLE EAST
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
0|AFRICA|lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to
1|AMERICA|hs use ironic, even requests. s
2|ASIA|ges. thinly even pinto beans ca
3|EUROPE|ly final courts cajole furiously final excuse
4|MIDDLE EAST|uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
0|AFRICA|lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to
1|AMERICA|hs use ironic, even requests. s
2|ASIA|ges. thinly even pinto beans ca
3|EUROPE|ly final courts cajole furiously final excuse
4|MIDDLE EAST|uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
0 AFRICA lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to

2 ASIA ges. thinly even pinto beans ca
3 EUROPE
4 MIDDLE EAST
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set `exec.storage.enable_v3_text_reader` = false;
select * from table(`/drill/testdata/text_storage/v3_text_reader/region_malformed.csvh`(type=>'text',lineDelimiter=>'\n',fieldDelimiter=>',',extractHeader=>true));
reset `exec.storage.enable_v3_text_reader`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
0 AFRICA lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to

2 ASIA ges. thinly even pinto beans ca
3 EUROPE
4 MIDDLE EAST
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set `exec.storage.enable_v3_text_reader` = true;
select * from `/drill/testdata/text_storage/v3_text_reader/region_malformed.csvh`;
reset `exec.storage.enable_v3_text_reader`;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exec.storage.enable_v3_text_reader false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set `exec.storage.enable_v3_text_reader`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
["0","AFRICA","lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to "] null null VARCHAR VARCHAR
["1","AMERICA","hs use ironic, even requests. s"] null null VARCHAR VARCHAR
["2","ASIA","ges. thinly even pinto beans ca"] null null VARCHAR VARCHAR
["3","EUROPE","ly final courts cajole furiously final excuse"] null null VARCHAR VARCHAR
["4","MIDDLE EAST","uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl"] null null VARCHAR VARCHAR
["0","AFRICA","lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to "] nested null VARCHAR VARCHAR
["1","AMERICA","hs use ironic, even requests. s"] nested null VARCHAR VARCHAR
["2","ASIA","ges. thinly even pinto beans ca"] nested null VARCHAR VARCHAR
["3","EUROPE","ly final courts cajole furiously final excuse"] nested null VARCHAR VARCHAR
["4","MIDDLE EAST","uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl"] nested null VARCHAR VARCHAR
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set `exec.storage.min_width` = 2;
select *, drillTypeOf(dir0), drillTypeOf(dir1) from dfs.`/drill/testdata/text_storage/v3_text_reader/region_partitioned`;
reset `exec.storage.min_width`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

0
2
3
4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select max(id) over(order by id) from `/drill/testdata/text_storage/v3_text_reader/region_malformed.csvh`;
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
{
"testId": "textRead",
"type": "group",
"description": "Test text read queries",
"categories": [
"functional"
],
"matrices": [
{
"query-file": ".*.q",
"schema": "dfs",
"output-format": "tsv",
"expected-file": ".*.e_tsv",
"verification-type": [
"in-memory"
]
}
],
"datasources": [
{
"mode": "cp",
"src": "Datasources/text_storage",
"dest": "text_storage"
},
{
"mode": "gen",
"src": "Datasources/text_storage/drill-4484.sh",
"dest": ""
}
]
"testId": "textRead",
"type": "group",
"description": "Test text read queries",
"categories": [
"functional"
],
"matrices": [
{
"query-file": ".*.sql",
"schema": "dfs",
"output-format": "tsv",
"expected-file": ".*.e_tsv",
"verification-type": [
"in-memory"
]
}
],
"datasources": [
{
"mode": "cp",
"src": "Datasources/text_storage",
"dest": "text_storage"
},
{
"mode": "gen",
"src": "Datasources/text_storage/drill-4484.sh",
"dest": ""
}
]
}

0 comments on commit 13f42bf

Please sign in to comment.