You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "felipecrv (via GitHub)" <gi...@apache.org> on 2023/03/13 19:03:40 UTC

[GitHub] [arrow] felipecrv opened a new pull request, #34550: GH-32338: [C++] Add IPC support for Run-End Encoded Arrays

felipecrv opened a new pull request, #34550:
URL: https://github.com/apache/arrow/pull/34550

    * Closes #14340 


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] felipecrv commented on a diff in pull request #34550: GH-32338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on code in PR #34550:
URL: https://github.com/apache/arrow/pull/34550#discussion_r1136390423


##########
cpp/src/arrow/array/array_run_end.cc:
##########
@@ -85,6 +86,53 @@ void RunEndEncodedArray::SetData(const std::shared_ptr<ArrayData>& data) {
   values_array_ = MakeArray(this->data()->child_data[1]);
 }
 
+namespace {
+
+template <typename RunEndType>
+Result<std::shared_ptr<Array>> MakeLogicalRunEnds(const RunEndEncodedArray& self,
+                                                  int64_t physical_offset,
+                                                  int64_t physical_length) {
+  using RunEndCType = typename RunEndType::c_type;
+  const auto* run_ends = self.data()->child_data[0]->GetValues<RunEndCType>(1);
+  NumericBuilder<RunEndType> builder;
+  RETURN_NOT_OK(builder.Resize(physical_length));
+  if (physical_length > 0) {
+    for (int64_t i = 0; i < physical_length - 1; i++) {
+      const auto run_end = run_ends[physical_offset + i] - self.offset();
+      DCHECK_LT(run_end, self.length());
+      RETURN_NOT_OK(builder.Append(static_cast<RunEndCType>(run_end)));
+    }
+    DCHECK_GE(run_ends[physical_offset + physical_length - 1] - self.offset(),
+              self.length());
+    RETURN_NOT_OK(builder.Append(static_cast<RunEndCType>(self.length())));
+  }

Review Comment:
   Sure. I've forgot. But it's good that I've got a full CI run based on this version which will become a fallback when I add the if.



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] github-actions[bot] commented on pull request #34550: GH-2338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34550:
URL: https://github.com/apache/arrow/pull/34550#issuecomment-1466801545

   :warning: GitHub issue #2338 **has no components**, please add labels for components.


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] zeroshade merged pull request #34550: GH-32338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade merged PR #34550:
URL: https://github.com/apache/arrow/pull/34550


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] felipecrv commented on pull request #34550: GH-32338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on PR #34550:
URL: https://github.com/apache/arrow/pull/34550#issuecomment-1467196070

   @zeroshade 


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] felipecrv commented on a diff in pull request #34550: GH-32338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on code in PR #34550:
URL: https://github.com/apache/arrow/pull/34550#discussion_r1136410094


##########
cpp/src/arrow/array/array_run_end.h:
##########
@@ -87,6 +87,19 @@ class ARROW_EXPORT RunEndEncodedArray : public Array {
   /// The physical offset to the array is applied.
   const std::shared_ptr<Array>& values() const { return values_array_; }
 
+  /// \brief Returns an array holding the logical indexes of each run end
+  ///
+  /// If a non-zero logical offset is set, this function allocates a new
+  /// array and rewrites all the run end values to be relative to the logical
+  /// offset and cuts the end of the array to the logical length.

Review Comment:
   Pushed a fix.



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] github-actions[bot] commented on pull request #34550: GH-32338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34550:
URL: https://github.com/apache/arrow/pull/34550#issuecomment-1467214563

   :warning: GitHub issue #32338 **has been automatically assigned in GitHub** to PR creator.


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] felipecrv commented on pull request #34550: GH-2338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on PR #34550:
URL: https://github.com/apache/arrow/pull/34550#issuecomment-1466801859

   Commits with integration tests enabled are on the way.


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] felipecrv commented on a diff in pull request #34550: GH-32338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on code in PR #34550:
URL: https://github.com/apache/arrow/pull/34550#discussion_r1136389111


##########
cpp/src/arrow/array/array_run_end.cc:
##########
@@ -85,6 +86,53 @@ void RunEndEncodedArray::SetData(const std::shared_ptr<ArrayData>& data) {
   values_array_ = MakeArray(this->data()->child_data[1]);
 }
 
