From 82dc279c99b6a5765b89eab5ea4d213d420ed21c Mon Sep 17 00:00:00 2001 From: Masha Basmanova Date: Sun, 17 Mar 2024 23:13:57 -0700 Subject: [PATCH] Add support for DECIMAL types to Simple Function API (#9096) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: **type/Type.h** Add P1, P2, P3, P4, S1, S2, S3, S4 types to specify precision and scale parameters for decimal types during function registration. Add LongDecimal and ShortDecimal templates to specify decimal argument and return types during function registration. ``` registerFunction< DecimalAddFunction, LongDecimal, LongDecimal, LongDecimal>({"plus"}, constraints); ``` **expression/UdfTypeResolver.h** Define arg_type and out_type for LongDecimal and ShortDecimal. ``` arg_type = int128_t out_type = int128_t arg_type = int64_t out_type = int64_t ``` **functions/Registerer.h** Add optional ‘constraints’ parameter to registerFunction template. This allows to specify rules for calculating precision and scale for decimal return types. ``` template