Skip to content

Commit b207344

Browse files
authored
Merge branch 'main' into apachegh-21761-array-accepting-scalars
2 parents 4961ecc + caa7898 commit b207344

92 files changed

Lines changed: 1742 additions & 466 deletions

File tree

Some content is hidden

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

‎.env‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ UBUNTU=20.04
5656
CLANG_TOOLS=14
5757
CUDA=11.0.3
5858
DASK=latest
59-
DOTNET=6.0
59+
DOTNET=7.0
6060
GCC_VERSION=""
6161
GO=1.17
6262
STATICCHECK=v0.2.2

‎c_glib/arrow-glib/compute-definition.h‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,16 @@ struct _GArrowCastOptionsClass
4646
GArrowFunctionOptionsClass parent_class;
4747
};
4848

49+
#define GARROW_TYPE_EXPRESSION (garrow_expression_get_type())
50+
G_DECLARE_DERIVABLE_TYPE(GArrowExpression,
51+
garrow_expression,
52+
GARROW,
53+
EXPRESSION,
54+
GObject)
55+
struct _GArrowExpressionClass
56+
{
57+
GObjectClass parent_class;
58+
};
59+
4960

5061
G_END_DECLS

‎c_glib/arrow-glib/compute.cpp‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ G_BEGIN_DECLS
178178
*
179179
* #GArrowSourceNodeOptions is a class to customize a source node.
180180
*
181+
* #GArrowFilterNodeOptions is a class to customize a filter node.
182+
*
181183
* #GArrowProjectNodeOptions is a class to customize a project node.
182184
*
183185
* #GArrowAggregation is a class to specify how to aggregate.
@@ -1059,6 +1061,41 @@ garrow_source_node_options_new_table(GArrowTable *table)
10591061
}
10601062

10611063

1064+
G_DEFINE_TYPE(GArrowFilterNodeOptions,
1065+
garrow_filter_node_options,
1066+
GARROW_TYPE_EXECUTE_NODE_OPTIONS)
1067+
1068+
static void
1069+
garrow_filter_node_options_init(GArrowFilterNodeOptions *object)
1070+
{
1071+
}
1072+
1073+
static void
1074+
garrow_filter_node_options_class_init(GArrowFilterNodeOptionsClass *klass)
1075+
{
1076+
}
1077+
1078+
/**
1079+
* garrow_filter_node_options_new:
1080+
* @expression: A #GArrowExpression to be used for filter.
1081+
*
1082+
* Returns: A newly created #GArrowFilterNodeOptions.
1083+
*
1084+
* Since: 12.0.0
1085+
*/
1086+
GArrowFilterNodeOptions *
1087+
garrow_filter_node_options_new(GArrowExpression *expression)
1088+
{
1089+
auto arrow_expression = garrow_expression_get_raw(expression);
1090+
auto arrow_options =
1091+
new arrow::compute::FilterNodeOptions(*arrow_expression);
1092+
auto options = g_object_new(GARROW_TYPE_FILTER_NODE_OPTIONS,
1093+
"options", arrow_options,
1094+
NULL);
1095+
return GARROW_FILTER_NODE_OPTIONS(options);
1096+
}
1097+
1098+
10621099
G_DEFINE_TYPE(GArrowProjectNodeOptions,
10631100
garrow_project_node_options,
10641101
GARROW_TYPE_EXECUTE_NODE_OPTIONS)
@@ -1871,6 +1908,39 @@ garrow_execute_plan_build_source_node(GArrowExecutePlan *plan,
18711908
error);
18721909
}
18731910

