Creates a function call to TestGetFnAttrs() in test-udfs.h
| 247 | |
| 248 | // Creates a function call to TestGetFnAttrs() in test-udfs.h |
| 249 | TExprNode CreateFunctionCall(vector<TExprNode> children, int precision, int scale) { |
| 250 | TScalarType scalar_type; |
| 251 | scalar_type.type = TPrimitiveType::DECIMAL; |
| 252 | scalar_type.__set_precision(precision); |
| 253 | scalar_type.__set_scale(scale); |
| 254 | |
| 255 | TTypeNode type; |
| 256 | type.type = TTypeNodeType::SCALAR; |
| 257 | type.__set_scalar_type(scalar_type); |
| 258 | |
| 259 | TColumnType col_type; |
| 260 | col_type.__set_types(vector<TTypeNode>(1, type)); |
| 261 | |
| 262 | TFunctionName fn_name; |
| 263 | fn_name.function_name = "test_get_type_attr"; |
| 264 | |
| 265 | TScalarFunction scalar_fn; |
| 266 | scalar_fn.symbol = TEST_GET_FN_ATTR_SYMBOL; |
| 267 | |
| 268 | TFunction fn; |
| 269 | fn.name = fn_name; |
| 270 | fn.binary_type = TFunctionBinaryType::IR; |
| 271 | for (const TExprNode& child: children) { |
| 272 | fn.arg_types.push_back(child.type); |
| 273 | } |
| 274 | fn.ret_type = col_type; |
| 275 | fn.has_var_args = false; |
| 276 | fn.__set_scalar_fn(scalar_fn); |
| 277 | |
| 278 | TExprNode expr; |
| 279 | expr.node_type = TExprNodeType::FUNCTION_CALL; |
| 280 | expr.type = col_type; |
| 281 | expr.num_children = children.size(); |
| 282 | expr.__set_fn(fn); |
| 283 | return expr; |
| 284 | } |
| 285 | |
| 286 | TEST_F(ExprCodegenTest, TestGetConstFnAttrsInterpreted) { |
| 287 | // Call fn and check results'. The input is of type Decimal(10,2) (i.e. 10000.25) and |