You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by za...@apache.org on 2025/01/15 12:27:59 UTC
(arrow) branch vector-placement-addressing-comments created (now eaa9a3ca74)
This is an automated email from the ASF dual-hosted git repository.
zanmato pushed a change to branch vector-placement-addressing-comments
in repository https://gitbox.apache.org/repos/asf/arrow.git
at eaa9a3ca74 type -> value_type
This branch includes the following new commits:
new 953d3b18ca Move new functions into selection category in doc
new b82ad94b7d Allocate uninitialized buffer and fill the capacity bytes
new eaa9a3ca74 type -> value_type
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(arrow) 02/03: Allocate uninitialized buffer and fill the capacity bytes
Posted by za...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zanmato pushed a commit to branch vector-placement-addressing-comments
in repository https://gitbox.apache.org/repos/asf/arrow.git
commit b82ad94b7dd1612d77cc1c692cab706aa869cc96
Author: Rossi Sun <za...@gmail.com>
AuthorDate: Wed Jan 15 19:58:33 2025 +0800
Allocate uninitialized buffer and fill the capacity bytes
---
cpp/src/arrow/compute/kernels/vector_swizzle.cc | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/cpp/src/arrow/compute/kernels/vector_swizzle.cc b/cpp/src/arrow/compute/kernels/vector_swizzle.cc
index 1611a2e90b..43eeb37c94 100644
--- a/cpp/src/arrow/compute/kernels/vector_swizzle.cc
+++ b/cpp/src/arrow/compute/kernels/vector_swizzle.cc
@@ -155,10 +155,9 @@ struct InversePermutationImpl {
Status AllocateValidityBufAndFill(bool valid) {
DCHECK_EQ(validity_buf_, nullptr);
- ARROW_ASSIGN_OR_RAISE(validity_buf_,
- AllocateEmptyBitmap(output_length_, ctx_->memory_pool()));
+ ARROW_ASSIGN_OR_RAISE(validity_buf_, ctx_->Allocate(output_length_));
auto validity = validity_buf_->mutable_data_as<uint8_t>();
- std::memset(validity, valid ? 0xff : 0, validity_buf_->size());
+ std::memset(validity, valid ? 0xff : 0, validity_buf_->capacity());
return Status::OK();
}
(arrow) 01/03: Move new functions into selection category in doc
Posted by za...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zanmato pushed a commit to branch vector-placement-addressing-comments
in repository https://gitbox.apache.org/repos/asf/arrow.git
commit 953d3b18ca71302f975e5748c7c1c05a47318b2e
Author: Rossi Sun <za...@gmail.com>
AuthorDate: Wed Jan 15 19:49:15 2025 +0800
Move new functions into selection category in doc
---
docs/source/cpp/compute.rst | 67 ++++++++++++++++++++-------------------------
1 file changed, 29 insertions(+), 38 deletions(-)
diff --git a/docs/source/cpp/compute.rst b/docs/source/cpp/compute.rst
index 1015fcca07..92f3e44039 100644
--- a/docs/source/cpp/compute.rst
+++ b/docs/source/cpp/compute.rst
@@ -1731,19 +1731,23 @@ Selections
These functions select and return a subset of their input.
-+---------------+--------+--------------+--------------+--------------+-------------------------+-----------+
-| Function name | Arity | Input type 1 | Input type 2 | Output type | Options class | Notes |
-+===============+========+==============+==============+==============+=========================+===========+
-| array_filter | Binary | Any | Boolean | Input type 1 | :struct:`FilterOptions` | \(2) |
-+---------------+--------+--------------+--------------+--------------+-------------------------+-----------+
-| array_take | Binary | Any | Integer | Input type 1 | :struct:`TakeOptions` | \(3) |
-+---------------+--------+--------------+--------------+--------------+-------------------------+-----------+
-| drop_null | Unary | Any | | Input type 1 | | \(1) |
-+---------------+--------+--------------+--------------+--------------+-------------------------+-----------+
-| filter | Binary | Any | Boolean | Input type 1 | :struct:`FilterOptions` | \(2) |
-+---------------+--------+--------------+--------------+--------------+-------------------------+-----------+
-| take | Binary | Any | Integer | Input type 1 | :struct:`TakeOptions` | \(3) |
-+---------------+--------+--------------+--------------+--------------+-------------------------+-----------+
++---------------------+--------+----------------+--------------+---------------------+-------------------------------------+-------+
+| Function name | Arity | Input type 1 | Input type 2 | Output type | Options class | Notes |
++=====================+========+================+==============+=====================+=====================================+=======+
+| array_filter | Binary | Any | Boolean | Input type 1 | :struct:`FilterOptions` | \(2) |
++---------------------+--------+----------------+--------------+---------------------+-------------------------------------+-------+
+| array_take | Binary | Any | Integer | Input type 1 | :struct:`TakeOptions` | \(3) |
++---------------------+--------+----------------+--------------+---------------------+-------------------------------------+-------+
+| drop_null | Unary | Any | | Input type 1 | | \(1) |
++---------------------+--------+----------------+--------------+---------------------+-------------------------------------+-------+
+| filter | Binary | Any | Boolean | Input type 1 | :struct:`FilterOptions` | \(2) |
++---------------------+--------+----------------+--------------+---------------------+-------------------------------------+-------+
+| inverse_permutation | Unary | Signed Integer | | Signed Integer \(4) | :struct:`InversePermutationOptions` | \(5) |
++---------------------+--------+----------------+--------------+---------------------+-------------------------------------+-------+
+| scatter | Binary | Any | Integer | Input type 1 | :struct:`ScatterOptions` | \(6) |
++---------------------+--------+----------------+--------------+---------------------+-------------------------------------+-------+
+| take | Binary | Any | Integer | Input type 1 | :struct:`TakeOptions` | \(3) |
++---------------------+--------+----------------+--------------+---------------------+-------------------------------------+-------+
* \(1) Each element in the input is appended to the output iff it is non-null.
If the input is a record batch or table, any null value in a column drops
@@ -1756,6 +1760,18 @@ These functions select and return a subset of their input.
* \(3) For each element *i* in input 2 (the indices), the *i*'th element
in input 1 (the values) is appended to the output.
+* \(4) The output type is specified in :struct:`InversePermutationOptions`.
+
+* \(5) For *indices[i] = x*, *inverse_permutation[x] = i*. And *inverse_permutation[x]
+ = null* if *x* does not appear in the input indices. Indices must be in the range
+ of *[0, max_index]*, or null, which will be ignored. If multiple indices point to the
+ same value, the last one is used.
+
+* \(6) For *indices[i] = x*, *output[x] = values[i]*. And *output[x] = null*
+ if *x* does not appear in the input indices. Indices must be in the range
+ of *[0, max_index]*, or null, in which case the corresponding value will be
+ ignored. If multiple indices point to the same value, the last one is used.
+
Containment tests
~~~~~~~~~~~~~~~~~
@@ -1931,28 +1947,3 @@ operation to the n-th and (n+abs(p))-th inputs.
``Subtract``. The period can be specified in :struct:`PairwiseOptions`.
* \(2) Wraps around the result when overflow is detected.
* \(3) Returns an ``Invalid`` :class:`Status` when overflow is detected.
-
-Swizzle functions
-~~~~~~~~~~~~~~~~~~~
-
-Swizzle functions reorder the input array based on the specified indices.
-
-+---------------------+--------+----------------+--------------+---------------------+-------------------------------------+-------+
-| Function name | Arity | Input type 1 | Input type 2 | Output type | Options class | Notes |
-+=====================+========+================+==============+=====================+=====================================+=======+
-| inverse_permutation | Unary | Signed Integer | | Signed Integer \(1) | :struct:`InversePermutationOptions` | \(2) |
-+---------------------+--------+----------------+--------------+---------------------+-------------------------------------+-------+
-| scatter | Binary | Any | Integer | Input type 1 | :struct:`ScatterOptions` | \(3) |
-+---------------------+--------+----------------+--------------+---------------------+-------------------------------------+-------+
-
-* \(1) The output type is specified in :struct:`InversePermutationOptions`.
-
-* \(2) For ``indices[i] = x``, ``inverse_permutation[x] = i``. And ``inverse_permutation[x]
- = null`` if ``x`` does not appear in the input ``indices``. Indices must be in the range
- of ``[0, max_index]``, or null, which will be ignored. If multiple indices point to the
- same value, the last one is used.
-
-* \(3) For ``indices[i] = x``, ``output[x] = values[i]``. And ``output[x] = null``
- if ``x`` does not appear in the input ``indices``. Indices must be in the range
- of ``[0, max_index]``, or null, in which case the corresponding value will be
- ignored. If multiple indices point to the same value, the last one is used.
(arrow) 03/03: type -> value_type
Posted by za...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zanmato pushed a commit to branch vector-placement-addressing-comments
in repository https://gitbox.apache.org/repos/asf/arrow.git
commit eaa9a3ca748ca665982e316cf50be46e61b432f1
Author: Rossi Sun <za...@gmail.com>
AuthorDate: Wed Jan 15 20:03:11 2025 +0800
type -> value_type
---
.../arrow/compute/kernels/vector_swizzle_test.cc | 50 +++++++++++-----------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/cpp/src/arrow/compute/kernels/vector_swizzle_test.cc b/cpp/src/arrow/compute/kernels/vector_swizzle_test.cc
index be5fbdeaed..87bb42134a 100644
--- a/cpp/src/arrow/compute/kernels/vector_swizzle_test.cc
+++ b/cpp/src/arrow/compute/kernels/vector_swizzle_test.cc
@@ -467,12 +467,12 @@ void DoTestScatter(const std::shared_ptr<Array>& values,
DoTestScatterForIndicesTypes(kSignedIntegerTypes, values, indices, max_index, expected);
}
-void TestScatter(const std::shared_ptr<DataType>& type, const std::string& values_str,
- const std::string& indices_str, int64_t max_index,
- const std::string& expected_str) {
- auto values = ArrayFromJSON(type, values_str);
+void TestScatter(const std::shared_ptr<DataType>& value_type,
+ const std::string& values_str, const std::string& indices_str,
+ int64_t max_index, const std::string& expected_str) {
+ auto values = ArrayFromJSON(value_type, values_str);
auto indices = ArrayFromJSON(int8(), indices_str);
- auto expected = ArrayFromJSON(type, expected_str);
+ auto expected = ArrayFromJSON(value_type, expected_str);
DoTestScatter(values, indices, max_index, expected);
}
@@ -639,15 +639,15 @@ TEST(Scatter, Boolean) {
}
TEST(Scatter, Numeric) {
- for (const auto& type : kSignedIntegerTypes) {
- ARROW_SCOPED_TRACE(type->ToString());
+ for (const auto& value_type : kSignedIntegerTypes) {
+ ARROW_SCOPED_TRACE(value_type->ToString());
{
ARROW_SCOPED_TRACE("Basic");
auto values = "[10, 11, 12, 13, 14, 15, 16, 17, 18, 19]";
auto indices = "[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]";
int64_t max_index = 9;
auto expected = "[19, 18, 17, 16, 15, 14, 13, 12, 11, 10]";
- TestScatter(type, values, indices, max_index, expected);
+ TestScatter(value_type, values, indices, max_index, expected);
}
{
ARROW_SCOPED_TRACE("Values with nulls");
@@ -655,7 +655,7 @@ TEST(Scatter, Numeric) {
auto indices = "[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]";
int64_t max_index = 9;
auto expected = "[19, null, 17, null, 15, null, 13, null, 11, null]";
- TestScatter(type, values, indices, max_index, expected);
+ TestScatter(value_type, values, indices, max_index, expected);
}
{
ARROW_SCOPED_TRACE("Indices with nulls");
@@ -663,7 +663,7 @@ TEST(Scatter, Numeric) {
auto indices = "[9, null, 7, null, 5, null, 3, null, 1, null]";
int64_t max_index = 9;
auto expected = "[null, 18, null, 16, null, 14, null, 12, null, 10]";
- TestScatter(type, values, indices, max_index, expected);
+ TestScatter(value_type, values, indices, max_index, expected);
}
{
ARROW_SCOPED_TRACE("Output greater than input");
@@ -671,7 +671,7 @@ TEST(Scatter, Numeric) {
auto indices = "[0, 3, 6, 1, 4, 7]";
int64_t max_index = 8;
auto expected = "[0, 1, null, 0, 1, null, 0, 1, null]";
- TestScatter(type, values, indices, max_index, expected);
+ TestScatter(value_type, values, indices, max_index, expected);
}
{
ARROW_SCOPED_TRACE("Values all null");
@@ -679,7 +679,7 @@ TEST(Scatter, Numeric) {
auto indices = "[0, 1]";
int64_t max_index = 1;
auto expected = "[null, null]";
- TestScatter(type, values, indices, max_index, expected);
+ TestScatter(value_type, values, indices, max_index, expected);
}
{
ARROW_SCOPED_TRACE("Indices all null");
@@ -687,7 +687,7 @@ TEST(Scatter, Numeric) {
auto indices = "[null, null]";
int64_t max_index = 1;
auto expected = "[null, null]";
- TestScatter(type, values, indices, max_index, expected);
+ TestScatter(value_type, values, indices, max_index, expected);
}
{
ARROW_SCOPED_TRACE("Empty input output null");
@@ -695,7 +695,7 @@ TEST(Scatter, Numeric) {
auto indices = "[]";
int64_t max_index = 1;
auto expected = "[null, null]";
- TestScatter(type, values, indices, max_index, expected);
+ TestScatter(value_type, values, indices, max_index, expected);
}
{
ARROW_SCOPED_TRACE("Indices duplicated indices");
@@ -703,21 +703,21 @@ TEST(Scatter, Numeric) {
auto indices = "[0, 1, 0, 1]";
int64_t max_index = 3;
auto expected = "[null, null, null, null]";
- TestScatter(type, values, indices, max_index, expected);
+ TestScatter(value_type, values, indices, max_index, expected);
}
}
}
TEST(Scatter, Binary) {
- for (const auto& type : kBinaryTypes) {
- ARROW_SCOPED_TRACE(type->ToString());
+ for (const auto& value_type : kBinaryTypes) {
+ ARROW_SCOPED_TRACE(value_type->ToString());
{
ARROW_SCOPED_TRACE("Basic");
auto values = R"(["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"])";
auto indices = "[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]";
int64_t max_index = 9;
auto expected = R"(["j", "i", "h", "g", "f", "e", "d", "c", "b", "a"])";
- TestScatter(type, values, indices, max_index, expected);
+ TestScatter(value_type, values, indices, max_index, expected);
}
{
ARROW_SCOPED_TRACE("Values with nulls");
@@ -725,7 +725,7 @@ TEST(Scatter, Binary) {
auto indices = "[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]";
int64_t max_index = 9;
auto expected = R"(["j", null, "h", null, "f", null, "d", null, "b", null])";
- TestScatter(type, values, indices, max_index, expected);
+ TestScatter(value_type, values, indices, max_index, expected);
}
{
ARROW_SCOPED_TRACE("Indices with nulls");
@@ -733,7 +733,7 @@ TEST(Scatter, Binary) {
auto indices = "[9, null, 7, null, 5, null, 3, null, 1, null]";
int64_t max_index = 9;
auto expected = R"([null, "i", null, "g", null, "e", null, "c", null, "a"])";
- TestScatter(type, values, indices, max_index, expected);
+ TestScatter(value_type, values, indices, max_index, expected);
}
{
ARROW_SCOPED_TRACE("Output greater than input");
@@ -741,7 +741,7 @@ TEST(Scatter, Binary) {
auto indices = "[0, 3, 6, 1, 4, 7]";
int64_t max_index = 8;
auto expected = R"(["a", "b", null, "a", "b", null, "a", "b", null])";
- TestScatter(type, values, indices, max_index, expected);
+ TestScatter(value_type, values, indices, max_index, expected);
}
{
ARROW_SCOPED_TRACE("Values all null");
@@ -749,7 +749,7 @@ TEST(Scatter, Binary) {
auto indices = "[0, 1]";
int64_t max_index = 1;
auto expected = "[null, null]";
- TestScatter(type, values, indices, max_index, expected);
+ TestScatter(value_type, values, indices, max_index, expected);
}
{
ARROW_SCOPED_TRACE("Indices all null");
@@ -757,7 +757,7 @@ TEST(Scatter, Binary) {
auto indices = "[null, null]";
int64_t max_index = 1;
auto expected = "[null, null]";
- TestScatter(type, values, indices, max_index, expected);
+ TestScatter(value_type, values, indices, max_index, expected);
}
{
ARROW_SCOPED_TRACE("Empty input output null");
@@ -765,7 +765,7 @@ TEST(Scatter, Binary) {
auto indices = "[]";
int64_t max_index = 1;
auto expected = "[null, null]";
- TestScatter(type, values, indices, max_index, expected);
+ TestScatter(value_type, values, indices, max_index, expected);
}
{
ARROW_SCOPED_TRACE("Indices duplicated indices");
@@ -773,7 +773,7 @@ TEST(Scatter, Binary) {
auto indices = "[0, 1, 0, 1]";
int64_t max_index = 3;
auto expected = "[null, null, null, null]";
- TestScatter(type, values, indices, max_index, expected);
+ TestScatter(value_type, values, indices, max_index, expected);
}
}
}