message: Use unary executor for reverse
diff: #include "duckdb/common/exception.hpp"
  #include "duckdb/common/vector_operations/vector_operations.hpp"
  +#include "duckdb/common/vector_operations/unary_executor.hpp"
  #include <string.h>
  @@ -9,11 +10,8 @@ using namespace std;
  namespace duckdb {
  -typedef void (*str_function)(const char *input, char *output);
  -
  -static void strreverse(const char *input, char *output) {
  - size_t n = strlen(input); // the size of the string in bytes
  - size_t bytes = 0;
  +static void strreverse(const char *input, index_t n, char *output) {
  + index_t bytes = 0;
  output[n] = 0;
  @@ -36,40 +34,26 @@ static void strreverse(const char *input, char *output) {
  }
  }
  -template <str_function REVERSE_FUNCTION> static void reverse_function(Vector &input, Vector &result) {
  - assert(input.type == TypeId::VARCHAR);
  -
  - result.nullmask = input.nullmask;
  -
  - auto result_data = (const char **)result.GetData();
  - auto input_data = (const char **)input.GetData();
  +static void reverse_chunk_function(DataChunk &args, ExpressionState &state, Vector &result) {
  + assert(args.column_count() == 1);
  + assert(args.data[0].type == TypeId::VARCHAR);
  index_t current_len = 0;
  unique_ptr<char[]> output;
  - VectorOperations::Exec(input, [&](index_t i, index_t k) {
  - if (input.nullmask[i]) {
  - return;
  - }
  - // if (!has_stats) {
  - // no stats available, might need to reallocate
  - index_t required_len = strlen(input_data[i]) + 1;
  + UnaryExecutor::Execute<const char*, const char*, true>(args.data[0], result, [&](const char *input) {
  + index_t input_length = strlen(input);
  + index_t required_len = input_length + 1;
  if (required_len > current_len) {
  current_len = required_len + 1;
  output = unique_ptr<char[]>{new char[current_len]};
  }
  - //}
  - assert(strlen(input_data[i]) < current_len);
  - REVERSE_FUNCTION(input_data[i], output.get());
  + assert(input_length < current_len);
  + strreverse(input, input_length, output.get());
  - result_data[i] = result.AddString(output.get());
  + return result.AddString(output.get());
  });
  }
  -static void reverse_chunk_function(DataChunk &args, ExpressionState &state, Vector &result) {
  - assert(args.column_count() == 1);
  - reverse_function<strreverse>(args.data[0], result);
  -}
  -
  void ReverseFun::RegisterFunction(BuiltinFunctions &set) {
  set.AddFunction(ScalarFunction("reverse", {SQLType::VARCHAR}, SQLType::VARCHAR, reverse_chunk_function));
  }
  