You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/06/12 14:20:15 UTC

[GitHub] [arrow] cyb70289 commented on a change in pull request #7418: ARROW-9115: [C++] Implementation of ascii_lower/ascii_upper by processing input data buffers in batch

cyb70289 commented on a change in pull request #7418:
URL: https://github.com/apache/arrow/pull/7418#discussion_r439448175



##########
File path: cpp/src/arrow/compute/kernels/scalar_string.cc
##########
@@ -37,26 +39,108 @@ struct AsciiLength {
   }
 };
 
-struct AsciiUpper {
-  // XXX: the Scalar codegen path passes template arguments that are unused
-  template <typename... Ignored>
-  static std::string Call(KernelContext*, const util::string_view& val) {
-    std::string result = val.to_string();
-    std::transform(result.begin(), result.end(), result.begin(),
-                   [](unsigned char c) { return std::toupper(c); });
-    return result;
+using TransformFunc = std::function<void(const uint8_t*, int64_t, uint8_t*)>;
+
+void StringDataTransform(KernelContext* ctx, const ExecBatch& batch,
+                         TransformFunc transform, Datum* out) {
+  if (batch[0].kind() == Datum::ARRAY) {
+    const ArrayData& input = *batch[0].array();
+    ArrayData* out_arr = out->mutable_array();
+    // Reuse offsets from input
+    out_arr->buffers[1] = input.buffers[1];

Review comment:
       These buffers[1], buffers[2] are mysterious to me. Any hint to figure it out? Thanks.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org