From 78db3b9aacc11a916f154904c87e0b9fb86fd85d Mon Sep 17 00:00:00 2001 From: Richard Tia Date: Wed, 31 May 2023 11:25:44 -0700 Subject: [PATCH] test: add string support to velox and use i64 for substring param --- bft/testers/velox/runner.py | 2 +- cases/string/substring.yaml | 44 +++++++++++++++++++++++++++++++++++++ dialects/postgres.yaml | 6 +++++ dialects/velox_presto.yaml | 6 +++++ 4 files changed, 57 insertions(+), 1 deletion(-) diff --git a/bft/testers/velox/runner.py b/bft/testers/velox/runner.py index 3483f3bb..fc7438fa 100644 --- a/bft/testers/velox/runner.py +++ b/bft/testers/velox/runner.py @@ -5,7 +5,7 @@ def is_type_supported(type): - return type in set({"i64", "fp64", "boolean"}) + return type in set({"i64", "fp64", "boolean", "string"}) class VeloxRunner(SqlCaseRunner): diff --git a/cases/string/substring.yaml b/cases/string/substring.yaml index a4b2253b..51b56d6a 100644 --- a/cases/string/substring.yaml +++ b/cases/string/substring.yaml @@ -13,6 +13,17 @@ cases: result: value: 'abcde' type: string + - group: basic + args: + - value: 'abcdefg' + type: string + - value: 1 + type: i64 + - value: 5 + type: i64 + result: + value: 'abcde' + type: string - group: id: negative_start description: Example where start argument is a negative integer @@ -26,6 +37,17 @@ cases: result: value: 'ef' type: string + - group: negative_start + args: + - value: 'abcdefg' + type: string + - value: -3 + type: i64 + - value: 2 + type: i64 + result: + value: 'ef' + type: string - group: id: start_greater_than_length description: Example where start argument greater than the length of the string @@ -39,6 +61,17 @@ cases: result: value: '' type: string + - group: start_greater_than_length + args: + - value: 'abcdefg' + type: string + - value: 10 + type: i64 + - value: 2 + type: i64 + result: + value: '' + type: string - group: id: multi_byte_characters description: Example where multi byte characters exist in the string @@ -52,3 +85,14 @@ cases: result: value: '😊a😊' type: string + - group: multi_byte_characters + args: + - value: '😊a😊b😊😊' + type: string + - value: 1 + type: i64 + - value: 3 + type: i64 + result: + value: '😊a😊' + type: string diff --git a/dialects/postgres.yaml b/dialects/postgres.yaml index 11d0b888..33115c3c 100644 --- a/dialects/postgres.yaml +++ b/dialects/postgres.yaml @@ -221,6 +221,12 @@ scalar_functions: - name: extract extract: True - name: substring + unsupported_kernels: + - args: + - string + - i64 + - i64 + result: string - name: concat local_name: "||" infix: True diff --git a/dialects/velox_presto.yaml b/dialects/velox_presto.yaml index 0b9214c7..32199bc9 100644 --- a/dialects/velox_presto.yaml +++ b/dialects/velox_presto.yaml @@ -289,6 +289,12 @@ scalar_functions: unsupported: True - name: substring local_name: substr + unsupported_kernels: + - args: + - string + - i32 + - i32 + result: string - name: concat - name: like aggregate_functions: