diff --git a/framework/resources/Datasources/ctas/subqueries/subqueries_select.ddl b/framework/resources/Datasources/ctas/subqueries/subqueries_select.ddl new file mode 100644 index 000000000..d8ceb2dd4 --- /dev/null +++ b/framework/resources/Datasources/ctas/subqueries/subqueries_select.ddl @@ -0,0 +1,2 @@ +DROP TABLE IF EXISTS dfs.drilltestdir.`employee_json_for_subq`; +CREATE TABLE dfs.drilltestdir.`employee_json_for_subq` as SELECT * FROM cp.`employee.json`; diff --git a/framework/resources/Datasources/ctas/subqueries/subqueries_select.sh b/framework/resources/Datasources/ctas/subqueries/subqueries_select.sh new file mode 100755 index 000000000..90c5c4550 --- /dev/null +++ b/framework/resources/Datasources/ctas/subqueries/subqueries_select.sh @@ -0,0 +1,9 @@ +#!/bin/bash +source conf/drillTestConfig.properties + +if [ -z "$PASSWORD" ] +then + ${DRILL_HOME}/bin/sqlline -n ${USERNAME} -u "jdbc:drill:schema=dfs.drilltestdir;drillbit=${DRILL_STORAGE_PLUGIN_SERVER}" --run=${DRILL_TEST_DATA_DIR}/Datasources/ctas/subqueries/subqueries_select.ddl +else + ${DRILL_HOME}/bin/sqlline -n ${USERNAME} -p ${PASSWORD} -u "jdbc:drill:schema=dfs.drilltestdir;drillbit=${DRILL_STORAGE_PLUGIN_SERVER}" --run=${DRILL_TEST_DATA_DIR}/Datasources/ctas/subqueries/subqueries_select.ddl +fi diff --git a/framework/resources/Functional/subqueries/subquery_in_select/agg_func_avg_in_subquery.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/agg_func_avg_in_subquery.e_tsv new file mode 100644 index 000000000..69721f3f5 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/agg_func_avg_in_subquery.e_tsv @@ -0,0 +1,5 @@ +1 null +5 1.6666666666666667 +6 1.75 +7 2.0 +8 2.3333333333333335 diff --git a/framework/resources/Functional/subqueries/subquery_in_select/agg_func_avg_in_subquery.sql b/framework/resources/Functional/subqueries/subquery_in_select/agg_func_avg_in_subquery.sql new file mode 100644 index 000000000..8c7053c87 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/agg_func_avg_in_subquery.sql @@ -0,0 +1,16 @@ +SET `planner.enable_nljoin_for_scalar_only` = false; +SELECT + m.employee_id, + ( + SELECT + AVG(sb.position_id) as avg_position + FROM + cp.`employee.json` as sb + WHERE + sb.employee_id < m.employee_id + ) as avg_position +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; +RESET `planner.enable_nljoin_for_scalar_only`; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/agg_func_max_in_subquery.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/agg_func_max_in_subquery.e_tsv new file mode 100644 index 000000000..2ba478453 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/agg_func_max_in_subquery.e_tsv @@ -0,0 +1,5 @@ +1 Zach Lovell +5 Zach Lovell +6 Zach Lovell +7 Zach Lovell +8 Zach Lovell diff --git a/framework/resources/Functional/subqueries/subquery_in_select/agg_func_max_in_subquery.sql b/framework/resources/Functional/subqueries/subquery_in_select/agg_func_max_in_subquery.sql new file mode 100644 index 000000000..2ad432ff4 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/agg_func_max_in_subquery.sql @@ -0,0 +1,12 @@ +SELECT + m.employee_id, + ( + SELECT + MAX(sb.full_name) as max_concat + FROM + cp.`employee.json` as sb + ) as max_f_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/agg_func_min_in_subquery.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/agg_func_min_in_subquery.e_tsv new file mode 100644 index 000000000..2dbcf21af --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/agg_func_min_in_subquery.e_tsv @@ -0,0 +1,5 @@ +1 A. Joyce Jarvis +5 A. Joyce Jarvis +6 A. Joyce Jarvis +7 A. Joyce Jarvis +8 A. Joyce Jarvis diff --git a/framework/resources/Functional/subqueries/subquery_in_select/agg_func_min_in_subquery.sql b/framework/resources/Functional/subqueries/subquery_in_select/agg_func_min_in_subquery.sql new file mode 100644 index 000000000..1417e2519 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/agg_func_min_in_subquery.sql @@ -0,0 +1,12 @@ +SELECT + m.employee_id, + ( + SELECT + MIN(sb.full_name) as min_concat + FROM + cp.`employee.json` as sb + ) as min_f_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/agg_func_sum_in_subquery.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/agg_func_sum_in_subquery.e_tsv new file mode 100644 index 000000000..960782a4b --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/agg_func_sum_in_subquery.e_tsv @@ -0,0 +1,5 @@ +1 null +5 5 +6 7 +7 10 +8 14 diff --git a/framework/resources/Functional/subqueries/subquery_in_select/agg_func_sum_in_subquery.sql b/framework/resources/Functional/subqueries/subquery_in_select/agg_func_sum_in_subquery.sql new file mode 100644 index 000000000..b0275acd2 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/agg_func_sum_in_subquery.sql @@ -0,0 +1,16 @@ +SET `planner.enable_nljoin_for_scalar_only` = false; +SELECT + m.employee_id, + ( + SELECT + SUM(sb.position_id) as sum_position + FROM + cp.`employee.json` as sb + WHERE + sb.employee_id < m.employee_id + ) as sum_position +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; +RESET `planner.enable_nljoin_for_scalar_only`; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by.e_tsv new file mode 100644 index 000000000..f78f8fbe1 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by.e_tsv @@ -0,0 +1,5 @@ +1 1 +5 1 +6 1 +7 1 +8 1 diff --git a/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by.sql b/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by.sql new file mode 100644 index 000000000..c1642c5c5 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by.sql @@ -0,0 +1,15 @@ +SELECT + m.employee_id, + ( + SELECT + COUNT(sub.position_id) as count_position_id + FROM + dfs.drilltestdir.`employee_json_for_subq` as sub + GROUP BY sub.position_id + LIMIT 1 + ) as count_position_id +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' +LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_order_by.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_order_by.e_tsv new file mode 100644 index 000000000..f78f8fbe1 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_order_by.e_tsv @@ -0,0 +1,5 @@ +1 1 +5 1 +6 1 +7 1 +8 1 diff --git a/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_order_by.sql b/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_order_by.sql new file mode 100644 index 000000000..05cd2509a --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_order_by.sql @@ -0,0 +1,16 @@ +SELECT + m.employee_id, + ( + SELECT + COUNT(sub.position_id) as count_position_id + FROM + dfs.drilltestdir.`employee_json_for_subq` as sub + GROUP BY sub.position_id + ORDER BY count_position_id + LIMIT 1 + ) as count_position_id +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' +LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_order_by_desc.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_order_by_desc.e_tsv new file mode 100644 index 000000000..66918d418 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_order_by_desc.e_tsv @@ -0,0 +1,5 @@ +1 268 +5 268 +6 268 +7 268 +8 268 diff --git a/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_order_by_desc.sql b/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_order_by_desc.sql new file mode 100644 index 000000000..652dd779a --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_order_by_desc.sql @@ -0,0 +1,16 @@ +SELECT + m.employee_id, + ( + SELECT + COUNT(sub.position_id) as count_position_id + FROM + dfs.drilltestdir.`employee_json_for_subq` as sub + GROUP BY sub.position_id + ORDER BY count_position_id DESC + LIMIT 1 + ) as count_position_id +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' +LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_where.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_where.e_tsv new file mode 100644 index 000000000..c75535418 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_where.e_tsv @@ -0,0 +1,5 @@ +1 24 +5 24 +6 24 +7 24 +8 24 diff --git a/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_where.sql b/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_where.sql new file mode 100644 index 000000000..d9ebbc2f1 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/external_table_group_by_where.sql @@ -0,0 +1,16 @@ +SELECT + m.employee_id, + ( + SELECT + COUNT(sub.position_id) as count_position_id + FROM + dfs.drilltestdir.`employee_json_for_subq` as sub + WHERE sub.position_id > 7 + GROUP BY sub.position_id + LIMIT 1 + ) as count_position_id +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' +LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/external_table_having_count.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/external_table_having_count.e_tsv new file mode 100644 index 000000000..9d9040700 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/external_table_having_count.e_tsv @@ -0,0 +1,5 @@ +1 6 +5 6 +6 6 +7 6 +8 6 diff --git a/framework/resources/Functional/subqueries/subquery_in_select/external_table_having_count.sql b/framework/resources/Functional/subqueries/subquery_in_select/external_table_having_count.sql new file mode 100644 index 000000000..01109dcdb --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/external_table_having_count.sql @@ -0,0 +1,16 @@ +SELECT + m.employee_id, + ( + SELECT + COUNT(sub.position_id) as count_position_id + FROM + dfs.drilltestdir.`employee_json_for_subq` as sub + GROUP BY sub.position_id + HAVING COUNT(sub.position_id) > 5 + LIMIT 1 + ) as count_position_id +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' +LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/subquery_in_select.json b/framework/resources/Functional/subqueries/subquery_in_select/subquery_in_select.json new file mode 100755 index 000000000..b971ee117 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/subquery_in_select.json @@ -0,0 +1,28 @@ +{ + "testId": "subqueries_in_select_statement", + "type": "group", + "description": "Testing subqueries in the SELECT statement. Initiated by DRILL-7050", + "submit-type": "jdbc", + "categories": [ + "functional" + ], + "matrices": [ + { + "query-file": ".*.sql", + "schema": "dfs.drillTestDir", + "output-format": "tsv", + "expected-file": ".*.e_tsv", + "verification-type": [ + "in-memory" + ] + } + ], + "datasources": [ + { + "mode": "gen", + "src": "Datasources/ctas/subqueries/subqueries_select.sh", + "dest": "" + } + ] +} + diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_equal.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/where_equal.e_tsv new file mode 100644 index 000000000..a33e6f8f5 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_equal.e_tsv @@ -0,0 +1,5 @@ +1 Sheri Nowmer +5 Maya Gutierrez +6 Roberta Damstra +7 Rebecca Kanagaki +8 Kim Brunner diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_equal.sql b/framework/resources/Functional/subqueries/subquery_in_select/where_equal.sql new file mode 100644 index 000000000..fa9b325c0 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_equal.sql @@ -0,0 +1,15 @@ +SELECT + m.employee_id, + ( + SELECT + MAX(sub.full_name) as max_full_name + FROM + cp.`employee.json` as sub + WHERE + sub.employee_id = m.employee_id + ) as max_full_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' +LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_equal_varchar.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/where_equal_varchar.e_tsv new file mode 100644 index 000000000..f2084a9cc --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_equal_varchar.e_tsv @@ -0,0 +1,5 @@ +1 Maya Gutierrez +5 Maya Gutierrez +6 Maya Gutierrez +7 Maya Gutierrez +8 Maya Gutierrez diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_equal_varchar.sql b/framework/resources/Functional/subqueries/subquery_in_select/where_equal_varchar.sql new file mode 100644 index 000000000..18aea5203 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_equal_varchar.sql @@ -0,0 +1,15 @@ +SELECT + m.employee_id, + ( + SELECT + sub.full_name + FROM + cp.`employee.json` as sub + WHERE + sub.full_name = 'Maya Gutierrez' + LIMIT 1 + ) as full_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_in_int.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/where_in_int.e_tsv new file mode 100644 index 000000000..01475f6dc --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_in_int.e_tsv @@ -0,0 +1,5 @@ +1 Sheri Nowmer +5 Sheri Nowmer +6 Sheri Nowmer +7 Sheri Nowmer +8 Sheri Nowmer diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_in_int.sql b/framework/resources/Functional/subqueries/subquery_in_select/where_in_int.sql new file mode 100644 index 000000000..862f89aa9 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_in_int.sql @@ -0,0 +1,15 @@ +SELECT + m.employee_id, + ( + SELECT + sub.full_name + FROM + cp.`employee.json` as sub + WHERE + sub.employee_id IN (1, 7, 5, 8) + LIMIT 1 + ) as full_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_in_varchar.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/where_in_varchar.e_tsv new file mode 100644 index 000000000..46b0072ad --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_in_varchar.e_tsv @@ -0,0 +1,5 @@ +1 Roberta Damstra +5 Roberta Damstra +6 Roberta Damstra +7 Roberta Damstra +8 Roberta Damstra diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_in_varchar.sql b/framework/resources/Functional/subqueries/subquery_in_select/where_in_varchar.sql new file mode 100644 index 000000000..57df57399 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_in_varchar.sql @@ -0,0 +1,14 @@ +SELECT + m.employee_id, + ( + SELECT + sub.full_name + FROM + cp.`employee.json` as sub + WHERE + sub.full_name IN ('Roberta Damstra', 'Roberta Bozeman') LIMIT 1 + ) as full_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_less.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/where_less.e_tsv new file mode 100644 index 000000000..b6e5e4b60 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_less.e_tsv @@ -0,0 +1,5 @@ +1 Brenda Blumberg +5 Brenda Blumberg +6 Brenda Blumberg +7 Brenda Blumberg +8 Brenda Blumberg diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_less.sql b/framework/resources/Functional/subqueries/subquery_in_select/where_less.sql new file mode 100644 index 000000000..57a3bf709 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_less.sql @@ -0,0 +1,14 @@ +SELECT + m.employee_id, + ( + SELECT + MIN(sub.full_name) as min_full_name + FROM + cp.`employee.json` as sub + WHERE + sub.employee_id < 10 + ) as min_full_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_less_and_more.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/where_less_and_more.e_tsv new file mode 100644 index 000000000..8f2abf85e --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_less_and_more.e_tsv @@ -0,0 +1,5 @@ +1 Derrick Whelply +5 Roberta Damstra +6 null +7 null +8 null diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_less_and_more.sql b/framework/resources/Functional/subqueries/subquery_in_select/where_less_and_more.sql new file mode 100644 index 000000000..b82c2435f --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_less_and_more.sql @@ -0,0 +1,17 @@ +SET `planner.enable_nljoin_for_scalar_only` = false; +SELECT + m.employee_id, + ( + SELECT + MIN(sub.full_name) as min_full_name + FROM + cp.`employee.json` as sub + WHERE + sub.employee_id < 7 + AND sub.employee_id > m.employee_id + ) as min_full_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; +RESET `planner.enable_nljoin_for_scalar_only`; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_less_equal.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/where_less_equal.e_tsv new file mode 100644 index 000000000..951a84e20 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_less_equal.e_tsv @@ -0,0 +1,5 @@ +1 Derrick Whelply +5 Derrick Whelply +6 Derrick Whelply +7 Derrick Whelply +8 Derrick Whelply diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_less_equal.sql b/framework/resources/Functional/subqueries/subquery_in_select/where_less_equal.sql new file mode 100644 index 000000000..2791178cd --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_less_equal.sql @@ -0,0 +1,15 @@ +SELECT + m.employee_id, + ( + SELECT + sub.full_name + FROM + cp.`employee.json` as sub + WHERE + sub.full_name <= 'Maya Gutierrez' + LIMIT 1 + ) as full_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_less_varchar.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/where_less_varchar.e_tsv new file mode 100644 index 000000000..951a84e20 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_less_varchar.e_tsv @@ -0,0 +1,5 @@ +1 Derrick Whelply +5 Derrick Whelply +6 Derrick Whelply +7 Derrick Whelply +8 Derrick Whelply diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_less_varchar.sql b/framework/resources/Functional/subqueries/subquery_in_select/where_less_varchar.sql new file mode 100644 index 000000000..9826a4a7a --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_less_varchar.sql @@ -0,0 +1,15 @@ +SELECT + m.employee_id, + ( + SELECT + sub.full_name + FROM + cp.`employee.json` as sub + WHERE + sub.full_name < 'Maya Gutierrez' + LIMIT 1 + ) as full_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_like.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/where_like.e_tsv new file mode 100644 index 000000000..46b0072ad --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_like.e_tsv @@ -0,0 +1,5 @@ +1 Roberta Damstra +5 Roberta Damstra +6 Roberta Damstra +7 Roberta Damstra +8 Roberta Damstra diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_like.sql b/framework/resources/Functional/subqueries/subquery_in_select/where_like.sql new file mode 100644 index 000000000..c73e9bde1 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_like.sql @@ -0,0 +1,14 @@ +SELECT + m.employee_id, + ( + SELECT + sub.full_name + FROM + cp.`employee.json` as sub + WHERE + sub.full_name LIKE 'R%' LIMIT 1 + ) as full_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_like_and_in.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/where_like_and_in.e_tsv new file mode 100644 index 000000000..46b0072ad --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_like_and_in.e_tsv @@ -0,0 +1,5 @@ +1 Roberta Damstra +5 Roberta Damstra +6 Roberta Damstra +7 Roberta Damstra +8 Roberta Damstra diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_like_and_in.sql b/framework/resources/Functional/subqueries/subquery_in_select/where_like_and_in.sql new file mode 100644 index 000000000..2f2a30e7c --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_like_and_in.sql @@ -0,0 +1,15 @@ +SELECT + m.employee_id, + ( + SELECT + sub.full_name + FROM + cp.`employee.json` as sub + WHERE + sub.full_name LIKE 'Ro%' + AND sub.full_name IN ('Roberta Damstra', 'Roberta Bozeman') LIMIT 1 + ) as full_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_like_or_in.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/where_like_or_in.e_tsv new file mode 100644 index 000000000..951a84e20 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_like_or_in.e_tsv @@ -0,0 +1,5 @@ +1 Derrick Whelply +5 Derrick Whelply +6 Derrick Whelply +7 Derrick Whelply +8 Derrick Whelply diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_like_or_in.sql b/framework/resources/Functional/subqueries/subquery_in_select/where_like_or_in.sql new file mode 100644 index 000000000..b4aa42aef --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_like_or_in.sql @@ -0,0 +1,15 @@ +SELECT + m.employee_id, + ( + SELECT + sub.full_name + FROM + cp.`employee.json` as sub + WHERE + sub.full_name LIKE 'R%' + OR sub.full_name IN ('Roberta Damstra', 'Derrick Whelply') LIMIT 1 + ) as full_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_more.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/where_more.e_tsv new file mode 100644 index 000000000..2dbcf21af --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_more.e_tsv @@ -0,0 +1,5 @@ +1 A. Joyce Jarvis +5 A. Joyce Jarvis +6 A. Joyce Jarvis +7 A. Joyce Jarvis +8 A. Joyce Jarvis diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_more.sql b/framework/resources/Functional/subqueries/subquery_in_select/where_more.sql new file mode 100644 index 000000000..258ee2ea7 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_more.sql @@ -0,0 +1,14 @@ +SELECT + m.employee_id, + ( + SELECT + MIN(sub.full_name) as min_full_name + FROM + cp.`employee.json` as sub + WHERE + sub.employee_id > 10 + ) as min_full_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_more_equal.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/where_more_equal.e_tsv new file mode 100644 index 000000000..01475f6dc --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_more_equal.e_tsv @@ -0,0 +1,5 @@ +1 Sheri Nowmer +5 Sheri Nowmer +6 Sheri Nowmer +7 Sheri Nowmer +8 Sheri Nowmer diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_more_equal.sql b/framework/resources/Functional/subqueries/subquery_in_select/where_more_equal.sql new file mode 100644 index 000000000..fb678ba9e --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_more_equal.sql @@ -0,0 +1,15 @@ +SELECT + m.employee_id, + ( + SELECT + sub.full_name + FROM + cp.`employee.json` as sub + WHERE + sub.full_name >= 'Maya Gutierrez' + LIMIT 1 + ) as full_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_more_varchar.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/where_more_varchar.e_tsv new file mode 100644 index 000000000..01475f6dc --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_more_varchar.e_tsv @@ -0,0 +1,5 @@ +1 Sheri Nowmer +5 Sheri Nowmer +6 Sheri Nowmer +7 Sheri Nowmer +8 Sheri Nowmer diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_more_varchar.sql b/framework/resources/Functional/subqueries/subquery_in_select/where_more_varchar.sql new file mode 100644 index 000000000..f767b16a7 --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_more_varchar.sql @@ -0,0 +1,15 @@ +SELECT + m.employee_id, + ( + SELECT + sub.full_name + FROM + cp.`employee.json` as sub + WHERE + sub.full_name > 'Maya Gutierrez' + LIMIT 1 + ) as full_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_not_in.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/where_not_in.e_tsv new file mode 100644 index 000000000..01475f6dc --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_not_in.e_tsv @@ -0,0 +1,5 @@ +1 Sheri Nowmer +5 Sheri Nowmer +6 Sheri Nowmer +7 Sheri Nowmer +8 Sheri Nowmer diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_not_in.sql b/framework/resources/Functional/subqueries/subquery_in_select/where_not_in.sql new file mode 100644 index 000000000..68f91db2a --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_not_in.sql @@ -0,0 +1,15 @@ +SELECT + m.employee_id, + ( + SELECT + sub.full_name + FROM + cp.`employee.json` as sub + WHERE + sub.full_name NOT IN ('Roberta Damstra', 'Derrick Whelply') + LIMIT 1 + ) as full_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5; diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_not_like.e_tsv b/framework/resources/Functional/subqueries/subquery_in_select/where_not_like.e_tsv new file mode 100644 index 000000000..01475f6dc --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_not_like.e_tsv @@ -0,0 +1,5 @@ +1 Sheri Nowmer +5 Sheri Nowmer +6 Sheri Nowmer +7 Sheri Nowmer +8 Sheri Nowmer diff --git a/framework/resources/Functional/subqueries/subquery_in_select/where_not_like.sql b/framework/resources/Functional/subqueries/subquery_in_select/where_not_like.sql new file mode 100644 index 000000000..a7a91267d --- /dev/null +++ b/framework/resources/Functional/subqueries/subquery_in_select/where_not_like.sql @@ -0,0 +1,15 @@ +SELECT + m.employee_id, + ( + SELECT + sub.full_name + FROM + cp.`employee.json` as sub + WHERE + sub.full_name NOT LIKE 'R%' + LIMIT 1 + ) as full_name +FROM + cp.`employee.json` as m +WHERE + m.gender LIKE 'F' LIMIT 5;