From 8db9dcab7fcb9b1d0b790368ba78d2783d36fa66 Mon Sep 17 00:00:00 2001 From: Zhengda Lu Date: Thu, 16 Nov 2023 13:53:54 -0500 Subject: [PATCH] add oracle hint test cases --- testdata/oracle/select/full-hint.json | 24 +++++++++++++++++++ testdata/oracle/select/index-hint.json | 24 +++++++++++++++++++ testdata/oracle/select/multiple-hints.json | 24 +++++++++++++++++++ .../oracle/select/optimizer-mode-hint.json | 24 +++++++++++++++++++ testdata/oracle/select/use-nl-hint.json | 24 +++++++++++++++++++ 5 files changed, 120 insertions(+) create mode 100644 testdata/oracle/select/full-hint.json create mode 100644 testdata/oracle/select/index-hint.json create mode 100644 testdata/oracle/select/multiple-hints.json create mode 100644 testdata/oracle/select/optimizer-mode-hint.json create mode 100644 testdata/oracle/select/use-nl-hint.json diff --git a/testdata/oracle/select/full-hint.json b/testdata/oracle/select/full-hint.json new file mode 100644 index 0000000..89a6981 --- /dev/null +++ b/testdata/oracle/select/full-hint.json @@ -0,0 +1,24 @@ +{ + "input": "SELECT /*+ FULL(e) */ employee_id, first_name, last_name FROM employees e WHERE department_id = 10;", + "outputs": [ + { + "expected": "SELECT employee_id, first_name, last_name FROM employees e WHERE department_id = ?;", + "statement_metadata": { + "size": 29, + "tables": ["employees"], + "commands": ["SELECT"], + "comments": ["/*+ FULL(e) */"], + "procedures": [] + }, + "normalizer_config": { + "collect_tables": true, + "collect_commands": true, + "collect_comments": true, + "collect_procedure": true, + "keep_trailing_semicolon": true, + "remove_space_between_parentheses": true + } + } + ] + } + \ No newline at end of file diff --git a/testdata/oracle/select/index-hint.json b/testdata/oracle/select/index-hint.json new file mode 100644 index 0000000..cd6e00a --- /dev/null +++ b/testdata/oracle/select/index-hint.json @@ -0,0 +1,24 @@ +{ + "input": "SELECT /*+ INDEX(e employee_index) */ employee_id, first_name, last_name FROM employees e WHERE department_id = 10;", + "outputs": [ + { + "expected": "SELECT employee_id, first_name, last_name FROM employees e WHERE department_id = ?;", + "statement_metadata": { + "size": 45, + "tables": ["employees"], + "commands": ["SELECT"], + "comments": ["/*+ INDEX(e employee_index) */"], + "procedures": [] + }, + "normalizer_config": { + "collect_tables": true, + "collect_commands": true, + "collect_comments": true, + "collect_procedure": true, + "keep_trailing_semicolon": true, + "remove_space_between_parentheses": true + } + } + ] + } + \ No newline at end of file diff --git a/testdata/oracle/select/multiple-hints.json b/testdata/oracle/select/multiple-hints.json new file mode 100644 index 0000000..deddd94 --- /dev/null +++ b/testdata/oracle/select/multiple-hints.json @@ -0,0 +1,24 @@ +{ + "input": "SELECT /*+ LEADING(e) USE_HASH(d) */ e.employee_id, e.first_name, d.department_name FROM employees e, departments d WHERE e.department_id = d.department_id;", + "outputs": [ + { + "expected": "SELECT e.employee_id, e.first_name, d.department_name FROM employees e, departments d WHERE e.department_id = d.department_id;", + "statement_metadata": { + "size": 44, + "tables": ["employees"], + "commands": ["SELECT"], + "comments": ["/*+ LEADING(e) USE_HASH(d) */"], + "procedures": [] + }, + "normalizer_config": { + "collect_tables": true, + "collect_commands": true, + "collect_comments": true, + "collect_procedure": true, + "keep_trailing_semicolon": true, + "remove_space_between_parentheses": true + } + } + ] + } + \ No newline at end of file diff --git a/testdata/oracle/select/optimizer-mode-hint.json b/testdata/oracle/select/optimizer-mode-hint.json new file mode 100644 index 0000000..6a19aca --- /dev/null +++ b/testdata/oracle/select/optimizer-mode-hint.json @@ -0,0 +1,24 @@ +{ + "input": "SELECT /*+ ALL_ROWS */ order_id, description FROM orders WHERE price > 100;", + "outputs": [ + { + "expected": "SELECT order_id, description FROM orders WHERE price > ?;", + "statement_metadata": { + "size": 27, + "tables": ["orders"], + "commands": ["SELECT"], + "comments": ["/*+ ALL_ROWS */"], + "procedures": [] + }, + "normalizer_config": { + "collect_tables": true, + "collect_commands": true, + "collect_comments": true, + "collect_procedure": true, + "keep_trailing_semicolon": true, + "remove_space_between_parentheses": true + } + } + ] + } + \ No newline at end of file diff --git a/testdata/oracle/select/use-nl-hint.json b/testdata/oracle/select/use-nl-hint.json new file mode 100644 index 0000000..a84e0ad --- /dev/null +++ b/testdata/oracle/select/use-nl-hint.json @@ -0,0 +1,24 @@ +{ + "input": "SELECT /*+ USE_NL(e d) */ e.employee_id, e.first_name, d.department_name FROM employees e, departments d WHERE e.department_id = d.department_id;", + "outputs": [ + { + "expected": "SELECT e.employee_id, e.first_name, d.department_name FROM employees e, departments d WHERE e.department_id = d.department_id;", + "statement_metadata": { + "size": 33, + "tables": ["employees"], + "commands": ["SELECT"], + "comments": ["/*+ USE_NL(e d) */"], + "procedures": [] + }, + "normalizer_config": { + "collect_tables": true, + "collect_commands": true, + "collect_comments": true, + "collect_procedure": true, + "keep_trailing_semicolon": true, + "remove_space_between_parentheses": true + } + } + ] + } + \ No newline at end of file