Skip to content

Commit d3aee89

Browse files
committed
Merge remote-tracking branch 'apache/main' into fix/gh-41011
2 parents 62eab1d + 8ccdbe7 commit d3aee89

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1874
-1266
lines changed

.github/workflows/dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105
shell: bash
106106
run: |
107107
gem install test-unit
108-
pip install "cython>=3" setuptools pytest requests setuptools-scm
108+
pip install "cython>=3.1" setuptools pytest requests setuptools-scm
109109
- name: Run Release Test
110110
shell: bash
111111
run: |

ci/conda_env_python.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# Not a direct dependency of s3fs, but needed for our s3fs fixture
2121
boto3
2222
cffi
23-
cython>=3
23+
cython>=3.1
2424
cloudpickle
2525
fsspec
2626
hypothesis

ci/docker/linux-apt-python-313-freethreading.dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ RUN apt-get update -y -q && \
2727
rm -rf /var/lib/apt/lists*
2828

2929
COPY python/requirements-build.txt \
30-
python/requirements-test.txt \
30+
python/requirements-test-3.13t.txt \
3131
/arrow/python/
3232

3333
ENV ARROW_PYTHON_VENV /arrow-dev
@@ -38,7 +38,7 @@ RUN ${ARROW_PYTHON_VENV}/bin/python -m pip install \
3838
--prefer-binary \
3939
--extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" \
4040
-r arrow/python/requirements-build.txt \
41-
-r arrow/python/requirements-test.txt
41+
-r arrow/python/requirements-test-3.13t.txt
4242

4343
# We want to run the PyArrow test suite with the GIL disabled, but cffi
4444
# (more precisely, the `_cffi_backend` module) currently doesn't declare

ci/docker/python-free-threaded-wheel-windows-test-vs2022.dockerfile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,13 @@ ENV PYTHON_CMD="py -${python}t"
3737
SHELL ["cmd", "/S", "/C"]
3838
RUN %PYTHON_CMD% -m pip install -U pip setuptools
3939

40-
COPY python/requirements-wheel-test.txt C:/arrow/python/
40+
COPY python/requirements-wheel-test-3.13t.txt C:/arrow/python/
4141
# Cython and Pandas wheels for 3.13 free-threaded are not released yet
4242
RUN %PYTHON_CMD% -m pip install \
4343
--extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \
4444
--pre \
4545
--prefer-binary \
46-
-r C:/arrow/python/requirements-wheel-test.txt
47-
# cffi-based tests would crash when importing cffi.
48-
# hadolint ignore=DL3059
49-
RUN %PYTHON_CMD% -m pip uninstall -y cffi
46+
-r C:/arrow/python/requirements-wheel-test-3.13t.txt
5047

5148
ENV PYTHON="${python}t"
5249
ENV PYTHON_GIL=0

ci/docker/python-wheel-manylinux-test.dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ RUN pip install -r /arrow/python/requirements-wheel-test.txt
2828
RUN apt-get update -y -q && \
2929
apt-get install -y -q \
3030
build-essential \
31-
python3-dev && \
31+
python3-dev \
32+
tzdata-legacy && \
3233
apt-get clean && \
3334
rm -rf /var/lib/apt/lists*
3435

cpp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}")
177177
set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build-support")
178178