+namespace {
+
+template <typename RunEndType>
+Result<std::shared_ptr<Array>> MakeLogicalRunEnds(const RunEndEncodedArray& self,
+                                                  int64_t physical_offset,
+                                                  int64_t physical_length) {
+  using RunEndCType = typename RunEndType::c_type;
+  const auto* run_ends = self.data()->child_data[0]->GetValues<RunEndCType>(1);
+  NumericBuilder<RunEndType> builder;
+  RETURN_NOT_OK(builder.Resize(physical_length));
+  if (physical_length > 0) {
+    for (int64_t i = 0; i < physical_length - 1; i++) {
+      const auto run_end = run_ends[physical_offset + i] - self.offset();
+      DCHECK_LT(run_end, self.length());
+      RETURN_NOT_OK(builder.Append(static_cast<RunEndCType>(run_end)));
+    }
+    DCHECK_GE(run_ends[physical_offset + physical_length - 1] - self.offset(),
+              self.length());
+    RETURN_NOT_OK(builder.Append(static_cast<RunEndCType>(self.length())));
+  }
+  return builder.Finish();
+}
+
+}  // namespace
+
+Result<std::shared_ptr<Array>> RunEndEncodedArray::LogicalRunEnds() const {
+  int64_t physical_offset = FindPhysicalOffset();
+  int64_t physical_length = FindPhysicalLength();
+  DCHECK(data()->child_data[0]->buffers[1]->is_cpu());
+
+  switch (run_ends_array_->type_id()) {
+    case Type::INT16:
+      return MakeLogicalRunEnds<Int16Type>(*this, physical_offset, physical_length);
+    case Type::INT32:
+      return MakeLogicalRunEnds<Int32Type>(*this, physical_offset, physical_length);
+    default:
+      break;
+  }
+  return MakeLogicalRunEnds<Int64Type>(*this, physical_offset, physical_length);

Review Comment:
   In other projects, I've been annoyed by MSVC complaining the function doesn't return a value when all the returns were in the `switch`, but I can change it here if Arrows MSVC warnings aren't so aggressive.



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] ursabot commented on pull request #34550: GH-32338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "ursabot (via GitHub)" <gi...@apache.org>.
ursabot commented on PR #34550:
URL: https://github.com/apache/arrow/pull/34550#issuecomment-1470489984

   Benchmark runs are scheduled for baseline = 8732b2785804d3c75c2e7c551ebec5e787214b47 and contender = 8ea376909d45e7d71f1cbfecf09378a004c38609. 8ea376909d45e7d71f1cbfecf09378a004c38609 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Finished :arrow_down:0.0% :arrow_up:0.0%] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/fbd1dc9ff21a474583ef5ae9560ff203...b3f21be1af2544238858c6e3c711feba/)
   [Failed :arrow_down:0.61% :arrow_up:0.0%] [test-mac-arm](https://conbench.ursa.dev/compare/runs/9357e3b31cdc404ca5c12926ee9f4983...a3130b11e1dd46c487e1f6f8d1916d14/)
   [Finished :arrow_down:0.26% :arrow_up:0.26%] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/bfd8bd31da814d39815a0236637216be...6c10031940e643c28afd4b03ee3d8288/)
   [Finished :arrow_down:0.19% :arrow_up:0.0%] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/4dd409c847f242dd9ba5193fb3b861dd...e3eb4f7229424851ad2aecdfef82c943/)
   Buildkite builds:
   [Finished] [`8ea37690` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/2526)
   [Failed] [`8ea37690` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/2556)
   [Finished] [`8ea37690` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/2524)
   [Finished] [`8ea37690` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/2547)
   [Finished] [`8732b278` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/2524)
   [Finished] [`8732b278` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/2555)
   [Finished] [`8732b278` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/2523)
   [Finished] [`8732b278` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/2546)
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] github-actions[bot] commented on pull request #34550: GH-2338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34550:
URL: https://github.com/apache/arrow/pull/34550#issuecomment-1466801477

   * Closes: #2338


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] github-actions[bot] commented on pull request #34550: GH-32338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34550:
URL: https://github.com/apache/arrow/pull/34550#issuecomment-1467192567

   :warning: GitHub issue #32338 **has been automatically assigned in GitHub** to PR creator.


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] github-actions[bot] commented on pull request #34550: GH-2338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34550:
URL: https://github.com/apache/arrow/pull/34550#issuecomment-1466801520

   :warning: GitHub issue #2338 **has been automatically assigned in GitHub** to PR creator.


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] github-actions[bot] commented on pull request #34550: GH-32338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34550:
URL: https://github.com/apache/arrow/pull/34550#issuecomment-1467192526

   * Closes: #32338


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] felipecrv commented on a diff in pull request #34550: GH-32338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on code in PR #34550:
URL: https://github.com/apache/arrow/pull/34550#discussion_r1136410349


##########
cpp/src/arrow/array/array_run_end.cc:
##########
@@ -85,6 +86,53 @@ void RunEndEncodedArray::SetData(const std::shared_ptr<ArrayData>& data) {
   values_array_ = MakeArray(this->data()->child_data[1]);
 }
 
