| 25 | } |
| 26 | |
| 27 | std::unique_ptr<FunctionBindData> ArrayCrossProductBindFunc(const ScalarBindFuncInput& input) { |
| 28 | auto leftType = interpretLogicalType(input.arguments[0].get()); |
| 29 | auto rightType = interpretLogicalType(input.arguments[1].get()); |
| 30 | if (leftType != rightType) { |
| 31 | throw BinderException( |
| 32 | std::format("{} requires both arrays to have the same element type and size of 3", |
| 33 | ArrayCrossProductFunction::name)); |
| 34 | } |
| 35 | scalar_func_exec_t execFunc; |
| 36 | switch (ArrayType::getChildType(leftType).getLogicalTypeID()) { |
| 37 | case LogicalTypeID::INT128: |
| 38 | execFunc = ScalarFunction::BinaryExecListStructFunction<list_entry_t, list_entry_t, |
| 39 | list_entry_t, ArrayCrossProduct<int128_t>>; |
| 40 | break; |
| 41 | case LogicalTypeID::INT64: |
| 42 | execFunc = ScalarFunction::BinaryExecListStructFunction<list_entry_t, list_entry_t, |
| 43 | list_entry_t, ArrayCrossProduct<int64_t>>; |
| 44 | break; |
| 45 | case LogicalTypeID::INT32: |
| 46 | execFunc = ScalarFunction::BinaryExecListStructFunction<list_entry_t, list_entry_t, |
| 47 | list_entry_t, ArrayCrossProduct<int32_t>>; |
| 48 | break; |
| 49 | case LogicalTypeID::INT16: |
| 50 | execFunc = ScalarFunction::BinaryExecListStructFunction<list_entry_t, list_entry_t, |
| 51 | list_entry_t, ArrayCrossProduct<int16_t>>; |
| 52 | break; |
| 53 | case LogicalTypeID::INT8: |
| 54 | execFunc = ScalarFunction::BinaryExecListStructFunction<list_entry_t, list_entry_t, |
| 55 | list_entry_t, ArrayCrossProduct<int8_t>>; |
| 56 | break; |
| 57 | case LogicalTypeID::FLOAT: |
| 58 | execFunc = ScalarFunction::BinaryExecListStructFunction<list_entry_t, list_entry_t, |
| 59 | list_entry_t, ArrayCrossProduct<float>>; |
| 60 | break; |
| 61 | case LogicalTypeID::DOUBLE: |
| 62 | execFunc = ScalarFunction::BinaryExecListStructFunction<list_entry_t, list_entry_t, |
| 63 | list_entry_t, ArrayCrossProduct<double>>; |
| 64 | break; |
| 65 | default: |
| 66 | throw BinderException{ |
| 67 | std::format("{} can only be applied on array of floating points or signed integers", |
| 68 | ArrayCrossProductFunction::name)}; |
| 69 | } |
| 70 | input.definition->ptrCast<ScalarFunction>()->execFunc = execFunc; |
| 71 | const auto resultType = LogicalType::ARRAY(ArrayType::getChildType(leftType).copy(), |
| 72 | ArrayType::getNumElements(leftType)); |
| 73 | return FunctionBindData::getSimpleBindData(input.arguments, resultType); |
| 74 | } |
| 75 | |
| 76 | function_set ArrayCrossProductFunction::getFunctionSet() { |
| 77 | function_set result; |
nothing calls this directly
no test coverage detected