| 55 | } // namespace |
| 56 | |
| 57 | void registerSubscriptFunction( |
| 58 | const std::string& name, |
| 59 | bool enableCaching = true) { |
| 60 | exec::registerStatefulVectorFunction( |
| 61 | name, |
| 62 | SubscriptFunction::signatures(), |
| 63 | [enableCaching]( |
| 64 | const std::string&, |
| 65 | const std::vector<exec::VectorFunctionArg>& inputArgs, |
| 66 | const bolt::core::QueryConfig& config) { |
| 67 | static const auto kSubscriptStateLess = |
| 68 | std::make_shared<SubscriptFunction>(false); |
| 69 | if (inputArgs[0].type->isArray()) { |
| 70 | return kSubscriptStateLess; |
| 71 | } else { |
| 72 | return std::make_shared<SubscriptFunction>( |
| 73 | enableCaching && config.isExpressionEvaluationCacheEnabled()); |
| 74 | } |
| 75 | }); |
| 76 | } |
| 77 | |
| 78 | BOLT_DECLARE_VECTOR_FUNCTION( |
| 79 | udf_subscript, |
no test coverage detected