+namespace {
+
+template <typename RunEndType>
+Result<std::shared_ptr<Array>> MakeLogicalRunEnds(const RunEndEncodedArray& self,
+                                                  int64_t physical_offset,
+                                                  int64_t physical_length) {
+  using RunEndCType = typename RunEndType::c_type;
+  const auto* run_ends = self.data()->child_data[0]->GetValues<RunEndCType>(1);
+  NumericBuilder<RunEndType> builder;
+  RETURN_NOT_OK(builder.Resize(physical_length));
+  if (physical_length > 0) {
+    for (int64_t i = 0; i < physical_length - 1; i++) {
+      const auto run_end = run_ends[physical_offset + i] - self.offset();
+      DCHECK_LT(run_end, self.length());
+      RETURN_NOT_OK(builder.Append(static_cast<RunEndCType>(run_end)));
+    }
+    DCHECK_GE(run_ends[physical_offset + physical_length - 1] - self.offset(),
+              self.length());
+    RETURN_NOT_OK(builder.Append(static_cast<RunEndCType>(self.length())));
+  }
+  return builder.Finish();
+}
+
+}  // namespace
+
+Result<std::shared_ptr<Array>> RunEndEncodedArray::LogicalRunEnds() const {
+  int64_t physical_offset = FindPhysicalOffset();
+  int64_t physical_length = FindPhysicalLength();
+  DCHECK(data()->child_data[0]->buffers[1]->is_cpu());
+
+  switch (run_ends_array_->type_id()) {
+    case Type::INT16:
+      return MakeLogicalRunEnds<Int16Type>(*this, physical_offset, physical_length);
+    case Type::INT32:
+      return MakeLogicalRunEnds<Int32Type>(*this, physical_offset, physical_length);
+    default:
+      break;
+  }
+  return MakeLogicalRunEnds<Int64Type>(*this, physical_offset, physical_length);

Review Comment:
   Pushed a commit fixing this.



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] felipecrv commented on a diff in pull request #34550: GH-32338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "felipecrv (via GitHub)" <gi...@apache.org>.
felipecrv commented on code in PR #34550:
URL: https://github.com/apache/arrow/pull/34550#discussion_r1136410804


##########
cpp/src/arrow/array/array_run_end.cc:
##########
@@ -85,6 +86,53 @@ void RunEndEncodedArray::SetData(const std::shared_ptr<ArrayData>& data) {
   values_array_ = MakeArray(this->data()->child_data[1]);
 }
 