179179
set(ARROW_LLVM_VERSIONS
180+
"21.1"
180181
"20.1"
181182
"19.1"
182183
"18.1"

cpp/cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,6 +1723,8 @@ if(ARROW_NEED_GFLAGS)
17231723
set(GFLAGS_LIBRARIES gflags-shared)
17241724
elseif(TARGET gflags_shared)
17251725
set(GFLAGS_LIBRARIES gflags_shared)
1726+
elseif(TARGET gflags::gflags)
1727+
set(GFLAGS_LIBRARIES gflags::gflags)
17261728
endif()
17271729
endif()
17281730
endif()

cpp/src/arrow/compare.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,38 @@ class EqualOptions {
8383
return res;
8484
}
8585

86+
/// Whether the \ref arrow::Schema property is used in the comparison.
87+
///
88+
/// This option only affects the Equals methods
89+
/// and has no effect on ApproxEquals methods.
90+
bool use_schema() const { return use_schema_; }
91+
92+
/// Return a new EqualOptions object with the "use_schema_" property changed.
93+
///
94+
/// Setting this option is false making the value of \ref EqualOptions::use_metadata
95+
/// is ignored.
96+
EqualOptions use_schema(bool v) const {
97+
auto res = EqualOptions(*this);
98+
res.use_schema_ = v;
99+
return res;
100+
}
101+
102+
/// Whether the "metadata" in \ref arrow::Schema is used in the comparison.
103+
///
104+
/// This option only affects the Equals methods
105+
/// and has no effect on the ApproxEquals methods.
106+
///
107+
/// Note: This option is only considered when \ref arrow::EqualOptions::use_schema is
108+
/// set to true.
109+
bool use_metadata() const { return use_metadata_; }
110+
111+
/// Return a new EqualOptions object with the "use_metadata" property changed.
112+
EqualOptions use_metadata(bool v) const {
113+
auto res = EqualOptions(*this);
114+
res.use_metadata_ = v;
115+
return res;
116+
}
117+
86118
/// The ostream to which a diff will be formatted if arrays disagree.
87119
/// If this is null (the default) no diff will be formatted.
88120
std::ostream* diff_sink() const { return diff_sink_; }
@@ -103,6 +135,8 @@ class EqualOptions {
103135
bool nans_equal_ = false;
104136
bool signed_zeros_equal_ = true;
105137
bool use_atol_ = false;
138+
bool use_schema_ = true;
139+
bool use_metadata_ = false;
106140

107141
std::ostream* diff_sink_ = NULLPTR;
108142
};

cpp/src/arrow/compute/expression.cc

Lines changed: 40 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -545,67 +545,61 @@ Result<Expression> BindNonRecursive(Expression::Call call, bool insert_implicit_
545545
std::vector<TypeHolder> types = GetTypes(call.arguments);
546546
ARROW_ASSIGN_OR_RAISE(call.function, GetFunction(call, exec_context));
547547

548-
auto FinishBind = [&] {
549-
compute::KernelContext kernel_context(exec_context, call.kernel);
550-
if (call.kernel->init) {
551-
const FunctionOptions* options =
552-
call.options ? call.options.get() : call.function->default_options();
553-
ARROW_ASSIGN_OR_RAISE(
554-
call.kernel_state,
555-
call.kernel->init(&kernel_context, {call.kernel, types, options}));
556-
557-
kernel_context.SetState(call.kernel_state.get());
558-
}
559-
560-
ARROW_ASSIGN_OR_RAISE(
561-
call.type, call.kernel->signature->out_type().Resolve(&kernel_context, types));
562-
return Status::OK();
563-
};
564-
565548
// First try and bind exactly
566549
Result<const Kernel*> maybe_exact_match = call.function->DispatchExact(types);
567550
if (maybe_exact_match.ok()) {
568551
call.kernel = *maybe_exact_match;
569-
if (FinishBind().ok()) {
570-
return Expression(std::move(call));
552+
} else {
553+
if (!insert_implicit_casts) {
554+
return maybe_exact_match.status();
571555
}
572-
}
573556

574-
if (!insert_implicit_casts) {
575-
return maybe_exact_match.status();
576-
}
557+
// If exact binding fails, and we are allowed to cast, then prefer casting literals
558+
// first. Since DispatchBest generally prefers up-casting the best way to do this is
559+
// first down-cast the literals as much as possible
560+
types = GetTypesWithSmallestLiteralRepresentation(call.arguments);
561+
ARROW_ASSIGN_OR_RAISE(call.kernel, call.function->DispatchBest(&types));
577562

578-
// If exact binding fails, and we are allowed to cast, then prefer casting literals
579-
// first. Since DispatchBest generally prefers up-casting the best way to do this is
580-
// first down-cast the literals as much as possible
581-
types = GetTypesWithSmallestLiteralRepresentation(call.arguments);
582-
ARROW_ASSIGN_OR_RAISE(call.kernel, call.function->DispatchBest(&types));
563+
for (size_t i = 0; i < types.size(); ++i) {
564+
if (types[i] == call.arguments[i].type()) continue;
583565

584-
for (size_t i = 0; i < types.size(); ++i) {
585-
if (types[i] == call.arguments[i].type()) continue;
566+
if (const Datum* lit = call.arguments[i].literal()) {
567+
ARROW_ASSIGN_OR_RAISE(Datum new_lit,
568+
compute::Cast(*lit, types[i].GetSharedPtr()));
569+
call.arguments[i] = literal(std::move(new_lit));
570+
continue;
571+
}
586572

587-
if (const Datum* lit = call.arguments[i].literal()) {
588-
ARROW_ASSIGN_OR_RAISE(Datum new_lit, compute::Cast(*lit, types[i].GetSharedPtr()));
589-
call.arguments[i] = literal(std::move(new_lit));
590-
continue;
591-
}
573+
// construct an implicit cast Expression with which to replace this argument
574+
Expression::Call implicit_cast;
575+
implicit_cast.function_name = "cast";
576+
implicit_cast.arguments = {std::move(call.arguments[i])};
592577

593-
// construct an implicit cast Expression with which to replace this argument
594-
Expression::Call implicit_cast;
595-
implicit_cast.function_name = "cast";
596-
implicit_cast.arguments = {std::move(call.arguments[i])};
578+
// TODO(wesm): Use TypeHolder in options
579+
implicit_cast.options = std::make_shared<compute::CastOptions>(
580+
compute::CastOptions::Safe(types[i].GetSharedPtr()));
597581

598-
// TODO(wesm): Use TypeHolder in options
599-
implicit_cast.options = std::make_shared<compute::CastOptions>(
600-
compute::CastOptions::Safe(types[i].GetSharedPtr()));
582+
ARROW_ASSIGN_OR_RAISE(
583+
call.arguments[i],
584+
BindNonRecursive(std::move(implicit_cast),
585+
/*insert_implicit_casts=*/false, exec_context));
586+
}
587+
}
601588

589+
compute::KernelContext kernel_context(exec_context, call.kernel);
590+
if (call.kernel->init) {
591+
const FunctionOptions* options =
592+
call.options ? call.options.get() : call.function->default_options();
602593
ARROW_ASSIGN_OR_RAISE(
603-
call.arguments[i],
604-
BindNonRecursive(std::move(implicit_cast),
605-
/*insert_implicit_casts=*/false, exec_context));
594+
call.kernel_state,
595+
call.kernel->init(&kernel_context, {call.kernel, types, options}));
596+
597+
kernel_context.SetState(call.kernel_state.get());
606598
}
607599

608-
RETURN_NOT_OK(FinishBind());
600+
ARROW_ASSIGN_OR_RAISE(
601+
call.type, call.kernel->signature->out_type().Resolve(&kernel_context, types));
602+
609603
return Expression(std::move(call));
610604
}
611605

0 commit comments

Comments
 (0)