1911+
/**
1912+
* garrow_execute_plan_build_filter_node:
1913+
* @plan: A #GArrowExecutePlan.
1914+
* @input: A #GArrowExecuteNode.
1915+
* @options: A #GArrowFilterNodeOptions.
1916+
* @error: (nullable): Return location for a #GError or %NULL.
1917+
*
1918+
* This is a shortcut of garrow_execute_plan_build_node() for filter
1919+
* node.
1920+
*
1921+
* Returns: (transfer full): A newly built and added #GArrowExecuteNode
1922+
* for filter on success, %NULL on error.
1923+
*
1924+
* Since: 12.0.0
1925+
*/
1926+
GArrowExecuteNode *
1927+
garrow_execute_plan_build_filter_node(GArrowExecutePlan *plan,
1928+
GArrowExecuteNode *input,
1929+
GArrowFilterNodeOptions *options,
1930+
GError **error)
1931+
{
1932+
GList *inputs = nullptr;
1933+
inputs = g_list_prepend(inputs, input);
1934+
auto node =
1935+
garrow_execute_plan_build_node(plan,
1936+
"filter",
1937+
inputs,
1938+
GARROW_EXECUTE_NODE_OPTIONS(options),
1939+
error);
1940+
g_list_free(inputs);
1941+
return node;
1942+
}
1943+
18741944
/**
18751945
* garrow_execute_plan_build_project_node:
18761946
* @plan: A #GArrowExecutePlan.

‎c_glib/arrow-glib/compute.h‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,22 @@ GArrowSourceNodeOptions *
156156
garrow_source_node_options_new_table(GArrowTable *table);
157157

158158

159+
#define GARROW_TYPE_FILTER_NODE_OPTIONS (garrow_filter_node_options_get_type())
160+
G_DECLARE_DERIVABLE_TYPE(GArrowFilterNodeOptions,
161+
garrow_filter_node_options,
162+
GARROW,
163+
FILTER_NODE_OPTIONS,
164+
GArrowExecuteNodeOptions)
165+
struct _GArrowFilterNodeOptionsClass
166+
{
167+
GArrowExecuteNodeOptionsClass parent_class;
168+
};
169+
170+
GARROW_AVAILABLE_IN_12_0
171+
GArrowFilterNodeOptions *
172+
garrow_filter_node_options_new(GArrowExpression *expression);
173+
174+
159175
#define GARROW_TYPE_PROJECT_NODE_OPTIONS (garrow_project_node_options_get_type())
160176
G_DECLARE_DERIVABLE_TYPE(GArrowProjectNodeOptions,
161177
garrow_project_node_options,
@@ -339,6 +355,12 @@ GArrowExecuteNode *
339355
garrow_execute_plan_build_source_node(GArrowExecutePlan *plan,
340356
GArrowSourceNodeOptions *options,
341357
GError **error);
358+
GARROW_AVAILABLE_IN_12_0
359+
GArrowExecuteNode *
360+
garrow_execute_plan_build_filter_node(GArrowExecutePlan *plan,
361+
GArrowExecuteNode *input,
362+
GArrowFilterNodeOptions *options,
363+
GError **error);
342364
GARROW_AVAILABLE_IN_11_0
343365
GArrowExecuteNode *
344366
garrow_execute_plan_build_project_node(GArrowExecutePlan *plan,

‎c_glib/arrow-glib/expression.h‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,6 @@
2323

2424
G_BEGIN_DECLS
2525

26-
#define GARROW_TYPE_EXPRESSION (garrow_expression_get_type())
27-
G_DECLARE_DERIVABLE_TYPE(GArrowExpression,
28-
garrow_expression,
29-
GARROW,
30-
EXPRESSION,
31-
GObject)
32-
struct _GArrowExpressionClass
33-
{
34-
GObjectClass parent_class;
35-
};
36-
3726
GARROW_AVAILABLE_IN_6_0
3827
gchar *
3928
garrow_expression_to_string(GArrowExpression *expression);

‎c_glib/test/test-filter-node.rb‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
class TestFilterNode < Test::Unit::TestCase
19+
include Helper::Buildable
20+
21+
def execute_plan(options)
22+
plan = Arrow::ExecutePlan.new
23+
numbers = build_int8_array([1, 2, 3, 4, 5])
24+
table = build_table(number: numbers)
25+
source_node_options = Arrow::SourceNodeOptions.new(table)
26+
source_node = plan.build_source_node(source_node_options)
27+
filter_node = plan.build_filter_node(source_node, options)
28+
sink_node_options = Arrow::SinkNodeOptions.new
29+
sink_node = plan.build_sink_node(filter_node,
30+
sink_node_options)
31+
plan.validate
32+
plan.start
33+
plan.wait
34+
reader = sink_node_options.get_reader(filter_node.output_schema)
35+
table = reader.read_all
36+
plan.stop
37+
table
38+
end
39+
40+
def test_expression
41+
three_scalar = Arrow::Int8Scalar.new(3)
42+
three_datum = Arrow::ScalarDatum.new(three_scalar)
43+
expression =
44+
Arrow::CallExpression.new("greater",
45+
[
46+
Arrow::FieldExpression.new("number"),
47+
Arrow::LiteralExpression.new(three_datum),
48+
])
49+
options = Arrow::FilterNodeOptions.new(expression)
50+
assert_equal(build_table("number" => [
51+
build_int8_array([4, 5]),
52+
]),
53+
execute_plan(options))
54+
end
55+
end

‎ci/docker/centos-7-cpp.dockerfile‎

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,27 @@
1717

1818
FROM centos:centos7
1919

20-
RUN yum install -y \
21-
centos-release-scl \
22-
curl \
23-
diffutils \
24-
gcc-c++ \
25-
libcurl-devel \
26-
make \
27-
openssl-devel \
28-
wget \
29-
which
30-
3120
# devtoolset is required for C++17
32-
RUN yum install -y devtoolset-8
33-
34-
# yum install cmake version is too old
35-
ARG cmake=3.23.1
36-
RUN mkdir /opt/cmake-${cmake}
37-
RUN wget -nv -O - https://github.com/Kitware/CMake/releases/download/v${cmake}/cmake-${cmake}-Linux-x86_64.tar.gz | \
38-
tar -xzf - --strip-components=1 -C /opt/cmake-${cmake}
21+
RUN \
22+
yum install -y \
23+
centos-release-scl \
24+
epel-release && \
25+
yum install -y \
26+
cmake3 \
27+
curl \
28+
devtoolset-8 \
29+
diffutils \
30+
gcc-c++ \
31+
libcurl-devel \
32+
make \
33+
openssl-devel \
34+
openssl11-devel \
35+
wget \
36+
which
3937

4038
COPY ci/scripts/install_sccache.sh /arrow/ci/scripts/
4139
RUN bash /arrow/ci/scripts/install_sccache.sh unknown-linux-musl /usr/local/bin
4240

43-
ENV PATH=/opt/cmake-${cmake}/bin:$PATH \
44-
ARROW_R_DEV=TRUE
41+
ENV \
42+
ARROW_R_DEV=TRUE \
43+
CMAKE=/usr/bin/cmake3

‎ci/docker/ubuntu-20.04-cpp-minimal.dockerfile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ RUN apt-get update -y -q && \
3333
libssl-dev \
3434
libcurl4-openssl-dev \
3535
python3-pip \
36+
tzdata \
3637
wget && \
3738
apt-get clean && \
3839
rm -rf /var/lib/apt/lists*

‎ci/docker/ubuntu-22.04-cpp-minimal.dockerfile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ RUN apt-get update -y -q && \
3333
libssl-dev \
3434
libcurl4-openssl-dev \
3535
python3-pip \
36+
tzdata \
3637
wget && \
3738
apt-get clean && \
3839
rm -rf /var/lib/apt/lists*
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
ARG arch=amd64
1919
ARG dotnet=7.0
20-
ARG platform=focal
20+
ARG platform=jammy
2121
FROM mcr.microsoft.com/dotnet/sdk:${dotnet}-${platform}-${arch}
2222

2323
RUN dotnet tool install --tool-path /usr/local/bin sourcelink

0 commit comments

Comments
 (0)