+namespace {
+
+template <typename RunEndType>
+Result<std::shared_ptr<Array>> MakeLogicalRunEnds(const RunEndEncodedArray& self,
+                                                  int64_t physical_offset,
+                                                  int64_t physical_length) {
+  using RunEndCType = typename RunEndType::c_type;
+  const auto* run_ends = self.data()->child_data[0]->GetValues<RunEndCType>(1);
+  NumericBuilder<RunEndType> builder;
+  RETURN_NOT_OK(builder.Resize(physical_length));
+  if (physical_length > 0) {
+    for (int64_t i = 0; i < physical_length - 1; i++) {
+      const auto run_end = run_ends[physical_offset + i] - self.offset();
+      DCHECK_LT(run_end, self.length());
+      RETURN_NOT_OK(builder.Append(static_cast<RunEndCType>(run_end)));
+    }
+    DCHECK_GE(run_ends[physical_offset + physical_length - 1] - self.offset(),
+              self.length());
+    RETURN_NOT_OK(builder.Append(static_cast<RunEndCType>(self.length())));
+  }

Review Comment:
   Check added. :heavy_check_mark: 



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] zeroshade commented on a diff in pull request #34550: GH-32338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on code in PR #34550:
URL: https://github.com/apache/arrow/pull/34550#discussion_r1135885227


##########
cpp/src/arrow/array/array_run_end.cc:
##########
@@ -85,6 +86,53 @@ void RunEndEncodedArray::SetData(const std::shared_ptr<ArrayData>& data) {
   values_array_ = MakeArray(this->data()->child_data[1]);
 }
 
+namespace {
+
+template <typename RunEndType>
+Result<std::shared_ptr<Array>> MakeLogicalRunEnds(const RunEndEncodedArray& self,
+                                                  int64_t physical_offset,
+                                                  int64_t physical_length) {
+  using RunEndCType = typename RunEndType::c_type;
+  const auto* run_ends = self.data()->child_data[0]->GetValues<RunEndCType>(1);
+  NumericBuilder<RunEndType> builder;
+  RETURN_NOT_OK(builder.Resize(physical_length));
+  if (physical_length > 0) {
+    for (int64_t i = 0; i < physical_length - 1; i++) {
+      const auto run_end = run_ends[physical_offset + i] - self.offset();
+      DCHECK_LT(run_end, self.length());
+      RETURN_NOT_OK(builder.Append(static_cast<RunEndCType>(run_end)));
+    }
+    DCHECK_GE(run_ends[physical_offset + physical_length - 1] - self.offset(),
+              self.length());
+    RETURN_NOT_OK(builder.Append(static_cast<RunEndCType>(self.length())));
+  }

Review Comment:
   if `self.offset() == 0` then you could just return a slice of the underlying run ends child. would it make sense to do that?



##########
cpp/src/arrow/array/array_run_end.cc:
##########
@@ -85,6 +86,53 @@ void RunEndEncodedArray::SetData(const std::shared_ptr<ArrayData>& data) {
   values_array_ = MakeArray(this->data()->child_data[1]);
 }
 
+namespace {
+
+template <typename RunEndType>
+Result<std::shared_ptr<Array>> MakeLogicalRunEnds(const RunEndEncodedArray& self,
+                                                  int64_t physical_offset,
+                                                  int64_t physical_length) {
+  using RunEndCType = typename RunEndType::c_type;
+  const auto* run_ends = self.data()->child_data[0]->GetValues<RunEndCType>(1);
+  NumericBuilder<RunEndType> builder;
+  RETURN_NOT_OK(builder.Resize(physical_length));
+  if (physical_length > 0) {
+    for (int64_t i = 0; i < physical_length - 1; i++) {
+      const auto run_end = run_ends[physical_offset + i] - self.offset();
+      DCHECK_LT(run_end, self.length());
+      RETURN_NOT_OK(builder.Append(static_cast<RunEndCType>(run_end)));
+    }
+    DCHECK_GE(run_ends[physical_offset + physical_length - 1] - self.offset(),
+              self.length());
+    RETURN_NOT_OK(builder.Append(static_cast<RunEndCType>(self.length())));
+  }
+  return builder.Finish();
+}
+
+}  // namespace
+
+Result<std::shared_ptr<Array>> RunEndEncodedArray::LogicalRunEnds() const {
+  int64_t physical_offset = FindPhysicalOffset();
+  int64_t physical_length = FindPhysicalLength();
+  DCHECK(data()->child_data[0]->buffers[1]->is_cpu());
+
+  switch (run_ends_array_->type_id()) {
+    case Type::INT16:
+      return MakeLogicalRunEnds<Int16Type>(*this, physical_offset, physical_length);
+    case Type::INT32:
+      return MakeLogicalRunEnds<Int32Type>(*this, physical_offset, physical_length);
+    default:
+      break;
+  }
+  return MakeLogicalRunEnds<Int64Type>(*this, physical_offset, physical_length);

Review Comment:
   any reason to not just make this the default case above instead of the `break`? I just personally find that more readable, but it's not a big deal



##########
cpp/src/arrow/array/array_run_end.h:
##########
@@ -87,6 +87,19 @@ class ARROW_EXPORT RunEndEncodedArray : public Array {
   /// The physical offset to the array is applied.
   const std::shared_ptr<Array>& values() const { return values_array_; }
 
+  /// \brief Returns an array holding the logical indexes of each run end
+  ///
+  /// If a non-zero logical offset is set, this function allocates a new
+  /// array and rewrites all the run end values to be relative to the logical
+  /// offset and cuts the end of the array to the logical length.

Review Comment:
   your current implementation still allocates a new array even if the offset is zero



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] github-actions[bot] commented on pull request #34550: GH-32338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34550:
URL: https://github.com/apache/arrow/pull/34550#issuecomment-1466784880

   <!--
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
     regarding copyright ownership.  The ASF licenses this file
     to you under the Apache License, Version 2.0 (the
     "License"); you may not use this file except in compliance
     with the License.  You may obtain a copy of the License at
   
       http://www.apache.org/licenses/LICENSE-2.0
   
     Unless required by applicable law or agreed to in writing,
     software distributed under the License is distributed on an
     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
   -->
   
   Thanks for opening a pull request!
   
   If this is not a [minor PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes). Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose
   
   Opening GitHub issues ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
   
   Then could you also rename the pull request title in the following format?
   
       GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   or
   
       MINOR: [${COMPONENT}] ${SUMMARY}
   
   In the case of PARQUET issues on JIRA the title also supports:
   
       PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   See also:
   
     * [Other pull requests](https://github.com/apache/arrow/pulls/)
     * [Contribution Guidelines - How to contribute patches](https://arrow.apache.org/docs/developers/contributing.html#how-to-contribute-patches)
   


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] github-actions[bot] commented on pull request #34550: GH-32338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34550:
URL: https://github.com/apache/arrow/pull/34550#issuecomment-1467194383

   :warning: GitHub issue #32338 **has been automatically assigned in GitHub** to PR creator.


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] github-actions[bot] commented on pull request #34550: GH-32338: [C++] Add IPC support for Run-End Encoded Arrays

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #34550:
URL: https://github.com/apache/arrow/pull/34550#issuecomment-1467214848

   :warning: GitHub issue #32338 **has been automatically assigned in GitHub** to PR creator.


-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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