From a70cf72425c3a0eed432238c2a8afedab1cc025b Mon Sep 17 00:00:00 2001 From: anshuldata Date: Thu, 1 Aug 2024 06:47:07 +0530 Subject: [PATCH] feat: add arithmetic function for bitwise(AND/OR/XOR) operation with decimal arguments (#675) --- extensions/functions_arithmetic_decimal.yaml | 42 +++++++++++++++++++- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/extensions/functions_arithmetic_decimal.yaml b/extensions/functions_arithmetic_decimal.yaml index b62c63484..79c6cf8b1 100644 --- a/extensions/functions_arithmetic_decimal.yaml +++ b/extensions/functions_arithmetic_decimal.yaml @@ -102,7 +102,7 @@ scalar_functions: scale_after_borrow = max(init_scale - delta, min_scale) scale = init_prec > 38 ? scale_after_borrow : init_scale DECIMAL - - + - name: "abs" description: Calculate the absolute value of the argument. impls: @@ -110,7 +110,45 @@ scalar_functions: - name: x value: decimal return: decimal - + - name: "bitwise_and" + description: > + Return the bitwise AND result for two decimal inputs. + In inputs scale must be 0 (i.e. only integer types are allowed) + impls: + - args: + - name: x + value: "DECIMAL" + - name: y + value: "DECIMAL" + return: |- + max_precision = max(P1, P2) + DECIMAL + - name: "bitwise_or" + description: > + Return the bitwise OR result for two given decimal inputs. + In inputs scale must be 0 (i.e. only integer types are allowed) + impls: + - args: + - name: x + value: "DECIMAL" + - name: y + value: "DECIMAL" + return: |- + max_precision = max(P1, P2) + DECIMAL + - name: "bitwise_xor" + description: > + Return the bitwise XOR result for two given decimal inputs. + In inputs scale must be 0 (i.e. only integer types are allowed) + impls: + - args: + - name: x + value: "DECIMAL" + - name: y + value: "DECIMAL" + return: |- + max_precision = max(P1, P2) + DECIMAL aggregate_functions: - name: "sum" description: Sum a set of values.