Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into apacheGH-15187
Browse files Browse the repository at this point in the history
  • Loading branch information
rtadepalli committed Jun 14, 2023
2 parents 76219f5 + b4ac585 commit aa7e1d7
Show file tree
Hide file tree
Showing 312 changed files with 12,133 additions and 4,339 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ jobs:
/d 1 `
/f
- name: Installed Packages
run: choco list -l
run: choco list
- name: Install Dependencies
run: choco install -y --no-progress openssl
- name: Checkout Arrow
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ jobs:
go: 1.17
staticcheck: v0.2.2
runs-on: ["self-hosted", "arm", "linux"]
- arch-label: ARM64
arch: arm64v8
go: 1.18
staticcheck: v0.3.3
runs-on: ["self-hosted", "arm", "linux"]
env:
ARCH: ${{ matrix.arch }}
GO: ${{ matrix.go }}
Expand Down Expand Up @@ -122,6 +127,27 @@ jobs:
python3 -m pip install benchadapt@git+https://github.com/conbench/conbench.git@main#subdirectory=benchadapt/python
python3 ci/scripts/go_bench_adapt.py
build386:
name: Go Cross-build for 386
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 20
steps:
- name: Checkout Arrow
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.18
cache: true
cache-dependency-path: go/go.sum
- name: Run build
run: |
cd go
GOARCH=386 go build ./...
docker_cgo:
name: AMD64 Debian 11 Go ${{ matrix.go }} - CGO
runs-on: ubuntu-latest
Expand Down Expand Up @@ -394,3 +420,20 @@ jobs:
- name: Test
shell: bash
run: ci/scripts/go_test.sh $(pwd)

tinygo:
name: TinyGo
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
env:
TINYGO_VERSION: 0.27.0
timeout-minutes: 60
steps:
- name: Checkout Arrow
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Build and Run Example
run: |
docker run --rm -v $(pwd)/go:/src -v $(pwd)/ci/scripts:/ci-scripts "tinygo/tinygo:$TINYGO_VERSION" /ci-scripts/go_tinygo_example.sh
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ swift/Arrow/.build

# Go dependencies
go/vendor
# go debug binaries
__debug_bin

# direnv
.envrc
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ makes it easier for us to process the backlog of submitted Pull Requests.

Any functionality change should have a GitHub issue opened. For minor changes that
affect documentation, you do not need to open up a GitHub issue. Instead you can
prefix the title of your PR with "MINOR: " if meets the following guidelines:
prefix the title of your PR with "MINOR: " if meets one of the following:

* Grammar, usage and spelling fixes that affect no more than 2 files
* Documentation updates affecting no more than 2 files and not more
Expand Down
132 changes: 116 additions & 16 deletions c_glib/arrow-glib/compute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,27 @@ garrow_source_node_options_set_property(GObject *object,
}
}

static void
garrow_source_node_options_get_property(GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
auto priv = GARROW_SOURCE_NODE_OPTIONS_GET_PRIVATE(object);

switch (prop_id) {
case PROP_READER:
g_value_set_object(value, priv->reader);
break;
case PROP_RECORD_BATCH:
g_value_set_object(value, priv->record_batch);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}

static void
garrow_source_node_options_init(GArrowSourceNodeOptions *object)
{
Expand All @@ -955,22 +976,23 @@ garrow_source_node_options_class_init(GArrowSourceNodeOptionsClass *klass)
auto gobject_class = G_OBJECT_CLASS(klass);
gobject_class->dispose = garrow_source_node_options_dispose;
gobject_class->set_property = garrow_source_node_options_set_property;
gobject_class->get_property = garrow_source_node_options_get_property;

GParamSpec *spec;
spec = g_param_spec_object("reader",
"Reader",
"The GArrowRecordBatchReader that produces "
"record batches",
GARROW_TYPE_RECORD_BATCH_READER,
static_cast<GParamFlags>(G_PARAM_WRITABLE |
static_cast<GParamFlags>(G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property(gobject_class, PROP_READER, spec);

spec = g_param_spec_object("record-batch",
"Record batch",
"The GArrowRecordBatch to be produced",
GARROW_TYPE_RECORD_BATCH,
static_cast<GParamFlags>(G_PARAM_WRITABLE |
static_cast<GParamFlags>(G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property(gobject_class, PROP_RECORD_BATCH, spec);
}
Expand Down Expand Up @@ -1524,9 +1546,9 @@ garrow_sink_node_options_get_reader(GArrowSinkNodeOptions *options,
if (!priv->reader) {
auto arrow_reader =
arrow::acero::MakeGeneratorReader(arrow_schema,
std::move(priv->generator),
arrow::default_memory_pool());
priv->reader = garrow_record_batch_reader_new_raw(&arrow_reader);
std::move(priv->generator),
arrow::default_memory_pool());
priv->reader = garrow_record_batch_reader_new_raw(&arrow_reader, nullptr);
}
g_object_ref(priv->reader);
return priv->reader;
Expand Down Expand Up @@ -1670,23 +1692,36 @@ garrow_hash_join_node_options_set_right_outputs(
}


typedef struct GArrowExecuteNodePrivate_ {
struct GArrowExecuteNodePrivate {
arrow::acero::ExecNode *node;
} GArrowExecuteNodePrivate;
GArrowExecuteNodeOptions *options;
};

enum {
PROP_NODE = 1,
PROP_OPTIONS,
};

G_DEFINE_TYPE_WITH_PRIVATE(GArrowExecuteNode,
garrow_execute_node,
G_TYPE_OBJECT)

#define GARROW_EXECUTE_NODE_GET_PRIVATE(object) \
static_cast<GArrowExecuteNodePrivate *>( \
garrow_execute_node_get_instance_private( \
static_cast<GArrowExecuteNodePrivate *>( \
garrow_execute_node_get_instance_private( \
GARROW_EXECUTE_NODE(object)))

static void
garrow_execute_node_dispose(GObject *object)
{
auto priv = GARROW_EXECUTE_NODE_GET_PRIVATE(object);
if (priv->options) {
g_object_unref(priv->options);
priv->options = nullptr;
}
G_OBJECT_CLASS(garrow_execute_node_parent_class)->dispose(object);
}

static void
garrow_execute_node_set_property(GObject *object,
guint prop_id,
Expand All @@ -1700,6 +1735,28 @@ garrow_execute_node_set_property(GObject *object,
priv->node =
static_cast<arrow::acero::ExecNode *>(g_value_get_pointer(value));
break;
case PROP_OPTIONS:
priv->options =
static_cast<GArrowExecuteNodeOptions *>(g_value_dup_object(value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}

static void
garrow_execute_node_get_property(GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
auto priv = GARROW_EXECUTE_NODE_GET_PRIVATE(object);

switch (prop_id) {
case PROP_OPTIONS:
g_value_set_object(value, priv->options);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
Expand All @@ -1715,7 +1772,9 @@ static void
garrow_execute_node_class_init(GArrowExecuteNodeClass *klass)
{
auto gobject_class = G_OBJECT_CLASS(klass);
gobject_class->dispose = garrow_execute_node_dispose;
gobject_class->set_property = garrow_execute_node_set_property;
gobject_class->get_property = garrow_execute_node_get_property;

GParamSpec *spec;
spec = g_param_spec_pointer("node",
Expand All @@ -1724,6 +1783,14 @@ garrow_execute_node_class_init(GArrowExecuteNodeClass *klass)
static_cast<GParamFlags>(G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property(gobject_class, PROP_NODE, spec);

spec = g_param_spec_object("options",
"Options",
"The options of this node",
GARROW_TYPE_EXECUTE_NODE_OPTIONS,
static_cast<GParamFlags>(G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property(gobject_class, PROP_OPTIONS, spec);
}

/**
Expand Down Expand Up @@ -1758,9 +1825,10 @@ garrow_execute_node_get_output_schema(GArrowExecuteNode *node)
}


typedef struct GArrowExecutePlanPrivate_ {
struct GArrowExecutePlanPrivate {
std::shared_ptr<arrow::acero::ExecPlan> plan;
} GArrowExecutePlanPrivate;
GList *nodes;
};

enum {
PROP_PLAN = 1,
Expand All @@ -1783,6 +1851,15 @@ garrow_execute_plan_finalize(GObject *object)
G_OBJECT_CLASS(garrow_execute_plan_parent_class)->finalize(object);
}

static void
garrow_execute_plan_dispose(GObject *object)
{
auto priv = GARROW_EXECUTE_PLAN_GET_PRIVATE(object);
g_list_free_full(priv->nodes, g_object_unref);
priv->nodes = nullptr;
G_OBJECT_CLASS(garrow_execute_plan_parent_class)->dispose(object);
}

static void
garrow_execute_plan_set_property(GObject *object,
guint prop_id,
Expand Down Expand Up @@ -1815,6 +1892,7 @@ garrow_execute_plan_class_init(GArrowExecutePlanClass *klass)
{
auto gobject_class = G_OBJECT_CLASS(klass);
gobject_class->finalize = garrow_execute_plan_finalize;
gobject_class->dispose = garrow_execute_plan_dispose;
gobject_class->set_property = garrow_execute_plan_set_property;

GParamSpec *spec;
Expand Down Expand Up @@ -1877,13 +1955,17 @@ garrow_execute_plan_build_node(GArrowExecutePlan *plan,
}
auto arrow_options = garrow_execute_node_options_get_raw(options);
auto arrow_node_result = arrow::acero::MakeExecNode(factory_name,
arrow_plan.get(),
arrow_inputs,
*arrow_options);
arrow_plan.get(),
arrow_inputs,
*arrow_options);
if (garrow::check(error, arrow_node_result, "[execute-plan][build-node]")) {
auto arrow_node = *arrow_node_result;
arrow_node->SetLabel(factory_name);
return garrow_execute_node_new_raw(arrow_node);
auto node = garrow_execute_node_new_raw(arrow_node, options);
g_object_ref(node);
auto priv = GARROW_EXECUTE_PLAN_GET_PRIVATE(plan);
priv->nodes = g_list_prepend(priv->nodes, node);
return node;
} else {
return NULL;
}
Expand Down Expand Up @@ -2083,6 +2165,22 @@ garrow_execute_plan_build_hash_join_node(GArrowExecutePlan *plan,
return node;
}

/**
* garrow_execute_plan_get_nodes:
* @plan: A #GArrowExecutePlan.
*
* Returns: (transfer none) (element-type GArrowExecuteNode): A list of
* #GArrowExecuteNode of this plan.
*
* Since: 13.0.0
*/
GList *
garrow_execute_plan_get_nodes(GArrowExecutePlan *plan)
{
auto priv = GARROW_EXECUTE_PLAN_GET_PRIVATE(plan);
return priv->nodes;
}

/**
* garrow_execute_plan_validate:
* @plan: A #GArrowExecutePlan.
Expand Down Expand Up @@ -5931,10 +6029,12 @@ garrow_execute_node_options_get_raw(GArrowExecuteNodeOptions *options)


GArrowExecuteNode *
garrow_execute_node_new_raw(arrow::acero::ExecNode *arrow_node)
garrow_execute_node_new_raw(arrow::acero::ExecNode *arrow_node,
GArrowExecuteNodeOptions *options)
{
return GARROW_EXECUTE_NODE(g_object_new(GARROW_TYPE_EXECUTE_NODE,
"node", arrow_node,
"options", options,
NULL));
}

Expand Down
3 changes: 3 additions & 0 deletions c_glib/arrow-glib/compute.h
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ garrow_execute_plan_build_hash_join_node(GArrowExecutePlan *plan,
GArrowExecuteNode *right,
GArrowHashJoinNodeOptions *options,
GError **error);
GARROW_AVAILABLE_IN_13_0
GList *
garrow_execute_plan_get_nodes(GArrowExecutePlan *plan);
GARROW_AVAILABLE_IN_6_0
gboolean
garrow_execute_plan_validate(GArrowExecutePlan *plan,
Expand Down
4 changes: 3 additions & 1 deletion c_glib/arrow-glib/compute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ garrow_execute_node_options_get_raw(GArrowExecuteNodeOptions *options);


GArrowExecuteNode *
garrow_execute_node_new_raw(arrow::acero::ExecNode *arrow_node);
garrow_execute_node_new_raw(
arrow::acero::ExecNode* arrow_node,
GArrowExecuteNodeOptions *options);
arrow::acero::ExecNode *
garrow_execute_node_get_raw(GArrowExecuteNode *node);

Expand Down
2 changes: 1 addition & 1 deletion c_glib/arrow-glib/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ garrow_call_expression_new(const gchar *function,
}
std::shared_ptr<arrow::compute::FunctionOptions> arrow_options;
if (options) {
arrow_options.reset(garrow_function_options_get_raw(options));
arrow_options.reset(garrow_function_options_get_raw(options)->Copy().release());
}
auto arrow_expression = arrow::compute::call(function,
arrow_arguments,
Expand Down

0 comments on commit aa7e1d7

Please sign in to comment.