diff --git a/cpp/src/arrow/array/builder_binary.h b/cpp/src/arrow/array/builder_binary.h index 21993ce54931d..70fde2a2e6464 100644 --- a/cpp/src/arrow/array/builder_binary.h +++ b/cpp/src/arrow/array/builder_binary.h @@ -447,6 +447,10 @@ class ARROW_EXPORT FixedSizeBinaryBuilder : public ArrayBuilder { } } + void UnsafeAppend(const char* value) { + UnsafeAppend(reinterpret_cast(value)); + } + void UnsafeAppend(util::string_view value) { #ifndef NDEBUG CheckValueSize(static_cast(value.size())); diff --git a/cpp/src/arrow/python/python_to_arrow.cc b/cpp/src/arrow/python/python_to_arrow.cc index 252577eef0109..6d98211e1a64e 100644 --- a/cpp/src/arrow/python/python_to_arrow.cc +++ b/cpp/src/arrow/python/python_to_arrow.cc @@ -1034,7 +1034,7 @@ Result> ConvertPySequence(PyObject* obj, PyObject* return chunked_converter->ToChunkedArray(); } else { // If the converter can't overflow spare the capacity error checking on the hot-path, - // this improves the performance roughly by ~10 for primitive types. + // this improves the performance roughly by ~10% for primitive types. if (mask != nullptr && mask != Py_None) { RETURN_NOT_OK(ExtendMasked(converter.get(), seq, mask, size)); } else { diff --git a/python/pyarrow/tests/test_convert_builtin.py b/python/pyarrow/tests/test_convert_builtin.py index f4894a4226a94..c4580db6f425e 100644 --- a/python/pyarrow/tests/test_convert_builtin.py +++ b/python/pyarrow/tests/test_convert_builtin.py @@ -764,6 +764,15 @@ def test_fixed_size_bytes_does_not_accept_varying_lengths(): pa.array(data, type=pa.binary(4)) +def test_fixed_size_binary_length_check(): + # ARROW-10193 + data = [b'\x19h\r\x9e\x00\x00\x00\x00\x01\x9b\x9fA'] + assert len(data[0]) == 12 + ty = pa.binary(12) + arr = pa.array(data, type=ty) + assert arr.to_pylist() == data + + def test_sequence_date(): data = [datetime.date(2000, 1, 1), None, datetime.date(1970, 1, 1), datetime.date(2040, 2, 26)]