This is an automated email from the ASF dual-hosted git repository.
westonpace pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 11ae62a142 GH-34150: [C++] [Python] Fix improper initialization of
ConversionOptions (#34156)
11ae62a142 is described below
commit 11ae62a1426a1594ed750be1f25334fe7198356d
Author: rtpsw <[email protected]>
AuthorDate: Fri Feb 17 22:15:34 2023 +0200
GH-34150: [C++] [Python] Fix improper initialization of ConversionOptions
(#34156)
This PR fixes a bug that caused a crash. See #34150 for more details.
* Closes: #34150
Authored-by: Yaron Gvili <[email protected]>
Signed-off-by: Weston Pace <[email protected]>
---
cpp/src/arrow/engine/substrait/options.h | 17 +++++++++++++----
python/pyarrow/_substrait.pyx | 1 +
python/pyarrow/includes/libarrow_substrait.pxd | 3 ++-
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/cpp/src/arrow/engine/substrait/options.h
b/cpp/src/arrow/engine/substrait/options.h
index 3b4a6963ac..055652e4de 100644
--- a/cpp/src/arrow/engine/substrait/options.h
+++ b/cpp/src/arrow/engine/substrait/options.h
@@ -102,18 +102,27 @@ ARROW_ENGINE_EXPORT void
set_default_named_tap_provider(NamedTapProvider provide
/// Options that control the conversion between Substrait and Acero
representations of a
/// plan.
struct ARROW_ENGINE_EXPORT ConversionOptions {
+ ConversionOptions()
+ : strictness(ConversionStrictness::BEST_EFFORT),
+ named_table_provider(kDefaultNamedTableProvider),
+ named_tap_provider(default_named_tap_provider()),
+ extension_provider(default_extension_provider()) {}
+
/// \brief How strictly the converter should adhere to the structure of the
input.
- ConversionStrictness strictness = ConversionStrictness::BEST_EFFORT;
+ ConversionStrictness strictness;
/// \brief A custom strategy to be used for providing named tables
///
/// The default behavior will return an invalid status if the plan has any
/// named table relations.
- NamedTableProvider named_table_provider = kDefaultNamedTableProvider;
+ NamedTableProvider named_table_provider;
/// \brief A custom strategy to be used for obtaining a tap declaration
///
/// The default provider returns an error
- NamedTapProvider named_tap_provider = default_named_tap_provider();
- std::shared_ptr<ExtensionProvider> extension_provider =
default_extension_provider();
+ NamedTapProvider named_tap_provider;
+ /// \brief A custom strategy to be used for providing relation infos.
+ ///
+ /// The default behavior will provide for relations known to Arrow.
+ std::shared_ptr<ExtensionProvider> extension_provider;
};
} // namespace engine
diff --git a/python/pyarrow/_substrait.pyx b/python/pyarrow/_substrait.pyx
index 8b2a89da27..804803504a 100644
--- a/python/pyarrow/_substrait.pyx
+++ b/python/pyarrow/_substrait.pyx
@@ -18,6 +18,7 @@
# cython: language_level = 3
from cython.operator cimport dereference as deref
from libcpp.vector cimport vector as std_vector
+from libcpp cimport bool
from pyarrow import Buffer, py_buffer
from pyarrow.lib import frombytes, tobytes
diff --git a/python/pyarrow/includes/libarrow_substrait.pxd
b/python/pyarrow/includes/libarrow_substrait.pxd
index b3ad00516d..4fab699362 100644
--- a/python/pyarrow/includes/libarrow_substrait.pxd
+++ b/python/pyarrow/includes/libarrow_substrait.pxd
@@ -36,7 +36,8 @@ cdef extern from "arrow/engine/substrait/options.h" namespace
"arrow::engine" no
cdef cppclass CConversionOptions \
"arrow::engine::ConversionOptions":
- ConversionStrictness conversion_strictness
+ CConversionOptions()
+ ConversionStrictness strictness
function[CNamedTableProvider] named_table_provider
cdef extern from "arrow/engine/substrait/extension_set.h" \