From 35afd40cb062b73b7dca6452ddd8ed1a03695196 Mon Sep 17 00:00:00 2001 From: Rok Mihevc Date: Mon, 8 Apr 2024 20:37:52 +0200 Subject: [PATCH 01/32] GH-40799: [Doc][Format] Implementation status page should list canonical extension types (#41053) ### Rationale for this change Two specifications and one implementation of canonical extension types were added and this should be documented. ### What changes are included in this PR? This represents current state of canonical extension types. ### Are these changes tested? No, docs only. ### Are there any user-facing changes? In so much as they read docs. * GitHub Issue: #40799 Authored-by: Rok Mihevc Signed-off-by: Rok Mihevc --- docs/source/status.rst | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/source/status.rst b/docs/source/status.rst index 71d33eaa6520..dc60b311a148 100644 --- a/docs/source/status.rst +++ b/docs/source/status.rst @@ -111,6 +111,15 @@ Data Types | Run-End Encoded | ✓ | | ✓ | | | | | | +-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ ++-----------------------+-------+-------+-------+------------+-------+-------+-------+-------+ +| Canonical | C++ | Java | Go | JavaScript | C# | Rust | Julia | Swift | +| Extension types | | | | | | | | | ++=======================+=======+=======+=======+============+=======+=======+=======+=======+ +| Fixed shape tensor | ✓ | | | | | | | | ++-----------------------+-------+-------+-------+------------+-------+-------+-------+-------+ +| Variable shape tensor | | | | | | | | | ++-----------------------+-------+-------+-------+------------+-------+-------+-------+-------+ + Notes: * \(1) Casting to/from Float16 in Java is not supported. @@ -118,7 +127,8 @@ Notes: * \(3) Nested dictionaries not supported .. seealso:: - The :ref:`format_columnar` specification. + The :ref:`format_columnar` and the + :ref:`format_canonical_extensions` specification. IPC Format From 3a4962dd8c71da6bbbfb2467b739c2aed574a624 Mon Sep 17 00:00:00 2001 From: keshen-msft <53491277+keshen-msft@users.noreply.github.com> Date: Mon, 8 Apr 2024 13:14:31 -0700 Subject: [PATCH 02/32] GH-41047: [C#] Address performance issue of reading from StringArray (#41048) ### Rationale for this change The motivation here is to address https://github.com/apache/arrow/issues/41047. There is severe performance drawback in reading a StringArray as value array of a DictionaryArray, because of repeated and unnecessary UTF 8 string decoding. ### What changes are included in this PR? - Added a new function Materialize() to materialize the values to a list. When materialized, GetString() reads from the vector directly. - Added test coverage. ### Are these changes tested? Yes ### Are there any user-facing changes? No. This change maintains backwards compatibility on the API surface. It is up to the client application to decide whether to materialize the array and gain performance. * GitHub Issue: #41047 Authored-by: Keshuang Shen Signed-off-by: Curt Hagenlocher --- csharp/src/Apache.Arrow/Arrays/StringArray.cs | 60 ++++++++++++++++++- .../Apache.Arrow.Tests/StringArrayTests.cs | 31 ++++++++++ 2 files changed, 90 insertions(+), 1 deletion(-) diff --git a/csharp/src/Apache.Arrow/Arrays/StringArray.cs b/csharp/src/Apache.Arrow/Arrays/StringArray.cs index af77fe1b1a83..a3ec596adc7b 100644 --- a/csharp/src/Apache.Arrow/Arrays/StringArray.cs +++ b/csharp/src/Apache.Arrow/Arrays/StringArray.cs @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -using Apache.Arrow.Types; using System; using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; +using Apache.Arrow.Types; namespace Apache.Arrow { @@ -26,6 +26,8 @@ public class StringArray: BinaryArray, IReadOnlyList { public static readonly Encoding DefaultEncoding = Encoding.UTF8; + private Dictionary materializedStringStore; + public new class Builder : BuilderBase { public Builder() : base(StringType.Default) { } @@ -71,16 +73,28 @@ public StringArray(int length, public override void Accept(IArrowArrayVisitor visitor) => Accept(this, visitor); + /// + /// Get the string value at the given index + /// + /// Input index + /// Optional: the string encoding, default is UTF8 + /// The string object at the given index public string GetString(int index, Encoding encoding = default) { encoding ??= DefaultEncoding; + if (materializedStringStore != null && materializedStringStore.TryGetValue(encoding, out string[] materializedStrings)) + { + return materializedStrings[index]; + } + ReadOnlySpan bytes = GetBytes(index, out bool isNull); if (isNull) { return null; } + if (bytes.Length == 0) { return string.Empty; @@ -93,6 +107,50 @@ public string GetString(int index, Encoding encoding = default) } } + /// + /// Materialize the array for the given encoding to accelerate the string access + /// + /// Optional: the string encoding, default is UTF8 + /// This method is not thread safe when it is called in parallel with or . + public void Materialize(Encoding encoding = default) + { + encoding ??= DefaultEncoding; + + if (IsMaterialized(encoding)) + { + return; + } + + if (materializedStringStore == null) + { + materializedStringStore = new Dictionary(); + } + + var stringStore = new string[Length]; + for (int i = 0; i < Length; i++) + { + stringStore[i] = GetString(i, encoding); + } + + materializedStringStore[encoding] = stringStore; + } + + /// + /// Check if the array has been materialized for the given encoding + /// + /// Optional: the string encoding, default is UTF8 + /// True of false whether the array has been materialized + public bool IsMaterialized(Encoding encoding = default) + { + if (materializedStringStore == null) + { + return false; + } + + encoding ??= DefaultEncoding; + return materializedStringStore.ContainsKey(encoding); + } + int IReadOnlyCollection.Count => Length; string IReadOnlyList.this[int index] => GetString(index); diff --git a/csharp/test/Apache.Arrow.Tests/StringArrayTests.cs b/csharp/test/Apache.Arrow.Tests/StringArrayTests.cs index 0fd3d3d105a7..b19731535a29 100644 --- a/csharp/test/Apache.Arrow.Tests/StringArrayTests.cs +++ b/csharp/test/Apache.Arrow.Tests/StringArrayTests.cs @@ -49,6 +49,37 @@ public void ReturnsAppendedValue(string firstValue, string secondValue) // Assert Assert.Equal(firstValue, retrievedValue); } + + [Theory] + [InlineData(null, null)] + [InlineData(null, "")] + [InlineData(null, "value")] + [InlineData("", null)] + [InlineData("", "")] + [InlineData("", "value")] + [InlineData("value", null)] + [InlineData("value", "")] + [InlineData("value", "value")] + public void ReturnsAppendedValueMaterialize(string firstValue, string secondValue) + { + // Arrange + // Create an array with two elements. The second element being null, + // empty, or non-empty may influence the underlying BinaryArray + // storage such that retrieving an empty first element could result + // in an empty span or a 0-length span backed by storage. + var array = new StringArray.Builder() + .Append(firstValue) + .Append(secondValue) + .Build(); + + // Act + array.Materialize(); + var retrievedValue = array.GetString(0); + + // Assert + Assert.True(array.IsMaterialized()); + Assert.Equal(firstValue, retrievedValue); + } } } } From 1558d3f32060570a61a5ef3f8e362cafc1ae5201 Mon Sep 17 00:00:00 2001 From: LucasG0 <44552904+LucasG0@users.noreply.github.com> Date: Tue, 9 Apr 2024 17:05:03 +0200 Subject: [PATCH 03/32] GH-38768: [Python] Empty slicing an array backwards beyond the start is now empty (#40682) ### What changes are included in this PR? `_normalize_slice` now relies on `slice.indices` (https://docs.python.org/3/reference/datamodel.html#slice.indices). ### Are these changes tested? Yes. ### Are there any user-facing changes? Fixing wrong data returned in an edge case. * GitHub Issue: #40642 * GitHub Issue: #38768 Lead-authored-by: LucasG0 Co-authored-by: Joris Van den Bossche Signed-off-by: Joris Van den Bossche --- python/pyarrow/array.pxi | 29 +---------------------------- python/pyarrow/tests/test_array.py | 1 + 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/python/pyarrow/array.pxi b/python/pyarrow/array.pxi index 59d2e91ef6c7..45fd29ad3b3f 100644 --- a/python/pyarrow/array.pxi +++ b/python/pyarrow/array.pxi @@ -561,34 +561,7 @@ def _normalize_slice(object arrow_obj, slice key): Py_ssize_t start, stop, step Py_ssize_t n = len(arrow_obj) - step = key.step or 1 - - if key.start is None: - if step < 0: - start = n - 1 - else: - start = 0 - elif key.start < 0: - start = key.start + n - if start < 0: - start = 0 - elif key.start >= n: - start = n - else: - start = key.start - - if step < 0 and (key.stop is None or key.stop < -n): - stop = -1 - elif key.stop is None: - stop = n - elif key.stop < 0: - stop = key.stop + n - if stop < 0: # step > 0 in this case. - stop = 0 - elif key.stop >= n: - stop = n - else: - stop = key.stop + start, stop, step = key.indices(n) if step != 1: indices = np.arange(start, stop, step) diff --git a/python/pyarrow/tests/test_array.py b/python/pyarrow/tests/test_array.py index 60794ebef328..472a6c5dce75 100644 --- a/python/pyarrow/tests/test_array.py +++ b/python/pyarrow/tests/test_array.py @@ -486,6 +486,7 @@ def test_array_slice_negative_step(): slice(None, None, 2), slice(0, 10, 2), slice(15, -25, -1), # GH-38768 + slice(-22, -22, -1), # GH-40642 ] for case in cases: From 93d2db0cf232fb933c1cda3feeff7e32d992b8ab Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Tue, 9 Apr 2024 15:27:59 -0300 Subject: [PATCH 04/32] GH-40689: [Docs] Add nanoarrow to implementation status page (#41052) ### Rationale for this change nanoarrow now supports most types and reading IPC streams. As discussed in the issue, there is interest in adding it to the implementation status page for visibility. ### What changes are included in this PR? A column was added to the table with the appropriate values characterizing the C library implementation status. ### Are these changes tested? Not needed (docs!) ### Are there any user-facing changes? No (docs!) * GitHub Issue: #40689 Lead-authored-by: Dewey Dunnington Co-authored-by: Dewey Dunnington Signed-off-by: Dewey Dunnington --- docs/source/index.rst | 1 + docs/source/status.rst | 470 +++++++++++++++++++++-------------------- 2 files changed, 237 insertions(+), 234 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index 2ca63c5ebdbc..57143b119655 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -109,6 +109,7 @@ Implementations JavaScript Julia MATLAB + nanoarrow Python R Ruby diff --git a/docs/source/status.rst b/docs/source/status.rst index dc60b311a148..f4672d6b4bc5 100644 --- a/docs/source/status.rst +++ b/docs/source/status.rst @@ -28,88 +28,88 @@ stated, the Python, R, Ruby and C/GLib libraries follow the C++ Arrow library. Data Types ========== -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Data type | C++ | Java | Go | JavaScript | C# | Rust | Julia | Swift | -| (primitive) | | | | | | | | | -+===================+=======+=======+=======+============+=======+=======+=======+=======+ -| Null | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Boolean | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Int8/16/32/64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| UInt8/16/32/64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Float16 | ✓ | ✓ (1) | ✓ | ✓ | ✓ (2)| ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Float32/64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Decimal128 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Decimal256 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Date32/64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Time32/64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Timestamp | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Duration | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Interval | ✓ | ✓ | ✓ | | ✓ | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Fixed Size Binary | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Binary | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Large Binary | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Utf8 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Large Utf8 | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Binary View | ✓ | | ✓ | | ✓ | | | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Large Binary View | ✓ | | ✓ | | | | | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Utf8 View | ✓ | | ✓ | | ✓ | | | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Large Utf8 View | ✓ | | ✓ | | | | | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ - -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Data type | C++ | Java | Go | JavaScript | C# | Rust | Julia | Swift | -| (nested) | | | | | | | | | -+===================+=======+=======+=======+============+=======+=======+=======+=======+ -| Fixed Size List | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| List | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Large List | ✓ | ✓ | ✓ | | | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| List View | ✓ | | ✓ | | ✓ | | | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Large List View | ✓ | | ✓ | | | | | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Struct | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Map | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Dense Union | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Sparse Union | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ - -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Data type | C++ | Java | Go | JavaScript | C# | Rust | Julia | Swift | -| (special) | | | | | | | | | -+===================+=======+=======+=======+============+=======+=======+=======+=======+ -| Dictionary | ✓ | ✓ (3) | ✓ | ✓ | ✓ | ✓ (3) | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Extension | ✓ | ✓ | ✓ | | | ✓ | ✓ | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Run-End Encoded | ✓ | | ✓ | | | | | | -+-------------------+-------+-------+-------+------------+-------+-------+-------+-------+ ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Data type | C++ | Java | Go | JS | C# | Rust | Julia | Swift | nanoarrow | +| (primitive) | | | | | | | | | | ++===================+=======+=======+=======+====+=======+=======+=======+=======+===========+ +| Null | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Boolean | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Int8/16/32/64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| UInt8/16/32/64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Float16 | ✓ | ✓ (1) | ✓ | ✓ | ✓ (2)| ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Float32/64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Decimal128 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Decimal256 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Date32/64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Time32/64 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Timestamp | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Duration | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Interval | ✓ | ✓ | ✓ | | ✓ | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Fixed Size Binary | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Binary | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Large Binary | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Utf8 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Large Utf8 | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Binary View | ✓ | | ✓ | | ✓ | | | | | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Large Binary View | ✓ | | ✓ | | | | | | | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Utf8 View | ✓ | | ✓ | | ✓ | | | | | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Large Utf8 View | ✓ | | ✓ | | | | | | | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ + ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Data type | C++ | Java | Go | JS | C# | Rust | Julia | Swift | nanoarrow | +| (nested) | | | | | | | | | | ++===================+=======+=======+=======+====+=======+=======+=======+=======+===========+ +| Fixed Size List | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| List | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Large List | ✓ | ✓ | ✓ | | | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| List View | ✓ | | ✓ | | ✓ | | | | | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Large List View | ✓ | | ✓ | | | | | | | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Struct | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Map | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Dense Union | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Sparse Union | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ + ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Data type | C++ | Java | Go | JS | C# | Rust | Julia | Swift | nanoarrow | +| (special) | | | | | | | | | | ++===================+=======+=======+=======+====+=======+=======+=======+=======+===========+ +| Dictionary | ✓ | ✓ (3) | ✓ | ✓ | ✓ | ✓ (3) | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Extension | ✓ | ✓ | ✓ | | | ✓ | ✓ | | ✓ | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Run-End Encoded | ✓ | | ✓ | | | | | | | ++-------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +-----------------------+-------+-------+-------+------------+-------+-------+-------+-------+ | Canonical | C++ | Java | Go | JavaScript | C# | Rust | Julia | Swift | @@ -134,32 +134,32 @@ Notes: IPC Format ========== -+-----------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| IPC Feature | C++ | Java | Go | JavaScript | C# | Rust | Julia | Swift | -| | | | | | | | | | -+=============================+=======+=======+=======+============+=======+=======+=======+=======+ -| Arrow stream format | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -+-----------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Arrow file format | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -+-----------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Record batches | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | -+-----------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Dictionaries | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | -+-----------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Replacement dictionaries | ✓ | ✓ | ✓ | | | | ✓ | | -+-----------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Delta dictionaries | ✓ (1) | | ✓ (1) | ✓ | ✓ | | ✓ | | -+-----------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Tensors | ✓ | | | | | | | | -+-----------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Sparse tensors | ✓ | | | | | | | | -+-----------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Buffer compression | ✓ | ✓ (3) | ✓ | | ✓ | ✓ | ✓ | | -+-----------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Endianness conversion | ✓ (2) | | ✓ (2) | | | | | | -+-----------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Custom schema metadata | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | -+-----------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ ++-----------------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| IPC Feature | C++ | Java | Go | JS | C# | Rust | Julia | Swift | nanoarrow | +| | | | | | | | | | | ++=============================+=======+=======+=======+====+=======+=======+=======+=======+===========+ +| Arrow stream format | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ (4) | ++-----------------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Arrow file format | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ++-----------------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Record batches | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ++-----------------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Dictionaries | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | ++-----------------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Replacement dictionaries | ✓ | ✓ | ✓ | | | | ✓ | | | ++-----------------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Delta dictionaries | ✓ (1) | | ✓ (1) | ✓ | ✓ | | ✓ | | | ++-----------------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Tensors | ✓ | | | | | | | | | ++-----------------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Sparse tensors | ✓ | | | | | | | | | ++-----------------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Buffer compression | ✓ | ✓ (3) | ✓ | | ✓ | ✓ | ✓ | | | ++-----------------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Endianness conversion | ✓ (2) | | ✓ (2) | | | | | | ✓ (2) | ++-----------------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ +| Custom schema metadata | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ++-----------------------------+-------+-------+-------+----+-------+-------+-------+-------+-----------+ Notes: @@ -169,6 +169,8 @@ Notes: * \(3) LZ4 Codec currently is quite inefficient. ARROW-11901 tracks improving performance. +* \(4) The nanoarrow IPC implementation is only implemented for reading IPC streams. + .. seealso:: The :ref:`format-ipc` specification. @@ -177,57 +179,57 @@ Notes: Flight RPC ========== -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Flight RPC Transport | C++ | Java | Go | JavaScript | C# | Rust | Julia | Swift | -+============================================+=======+=======+=======+============+=======+=======+=======+=======+ -| gRPC_ transport (grpc:, grpc+tcp:) | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| gRPC domain socket transport (grpc+unix:) | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| gRPC + TLS transport (grpc+tls:) | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| UCX_ transport (ucx:) | ✓ | | | | | | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| Flight RPC Transport | C++ | Java | Go | JS | C# | Rust | Julia | Swift | ++============================================+=======+=======+=======+====+=======+=======+=======+=======+ +| gRPC_ transport (grpc:, grpc+tcp:) | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| gRPC domain socket transport (grpc+unix:) | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| gRPC + TLS transport (grpc+tls:) | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| UCX_ transport (ucx:) | ✓ | | | | | | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ Supported features in the gRPC transport: -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Flight RPC Feature | C++ | Java | Go | JavaScript | C# | Rust | Julia | Swift | -+============================================+=======+=======+=======+============+=======+=======+=======+=======+ -| All RPC methods | ✓ | ✓ | ✓ | | × (1) | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Authentication handlers | ✓ | ✓ | ✓ | | ✓ (2) | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Call timeouts | ✓ | ✓ | ✓ | | | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Call cancellation | ✓ | ✓ | ✓ | | | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Concurrent client calls (3) | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Custom middleware | ✓ | ✓ | ✓ | | | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| RPC error codes | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| Flight RPC Feature | C++ | Java | Go | JS | C# | Rust | Julia | Swift | ++============================================+=======+=======+=======+====+=======+=======+=======+=======+ +| All RPC methods | ✓ | ✓ | ✓ | | ✓ (1) | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| Authentication handlers | ✓ | ✓ | ✓ | | ✓ (2) | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| Call timeouts | ✓ | ✓ | ✓ | | | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| Call cancellation | ✓ | ✓ | ✓ | | | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| Concurrent client calls (3) | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| Custom middleware | ✓ | ✓ | ✓ | | | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| RPC error codes | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ Supported features in the UCX transport: -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Flight RPC Feature | C++ | Java | Go | JavaScript | C# | Rust | Julia | Swift | -+============================================+=======+=======+=======+============+=======+=======+=======+=======+ -| All RPC methods | × (4) | | | | | | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Authentication handlers | | | | | | | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Call timeouts | | | | | | | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Call cancellation | | | | | | | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Concurrent client calls | ✓ (5) | | | | | | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Custom middleware | | | | | | | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| RPC error codes | ✓ | | | | | | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| Flight RPC Feature | C++ | Java | Go | JS | C# | Rust | Julia | Swift | ++============================================+=======+=======+=======+====+=======+=======+=======+=======+ +| All RPC methods | ✓ (4) | | | | | | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| Authentication handlers | | | | | | | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| Call timeouts | | | | | | | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| Call cancellation | | | | | | | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| Concurrent client calls | ✓ (5) | | | | | | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| Custom middleware | | | | | | | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| RPC error codes | ✓ | | | | | | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ Notes: @@ -255,55 +257,55 @@ The feature support refers to the client/server libraries only; databases which implement the Flight SQL protocol in turn will support/not support individual features. -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| Feature | C++ | Java | Go | JavaScript | C# | Rust | Julia | Swift | -+============================================+=======+=======+=======+============+=======+=======+=======+=======+ -| BeginSavepoint | ✓ | ✓ | | | | | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| BeginTransaction | ✓ | ✓ | | | | | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| CancelQuery | ✓ | ✓ | | | | | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| ClosePreparedStatement | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| CreatePreparedStatement | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| CreatePreparedSubstraitPlan | ✓ | ✓ | | | | | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| EndSavepoint | ✓ | ✓ | | | | | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| EndTransaction | ✓ | ✓ | | | | | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| GetCatalogs | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| GetCrossReference | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| GetDbSchemas | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| GetExportedKeys | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| GetImportedKeys | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| GetPrimaryKeys | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| GetSqlInfo | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| GetTables | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| GetTableTypes | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| GetXdbcTypeInfo | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| PreparedStatementQuery | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| PreparedStatementUpdate | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| StatementSubstraitPlan | ✓ | ✓ | | | | | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| StatementQuery | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ -| StatementUpdate | ✓ | ✓ | ✓ | | ✓ | ✓ | | | -+--------------------------------------------+-------+-------+-------+------------+-------+-------+-------+-------+ ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| Feature | C++ | Java | Go | JS | C# | Rust | Julia | Swift | ++============================================+=======+=======+=======+====+=======+=======+=======+=======+ +| BeginSavepoint | ✓ | ✓ | | | | | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| BeginTransaction | ✓ | ✓ | | | | | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| CancelQuery | ✓ | ✓ | | | | | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| ClosePreparedStatement | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| CreatePreparedStatement | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| CreatePreparedSubstraitPlan | ✓ | ✓ | | | | | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| EndSavepoint | ✓ | ✓ | | | | | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| EndTransaction | ✓ | ✓ | | | | | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| GetCatalogs | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| GetCrossReference | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| GetDbSchemas | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| GetExportedKeys | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| GetImportedKeys | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| GetPrimaryKeys | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| GetSqlInfo | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| GetTables | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| GetTableTypes | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| GetXdbcTypeInfo | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| PreparedStatementQuery | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| PreparedStatementUpdate | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| StatementSubstraitPlan | ✓ | ✓ | | | | | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| StatementQuery | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ +| StatementUpdate | ✓ | ✓ | ✓ | | ✓ | ✓ | | | ++--------------------------------------------+-------+-------+-------+----+-------+-------+-------+-------+ .. seealso:: The :doc:`./format/FlightSql` specification. @@ -311,18 +313,18 @@ support/not support individual features. C Data Interface ================ -+-----------------------------+-----+--------+---+------+----+------+--------+------+-------+-----+-------+ -| Feature | C++ | Python | R | Rust | Go | Java | C/GLib | Ruby | Julia | C# | Swift | -| | | | | | | | | | | | | -+=============================+=====+========+===+======+====+======+========+======+=======+=====+=======+ -| Schema export | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | | -+-----------------------------+-----+--------+---+------+----+------+--------+------+-------+-----+-------+ -| Array export | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | | -+-----------------------------+-----+--------+---+------+----+------+--------+------+-------+-----+-------+ -| Schema import | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | | -+-----------------------------+-----+--------+---+------+----+------+--------+------+-------+-----+-------+ -| Array import | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | | -+-----------------------------+-----+--------+---+------+----+------+--------+------+-------+-----+-------+ ++-----------------------------+-----+--------+---+------+----+------+--------+------+-------+-----+-------+-----------+ +| Feature | C++ | Python | R | Rust | Go | Java | C/GLib | Ruby | Julia | C# | Swift | nanoarrow | +| | | | | | | | | | | | | | ++=============================+=====+========+===+======+====+======+========+======+=======+=====+=======+===========+ +| Schema export | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | | ✓ | ++-----------------------------+-----+--------+---+------+----+------+--------+------+-------+-----+-------+-----------+ +| Array export | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | | ✓ | ++-----------------------------+-----+--------+---+------+----+------+--------+------+-------+-----+-------+-----------+ +| Schema import | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | | ✓ | ++-----------------------------+-----+--------+---+------+----+------+--------+------+-------+-----+-------+-----------+ +| Array import | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | | ✓ | ++-----------------------------+-----+--------+---+------+----+------+--------+------+-------+-----+-------+-----------+ .. seealso:: The :ref:`C Data Interface ` specification. @@ -331,14 +333,14 @@ C Data Interface C Stream Interface ================== -+-----------------------------+-----+--------+---+------+----+------+--------+------+-------+-----+-------+ -| Feature | C++ | Python | R | Rust | Go | Java | C/GLib | Ruby | Julia | C# | Swift | -| | | | | | | | | | | | | -+=============================+=====+========+===+======+====+======+========+======+=======+=====+=======+ -| Stream export | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | | ✓ | | -+-----------------------------+-----+--------+---+------+----+------+--------+------+-------+-----+-------+ -| Stream import | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | | ✓ | | -+-----------------------------+-----+--------+---+------+----+------+--------+------+-------+-----+-------+ ++-----------------------------+-----+--------+---+------+----+------+--------+------+-------+-----+-------+-----------+ +| Feature | C++ | Python | R | Rust | Go | Java | C/GLib | Ruby | Julia | C# | Swift | nanoarrow | +| | | | | | | | | | | | | | ++=============================+=====+========+===+======+====+======+========+======+=======+=====+=======+===========+ +| Stream export | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | | ✓ | | ✓ | ++-----------------------------+-----+--------+---+------+----+------+--------+------+-------+-----+-------+-----------+ +| Stream import | ✓ | ✓ | ✓ | ✓ | ✓ | | ✓ | ✓ | | ✓ | | ✓ | ++-----------------------------+-----+--------+---+------+----+------+--------+------+-------+-----+-------+-----------+ .. seealso:: The :ref:`C Stream Interface ` specification. @@ -347,18 +349,18 @@ C Stream Interface Third-Party Data Formats ======================== -+-----------------------------+---------+---------+-------+------------+-------+-------+-------+-------+ -| Format | C++ | Java | Go | JavaScript | C# | Rust | Julia | Swift | -| | | | | | | | | | -+=============================+=========+=========+=======+============+=======+=======+=======+=======+ -| Avro | | R | | | | | | | -+-----------------------------+---------+---------+-------+------------+-------+-------+-------+-------+ -| CSV | R/W | R (2) | R/W | | | R/W | R/W | | -+-----------------------------+---------+---------+-------+------------+-------+-------+-------+-------+ -| ORC | R/W | R (1) | | | | | | | -+-----------------------------+---------+---------+-------+------------+-------+-------+-------+-------+ -| Parquet | R/W | R (2) | R/W | | | R/W | | | -+-----------------------------+---------+---------+-------+------------+-------+-------+-------+-------+ ++-----------------------------+---------+---------+-------+----+-------+-------+-------+-------+ +| Format | C++ | Java | Go | JS | C# | Rust | Julia | Swift | +| | | | | | | | | | ++=============================+=========+=========+=======+====+=======+=======+=======+=======+ +| Avro | | R | | | | | | | ++-----------------------------+---------+---------+-------+----+-------+-------+-------+-------+ +| CSV | R/W | R (2) | R/W | | | R/W | R/W | | ++-----------------------------+---------+---------+-------+----+-------+-------+-------+-------+ +| ORC | R/W | R (1) | | | | | | | ++-----------------------------+---------+---------+-------+----+-------+-------+-------+-------+ +| Parquet | R/W | R (2) | R/W | | | R/W | | | ++-----------------------------+---------+---------+-------+----+-------+-------+-------+-------+ Notes: From ef530eb5b3a08099cea5c106028bd18623bdd541 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Wed, 10 Apr 2024 05:18:23 +0900 Subject: [PATCH 05/32] GH-41088: [CI][Crossbow] Fix GitHub Actions workflow syntax error (#41091) ### Rationale for this change We can't use multiple top-level `env:` in workflow. GH-40949 introduced a top-level `env:` by `macros.github_header()`. It broke workflows that already have top-level `env:`. ### What changes are included in this PR? Omit top-level `env:` key and reuse the top-level `env:` key generated by `macros.github_header()` in workflows. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #41088 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- dev/tasks/python-wheels/github.osx.yml | 3 +-- dev/tasks/verify-rc/github.macos.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/dev/tasks/python-wheels/github.osx.yml b/dev/tasks/python-wheels/github.osx.yml index e7b6d7898103..cf99c84c60bf 100644 --- a/dev/tasks/python-wheels/github.osx.yml +++ b/dev/tasks/python-wheels/github.osx.yml @@ -17,8 +17,7 @@ {% import 'macros.jinja' as macros with context %} {{ macros.github_header() }} - -env: +# env: is generated by macros.github_header() ARROW_JEMALLOC: "{{ arrow_jemalloc }}" CC: "clang" CMAKE_BUILD_TYPE: release diff --git a/dev/tasks/verify-rc/github.macos.yml b/dev/tasks/verify-rc/github.macos.yml index 642cee2bb9ae..8963954dba49 100644 --- a/dev/tasks/verify-rc/github.macos.yml +++ b/dev/tasks/verify-rc/github.macos.yml @@ -20,8 +20,7 @@ {{ macros.github_header() }} {% set use_conda = use_conda|default(False) %} - -env: +# env: is generated by macros.github_header() # Current oldest supported version according to https://endoflife.date/macos MACOSX_DEPLOYMENT_TARGET: "10.15" From e138bdc5f0178a57f13c445396b42aa3795a88c4 Mon Sep 17 00:00:00 2001 From: Alenka Frim Date: Wed, 10 Apr 2024 09:54:38 +0200 Subject: [PATCH 06/32] GH-41043: [CI][Python] check message in test_make_write_options_error for Cython 2 (#41059) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Rationale for this change `test_make_write_options_error` has been failing on Cython 2 crossbow build because in older versions of Cython the methods were "regular" C extension method had type check automatically built in. In Cython 3 that is not the case, see https://github.com/cython/cython/issues/6127 and so the check for `ParquetFileFormat` was added in https://github.com/apache/arrow/pull/40976. ### What changes are included in this PR? Checking the error raised for both messages, type check and the check for `ParquetFileFormat` added in https://github.com/apache/arrow/pull/40976. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #41043 Authored-by: AlenkaF Signed-off-by: Raúl Cumplido --- python/pyarrow/tests/test_dataset.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/python/pyarrow/tests/test_dataset.py b/python/pyarrow/tests/test_dataset.py index 6bba7240c05d..0b79218fb001 100644 --- a/python/pyarrow/tests/test_dataset.py +++ b/python/pyarrow/tests/test_dataset.py @@ -5633,11 +5633,17 @@ def test_checksum_write_dataset_read_dataset_to_table(tempdir): def test_make_write_options_error(): - # GH-39440 - msg = ("make_write_options\\(\\) should be called on an " - "instance of ParquetFileFormat") - with pytest.raises(TypeError, match=msg): + # GH-39440: calling make_write_options as a static class method + msg_1 = ("make_write_options() should be called on an " + "instance of ParquetFileFormat") + # GH-41043: In Cython2 all Cython methods were "regular" C extension methods + # see: https://github.com/cython/cython/issues/6127#issuecomment-2038153359 + msg_2 = ("descriptor 'make_write_options' for " + "'pyarrow._dataset_parquet.ParquetFileFormat' objects " + "doesn't apply to a 'int'") + with pytest.raises(TypeError) as excinfo: pa.dataset.ParquetFileFormat.make_write_options(43) + assert msg_1 in str(excinfo.value) or msg_2 in str(excinfo.value) pformat = pa.dataset.ParquetFileFormat() msg = "make_write_options\\(\\) takes exactly 0 positional arguments" From 903be59c79e18a46702ee276c7a9f7c021c78447 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Wed, 10 Apr 2024 05:19:14 -0300 Subject: [PATCH 07/32] GH-40801: [Docs] Clarify device identifier documentation in the Arrow C Device data interface (#41101) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Rationale for this change It is not explicit what the value of the `ArrowDeviceArray::device_id` should be when a given device type has no notion of a device identifier (e.g., there is always only one). ### What changes are included in this PR? The text was clarified to recommend a value of -1. This was the value already used by Arrow C++. ### Are these changes tested? No tests needed (documentation) ### Are there any user-facing changes? No * GitHub Issue: #40801 Authored-by: Dewey Dunnington Signed-off-by: Raúl Cumplido --- docs/source/format/CDeviceDataInterface.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/source/format/CDeviceDataInterface.rst b/docs/source/format/CDeviceDataInterface.rst index b5b7229a679e..dd8b7e98e1cb 100644 --- a/docs/source/format/CDeviceDataInterface.rst +++ b/docs/source/format/CDeviceDataInterface.rst @@ -256,6 +256,10 @@ has the following fields: type are on the system. The semantics of the id will be hardware dependent, but we use an ``int64_t`` to future-proof the id as devices change over time. + For device types that do not have an intrinsic notion of a device identifier (e.g., + ``ARROW_DEVICE_CPU``), it is recommended to use a ``device_id`` of -1 as a + convention. + .. c:member:: ArrowDeviceType ArrowDeviceArray.device_type *Mandatory.* The type of the device which can access the buffers in the array. @@ -689,4 +693,4 @@ Any incompatible changes should be part of a new specification, for example .. _Vulkan: https://www.vulkan.org/ .. _Metal: https://developer.apple.com/metal/ .. _ROCm: https://www.amd.com/en/graphics/servers-solutions-rocm -.. _oneAPI: https://www.intel.com/content/www/us/en/developer/tools/oneapi/overview.html \ No newline at end of file +.. _oneAPI: https://www.intel.com/content/www/us/en/developer/tools/oneapi/overview.html From 4d3d4ac0bbf023c7f2a7dde49bab371a0c9a5f67 Mon Sep 17 00:00:00 2001 From: Alenka Frim Date: Wed, 10 Apr 2024 12:15:47 +0200 Subject: [PATCH 08/32] GH-40866: [C++][Python] Basic conversion of RecordBatch to Arrow Tensor - add support for row-major (#40867) ### Rationale for this change The conversion from `RecordBatch` to `Tensor` class now exists but it doesn't support row-major `Tensor` as an output. This PR adds support for an option to construct row-major `Tensor`. ### What changes are included in this PR? This PR adds a `row_major` option in `RecordBatch::ToTensor` so that row-major `Tensor` can be constructed. The default conversion will be row-major. This for example works: ```python >>> import pyarrow as pa >>> import numpy as np >>> arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9] >>> arr2 = [10, 20, 30, 40, 50, 60, 70, 80, 90] >>> batch = pa.RecordBatch.from_arrays( ... [ ... pa.array(arr1, type=pa.uint16()), ... pa.array(arr2, type=pa.int16()), ... ... ], ["a", "b"] ... ) # Row-major >>> batch.to_tensor() type: int32 shape: (9, 2) strides: (8, 4) >>> batch.to_tensor().to_numpy().flags C_CONTIGUOUS : True F_CONTIGUOUS : False OWNDATA : False WRITEABLE : True ALIGNED : True WRITEBACKIFCOPY : False # Column-major >>> batch.to_tensor(row_major=False) type: int32 shape: (9, 2) strides: (4, 36) >>> batch.to_tensor(row_major=False).to_numpy().flags C_CONTIGUOUS : False F_CONTIGUOUS : True OWNDATA : False WRITEABLE : True ALIGNED : True WRITEBACKIFCOPY : False ``` ### Are these changes tested? Yes, in C++ and Python. ### Are there any user-facing changes? No. * GitHub Issue: #40866 Lead-authored-by: AlenkaF Co-authored-by: Alenka Frim Co-authored-by: Joris Van den Bossche Signed-off-by: Joris Van den Bossche --- cpp/src/arrow/record_batch.cc | 79 +++++++--- cpp/src/arrow/record_batch.h | 4 +- cpp/src/arrow/record_batch_test.cc | 212 +++++++++++++++++++++++---- python/pyarrow/includes/libarrow.pxd | 3 +- python/pyarrow/table.pxi | 36 ++++- python/pyarrow/tests/test_table.py | 74 ++++++---- 6 files changed, 326 insertions(+), 82 deletions(-) diff --git a/cpp/src/arrow/record_batch.cc b/cpp/src/arrow/record_batch.cc index 6f3b8e75a20d..8521d500f5c0 100644 --- a/cpp/src/arrow/record_batch.cc +++ b/cpp/src/arrow/record_batch.cc @@ -283,18 +283,55 @@ struct ConvertColumnsToTensorVisitor { } }; +template +struct ConvertColumnsToTensorRowMajorVisitor { + Out*& out_values; + const ArrayData& in_data; + int num_cols; + int col_idx; + + template + Status Visit(const T&) { + if constexpr (is_numeric(T::type_id)) { + using In = typename T::c_type; + auto in_values = ArraySpan(in_data).GetSpan(1, in_data.length); + + if (in_data.null_count == 0) { + for (int64_t i = 0; i < in_data.length; ++i) { + out_values[i * num_cols + col_idx] = static_cast(in_values[i]); + } + } else { + for (int64_t i = 0; i < in_data.length; ++i) { + out_values[i * num_cols + col_idx] = + in_data.IsNull(i) ? static_cast(NAN) : static_cast(in_values[i]); + } + } + return Status::OK(); + } + Unreachable(); + } +}; + template -inline void ConvertColumnsToTensor(const RecordBatch& batch, uint8_t* out) { +inline void ConvertColumnsToTensor(const RecordBatch& batch, uint8_t* out, + bool row_major) { using CType = typename arrow::TypeTraits::CType; auto* out_values = reinterpret_cast(out); + int i = 0; for (const auto& column : batch.columns()) { - ConvertColumnsToTensorVisitor visitor{out_values, *column->data()}; - DCHECK_OK(VisitTypeInline(*column->type(), &visitor)); + if (row_major) { + ConvertColumnsToTensorRowMajorVisitor visitor{out_values, *column->data(), + batch.num_columns(), i++}; + DCHECK_OK(VisitTypeInline(*column->type(), &visitor)); + } else { + ConvertColumnsToTensorVisitor visitor{out_values, *column->data()}; + DCHECK_OK(VisitTypeInline(*column->type(), &visitor)); + } } } -Result> RecordBatch::ToTensor(bool null_to_nan, +Result> RecordBatch::ToTensor(bool null_to_nan, bool row_major, MemoryPool* pool) const { if (num_columns() == 0) { return Status::TypeError( @@ -362,35 +399,35 @@ Result> RecordBatch::ToTensor(bool null_to_nan, // Copy data switch (result_type->id()) { case Type::UINT8: - ConvertColumnsToTensor(*this, result->mutable_data()); + ConvertColumnsToTensor(*this, result->mutable_data(), row_major); break; case Type::UINT16: case Type::HALF_FLOAT: - ConvertColumnsToTensor(*this, result->mutable_data()); + ConvertColumnsToTensor(*this, result->mutable_data(), row_major); break; case Type::UINT32: - ConvertColumnsToTensor(*this, result->mutable_data()); + ConvertColumnsToTensor(*this, result->mutable_data(), row_major); break; case Type::UINT64: - ConvertColumnsToTensor(*this, result->mutable_data()); + ConvertColumnsToTensor(*this, result->mutable_data(), row_major); break; case Type::INT8: - ConvertColumnsToTensor(*this, result->mutable_data()); + ConvertColumnsToTensor(*this, result->mutable_data(), row_major); break; case Type::INT16: - ConvertColumnsToTensor(*this, result->mutable_data()); + ConvertColumnsToTensor(*this, result->mutable_data(), row_major); break; case Type::INT32: - ConvertColumnsToTensor(*this, result->mutable_data()); + ConvertColumnsToTensor(*this, result->mutable_data(), row_major); break; case Type::INT64: - ConvertColumnsToTensor(*this, result->mutable_data()); + ConvertColumnsToTensor(*this, result->mutable_data(), row_major); break; case Type::FLOAT: - ConvertColumnsToTensor(*this, result->mutable_data()); + ConvertColumnsToTensor(*this, result->mutable_data(), row_major); break; case Type::DOUBLE: - ConvertColumnsToTensor(*this, result->mutable_data()); + ConvertColumnsToTensor(*this, result->mutable_data(), row_major); break; default: return Status::TypeError("DataType is not supported: ", result_type->ToString()); @@ -401,11 +438,17 @@ Result> RecordBatch::ToTensor(bool null_to_nan, internal::checked_cast(*result_type); std::vector shape = {num_rows(), num_columns()}; std::vector strides; - ARROW_RETURN_NOT_OK( - internal::ComputeColumnMajorStrides(fixed_width_type, shape, &strides)); - ARROW_ASSIGN_OR_RAISE(auto tensor, - Tensor::Make(result_type, std::move(result), shape, strides)); + std::shared_ptr tensor; + if (row_major) { + ARROW_RETURN_NOT_OK( + internal::ComputeRowMajorStrides(fixed_width_type, shape, &strides)); + } else { + ARROW_RETURN_NOT_OK( + internal::ComputeColumnMajorStrides(fixed_width_type, shape, &strides)); + } + ARROW_ASSIGN_OR_RAISE(tensor, + Tensor::Make(result_type, std::move(result), shape, strides)); return tensor; } diff --git a/cpp/src/arrow/record_batch.h b/cpp/src/arrow/record_batch.h index 5202ff4abfa0..cd647a88abd9 100644 --- a/cpp/src/arrow/record_batch.h +++ b/cpp/src/arrow/record_batch.h @@ -87,10 +87,12 @@ class ARROW_EXPORT RecordBatch { /// Generated Tensor will have column-major layout. /// /// \param[in] null_to_nan if true, convert nulls to NaN + /// \param[in] row_major if true, create row-major Tensor else column-major Tensor /// \param[in] pool the memory pool to allocate the tensor buffer /// \return the resulting Tensor Result> ToTensor( - bool null_to_nan = false, MemoryPool* pool = default_memory_pool()) const; + bool null_to_nan = false, bool row_major = true, + MemoryPool* pool = default_memory_pool()) const; /// \brief Construct record batch from struct array /// diff --git a/cpp/src/arrow/record_batch_test.cc b/cpp/src/arrow/record_batch_test.cc index 95f601465b44..daf7109075ea 100644 --- a/cpp/src/arrow/record_batch_test.cc +++ b/cpp/src/arrow/record_batch_test.cc @@ -685,14 +685,20 @@ TEST_F(TestRecordBatch, ToTensorEmptyBatch) { ASSERT_OK_AND_ASSIGN(std::shared_ptr empty, RecordBatch::MakeEmpty(schema)); - ASSERT_OK_AND_ASSIGN(auto tensor, empty->ToTensor()); - ASSERT_OK(tensor->Validate()); + ASSERT_OK_AND_ASSIGN(auto tensor_column, + empty->ToTensor(/*null_to_nan=*/false, /*row_major=*/false)); + ASSERT_OK(tensor_column->Validate()); + + ASSERT_OK_AND_ASSIGN(auto tensor_row, empty->ToTensor()); + ASSERT_OK(tensor_row->Validate()); const std::vector strides = {4, 4}; const std::vector shape = {0, 2}; - EXPECT_EQ(strides, tensor->strides()); - EXPECT_EQ(shape, tensor->shape()); + EXPECT_EQ(strides, tensor_column->strides()); + EXPECT_EQ(shape, tensor_column->shape()); + EXPECT_EQ(strides, tensor_row->strides()); + EXPECT_EQ(shape, tensor_row->shape()); auto batch_no_columns = RecordBatch::Make(::arrow::schema({}), 10, std::vector>{}); @@ -715,6 +721,19 @@ void CheckTensor(const std::shared_ptr& tensor, const int size, EXPECT_TRUE(tensor->is_contiguous()); } +template +void CheckTensorRowMajor(const std::shared_ptr& tensor, const int size, + const std::vector shape, + const std::vector strides) { + EXPECT_EQ(size, tensor->size()); + EXPECT_EQ(TypeTraits::type_singleton(), tensor->type()); + EXPECT_EQ(shape, tensor->shape()); + EXPECT_EQ(strides, tensor->strides()); + EXPECT_TRUE(tensor->is_row_major()); + EXPECT_FALSE(tensor->is_column_major()); + EXPECT_TRUE(tensor->is_contiguous()); +} + TEST_F(TestRecordBatch, ToTensorSupportedNaN) { const int length = 9; @@ -729,7 +748,8 @@ TEST_F(TestRecordBatch, ToTensorSupportedNaN) { auto batch = RecordBatch::Make(schema, length, {a0, a1}); - ASSERT_OK_AND_ASSIGN(auto tensor, batch->ToTensor()); + ASSERT_OK_AND_ASSIGN(auto tensor, + batch->ToTensor(/*null_to_nan=*/false, /*row_major=*/false)); ASSERT_OK(tensor->Validate()); std::vector shape = {9, 2}; @@ -759,7 +779,8 @@ TEST_F(TestRecordBatch, ToTensorSupportedNullToNan) { auto batch = RecordBatch::Make(schema, length, {a0, a1}); - ASSERT_OK_AND_ASSIGN(auto tensor, batch->ToTensor(/*null_to_nan=*/true)); + ASSERT_OK_AND_ASSIGN(auto tensor, + batch->ToTensor(/*null_to_nan=*/true, /*row_major=*/false)); ASSERT_OK(tensor->Validate()); std::vector shape = {9, 2}; @@ -774,6 +795,19 @@ TEST_F(TestRecordBatch, ToTensorSupportedNullToNan) { CheckTensor(tensor, 18, shape, f_strides); + ASSERT_OK_AND_ASSIGN(auto tensor_row, batch->ToTensor(/*null_to_nan=*/true)); + ASSERT_OK(tensor_row->Validate()); + + std::vector strides = {f64_size * shape[1], f64_size}; + std::shared_ptr tensor_expected_row = TensorFromJSON( + float64(), "[NaN, 10, 2, 20, 3, 30, 4, 40, 5, NaN, 6, 60, 7, 70, 8, 80, 9, 90]", + shape, strides); + + EXPECT_FALSE(tensor_expected_row->Equals(*tensor_row)); + EXPECT_TRUE(tensor_expected_row->Equals(*tensor_row, EqualOptions().nans_equal(true))); + + CheckTensorRowMajor(tensor_row, 18, shape, strides); + // int32 -> float64 auto f2 = field("f2", int32()); @@ -783,7 +817,8 @@ TEST_F(TestRecordBatch, ToTensorSupportedNullToNan) { auto a2 = ArrayFromJSON(int32(), "[10, 20, 30, 40, null, 60, 70, 80, 90]"); auto batch1 = RecordBatch::Make(schema1, length, {a0, a2}); - ASSERT_OK_AND_ASSIGN(auto tensor1, batch1->ToTensor(/*null_to_nan=*/true)); + ASSERT_OK_AND_ASSIGN(auto tensor1, + batch1->ToTensor(/*null_to_nan=*/true, /*row_major=*/false)); ASSERT_OK(tensor1->Validate()); EXPECT_FALSE(tensor_expected->Equals(*tensor1)); @@ -791,6 +826,14 @@ TEST_F(TestRecordBatch, ToTensorSupportedNullToNan) { CheckTensor(tensor1, 18, shape, f_strides); + ASSERT_OK_AND_ASSIGN(auto tensor1_row, batch1->ToTensor(/*null_to_nan=*/true)); + ASSERT_OK(tensor1_row->Validate()); + + EXPECT_FALSE(tensor_expected_row->Equals(*tensor1_row)); + EXPECT_TRUE(tensor_expected_row->Equals(*tensor1_row, EqualOptions().nans_equal(true))); + + CheckTensorRowMajor(tensor1_row, 18, shape, strides); + // int8 -> float32 auto f3 = field("f3", int8()); auto f4 = field("f4", int8()); @@ -802,7 +845,8 @@ TEST_F(TestRecordBatch, ToTensorSupportedNullToNan) { auto a4 = ArrayFromJSON(int8(), "[10, 20, 30, 40, null, 60, 70, 80, 90]"); auto batch2 = RecordBatch::Make(schema2, length, {a3, a4}); - ASSERT_OK_AND_ASSIGN(auto tensor2, batch2->ToTensor(/*null_to_nan=*/true)); + ASSERT_OK_AND_ASSIGN(auto tensor2, + batch2->ToTensor(/*null_to_nan=*/true, /*row_major=*/false)); ASSERT_OK(tensor2->Validate()); const int64_t f32_size = sizeof(float); @@ -815,6 +859,20 @@ TEST_F(TestRecordBatch, ToTensorSupportedNullToNan) { EXPECT_TRUE(tensor_expected_2->Equals(*tensor2, EqualOptions().nans_equal(true))); CheckTensor(tensor2, 18, shape, f_strides_2); + + ASSERT_OK_AND_ASSIGN(auto tensor2_row, batch2->ToTensor(/*null_to_nan=*/true)); + ASSERT_OK(tensor2_row->Validate()); + + std::vector strides_2 = {f32_size * shape[1], f32_size}; + std::shared_ptr tensor2_expected_row = TensorFromJSON( + float32(), "[NaN, 10, 2, 20, 3, 30, 4, 40, 5, NaN, 6, 60, 7, 70, 8, 80, 9, 90]", + shape, strides_2); + + EXPECT_FALSE(tensor2_expected_row->Equals(*tensor2_row)); + EXPECT_TRUE( + tensor2_expected_row->Equals(*tensor2_row, EqualOptions().nans_equal(true))); + + CheckTensorRowMajor(tensor2_row, 18, shape, strides_2); } TEST_F(TestRecordBatch, ToTensorSupportedTypesMixed) { @@ -833,7 +891,8 @@ TEST_F(TestRecordBatch, ToTensorSupportedTypesMixed) { auto schema = ::arrow::schema(fields); auto batch = RecordBatch::Make(schema, length, {a0}); - ASSERT_OK_AND_ASSIGN(auto tensor, batch->ToTensor()); + ASSERT_OK_AND_ASSIGN(auto tensor, + batch->ToTensor(/*null_to_nan=*/false, /*row_major=*/false)); ASSERT_OK(tensor->Validate()); std::vector shape = {9, 1}; @@ -850,7 +909,8 @@ TEST_F(TestRecordBatch, ToTensorSupportedTypesMixed) { auto schema1 = ::arrow::schema(fields1); auto batch1 = RecordBatch::Make(schema1, length, {a0, a1}); - ASSERT_OK_AND_ASSIGN(auto tensor1, batch1->ToTensor()); + ASSERT_OK_AND_ASSIGN(auto tensor1, + batch1->ToTensor(/*null_to_nan=*/false, /*row_major=*/false)); ASSERT_OK(tensor1->Validate()); std::vector shape1 = {9, 2}; @@ -875,7 +935,8 @@ TEST_F(TestRecordBatch, ToTensorSupportedTypesMixed) { auto schema2 = ::arrow::schema(fields2); auto batch2 = RecordBatch::Make(schema2, length, {a0, a1, a2}); - ASSERT_OK_AND_ASSIGN(auto tensor2, batch2->ToTensor()); + ASSERT_OK_AND_ASSIGN(auto tensor2, + batch2->ToTensor(/*null_to_nan=*/false, /*row_major=*/false)); ASSERT_OK(tensor2->Validate()); std::vector shape2 = {9, 3}; @@ -920,11 +981,11 @@ TEST_F(TestRecordBatch, ToTensorUnsupportedMixedFloat16) { } template -class TestBatchToTensor : public ::testing::Test {}; +class TestBatchToTensorColumnMajor : public ::testing::Test {}; -TYPED_TEST_SUITE_P(TestBatchToTensor); +TYPED_TEST_SUITE_P(TestBatchToTensorColumnMajor); -TYPED_TEST_P(TestBatchToTensor, SupportedTypes) { +TYPED_TEST_P(TestBatchToTensorColumnMajor, SupportedTypes) { using DataType = TypeParam; using c_data_type = typename DataType::c_type; const int unit_size = sizeof(c_data_type); @@ -947,7 +1008,8 @@ TYPED_TEST_P(TestBatchToTensor, SupportedTypes) { auto batch = RecordBatch::Make(schema, length, {a0, a1, a2}); - ASSERT_OK_AND_ASSIGN(auto tensor, batch->ToTensor()); + ASSERT_OK_AND_ASSIGN(auto tensor, + batch->ToTensor(/*null_to_nan=*/false, /*row_major=*/false)); ASSERT_OK(tensor->Validate()); std::vector shape = {9, 3}; @@ -964,7 +1026,8 @@ TYPED_TEST_P(TestBatchToTensor, SupportedTypes) { // Test offsets auto batch_slice = batch->Slice(1); - ASSERT_OK_AND_ASSIGN(auto tensor_sliced, batch_slice->ToTensor()); + ASSERT_OK_AND_ASSIGN(auto tensor_sliced, + batch_slice->ToTensor(/*null_to_nan=*/false, /*row_major=*/false)); ASSERT_OK(tensor_sliced->Validate()); std::vector shape_sliced = {8, 3}; @@ -980,7 +1043,9 @@ TYPED_TEST_P(TestBatchToTensor, SupportedTypes) { auto batch_slice_1 = batch->Slice(1, 5); - ASSERT_OK_AND_ASSIGN(auto tensor_sliced_1, batch_slice_1->ToTensor()); + ASSERT_OK_AND_ASSIGN( + auto tensor_sliced_1, + batch_slice_1->ToTensor(/*null_to_nan=*/false, /*row_major=*/false)); ASSERT_OK(tensor_sliced_1->Validate()); std::vector shape_sliced_1 = {5, 3}; @@ -994,18 +1059,107 @@ TYPED_TEST_P(TestBatchToTensor, SupportedTypes) { CheckTensor(tensor_expected_sliced_1, 15, shape_sliced_1, f_strides_sliced_1); } -REGISTER_TYPED_TEST_SUITE_P(TestBatchToTensor, SupportedTypes); +REGISTER_TYPED_TEST_SUITE_P(TestBatchToTensorColumnMajor, SupportedTypes); + +INSTANTIATE_TYPED_TEST_SUITE_P(UInt8, TestBatchToTensorColumnMajor, UInt8Type); +INSTANTIATE_TYPED_TEST_SUITE_P(UInt16, TestBatchToTensorColumnMajor, UInt16Type); +INSTANTIATE_TYPED_TEST_SUITE_P(UInt32, TestBatchToTensorColumnMajor, UInt32Type); +INSTANTIATE_TYPED_TEST_SUITE_P(UInt64, TestBatchToTensorColumnMajor, UInt64Type); +INSTANTIATE_TYPED_TEST_SUITE_P(Int8, TestBatchToTensorColumnMajor, Int8Type); +INSTANTIATE_TYPED_TEST_SUITE_P(Int16, TestBatchToTensorColumnMajor, Int16Type); +INSTANTIATE_TYPED_TEST_SUITE_P(Int32, TestBatchToTensorColumnMajor, Int32Type); +INSTANTIATE_TYPED_TEST_SUITE_P(Int64, TestBatchToTensorColumnMajor, Int64Type); +INSTANTIATE_TYPED_TEST_SUITE_P(Float16, TestBatchToTensorColumnMajor, HalfFloatType); +INSTANTIATE_TYPED_TEST_SUITE_P(Float32, TestBatchToTensorColumnMajor, FloatType); +INSTANTIATE_TYPED_TEST_SUITE_P(Float64, TestBatchToTensorColumnMajor, DoubleType); + +template +class TestBatchToTensorRowMajor : public ::testing::Test {}; + +TYPED_TEST_SUITE_P(TestBatchToTensorRowMajor); + +TYPED_TEST_P(TestBatchToTensorRowMajor, SupportedTypes) { + using DataType = TypeParam; + using c_data_type = typename DataType::c_type; + const int unit_size = sizeof(c_data_type); + + const int length = 9; + + auto f0 = field("f0", TypeTraits::type_singleton()); + auto f1 = field("f1", TypeTraits::type_singleton()); + auto f2 = field("f2", TypeTraits::type_singleton()); + + std::vector> fields = {f0, f1, f2}; + auto schema = ::arrow::schema(fields); + + auto a0 = ArrayFromJSON(TypeTraits::type_singleton(), + "[1, 2, 3, 4, 5, 6, 7, 8, 9]"); + auto a1 = ArrayFromJSON(TypeTraits::type_singleton(), + "[10, 20, 30, 40, 50, 60, 70, 80, 90]"); + auto a2 = ArrayFromJSON(TypeTraits::type_singleton(), + "[100, 100, 100, 100, 100, 100, 100, 100, 100]"); + + auto batch = RecordBatch::Make(schema, length, {a0, a1, a2}); + + ASSERT_OK_AND_ASSIGN(auto tensor, batch->ToTensor()); + ASSERT_OK(tensor->Validate()); + + std::vector shape = {9, 3}; + std::vector strides = {unit_size * shape[1], unit_size}; + std::shared_ptr tensor_expected = + TensorFromJSON(TypeTraits::type_singleton(), + "[1, 10, 100, 2, 20, 100, 3, 30, 100, 4, 40, 100, 5, 50, 100, 6, " + "60, 100, 7, 70, 100, 8, 80, 100, 9, 90, 100]", + shape, strides); + + EXPECT_TRUE(tensor_expected->Equals(*tensor)); + CheckTensorRowMajor(tensor, 27, shape, strides); + + // Test offsets + auto batch_slice = batch->Slice(1); + + ASSERT_OK_AND_ASSIGN(auto tensor_sliced, batch_slice->ToTensor()); + ASSERT_OK(tensor_sliced->Validate()); + + std::vector shape_sliced = {8, 3}; + std::vector strides_sliced = {unit_size * shape[1], unit_size}; + std::shared_ptr tensor_expected_sliced = + TensorFromJSON(TypeTraits::type_singleton(), + "[2, 20, 100, 3, 30, 100, 4, 40, 100, 5, 50, 100, 6, " + "60, 100, 7, 70, 100, 8, 80, 100, 9, 90, 100]", + shape_sliced, strides_sliced); + + EXPECT_TRUE(tensor_expected_sliced->Equals(*tensor_sliced)); + CheckTensorRowMajor(tensor_sliced, 24, shape_sliced, strides_sliced); + + auto batch_slice_1 = batch->Slice(1, 5); + + ASSERT_OK_AND_ASSIGN(auto tensor_sliced_1, batch_slice_1->ToTensor()); + ASSERT_OK(tensor_sliced_1->Validate()); + + std::vector shape_sliced_1 = {5, 3}; + std::vector strides_sliced_1 = {unit_size * shape_sliced_1[1], unit_size}; + std::shared_ptr tensor_expected_sliced_1 = + TensorFromJSON(TypeTraits::type_singleton(), + "[2, 20, 100, 3, 30, 100, 4, 40, 100, 5, 50, 100, 6, 60, 100]", + shape_sliced_1, strides_sliced_1); + + EXPECT_TRUE(tensor_expected_sliced_1->Equals(*tensor_sliced_1)); + CheckTensorRowMajor(tensor_sliced_1, 15, shape_sliced_1, strides_sliced_1); +} -INSTANTIATE_TYPED_TEST_SUITE_P(UInt8, TestBatchToTensor, UInt8Type); -INSTANTIATE_TYPED_TEST_SUITE_P(UInt16, TestBatchToTensor, UInt16Type); -INSTANTIATE_TYPED_TEST_SUITE_P(UInt32, TestBatchToTensor, UInt32Type); -INSTANTIATE_TYPED_TEST_SUITE_P(UInt64, TestBatchToTensor, UInt64Type); -INSTANTIATE_TYPED_TEST_SUITE_P(Int8, TestBatchToTensor, Int8Type); -INSTANTIATE_TYPED_TEST_SUITE_P(Int16, TestBatchToTensor, Int16Type); -INSTANTIATE_TYPED_TEST_SUITE_P(Int32, TestBatchToTensor, Int32Type); -INSTANTIATE_TYPED_TEST_SUITE_P(Int64, TestBatchToTensor, Int64Type); -INSTANTIATE_TYPED_TEST_SUITE_P(Float16, TestBatchToTensor, HalfFloatType); -INSTANTIATE_TYPED_TEST_SUITE_P(Float32, TestBatchToTensor, FloatType); -INSTANTIATE_TYPED_TEST_SUITE_P(Float64, TestBatchToTensor, DoubleType); +REGISTER_TYPED_TEST_SUITE_P(TestBatchToTensorRowMajor, SupportedTypes); + +INSTANTIATE_TYPED_TEST_SUITE_P(UInt8, TestBatchToTensorRowMajor, UInt8Type); +INSTANTIATE_TYPED_TEST_SUITE_P(UInt16, TestBatchToTensorRowMajor, UInt16Type); +INSTANTIATE_TYPED_TEST_SUITE_P(UInt32, TestBatchToTensorRowMajor, UInt32Type); +INSTANTIATE_TYPED_TEST_SUITE_P(UInt64, TestBatchToTensorRowMajor, UInt64Type); +INSTANTIATE_TYPED_TEST_SUITE_P(Int8, TestBatchToTensorRowMajor, Int8Type); +INSTANTIATE_TYPED_TEST_SUITE_P(Int16, TestBatchToTensorRowMajor, Int16Type); +INSTANTIATE_TYPED_TEST_SUITE_P(Int32, TestBatchToTensorRowMajor, Int32Type); +INSTANTIATE_TYPED_TEST_SUITE_P(Int64, TestBatchToTensorRowMajor, Int64Type); +INSTANTIATE_TYPED_TEST_SUITE_P(Float16, TestBatchToTensorRowMajor, HalfFloatType); +INSTANTIATE_TYPED_TEST_SUITE_P(Float32, TestBatchToTensorRowMajor, FloatType); +INSTANTIATE_TYPED_TEST_SUITE_P(Float64, TestBatchToTensorRowMajor, DoubleType); } // namespace arrow diff --git a/python/pyarrow/includes/libarrow.pxd b/python/pyarrow/includes/libarrow.pxd index aa50dd189a82..a35919579541 100644 --- a/python/pyarrow/includes/libarrow.pxd +++ b/python/pyarrow/includes/libarrow.pxd @@ -984,7 +984,8 @@ cdef extern from "arrow/api.h" namespace "arrow" nogil: shared_ptr[CRecordBatch] Slice(int64_t offset) shared_ptr[CRecordBatch] Slice(int64_t offset, int64_t length) - CResult[shared_ptr[CTensor]] ToTensor(c_bool null_to_nan, CMemoryPool* pool) const + CResult[shared_ptr[CTensor]] ToTensor(c_bool null_to_nan, c_bool row_major, + CMemoryPool* pool) const cdef cppclass CRecordBatchWithMetadata" arrow::RecordBatchWithMetadata": shared_ptr[CRecordBatch] batch diff --git a/python/pyarrow/table.pxi b/python/pyarrow/table.pxi index 54fda1da7dca..6b3c7d0b5626 100644 --- a/python/pyarrow/table.pxi +++ b/python/pyarrow/table.pxi @@ -3389,20 +3389,24 @@ cdef class RecordBatch(_Tabular): deref(c_record_batch).ToStructArray()) return pyarrow_wrap_array(c_array) - def to_tensor(self, c_bool null_to_nan=False, MemoryPool memory_pool=None): + def to_tensor(self, c_bool null_to_nan=False, c_bool row_major=True, MemoryPool memory_pool=None): """ Convert to a :class:`~pyarrow.Tensor`. RecordBatches that can be converted have fields of type signed or unsigned - integer or float, including all bit-widths. RecordBatches with validity bitmask - for any of the arrays can be converted with ``null_to_nan``turned to ``True``. - In this case null values are converted to NaN and signed or unsigned integer - type arrays are promoted to appropriate float type. + integer or float, including all bit-widths. + + ``null_to_nan`` is ``False`` by default and this method will raise an error in case + any nulls are present. RecordBatches with nulls can be converted with ``null_to_nan`` + set to ``True``. In this case null values are converted to ``NaN`` and integer type + arrays are promoted to the appropriate float type. Parameters ---------- null_to_nan : bool, default False Whether to write null values in the result as ``NaN``. + row_major : bool, default True + Whether resulting Tensor is row-major or column-major memory_pool : MemoryPool, default None For memory allocations, if required, otherwise use default pool @@ -3424,13 +3428,29 @@ cdef class RecordBatch(_Tabular): a: [1,2,3,4,null] b: [10,20,30,40,null] + Convert a RecordBatch to row-major Tensor with null values + written as ``NaN``s + >>> batch.to_tensor(null_to_nan=True) type: double shape: (5, 2) - strides: (8, 40) - + strides: (16, 8) >>> batch.to_tensor(null_to_nan=True).to_numpy() + array([[ 1., 10.], + [ 2., 20.], + [ 3., 30.], + [ 4., 40.], + [nan, nan]]) + + Convert a RecordBatch to column-major Tensor + + >>> batch.to_tensor(null_to_nan=True, row_major=False) + + type: double + shape: (5, 2) + strides: (8, 40) + >>> batch.to_tensor(null_to_nan=True, row_major=False).to_numpy() array([[ 1., 10.], [ 2., 20.], [ 3., 30.], @@ -3446,7 +3466,7 @@ cdef class RecordBatch(_Tabular): with nogil: c_tensor = GetResultValue( deref(c_record_batch).ToTensor(null_to_nan, - pool)) + row_major, pool)) return pyarrow_wrap_tensor(c_tensor) def _export_to_c(self, out_ptr, out_schema_ptr=0): diff --git a/python/pyarrow/tests/test_table.py b/python/pyarrow/tests/test_table.py index 8e3057418876..31d34058b61e 100644 --- a/python/pyarrow/tests/test_table.py +++ b/python/pyarrow/tests/test_table.py @@ -926,36 +926,46 @@ def test_recordbatch_to_tensor_uniform_type(typ): pa.array(arr3, type=pa.from_numpy_dtype(typ)), ], ["a", "b", "c"] ) - result = batch.to_tensor() - x = np.array([arr1, arr2, arr3], typ).transpose() + result = batch.to_tensor(row_major=False) + x = np.column_stack([arr1, arr2, arr3]).astype(typ, order="F") expected = pa.Tensor.from_numpy(x) + check_tensors(result, expected, pa.from_numpy_dtype(typ), 27) + result = batch.to_tensor() + x = np.column_stack([arr1, arr2, arr3]).astype(typ, order="C") + expected = pa.Tensor.from_numpy(x) check_tensors(result, expected, pa.from_numpy_dtype(typ), 27) # Test offset batch1 = batch.slice(1) - result = batch1.to_tensor() - arr1 = [2, 3, 4, 5, 6, 7, 8, 9] arr2 = [20, 30, 40, 50, 60, 70, 80, 90] arr3 = [100, 100, 100, 100, 100, 100, 100, 100] - x = np.array([arr1, arr2, arr3], typ).transpose() + result = batch1.to_tensor(row_major=False) + x = np.column_stack([arr1, arr2, arr3]).astype(typ, order="F") expected = pa.Tensor.from_numpy(x) + check_tensors(result, expected, pa.from_numpy_dtype(typ), 24) + result = batch1.to_tensor() + x = np.column_stack([arr1, arr2, arr3]).astype(typ, order="C") + expected = pa.Tensor.from_numpy(x) check_tensors(result, expected, pa.from_numpy_dtype(typ), 24) batch2 = batch.slice(1, 5) - result = batch2.to_tensor() - arr1 = [2, 3, 4, 5, 6] arr2 = [20, 30, 40, 50, 60] arr3 = [100, 100, 100, 100, 100] - x = np.array([arr1, arr2, arr3], typ).transpose() + result = batch2.to_tensor(row_major=False) + x = np.column_stack([arr1, arr2, arr3]).astype(typ, order="F") expected = pa.Tensor.from_numpy(x) + check_tensors(result, expected, pa.from_numpy_dtype(typ), 15) + result = batch2.to_tensor() + x = np.column_stack([arr1, arr2, arr3]).astype(typ, order="C") + expected = pa.Tensor.from_numpy(x) check_tensors(result, expected, pa.from_numpy_dtype(typ), 15) @@ -970,11 +980,15 @@ def test_recordbatch_to_tensor_uniform_float_16(): pa.array(np.array(arr3, dtype=np.float16), type=pa.float16()), ], ["a", "b", "c"] ) - result = batch.to_tensor() - x = np.array([arr1, arr2, arr3], np.float16).transpose() + result = batch.to_tensor(row_major=False) + x = np.column_stack([arr1, arr2, arr3]).astype(np.float16, order="F") expected = pa.Tensor.from_numpy(x) + check_tensors(result, expected, pa.float16(), 27) + result = batch.to_tensor() + x = np.column_stack([arr1, arr2, arr3]).astype(np.float16, order="C") + expected = pa.Tensor.from_numpy(x) check_tensors(result, expected, pa.float16(), 27) @@ -989,11 +1003,15 @@ def test_recordbatch_to_tensor_mixed_type(): pa.array(arr2, type=pa.int16()), ], ["a", "b"] ) - result = batch.to_tensor() - x = np.array([arr1, arr2], np.int32).transpose() + result = batch.to_tensor(row_major=False) + x = np.column_stack([arr1, arr2]).astype(np.int32, order="F") expected = pa.Tensor.from_numpy(x) + check_tensors(result, expected, pa.int32(), 18) + result = batch.to_tensor() + x = np.column_stack([arr1, arr2]).astype(np.int32, order="C") + expected = pa.Tensor.from_numpy(x) check_tensors(result, expected, pa.int32(), 18) # uint16 + int16 + float32 = float64 @@ -1004,9 +1022,18 @@ def test_recordbatch_to_tensor_mixed_type(): pa.array(arr3, type=pa.float32()), ], ["a", "b", "c"] ) - result = batch.to_tensor() + result = batch.to_tensor(row_major=False) + x = np.column_stack([arr1, arr2, arr3]).astype(np.float64, order="F") + expected = pa.Tensor.from_numpy(x) - x = np.array([arr1, arr2, arr3], np.float64).transpose() + np.testing.assert_equal(result.to_numpy(), x) + assert result.size == 27 + assert result.type == pa.float64() + assert result.shape == expected.shape + assert result.strides == expected.strides + + result = batch.to_tensor() + x = np.column_stack([arr1, arr2, arr3]).astype(np.float64, order="C") expected = pa.Tensor.from_numpy(x) np.testing.assert_equal(result.to_numpy(), x) @@ -1044,9 +1071,8 @@ def test_recordbatch_to_tensor_nan(): pa.array(arr2, type=pa.float32()), ], ["a", "b"] ) - result = batch.to_tensor() - - x = np.array([arr1, arr2], np.float32).transpose() + result = batch.to_tensor(row_major=False) + x = np.column_stack([arr1, arr2]).astype(np.float32, order="F") expected = pa.Tensor.from_numpy(x) np.testing.assert_equal(result.to_numpy(), x) @@ -1071,9 +1097,8 @@ def test_recordbatch_to_tensor_null(): ): batch.to_tensor() - result = batch.to_tensor(null_to_nan=True) - - x = np.array([arr1, arr2], np.float64).transpose() + result = batch.to_tensor(null_to_nan=True, row_major=False) + x = np.column_stack([arr1, arr2]).astype(np.float64, order="F") expected = pa.Tensor.from_numpy(x) np.testing.assert_equal(result.to_numpy(), x) @@ -1090,7 +1115,7 @@ def test_recordbatch_to_tensor_null(): ], ["a", "b"] ) - result = batch.to_tensor(null_to_nan=True) + result = batch.to_tensor(null_to_nan=True, row_major=False) np.testing.assert_equal(result.to_numpy(), x) assert result.size == 18 @@ -1106,9 +1131,8 @@ def test_recordbatch_to_tensor_null(): ], ["a", "b"] ) - result = batch.to_tensor(null_to_nan=True) - - x = np.array([arr1, arr2], np.float32).transpose() + result = batch.to_tensor(null_to_nan=True, row_major=False) + x = np.column_stack([arr1, arr2]).astype(np.float32, order="F") expected = pa.Tensor.from_numpy(x) np.testing.assert_equal(result.to_numpy(), x) @@ -1127,7 +1151,7 @@ def test_recordbatch_to_tensor_empty(): ) result = batch.to_tensor() - x = np.array([[], []], np.float32).transpose() + x = np.column_stack([[], []]).astype(np.float32, order="F") expected = pa.Tensor.from_numpy(x) assert result.size == expected.size From b18b1f4916ad4369112fd914ff081f21998ff0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Wed, 10 Apr 2024 23:04:51 +0200 Subject: [PATCH 09/32] GH-41119: [Archery][Packaging][CI] Avoid using --progress flag on Docker on Windows on archery (#41120) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Rationale for this change Windows wheels are currently failing due to the change on `ARCHERY_DEBUG=1` by default. This uses `--progress` on `docker build` which is not supported on Windows. ### What changes are included in this PR? Do not use `--progress` on the Windows builds. ### Are these changes tested? Yes on CI via archery. ### Are there any user-facing changes? No * GitHub Issue: #41119 Lead-authored-by: Raúl Cumplido Co-authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- dev/archery/archery/docker/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/archery/archery/docker/core.py b/dev/archery/archery/docker/core.py index 0b49111dd694..7376bb0a3b72 100644 --- a/dev/archery/archery/docker/core.py +++ b/dev/archery/archery/docker/core.py @@ -311,7 +311,7 @@ def _build(service, use_cache): self._execute_docker("buildx", "build", *args) elif self.config.using_docker: # better for caching - if self.config.debug: + if self.config.debug and os.name != "nt": args.append("--progress=plain") for k, v in service['build'].get('args', {}).items(): args.extend(['--build-arg', '{}={}'.format(k, v)]) @@ -324,7 +324,7 @@ def _build(service, use_cache): ]) self._execute_docker("build", *args) else: - if self.config.debug: + if self.config.debug and os.name != "nt": args.append("--progress=plain") self._execute_compose("build", *args, service['name']) From 2853ecb4df854aaf1a4f72168a3d7fa62eb323df Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 11 Apr 2024 08:59:58 +0900 Subject: [PATCH 10/32] GH-41034: [C++][FS][Azure] Adjust DeleteDir/DeleteDirContents/GetFileInfoSelector behaviors against Azure for generic filesystem tests (#41068) ### Rationale for this change They are failing: ```text [ FAILED ] TestAzureHierarchicalNSGeneric.DeleteDir [ FAILED ] TestAzureHierarchicalNSGeneric.DeleteDirContents [ FAILED ] TestAzureHierarchicalNSGeneric.GetFileInfoSelector ``` ### What changes are included in this PR? * `DeleteDir()`: Check not a directory case * `DeleteDirContents()`: Check not a directory case * `GetFileInfoSelector()`: * Add not a directory check for input * Add support for returning metadata for directory ### Are these changes tested? Yes. ### Are there any user-facing changes? Yes. * GitHub Issue: #41034 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- cpp/src/arrow/filesystem/azurefs.cc | 83 +++++++++++++++++++++++- cpp/src/arrow/filesystem/azurefs_test.cc | 6 +- 2 files changed, 87 insertions(+), 2 deletions(-) diff --git a/cpp/src/arrow/filesystem/azurefs.cc b/cpp/src/arrow/filesystem/azurefs.cc index 84733a824e7b..bb8309a24740 100644 --- a/cpp/src/arrow/filesystem/azurefs.cc +++ b/cpp/src/arrow/filesystem/azurefs.cc @@ -1179,6 +1179,15 @@ Status CreateContainerIfNotExists(const std::string& container_name, } } +FileInfo FileInfoFromPath(std::string_view container, + const DataLake::Models::PathItem& path) { + FileInfo info{internal::ConcatAbstractPath(container, path.Name), + path.IsDirectory ? FileType::Directory : FileType::File}; + info.set_size(path.FileSize); + info.set_mtime(std::chrono::system_clock::time_point{path.LastModified}); + return info; +} + FileInfo DirectoryFileInfoFromPath(std::string_view path) { return FileInfo{std::string{internal::RemoveTrailingSlash(path)}, FileType::Directory}; } @@ -1576,7 +1585,7 @@ class AzureFileSystem::Impl { } private: - /// \pref location.container is not empty. + /// \pre location.container is not empty. template Status CheckDirExists(const ContainerClient& container_client, const AzureLocation& location) { @@ -1623,6 +1632,50 @@ class AzureFileSystem::Impl { return result; } + /// \brief List the paths at the root of a filesystem or some dir in a filesystem. + /// + /// \pre adlfs_client is the client for the filesystem named like the first + /// segment of select.base_dir. + Status GetFileInfoWithSelectorFromFileSystem( + const DataLake::DataLakeFileSystemClient& adlfs_client, + const Core::Context& context, Azure::Nullable page_size_hint, + const FileSelector& select, FileInfoVector* acc_results) { + ARROW_ASSIGN_OR_RAISE(auto base_location, AzureLocation::FromString(select.base_dir)); + + auto directory_client = adlfs_client.GetDirectoryClient(base_location.path); + bool found = false; + DataLake::ListPathsOptions options; + options.PageSizeHint = page_size_hint; + + try { + auto list_response = directory_client.ListPaths(select.recursive, options, context); + for (; list_response.HasPage(); list_response.MoveToNextPage(context)) { + if (list_response.Paths.empty()) { + continue; + } + found = true; + for (const auto& path : list_response.Paths) { + if (path.Name == base_location.path && !path.IsDirectory) { + return NotADir(base_location); + } + acc_results->push_back(FileInfoFromPath(base_location.container, path)); + } + } + } catch (const Storage::StorageException& exception) { + if (IsContainerNotFound(exception) || exception.ErrorCode == "PathNotFound") { + found = false; + } else { + return ExceptionToStatus(exception, + "Failed to list paths in a directory: ", select.base_dir, + ": ", directory_client.GetUrl()); + } + } + + return found || select.allow_not_found + ? Status::OK() + : ::arrow::fs::internal::PathNotFound(select.base_dir); + } + /// \brief List the blobs at the root of a container or some dir in a container. /// /// \pre container_client is the client for the container named like the first @@ -1772,6 +1825,20 @@ class AzureFileSystem::Impl { return VisitContainers(context, std::move(on_container)); } + auto adlfs_client = GetFileSystemClient(base_location.container); + ARROW_ASSIGN_OR_RAISE(auto hns_support, HierarchicalNamespaceSupport(adlfs_client)); + if (hns_support == HNSSupport::kContainerNotFound) { + if (select.allow_not_found) { + return Status::OK(); + } else { + return ::arrow::fs::internal::PathNotFound(select.base_dir); + } + } + if (hns_support == HNSSupport::kEnabled) { + return GetFileInfoWithSelectorFromFileSystem(adlfs_client, context, page_size_hint, + select, acc_results); + } + DCHECK_EQ(hns_support, HNSSupport::kDisabled); auto container_client = blob_service_client_->GetBlobContainerClient(base_location.container); return GetFileInfoWithSelectorFromContainer(container_client, context, page_size_hint, @@ -2157,6 +2224,17 @@ class AzureFileSystem::Impl { Azure::Nullable lease_id = {}) { DCHECK(!location.container.empty()); DCHECK(!location.path.empty()); + ARROW_ASSIGN_OR_RAISE(auto file_info, GetFileInfo(adlfs_client, location, lease_id)); + if (file_info.type() == FileType::NotFound) { + if (require_dir_to_exist) { + return PathNotFound(location); + } else { + return Status::OK(); + } + } + if (file_info.type() != FileType::Directory) { + return NotADir(location); + } auto directory_client = adlfs_client.GetDirectoryClient( std::string(internal::RemoveTrailingSlash(location.path))); DataLake::DeleteDirectoryOptions options; @@ -2200,6 +2278,9 @@ class AzureFileSystem::Impl { kDelimiter, path.Name, ": ", sub_directory_client.GetUrl()); } } else { + if (path.Name == location.path) { + return NotADir(location); + } auto sub_file_client = adlfs_client.GetFileClient(path.Name); try { sub_file_client.Delete(); diff --git a/cpp/src/arrow/filesystem/azurefs_test.cc b/cpp/src/arrow/filesystem/azurefs_test.cc index 24031e313f79..ed09bfc2fadd 100644 --- a/cpp/src/arrow/filesystem/azurefs_test.cc +++ b/cpp/src/arrow/filesystem/azurefs_test.cc @@ -392,7 +392,7 @@ class TestGeneric : public ::testing::Test, public GenericFileSystemTest { bool allow_move_dir() const override { return false; } bool allow_move_file() const override { return true; } bool allow_append_to_file() const override { return true; } - bool have_directory_mtimes() const override { return false; } + bool have_directory_mtimes() const override { return true; } bool have_flaky_directory_tree_deletion() const override { return false; } bool have_file_metadata() const override { return true; } // calloc() used in libxml2's xmlNewGlobalState() is detected as a @@ -429,6 +429,8 @@ class TestAzuriteGeneric : public TestGeneric { protected: // Azurite doesn't support moving files over containers. bool allow_move_file() const override { return false; } + // Azurite doesn't support directory mtime. + bool have_directory_mtimes() const override { return false; } // DeleteDir() doesn't work with Azurite on macOS bool have_flaky_directory_tree_deletion() const override { return env_->HasSubmitBatchBug(); @@ -449,6 +451,8 @@ class TestAzureFlatNSGeneric : public TestGeneric { protected: // Flat namespace account doesn't support moving files over containers. bool allow_move_file() const override { return false; } + // Flat namespace account doesn't support directory mtime. + bool have_directory_mtimes() const override { return false; } }; class TestAzureHierarchicalNSGeneric : public TestGeneric { From 5330df7a7186ec440664f32e68a151830d395612 Mon Sep 17 00:00:00 2001 From: Weston Pace Date: Wed, 10 Apr 2024 19:48:01 -0700 Subject: [PATCH 11/32] GH-40695 [C++] Expand Substrait type support (#40696) ### Rationale for this change See #40695 ### What changes are included in this PR? This PR does a few things: * Substrait is upgraded to the latest version * Support is added for the parameterized timestamp type (but not literals due to https://github.com/substrait-io/substrait/issues/611). * Support is added for the following arrow-specific types: * fp16 * date_millis * time_seconds * time_millis * time_nanos * large_string * large_binary When adding support for the new timestamp types I also relaxed the restrictions on the time zone column. Substrait puts time zone information in the function and not the type. In other words, to print the "America/New York" value of a column of instants one would do something like `to_char(my_timestamp, "America/New York")` instead of `to_char(cast(my_timestamp, timestamp("nanos", "America/New York")`. However, the current implementation makes it impossible to produce or consume a plan with `to_char(my_timestamp, "America/New York")` because it would reject the type because it has a non-UTC time zone. With this latest change, we treat any non-empty timezone as a timezone_tz type. In addition, I have enabled conversions from "encoded types" to their unencoded representation. E.g. a type of `DICTIONARY` will convert to `INT32`. At a logical expression / plan perspective these encodings are irrelevant. If anything, they may belong in a more physical plan representation. Should a need for them arise we can dig into it more later. However, I believe it is better to err on the side of generating "something" rather than failing in these cases. I don't consider this last change critical and can back it out if need be. ### Are these changes tested? Yes, I added new unit tests ### Are there any user-facing changes? Yes, via the Substrait conversion. These changes should be backwards compatible in that they only add functionality in places that previously reported "Not Supported". * GitHub Issue: #40695 Lead-authored-by: Weston Pace Co-authored-by: Benjamin Kietzman Signed-off-by: Weston Pace --- .../engine/substrait/expression_internal.cc | 262 +++++++++++++++--- .../arrow/engine/substrait/extension_set.cc | 8 +- .../arrow/engine/substrait/extension_set.h | 4 + .../arrow/engine/substrait/extension_types.cc | 31 +++ .../arrow/engine/substrait/extension_types.h | 10 + cpp/src/arrow/engine/substrait/serde_test.cc | 125 +++++++-- .../arrow/engine/substrait/type_internal.cc | 110 ++++++-- cpp/src/arrow/engine/substrait/util.h | 2 +- cpp/thirdparty/versions.txt | 4 +- format/substrait/extension_types.yaml | 142 ++++++++-- python/pyarrow/tests/test_substrait.py | 48 ++++ 11 files changed, 649 insertions(+), 97 deletions(-) diff --git a/cpp/src/arrow/engine/substrait/expression_internal.cc b/cpp/src/arrow/engine/substrait/expression_internal.cc index 5d892af9a394..480cf30d3033 100644 --- a/cpp/src/arrow/engine/substrait/expression_internal.cc +++ b/cpp/src/arrow/engine/substrait/expression_internal.cc @@ -33,6 +33,7 @@ #include #include +#include #include "arrow/array/array_base.h" #include "arrow/array/array_nested.h" @@ -58,8 +59,10 @@ #include "arrow/util/decimal.h" #include "arrow/util/endian.h" #include "arrow/util/logging.h" +#include "arrow/util/macros.h" #include "arrow/util/small_vector.h" #include "arrow/util/string.h" +#include "arrow/util/unreachable.h" #include "arrow/visit_scalar_inline.h" namespace arrow { @@ -71,6 +74,9 @@ namespace engine { namespace { +constexpr int64_t kMicrosPerSecond = 1000000; +constexpr int64_t kMicrosPerMilli = 1000; + Id NormalizeFunctionName(Id id) { // Substrait plans encode the types into the function name so it might look like // add:opt_i32_i32. We don't care about the :opt_i32_i32 so we just trim it @@ -421,6 +427,86 @@ Result FromProto(const substrait::Expression& expr, expr.DebugString()); } +namespace { +struct UserDefinedLiteralToArrow { + Status Visit(const DataType& type) { + return Status::NotImplemented("User defined literals of type ", type); + } + Status Visit(const IntegerType& type) { + google::protobuf::UInt64Value value; + if (!user_defined_->value().UnpackTo(&value)) { + return Status::Invalid( + "Failed to unpack user defined integer literal to UInt64Value"); + } + ARROW_ASSIGN_OR_RAISE(scalar_, MakeScalar(type.GetSharedPtr(), value.value())); + return Status::OK(); + } + Status Visit(const Time32Type& type) { + google::protobuf::Int32Value value; + if (!user_defined_->value().UnpackTo(&value)) { + return Status::Invalid( + "Failed to unpack user defined time32 literal to Int32Value"); + } + ARROW_ASSIGN_OR_RAISE(scalar_, MakeScalar(type.GetSharedPtr(), value.value())); + return Status::OK(); + } + Status Visit(const Time64Type& type) { + google::protobuf::Int64Value value; + if (!user_defined_->value().UnpackTo(&value)) { + return Status::Invalid( + "Failed to unpack user defined time64 literal to Int64Value"); + } + ARROW_ASSIGN_OR_RAISE(scalar_, MakeScalar(type.GetSharedPtr(), value.value())); + return Status::OK(); + } + Status Visit(const Date64Type& type) { + google::protobuf::Int64Value value; + if (!user_defined_->value().UnpackTo(&value)) { + return Status::Invalid( + "Failed to unpack user defined date64 literal to Int64Value"); + } + ARROW_ASSIGN_OR_RAISE(scalar_, MakeScalar(type.GetSharedPtr(), value.value())); + return Status::OK(); + } + Status Visit(const HalfFloatType& type) { + google::protobuf::UInt32Value value; + if (!user_defined_->value().UnpackTo(&value)) { + return Status::Invalid( + "Failed to unpack user defined half_float literal to UInt32Value"); + } + uint16_t half_float_value = value.value(); + ARROW_ASSIGN_OR_RAISE(scalar_, MakeScalar(type.GetSharedPtr(), half_float_value)); + return Status::OK(); + } + Status Visit(const LargeStringType& type) { + google::protobuf::StringValue value; + if (!user_defined_->value().UnpackTo(&value)) { + return Status::Invalid( + "Failed to unpack user defined large_string literal to StringValue"); + } + ARROW_ASSIGN_OR_RAISE(scalar_, + MakeScalar(type.GetSharedPtr(), std::string(value.value()))); + return Status::OK(); + } + Status Visit(const LargeBinaryType& type) { + google::protobuf::BytesValue value; + if (!user_defined_->value().UnpackTo(&value)) { + return Status::Invalid( + "Failed to unpack user defined large_binary literal to BytesValue"); + } + ARROW_ASSIGN_OR_RAISE(scalar_, + MakeScalar(type.GetSharedPtr(), std::string(value.value()))); + return Status::OK(); + } + Status operator()(const DataType& type) { return VisitTypeInline(type, this); } + + std::shared_ptr scalar_; + const substrait::Expression::Literal::UserDefined* user_defined_; + const ExtensionSet* ext_set_; + const ConversionOptions& conversion_options_; +}; +} // namespace + Result FromProto(const substrait::Expression::Literal& lit, const ExtensionSet& ext_set, const ConversionOptions& conversion_options) { @@ -455,6 +541,7 @@ Result FromProto(const substrait::Expression::Literal& lit, case substrait::Expression::Literal::kBinary: return Datum(BinaryScalar(lit.binary())); + ARROW_SUPPRESS_DEPRECATION_WARNING case substrait::Expression::Literal::kTimestamp: return Datum( TimestampScalar(static_cast(lit.timestamp()), TimeUnit::MICRO)); @@ -462,7 +549,17 @@ Result FromProto(const substrait::Expression::Literal& lit, case substrait::Expression::Literal::kTimestampTz: return Datum(TimestampScalar(static_cast(lit.timestamp_tz()), TimeUnit::MICRO, TimestampTzTimezoneString())); - + ARROW_UNSUPPRESS_DEPRECATION_WARNING + case substrait::Expression::Literal::kPrecisionTimestamp: { + // https://github.com/substrait-io/substrait/issues/611 + // TODO(GH-40741) don't break, return precision timestamp + break; + } + case substrait::Expression::Literal::kPrecisionTimestampTz: { + // https://github.com/substrait-io/substrait/issues/611 + // TODO(GH-40741) don't break, return precision timestamp + break; + } case substrait::Expression::Literal::kDate: return Datum(Date32Scalar(lit.date())); case substrait::Expression::Literal::kTime: @@ -674,18 +771,30 @@ Result FromProto(const substrait::Expression::Literal& lit, return Datum(MakeNullScalar(std::move(type_nullable.first))); } + case substrait::Expression::Literal::kUserDefined: { + const auto& user_defined = lit.user_defined(); + ARROW_ASSIGN_OR_RAISE(auto type_record, + ext_set.DecodeType(user_defined.type_reference())); + UserDefinedLiteralToArrow visitor{nullptr, &user_defined, &ext_set, + conversion_options}; + ARROW_RETURN_NOT_OK((visitor)(*type_record.type)); + return Datum(std::move(visitor.scalar_)); + } + + case substrait::Expression::Literal::LITERAL_TYPE_NOT_SET: + return Status::Invalid("substrait literal did not have any literal type set"); + default: break; } - return Status::NotImplemented("conversion to arrow::Datum from Substrait literal ", - lit.DebugString()); + return Status::NotImplemented("conversion to arrow::Datum from Substrait literal `", + lit.DebugString(), "`"); } namespace { -struct ScalarToProtoImpl { - Status Visit(const NullScalar& s) { return NotImplemented(s); } +struct ScalarToProtoImpl { using Lit = substrait::Expression::Literal; template @@ -702,6 +811,25 @@ struct ScalarToProtoImpl { return Status::OK(); } + Status EncodeUserDefined(const DataType& data_type, + const google::protobuf::Message& value) { + ARROW_ASSIGN_OR_RAISE(auto anchor, ext_set_->EncodeType(data_type)); + auto user_defined = std::make_unique(); + user_defined->set_type_reference(anchor); + auto value_any = std::make_unique(); + value_any->PackFrom(value); + user_defined->set_allocated_value(value_any.release()); + lit_->set_allocated_user_defined(user_defined.release()); + return Status::OK(); + } + + Status Visit(const NullScalar& s) { + ARROW_ASSIGN_OR_RAISE(auto anchor, ext_set_->EncodeType(*s.type)); + auto user_defined = std::make_unique(); + user_defined->set_type_reference(anchor); + lit_->set_allocated_user_defined(user_defined.release()); + return Status::OK(); + } Status Visit(const BooleanScalar& s) { return Primitive(&Lit::set_boolean, s); } Status Visit(const Int8Scalar& s) { return Primitive(&Lit::set_i8, s); } @@ -709,12 +837,31 @@ struct ScalarToProtoImpl { Status Visit(const Int32Scalar& s) { return Primitive(&Lit::set_i32, s); } Status Visit(const Int64Scalar& s) { return Primitive(&Lit::set_i64, s); } - Status Visit(const UInt8Scalar& s) { return NotImplemented(s); } - Status Visit(const UInt16Scalar& s) { return NotImplemented(s); } - Status Visit(const UInt32Scalar& s) { return NotImplemented(s); } - Status Visit(const UInt64Scalar& s) { return NotImplemented(s); } - - Status Visit(const HalfFloatScalar& s) { return NotImplemented(s); } + Status Visit(const UInt8Scalar& s) { + google::protobuf::UInt64Value value; + value.set_value(s.value); + return EncodeUserDefined(*s.type, value); + } + Status Visit(const UInt16Scalar& s) { + google::protobuf::UInt64Value value; + value.set_value(s.value); + return EncodeUserDefined(*s.type, value); + } + Status Visit(const UInt32Scalar& s) { + google::protobuf::UInt64Value value; + value.set_value(s.value); + return EncodeUserDefined(*s.type, value); + } + Status Visit(const UInt64Scalar& s) { + google::protobuf::UInt64Value value; + value.set_value(s.value); + return EncodeUserDefined(*s.type, value); + } + Status Visit(const HalfFloatScalar& s) { + google::protobuf::UInt32Value value; + value.set_value(s.value); + return EncodeUserDefined(*s.type, value); + } Status Visit(const FloatScalar& s) { return Primitive(&Lit::set_fp32, s); } Status Visit(const DoubleScalar& s) { return Primitive(&Lit::set_fp64, s); } @@ -722,12 +869,18 @@ struct ScalarToProtoImpl { return FromBuffer([](Lit* lit, std::string&& s) { lit->set_string(std::move(s)); }, s); } + Status Visit(const StringViewScalar& s) { + return FromBuffer([](Lit* lit, std::string&& s) { lit->set_string(std::move(s)); }, + s); + } Status Visit(const BinaryScalar& s) { return FromBuffer([](Lit* lit, std::string&& s) { lit->set_binary(std::move(s)); }, s); } - - Status Visit(const BinaryViewScalar& s) { return NotImplemented(s); } + Status Visit(const BinaryViewScalar& s) { + return FromBuffer([](Lit* lit, std::string&& s) { lit->set_binary(std::move(s)); }, + s); + } Status Visit(const FixedSizeBinaryScalar& s) { return FromBuffer( @@ -735,28 +888,64 @@ struct ScalarToProtoImpl { } Status Visit(const Date32Scalar& s) { return Primitive(&Lit::set_date, s); } - Status Visit(const Date64Scalar& s) { return NotImplemented(s); } + Status Visit(const Date64Scalar& s) { + google::protobuf::Int64Value value; + value.set_value(s.value); + return EncodeUserDefined(*s.type, value); + } Status Visit(const TimestampScalar& s) { const auto& t = checked_cast(*s.type); - if (t.unit() != TimeUnit::MICRO) return NotImplemented(s); + uint64_t micros; + switch (t.unit()) { + case TimeUnit::SECOND: + micros = s.value * kMicrosPerSecond; + break; + case TimeUnit::MILLI: + micros = s.value * kMicrosPerMilli; + break; + case TimeUnit::MICRO: + micros = s.value; + break; + case TimeUnit::NANO: + // TODO(GH-40741): can support nanos when + // https://github.com/substrait-io/substrait/issues/611 is resolved + return NotImplemented(s); + default: + return NotImplemented(s); + } - if (t.timezone() == "") return Primitive(&Lit::set_timestamp, s); + // Remove these and use precision timestamp once + // https://github.com/substrait-io/substrait/issues/611 is resolved + ARROW_SUPPRESS_DEPRECATION_WARNING - if (t.timezone() == TimestampTzTimezoneString()) { - return Primitive(&Lit::set_timestamp_tz, s); + if (t.timezone() == "") { + lit_->set_timestamp(micros); + } else { + // Some loss of info here, Substrait doesn't store timezone + // in field data + lit_->set_timestamp_tz(micros); } + ARROW_UNSUPPRESS_DEPRECATION_WARNING - return NotImplemented(s); + return Status::OK(); } - Status Visit(const Time32Scalar& s) { return NotImplemented(s); } + // Need to support parameterized UDTs + Status Visit(const Time32Scalar& s) { + google::protobuf::Int32Value value; + value.set_value(s.value); + return EncodeUserDefined(*s.type, value); + } Status Visit(const Time64Scalar& s) { - if (checked_cast(*s.type).unit() != TimeUnit::MICRO) { - return NotImplemented(s); + if (checked_cast(*s.type).unit() == TimeUnit::MICRO) { + return Primitive(&Lit::set_time, s); + } else { + google::protobuf::Int64Value value; + value.set_value(s.value); + return EncodeUserDefined(*s.type, value); } - return Primitive(&Lit::set_time, s); } Status Visit(const MonthIntervalScalar& s) { return NotImplemented(s); } @@ -778,9 +967,10 @@ struct ScalarToProtoImpl { return Status::OK(); } + // Need support for parameterized UDTs Status Visit(const Decimal256Scalar& s) { return NotImplemented(s); } - Status Visit(const ListScalar& s) { + Status Visit(const BaseListScalar& s) { if (s.value->length() == 0) { ARROW_ASSIGN_OR_RAISE(auto list_type, ToProto(*s.type, /*nullable=*/true, ext_set_, conversion_options_)); @@ -807,10 +997,6 @@ struct ScalarToProtoImpl { return Status::OK(); } - Status Visit(const ListViewScalar& s) { - return Status::NotImplemented("list-view to proto"); - } - Status Visit(const LargeListViewScalar& s) { return Status::NotImplemented("list-view to proto"); } @@ -830,7 +1016,10 @@ struct ScalarToProtoImpl { Status Visit(const SparseUnionScalar& s) { return NotImplemented(s); } Status Visit(const DenseUnionScalar& s) { return NotImplemented(s); } - Status Visit(const DictionaryScalar& s) { return NotImplemented(s); } + Status Visit(const DictionaryScalar& s) { + ARROW_ASSIGN_OR_RAISE(auto encoded, s.GetEncodedValue()); + return (*this)(*encoded); + } Status Visit(const MapScalar& s) { if (s.value->length() == 0) { @@ -914,10 +1103,21 @@ struct ScalarToProtoImpl { return NotImplemented(s); } + // Need support for parameterized UDTs Status Visit(const FixedSizeListScalar& s) { return NotImplemented(s); } Status Visit(const DurationScalar& s) { return NotImplemented(s); } - Status Visit(const LargeStringScalar& s) { return NotImplemented(s); } - Status Visit(const LargeBinaryScalar& s) { return NotImplemented(s); } + + Status Visit(const LargeStringScalar& s) { + google::protobuf::StringValue value; + value.set_value(s.view().data(), s.view().size()); + return EncodeUserDefined(*s.type, value); + } + Status Visit(const LargeBinaryScalar& s) { + google::protobuf::BytesValue value; + value.set_value(s.view().data(), s.view().size()); + return EncodeUserDefined(*s.type, value); + } + // Need support for parameterized UDTs Status Visit(const LargeListScalar& s) { return NotImplemented(s); } Status Visit(const MonthDayNanoIntervalScalar& s) { return NotImplemented(s); } diff --git a/cpp/src/arrow/engine/substrait/extension_set.cc b/cpp/src/arrow/engine/substrait/extension_set.cc index b0dd6aeffbcf..e955084dcdfb 100644 --- a/cpp/src/arrow/engine/substrait/extension_set.cc +++ b/cpp/src/arrow/engine/substrait/extension_set.cc @@ -1035,7 +1035,7 @@ struct DefaultExtensionIdRegistry : ExtensionIdRegistryImpl { }; // The type (variation) mappings listed below need to be kept in sync - // with the YAML at substrait/format/extension_types.yaml manually; + // with the YAML at format/substrait/extension_types.yaml manually; // see ARROW-15535. for (TypeName e : { TypeName{uint8(), "u8"}, @@ -1043,6 +1043,12 @@ struct DefaultExtensionIdRegistry : ExtensionIdRegistryImpl { TypeName{uint32(), "u32"}, TypeName{uint64(), "u64"}, TypeName{float16(), "fp16"}, + TypeName{large_utf8(), "large_string"}, + TypeName{large_binary(), "large_binary"}, + TypeName{time32(TimeUnit::SECOND), "time_seconds"}, + TypeName{time32(TimeUnit::MILLI), "time_millis"}, + TypeName{date64(), "date_millis"}, + TypeName{time64(TimeUnit::NANO), "time_nanos"}, }) { DCHECK_OK(RegisterType({kArrowExtTypesUri, e.name}, std::move(e.type))); } diff --git a/cpp/src/arrow/engine/substrait/extension_set.h b/cpp/src/arrow/engine/substrait/extension_set.h index 0a502960447e..c18e0cf77aae 100644 --- a/cpp/src/arrow/engine/substrait/extension_set.h +++ b/cpp/src/arrow/engine/substrait/extension_set.h @@ -295,6 +295,10 @@ class ARROW_ENGINE_EXPORT ExtensionIdRegistry { constexpr std::string_view kArrowExtTypesUri = "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/apache/arrow/blob/main/format/substrait/" "extension_types.yaml"; +// Extension types that don't match 1:1 with a data type (or the data type is +// parameterized) +constexpr std::string_view kTimeNanosTypeName = "time_nanos"; +constexpr Id kTimeNanosId = {kArrowExtTypesUri, kTimeNanosTypeName}; /// A default registry with all supported functions and data types registered /// diff --git a/cpp/src/arrow/engine/substrait/extension_types.cc b/cpp/src/arrow/engine/substrait/extension_types.cc index fcc722e9d941..f71b5f7185d0 100644 --- a/cpp/src/arrow/engine/substrait/extension_types.cc +++ b/cpp/src/arrow/engine/substrait/extension_types.cc @@ -22,6 +22,7 @@ #include #include "arrow/engine/simple_extension_type_internal.h" +#include "arrow/engine/substrait/type_internal.h" #include "arrow/result.h" #include "arrow/type_fwd.h" #include "arrow/util/reflection_internal.h" @@ -113,6 +114,36 @@ std::shared_ptr interval_year() { return IntervalYearType::Make({}); } std::shared_ptr interval_day() { return IntervalDayType::Make({}); } +Result> precision_timestamp(int precision) { + switch (precision) { + case 0: + return timestamp(TimeUnit::SECOND); + case 3: + return timestamp(TimeUnit::MILLI); + case 6: + return timestamp(TimeUnit::MICRO); + case 9: + return timestamp(TimeUnit::NANO); + default: + return Status::NotImplemented("Unrecognized timestamp precision (", precision, ")"); + } +} + +Result> precision_timestamp_tz(int precision) { + switch (precision) { + case 0: + return timestamp(TimeUnit::SECOND, TimestampTzTimezoneString()); + case 3: + return timestamp(TimeUnit::MILLI, TimestampTzTimezoneString()); + case 6: + return timestamp(TimeUnit::MICRO, TimestampTzTimezoneString()); + case 9: + return timestamp(TimeUnit::NANO, TimestampTzTimezoneString()); + default: + return Status::NotImplemented("Unrecognized timestamp precision (", precision, ")"); + } +} + bool UnwrapUuid(const DataType& t) { if (UuidType::GetIf(t)) { return true; diff --git a/cpp/src/arrow/engine/substrait/extension_types.h b/cpp/src/arrow/engine/substrait/extension_types.h index 28a4898a878d..ae71ad83f7e5 100644 --- a/cpp/src/arrow/engine/substrait/extension_types.h +++ b/cpp/src/arrow/engine/substrait/extension_types.h @@ -56,6 +56,16 @@ std::shared_ptr interval_year(); ARROW_ENGINE_EXPORT std::shared_ptr interval_day(); +/// constructs the appropriate timestamp type given the precision +/// no time zone +ARROW_ENGINE_EXPORT +Result> precision_timestamp(int precision); + +/// constructs the appropriate timestamp type given the precision +/// and the UTC time zone +ARROW_ENGINE_EXPORT +Result> precision_timestamp_tz(int precision); + /// Return true if t is Uuid, otherwise false ARROW_ENGINE_EXPORT bool UnwrapUuid(const DataType&); diff --git a/cpp/src/arrow/engine/substrait/serde_test.cc b/cpp/src/arrow/engine/substrait/serde_test.cc index 1e771ccdd25c..3e8019237793 100644 --- a/cpp/src/arrow/engine/substrait/serde_test.cc +++ b/cpp/src/arrow/engine/substrait/serde_test.cc @@ -54,6 +54,7 @@ #include "arrow/engine/substrait/options.h" #include "arrow/engine/substrait/serde.h" #include "arrow/engine/substrait/test_util.h" +#include "arrow/engine/substrait/type_internal.h" #include "arrow/engine/substrait/util.h" #include "arrow/filesystem/filesystem.h" #include "arrow/filesystem/localfs.h" @@ -299,6 +300,8 @@ TEST(Substrait, SupportedTypes) { map(utf8(), field("", utf8()), false)); } +// These types don't exist in Substrait. However, we have user defined types +// defined for them and they should be able to round-trip TEST(Substrait, SupportedExtensionTypes) { ExtensionSet ext_set; @@ -308,6 +311,12 @@ TEST(Substrait, SupportedExtensionTypes) { uint16(), uint32(), uint64(), + large_utf8(), + large_binary(), + date64(), + time32(TimeUnit::SECOND), + time32(TimeUnit::MILLI), + time64(TimeUnit::NANO), }) { auto anchor = ext_set.num_types(); @@ -332,6 +341,53 @@ TEST(Substrait, SupportedExtensionTypes) { } } +// Encodings are not considered distinct types in Substrait. The encoding information +// is lost during a round-trip. +TEST(Substrait, OneWayTypes) { + ExtensionSet ext_set; + + for (auto [source_type, return_type] : + {std::pair{binary_view(), binary()}, + {utf8_view(), utf8()}, + {dictionary(int32(), utf8()), utf8()}, + {run_end_encoded(int32(), int32()), int32()}, + {dictionary(int32(), dictionary(int32(), utf8())), utf8()}}) { + ASSERT_OK_AND_ASSIGN(auto substrait_type, SerializeType(*source_type, &ext_set, {})); + + ASSERT_OK_AND_ASSIGN(auto actual_return, + DeserializeType(*substrait_type, ext_set, {})); + + EXPECT_EQ(*actual_return, *return_type); + } +} + +// Substrait does not store the time zone as part of the type. That information is stored +// on the function instead. As a result, that information is lost on a round-trip. +TEST(Substrait, TimestampTypes) { + ExtensionSet ext_set; + + for (auto time_unit : + {TimeUnit::NANO, TimeUnit::MICRO, TimeUnit::MILLI, TimeUnit::SECOND}) { + for (auto time_zone : {"UTC", "America/New_York"}) { + auto input_type = timestamp(time_unit, time_zone); + ASSERT_OK_AND_ASSIGN(auto substrait_type, SerializeType(*input_type, &ext_set, {})); + + auto expected_return = timestamp(time_unit, TimestampTzTimezoneString()); + ASSERT_OK_AND_ASSIGN(auto actual_return, + DeserializeType(*substrait_type, ext_set, {})); + + EXPECT_EQ(*actual_return, *expected_return); + } + auto input_type = timestamp(time_unit); + ASSERT_OK_AND_ASSIGN(auto substrait_type, SerializeType(*input_type, &ext_set, {})); + + ASSERT_OK_AND_ASSIGN(auto actual_return, + DeserializeType(*substrait_type, ext_set, {})); + + EXPECT_EQ(*actual_return, *input_type); + } +} + TEST(Substrait, NamedStruct) { ExtensionSet ext_set; @@ -415,26 +471,11 @@ TEST(Substrait, NoEquivalentArrowType) { TEST(Substrait, NoEquivalentSubstraitType) { for (auto type : { - date64(), - timestamp(TimeUnit::SECOND), - timestamp(TimeUnit::NANO), - timestamp(TimeUnit::MICRO, "New York"), - time32(TimeUnit::SECOND), - time32(TimeUnit::MILLI), - time64(TimeUnit::NANO), - decimal256(76, 67), - sparse_union({field("i8", int8()), field("f32", float32())}), dense_union({field("i8", int8()), field("f32", float32())}), - dictionary(int32(), utf8()), - fixed_size_list(float16(), 3), - duration(TimeUnit::MICRO), - - large_utf8(), - large_binary(), large_list(utf8()), }) { ARROW_SCOPED_TRACE(type->ToString()); @@ -563,6 +604,56 @@ TEST(Substrait, SupportedLiterals) { } } +template +void CheckArrowSpecificLiteral(ScalarType scalar) { + compute::Expression lit = compute::literal(scalar); + ExtensionSet ext_set; + ASSERT_OK_AND_ASSIGN(auto serialized, SerializeExpression(lit, &ext_set)); + ASSERT_OK_AND_ASSIGN(auto roundtripped, DeserializeExpression(*serialized, ext_set)); + ASSERT_EQ(lit, roundtripped); +} + +TEST(Substrait, ArrowSpecificLiterals) { + CheckArrowSpecificLiteral(UInt8Scalar(7)); + CheckArrowSpecificLiteral(UInt16Scalar(7)); + CheckArrowSpecificLiteral(UInt32Scalar(7)); + CheckArrowSpecificLiteral(UInt64Scalar(7)); + CheckArrowSpecificLiteral(Date64Scalar(86400000)); + CheckArrowSpecificLiteral(Time64Scalar(7, TimeUnit::NANO)); + CheckArrowSpecificLiteral(Time32Scalar(7, TimeUnit::SECOND)); + CheckArrowSpecificLiteral(Time32Scalar(7, TimeUnit::MILLI)); + CheckArrowSpecificLiteral(Time32Scalar(7, TimeUnit::SECOND)); + // We serialize as a signed integer, which doesn't make sense for Time scalars but + // Arrow supports it so we might as well round-trip it. + CheckArrowSpecificLiteral(Time32Scalar(-7, TimeUnit::MILLI)); + CheckArrowSpecificLiteral(Time32Scalar(-7, TimeUnit::SECOND)); + CheckArrowSpecificLiteral(Time64Scalar(-7, TimeUnit::NANO)); + // Negative date scalars DO make sense and we should make sure they work + CheckArrowSpecificLiteral(Date64Scalar(-86400000)); + CheckArrowSpecificLiteral(HalfFloatScalar(0)); + CheckArrowSpecificLiteral(LargeStringScalar("hello")); + CheckArrowSpecificLiteral(LargeBinaryScalar("hello")); + CheckArrowSpecificLiteral(MakeNullScalar(null())); +} + +template +void CheckOneWayLiteral(SourceScalarType source, DestScalarType expected) { + compute::Expression lit = compute::literal(source); + ExtensionSet ext_set; + ASSERT_OK_AND_ASSIGN(auto serialized, SerializeExpression(lit, &ext_set)); + ASSERT_OK_AND_ASSIGN(auto roundtripped, DeserializeExpression(*serialized, ext_set)); + compute::Expression expected_lit = compute::literal(expected); + ASSERT_EQ(expected_lit, roundtripped); +} + +TEST(Substrait, OneWayLiterals) { + CheckOneWayLiteral(StringViewScalar("test"), StringScalar("test")); + CheckOneWayLiteral(BinaryViewScalar("test"), BinaryScalar("test")); + CheckOneWayLiteral(RunEndEncodedScalar(std::make_shared(7), + run_end_encoded(int16(), uint32())), + UInt32Scalar(7)); +} + TEST(Substrait, CannotDeserializeLiteral) { ExtensionSet ext_set; @@ -823,8 +914,8 @@ TEST(Substrait, Cast) { std::shared_ptr cast_opts = std::dynamic_pointer_cast(call_opts); ASSERT_TRUE(!!cast_opts); - // It is unclear whether a Substrait cast should be safe or not. In the meantime we are - // assuming it is unsafe based on the behavior of many SQL engines. + // It is unclear whether a Substrait cast should be safe or not. In the meantime we + // are assuming it is unsafe based on the behavior of many SQL engines. ASSERT_TRUE(cast_opts->allow_int_overflow); ASSERT_TRUE(cast_opts->allow_float_truncate); ASSERT_TRUE(cast_opts->allow_decimal_truncate); diff --git a/cpp/src/arrow/engine/substrait/type_internal.cc b/cpp/src/arrow/engine/substrait/type_internal.cc index f4a2e6800eb4..5e7e364fe00c 100644 --- a/cpp/src/arrow/engine/substrait/type_internal.cc +++ b/cpp/src/arrow/engine/substrait/type_internal.cc @@ -34,8 +34,13 @@ #include "arrow/status.h" #include "arrow/type.h" #include "arrow/type_fwd.h" +#include "arrow/type_traits.h" +#include "arrow/util/checked_cast.h" +#include "arrow/util/unreachable.h" #include "arrow/visit_type_inline.h" +using arrow::internal::checked_cast; + namespace arrow { namespace engine { @@ -121,11 +126,24 @@ Result, bool>> FromProto( case substrait::Type::kBinary: return FromProtoImpl(type.binary()); + ARROW_SUPPRESS_DEPRECATION_WARNING case substrait::Type::kTimestamp: return FromProtoImpl(type.timestamp(), TimeUnit::MICRO); case substrait::Type::kTimestampTz: return FromProtoImpl(type.timestamp_tz(), TimeUnit::MICRO, TimestampTzTimezoneString()); + ARROW_UNSUPPRESS_DEPRECATION_WARNING + case substrait::Type::kPrecisionTimestamp: { + ARROW_ASSIGN_OR_RAISE(std::shared_ptr ts_type, + precision_timestamp(type.precision_timestamp().precision())); + return std::make_pair(ts_type, IsNullable(type.precision_timestamp())); + } + case substrait::Type::kPrecisionTimestampTz: { + ARROW_ASSIGN_OR_RAISE( + std::shared_ptr ts_type, + precision_timestamp_tz(type.precision_timestamp_tz().precision())); + return std::make_pair(ts_type, IsNullable(type.precision_timestamp_tz())); + } case substrait::Type::kDate: return FromProtoImpl(type.date()); @@ -263,7 +281,14 @@ struct DataTypeToProtoImpl { return SetWith(&substrait::Type::set_allocated_binary); } - Status Visit(const BinaryViewType& t) { return NotImplemented(t); } + // From Substrait's point of view the view types are encodings, and an execution detail, + // and not distinct from the non-view type. + Status Visit(const BinaryViewType& t) { + return SetWith(&substrait::Type::set_allocated_binary); + } + Status Visit(const StringViewType& t) { + return SetWith(&substrait::Type::set_allocated_string); + } Status Visit(const FixedSizeBinaryType& t) { SetWithThen(&substrait::Type::set_allocated_fixed_binary)->set_length(t.byte_width()); @@ -273,25 +298,50 @@ struct DataTypeToProtoImpl { Status Visit(const Date32Type& t) { return SetWith(&substrait::Type::set_allocated_date); } - Status Visit(const Date64Type& t) { return NotImplemented(t); } + Status Visit(const Date64Type& t) { return EncodeUserDefined(t); } - Status Visit(const TimestampType& t) { - if (t.unit() != TimeUnit::MICRO) return NotImplemented(t); + template + Status VisitTimestamp(const TimestampType& t, + void (substrait::Type::*set_allocated_sub)(Sub*)) { + auto ts = SetWithThen(set_allocated_sub); + switch (t.unit()) { + case TimeUnit::SECOND: + ts->set_precision(0); + break; + case TimeUnit::MILLI: + ts->set_precision(3); + break; + case TimeUnit::MICRO: + ts->set_precision(6); + break; + case TimeUnit::NANO: + ts->set_precision(9); + break; + default: + return NotImplemented(t); + } + return Status::OK(); + } + Status Visit(const TimestampType& t) { if (t.timezone() == "") { - return SetWith(&substrait::Type::set_allocated_timestamp); - } - if (t.timezone() == TimestampTzTimezoneString()) { - return SetWith(&substrait::Type::set_allocated_timestamp_tz); + return VisitTimestamp(t, &substrait::Type::set_allocated_precision_timestamp); + } else { + // Note: The timezone information is discarded here. In Substrait the time zone + // information is part of the function and not part of the type. For example, to + // convert a timestamp to a string, the time zone is passed as an argument to the + // function. + return VisitTimestamp(t, &substrait::Type::set_allocated_precision_timestamp_tz); } - - return NotImplemented(t); } - Status Visit(const Time32Type& t) { return NotImplemented(t); } + Status Visit(const Time32Type& t) { return EncodeUserDefined(t); } Status Visit(const Time64Type& t) { - if (t.unit() != TimeUnit::MICRO) return NotImplemented(t); - return SetWith(&substrait::Type::set_allocated_time); + if (t.unit() == TimeUnit::MICRO) { + return SetWith(&substrait::Type::set_allocated_time); + } else { + return EncodeUserDefined(t); + } } Status Visit(const MonthIntervalType& t) { return EncodeUserDefined(t); } @@ -303,6 +353,7 @@ struct DataTypeToProtoImpl { dec->set_scale(t.scale()); return Status::OK(); } + // TODO(GH-40740) support parameterized UDT Status Visit(const Decimal256Type& t) { return NotImplemented(t); } Status Visit(const ListType& t) { @@ -313,8 +364,16 @@ struct DataTypeToProtoImpl { return Status::OK(); } - Status Visit(const ListViewType& t) { return NotImplemented(t); } + // From Substrait's point of view this is an encoding, and an implementation detail, + // and not distinct from the list type. + Status Visit(const ListViewType& t) { + ARROW_ASSIGN_OR_RAISE(auto type, ToProto(*t.value_type(), t.value_field()->nullable(), + ext_set_, conversion_options_)); + SetWithThen(&substrait::Type::set_allocated_list)->set_allocated_type(type.release()); + return Status::OK(); + } + // TODO(GH-40740) support parameterized UDT Status Visit(const LargeListViewType& t) { return NotImplemented(t); } Status Visit(const StructType& t) { @@ -335,8 +394,9 @@ struct DataTypeToProtoImpl { Status Visit(const SparseUnionType& t) { return NotImplemented(t); } Status Visit(const DenseUnionType& t) { return NotImplemented(t); } - Status Visit(const DictionaryType& t) { return NotImplemented(t); } - Status Visit(const RunEndEncodedType& t) { return NotImplemented(t); } + // The caller should have unwrapped the dictionary / RLE type + Status Visit(const DictionaryType& t) { Unreachable(); } + Status Visit(const RunEndEncodedType& t) { Unreachable(); } Status Visit(const MapType& t) { // FIXME assert default field names; custom ones won't roundtrip @@ -379,10 +439,13 @@ struct DataTypeToProtoImpl { return NotImplemented(t); } + // TODO(GH-40740) support parameterized UDT Status Visit(const FixedSizeListType& t) { return NotImplemented(t); } + // TODO(GH-40740) support parameterized UDT Status Visit(const DurationType& t) { return NotImplemented(t); } - Status Visit(const LargeStringType& t) { return NotImplemented(t); } - Status Visit(const LargeBinaryType& t) { return NotImplemented(t); } + Status Visit(const LargeStringType& t) { return EncodeUserDefined(t); } + Status Visit(const LargeBinaryType& t) { return EncodeUserDefined(t); } + // TODO(GH-40740) support parameterized UDT Status Visit(const LargeListType& t) { return NotImplemented(t); } Status Visit(const MonthDayNanoIntervalType& t) { return EncodeUserDefined(t); } @@ -429,6 +492,17 @@ struct DataTypeToProtoImpl { Result> ToProto( const DataType& type, bool nullable, ExtensionSet* ext_set, const ConversionOptions& conversion_options) { + // From Substrait's perspective the "dictionary type" is just an encoding. As a result, + // we lose that information on conversion and just convert the value type. + if (type.id() == Type::DICTIONARY) { + const auto& dict_type = checked_cast(type); + return ToProto(*dict_type.value_type(), nullable, ext_set, conversion_options); + } + // Ditto for REE + if (type.id() == Type::RUN_END_ENCODED) { + const auto& ree_type = checked_cast(type); + return ToProto(*ree_type.value_type(), nullable, ext_set, conversion_options); + } auto out = std::make_unique(); RETURN_NOT_OK( (DataTypeToProtoImpl{out.get(), nullable, ext_set, conversion_options})(type)); diff --git a/cpp/src/arrow/engine/substrait/util.h b/cpp/src/arrow/engine/substrait/util.h index 5128ec44bff7..bef2a6c7e182 100644 --- a/cpp/src/arrow/engine/substrait/util.h +++ b/cpp/src/arrow/engine/substrait/util.h @@ -70,7 +70,7 @@ ARROW_ENGINE_EXPORT const std::string& default_extension_types_uri(); // TODO(ARROW-18145) Populate these from cmake files constexpr uint32_t kSubstraitMajorVersion = 0; -constexpr uint32_t kSubstraitMinorVersion = 27; +constexpr uint32_t kSubstraitMinorVersion = 44; constexpr uint32_t kSubstraitPatchVersion = 0; constexpr uint32_t kSubstraitMinimumMajorVersion = 0; diff --git a/cpp/thirdparty/versions.txt b/cpp/thirdparty/versions.txt index 4093b0ec43ef..4983f3cee2c2 100644 --- a/cpp/thirdparty/versions.txt +++ b/cpp/thirdparty/versions.txt @@ -103,8 +103,8 @@ ARROW_RE2_BUILD_VERSION=2022-06-01 ARROW_RE2_BUILD_SHA256_CHECKSUM=f89c61410a072e5cbcf8c27e3a778da7d6fd2f2b5b1445cd4f4508bee946ab0f ARROW_SNAPPY_BUILD_VERSION=1.1.10 ARROW_SNAPPY_BUILD_SHA256_CHECKSUM=49d831bffcc5f3d01482340fe5af59852ca2fe76c3e05df0e67203ebbe0f1d90 -ARROW_SUBSTRAIT_BUILD_VERSION=v0.27.0 -ARROW_SUBSTRAIT_BUILD_SHA256_CHECKSUM=4ed375f69d972a57fdc5ec406c17003a111831d8640d3f1733eccd4b3ff45628 +ARROW_SUBSTRAIT_BUILD_VERSION=v0.44.0 +ARROW_SUBSTRAIT_BUILD_SHA256_CHECKSUM=f989a862f694e7dbb695925ddb7c4ce06aa6c51aca945105c075139aed7e55a2 ARROW_S2N_TLS_BUILD_VERSION=v1.3.35 ARROW_S2N_TLS_BUILD_SHA256_CHECKSUM=9d32b26e6bfcc058d98248bf8fc231537e347395dd89cf62bb432b55c5da990d ARROW_THRIFT_BUILD_VERSION=0.16.0 diff --git a/format/substrait/extension_types.yaml b/format/substrait/extension_types.yaml index 888d6c94c818..0073da1acc1e 100644 --- a/format/substrait/extension_types.yaml +++ b/format/substrait/extension_types.yaml @@ -35,36 +35,52 @@ # - interval # - arrow::ExtensionTypes # -# Note that not all of these are currently implemented. In particular, these -# extension types are currently not parameterizable in Substrait, which means -# among other things that we can't declare dictionary type here at all since -# we'd have to declare a different dictionary type for all encoded types -# (but that is an infinite space). Similarly, we would have to declare a -# timestamp variation for all possible timezone strings. +# These types fall into several categories of behavior: -type_variations: - - parent: i8 - name: u8 - description: an unsigned 8 bit integer - functions: SEPARATE - - parent: i16 - name: u16 - description: an unsigned 16 bit integer - functions: SEPARATE - - parent: i32 - name: u32 - description: an unsigned 32 bit integer - functions: SEPARATE - - parent: i64 - name: u64 - description: an unsigned 64 bit integer - functions: SEPARATE +# Certain Arrow data types are, from Substrait's point of view, encodings. +# These include dictionary, the view types (e.g. binary view, list view), +# and REE. +# +# These types are not logically distinct from the type they are encoding. +# Specifically, the types meet the following criteria: +# * There is no value in the decoded type that cannot be represented +# as a value in the encoded type and vice versa. +# * Functions have the same meaning when applied to the encoded type +# +# Note: if two types have a different range (e.g. string and large_string) then +# they do not satisfy the above criteria and are not encodings. +# +# These types will never have a Substrait equivalent. In the Substrait point +# of view these are execution details. + +# The following types are encodings: + +# binary_view +# list_view +# dictionary +# ree + +# Arrow-cpp's Substrait serde does not yet handle parameterized UDTs. This means +# the following types are not yet supported but may be supported in the future. +# We define them below in case other implementations support them in the meantime. - - parent: i16 - name: fp16 - description: a 16 bit floating point number - functions: SEPARATE +# decimal256 +# large_list +# fixed_size_list +# duration +# Other types are not encodings, but are not first-class in Substrait. These +# types are often similar to existing Substrait types but define a different range +# of values. For example, unsigned integer types are very similar to their integer +# counterparts, but have a different range of values. These types are defined here +# as extension types. +# +# A full description of the types, along with their specified range, can be found +# in Schema.fbs +# +# Consumers should take care when supporting the below types. Should Substrait decide +# later to support these types, the consumer will need to make sure to continue supporting +# the extension type names as aliases for proper backwards compatibility. types: - name: "null" structure: {} @@ -80,3 +96,75 @@ types: months: i32 days: i32 nanos: i64 + # All unsigned integer literals are encoded as user defined literals with + # a google.protobuf.UInt64Value message. + - name: u8 + structure: {} + - name: u16 + structure: {} + - name: u32 + structure: {} + - name: u64 + structure: {} + # fp16 literals are encoded as user defined literals with + # a google.protobuf.UInt32Value message where the lower 16 bits are + # the fp16 value. + - name: fp16 + structure: {} + # 64-bit integers are big. Even though date64 stores ms and not days it + # can still represent about 50x more dates than date32. Since it has a + # different range of values, it is an extension type. + # + # date64 literals are encoded as user defined literals with + # a google.protobuf.Int64Value message. + - name: date_millis + structure: {} + # time literals are encoded as user defined literals with + # a google.protobuf.Int32Value message (for time_seconds/time_millis) + # or a google.protobuf.Int64Value message (for time_nanos). + - name: time_seconds + structure: {} + - name: time_millis + structure: {} + - name: time_nanos + structure: {} + # Large string literals are encoded using a + # google.protobuf.StringValue message. + - name: large_string + structure: {} + # Large binary literals are encoded using a + # google.protobuf.BytesValue message. + - name: large_binary + structure: {} + # We cannot generate these today because they are parameterized UDTs and + # substrait-cpp does not yet support parameterized UDTs. + - name: decimal256 + structure: {} + parameters: + - name: precision + type: integer + min: 0 + max: 76 + - name: scale + type: integer + min: 0 + max: 76 + - name: large_list + structure: {} + parameters: + - name: value_type + type: dataType + - name: fixed_size_list + structure: {} + parameters: + - name: value_type + type: dataType + - name: dimension + type: integer + min: 0 + - name: duration + structure: {} + parameters: + - name: unit + type: string + diff --git a/python/pyarrow/tests/test_substrait.py b/python/pyarrow/tests/test_substrait.py index d4fbfb740683..40700e474132 100644 --- a/python/pyarrow/tests/test_substrait.py +++ b/python/pyarrow/tests/test_substrait.py @@ -944,6 +944,54 @@ def test_serializing_expressions(expr): assert "test_expr" in returned.expressions +def test_arrow_specific_types(): + fields = { + "time_seconds": (pa.time32("s"), 0), + "time_millis": (pa.time32("ms"), 0), + "time_nanos": (pa.time64("ns"), 0), + "date_millis": (pa.date64(), 0), + "large_string": (pa.large_string(), "test_string"), + "large_binary": (pa.large_binary(), b"test_string"), + } + schema = pa.schema([pa.field(name, typ) for name, (typ, _) in fields.items()]) + + def check_round_trip(expr): + buf = pa.substrait.serialize_expressions([expr], ["test_expr"], schema) + returned = pa.substrait.deserialize_expressions(buf) + assert schema == returned.schema + + for name, (typ, val) in fields.items(): + check_round_trip(pc.field(name) == pa.scalar(val, type=typ)) + + +def test_arrow_one_way_types(): + schema = pa.schema( + [ + pa.field("binary_view", pa.binary_view()), + pa.field("string_view", pa.string_view()), + pa.field("dictionary", pa.dictionary(pa.int32(), pa.string())), + pa.field("ree", pa.run_end_encoded(pa.int32(), pa.string())), + ] + ) + alt_schema = pa.schema( + [ + pa.field("binary_view", pa.binary()), + pa.field("string_view", pa.string()), + pa.field("dictionary", pa.string()), + pa.field("ree", pa.string()) + ] + ) + + def check_one_way(field): + expr = pc.is_null(pc.field(field.name)) + buf = pa.substrait.serialize_expressions([expr], ["test_expr"], schema) + returned = pa.substrait.deserialize_expressions(buf) + assert alt_schema == returned.schema + + for field in schema: + check_one_way(field) + + def test_invalid_expression_ser_des(): schema = pa.schema([ pa.field("x", pa.int32()), From bcde34aead04be84e09afe7d4974e5fb2e1e3068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Thu, 11 Apr 2024 11:06:23 +0200 Subject: [PATCH 12/32] Temporary update Azure CI workflow to use Jinja macro --- dev/tasks/docker-tests/azure.linux.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/dev/tasks/docker-tests/azure.linux.yml b/dev/tasks/docker-tests/azure.linux.yml index b66bfbdfe940..a2c49d9f296f 100644 --- a/dev/tasks/docker-tests/azure.linux.yml +++ b/dev/tasks/docker-tests/azure.linux.yml @@ -34,13 +34,7 @@ jobs: inputs: versionSpec: '3.8' - - script: | - git clone --no-checkout {{ arrow.remote }} arrow - git -C arrow fetch -t {{ arrow.remote }} {{ arrow.branch }} - git -C arrow checkout FETCH_HEAD - git -C arrow submodule update --init --recursive - git -C arrow remote add upstream https://github.com/apache/arrow.git - displayName: Clone arrow + {{ macros.azure_checkout_arrow() }} - script: pip install -e arrow/dev/archery[docker] displayName: Setup Archery From 84cd4933ad6853b254786b9c911feb43ca27376d Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Thu, 11 Apr 2024 16:01:38 +0200 Subject: [PATCH 13/32] GH-41147: [CI][C++] Use newer LLVM on Ubuntu 24.04 (#41150) ### What changes are included in this PR? Use LLVM 15 on Ubuntu 24.04, as LLVM 14 packages seem not always available. ### Are these changes tested? Yes, on CI. ### Are there any user-facing changes? No. * GitHub Issue: #41147 Authored-by: Antoine Pitrou Signed-off-by: Antoine Pitrou --- ci/docker/ubuntu-24.04-cpp.dockerfile | 4 ++-- dev/tasks/tasks.yml | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ci/docker/ubuntu-24.04-cpp.dockerfile b/ci/docker/ubuntu-24.04-cpp.dockerfile index 629d532a3dc7..4a37818f9439 100644 --- a/ci/docker/ubuntu-24.04-cpp.dockerfile +++ b/ci/docker/ubuntu-24.04-cpp.dockerfile @@ -29,7 +29,7 @@ RUN echo "debconf debconf/frontend select Noninteractive" | \ # while debugging package list with docker build. ARG clang_tools ARG llvm -RUN latest_system_llvm=14 && \ +RUN latest_system_llvm=18 && \ if [ ${llvm} -gt ${latest_system_llvm} -o \ ${clang_tools} -gt ${latest_system_llvm} ]; then \ apt-get update -y -q && \ @@ -127,7 +127,7 @@ RUN if [ "${gcc_version}" = "" ]; then \ g++ \ gcc; \ else \ - if [ "${gcc_version}" -gt "12" ]; then \ + if [ "${gcc_version}" -gt "14" ]; then \ apt-get update -y -q && \ apt-get install -y -q --no-install-recommends software-properties-common && \ add-apt-repository ppa:ubuntu-toolchain-r/volatile; \ diff --git a/dev/tasks/tasks.yml b/dev/tasks/tasks.yml index fc8d03b3d5bf..9a93faefdf74 100644 --- a/dev/tasks/tasks.yml +++ b/dev/tasks/tasks.yml @@ -1055,7 +1055,7 @@ tasks: params: image: conda-cpp-valgrind -{% for ubuntu_version in ["20.04", "22.04", "24.04"] %} +{% for ubuntu_version in ["20.04", "22.04"] %} test-ubuntu-{{ ubuntu_version }}-cpp: ci: github template: docker-tests/github.linux.yml @@ -1073,13 +1073,25 @@ tasks: UBUNTU: 20.04 image: ubuntu-cpp-bundled + test-ubuntu-24.04-cpp: + ci: github + template: docker-tests/github.linux.yml + params: + env: + CLANG_TOOLS: 15 + LLVM: 15 + UBUNTU: 24.04 + image: ubuntu-cpp + test-ubuntu-24.04-cpp-gcc-14: ci: github template: docker-tests/github.linux.yml params: env: - UBUNTU: "24.04" + CLANG_TOOLS: 15 GCC_VERSION: 14 + LLVM: 15 + UBUNTU: 24.04 # rapidjson 1.1.0 has an error caught by gcc 14. # https://github.com/Tencent/rapidjson/issues/718 flags: -e CC=gcc-14 -e CXX=g++-14 -e RapidJSON_SOURCE=BUNDLED From a2c5a9a4bd474d2608bfccd5392bf5ea822f5caf Mon Sep 17 00:00:00 2001 From: Weston Pace Date: Thu, 11 Apr 2024 08:05:54 -0700 Subject: [PATCH 14/32] GH-41145: [R][CI] test-r-dev-duckdb fails installing duckdb (#41152) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Rationale for this change An error is received installing R duckdb: ``` #15 18.13 > remotes::install_github('duckdb/duckdb-r', build = FALSE) #15 18.27 Error: Failed to install 'unknown package' from **GitHub:** #15 18.27 Line starting 'Roxyg ...' is malformed! ``` Some searching seems to suggest that this is because R cannot process UTF-8 characters in DESCRIPTION files if the `LANG` is set to `C`. ### What changes are included in this PR? The `LANG` is set to `C.UTF-8` in the dockerfile for this CI job ### Are these changes tested? The change only affects a test ### Are there any user-facing changes? No * GitHub Issue: #41145 Authored-by: Weston Pace Signed-off-by: Raúl Cumplido --- ci/docker/linux-apt-r.dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ci/docker/linux-apt-r.dockerfile b/ci/docker/linux-apt-r.dockerfile index c59766c4a665..d93732abb003 100644 --- a/ci/docker/linux-apt-r.dockerfile +++ b/ci/docker/linux-apt-r.dockerfile @@ -27,6 +27,11 @@ ENV R_PRUNE_DEPS=${r_prune_deps} ARG r_duckdb_dev=FALSE ENV R_DUCKDB_DEV=${r_duckdb_dev} +# This is needed to avoid errors with utf8 characters in some +# R package's DESCRIPTION files +# https://github.com/statnmap/HatchedPolygons/issues/4 +ENV LANG=C.UTF-8 + # Build R # [1] https://www.digitalocean.com/community/tutorials/how-to-install-r-on-ubuntu-18-04 # [2] https://linuxize.com/post/how-to-install-r-on-ubuntu-18-04/#installing-r-packages-from-cran From 0f339546176e901c3d30a2dea042704ccb834d18 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Thu, 11 Apr 2024 19:44:47 +0200 Subject: [PATCH 15/32] GH-41154: [C++] Fix Valgrind error in string-to-float16 conversion (#41155) ### Rationale for this change Only do the final conversion to float16 on success, to avoid conditional jump on uninitialized values. Note: this is a benign error. But we want our Valgrind CI job to be as successful as possible. ### Are these changes tested? Yes, on CI. ### Are there any user-facing changes? No. * GitHub Issue: #41154 Authored-by: Antoine Pitrou Signed-off-by: Antoine Pitrou --- cpp/src/arrow/util/value_parsing.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cpp/src/arrow/util/value_parsing.cc b/cpp/src/arrow/util/value_parsing.cc index e84aac995e35..8cecc6365a3b 100644 --- a/cpp/src/arrow/util/value_parsing.cc +++ b/cpp/src/arrow/util/value_parsing.cc @@ -53,8 +53,11 @@ bool StringToFloat(const char* s, size_t length, char decimal_point, uint16_t* o float temp_out; const auto res = ::arrow_vendored::fast_float::from_chars_advanced(s, s + length, temp_out, options); - *out = Float16::FromFloat(temp_out).bits(); - return res.ec == std::errc() && res.ptr == s + length; + const bool ok = res.ec == std::errc() && res.ptr == s + length; + if (ok) { + *out = Float16::FromFloat(temp_out).bits(); + } + return ok; } // ---------------------------------------------------------------------- From ba851251cac75373707adfbd78549b56b75e106b Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Fri, 12 Apr 2024 09:15:45 +0900 Subject: [PATCH 16/32] GH-41127: [CI] Use GitHub Actions instead of Azure Pipelines for docker-tests (#41153) We don't want to maintain multiple CI platforms to reduce maintenance cost. Use GitHub Actions for docker-tests. Yes. No. * GitHub Issue: #41127 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- dev/tasks/docker-tests/azure.linux.yml | 61 ------------------------- dev/tasks/docker-tests/circle.linux.yml | 51 --------------------- dev/tasks/tasks.yml | 33 +++++++------ 3 files changed, 16 insertions(+), 129 deletions(-) delete mode 100644 dev/tasks/docker-tests/azure.linux.yml delete mode 100644 dev/tasks/docker-tests/circle.linux.yml diff --git a/dev/tasks/docker-tests/azure.linux.yml b/dev/tasks/docker-tests/azure.linux.yml deleted file mode 100644 index a2c49d9f296f..000000000000 --- a/dev/tasks/docker-tests/azure.linux.yml +++ /dev/null @@ -1,61 +0,0 @@ -# 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. - -{% import 'macros.jinja' as macros with context %} - -jobs: -- job: linux - pool: - vmImage: ubuntu-latest - timeoutInMinutes: 360 - {% if env is defined %} - variables: - {% for key, value in env.items() %} - {{ key }}: {{ value }} - {% endfor %} - {% endif %} - - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.8' - - {{ macros.azure_checkout_arrow() }} - - - script: pip install -e arrow/dev/archery[docker] - displayName: Setup Archery - - - script: | - archery --debug docker --using-docker-cli run \ - -e ARROW_DOCS_VERSION="{{ arrow.no_rc_version }}" \ - -e SETUPTOOLS_SCM_PRETEND_VERSION="{{ arrow.no_rc_version }}" \ - {{ flags|default("") }} \ - {{ image }} \ - {{ command|default("") }} - displayName: Execute Docker Build - env: - {{ macros.azure_set_sccache_envvars()|indent(4) }} - - {% if post_script is defined %} - - script: | - {{ post_script|indent(6) }} - displayName: Post Script - {% endif %} - - {% if artifacts is defined %} - {{ macros.azure_upload_releases(artifacts) }} - {% endif %} diff --git a/dev/tasks/docker-tests/circle.linux.yml b/dev/tasks/docker-tests/circle.linux.yml deleted file mode 100644 index faad449c8ef8..000000000000 --- a/dev/tasks/docker-tests/circle.linux.yml +++ /dev/null @@ -1,51 +0,0 @@ -# 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. - -version: 2 -jobs: - build: - machine: - image: ubuntu-1604:202004-01 - {%- if env is defined %} - environment: - {%- for key, value in env.items() %} - {{ key }}: {{ value }} - {%- endfor %} - {%- endif %} - steps: - - run: | - docker -v - docker-compose -v - - run: | - git clone --no-checkout {{ arrow.remote }} arrow - git -C arrow fetch -t {{ arrow.remote }} {{ arrow.branch }} - git -C arrow checkout FETCH_HEAD - git -C arrow submodule update --init --recursive - - run: - name: Execute Docker Build - command: | - pyenv versions - pyenv global 3.8.12 - pip install -e arrow/dev/archery[docker] - archery docker run -e SETUPTOOLS_SCM_PRETEND_VERSION="{{ arrow.no_rc_version }}" {{ run }} - no_output_timeout: "1h" - -workflows: - version: 2 - build: - jobs: - - build diff --git a/dev/tasks/tasks.yml b/dev/tasks/tasks.yml index 9a93faefdf74..ed49d55c92fe 100644 --- a/dev/tasks/tasks.yml +++ b/dev/tasks/tasks.yml @@ -1048,10 +1048,9 @@ tasks: image: {{ image }} {% endfor %} - # Use azure to run valgrind tests to prevent OOM test-conda-cpp-valgrind: - ci: azure - template: docker-tests/azure.linux.yml + ci: github + template: docker-tests/github.linux.yml params: image: conda-cpp-valgrind @@ -1226,8 +1225,8 @@ tasks: image: conda-python-cython2 test-debian-12-python-3-amd64: - ci: azure - template: docker-tests/azure.linux.yml + ci: github + template: docker-tests/github.linux.yml params: env: DEBIAN: 12 @@ -1244,8 +1243,8 @@ tasks: image: debian-python test-ubuntu-20.04-python-3: - ci: azure - template: docker-tests/azure.linux.yml + ci: github + template: docker-tests/github.linux.yml params: env: UBUNTU: 20.04 @@ -1260,16 +1259,16 @@ tasks: image: ubuntu-python test-fedora-39-python-3: - ci: azure - template: docker-tests/azure.linux.yml + ci: github + template: docker-tests/github.linux.yml params: env: FEDORA: 39 image: fedora-python test-r-linux-valgrind: - ci: azure - template: docker-tests/azure.linux.yml + ci: github + template: docker-tests/github.linux.yml params: env: ARROW_R_DEV: "TRUE" @@ -1430,16 +1429,16 @@ tasks: flags: "-e LIBARROW_MINIMAL=TRUE" test-ubuntu-r-sanitizer: - ci: azure - template: docker-tests/azure.linux.yml + ci: github + template: docker-tests/github.linux.yml params: env: R_PRUNE_DEPS: TRUE image: ubuntu-r-sanitizer test-fedora-r-clang-sanitizer: - ci: azure - template: docker-tests/azure.linux.yml + ci: github + template: docker-tests/github.linux.yml params: env: R_PRUNE_DEPS: TRUE @@ -1447,8 +1446,8 @@ tasks: {% for go_version, staticcheck in [("1.21", "v0.4.7"), ("1.22", "latest")] %} test-debian-12-go-{{ go_version }}: - ci: azure - template: docker-tests/azure.linux.yml + ci: github + template: docker-tests/github.linux.yml params: env: DEBIAN: 12 From 3856bddfa75e95e8bc3fd642ee25ed40ab76ea84 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Fri, 12 Apr 2024 11:37:32 +0900 Subject: [PATCH 17/32] GH-41004: [C++][FS][Azure] Don't run TestGetFileInfoGenerator() with Valgrind (#41163) ### Rationale for this change `GetFileInfo()` with generator reports false positive memory leak in Azure SDK for C++. ### What changes are included in this PR? Don't run `TestGetFileInfoGenerator()` with Valgrind. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #41004 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- cpp/src/arrow/filesystem/test_util.cc | 3 ++- cpp/src/arrow/util/config.h.cmake | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cpp/src/arrow/filesystem/test_util.cc b/cpp/src/arrow/filesystem/test_util.cc index 19226ce01ae2..accb7a47ab01 100644 --- a/cpp/src/arrow/filesystem/test_util.cc +++ b/cpp/src/arrow/filesystem/test_util.cc @@ -33,6 +33,7 @@ #include "arrow/testing/future_util.h" #include "arrow/testing/gtest_util.h" #include "arrow/util/async_generator.h" +#include "arrow/util/config.h" #include "arrow/util/io_util.h" #include "arrow/util/key_value_metadata.h" #include "arrow/util/vector.h" @@ -752,7 +753,7 @@ void GenericFileSystemTest::TestGetFileInfoSelector(FileSystem* fs) { } void GenericFileSystemTest::TestGetFileInfoGenerator(FileSystem* fs) { -#ifdef ADDRESS_SANITIZER +#if defined(ADDRESS_SANITIZER) || defined(ARROW_TEST_MEMCHECK) if (have_false_positive_memory_leak_with_generator()) { GTEST_SKIP() << "Filesystem have false positive memory leak with generator"; } diff --git a/cpp/src/arrow/util/config.h.cmake b/cpp/src/arrow/util/config.h.cmake index 9fbd685084fd..5ab10c5c49aa 100644 --- a/cpp/src/arrow/util/config.h.cmake +++ b/cpp/src/arrow/util/config.h.cmake @@ -57,6 +57,7 @@ #cmakedefine ARROW_GCS #cmakedefine ARROW_HDFS #cmakedefine ARROW_S3 +#cmakedefine ARROW_TEST_MEMCHECK #cmakedefine ARROW_USE_GLOG #cmakedefine ARROW_USE_NATIVE_INT128 #cmakedefine ARROW_WITH_BROTLI From 9bdf0827770cbb9cb19ff6e627e19965841440cc Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Fri, 12 Apr 2024 14:15:07 +0900 Subject: [PATCH 18/32] GH-41124: [CI][C++] Don't use CMake 3.29.1 with vcpkg (#41151) ### Rationale for this change vcpkg doesn't work with CMake 3.29.1. See also: https://github.com/microsoft/vcpkg/issues/37968 ### What changes are included in this PR? Use CMake 3.29.0 temporary. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #41124 Lead-authored-by: Sutou Kouhei Co-authored-by: Sutou Kouhei Co-authored-by: Jacob Wujciak-Jens Signed-off-by: Sutou Kouhei --- ci/scripts/install_cmake.sh | 29 ++++++++++++++++++++--- dev/tasks/macros.jinja | 6 +++-- dev/tasks/python-wheels/github.osx.yml | 8 +++++++ dev/tasks/vcpkg-tests/cpp-build-vcpkg.bat | 3 ++- dev/tasks/vcpkg-tests/github.windows.yml | 23 ++++++++---------- 5 files changed, 50 insertions(+), 19 deletions(-) diff --git a/ci/scripts/install_cmake.sh b/ci/scripts/install_cmake.sh index 2f5e5d52051e..7fdb06d90f02 100755 --- a/ci/scripts/install_cmake.sh +++ b/ci/scripts/install_cmake.sh @@ -21,7 +21,10 @@ set -e declare -A archs archs=([amd64]=x86_64 - [arm64v8]=aarch64) + [arch64]=aarch64 + [arm64]=aarch64 + [arm64v8]=aarch64 + [x86_64]=x86_64) declare -A platforms platforms=([linux]=linux @@ -38,5 +41,25 @@ platform=${platforms[$2]} version=$3 prefix=$4 -url="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/Kitware/CMake/releases/download/v${version}/cmake-${version}-${platform}-${arch}.tar.gz" -wget -q ${url} -O - | tar -xzf - --directory ${prefix} --strip-components=1 +mkdir -p ${prefix} +url="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/Kitware/CMake/releases/download/v${version}/cmake-${version}-${platform}-" +case ${platform} in + macos) + url+="universal.tar.gz" + curl -L ${url} | tar -xzf - --directory ${prefix} --strip-components=1 + ln -s CMake.app/Contents/bin ${prefix}/bin + ;; + windows) + url+="${arch}.zip" + archive_name=$(basename ${url}) + curl -L -o ${archive_name} ${url} + unzip ${archive_name} + base_name=$(basename ${archive_name} .zip) + mv ${base_name}/* ${prefix} + rm -rf ${base_name} ${archive_name} + ;; + *) + url+="${arch}.tar.gz" + curl -L ${url} | tar -xzf - --directory ${prefix} --strip-components=1 + ;; +esac diff --git a/dev/tasks/macros.jinja b/dev/tasks/macros.jinja index f55a7f9481e5..1e819d3cf455 100644 --- a/dev/tasks/macros.jinja +++ b/dev/tasks/macros.jinja @@ -59,7 +59,8 @@ env: {%- macro github_install_archery() -%} - name: Set up Python by actions/setup-python - if: runner.arch == 'X64' + if: | + !(runner.os == 'Linux' && runner.arch != 'X64') uses: actions/setup-python@v4 with: cache: 'pip' @@ -86,7 +87,8 @@ env: {%- macro github_upload_releases(pattern) -%} - name: Set up Python by actions/setup-python - if: runner.arch == 'X64' + if: | + !(runner.os == 'Linux' && runner.arch != 'X64') uses: actions/setup-python@v4 with: python-version: 3.12 diff --git a/dev/tasks/python-wheels/github.osx.yml b/dev/tasks/python-wheels/github.osx.yml index cf99c84c60bf..ce9613545eb5 100644 --- a/dev/tasks/python-wheels/github.osx.yml +++ b/dev/tasks/python-wheels/github.osx.yml @@ -50,6 +50,14 @@ jobs: run: | brew list + # CMake 3.29.1 that is pre-installed on the macOS image has a problem. + # See also: https://github.com/microsoft/vcpkg/issues/37968 + - name: Install CMake 3.29.0 + shell: bash + run: | + arrow/ci/scripts/install_cmake.sh $(arch) macos 3.29.0 ${PWD}/local + echo "${PWD}/local/bin" >> $GITHUB_PATH + - name: Retrieve VCPKG version from arrow/.env run: | vcpkg_version=$(cat "arrow/.env" | grep "VCPKG" | cut -d "=" -f2 | tr -d '"') diff --git a/dev/tasks/vcpkg-tests/cpp-build-vcpkg.bat b/dev/tasks/vcpkg-tests/cpp-build-vcpkg.bat index 8f160ee7c4fd..3b337bb17500 100644 --- a/dev/tasks/vcpkg-tests/cpp-build-vcpkg.bat +++ b/dev/tasks/vcpkg-tests/cpp-build-vcpkg.bat @@ -78,7 +78,8 @@ cmake --build . --target INSTALL --config Release || exit /B 1 @rem Test Arrow C++ library -ctest --output-on-failure ^ +ctest --build-config Release ^ + --output-on-failure ^ --parallel %NUMBER_OF_PROCESSORS% ^ --timeout 300 || exit /B 1 diff --git a/dev/tasks/vcpkg-tests/github.windows.yml b/dev/tasks/vcpkg-tests/github.windows.yml index 618c997c2527..af12db595286 100644 --- a/dev/tasks/vcpkg-tests/github.windows.yml +++ b/dev/tasks/vcpkg-tests/github.windows.yml @@ -15,14 +15,9 @@ # specific language governing permissions and limitations # under the License. -# NOTE: must set "Crossbow" as name to have the badge links working in the -# github comment reports! -name: Crossbow +{% import 'macros.jinja' as macros with context %} -on: - push: - branches: - - "*-github-*" +{{ macros.github_header() }} jobs: test-vcpkg-win: @@ -31,12 +26,14 @@ jobs: env: VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite' steps: - - name: Checkout Arrow + {{ macros.github_checkout_arrow()|indent }} + # CMake 3.29.1 that is pre-installed on the Windows image has a problem. + # See also: https://github.com/microsoft/vcpkg/issues/37968 + - name: Install CMake 3.29.0 + shell: bash run: | - git clone --no-checkout {{ arrow.remote }} arrow - git -C arrow fetch -t {{ arrow.remote }} {{ arrow.branch }} - git -C arrow checkout FETCH_HEAD - git -C arrow submodule update --init --recursive + arrow/ci/scripts/install_cmake.sh amd64 windows 3.29.0 /c/cmake + echo "c:\\cmake\\bin" >> $GITHUB_PATH - name: Download Timezone Database shell: bash run: arrow/ci/scripts/download_tz_database.sh @@ -59,7 +56,7 @@ jobs: CALL setx PATH "%PATH%;C:\vcpkg" - name: Setup NuGet Credentials shell: bash - env: + env: GITHUB_TOKEN: {{ '${{ secrets.GITHUB_TOKEN }}' }} run: | `vcpkg fetch nuget | tail -n 1` \ From ed064404b50a5d0d83d216dab2ffd64383d00dfe Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Sun, 14 Apr 2024 05:19:26 +0900 Subject: [PATCH 19/32] GH-41169: [CI][Release] Specify --build-config explicitly on Windows (#41178) ### Rationale for this change #37821 changed to use `add_test()` usage from old style to new style: https://github.com/apache/arrow/commit/1a1d2c87d11c48569fa603cc157e6bddc1f7d306?diff=unified&w=1#diff-1ce47eec54afaee769086e1a720c5ed65bc347cd8fc60a233de67fd895dda329L763-R764 MSVC generators multi-config generators. With old style, all tests are run without specifying `--build-config` explicitly. With new style, we need to specify `--build-config` explicitly. See also: https://cmake.org/cmake/help/latest/command/add_test.html ### What changes are included in this PR? Specify `--build-config` explicitly. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #41169 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- dev/release/verify-release-candidate.bat | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dev/release/verify-release-candidate.bat b/dev/release/verify-release-candidate.bat index 8226eb5db360..06d3016c72af 100644 --- a/dev/release/verify-release-candidate.bat +++ b/dev/release/verify-release-candidate.bat @@ -122,7 +122,10 @@ cmake --build . --target INSTALL --config Release || exit /B 1 @rem Needed so python-test.exe works set PYTHONPATH_ORIGINAL=%PYTHONPATH% set PYTHONPATH=%CONDA_PREFIX%\Lib;%CONDA_PREFIX%\Lib\site-packages;%CONDA_PREFIX%\DLLs;%CONDA_PREFIX%;%PYTHONPATH% -ctest -j%NUMBER_OF_PROCESSORS% --output-on-failure || exit /B 1 +ctest ^ + --build-config Release ^ + --output-on-failure ^ + --parallel %NUMBER_OF_PROCESSORS% || exit /B 1 set PYTHONPATH=%PYTHONPATH_ORIGINAL% popd From 4ec41de4d2848586c0aa6065ac2c6630dd92606e Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Sun, 14 Apr 2024 05:27:16 +0900 Subject: [PATCH 20/32] GH-41167: [CI][Release][GLib][Conda] Pin gobject-introspection to 1.78.1 (#41181) ### Rationale for this change GObject Introspection is merging into GLib. It's not completed yet. GLib related `.gir` files are moved to GLib from GObject Introspection since GLib/GObject Introspection 2.80.0. But glib 2.80.0 conda package doesn't support this merge yet: https://github.com/conda-forge/glib-feedstock/pull/174 ### What changes are included in this PR? Pin gobject-introspection to 1.78.1 for now. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #41167 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- dev/release/verify-release-candidate.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev/release/verify-release-candidate.sh b/dev/release/verify-release-candidate.sh index f18b18aaa997..cf49751e6e2a 100755 --- a/dev/release/verify-release-candidate.sh +++ b/dev/release/verify-release-candidate.sh @@ -831,7 +831,9 @@ test_glib() { show_header "Build and test C GLib libraries" # Build and test C GLib - maybe_setup_conda glib gobject-introspection meson ninja ruby + # We can unpin gobject-introspection after + # https://github.com/conda-forge/glib-feedstock/pull/174 is merged. + maybe_setup_conda glib gobject-introspection=1.78.1 meson ninja ruby maybe_setup_virtualenv meson # Install bundler if doesn't exist From 8c625d76fa5cf7c341325259eddc7981aab68ca4 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Sun, 14 Apr 2024 05:55:58 +0900 Subject: [PATCH 21/32] GH-41176: [C++] Stop defining ARROW_TEST_MEMCHECK in config.h.cmake (#41177) ### Rationale for this change We already have `ARROW_VALGRIND`. ### What changes are included in this PR? Remove redundant macro. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #41176 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- cpp/src/arrow/filesystem/test_util.cc | 3 +-- cpp/src/arrow/util/config.h.cmake | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cpp/src/arrow/filesystem/test_util.cc b/cpp/src/arrow/filesystem/test_util.cc index accb7a47ab01..8eb00b8ae44f 100644 --- a/cpp/src/arrow/filesystem/test_util.cc +++ b/cpp/src/arrow/filesystem/test_util.cc @@ -33,7 +33,6 @@ #include "arrow/testing/future_util.h" #include "arrow/testing/gtest_util.h" #include "arrow/util/async_generator.h" -#include "arrow/util/config.h" #include "arrow/util/io_util.h" #include "arrow/util/key_value_metadata.h" #include "arrow/util/vector.h" @@ -753,7 +752,7 @@ void GenericFileSystemTest::TestGetFileInfoSelector(FileSystem* fs) { } void GenericFileSystemTest::TestGetFileInfoGenerator(FileSystem* fs) { -#if defined(ADDRESS_SANITIZER) || defined(ARROW_TEST_MEMCHECK) +#if defined(ADDRESS_SANITIZER) || defined(ARROW_VALGRIND) if (have_false_positive_memory_leak_with_generator()) { GTEST_SKIP() << "Filesystem have false positive memory leak with generator"; } diff --git a/cpp/src/arrow/util/config.h.cmake b/cpp/src/arrow/util/config.h.cmake index 5ab10c5c49aa..9fbd685084fd 100644 --- a/cpp/src/arrow/util/config.h.cmake +++ b/cpp/src/arrow/util/config.h.cmake @@ -57,7 +57,6 @@ #cmakedefine ARROW_GCS #cmakedefine ARROW_HDFS #cmakedefine ARROW_S3 -#cmakedefine ARROW_TEST_MEMCHECK #cmakedefine ARROW_USE_GLOG #cmakedefine ARROW_USE_NATIVE_INT128 #cmakedefine ARROW_WITH_BROTLI From 41b99cb60819a4d0a0dca6f0d1138461910dac5f Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Mon, 15 Apr 2024 10:22:15 +0200 Subject: [PATCH 22/32] GH-38010: [Python] Construct pyarrow.Field and ChunkedArray through Arrow PyCapsule Protocol (#40818) ### Rationale for this change See https://github.com/apache/arrow/issues/38010#issuecomment-2010601912 for more context. Right now for _consuming_ ArrowSchema-compatible objects that implement the PyCapsule interface, we only have the private `_import_from_c_capsule` (on Schema, Field, DataType) and we check for the protocol in the public `pa.schema(..)`. But that means you currently can only consume objects that represent the schema of a batch (struct type), and not schemas of individual arrays. ### What changes are included in this PR? Expand the `pa.field(..)` constructor to accept objects implementing the protocol method. ### Are these changes tested? TODO * GitHub Issue: #38010 Authored-by: Joris Van den Bossche Signed-off-by: Joris Van den Bossche --- docs/source/python/extending_types.rst | 29 ++++++++++++++++-- python/pyarrow/table.pxi | 37 ++++++++++++++++++++--- python/pyarrow/tests/test_array.py | 2 +- python/pyarrow/tests/test_cffi.py | 12 ++++++-- python/pyarrow/tests/test_table.py | 41 ++++++++++++++++++++++++++ python/pyarrow/tests/test_types.py | 22 ++++++++++++++ python/pyarrow/types.pxi | 18 ++++++++++- 7 files changed, 151 insertions(+), 10 deletions(-) diff --git a/docs/source/python/extending_types.rst b/docs/source/python/extending_types.rst index b7261005e66e..8df0ef0b1fe9 100644 --- a/docs/source/python/extending_types.rst +++ b/docs/source/python/extending_types.rst @@ -37,14 +37,14 @@ under the hood, you can implement the following methods on those objects: - ``__arrow_c_schema__`` for schema or type-like objects. - ``__arrow_c_array__`` for arrays and record batches (contiguous tables). -- ``__arrow_c_stream__`` for chunked tables or streams of data. +- ``__arrow_c_stream__`` for chunked arrays, tables and streams of data. Those methods return `PyCapsule `__ objects, and more details on the exact semantics can be found in the :ref:`specification `. When your data structures have those methods defined, the PyArrow constructors -(such as :func:`pyarrow.array` or :func:`pyarrow.table`) will recognize those objects as +(see below) will recognize those objects as supporting this protocol, and convert them to PyArrow data structures zero-copy. And the same can be true for any other library supporting this protocol on ingesting data. @@ -53,6 +53,31 @@ support for this protocol by checking for the presence of those methods, and therefore accept any Arrow data (instead of harcoding support for a specific Arrow producer such as PyArrow). +For consuming data through this protocol with PyArrow, the following constructors +can be used to create the various PyArrow objects: + ++----------------------------+-----------------------------------------------+--------------------+ +| Result class | PyArrow constructor | Supported protocol | ++============================+===============================================+====================+ +| :class:`Array` | :func:`pyarrow.array` | array | ++----------------------------+-----------------------------------------------+--------------------+ +| :class:`ChunkedArray` | :func:`pyarrow.chunked_array` | array, stream | ++----------------------------+-----------------------------------------------+--------------------+ +| :class:`RecordBatch` | :func:`pyarrow.record_batch` | array | ++----------------------------+-----------------------------------------------+--------------------+ +| :class:`Table` | :func:`pyarrow.table` | array, stream | ++----------------------------+-----------------------------------------------+--------------------+ +| :class:`RecordBatchReader` | :meth:`pyarrow.RecordBatchReader.from_stream` | stream | ++----------------------------+-----------------------------------------------+--------------------+ +| :class:`Field` | :func:`pyarrow.field` | schema | ++----------------------------+-----------------------------------------------+--------------------+ +| :class:`Schema` | :func:`pyarrow.schema` | schema | ++----------------------------+-----------------------------------------------+--------------------+ + +A :class:`DataType` can be created by consuming the schema-compatible object +using :func:`pyarrow.field` and then accessing the ``.type`` of the resulting +Field. + .. _arrow_array_protocol: Controlling conversion to pyarrow.Array with the ``__arrow_array__`` protocol diff --git a/python/pyarrow/table.pxi b/python/pyarrow/table.pxi index 6b3c7d0b5626..d31ea0a5fa1e 100644 --- a/python/pyarrow/table.pxi +++ b/python/pyarrow/table.pxi @@ -1344,17 +1344,28 @@ cdef class ChunkedArray(_PandasConvertible): A capsule containing a C ArrowArrayStream struct. """ cdef: + ChunkedArray chunked ArrowArrayStream* c_stream = NULL if requested_schema is not None: - out_type = DataType._import_from_c_capsule(requested_schema) - if self.type != out_type: - raise NotImplementedError("Casting to requested_schema") + target_type = DataType._import_from_c_capsule(requested_schema) + + if target_type != self.type: + try: + chunked = self.cast(target_type, safe=True) + except ArrowInvalid as e: + raise ValueError( + f"Could not cast {self.type} to requested type {target_type}: {e}" + ) + else: + chunked = self + else: + chunked = self stream_capsule = alloc_c_stream(&c_stream) with nogil: - check_status(ExportChunkedArray(self.sp_chunked_array, c_stream)) + check_status(ExportChunkedArray(chunked.sp_chunked_array, c_stream)) return stream_capsule @@ -1397,6 +1408,9 @@ def chunked_array(arrays, type=None): ---------- arrays : Array, list of Array, or array-like Must all be the same data type. Can be empty only if type also passed. + Any Arrow-compatible array that implements the Arrow PyCapsule Protocol + (has an ``__arrow_c_array__`` or ``__arrow_c_stream__`` method) can be + passed as well. type : DataType or string coercible to DataType Returns @@ -1437,6 +1451,21 @@ def chunked_array(arrays, type=None): if isinstance(arrays, Array): arrays = [arrays] + elif hasattr(arrays, "__arrow_c_stream__"): + if type is not None: + requested_type = type.__arrow_c_schema__() + else: + requested_type = None + capsule = arrays.__arrow_c_stream__(requested_type) + result = ChunkedArray._import_from_c_capsule(capsule) + if type is not None and result.type != type: + # __arrow_c_stream__ coerces schema with best effort, so we might + # need to cast it if the producer wasn't able to cast to exact schema. + result = result.cast(type) + return result + elif hasattr(arrays, "__arrow_c_array__"): + arr = array(arrays, type=type) + arrays = [arr] for x in arrays: arr = x if isinstance(x, Array) else array(x, type=type) diff --git a/python/pyarrow/tests/test_array.py b/python/pyarrow/tests/test_array.py index 472a6c5dce75..8bcb28c0d41b 100644 --- a/python/pyarrow/tests/test_array.py +++ b/python/pyarrow/tests/test_array.py @@ -3382,7 +3382,7 @@ def __arrow_c_array__(self, requested_schema=None): result = pa.array(arr) assert result == arr.data - # Will case to requested type + # Will cast to requested type result = pa.array(arr, type=pa.int32()) assert result == pa.array([1, 2, 3], type=pa.int32()) diff --git a/python/pyarrow/tests/test_cffi.py b/python/pyarrow/tests/test_cffi.py index f8b2ea15d31a..5bf41c3c14b6 100644 --- a/python/pyarrow/tests/test_cffi.py +++ b/python/pyarrow/tests/test_cffi.py @@ -692,8 +692,16 @@ def test_roundtrip_chunked_array_capsule_requested_schema(): imported_chunked = pa.ChunkedArray._import_from_c_capsule(capsule) assert imported_chunked == chunked - # Casting to something else should error + # Casting to something else should error if not possible requested_type = pa.binary() requested_capsule = requested_type.__arrow_c_schema__() - with pytest.raises(NotImplementedError): + capsule = chunked.__arrow_c_stream__(requested_capsule) + imported_chunked = pa.ChunkedArray._import_from_c_capsule(capsule) + assert imported_chunked == chunked.cast(pa.binary()) + + requested_type = pa.int64() + requested_capsule = requested_type.__arrow_c_schema__() + with pytest.raises( + ValueError, match="Could not cast string to requested type int64" + ): chunked.__arrow_c_stream__(requested_capsule) diff --git a/python/pyarrow/tests/test_table.py b/python/pyarrow/tests/test_table.py index 31d34058b61e..539da0e68538 100644 --- a/python/pyarrow/tests/test_table.py +++ b/python/pyarrow/tests/test_table.py @@ -493,6 +493,47 @@ def test_recordbatch_dunder_init(): pa.RecordBatch() +def test_chunked_array_c_array_interface(): + class ArrayWrapper: + def __init__(self, array): + self.array = array + + def __arrow_c_array__(self, requested_schema=None): + return self.array.__arrow_c_array__(requested_schema) + + data = pa.array([1, 2, 3], pa.int64()) + chunked = pa.chunked_array([data]) + wrapper = ArrayWrapper(data) + + # Can roundtrip through the wrapper. + result = pa.chunked_array(wrapper) + assert result == chunked + + # Can also import with a type that implementer can cast to. + result = pa.chunked_array(wrapper, type=pa.int16()) + assert result == chunked.cast(pa.int16()) + + +def test_chunked_array_c_stream_interface(): + class ChunkedArrayWrapper: + def __init__(self, chunked): + self.chunked = chunked + + def __arrow_c_stream__(self, requested_schema=None): + return self.chunked.__arrow_c_stream__(requested_schema) + + data = pa.chunked_array([[1, 2, 3], [4, None, 6]]) + wrapper = ChunkedArrayWrapper(data) + + # Can roundtrip through the wrapper. + result = pa.chunked_array(wrapper) + assert result == data + + # Can also import with a type that implementer can cast to. + result = pa.chunked_array(wrapper, type=pa.int16()) + assert result == data.cast(pa.int16()) + + def test_recordbatch_c_array_interface(): class BatchWrapper: def __init__(self, batch): diff --git a/python/pyarrow/tests/test_types.py b/python/pyarrow/tests/test_types.py index 21b382980348..4f66a6f41672 100644 --- a/python/pyarrow/tests/test_types.py +++ b/python/pyarrow/tests/test_types.py @@ -1335,3 +1335,25 @@ def __arrow_c_schema__(self): wrapped_schema = Wrapper(schema) assert pa.schema(wrapped_schema) == schema + + +def test_field_import_c_schema_interface(): + class Wrapper: + def __init__(self, field): + self.field = field + + def __arrow_c_schema__(self): + return self.field.__arrow_c_schema__() + + field = pa.field("field_name", pa.int32(), metadata={"key": "value"}) + wrapped_field = Wrapper(field) + + assert pa.field(wrapped_field) == field + + with pytest.raises(ValueError, match="cannot specify 'type'"): + pa.field(wrapped_field, type=pa.int64()) + + # override nullable or metadata + assert pa.field(wrapped_field, nullable=False).nullable is False + result = pa.field(wrapped_field, metadata={"other": "meta"}) + assert result.metadata == {b"other": b"meta"} diff --git a/python/pyarrow/types.pxi b/python/pyarrow/types.pxi index 6cbad8eeb653..018099ae7e65 100644 --- a/python/pyarrow/types.pxi +++ b/python/pyarrow/types.pxi @@ -3462,7 +3462,7 @@ cdef DataType primitive_type(Type type): # Type factory functions -def field(name, type, bint nullable=True, metadata=None): +def field(name, type=None, nullable=None, metadata=None): """ Create a pyarrow.Field instance. @@ -3470,6 +3470,8 @@ def field(name, type, bint nullable=True, metadata=None): ---------- name : str or bytes Name of the field. + Alternatively, you can also pass an object that implements the Arrow + PyCapsule Protocol for schemas (has an ``__arrow_c_schema__`` method). type : pyarrow.DataType Arrow datatype of the field. nullable : bool, default True @@ -3504,11 +3506,25 @@ def field(name, type, bint nullable=True, metadata=None): >>> pa.struct([field]) StructType(struct) """ + if hasattr(name, "__arrow_c_schema__"): + if type is not None: + raise ValueError( + "cannot specify 'type' when creating a Field from an ArrowSchema" + ) + field = Field._import_from_c_capsule(name.__arrow_c_schema__()) + if metadata is not None: + field = field.with_metadata(metadata) + if nullable is not None: + field = field.with_nullable(nullable) + return field + cdef: Field result = Field.__new__(Field) DataType _type = ensure_type(type, allow_none=False) shared_ptr[const CKeyValueMetadata] c_meta + nullable = True if nullable is None else nullable + metadata = ensure_metadata(metadata, allow_none=True) c_meta = pyarrow_unwrap_metadata(metadata) From 0d1a0161ed7073b32d34b155b4861035b86354f6 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Mon, 15 Apr 2024 13:09:02 +0200 Subject: [PATCH 23/32] GH-39848: [Python][Packaging] Build pyarrow wheels with numpy RC instead of nightly (#41097) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Rationale for this change Now NumPy has released a first RC for 2.0, we should update our PyArrow wheels to build with this released version instead of with the nightly numpy packages, to ensure we don't build our release wheels with an unstable numpy version. ### What changes are included in this PR? Increased the version requirement for numpy for the installed packages at build time to `numpy>=2.0.0rc1`, to force installing this RC instead of numpy 1.26 ### Are these changes tested? The wheel tests ensure that those wheels still work with older versions of numpy * GitHub Issue: #39848 Authored-by: Joris Van den Bossche Signed-off-by: Raúl Cumplido --- .env | 2 +- ci/docker/python-wheel-manylinux.dockerfile | 3 +-- ci/docker/python-wheel-windows-vs2019.dockerfile | 3 +-- ci/scripts/python_wheel_macos_build.sh | 5 +---- python/requirements-wheel-build.txt | 2 +- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.env b/.env index 298c100c094b..65bb46c838be 100644 --- a/.env +++ b/.env @@ -98,7 +98,7 @@ VCPKG="a42af01b72c28a8e1d7b48107b33e4f286a55ef6" # 2023.11.20 Release # ci/docker/python-wheel-windows-vs2019.dockerfile. # This is a workaround for our CI problem that "archery docker build" doesn't # use pulled built images in dev/tasks/python-wheels/github.windows.yml. -PYTHON_WHEEL_WINDOWS_IMAGE_REVISION=2024-03-19 +PYTHON_WHEEL_WINDOWS_IMAGE_REVISION=2024-04-09 # Use conanio/${CONAN} for "docker-compose run --rm conan". See # https://github.com/conan-io/conan-docker-tools#readme for available diff --git a/ci/docker/python-wheel-manylinux.dockerfile b/ci/docker/python-wheel-manylinux.dockerfile index b1d9ed5ab88d..63fd7b1d4682 100644 --- a/ci/docker/python-wheel-manylinux.dockerfile +++ b/ci/docker/python-wheel-manylinux.dockerfile @@ -99,5 +99,4 @@ SHELL ["/bin/bash", "-i", "-c"] ENTRYPOINT ["/bin/bash", "-i", "-c"] COPY python/requirements-wheel-build.txt /arrow/python/ -# TODO(GH-39848) Remove the `--pre --extra-index-url` for numpy nightly again before the 16.0 release -RUN pip install -r /arrow/python/requirements-wheel-build.txt --pre --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" +RUN pip install -r /arrow/python/requirements-wheel-build.txt diff --git a/ci/docker/python-wheel-windows-vs2019.dockerfile b/ci/docker/python-wheel-windows-vs2019.dockerfile index 0ab5071abb86..ff42de939d91 100644 --- a/ci/docker/python-wheel-windows-vs2019.dockerfile +++ b/ci/docker/python-wheel-windows-vs2019.dockerfile @@ -89,8 +89,7 @@ RUN choco install -r -y --no-progress python --version=%PYTHON_VERSION% RUN python -m pip install -U pip setuptools COPY python/requirements-wheel-build.txt arrow/python/ -# TODO(GH-39848) Remove the `--pre --extra-index-url` for numpy nightly again before the 16.0 release -RUN python -m pip install -r arrow/python/requirements-wheel-build.txt --pre --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" +RUN python -m pip install -r arrow/python/requirements-wheel-build.txt # ENV CLCACHE_DIR="C:\clcache" # ENV CLCACHE_COMPRESS=1 diff --git a/ci/scripts/python_wheel_macos_build.sh b/ci/scripts/python_wheel_macos_build.sh index a94dac40e931..3ed9d5d8dd12 100755 --- a/ci/scripts/python_wheel_macos_build.sh +++ b/ci/scripts/python_wheel_macos_build.sh @@ -50,15 +50,12 @@ echo "=== (${PYTHON_VERSION}) Install Python build dependencies ===" export PIP_SITE_PACKAGES=$(python -c 'import site; print(site.getsitepackages()[0])') export PIP_TARGET_PLATFORM="macosx_${MACOSX_DEPLOYMENT_TARGET//./_}_${arch}" -# TODO(GH-39848) Remove the `--pre --extra-index-url` for numpy nightly again before the 16.0 release pip install \ --upgrade \ --only-binary=:all: \ --target $PIP_SITE_PACKAGES \ --platform $PIP_TARGET_PLATFORM \ - -r ${source_dir}/python/requirements-wheel-build.txt \ - --pre \ - --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" + -r ${source_dir}/python/requirements-wheel-build.txt pip install "delocate>=0.10.3" echo "=== (${PYTHON_VERSION}) Building Arrow C++ libraries ===" diff --git a/python/requirements-wheel-build.txt b/python/requirements-wheel-build.txt index 9920a38a4e28..3ea57b611f9d 100644 --- a/python/requirements-wheel-build.txt +++ b/python/requirements-wheel-build.txt @@ -1,6 +1,6 @@ cython>=0.29.31 oldest-supported-numpy>=0.14; python_version<'3.9' -numpy>=1.25; python_version>='3.9' +numpy>=2.0.0rc1; python_version>='3.9' setuptools_scm setuptools>=58 wheel From 0d3af8d766944d98f463b5cbc04a65b507e27f14 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Mon, 15 Apr 2024 17:07:44 +0200 Subject: [PATCH 24/32] GH-41098: [Python] Add copy keyword in Array.__array__ for numpy 2.0+ compatibility (#41071) ### Rationale for this change Adapting for changes in numpy 2.0 as decribed at https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword and future changes to pass copy=True (https://github.com/numpy/numpy/issues/26208) ### What changes are included in this PR? Add a `copy=None` to the signatures of our `__array__` methods. This does have impact on the user facing behaviour, though. Questioning that upstream at https://github.com/numpy/numpy/issues/25941#issuecomment-2043035821 ### Are these changes tested? Yes ### Are there any user-facing changes? No (compared to usage with numpy<2) * GitHub Issue: #39532 * GitHub Issue: #41098 Authored-by: Joris Van den Bossche Signed-off-by: Antoine Pitrou --- python/pyarrow/array.pxi | 21 +++++++++++-- python/pyarrow/includes/libarrow.pxd | 1 + python/pyarrow/table.pxi | 23 ++++++++++++-- python/pyarrow/tests/test_array.py | 47 ++++++++++++++++++++++++++++ python/pyarrow/tests/test_table.py | 16 ++++++++++ 5 files changed, 103 insertions(+), 5 deletions(-) diff --git a/python/pyarrow/array.pxi b/python/pyarrow/array.pxi index 45fd29ad3b3f..60fc09ea861b 100644 --- a/python/pyarrow/array.pxi +++ b/python/pyarrow/array.pxi @@ -1516,11 +1516,28 @@ cdef class Array(_PandasConvertible): def _to_pandas(self, options, types_mapper=None, **kwargs): return _array_like_to_pandas(self, options, types_mapper=types_mapper) - def __array__(self, dtype=None): + def __array__(self, dtype=None, copy=None): + if copy is False: + try: + values = self.to_numpy(zero_copy_only=True) + except ArrowInvalid: + raise ValueError( + "Unable to avoid a copy while creating a numpy array as requested.\n" + "If using `np.array(obj, copy=False)` replace it with " + "`np.asarray(obj)` to allow a copy when needed" + ) + # values is already a numpy array at this point, but calling np.array(..) + # again to handle the `dtype` keyword with a no-copy guarantee + return np.array(values, dtype=dtype, copy=False) + values = self.to_numpy(zero_copy_only=False) + if copy is True and is_numeric(self.type.id) and self.null_count == 0: + # to_numpy did not yet make a copy (is_numeric = integer/floats, no decimal) + return np.array(values, dtype=dtype, copy=True) + if dtype is None: return values - return values.astype(dtype) + return np.asarray(values, dtype=dtype) def to_numpy(self, zero_copy_only=True, writable=False): """ diff --git a/python/pyarrow/includes/libarrow.pxd b/python/pyarrow/includes/libarrow.pxd index a35919579541..6dae45ab80b1 100644 --- a/python/pyarrow/includes/libarrow.pxd +++ b/python/pyarrow/includes/libarrow.pxd @@ -173,6 +173,7 @@ cdef extern from "arrow/api.h" namespace "arrow" nogil: c_string ToString() c_bool is_primitive(Type type) + c_bool is_numeric(Type type) cdef cppclass CArrayData" arrow::ArrayData": shared_ptr[CDataType] type diff --git a/python/pyarrow/table.pxi b/python/pyarrow/table.pxi index d31ea0a5fa1e..b35a321dd2ff 100644 --- a/python/pyarrow/table.pxi +++ b/python/pyarrow/table.pxi @@ -525,11 +525,19 @@ cdef class ChunkedArray(_PandasConvertible): return values - def __array__(self, dtype=None): + def __array__(self, dtype=None, copy=None): + if copy is False: + raise ValueError( + "Unable to avoid a copy while creating a numpy array as requested " + "(converting a pyarrow.ChunkedArray always results in a copy).\n" + "If using `np.array(obj, copy=False)` replace it with " + "`np.asarray(obj)` to allow a copy when needed" + ) + # 'copy' can further be ignored because to_numpy() already returns a copy values = self.to_numpy() if dtype is None: return values - return values.astype(dtype) + return values.astype(dtype, copy=False) def cast(self, object target_type=None, safe=None, options=None): """ @@ -1562,7 +1570,16 @@ cdef class _Tabular(_PandasConvertible): raise TypeError(f"Do not call {self.__class__.__name__}'s constructor directly, use " f"one of the `{self.__class__.__name__}.from_*` functions instead.") - def __array__(self, dtype=None): + def __array__(self, dtype=None, copy=None): + if copy is False: + raise ValueError( + "Unable to avoid a copy while creating a numpy array as requested " + f"(converting a pyarrow.{self.__class__.__name__} always results " + "in a copy).\n" + "If using `np.array(obj, copy=False)` replace it with " + "`np.asarray(obj)` to allow a copy when needed" + ) + # 'copy' can further be ignored because stacking will result in a copy column_arrays = [ np.asarray(self.column(i), dtype=dtype) for i in range(self.num_columns) ] diff --git a/python/pyarrow/tests/test_array.py b/python/pyarrow/tests/test_array.py index 8bcb28c0d41b..156d58326b96 100644 --- a/python/pyarrow/tests/test_array.py +++ b/python/pyarrow/tests/test_array.py @@ -31,6 +31,7 @@ import pyarrow as pa import pyarrow.tests.strategies as past +from pyarrow.vendored.version import Version def test_total_bytes_allocated(): @@ -3302,6 +3303,52 @@ def test_array_from_large_pyints(): pa.array([int(2 ** 63)]) +def test_numpy_array_protocol(): + # test the __array__ method on pyarrow.Array + arr = pa.array([1, 2, 3]) + result = np.asarray(arr) + expected = np.array([1, 2, 3], dtype="int64") + np.testing.assert_array_equal(result, expected) + + # this should not raise a deprecation warning with numpy 2.0+ + result = np.array(arr, copy=False) + np.testing.assert_array_equal(result, expected) + + result = np.array(arr, dtype="int64", copy=False) + np.testing.assert_array_equal(result, expected) + + # no zero-copy is possible + arr = pa.array([1, 2, None]) + expected = np.array([1, 2, np.nan], dtype="float64") + result = np.asarray(arr) + np.testing.assert_array_equal(result, expected) + + if Version(np.__version__) < Version("2.0"): + # copy keyword is not strict and not passed down to __array__ + result = np.array(arr, copy=False) + np.testing.assert_array_equal(result, expected) + + result = np.array(arr, dtype="float64", copy=False) + np.testing.assert_array_equal(result, expected) + else: + # starting with numpy 2.0, the copy=False keyword is assumed to be strict + with pytest.raises(ValueError, match="Unable to avoid a copy"): + np.array(arr, copy=False) + + arr = pa.array([1, 2, 3]) + with pytest.raises(ValueError): + np.array(arr, dtype="float64", copy=False) + + # copy=True -> not yet passed by numpy, so we have to call this directly to test + arr = pa.array([1, 2, 3]) + result = arr.__array__(copy=True) + assert result.flags.writeable + + arr = pa.array([1, 2, 3]) + result = arr.__array__(dtype=np.dtype("float64"), copy=True) + assert result.dtype == "float64" + + def test_array_protocol(): class MyArray: diff --git a/python/pyarrow/tests/test_table.py b/python/pyarrow/tests/test_table.py index 539da0e68538..e11efa64db4d 100644 --- a/python/pyarrow/tests/test_table.py +++ b/python/pyarrow/tests/test_table.py @@ -24,6 +24,7 @@ import pytest import pyarrow as pa import pyarrow.compute as pc +from pyarrow.vendored.version import Version def test_chunked_array_basics(): @@ -3238,6 +3239,21 @@ def test_numpy_asarray(constructor): assert result.dtype == "int32" +@pytest.mark.parametrize("constructor", [pa.table, pa.record_batch]) +def test_numpy_array_protocol(constructor): + table = constructor([[1, 2, 3], [4.0, 5.0, 6.0]], names=["a", "b"]) + expected = np.array([[1, 4], [2, 5], [3, 6]], dtype="float64") + + if Version(np.__version__) < Version("2.0"): + # copy keyword is not strict and not passed down to __array__ + result = np.array(table, copy=False) + np.testing.assert_array_equal(result, expected) + else: + # starting with numpy 2.0, the copy=False keyword is assumed to be strict + with pytest.raises(ValueError, match="Unable to avoid a copy"): + np.array(table, copy=False) + + @pytest.mark.acero def test_invalid_non_join_column(): NUM_ITEMS = 30 From 1e40252f318a053a754a1cf98bb77bc0660fd4ea Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Mon, 15 Apr 2024 17:30:28 +0200 Subject: [PATCH 25/32] GH-41016: [C++] Fix null count check in BooleanArray.true_count() (#41070) ### Rationale for this change Loading the `null_count` attribute doesn't take into account the possible value of -1, leading to a code path where the validity buffer is accessed, but which is not necessarily present in that case. ### What changes are included in this PR? Use `data->MayHaveNulls()` instead of `data->null_count.load()` ### Are these changes tested? Yes * GitHub Issue: #41016 Authored-by: Joris Van den Bossche Signed-off-by: Antoine Pitrou --- cpp/src/arrow/array/array_primitive.cc | 2 +- cpp/src/arrow/array/array_test.cc | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cpp/src/arrow/array/array_primitive.cc b/cpp/src/arrow/array/array_primitive.cc index 7c4a14d93400..da3810aa392c 100644 --- a/cpp/src/arrow/array/array_primitive.cc +++ b/cpp/src/arrow/array/array_primitive.cc @@ -56,7 +56,7 @@ int64_t BooleanArray::false_count() const { } int64_t BooleanArray::true_count() const { - if (data_->null_count.load() != 0) { + if (data_->MayHaveNulls()) { DCHECK(data_->buffers[0]); return internal::CountAndSetBits(data_->buffers[0]->data(), data_->offset, data_->buffers[1]->data(), data_->offset, diff --git a/cpp/src/arrow/array/array_test.cc b/cpp/src/arrow/array/array_test.cc index 21ac1a09f56e..60efdb47683f 100644 --- a/cpp/src/arrow/array/array_test.cc +++ b/cpp/src/arrow/array/array_test.cc @@ -1307,6 +1307,13 @@ TEST(TestBooleanArray, TrueCountFalseCount) { CheckArray(checked_cast(*arr)); CheckArray(checked_cast(*arr->Slice(5))); CheckArray(checked_cast(*arr->Slice(0, 0))); + + // GH-41016 true_count() with array without validity buffer with null_count of -1 + auto arr_unknown_null_count = ArrayFromJSON(boolean(), "[true, false, true]"); + arr_unknown_null_count->data()->null_count = kUnknownNullCount; + ASSERT_EQ(arr_unknown_null_count->data()->null_count.load(), -1); + ASSERT_EQ(arr_unknown_null_count->null_bitmap(), nullptr); + ASSERT_EQ(checked_pointer_cast(arr_unknown_null_count)->true_count(), 2); } TEST(TestPrimitiveAdHoc, TestType) { From 9cb361c90e4c5f9d64799fb533e5c446f51f5243 Mon Sep 17 00:00:00 2001 From: Francis <455954986@qq.com> Date: Tue, 16 Apr 2024 00:09:05 +0800 Subject: [PATCH 26/32] GH-41121: [C++] Fix: left anti join filter empty rows. (#41122) ### Rationale for this change Since the left anti filter implementation is based on the left semi filter, and an assertion error occurs when the left semi filter rows are empty, this problem should be fixed. ### What changes are included in this PR? swiss_join.cc and hash_join_node_test.cc ### Are these changes tested? Yes ### Are there any user-facing changes? No * GitHub Issue: #41121 Lead-authored-by: light-city <455954986@qq.com> Co-authored-by: Antoine Pitrou Signed-off-by: Antoine Pitrou --- cpp/src/arrow/acero/hash_join_node_test.cc | 23 ++++++++++++++++++++++ cpp/src/arrow/acero/swiss_join.cc | 5 +++++ 2 files changed, 28 insertions(+) diff --git a/cpp/src/arrow/acero/hash_join_node_test.cc b/cpp/src/arrow/acero/hash_join_node_test.cc index 63969d9a3ed4..9c3dbc176ff4 100644 --- a/cpp/src/arrow/acero/hash_join_node_test.cc +++ b/cpp/src/arrow/acero/hash_join_node_test.cc @@ -2036,6 +2036,29 @@ TEST(HashJoin, ResidualFilter) { [3, 4, "alpha", 4, 16, "alpha"]])")}); } +TEST(HashJoin, FilterEmptyRows) { + // Regression test for GH-41121. + BatchesWithSchema input_left; + input_left.batches = { + ExecBatchFromJSON({int32(), utf8(), int32()}, R"([[2, "Jarry", 28]])")}; + input_left.schema = + schema({field("id", int32()), field("name", utf8()), field("age", int32())}); + + BatchesWithSchema input_right; + input_right.batches = {ExecBatchFromJSON( + {int32(), int32(), utf8()}, + R"([[2, 10, "Jack"], [3, 12, "Mark"], [4, 15, "Tom"], [1, 10, "Jack"]])")}; + input_right.schema = + schema({field("id", int32()), field("stu_id", int32()), field("subject", utf8())}); + + const ResidualFilterCaseRunner runner{std::move(input_left), std::move(input_right)}; + + Expression filter = greater(field_ref("age"), literal(25)); + + runner.Run(JoinType::LEFT_ANTI, {"id"}, {"stu_id"}, std::move(filter), + {ExecBatchFromJSON({int32(), utf8(), int32()}, R"([[2, "Jarry", 28]])")}); +} + TEST(HashJoin, TrivialResidualFilter) { Expression always_true = equal(call("add", {field_ref("l1"), field_ref("r1")}), literal(2)); // 1 + 1 == 2 diff --git a/cpp/src/arrow/acero/swiss_join.cc b/cpp/src/arrow/acero/swiss_join.cc index 61c8bfe95414..542e943c4a82 100644 --- a/cpp/src/arrow/acero/swiss_join.cc +++ b/cpp/src/arrow/acero/swiss_join.cc @@ -2167,6 +2167,11 @@ Status JoinResidualFilter::FilterOneBatch(const ExecBatch& keypayload_batch, ARROW_DCHECK(!output_payload_ids || payload_ids_maybe_null); *num_passing_rows = 0; + + if (num_batch_rows == 0) { + return Status::OK(); + } + ARROW_ASSIGN_OR_RAISE(Datum mask, EvalFilter(keypayload_batch, num_batch_rows, batch_row_ids, key_ids_maybe_null, payload_ids_maybe_null)); From b7187ad63d2c993b5adf54f2de537c89165e7afc Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Tue, 16 Apr 2024 13:50:00 +0900 Subject: [PATCH 27/32] GH-41227: [CI][Release][GLib][Conda] Unpin gobject-introspection (#41228) ### Rationale for this change Upstream problem https://github.com/conda-forge/glib-feedstock/pull/174 has been fixed. ### What changes are included in this PR? Revert pinning. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #41227 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- dev/release/verify-release-candidate.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dev/release/verify-release-candidate.sh b/dev/release/verify-release-candidate.sh index cf49751e6e2a..f18b18aaa997 100755 --- a/dev/release/verify-release-candidate.sh +++ b/dev/release/verify-release-candidate.sh @@ -831,9 +831,7 @@ test_glib() { show_header "Build and test C GLib libraries" # Build and test C GLib - # We can unpin gobject-introspection after - # https://github.com/conda-forge/glib-feedstock/pull/174 is merged. - maybe_setup_conda glib gobject-introspection=1.78.1 meson ninja ruby + maybe_setup_conda glib gobject-introspection meson ninja ruby maybe_setup_virtualenv meson # Install bundler if doesn't exist From 5a146ed26792d99a1ac49d8ee8c47529cf4837cd Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 16 Apr 2024 09:59:51 +0200 Subject: [PATCH 28/32] GH-35081: [Python] construct pandas.DataFrame with public API in `to_pandas` (#40897) ### Rationale for this change Avoiding using pandas internals to create Block objects ourselves, using a new API for pandas>=3 * GitHub Issue: #35081 Authored-by: Joris Van den Bossche Signed-off-by: Joris Van den Bossche --- python/pyarrow/pandas-shim.pxi | 7 ++- python/pyarrow/pandas_compat.py | 75 ++++++++++++++++++--------------- 2 files changed, 48 insertions(+), 34 deletions(-) diff --git a/python/pyarrow/pandas-shim.pxi b/python/pyarrow/pandas-shim.pxi index 0409e133ada5..74f0d981b52f 100644 --- a/python/pyarrow/pandas-shim.pxi +++ b/python/pyarrow/pandas-shim.pxi @@ -38,7 +38,7 @@ cdef class _PandasAPIShim(object): object _array_like_types, _is_extension_array_dtype, _lock bint has_sparse bint _pd024 - bint _is_v1, _is_ge_v21 + bint _is_v1, _is_ge_v21, _is_ge_v3 def __init__(self): self._lock = Lock() @@ -79,6 +79,7 @@ cdef class _PandasAPIShim(object): self._is_v1 = self._loose_version < Version('2.0.0') self._is_ge_v21 = self._loose_version >= Version('2.1.0') + self._is_ge_v3 = self._loose_version >= Version('3.0.0.dev0') self._compat_module = pdcompat self._data_frame = pd.DataFrame @@ -169,6 +170,10 @@ cdef class _PandasAPIShim(object): self._check_import() return self._is_ge_v21 + def is_ge_v3(self): + self._check_import() + return self._is_ge_v3 + @property def categorical_type(self): self._check_import() diff --git a/python/pyarrow/pandas_compat.py b/python/pyarrow/pandas_compat.py index 5bd0dfcf6b94..00fa19604e5c 100644 --- a/python/pyarrow/pandas_compat.py +++ b/python/pyarrow/pandas_compat.py @@ -676,7 +676,7 @@ def get_datetimetz_type(values, dtype, type_): # Converting pyarrow.Table efficiently to pandas.DataFrame -def _reconstruct_block(item, columns=None, extension_columns=None): +def _reconstruct_block(item, columns=None, extension_columns=None, return_block=True): """ Construct a pandas Block from the `item` dictionary coming from pyarrow's serialization or returned by arrow::python::ConvertTableToPandas. @@ -709,22 +709,23 @@ def _reconstruct_block(item, columns=None, extension_columns=None): block_arr = item.get('block', None) placement = item['placement'] if 'dictionary' in item: - cat = _pandas_api.categorical_type.from_codes( + arr = _pandas_api.categorical_type.from_codes( block_arr, categories=item['dictionary'], ordered=item['ordered']) - block = _int.make_block(cat, placement=placement) elif 'timezone' in item: unit, _ = np.datetime_data(block_arr.dtype) dtype = make_datetimetz(unit, item['timezone']) if _pandas_api.is_ge_v21(): - pd_arr = _pandas_api.pd.array( + arr = _pandas_api.pd.array( block_arr.view("int64"), dtype=dtype, copy=False ) - block = _int.make_block(pd_arr, placement=placement) else: - block = _int.make_block(block_arr, placement=placement, - klass=_int.DatetimeTZBlock, - dtype=dtype) + arr = block_arr + if return_block: + block = _int.make_block(block_arr, placement=placement, + klass=_int.DatetimeTZBlock, + dtype=dtype) + return block elif 'py_array' in item: # create ExtensionBlock arr = item['py_array'] @@ -734,12 +735,14 @@ def _reconstruct_block(item, columns=None, extension_columns=None): if not hasattr(pandas_dtype, '__from_arrow__'): raise ValueError("This column does not support to be converted " "to a pandas ExtensionArray") - pd_ext_arr = pandas_dtype.__from_arrow__(arr) - block = _int.make_block(pd_ext_arr, placement=placement) + arr = pandas_dtype.__from_arrow__(arr) else: - block = _int.make_block(block_arr, placement=placement) + arr = block_arr - return block + if return_block: + return _int.make_block(arr, placement=placement) + else: + return arr, placement def make_datetimetz(unit, tz): @@ -752,9 +755,6 @@ def make_datetimetz(unit, tz): def table_to_dataframe( options, table, categories=None, ignore_metadata=False, types_mapper=None ): - from pandas.core.internals import BlockManager - from pandas import DataFrame - all_columns = [] column_indexes = [] pandas_metadata = table.schema.pandas_metadata @@ -774,15 +774,35 @@ def table_to_dataframe( _check_data_column_metadata_consistency(all_columns) columns = _deserialize_column_index(table, all_columns, column_indexes) - blocks = _table_to_blocks(options, table, categories, ext_columns_dtypes) - axes = [columns, index] - mgr = BlockManager(blocks, axes) - if _pandas_api.is_ge_v21(): - df = DataFrame._from_mgr(mgr, mgr.axes) + column_names = table.column_names + result = pa.lib.table_to_blocks(options, table, categories, + list(ext_columns_dtypes.keys())) + if _pandas_api.is_ge_v3(): + from pandas.api.internals import create_dataframe_from_blocks + + blocks = [ + _reconstruct_block( + item, column_names, ext_columns_dtypes, return_block=False) + for item in result + ] + df = create_dataframe_from_blocks(blocks, index=index, columns=columns) + return df else: - df = DataFrame(mgr) - return df + from pandas.core.internals import BlockManager + from pandas import DataFrame + + blocks = [ + _reconstruct_block(item, column_names, ext_columns_dtypes) + for item in result + ] + axes = [columns, index] + mgr = BlockManager(blocks, axes) + if _pandas_api.is_ge_v21(): + df = DataFrame._from_mgr(mgr, mgr.axes) + else: + df = DataFrame(mgr) + return df # Set of the string repr of all numpy dtypes that can be stored in a pandas @@ -1099,17 +1119,6 @@ def _reconstruct_columns_from_metadata(columns, column_indexes): return pd.Index(new_levels[0], dtype=new_levels[0].dtype, name=columns.name) -def _table_to_blocks(options, block_table, categories, extension_columns): - # Part of table_to_blockmanager - - # Convert an arrow table to Block from the internal pandas API - columns = block_table.column_names - result = pa.lib.table_to_blocks(options, block_table, categories, - list(extension_columns.keys())) - return [_reconstruct_block(item, columns, extension_columns) - for item in result] - - def _add_any_metadata(table, pandas_metadata): modified_columns = {} modified_fields = {} From eb5f162daab41b5c29afd644ba8517e8969fc56e Mon Sep 17 00:00:00 2001 From: David Li Date: Tue, 16 Apr 2024 05:04:46 -0400 Subject: [PATCH 29/32] GH-41201: [C++] Fix mistake in integration test. Explicitly cast std::string to avoid compiler interpreting char* -> bool (#41202) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * GitHub Issue: #41201 Authored-by: David Li Signed-off-by: Raúl Cumplido --- .../integration_tests/test_integration.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/cpp/src/arrow/flight/integration_tests/test_integration.cc b/cpp/src/arrow/flight/integration_tests/test_integration.cc index 21f57efd122c..5fa561cd7af2 100644 --- a/cpp/src/arrow/flight/integration_tests/test_integration.cc +++ b/cpp/src/arrow/flight/integration_tests/test_integration.cc @@ -752,7 +752,8 @@ class ExpirationTimeRenewFlightEndpointScenario : public Scenario { /// both "lol_invalid", which will result in errors attempting to set either. class SessionOptionsServer : public sql::FlightSqlServerBase { static inline const std::string invalid_option_name = "lol_invalid"; - static inline const SessionOptionValue invalid_option_value = "lol_invalid"; + static inline const SessionOptionValue invalid_option_value = + std::string("lol_invalid"); const std::string session_middleware_key; // These will never be threaded so using a plain map and no lock @@ -852,7 +853,7 @@ class SessionOptionsScenario : public Scenario { {{"foolong", 123L}, {"bardouble", 456.0}, {"lol_invalid", "this won't get set"}, - {"key_with_invalid_value", "lol_invalid"}, + {"key_with_invalid_value", std::string("lol_invalid")}, {"big_ol_string_list", std::vector{"a", "b", "sea", "dee", " ", " ", "geee", "(づ。◕‿‿◕。)づ"}}}}; ARROW_ASSIGN_OR_RAISE(auto res1, client.SetSessionOptions({}, req1)); @@ -878,16 +879,16 @@ class SessionOptionsScenario : public Scenario { } // Update ARROW_ASSIGN_OR_RAISE( - auto res3, - client.SetSessionOptions( - {}, SetSessionOptionsRequest{ - {{"foolong", std::monostate{}}, - {"big_ol_string_list", "a,b,sea,dee, , ,geee,(づ。◕‿‿◕。)づ"}}})); + auto res3, client.SetSessionOptions( + {}, SetSessionOptionsRequest{ + {{"foolong", std::monostate{}}, + {"big_ol_string_list", + std::string("a,b,sea,dee, , ,geee,(づ。◕‿‿◕。)づ")}}})); ARROW_ASSIGN_OR_RAISE(auto res4, client.GetSessionOptions({}, {})); if (res4.session_options != std::map{ {"bardouble", 456.0}, - {"big_ol_string_list", "a,b,sea,dee, , ,geee,(づ。◕‿‿◕。)づ"}}) { + {"big_ol_string_list", std::string("a,b,sea,dee, , ,geee,(づ。◕‿‿◕。)づ")}}) { return Status::Invalid("res4 incorrect: " + res4.ToString()); } From 28477374b160ca803feafb72e7f9c1d04d3c388d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Tue, 16 Apr 2024 16:47:57 +0200 Subject: [PATCH 30/32] MINOR: [Release] Update CHANGELOG.md for 16.0.0 --- CHANGELOG.md | 400 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 400 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6101f5d3cac2..e10537d4d853 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,404 @@ +# Apache Arrow 16.0.0 (2024-04-16) + +## Bug Fixes + +* [GH-20379](https://github.com/apache/arrow/issues/20379) - [Java] Dataset Failed to update reservation while freeing bytes (#40101) +* [GH-35081](https://github.com/apache/arrow/issues/35081) - [Python] construct pandas.DataFrame with public API in `to_pandas` (#40897) +* [GH-35369](https://github.com/apache/arrow/issues/35369) - [Docs] Add a missing space after ref:`IPC format ` (#38276) +* [GH-35718](https://github.com/apache/arrow/issues/35718) - [Go][Parquet] Fix for null-only encoding panic (#39497) +* [GH-36026](https://github.com/apache/arrow/issues/36026) - [C++][ORC] Catch all ORC exceptions to avoid crash (#40697) +* [GH-36026](https://github.com/apache/arrow/issues/36026) - [Python] Fix ORC test segfault in the python wheel windows test (#40609) +* [GH-37164](https://github.com/apache/arrow/issues/37164) - [Python] Attach Python stacktrace to errors in `ConvertPyError` (#39380) +* [GH-37841](https://github.com/apache/arrow/issues/37841) - [Java] Dictionary decoding not using the compression factory from the ArrowReader (#38371) +* [GH-37989](https://github.com/apache/arrow/issues/37989) - [Python] Plug reference leaks when creating Arrow array from Python list of dicts (#40412) +* [GH-38768](https://github.com/apache/arrow/issues/38768) - [Python] Empty slicing an array backwards beyond the start is now empty (#40682) +* [GH-38768](https://github.com/apache/arrow/issues/38768) - [Python] Slicing an array backwards beyond the start now includes first item. (#39240) +* [GH-38794](https://github.com/apache/arrow/issues/38794) - [C++][S3] Handle conventional content-type for directories (#40147) +* [GH-38821](https://github.com/apache/arrow/issues/38821) - [C++] Strengthen handling of duplicate slashes in S3, GCS (#40371) +* [GH-38828](https://github.com/apache/arrow/issues/38828) - [R] Ensure that streams can be written to socket connections (#38897) +* [GH-38833](https://github.com/apache/arrow/issues/38833) - [C++] Avoid hash_mean overflow (#39349) +* [GH-38923](https://github.com/apache/arrow/issues/38923) - [GLib] Fix spelling (#38924) +* [GH-38962](https://github.com/apache/arrow/issues/38962) - [C++] Fix spelling (array) (#38963) +* [GH-39291](https://github.com/apache/arrow/issues/39291) - [Docs] Remove the "Show source" links from doc pages (#40167) +* [GH-39309](https://github.com/apache/arrow/issues/39309) - [Go][Parquet] handle nil bitWriter for DeltaBinaryPacked (#39347) +* [GH-39310](https://github.com/apache/arrow/issues/39310) - [CI][Java][Docs] Failed by new module-info-compiler Maven plugin +* [GH-39416](https://github.com/apache/arrow/issues/39416) - [GLib][Docs] Fixed Broken Link in README Content (#39896) +* [GH-39424](https://github.com/apache/arrow/issues/39424) - [CI][R] test-r-rhub-debian-gcc-devel-lto-latest fails not being able to install Arrow +* [GH-39440](https://github.com/apache/arrow/issues/39440) - [Python] Calling pyarrow.dataset.ParquetFileFormat.make_write_options as a class method results in a segfault (#40976) +* [GH-39444](https://github.com/apache/arrow/issues/39444) - [Python] Fix parquet import in encryption test (#40505) +* [GH-39444](https://github.com/apache/arrow/issues/39444) - [C++][Parquet] Fix crash in Modular Encryption (#39623) +* [GH-39456](https://github.com/apache/arrow/issues/39456) - [Go][Parquet] Arrow DATE64 Type Coerced to Parquet DATE Logical Type (#39460) +* [GH-39466](https://github.com/apache/arrow/issues/39466) - [Go][Parquet] Align Arrow and Parquet Timestamp Instant/Local Semantics (#39467) +* [GH-39519](https://github.com/apache/arrow/issues/39519) - [Swift] Fix null count when using reader (#39520) +* [GH-39523](https://github.com/apache/arrow/issues/39523) - [R] Don't override explicitly set NOT_CRAN=false when on dev version (#39524) +* [GH-39558](https://github.com/apache/arrow/issues/39558) - [Java] Add SQL_ALL_TABLES_ARE_SELECTABLE, SQL_NULL_ORDERING and SQL_MAX_COLUMNS_IN_TABLE support to SqlInfoBuilder (#39561) +* [GH-39579](https://github.com/apache/arrow/issues/39579) - [Python] fix raising ValueError on _ensure_partitioning (#39593) +* [GH-39683](https://github.com/apache/arrow/issues/39683) - [Release] Use temporary direction with TEST_BINARY=1 (#39684) +* [GH-39706](https://github.com/apache/arrow/issues/39706) - [Archery] Fix `benchmark diff` subcommand (#39733) +* [GH-39738](https://github.com/apache/arrow/issues/39738) - [R] Support build against the last three released versions of Arrow (#39739) +* [GH-39765](https://github.com/apache/arrow/issues/39765) - [C++][Dataset] Fix failures in dataset-scanner-benchmark (#39794) +* [GH-39769](https://github.com/apache/arrow/issues/39769) - [C++][Device] Fix Importing nested and string types for DeviceArray (#39770) +* [GH-39782](https://github.com/apache/arrow/issues/39782) - [C++] Use correct (non-CPU) address of buffer in ExportDeviceArray (#39783) +* [GH-39788](https://github.com/apache/arrow/issues/39788) - [Python] Validate max_chunksize in Table.to_batches (#39796) +* [GH-39841](https://github.com/apache/arrow/issues/39841) - [GLib] Add support for GLib 2.56 again (#39842) +* [GH-39857](https://github.com/apache/arrow/issues/39857) - [C++] Improve error message for "chunker out of sync" condition (#39892) +* [GH-39870](https://github.com/apache/arrow/issues/39870) - [Go] Include buffered pages in TotalBytesWritten (#40105) +* [GH-39874](https://github.com/apache/arrow/issues/39874) - [CI][C++][Windows] Use pre-installed OpenSSL (#39882) +* [GH-39883](https://github.com/apache/arrow/issues/39883) - [CI][R][Windows] Use ci/scripts/install_minio.sh with Git bash (#39929) +* [GH-39909](https://github.com/apache/arrow/issues/39909) - [Java][CI] Update reference to Float16 testing file reference on Testing submodule (#39911) +* [GH-39921](https://github.com/apache/arrow/issues/39921) - [Go][Parquet] ColumnWriter not reset TotalCompressedBytes after Flush (#39922) +* [GH-39925](https://github.com/apache/arrow/issues/39925) - [Go][Parquet] Fix re-slicing in maybeReplaceValidity function (#39926) +* [GH-39935](https://github.com/apache/arrow/issues/39935) - [GLib][Docs] Use GI-DocGen instead of GTK-Doc (#40427) +* [GH-39955](https://github.com/apache/arrow/issues/39955) - [C++] Use make -j1 to install bundled bzip2 (#39956) +* [GH-39965](https://github.com/apache/arrow/issues/39965) - [C++] DatasetWriter avoid creating zero-sized batch when `max_rows_per_file` enabled (#39995) +* [GH-39973](https://github.com/apache/arrow/issues/39973) - [C++][CI] Disable debug memory pool for ASAN and Valgrind (#39975) +* [GH-39992](https://github.com/apache/arrow/issues/39992) - [CI][Docs][Java] ubuntu-docs uses Maven version in .env (#39993) +* [GH-39996](https://github.com/apache/arrow/issues/39996) - [Archery] Fix Crossbow build on a PR from a fork's main branch (#40002) +* [GH-39996](https://github.com/apache/arrow/issues/39996) - [Archery] Fix Crossbow build on a PR from a fork's main branch (#39997) +* [GH-40038](https://github.com/apache/arrow/issues/40038) - [Java] Export non empty offset buffer for variable-size layout through C Data Interface (#40043) +* [GH-40039](https://github.com/apache/arrow/issues/40039) - [Java][FlightRPC] Improve performance by removing unnecessary memory copies (#40042) +* [GH-40040](https://github.com/apache/arrow/issues/40040) - [C++][Gandiva] Make Gandiva's default cache size to be 5000 for object code cache (#40041) +* [GH-40052](https://github.com/apache/arrow/issues/40052) - [C++][FS][Azure] Fix CreateDir and DeleteDir trailing slash issues on hierarchical namespace accounts (#40054) +* [GH-40085](https://github.com/apache/arrow/issues/40085) - [C++][FS][Azure] Validate containers in AzureFileSystem::Impl::MovePaths() (#40086) +* [GH-40089](https://github.com/apache/arrow/issues/40089) - [Go] Concurrent Recordset for receiving huge recordset (#40090) +* [GH-40097](https://github.com/apache/arrow/issues/40097) - [Go][FlightRPC] Enable disabling TLS (#40098) +* [GH-40126](https://github.com/apache/arrow/issues/40126) - [C++] Decimal types with different precisions and scales bind failed in resolve type when call arithmetic function (#40223) +* [GH-40145](https://github.com/apache/arrow/issues/40145) - [C++][Docs] Correct the console emitter link (#40146) +* [GH-40153](https://github.com/apache/arrow/issues/40153) - [C++][Python] Fix test_gdb failures on 32-bit (#40293) +* [GH-40153](https://github.com/apache/arrow/issues/40153) - [Python] Make `Tensor.__getbuffer__` work on 32-bit platforms (#40294) +* [GH-40153](https://github.com/apache/arrow/issues/40153) - [Python] Avoid using np.take in Array.to_numpy() (#40295) +* [GH-40153](https://github.com/apache/arrow/issues/40153) - [Python][C++] Fix large file handling on 32-bit Python build (#40176) +* [GH-40153](https://github.com/apache/arrow/issues/40153) - [Python] Update size assumptions for 32-bit platforms (#40165) +* [GH-40153](https://github.com/apache/arrow/issues/40153) - [Python] Fix OverflowError in foreign_buffer on 32-bit platforms (#40158) +* [GH-40171](https://github.com/apache/arrow/issues/40171) - [Python] Add Type_FIXED_SIZE_LIST to _NESTED_TYPES set (#40172) +* [GH-40181](https://github.com/apache/arrow/issues/40181) - [C++] Support glog 0.7 build (#40230) +* [GH-40183](https://github.com/apache/arrow/issues/40183) - [C++] Fix cast function bind failed after add an alias name through AddAlias (#40200) +* [GH-40199](https://github.com/apache/arrow/issues/40199) - [R] dbplyr 2.5.0 forward compatibility (#40197) +* [GH-40207](https://github.com/apache/arrow/issues/40207) - [C++] TakeCC: Concatenate only once and delegate to TakeAA instead of TakeCA (#40206) +* [GH-40227](https://github.com/apache/arrow/issues/40227) - [R] ensure executable files in `create_package_with_all_dependencies` (#40232) +* [GH-40233](https://github.com/apache/arrow/issues/40233) - [C++] Fix an abort on asof_join_benchmark run for lost an arg (#40234) +* [GH-40249](https://github.com/apache/arrow/issues/40249) - [Java] Fix NPE in ArrowDatabaseMetadata (#40988) +* [GH-40266](https://github.com/apache/arrow/issues/40266) - [Python] Mark ListView as a nested type (#40265) +* [GH-40268](https://github.com/apache/arrow/issues/40268) - [Archery] Bump the version of pygit2, adapt to API changes (#40269) +* [GH-40276](https://github.com/apache/arrow/issues/40276) - [C++] Fix an simple buffer-overflow case in decimal_benchmark (#40277) +* [GH-40279](https://github.com/apache/arrow/issues/40279) - [C++] Reduce S3Client initialization time (#40299) +* [GH-40306](https://github.com/apache/arrow/issues/40306) - [C++] Fix a wrong total_bytes to generate StringType's test data in vector_hash_benchmark (#40307) +* [GH-40308](https://github.com/apache/arrow/issues/40308) - [C++][Gandiva] Add support for compute module's decimal promotion rules (#40434) +* [GH-40316](https://github.com/apache/arrow/issues/40316) - [Python] only allocate the ScalarMemoTable when used (#40565) +* [GH-40327](https://github.com/apache/arrow/issues/40327) - [C++][Parquet] Add missing config.h include in key_management_test.cc (#40330) +* [GH-40331](https://github.com/apache/arrow/issues/40331) - [C++][CMake] Add missing glog::glog dependency to arrow_util (#40332) +* [GH-40334](https://github.com/apache/arrow/issues/40334) - [C++][Gandiva] Add missing OpenSSL dependency to encrypt_utils_test.cc (#40338) +* [GH-40366](https://github.com/apache/arrow/issues/40366) - [C++] Remove const qualifier from Buffer::mutable_span_as (#40367) +* [GH-40375](https://github.com/apache/arrow/issues/40375) - [Python] Error compiling Cython files on Windows during release verification +* [GH-40395](https://github.com/apache/arrow/issues/40395) - [C++] Avoid simplifying expressions which call impure functions (#40396) +* [GH-40398](https://github.com/apache/arrow/issues/40398) - [C++] Expose protobuf dependency if opentelemetry or ORC are enabled (#40399) +* [GH-40422](https://github.com/apache/arrow/issues/40422) - [C++][FlightRPC] Add missing expiration_time arguments (#40425) +* [GH-40431](https://github.com/apache/arrow/issues/40431) - [C++] Move key_hash/key_map/light_array related files to internal for prevent using by users (#40484) +* [GH-40432](https://github.com/apache/arrow/issues/40432) - [C++] Add missing Threads::Threads dependency to arrow_static (#40433) +* [GH-40439](https://github.com/apache/arrow/issues/40439) - [Python] Fix flake8 failures in python/benchmarks/parquet.py (#40440) +* [GH-40443](https://github.com/apache/arrow/issues/40443) - [Python] Suppress python/examples/minimal_build/Dockerfile.* warnings (#40444) +* [GH-40445](https://github.com/apache/arrow/issues/40445) - [C++] Fix static build on Windows (#40446) +* [GH-40500](https://github.com/apache/arrow/issues/40500) - [C++] Ensure using bundled FlatBuffers (#40519) +* [GH-40535](https://github.com/apache/arrow/issues/40535) - [Docs][R] Set RETICULATE_PYTHON_ENV in order to find pyarrow (#40571) +* [GH-40558](https://github.com/apache/arrow/issues/40558) - [C++][CI] Fix TSAN and ASAN/UBSAN crashes (#40559) +* [GH-40562](https://github.com/apache/arrow/issues/40562) - [C++] Repair FileSystem merge error (#40564) +* [GH-40566](https://github.com/apache/arrow/issues/40566) - [C++] Fix 3.12 Python support (#40322) +* [GH-40568](https://github.com/apache/arrow/issues/40568) - [Java] Test failure in Dataset regarding TestAllTypes (#40662) +* [GH-40591](https://github.com/apache/arrow/issues/40591) - [R] Add extra CSS for navbar on pkgdown website (#40610) +* [GH-40602](https://github.com/apache/arrow/issues/40602) - [C++] Move mold linker flags to variables (#40603) +* [GH-40615](https://github.com/apache/arrow/issues/40615) - [Packaging][deb] Move libprotobuf-dev dependency to libarrow-dev from libarrow-flight-dev (#40617) +* [GH-40616](https://github.com/apache/arrow/issues/40616) - [Docs][GLib] Ensure overwriting placeholder front pages (#40618) +* [GH-40619](https://github.com/apache/arrow/issues/40619) - [Java] JDBC Adapter Build Issue (#40656) +* [GH-40623](https://github.com/apache/arrow/issues/40623) - [Python][Docs] Add workaround for autosummary (#40739) +* [GH-40634](https://github.com/apache/arrow/issues/40634) - [C#] ArrowStreamReader should not be null (#40765) +* [GH-40642](https://github.com/apache/arrow/issues/40642) - [Python] BUG: Empty slicing an array backwards beyond the start should be empty +* [GH-40652](https://github.com/apache/arrow/issues/40652) - [C++] Enlarge dest buffer according to dest offset for `CopyBitmap` benchmark (#40769) +* [GH-40668](https://github.com/apache/arrow/issues/40668) - [Ruby][CI] Require GLib 2.58 or later for timezone (#40669) +* [GH-40672](https://github.com/apache/arrow/issues/40672) - [Go][Parquet] Add proper build tags for min_max (#40676) +* [GH-40674](https://github.com/apache/arrow/issues/40674) - [GLib] Don't assume gint64 and int64_t use the same type (#40736) +* [GH-40693](https://github.com/apache/arrow/issues/40693) - [Go] Fix Decimal type precision loss on GetOneForMarshal (#40694) +* [GH-40700](https://github.com/apache/arrow/issues/40700) - [Go][CI] test-debian-12-go-1.21 fails with \`go: updates to go.mod needed\` +* [GH-40702](https://github.com/apache/arrow/issues/40702) - [R] Avoid undocumented dbplyr internals in duckdb tests (#40710) +* [GH-40703](https://github.com/apache/arrow/issues/40703) - [CI][Packaging] Homebrew can't install Python 3.12 on GHA runners (#40704) +* [GH-40706](https://github.com/apache/arrow/issues/40706) - [CI][Python] Activate ARROW_PYTHON_VENV if defined in sdist-test job (#40707) +* [GH-40716](https://github.com/apache/arrow/issues/40716) - [Java][Integration] Fix test_package_java in verification scripts (#40724) +* [GH-40718](https://github.com/apache/arrow/issues/40718) - [JS] Fix set visitor in vectors for js dates (#40725) +* [GH-40719](https://github.com/apache/arrow/issues/40719) - [Go] Make `arrow.Null` non-null for `arrow.TypeEqual` to work properly with `new(arrow.NullType)` (#40802) +* [GH-40727](https://github.com/apache/arrow/issues/40727) - [C++][Gandiva] 'ilike' function does not work (#40728) +* [GH-40751](https://github.com/apache/arrow/issues/40751) - [C++] Fix protobuf package name setting for builds with substrait (#40753) +* [GH-40773](https://github.com/apache/arrow/issues/40773) - [Java] add `DENSEUNION` case to StructWriters, resolves #40773 (#40809) +* [GH-40775](https://github.com/apache/arrow/issues/40775) - [Benchmarking][Java] Fix conbench timeout (#40786) +* [GH-40788](https://github.com/apache/arrow/issues/40788) - [C#] Override Accept in MapArray (#40789) +* [GH-40790](https://github.com/apache/arrow/issues/40790) - [C#] Account for offset and length when getting fields of a StructArray (#40805) +* [GH-40792](https://github.com/apache/arrow/issues/40792) - [C#] Fix slicing a previously sliced array (#40793) +* [GH-40847](https://github.com/apache/arrow/issues/40847) - [Go] update readme (#40877) +* [GH-40851](https://github.com/apache/arrow/issues/40851) - [JS] Fix nullcount and make vectors created from typed arrays not nullable (#40852) +* [GH-40855](https://github.com/apache/arrow/issues/40855) - [C++][ORC] Fix `std::filesystem` related link error with ORC 2.0.0 or later (#41023) +* [GH-40858](https://github.com/apache/arrow/issues/40858) - [R] Remove dangling commas from codegen.R (#40859) +* [GH-40863](https://github.com/apache/arrow/issues/40863) - [C++] Fix TSAN link error for module library (#40864) +* [GH-40870](https://github.com/apache/arrow/issues/40870) - [C#] Update CompareValidityBuffer() to pass when unspecified final bits are not identical (#40873) +* [GH-40878](https://github.com/apache/arrow/issues/40878) - [JAVA] Fix flight-sql-jdbc-driver shading issues (#40879) +* [GH-40891](https://github.com/apache/arrow/issues/40891) - [JS] Store Dates as TimestampMillisecond (#40892) +* [GH-40893](https://github.com/apache/arrow/issues/40893) - [Java][FlightRPC] Support IntervalMonthDayNanoVector in FlightSQL JDBC Driver (#40894) +* [GH-40896](https://github.com/apache/arrow/issues/40896) - [Java] Remove runtime dependencies on Eclipse, logback (#40904) +* [GH-40898](https://github.com/apache/arrow/issues/40898) - [C#] Do not import length-zero buffers from C Data Interface Arrays (#41054) +* [GH-40900](https://github.com/apache/arrow/issues/40900) - [Go] Fix Mallocator Weirdness (#40902) +* [GH-40907](https://github.com/apache/arrow/issues/40907) - [Java][FlightSQL] Shade slf4j-api in JDBC driver (#40908) +* [GH-40952](https://github.com/apache/arrow/issues/40952) - [Java][FlightSQL] Clean up flight-sql-jdbc-driver dependencies (#40953) +* [GH-40954](https://github.com/apache/arrow/issues/40954) - [CI] Fix use of obsolete docker-compose command on Github Actions (#40949) +* [GH-40961](https://github.com/apache/arrow/issues/40961) - [GLib] Suppress warnings for Vala examples on macOS (#40962) +* [GH-40974](https://github.com/apache/arrow/issues/40974) - [CI][Python] CI failures on Python builds due to pytest_cython (#40975) +* [GH-40991](https://github.com/apache/arrow/issues/40991) - [R] Prefer r-universe, add a startup message (#41019) +* [GH-40999](https://github.com/apache/arrow/issues/40999) - [Java] Fix AIOOBE trying to splitAndTransfer DUV within nullable struct (#41000) +* [GH-41004](https://github.com/apache/arrow/issues/41004) - [C++][FS][Azure] Don't run TestGetFileInfoGenerator() with Valgrind (#41163) +* [GH-41005](https://github.com/apache/arrow/issues/41005) - [CI] HDFS and skyhook tests require docker compose usage because they require multiple containers (#41027) +* [GH-41007](https://github.com/apache/arrow/issues/41007) - [CI][Archery] Correctly interpolate environment variables from docker compose when using docker cli on archery docker (#41026) +* [GH-41016](https://github.com/apache/arrow/issues/41016) - [C++] Fix null count check in BooleanArray.true_count() (#41070) +* [GH-41024](https://github.com/apache/arrow/issues/41024) - [C++] IO: fixing compiling in gcc 7.5.0 (#41025) +* [GH-41032](https://github.com/apache/arrow/issues/41032) - [C++][Parquet] Bugfixes and more tests in boolean arrow decoding (#41037) +* [GH-41039](https://github.com/apache/arrow/issues/41039) - [Python] ListView pandas tests should use np.nan instead of None (#41040) +* [GH-41044](https://github.com/apache/arrow/issues/41044) - [C++] formatting.h: Make sure space is allocated for the 'Z' when formatting timestamps (#41045) +* [GH-41061](https://github.com/apache/arrow/issues/41061) - [C++] Ignore ARROW_USE_MOLD/ARROW_USE_LLD with clang < 12 (#41062) +* [GH-41088](https://github.com/apache/arrow/issues/41088) - [CI][Crossbow] Fix GitHub Actions workflow syntax error (#41091) +* [GH-41119](https://github.com/apache/arrow/issues/41119) - [Archery][Packaging][CI] Avoid using --progress flag on Docker on Windows on archery (#41120) +* [GH-41121](https://github.com/apache/arrow/issues/41121) - [C++] Fix: left anti join filter empty rows. (#41122) +* [GH-41124](https://github.com/apache/arrow/issues/41124) - [CI][C++] Don't use CMake 3.29.1 with vcpkg (#41151) +* [GH-41127](https://github.com/apache/arrow/issues/41127) - [CI] Use GitHub Actions instead of Azure Pipelines for docker-tests (#41153) +* [GH-41145](https://github.com/apache/arrow/issues/41145) - [R][CI] test-r-dev-duckdb fails installing duckdb (#41152) +* [GH-41147](https://github.com/apache/arrow/issues/41147) - [CI][C++] Use newer LLVM on Ubuntu 24.04 (#41150) +* [GH-41148](https://github.com/apache/arrow/issues/41148) - [CI][R][C++] test-r-linux-valgrind has started failing +* [GH-41149](https://github.com/apache/arrow/issues/41149) - [C++][Python] Sporadic asof\_join failures in PyArrow +* [GH-41154](https://github.com/apache/arrow/issues/41154) - [C++] Fix Valgrind error in string-to-float16 conversion (#41155) +* [GH-41167](https://github.com/apache/arrow/issues/41167) - [CI][Release][GLib][Conda] Pin gobject-introspection to 1.78.1 (#41181) +* [GH-41169](https://github.com/apache/arrow/issues/41169) - [CI][Release] Specify --build-config explicitly on Windows (#41178) +* [GH-41176](https://github.com/apache/arrow/issues/41176) - [C++] Stop defining ARROW_TEST_MEMCHECK in config.h.cmake (#41177) +* [GH-41201](https://github.com/apache/arrow/issues/41201) - [C++] Fix mistake in integration test. Explicitly cast std::string to avoid compiler interpreting char* -> bool (#41202) + + +## New Features and Improvements + +* [GH-18014](https://github.com/apache/arrow/issues/18014) - [C++] Filesystem implementation for Azure Blob Storage +* [GH-20127](https://github.com/apache/arrow/issues/20127) - [Python][CI] Remove legacy hdfs tests from hdfs and hypothesis setup (#40363) +* [GH-20127](https://github.com/apache/arrow/issues/20127) - [Python] Remove deprecated pyarrow.filesystem legacy implementations (#39825) +* [GH-20213](https://github.com/apache/arrow/issues/20213) - [C++] Implement cast to/from halffloat (#40067) +* [GH-20339](https://github.com/apache/arrow/issues/20339) - [C++] Add residual filter support to swiss join (#39487) +* [GH-23221](https://github.com/apache/arrow/issues/23221) - [C++] Add support for building with Emscripten (#37821) +* [GH-24826](https://github.com/apache/arrow/issues/24826) - [Java] Add DUV.setOffset method (#40985) +* [GH-24834](https://github.com/apache/arrow/issues/24834) - [C#] Support writing compressed IPC data (#39871) +* [GH-30915](https://github.com/apache/arrow/issues/30915) - [C++][Python] Add missing methods to `RecordBatch` (#39506) +* [GH-31545](https://github.com/apache/arrow/issues/31545) - [GLib] Enable clang-format (#40451) +* [GH-31735](https://github.com/apache/arrow/issues/31735) - [Docs][Release] Move release verification guide to developers documentation (#39960) +* [GH-33499](https://github.com/apache/arrow/issues/33499) - [Python][CI] Support ORC in Windows wheels +* [GH-34235](https://github.com/apache/arrow/issues/34235) - [Python] Correct test marker for join_asof tests (#40666) +* [GH-34235](https://github.com/apache/arrow/issues/34235) - [Python] Add `join_asof` binding (#34234) +* [GH-34865](https://github.com/apache/arrow/issues/34865) - [C++][Java][Flight RPC] Add Session management messages (#34817) +* [GH-35875](https://github.com/apache/arrow/issues/35875) - [R] Update Readme (#40148) +* [GH-35941](https://github.com/apache/arrow/issues/35941) - [Dev][MATLAB] Add clang-format configuration to pre-commit (#40588) +* [GH-36656](https://github.com/apache/arrow/issues/36656) - [Dev] Validate in merge script if issue has an assigned milestone already (#40771) +* [GH-37286](https://github.com/apache/arrow/issues/37286) - [Java] Start adding nullability/nullness annotations (#37723) +* [GH-37328](https://github.com/apache/arrow/issues/37328) - [Python] Add a function to download and extract timezone database on Windows (#38179) +* [GH-37381](https://github.com/apache/arrow/issues/37381) - [Python][CI][Packaging] Enable ORC on Windows Appveyor CI and Windows wheels for pyarrow +* [GH-37484](https://github.com/apache/arrow/issues/37484) - [Python] Add a FixedSizeTensorScalar class (#37533) +* [GH-37931](https://github.com/apache/arrow/issues/37931) - [Python][CI][Dev][Python] Release and merge script errors (#37819)" (#40150) +* [GH-38010](https://github.com/apache/arrow/issues/38010) - [Python] Construct pyarrow.Field and ChunkedArray through Arrow PyCapsule Protocol (#40818) +* [GH-38309](https://github.com/apache/arrow/issues/38309) - [C++] build filesystems as separate modules (#39067) +* [GH-38560](https://github.com/apache/arrow/issues/38560) - [C++][Parquet] Rewrite BYTE_STREAM_SPLIT SSE optimizations using xsimd (#40335) +* [GH-38573](https://github.com/apache/arrow/issues/38573) - [Java][FlightRPC] Try all locations in JDBC driver (#40104) +* [GH-38659](https://github.com/apache/arrow/issues/38659) - [CI][MATLAB][Packaging] Add MATLAB `packaging` task to crossbow `tasks.yml` (#38660) +* [GH-38663](https://github.com/apache/arrow/issues/38663) - [C++] Add support for service-specific endpoint for S3 using `AWS_ENDPOINT_URL_S3` (#39160) +* [GH-38703](https://github.com/apache/arrow/issues/38703) - [C++][FS][Azure] Implement DeleteFile() (#39840) +* [GH-38704](https://github.com/apache/arrow/issues/38704) - [C++] Implement Azure FileSystem Move() via Azure DataLake Storage Gen 2 API (#39904) +* [GH-38717](https://github.com/apache/arrow/issues/38717) - [C++] Add ImportChunkedArray and ExportChunkedArray to/from ArrowArrayStream (#39455) +* [GH-38916](https://github.com/apache/arrow/issues/38916) - [R] Simplify dataset and table print output (#38917) +* [GH-38988](https://github.com/apache/arrow/issues/38988) - [Go] Expose dictionary size from DictionaryBuilder (#39521) +* [GH-38998](https://github.com/apache/arrow/issues/38998) - [Java] Build memory-core and memory-unsafe as JPMS modules (#39011) +* [GH-39001](https://github.com/apache/arrow/issues/39001) - [Java] Modularize remaining modules (#39221) +* [GH-39057](https://github.com/apache/arrow/issues/39057) - [CI][C++][Go] Don't run jobs that use a self-hosted GitHub Actions Runner on fork (#39903) +* [GH-39069](https://github.com/apache/arrow/issues/39069) - [C++][FS][Azure] Use the generic filesystem tests (#40567) +* [GH-39147](https://github.com/apache/arrow/issues/39147) - [R] Add Bootstrap.r (#39148) +* [GH-39231](https://github.com/apache/arrow/issues/39231) - [C++][Compute] Add binary_slice kernel for fixed size binary (#39245) +* [GH-39233](https://github.com/apache/arrow/issues/39233) - [Compute] Add some duration kernels (#39358) +* [GH-39270](https://github.com/apache/arrow/issues/39270) - [C++] Avoid creating memory manager instance for every buffer view/copy (#39271) +* [GH-39277](https://github.com/apache/arrow/issues/39277) - [Python] Fix missing byte_width attribute on DataType class (#39592) +* [GH-39330](https://github.com/apache/arrow/issues/39330) - [Java][CI] Fix or suppress spurious errorprone warnings (#39529) +* [GH-39336](https://github.com/apache/arrow/issues/39336) - [C++][Parquet] Minor: Style enhancement for parquet::FileMetaData (#39337) +* [GH-39352](https://github.com/apache/arrow/issues/39352) - [FS][Azure] Enable azure in builds (#39971) +* [GH-39377](https://github.com/apache/arrow/issues/39377) - [C++] IO: Reuse same buffer in CompressedInputStream (#39807) +* [GH-39385](https://github.com/apache/arrow/issues/39385) - [C++] Use more permissable return code for rename (#39481) +* [GH-39398](https://github.com/apache/arrow/issues/39398) - [C++][Parquet] Use std::count in ColumnReader ReadLevels (#39397) +* [GH-39427](https://github.com/apache/arrow/issues/39427) - [GLib] Update script and documentation (#39428) +* [GH-39463](https://github.com/apache/arrow/issues/39463) - [C++] Support cast kernel from large string, (large) binary to dictionary (#40017) +* [GH-39532](https://github.com/apache/arrow/issues/39532) - [Python] Compatibility with NumPy 2.0 +* [GH-39549](https://github.com/apache/arrow/issues/39549) - [C++] Pass -jN to make in external projects (#39550) +* [GH-39552](https://github.com/apache/arrow/issues/39552) - [Go] inclusion of option to use replacer when creating csv strings with go library (#39576) +* [GH-39555](https://github.com/apache/arrow/issues/39555) - [Packaging][Python] Enable building pyarrow against numpy 2.0 (#39557) +* [GH-39560](https://github.com/apache/arrow/issues/39560) - [C++][Parquet] Add integration test for BYTE_STREAM_SPLIT (#39570) +* [GH-39574](https://github.com/apache/arrow/issues/39574) - [Go] Enable PollFlightInfo in Flight RPC (#39575) +* [GH-39621](https://github.com/apache/arrow/issues/39621) - [CI][Packaging] Update vcpkg to 2023.11.20 release (#39622) +* [GH-39651](https://github.com/apache/arrow/issues/39651) - [Python] Basic pyarrow bindings for Binary/StringView classes (#39652) +* [GH-39654](https://github.com/apache/arrow/issues/39654) - [Java] Upgrade to Netty 4.1.105.Final (#39655) +* [GH-39663](https://github.com/apache/arrow/issues/39663) - [C++] Ensure top-level benchmarks present informative metrics (#40091) +* [GH-39666](https://github.com/apache/arrow/issues/39666) - [C++] Ensure CSV and JSON benchmarks present a bytes/s or items/s metric (#39764) +* [GH-39667](https://github.com/apache/arrow/issues/39667) - [C++] Ensure dataset benchmarks present a bytes/s or items/s metric (#39766) +* [GH-39669](https://github.com/apache/arrow/issues/39669) - [C++][Gandiva] Ensure Gandiva benchmarks present a bytes/s or items/s metric (#40435) +* [GH-39680](https://github.com/apache/arrow/issues/39680) - [Java] enable half float support on Java module (#39681) +* [GH-39697](https://github.com/apache/arrow/issues/39697) - [R] Source build should check if offline (#39699) +* [GH-39702](https://github.com/apache/arrow/issues/39702) - [GLib] Add support for time zone in GArrowTimestampDataType (#39717) +* [GH-39704](https://github.com/apache/arrow/issues/39704) - [C++][Parquet] Benchmark levels decoding (#39705) +* [GH-39707](https://github.com/apache/arrow/issues/39707) - [Java] Enable local build cache for Maven/Java build (#39708) +* [GH-39718](https://github.com/apache/arrow/issues/39718) - [C++][FS][Azure] Remove StatusFromErrorResponse as it's not necessary (#39719) +* [GH-39720](https://github.com/apache/arrow/issues/39720) - [Swift] Switch reader to use arrow field instead of proto for building arrays (#39721) +* [GH-39734](https://github.com/apache/arrow/issues/39734) - [Java] Bump org.codehaus.mojo:exec-maven-plugin from 1.6.0 to 3.1.1 (#39696) +* [GH-39747](https://github.com/apache/arrow/issues/39747) - [C++][Parquet] Make BYTE_STREAM_SPLIT routines type-agnostic (#39748) +* [GH-39752](https://github.com/apache/arrow/issues/39752) - [Java] Remove Static imports for Utf8 Usage (#40683) +* [GH-39761](https://github.com/apache/arrow/issues/39761) - [Docs] Link to Go documentation references outdated documentation from 2018 (#39750) +* [GH-39771](https://github.com/apache/arrow/issues/39771) - [C++][Device] Generic CopyBatchTo/CopyArrayTo memory types (#39772) +* [GH-39774](https://github.com/apache/arrow/issues/39774) - [Go] Add public access to PreparedStatement handle (#39775) +* [GH-39779](https://github.com/apache/arrow/issues/39779) - [Python] Expose force_virtual_addressing in PyArrow (#39819) +* [GH-39780](https://github.com/apache/arrow/issues/39780) - [Python][Parquet] Support hashing for FileMetaData and ParquetSchema (#39781) +* [GH-39812](https://github.com/apache/arrow/issues/39812) - [Python] Add bindings for ListView and LargeListView (#39813) +* [GH-39815](https://github.com/apache/arrow/issues/39815) - [C++] Document and micro-optimize ChunkResolver::Resolve() (#39817) +* [GH-39823](https://github.com/apache/arrow/issues/39823) - [C++] Allow building cpp/src/arrow/**/*.cc without waiting bundled libraries (#39824) +* [GH-39837](https://github.com/apache/arrow/issues/39837) - [Go][Flight] Allow cloning existing cookies in middleware (#39838) +* [GH-39843](https://github.com/apache/arrow/issues/39843) - [C++][Parquet] Parquet binary length overflow exception should contain the length of binary (#39844) +* [GH-39845](https://github.com/apache/arrow/issues/39845) - [C++][Parquet] Minor: avoid creating a new Reader object in Decoder::SetData (#39847) +* [GH-39848](https://github.com/apache/arrow/issues/39848) - [Python][Packaging] Build pyarrow wheels with numpy RC instead of nightly (#41097) +* [GH-39852](https://github.com/apache/arrow/issues/39852) - [Python] Support creating Binary/StringView arrays from python objects (#39853) +* [GH-39855](https://github.com/apache/arrow/issues/39855) - [Python] ListView support for pa.array() (#40160) +* [GH-39859](https://github.com/apache/arrow/issues/39859) - [R] Remove macOS from the allow list (#39861) +* [GH-39863](https://github.com/apache/arrow/issues/39863) - [C++] Thirdparty: Bump google benchmark to 1.8.3 (#39878) +* [GH-39864](https://github.com/apache/arrow/issues/39864) - [C++] DataType::ToString support optionally show metadata (#39888) +* [GH-39872](https://github.com/apache/arrow/issues/39872) - [Packaging][Ubuntu] Add support for Ubuntu 24.04 Noble Numbat (#39887) +* [GH-39885](https://github.com/apache/arrow/issues/39885) - [CI][MATLAB] Bump matlab-actions/setup-matlab and matlab-actions/run-tests from v1 to v2 (#39886) +* [GH-39900](https://github.com/apache/arrow/issues/39900) - [Java][CI] To upload Maven and Memory Netty Buffer Patch into Apache Nightly repository (#39901) +* [GH-39910](https://github.com/apache/arrow/issues/39910) - [Go] Add func to load prepared statement from ActionCreatePreparedStatementResult (#39913) +* [GH-39928](https://github.com/apache/arrow/issues/39928) - [C++][Gandiva] Accept LLVM 18 (#39934) +* [GH-39930](https://github.com/apache/arrow/issues/39930) - [C++] Use Requires instead of Libs for system RE2 in arrow.pc (#39932) +* [GH-39946](https://github.com/apache/arrow/issues/39946) - [Java] Bump com.puppycrawl.tools:checkstyle from 8.19 to 8.29 (#39694) +* [GH-39958](https://github.com/apache/arrow/issues/39958) - [Python][CI] Remove upper pin on pytest (#40487) +* [GH-39962](https://github.com/apache/arrow/issues/39962) - [C++] Small CSV reader refactoring (#39963) +* [GH-39968](https://github.com/apache/arrow/issues/39968) - [Python][FS][Azure] Minimal Python bindings for `AzureFileSystem` (#40021) +* [GH-39978](https://github.com/apache/arrow/issues/39978) - [C++][Parquet] Expand BYTE_STREAM_SPLIT to support FIXED_LEN_BYTE_ARRAY, INT32 and INT64 (#40094) +* [GH-39979](https://github.com/apache/arrow/issues/39979) - [Python] Low-level bindings for exporting/importing the C Device Interface (#39980) +* [GH-39984](https://github.com/apache/arrow/issues/39984) - [Python] Add ChunkedArray import/export to/from C (#39985) +* [GH-39987](https://github.com/apache/arrow/issues/39987) - [R] Make it possible to use a rtools libarrow on windows (#39986) +* [GH-40011](https://github.com/apache/arrow/issues/40011) - [CI] Update Fedora to 39 from 38 (#40012) +* [GH-40023](https://github.com/apache/arrow/issues/40023) - [Python] Use Cast() instead of CastTo (#40116) +* [GH-40026](https://github.com/apache/arrow/issues/40026) - [C++][FS][Azure] Add support for reading user defined metadata (#40671) +* [GH-40028](https://github.com/apache/arrow/issues/40028) - [C++][FS][Azure] Add AzureFileSystem support to FileSystemFromUri() (#40325) +* [GH-40029](https://github.com/apache/arrow/issues/40029) - [Packaging][Ubuntu] Drop support for Ubuntu 23.10 Mantic Minotaur (#40030) +* [GH-40037](https://github.com/apache/arrow/issues/40037) - [C++][FS][Azure] Make attempted reads and writes against directories fail fast (#40119) +* [GH-40055](https://github.com/apache/arrow/issues/40055) - [Java][Docs] Simplify use of Filter and Expression into Dataset Substrait (#40056) +* [GH-40059](https://github.com/apache/arrow/issues/40059) - [C++][Python] Basic conversion of RecordBatch to Arrow Tensor (#40064) +* [GH-40060](https://github.com/apache/arrow/issues/40060) - [C++][Python] Basic conversion of RecordBatch to Arrow Tensor - add support for different data types (#40359) +* [GH-40061](https://github.com/apache/arrow/issues/40061) - [C++][Python] Basic conversion of RecordBatch to Arrow Tensor - add option to cast NULL to NaN (#40803) +* [GH-40066](https://github.com/apache/arrow/issues/40066) - [Python] Support `requested_schema` in `__arrow_c_stream__()` (#40070) +* [GH-40074](https://github.com/apache/arrow/issues/40074) - [C++][FS][Azure] Implement `DeleteFile()` for flat-namespace storage accounts (#40075) +* [GH-40077](https://github.com/apache/arrow/issues/40077) - [CI] Use GitHub hosted M1 macOS runner (#40437) +* [GH-40079](https://github.com/apache/arrow/issues/40079) - [CI][Packaging] Enable Azure in more tests and builds (#40080) +* [GH-40082](https://github.com/apache/arrow/issues/40082) - [CI][C++] Add a job on ARM64 macOS (#40456) +* [GH-40092](https://github.com/apache/arrow/issues/40092) - [Python] Support Binary/StringView conversion to numpy/pandas (#40093) +* [GH-40095](https://github.com/apache/arrow/issues/40095) - [C++][Parquet] Remove AVX512 variants of BYTE_STREAM_SPLIT encoding (#40127) +* [GH-40113](https://github.com/apache/arrow/issues/40113) - [Go][Parquet] New RegisterCodec function (#40114) +* [GH-40133](https://github.com/apache/arrow/issues/40133) - [C++][Parquet][Tools] Print FIXED_LEN_BYTE_ARRAY length (#40132) +* [GH-40142](https://github.com/apache/arrow/issues/40142) - [Python] Allow FileInfo instances to be passed to dataset init (#40143) +* [GH-40151](https://github.com/apache/arrow/issues/40151) - [C++] Make S3 narrative test more flexible (#40144) +* [GH-40152](https://github.com/apache/arrow/issues/40152) - [C++] Remove redundant invocation of BatchesFromTable (#40173) +* [GH-40155](https://github.com/apache/arrow/issues/40155) - [Go][FlightRPC][FlightSQL] Implement Session Management (#40284) +* [GH-40159](https://github.com/apache/arrow/issues/40159) - [Python][CI] Add 32-bit Debian build on Crossbow (#40164) +* [GH-40190](https://github.com/apache/arrow/issues/40190) - [R][Docs] Update NEWS.md with build system changes (#40191) +* [GH-40205](https://github.com/apache/arrow/issues/40205) - [Python] ListView arrow-to-pandas conversion (#40482) +* [GH-40209](https://github.com/apache/arrow/issues/40209) - [C++][CMake] Use "RapidJSON" CMake target for RapidJSON (#40210) +* [GH-40212](https://github.com/apache/arrow/issues/40212) - [R][CI] Add a C++ with gcc 14 build (#40244) +* [GH-40221](https://github.com/apache/arrow/issues/40221) - [C++][CMake] Use arrow/util/config.h.cmake instead of add_definitions() (#40222) +* [GH-40224](https://github.com/apache/arrow/issues/40224) - [C++] Fix: improve the backpressure handling in the dataset writer (#40722) +* [GH-40228](https://github.com/apache/arrow/issues/40228) - [C++][CMake] Improve description why we need to initialize AWS C++ SDK in arrow-s3fs-test (#40229) +* [GH-40236](https://github.com/apache/arrow/issues/40236) - [Python][CI] Disable generating C lines in Cython tracebacks (#40225) +* [GH-40261](https://github.com/apache/arrow/issues/40261) - [Go] Don't export array functions with unexposed return types (#40272) +* [GH-40273](https://github.com/apache/arrow/issues/40273) - [Python] Support construction of Run-End Encoded arrays in pa.array(..) (#40341) +* [GH-40274](https://github.com/apache/arrow/issues/40274) - [C++] Add support for system glog 0.7 (#40275) +* [GH-40280](https://github.com/apache/arrow/issues/40280) - [C++] Specialize ResolvedChunk::Value on value-specific types instead of entire class (#40281) +* [GH-40291](https://github.com/apache/arrow/issues/40291) - [Python] Accept dict in pyarrow.record_batch() function (#40292) +* [GH-40318](https://github.com/apache/arrow/issues/40318) - [C++][Docs] Add documentation of array factories (#40373) +* [GH-40323](https://github.com/apache/arrow/issues/40323) - [R][CI] Use rocker/r-ver instead of library/r-base (#40321) +* [GH-40328](https://github.com/apache/arrow/issues/40328) - [C++][Parquet] Allow use of FileDecryptionProperties after the CryptoFactory is destroyed (#40329) +* [GH-40333](https://github.com/apache/arrow/issues/40333) - [Docs] Improve env var docs for ARROW_USER_SIMD_LEVEL (#40374) +* [GH-40345](https://github.com/apache/arrow/issues/40345) - [FlightRPC][C++][Java][Go] Add URI scheme to reuse connection (#40084) +* [GH-40357](https://github.com/apache/arrow/issues/40357) - [C++] Add benchmark for ToTensor conversions (#40358) +* [GH-40370](https://github.com/apache/arrow/issues/40370) - [C++] Define ARROW_FORCE_INLINE for non-MSVC builds (#40372) +* [GH-40376](https://github.com/apache/arrow/issues/40376) - [Python] Update for NumPy 2.0 ABI change in PyArray_Descr->elsize (#40418) +* [GH-40377](https://github.com/apache/arrow/issues/40377) - [Python][CI] Fix install of nightly dask in integration tests (#40378) +* [GH-40379](https://github.com/apache/arrow/issues/40379) - [Python] Fix byte_width for binary(0) + fix hypothesis tests (#40381) +* [GH-40394](https://github.com/apache/arrow/issues/40394) - [C++] Add support for mold (#40397) +* [GH-40400](https://github.com/apache/arrow/issues/40400) - [C++] Add support for LLD (#40927) +* [GH-40402](https://github.com/apache/arrow/issues/40402) - [GLib] Add missing compute function options classes (#40403) +* [GH-40405](https://github.com/apache/arrow/issues/40405) - [C++] Produce better error message when Move is attempted on flat-namespace accounts (#40406) +* [GH-40428](https://github.com/apache/arrow/issues/40428) - [Python][CI] Fix dataset partition filter tests with pandas nightly (#40429) +* [GH-40438](https://github.com/apache/arrow/issues/40438) - [GLib] Add GArrowTimestampParser (#40457) +* [GH-40441](https://github.com/apache/arrow/issues/40441) - [GLib][Docs] Use Sphinx for Apache Arrow GLib front page (#40442) +* [GH-40448](https://github.com/apache/arrow/issues/40448) - [CI][Dev] Run pre-commit (#40449) +* [GH-40454](https://github.com/apache/arrow/issues/40454) - [CI][Debian] Update Debian to 12 from 11 (#40455) +* [GH-40495](https://github.com/apache/arrow/issues/40495) - [GLib] Use G_DECLARE_DERIVABLE_TYPE() (#40497) +* [GH-40498](https://github.com/apache/arrow/issues/40498) - [GLib] Remove arrow-glib/gobject-type.h (#40499) +* [GH-40507](https://github.com/apache/arrow/issues/40507) - [C++][ORC] Upgrade ORC to 2.0.0 (#40508) +* [GH-40515](https://github.com/apache/arrow/issues/40515) - [Java] Bump org.apache.maven dependencies from 3.3.9 to 3.8.7 (#40514) +* [GH-40522](https://github.com/apache/arrow/issues/40522) - [Dev][Go] Add Dependabot configuration for Go (#40523) +* [GH-40536](https://github.com/apache/arrow/issues/40536) - [CI] : Migrate remaining jobs away from self-hosted mac runners. (#40537) +* [GH-40540](https://github.com/apache/arrow/issues/40540) - [CI][C++] Don't install FlatBuffers (#40541) +* [GH-40542](https://github.com/apache/arrow/issues/40542) - [Dev][CI] Run pre-commit to all files (#40543) +* [GH-40544](https://github.com/apache/arrow/issues/40544) - [Dev] Add cmake-format configuration to pre-commit (#40545) +* [GH-40549](https://github.com/apache/arrow/issues/40549) - [Java] Revert bump org.apache.maven.plugins:maven-shade-plugin from 3.2.4 to 3.5.2 in /java (#40462)" (#41006) +* [GH-40551](https://github.com/apache/arrow/issues/40551) - [Release][Docs] Improve documentation for patch Release process (#40552) +* [GH-40553](https://github.com/apache/arrow/issues/40553) - [C#] Avoid logger instantiations per request (#40554) +* [GH-40573](https://github.com/apache/arrow/issues/40573) - [GLib][Ruby][CSV] Add support for customizing timestamp parsers (#40590) +* [GH-40575](https://github.com/apache/arrow/issues/40575) - [Docs][Python] Added JsonFileFormat to docs (#40585) +* [GH-40577](https://github.com/apache/arrow/issues/40577) - [C++] Ensure pkg-config flags include -ldl for static builds (#40578) +* [GH-40586](https://github.com/apache/arrow/issues/40586) - [Dev][C++][Python][R] Use pre-commit for clang-format (#40587) +* [GH-40607](https://github.com/apache/arrow/issues/40607) - [C++] Rename `Function::is_impure()` to `is_pure()` (#40608) +* [GH-40621](https://github.com/apache/arrow/issues/40621) - [C++] Add missing util/config.h in arrow/io/compressed_test.cc (#40625) +* [GH-40630](https://github.com/apache/arrow/issues/40630) - [Go][Parquet] Enable writing of Parquet footer without closing file (#40654) +* [GH-40659](https://github.com/apache/arrow/issues/40659) - [Python][C++] Support conversion of pyarrow.RunEndEncodedArray to numpy/pandas (#40661) +* [GH-40680](https://github.com/apache/arrow/issues/40680) - [Java] Test JDK 22 in CI (#41038) +* [GH-40684](https://github.com/apache/arrow/issues/40684) - [Java][Docs] JNI module debugging with IntelliJ (#40685) +* [GH-40689](https://github.com/apache/arrow/issues/40689) - [Docs] Add nanoarrow to implementation status page (#41052) +* [GH-40690](https://github.com/apache/arrow/issues/40690) - [C#][FlightRPC] Add do_exchange csharp implementation (#40691) +* [GH-40695](https://github.com/apache/arrow/issues/40695) - [C++] Expand Substrait type support (#40696) +* [GH-40698](https://github.com/apache/arrow/issues/40698) - [C++] Create registry for Devices to map DeviceType to MemoryManager in C Device Data import (#40699) +* [GH-40720](https://github.com/apache/arrow/issues/40720) - [Python] Simplify and improve perf of creation of the column names in Table.to_pandas (#40721) +* [GH-40731](https://github.com/apache/arrow/issues/40731) - [C++][Parquet] Minor enhancement code of encryption (#40732) +* [GH-40733](https://github.com/apache/arrow/issues/40733) - [Go] Require Go 1.21 or later (#40848) +* [GH-40745](https://github.com/apache/arrow/issues/40745) - [Java][FlightRPC] Support configuring backpressure threshold (#41051) +* [GH-40767](https://github.com/apache/arrow/issues/40767) - [C++][Parquet] Simplify PageWriter and ColumnWriter creation (#40768) +* [GH-40783](https://github.com/apache/arrow/issues/40783) - [C++] Re-order loads and stores in MemoryPoolStats update (#40647) +* [GH-40784](https://github.com/apache/arrow/issues/40784) - [JS] Use bigIntToNumber (#40785) +* [GH-40791](https://github.com/apache/arrow/issues/40791) - [Dev][CI] Use the official hadolint configuration (#40794) +* [GH-40796](https://github.com/apache/arrow/issues/40796) - [Java] set `lastSet` in `ListVector.setNull` to avoid O(n²) in ListVectors with lots of nulls (#40810) +* [GH-40799](https://github.com/apache/arrow/issues/40799) - [Doc][Format] Implementation status page should list canonical extension types (#41053) +* [GH-40801](https://github.com/apache/arrow/issues/40801) - [Docs] Clarify device identifier documentation in the Arrow C Device data interface (#41101) +* [GH-40806](https://github.com/apache/arrow/issues/40806) - [C++] Revert changes from PR #40857 (#40980) +* [GH-40806](https://github.com/apache/arrow/issues/40806) - [C++] Correctly report asimd/neon in GetRuntimeInfo (#40857) +* [GH-40814](https://github.com/apache/arrow/issues/40814) - [C++] Thirdparty: bump zstd to 1.5.6 (#40837) +* [GH-40833](https://github.com/apache/arrow/issues/40833) - [Docs][Release] Make explicit in the documentation that verifying binaries is not required in order to case a vote (#40834) +* [GH-40841](https://github.com/apache/arrow/issues/40841) - [Docs][C++][Python] Add initial documentation for RecordBatch::Tensor conversion (#40842) +* [GH-40843](https://github.com/apache/arrow/issues/40843) - [Java] Cleanup protobuf-maven-plugin usage (#40844) +* [GH-40866](https://github.com/apache/arrow/issues/40866) - [C++][Python] Basic conversion of RecordBatch to Arrow Tensor - add support for row-major (#40867) +* [GH-40872](https://github.com/apache/arrow/issues/40872) - [C++][Parquet] Encoding: Optimize DecodeArrow/Decode(bitmap) for PlainBooleanDecoder (#40876) +* [GH-40882](https://github.com/apache/arrow/issues/40882) - [C++] Suppress shorten-64-to-32 warnings in CUDA/Skyhook codes (#40883) +* [GH-40888](https://github.com/apache/arrow/issues/40888) - [Go][FlightRPC] support conversion from array.Duration in FlightSQL driver (#40889) +* [GH-40964](https://github.com/apache/arrow/issues/40964) - [CI][Archery] Archery linking should also check for undefined symbols Linux +* [GH-40983](https://github.com/apache/arrow/issues/40983) - [C++] Fix unused function build error (#40984) +* [GH-40994](https://github.com/apache/arrow/issues/40994) - [C++][Parquet] RleBooleanDecoder supports DecodeArrow with nulls (#40995) +* [GH-41034](https://github.com/apache/arrow/issues/41034) - [C++][FS][Azure] Adjust DeleteDir/DeleteDirContents/GetFileInfoSelector behaviors against Azure for generic filesystem tests (#41068) +* [GH-41043](https://github.com/apache/arrow/issues/41043) - [CI][Python] check message in test_make_write_options_error for Cython 2 (#41059) +* [GH-41047](https://github.com/apache/arrow/issues/41047) - [C#] Address performance issue of reading from StringArray (#41048) +* [GH-41098](https://github.com/apache/arrow/issues/41098) - [Python] Add copy keyword in Array.__array__ for numpy 2.0+ compatibility (#41071) +* [GH-41100](https://github.com/apache/arrow/issues/41100) - [Python][Packaging] PyArrow wheel building is failing because of disabled vcpkg install of liblzma +* [GH-41227](https://github.com/apache/arrow/issues/41227) - [CI][Release][GLib][Conda] Unpin gobject-introspection (#41228) +* [PARQUET-2423](https://issues.apache.org/jira/browse/PARQUET-2423) - [C++][Parquet] Avoid allocating buffer object in RecordReader's SkipRecords (#39818) + + + # Apache Arrow 6.0.1 (2021-11-18) ## Bug Fixes From 4cd1b348ff48ac0a029e03549446cac4b587a275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Tue, 16 Apr 2024 16:47:57 +0200 Subject: [PATCH 31/32] MINOR: [Release] Update .deb/.rpm changelogs for 16.0.0 --- .../linux-packages/apache-arrow-apt-source/debian/changelog | 6 ++++++ .../apache-arrow-release/yum/apache-arrow-release.spec.in | 3 +++ dev/tasks/linux-packages/apache-arrow/debian/changelog | 6 ++++++ dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in | 3 +++ 4 files changed, 18 insertions(+) diff --git a/dev/tasks/linux-packages/apache-arrow-apt-source/debian/changelog b/dev/tasks/linux-packages/apache-arrow-apt-source/debian/changelog index ea99882edfb2..1486738f0167 100644 --- a/dev/tasks/linux-packages/apache-arrow-apt-source/debian/changelog +++ b/dev/tasks/linux-packages/apache-arrow-apt-source/debian/changelog @@ -1,3 +1,9 @@ +apache-arrow-apt-source (16.0.0-1) unstable; urgency=low + + * New upstream release. + + -- Raúl Cumplido Tue, 16 Apr 2024 14:47:57 -0000 + apache-arrow-apt-source (15.0.2-1) unstable; urgency=low * New upstream release. diff --git a/dev/tasks/linux-packages/apache-arrow-release/yum/apache-arrow-release.spec.in b/dev/tasks/linux-packages/apache-arrow-release/yum/apache-arrow-release.spec.in index 0e28c475ffef..676c9e0d16de 100644 --- a/dev/tasks/linux-packages/apache-arrow-release/yum/apache-arrow-release.spec.in +++ b/dev/tasks/linux-packages/apache-arrow-release/yum/apache-arrow-release.spec.in @@ -102,6 +102,9 @@ else fi %changelog +* Tue Apr 16 2024 Raúl Cumplido - 16.0.0-1 +- New upstream release. + * Wed Mar 13 2024 Raúl Cumplido - 15.0.2-1 - New upstream release. diff --git a/dev/tasks/linux-packages/apache-arrow/debian/changelog b/dev/tasks/linux-packages/apache-arrow/debian/changelog index 68a8c01e1ec1..1cb60af4691d 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/changelog +++ b/dev/tasks/linux-packages/apache-arrow/debian/changelog @@ -1,3 +1,9 @@ +apache-arrow (16.0.0-1) unstable; urgency=low + + * New upstream release. + + -- Raúl Cumplido Tue, 16 Apr 2024 14:47:57 -0000 + apache-arrow (15.0.2-1) unstable; urgency=low * New upstream release. diff --git a/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in b/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in index 946514137956..3ede1814b865 100644 --- a/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in +++ b/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in @@ -881,6 +881,9 @@ Documentation for Apache Parquet GLib. %endif %changelog +* Tue Apr 16 2024 Raúl Cumplido - 16.0.0-1 +- New upstream release. + * Wed Mar 13 2024 Raúl Cumplido - 15.0.2-1 - New upstream release. From 6a28035c2b49b432dc63f5ee7524d76b4ed2d762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Tue, 16 Apr 2024 16:48:07 +0200 Subject: [PATCH 32/32] MINOR: [Release] Update versions for 16.0.0 --- c_glib/meson.build | 2 +- ci/scripts/PKGBUILD | 2 +- cpp/CMakeLists.txt | 2 +- cpp/vcpkg.json | 2 +- csharp/Directory.Build.props | 2 +- dev/tasks/homebrew-formulae/apache-arrow-glib.rb | 2 +- dev/tasks/homebrew-formulae/apache-arrow.rb | 2 +- docs/source/_static/versions.json | 9 +++++++-- go/arrow/doc.go | 2 +- go/parquet/writer_properties.go | 2 +- java/adapter/avro/pom.xml | 2 +- java/adapter/jdbc/pom.xml | 2 +- java/adapter/orc/pom.xml | 2 +- java/algorithm/pom.xml | 2 +- java/bom/pom.xml | 2 +- java/c/pom.xml | 2 +- java/compression/pom.xml | 2 +- java/dataset/pom.xml | 2 +- java/flight/flight-core/pom.xml | 2 +- java/flight/flight-integration-tests/pom.xml | 2 +- java/flight/flight-sql-jdbc-core/pom.xml | 2 +- java/flight/flight-sql-jdbc-driver/pom.xml | 2 +- java/flight/flight-sql/pom.xml | 2 +- java/flight/pom.xml | 2 +- java/format/pom.xml | 2 +- java/gandiva/pom.xml | 2 +- java/maven/module-info-compiler-maven-plugin/pom.xml | 2 +- java/maven/pom.xml | 2 +- java/memory/memory-core/pom.xml | 2 +- java/memory/memory-netty-buffer-patch/pom.xml | 2 +- java/memory/memory-netty/pom.xml | 2 +- java/memory/memory-unsafe/pom.xml | 2 +- java/memory/pom.xml | 2 +- java/performance/pom.xml | 2 +- java/pom.xml | 2 +- java/tools/pom.xml | 2 +- java/vector/pom.xml | 2 +- js/package.json | 2 +- matlab/CMakeLists.txt | 2 +- python/CMakeLists.txt | 2 +- python/setup.py | 2 +- r/DESCRIPTION | 2 +- r/NEWS.md | 2 +- r/pkgdown/assets/versions.json | 8 ++++++-- ruby/red-arrow-cuda/lib/arrow-cuda/version.rb | 2 +- ruby/red-arrow-dataset/lib/arrow-dataset/version.rb | 2 +- .../red-arrow-flight-sql/lib/arrow-flight-sql/version.rb | 2 +- ruby/red-arrow-flight/lib/arrow-flight/version.rb | 2 +- ruby/red-arrow/lib/arrow/version.rb | 2 +- ruby/red-gandiva/lib/gandiva/version.rb | 2 +- ruby/red-parquet/lib/parquet/version.rb | 2 +- 51 files changed, 62 insertions(+), 53 deletions(-) diff --git a/c_glib/meson.build b/c_glib/meson.build index 04d0129855b2..2022e389d18d 100644 --- a/c_glib/meson.build +++ b/c_glib/meson.build @@ -37,7 +37,7 @@ project('arrow-glib', 'c', 'cpp', # * 22.04: 0.61.2 meson_version: '>=0.53.2') -version = '16.0.0-SNAPSHOT' +version = '16.0.0' if version.endswith('-SNAPSHOT') version_numbers = version.split('-')[0].split('.') version_tag = version.split('-')[1] diff --git a/ci/scripts/PKGBUILD b/ci/scripts/PKGBUILD index dfdf90501f49..925a77ec50f6 100644 --- a/ci/scripts/PKGBUILD +++ b/ci/scripts/PKGBUILD @@ -18,7 +18,7 @@ _realname=arrow pkgbase=mingw-w64-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" -pkgver=15.0.2.9000 +pkgver=16.0.0 pkgrel=8000 pkgdesc="Apache Arrow is a cross-language development platform for in-memory data (mingw-w64)" arch=("any") diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 1fbf0bfcfb52..941f5dbda73d 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -71,7 +71,7 @@ if(POLICY CMP0135) cmake_policy(SET CMP0135 NEW) endif() -set(ARROW_VERSION "16.0.0-SNAPSHOT") +set(ARROW_VERSION "16.0.0") string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" ARROW_BASE_VERSION "${ARROW_VERSION}") diff --git a/cpp/vcpkg.json b/cpp/vcpkg.json index a0f0aa1008dc..62b0b4999cc5 100644 --- a/cpp/vcpkg.json +++ b/cpp/vcpkg.json @@ -1,6 +1,6 @@ { "name": "arrow", - "version-string": "16.0.0-SNAPSHOT", + "version-string": "16.0.0", "dependencies": [ "abseil", { diff --git a/csharp/Directory.Build.props b/csharp/Directory.Build.props index c759c49b395d..515ae14068d2 100644 --- a/csharp/Directory.Build.props +++ b/csharp/Directory.Build.props @@ -29,7 +29,7 @@ Apache Arrow library Copyright 2016-2024 The Apache Software Foundation The Apache Software Foundation - 16.0.0-SNAPSHOT + 16.0.0 diff --git a/dev/tasks/homebrew-formulae/apache-arrow-glib.rb b/dev/tasks/homebrew-formulae/apache-arrow-glib.rb index f47c4d737f1a..1382f7069fb3 100644 --- a/dev/tasks/homebrew-formulae/apache-arrow-glib.rb +++ b/dev/tasks/homebrew-formulae/apache-arrow-glib.rb @@ -29,7 +29,7 @@ class ApacheArrowGlib < Formula desc "GLib bindings for Apache Arrow" homepage "https://arrow.apache.org/" - url "https://www.apache.org/dyn/closer.lua?path=arrow/arrow-16.0.0-SNAPSHOT/apache-arrow-16.0.0-SNAPSHOT.tar.gz" + url "https://www.apache.org/dyn/closer.lua?path=arrow/arrow-16.0.0/apache-arrow-16.0.0.tar.gz" sha256 "9948ddb6d4798b51552d0dca3252dd6e3a7d0f9702714fc6f5a1b59397ce1d28" license "Apache-2.0" head "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/apache/arrow.git", branch: "main" diff --git a/dev/tasks/homebrew-formulae/apache-arrow.rb b/dev/tasks/homebrew-formulae/apache-arrow.rb index 881ca50fdecf..fb201db8bff5 100644 --- a/dev/tasks/homebrew-formulae/apache-arrow.rb +++ b/dev/tasks/homebrew-formulae/apache-arrow.rb @@ -29,7 +29,7 @@ class ApacheArrow < Formula desc "Columnar in-memory analytics layer designed to accelerate big data" homepage "https://arrow.apache.org/" - url "https://www.apache.org/dyn/closer.lua?path=arrow/arrow-16.0.0-SNAPSHOT/apache-arrow-16.0.0-SNAPSHOT.tar.gz" + url "https://www.apache.org/dyn/closer.lua?path=arrow/arrow-16.0.0/apache-arrow-16.0.0.tar.gz" sha256 "9948ddb6d4798b51552d0dca3252dd6e3a7d0f9702714fc6f5a1b59397ce1d28" license "Apache-2.0" head "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/apache/arrow.git", branch: "main" diff --git a/docs/source/_static/versions.json b/docs/source/_static/versions.json index d647709cda72..f8ff19095b3f 100644 --- a/docs/source/_static/versions.json +++ b/docs/source/_static/versions.json @@ -1,15 +1,20 @@ [ { - "name": "16.0 (dev)", + "name": "17.0 (dev)", "version": "dev/", "url": "https://arrow.apache.org/docs/dev/" }, { - "name": "15.0 (stable)", + "name": "16.0 (stable)", "version": "", "url": "https://arrow.apache.org/docs/", "preferred": true }, + { + "name": "15.0", + "version": "15.0/", + "url": "https://arrow.apache.org/docs/15.0/" + }, { "name": "14.0", "version": "14.0/", diff --git a/go/arrow/doc.go b/go/arrow/doc.go index 19f24c5d0b8c..76bdfeaa5be8 100644 --- a/go/arrow/doc.go +++ b/go/arrow/doc.go @@ -34,7 +34,7 @@ To build with tinygo include the noasm build tag. */ package arrow -const PkgVersion = "16.0.0-SNAPSHOT" +const PkgVersion = "16.0.0" //go:generate go run _tools/tmpl/main.go -i -data=numeric.tmpldata type_traits_numeric.gen.go.tmpl type_traits_numeric.gen_test.go.tmpl array/numeric.gen.go.tmpl array/numericbuilder.gen.go.tmpl array/bufferbuilder_numeric.gen.go.tmpl //go:generate go run _tools/tmpl/main.go -i -data=datatype_numeric.gen.go.tmpldata datatype_numeric.gen.go.tmpl tensor/numeric.gen.go.tmpl tensor/numeric.gen_test.go.tmpl diff --git a/go/parquet/writer_properties.go b/go/parquet/writer_properties.go index 7fd3ed9f4be8..6bd89895f15c 100644 --- a/go/parquet/writer_properties.go +++ b/go/parquet/writer_properties.go @@ -46,7 +46,7 @@ const ( DefaultStatsEnabled = true // If the stats are larger than 4K the writer will skip writing them out anyways. DefaultMaxStatsSize int64 = 4096 - DefaultCreatedBy = "parquet-go version 16.0.0-SNAPSHOT" + DefaultCreatedBy = "parquet-go version 16.0.0" DefaultRootName = "schema" ) diff --git a/java/adapter/avro/pom.xml b/java/adapter/avro/pom.xml index 6644748b5e59..2e0161539186 100644 --- a/java/adapter/avro/pom.xml +++ b/java/adapter/avro/pom.xml @@ -16,7 +16,7 @@ org.apache.arrow arrow-java-root - 16.0.0-SNAPSHOT + 16.0.0 ../../pom.xml diff --git a/java/adapter/jdbc/pom.xml b/java/adapter/jdbc/pom.xml index b6c450ecd32b..81237825b76f 100644 --- a/java/adapter/jdbc/pom.xml +++ b/java/adapter/jdbc/pom.xml @@ -16,7 +16,7 @@ org.apache.arrow arrow-java-root - 16.0.0-SNAPSHOT + 16.0.0 ../../pom.xml diff --git a/java/adapter/orc/pom.xml b/java/adapter/orc/pom.xml index 060aed5dcf15..699bf4ece5b0 100644 --- a/java/adapter/orc/pom.xml +++ b/java/adapter/orc/pom.xml @@ -115,7 +115,7 @@ org.apache.arrow arrow-java-root - 16.0.0-SNAPSHOT + 16.0.0 ../../pom.xml diff --git a/java/algorithm/pom.xml b/java/algorithm/pom.xml index 25669010d2d4..3ffc5c2d8f12 100644 --- a/java/algorithm/pom.xml +++ b/java/algorithm/pom.xml @@ -14,7 +14,7 @@ org.apache.arrow arrow-java-root - 16.0.0-SNAPSHOT + 16.0.0 arrow-algorithm Arrow Algorithms diff --git a/java/bom/pom.xml b/java/bom/pom.xml index 2406886222dc..8f87e549a4e9 100644 --- a/java/bom/pom.xml +++ b/java/bom/pom.xml @@ -20,7 +20,7 @@ org.apache.arrow arrow-bom - 16.0.0-SNAPSHOT + 16.0.0 pom Arrow Bill of Materials Arrow Bill of Materials diff --git a/java/c/pom.xml b/java/c/pom.xml index ffd41b62dd67..62b1712eb6ce 100644 --- a/java/c/pom.xml +++ b/java/c/pom.xml @@ -13,7 +13,7 @@ arrow-java-root org.apache.arrow - 16.0.0-SNAPSHOT + 16.0.0 4.0.0 diff --git a/java/compression/pom.xml b/java/compression/pom.xml index 0db3fae4653a..30bbcd2f8be4 100644 --- a/java/compression/pom.xml +++ b/java/compression/pom.xml @@ -14,7 +14,7 @@ org.apache.arrow arrow-java-root - 16.0.0-SNAPSHOT + 16.0.0 arrow-compression Arrow Compression diff --git a/java/dataset/pom.xml b/java/dataset/pom.xml index 43b913167390..35fd869ef092 100644 --- a/java/dataset/pom.xml +++ b/java/dataset/pom.xml @@ -15,7 +15,7 @@ arrow-java-root org.apache.arrow - 16.0.0-SNAPSHOT + 16.0.0 4.0.0 diff --git a/java/flight/flight-core/pom.xml b/java/flight/flight-core/pom.xml index 9ea6393f0f6d..62404d274344 100644 --- a/java/flight/flight-core/pom.xml +++ b/java/flight/flight-core/pom.xml @@ -14,7 +14,7 @@ arrow-flight org.apache.arrow - 16.0.0-SNAPSHOT + 16.0.0 ../pom.xml diff --git a/java/flight/flight-integration-tests/pom.xml b/java/flight/flight-integration-tests/pom.xml index 905c8bdaf013..07e4e449add6 100644 --- a/java/flight/flight-integration-tests/pom.xml +++ b/java/flight/flight-integration-tests/pom.xml @@ -15,7 +15,7 @@ arrow-flight org.apache.arrow - 16.0.0-SNAPSHOT + 16.0.0 ../pom.xml diff --git a/java/flight/flight-sql-jdbc-core/pom.xml b/java/flight/flight-sql-jdbc-core/pom.xml index 20996d7496c0..9d3a925ac373 100644 --- a/java/flight/flight-sql-jdbc-core/pom.xml +++ b/java/flight/flight-sql-jdbc-core/pom.xml @@ -16,7 +16,7 @@ arrow-flight org.apache.arrow - 16.0.0-SNAPSHOT + 16.0.0 ../pom.xml 4.0.0 diff --git a/java/flight/flight-sql-jdbc-driver/pom.xml b/java/flight/flight-sql-jdbc-driver/pom.xml index b586a0e46f51..e872a90e76c8 100644 --- a/java/flight/flight-sql-jdbc-driver/pom.xml +++ b/java/flight/flight-sql-jdbc-driver/pom.xml @@ -16,7 +16,7 @@ arrow-flight org.apache.arrow - 16.0.0-SNAPSHOT + 16.0.0 ../pom.xml 4.0.0 diff --git a/java/flight/flight-sql/pom.xml b/java/flight/flight-sql/pom.xml index 1da6ed276011..45221ac45c70 100644 --- a/java/flight/flight-sql/pom.xml +++ b/java/flight/flight-sql/pom.xml @@ -14,7 +14,7 @@ arrow-flight org.apache.arrow - 16.0.0-SNAPSHOT + 16.0.0 ../pom.xml diff --git a/java/flight/pom.xml b/java/flight/pom.xml index 5b9caafa82ef..593b25b60e99 100644 --- a/java/flight/pom.xml +++ b/java/flight/pom.xml @@ -15,7 +15,7 @@ arrow-java-root org.apache.arrow - 16.0.0-SNAPSHOT + 16.0.0 4.0.0 diff --git a/java/format/pom.xml b/java/format/pom.xml index a98edefbeb21..134bef41bea2 100644 --- a/java/format/pom.xml +++ b/java/format/pom.xml @@ -15,7 +15,7 @@ arrow-java-root org.apache.arrow - 16.0.0-SNAPSHOT + 16.0.0 arrow-format diff --git a/java/gandiva/pom.xml b/java/gandiva/pom.xml index cb2deb07db42..6903fc904685 100644 --- a/java/gandiva/pom.xml +++ b/java/gandiva/pom.xml @@ -14,7 +14,7 @@ org.apache.arrow arrow-java-root - 16.0.0-SNAPSHOT + 16.0.0 org.apache.arrow.gandiva diff --git a/java/maven/module-info-compiler-maven-plugin/pom.xml b/java/maven/module-info-compiler-maven-plugin/pom.xml index 910fede33ce3..c846e5a7a1ba 100644 --- a/java/maven/module-info-compiler-maven-plugin/pom.xml +++ b/java/maven/module-info-compiler-maven-plugin/pom.xml @@ -16,7 +16,7 @@ org.apache.arrow.maven.plugins arrow-maven-plugins - 16.0.0-SNAPSHOT + 16.0.0 module-info-compiler-maven-plugin maven-plugin diff --git a/java/maven/pom.xml b/java/maven/pom.xml index f6a6da3afe53..a88ab1ea8c4b 100644 --- a/java/maven/pom.xml +++ b/java/maven/pom.xml @@ -17,7 +17,7 @@ --> org.apache.arrow.maven.plugins arrow-maven-plugins - 16.0.0-SNAPSHOT + 16.0.0 Arrow Maven Plugins pom diff --git a/java/memory/memory-core/pom.xml b/java/memory/memory-core/pom.xml index 2a92d032942c..822973bf14e0 100644 --- a/java/memory/memory-core/pom.xml +++ b/java/memory/memory-core/pom.xml @@ -13,7 +13,7 @@ arrow-memory org.apache.arrow - 16.0.0-SNAPSHOT + 16.0.0 4.0.0 diff --git a/java/memory/memory-netty-buffer-patch/pom.xml b/java/memory/memory-netty-buffer-patch/pom.xml index 97b224e9ccc5..40658a28964c 100644 --- a/java/memory/memory-netty-buffer-patch/pom.xml +++ b/java/memory/memory-netty-buffer-patch/pom.xml @@ -15,7 +15,7 @@ arrow-memory org.apache.arrow - 16.0.0-SNAPSHOT + 16.0.0 4.0.0 diff --git a/java/memory/memory-netty/pom.xml b/java/memory/memory-netty/pom.xml index 9b20e1bde2ae..b7e39e98ad15 100644 --- a/java/memory/memory-netty/pom.xml +++ b/java/memory/memory-netty/pom.xml @@ -13,7 +13,7 @@ arrow-memory org.apache.arrow - 16.0.0-SNAPSHOT + 16.0.0 4.0.0 diff --git a/java/memory/memory-unsafe/pom.xml b/java/memory/memory-unsafe/pom.xml index 07a140e59452..d0aa6100584f 100644 --- a/java/memory/memory-unsafe/pom.xml +++ b/java/memory/memory-unsafe/pom.xml @@ -13,7 +13,7 @@ arrow-memory org.apache.arrow - 16.0.0-SNAPSHOT + 16.0.0 4.0.0 diff --git a/java/memory/pom.xml b/java/memory/pom.xml index 9e2d61276573..d3c492c17dfc 100644 --- a/java/memory/pom.xml +++ b/java/memory/pom.xml @@ -14,7 +14,7 @@ org.apache.arrow arrow-java-root - 16.0.0-SNAPSHOT + 16.0.0 arrow-memory Arrow Memory diff --git a/java/performance/pom.xml b/java/performance/pom.xml index 3f69be32a20e..9162cba5ca6a 100644 --- a/java/performance/pom.xml +++ b/java/performance/pom.xml @@ -14,7 +14,7 @@ arrow-java-root org.apache.arrow - 16.0.0-SNAPSHOT + 16.0.0 arrow-performance jar diff --git a/java/pom.xml b/java/pom.xml index 9892061677d0..3148d4304111 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -20,7 +20,7 @@ org.apache.arrow arrow-java-root - 16.0.0-SNAPSHOT + 16.0.0 pom Apache Arrow Java Root POM diff --git a/java/tools/pom.xml b/java/tools/pom.xml index 9b55f07c013d..a8ed6ffcc17b 100644 --- a/java/tools/pom.xml +++ b/java/tools/pom.xml @@ -14,7 +14,7 @@ org.apache.arrow arrow-java-root - 16.0.0-SNAPSHOT + 16.0.0 arrow-tools Arrow Tools diff --git a/java/vector/pom.xml b/java/vector/pom.xml index 436ffd15b297..089ad802aed6 100644 --- a/java/vector/pom.xml +++ b/java/vector/pom.xml @@ -14,7 +14,7 @@ org.apache.arrow arrow-java-root - 16.0.0-SNAPSHOT + 16.0.0 arrow-vector Arrow Vectors diff --git a/js/package.json b/js/package.json index 773cf23e35b3..6ff6c2387307 100644 --- a/js/package.json +++ b/js/package.json @@ -121,5 +121,5 @@ "engines": { "node": ">=12.0" }, - "version": "16.0.0-SNAPSHOT" + "version": "16.0.0" } diff --git a/matlab/CMakeLists.txt b/matlab/CMakeLists.txt index b85f782d2d37..6a80dc1cee62 100644 --- a/matlab/CMakeLists.txt +++ b/matlab/CMakeLists.txt @@ -94,7 +94,7 @@ endfunction() set(CMAKE_CXX_STANDARD 17) -set(MLARROW_VERSION "16.0.0-SNAPSHOT") +set(MLARROW_VERSION "16.0.0") string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" MLARROW_BASE_VERSION "${MLARROW_VERSION}") project(mlarrow VERSION "${MLARROW_BASE_VERSION}") diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index af65ea7d6148..f59019fa3ab9 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -21,7 +21,7 @@ cmake_minimum_required(VERSION 3.16) project(pyarrow) -set(PYARROW_VERSION "16.0.0-SNAPSHOT") +set(PYARROW_VERSION "16.0.0") string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" PYARROW_BASE_VERSION "${PYARROW_VERSION}") # Running from a Python sdist tarball diff --git a/python/setup.py b/python/setup.py index ce6996dc1d43..5f4f0567db04 100755 --- a/python/setup.py +++ b/python/setup.py @@ -414,7 +414,7 @@ def get_outputs(self): # If the event of not running from a git clone (e.g. from a git archive # or a Python sdist), see if we can set the version number ourselves -default_version = '16.0.0-SNAPSHOT' +default_version = '16.0.0' if (not os.path.exists('../.git') and not os.environ.get('SETUPTOOLS_SCM_PRETEND_VERSION')): os.environ['SETUPTOOLS_SCM_PRETEND_VERSION'] = \ diff --git a/r/DESCRIPTION b/r/DESCRIPTION index c9f84e2e794c..69197432ee37 100644 --- a/r/DESCRIPTION +++ b/r/DESCRIPTION @@ -1,6 +1,6 @@ Package: arrow Title: Integration to 'Apache' 'Arrow' -Version: 15.0.2.9000 +Version: 16.0.0 Authors@R: c( person("Neal", "Richardson", email = "neal.p.richardson@gmail.com", role = c("aut")), person("Ian", "Cook", email = "ianmcook@gmail.com", role = c("aut")), diff --git a/r/NEWS.md b/r/NEWS.md index ce422c6cbdfd..62207da50b6f 100644 --- a/r/NEWS.md +++ b/r/NEWS.md @@ -17,7 +17,7 @@ under the License. --> -# arrow 15.0.2.9000 +# arrow 16.0.0 # arrow 15.0.2 diff --git a/r/pkgdown/assets/versions.json b/r/pkgdown/assets/versions.json index e4e9534a81b4..75d179f24051 100644 --- a/r/pkgdown/assets/versions.json +++ b/r/pkgdown/assets/versions.json @@ -1,12 +1,16 @@ [ { - "name": "15.0.2.9000 (dev)", + "name": "16.0.0.9000 (dev)", "version": "dev/" }, { - "name": "15.0.2 (release)", + "name": "16.0.0 (release)", "version": "" }, + { + "name": "15.0.2", + "version": "15.0/" + }, { "name": "14.0.2", "version": "14.0/" diff --git a/ruby/red-arrow-cuda/lib/arrow-cuda/version.rb b/ruby/red-arrow-cuda/lib/arrow-cuda/version.rb index 816751fcba8f..1ef10ea6c162 100644 --- a/ruby/red-arrow-cuda/lib/arrow-cuda/version.rb +++ b/ruby/red-arrow-cuda/lib/arrow-cuda/version.rb @@ -16,7 +16,7 @@ # under the License. module ArrowCUDA - VERSION = "16.0.0-SNAPSHOT" + VERSION = "16.0.0" module Version numbers, TAG = VERSION.split("-") diff --git a/ruby/red-arrow-dataset/lib/arrow-dataset/version.rb b/ruby/red-arrow-dataset/lib/arrow-dataset/version.rb index e391493e1597..f0996ac63b2e 100644 --- a/ruby/red-arrow-dataset/lib/arrow-dataset/version.rb +++ b/ruby/red-arrow-dataset/lib/arrow-dataset/version.rb @@ -16,7 +16,7 @@ # under the License. module ArrowDataset - VERSION = "16.0.0-SNAPSHOT" + VERSION = "16.0.0" module Version numbers, TAG = VERSION.split("-") diff --git a/ruby/red-arrow-flight-sql/lib/arrow-flight-sql/version.rb b/ruby/red-arrow-flight-sql/lib/arrow-flight-sql/version.rb index d90751be80cb..71ef49a62776 100644 --- a/ruby/red-arrow-flight-sql/lib/arrow-flight-sql/version.rb +++ b/ruby/red-arrow-flight-sql/lib/arrow-flight-sql/version.rb @@ -16,7 +16,7 @@ # under the License. module ArrowFlightSQL - VERSION = "16.0.0-SNAPSHOT" + VERSION = "16.0.0" module Version numbers, TAG = VERSION.split("-") diff --git a/ruby/red-arrow-flight/lib/arrow-flight/version.rb b/ruby/red-arrow-flight/lib/arrow-flight/version.rb index 6c2d676809f8..d3de1d3e7ba4 100644 --- a/ruby/red-arrow-flight/lib/arrow-flight/version.rb +++ b/ruby/red-arrow-flight/lib/arrow-flight/version.rb @@ -16,7 +16,7 @@ # under the License. module ArrowFlight - VERSION = "16.0.0-SNAPSHOT" + VERSION = "16.0.0" module Version numbers, TAG = VERSION.split("-") diff --git a/ruby/red-arrow/lib/arrow/version.rb b/ruby/red-arrow/lib/arrow/version.rb index 2b1c14e38911..80ac16bc19da 100644 --- a/ruby/red-arrow/lib/arrow/version.rb +++ b/ruby/red-arrow/lib/arrow/version.rb @@ -16,7 +16,7 @@ # under the License. module Arrow - VERSION = "16.0.0-SNAPSHOT" + VERSION = "16.0.0" module Version numbers, TAG = VERSION.split("-") diff --git a/ruby/red-gandiva/lib/gandiva/version.rb b/ruby/red-gandiva/lib/gandiva/version.rb index 0a20a520194b..740d7ed1be26 100644 --- a/ruby/red-gandiva/lib/gandiva/version.rb +++ b/ruby/red-gandiva/lib/gandiva/version.rb @@ -16,7 +16,7 @@ # under the License. module Gandiva - VERSION = "16.0.0-SNAPSHOT" + VERSION = "16.0.0" module Version numbers, TAG = VERSION.split("-") diff --git a/ruby/red-parquet/lib/parquet/version.rb b/ruby/red-parquet/lib/parquet/version.rb index cd61c772a328..103c98741e32 100644 --- a/ruby/red-parquet/lib/parquet/version.rb +++ b/ruby/red-parquet/lib/parquet/version.rb @@ -16,7 +16,7 @@ # under the License. module Parquet - VERSION = "16.0.0-SNAPSHOT" + VERSION = "16.0.0" module Version numbers, TAG = VERSION.split("-")