Skip to content

Commit

Permalink
Merge branch 'apache:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jaepil authored Nov 6, 2024
2 parents ad355a8 + c3601a9 commit 3c75419
Show file tree
Hide file tree
Showing 46 changed files with 2,494 additions and 362 deletions.
123 changes: 1 addition & 122 deletions .github/workflows/comment_bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ on:

permissions:
contents: read
pull-requests: write


jobs:
crossbow:
name: Listen!
Expand Down Expand Up @@ -55,126 +54,6 @@ jobs:
--event-name ${{ github.event_name }} \
--event-payload ${{ github.event_path }}
autotune:
name: "Fix all the things"
if: startsWith(github.event.comment.body, '@github-actions autotune')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: r-lib/actions/pr-fetch@11a22a908006c25fe054c4ef0ac0436b1de3edbe # v2.6.4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: See what is different
run: |
set -ex
DEFAULT_BRANCH=${{ github.event.repository.default_branch }}
git remote add upstream https://github.com/apache/arrow
git fetch upstream
changed() {
git diff --name-only upstream/$DEFAULT_BRANCH... | grep -e "$1" >/dev/null 2>&1
}
if changed '^r/.*\.R$'; then
echo "R_DOCS=true" >> $GITHUB_ENV
echo "R_CODE=true" >> $GITHUB_ENV
fi
if changed 'cmake' || changed 'CMake'; then
echo "CMAKE_FORMAT=true" >> $GITHUB_ENV
fi
if changed '^cpp/src'; then
echo "CLANG_FORMAT_CPP=true" >> $GITHUB_ENV
fi
if changed '^r/src'; then
echo "CLANG_FORMAT_R=true" >> $GITHUB_ENV
fi
- name: Ensure clang-format has the appropriate version
if: env.CMAKE_FORMAT == 'true' ||
env.CLANG_FORMAT_CPP == 'true' ||
env.CLANG_FORMAT_R == 'true' ||
endsWith(github.event.comment.body, 'everything')
run: |
set -e
. .env # To get the clang version we use
sudo apt update
sudo apt install -y clang-format-${CLANG_TOOLS}
- name: Run cmake_format
if: env.CMAKE_FORMAT == 'true' || endsWith(github.event.comment.body, 'everything')
run: |
set -ex
export PATH=/home/runner/.local/bin:$PATH
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install -e dev/archery[lint]
archery lint --cmake-format --fix
- name: Run clang-format on cpp
if: env.CLANG_FORMAT_CPP == 'true' || endsWith(github.event.comment.body, 'everything')
run: |
. .env # To get the clang version we use
cpp/build-support/run_clang_format.py \
--clang_format_binary=clang-format-${CLANG_TOOLS} \
--exclude_glob=cpp/build-support/lint_exclusions.txt \
--source_dir=cpp/src --quiet --fix
- name: Run clang-format on r
if: env.CLANG_FORMAT_R == 'true' || endsWith(github.event.comment.body, 'everything')
run: |
. .env # To get the clang version we use
cpp/build-support/run_clang_format.py \
--clang_format_binary=clang-format-${CLANG_TOOLS} \
--exclude_glob=cpp/build-support/lint_exclusions.txt \
--source_dir=r/src --quiet --fix
- uses: r-lib/actions/setup-r@11a22a908006c25fe054c4ef0ac0436b1de3edbe # v2.6.4
if: env.R_DOCS == 'true' || env.R_CODE == 'true' || endsWith(github.event.comment.body, 'everything')
- name: Update R docs
if: env.R_DOCS == 'true' || endsWith(github.event.comment.body, 'everything')
shell: Rscript {0}
run: |
source("ci/etc/rprofile")
install.packages(c("remotes", "roxygen2"))
remotes::install_deps("r")
roxygen2::roxygenize("r")
- name: Style R code
if: env.R_CODE == 'true' || endsWith(github.event.comment.body, 'everything')
shell: Rscript {0}
run: |
changed_files <- system("git diff --name-only upstream/${{ github.event.repository.default_branch }}... 2>&1", intern = TRUE)
# only grab the .R files under r/
changed_files <- grep('^r/.*\\.R$', changed_files, value = TRUE)
# remove codegen.R and other possible exclusions
changed_files <- changed_files[!changed_files %in% file.path("r", source("r/.styler_excludes.R")$value)]
source("ci/etc/rprofile")
install.packages(c("remotes", "styler"))
remotes::install_deps("r")
styler::style_file(changed_files)
- name: Commit results
run: |
git config user.name "$(git log -1 --pretty=format:%an)"
git config user.email "$(git log -1 --pretty=format:%ae)"
git commit -a -m 'Autoformat/render all the things [automated commit]' || echo "No changes to commit"
- uses: r-lib/actions/pr-push@11a22a908006c25fe054c4ef0ac0436b1de3edbe # v2.6.4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

rebase:
name: "Rebase"
if: startsWith(github.event.comment.body, '@github-actions rebase')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: r-lib/actions/pr-fetch@11a22a908006c25fe054c4ef0ac0436b1de3edbe # v2.6.4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Rebase on ${{ github.repository }} default branch
run: |
set -ex
git config user.name "$(git log -1 --pretty=format:%an)"
git config user.email "$(git log -1 --pretty=format:%ae)"
git remote add upstream https://github.com/${{ github.repository }}
git fetch --unshallow upstream ${{ github.event.repository.default_branch }}
git rebase upstream/${{ github.event.repository.default_branch }}
- uses: r-lib/actions/pr-push@11a22a908006c25fe054c4ef0ac0436b1de3edbe # v2.6.4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
args: "--force"

issue_assign:
name: "Assign issue"
permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
name: AMD64 macOS 13 NodeJS ${{ matrix.node }}
runs-on: macos-13
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
timeout-minutes: 30
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
Expand Down
210 changes: 210 additions & 0 deletions c_glib/arrow-glib/array-builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,12 @@ G_BEGIN_DECLS
* #GArrowMapArrayBuilder is the class to create a new
* #GArrowMapArray.
*
* #GArrowDecimal32ArrayBuilder is the class to create a new
* #GArrowDecimal32Array.
*
* #GArrowDecimal64ArrayBuilder is the class to create a new
* #GArrowDecimal64Array.
*
* #GArrowDecimal128ArrayBuilder is the class to create a new
* #GArrowDecimal128Array.
*
Expand Down Expand Up @@ -6062,6 +6068,204 @@ garrow_map_array_builder_get_value_builder(GArrowMapArrayBuilder *builder)
return priv->value_builder;
}

G_DEFINE_TYPE(GArrowDecimal32ArrayBuilder,
garrow_decimal32_array_builder,
GARROW_TYPE_FIXED_SIZE_BINARY_ARRAY_BUILDER)

static void
garrow_decimal32_array_builder_init(GArrowDecimal32ArrayBuilder *builder)
{
}

static void
garrow_decimal32_array_builder_class_init(GArrowDecimal32ArrayBuilderClass *klass)
{
}

/**
* garrow_decimal32_array_builder_new:
* @data_type: #GArrowDecimal32DataType for the decimal.
*
* Returns: A newly created #GArrowDecimal32ArrayBuilder.
*
* Since: 19.0.0
*/
GArrowDecimal32ArrayBuilder *
garrow_decimal32_array_builder_new(GArrowDecimal32DataType *data_type)
{
auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type));
auto builder =
garrow_array_builder_new(arrow_data_type, NULL, "[decimal32-array-builder][new]");
return GARROW_DECIMAL32_ARRAY_BUILDER(builder);
}

/**
* garrow_decimal32_array_builder_append_value:
* @builder: A #GArrowDecimal32ArrayBuilder.
* @value: (nullable): A decimal value.
* @error: (nullable): Return location for a #GError or %NULL.
*
* Returns: %TRUE on success, %FALSE if there was an error.
*
* Since: 19.0.0
*/
gboolean
garrow_decimal32_array_builder_append_value(GArrowDecimal32ArrayBuilder *builder,
GArrowDecimal32 *value,
GError **error)
{
if (value) {
auto arrow_decimal = garrow_decimal32_get_raw(value);
return garrow_array_builder_append_value<arrow::Decimal32Builder>(
GARROW_ARRAY_BUILDER(builder),
*arrow_decimal,
error,
"[decimal32-array-builder][append-value]");
} else {
return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error);
}
}

/**
* garrow_decimal32_array_builder_append_values:
* @builder: A #GArrowDecimal32ArrayBuilder.
* @values: (array length=values_length): The array of #GArrowDecimal32.
* @values_length: The length of @values.
* @is_valids: (nullable) (array length=is_valids_length): The array of
* boolean that shows whether the Nth value is valid or not. If the
* Nth @is_valids is %TRUE, the Nth @values is valid value. Otherwise
* the Nth value is null value.
* @is_valids_length: The length of @is_valids.
* @error: (nullable): Return location for a #GError or %NULL.
*
* Append multiple values at once. It's more efficient than multiple
* `append` and `append_null` calls.
*
* Returns: %TRUE on success, %FALSE if there was an error.
*
* Since: 19.0.0
*/
gboolean
garrow_decimal32_array_builder_append_values(GArrowDecimal32ArrayBuilder *builder,
GArrowDecimal32 **values,
gint64 values_length,
const gboolean *is_valids,
gint64 is_valids_length,
GError **error)
{
return garrow_array_builder_append_values(
GARROW_ARRAY_BUILDER(builder),
values,
values_length,
is_valids,
is_valids_length,
error,
"[decimal32-array-builder][append-values]",
[](guint8 *output, GArrowDecimal32 *value, gsize size) {
auto arrow_decimal = garrow_decimal32_get_raw(value);
arrow_decimal->ToBytes(output);
});
}

G_DEFINE_TYPE(GArrowDecimal64ArrayBuilder,
garrow_decimal64_array_builder,
GARROW_TYPE_FIXED_SIZE_BINARY_ARRAY_BUILDER)

static void
garrow_decimal64_array_builder_init(GArrowDecimal64ArrayBuilder *builder)
{
}

static void
garrow_decimal64_array_builder_class_init(GArrowDecimal64ArrayBuilderClass *klass)
{
}

/**
* garrow_decimal64_array_builder_new:
* @data_type: #GArrowDecimal64DataType for the decimal.
*
* Returns: A newly created #GArrowDecimal64ArrayBuilder.
*
* Since: 19.0.0
*/
GArrowDecimal64ArrayBuilder *
garrow_decimal64_array_builder_new(GArrowDecimal64DataType *data_type)
{
auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type));
auto builder =
garrow_array_builder_new(arrow_data_type, NULL, "[decimal64-array-builder][new]");
return GARROW_DECIMAL64_ARRAY_BUILDER(builder);
}

/**
* garrow_decimal64_array_builder_append_value:
* @builder: A #GArrowDecimal64ArrayBuilder.
* @value: (nullable): A decimal value.
* @error: (nullable): Return location for a #GError or %NULL.
*
* Returns: %TRUE on success, %FALSE if there was an error.
*
* Since: 19.0.0
*/
gboolean
garrow_decimal64_array_builder_append_value(GArrowDecimal64ArrayBuilder *builder,
GArrowDecimal64 *value,
GError **error)
{
if (value) {
auto arrow_decimal = garrow_decimal64_get_raw(value);
return garrow_array_builder_append_value<arrow::Decimal64Builder>(
GARROW_ARRAY_BUILDER(builder),
*arrow_decimal,
error,
"[decimal64-array-builder][append-value]");
} else {
return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error);
}
}

/**
* garrow_decimal64_array_builder_append_values:
* @builder: A #GArrowDecimal64ArrayBuilder.
* @values: (array length=values_length): The array of #GArrowDecimal64.
* @values_length: The length of @values.
* @is_valids: (nullable) (array length=is_valids_length): The array of
* boolean that shows whether the Nth value is valid or not. If the
* Nth @is_valids is %TRUE, the Nth @values is valid value. Otherwise
* the Nth value is null value.
* @is_valids_length: The length of @is_valids.
* @error: (nullable): Return location for a #GError or %NULL.
*
* Append multiple values at once. It's more efficient than multiple
* `append` and `append_null` calls.
*
* Returns: %TRUE on success, %FALSE if there was an error.
*
* Since: 19.0.0
*/
gboolean
garrow_decimal64_array_builder_append_values(GArrowDecimal64ArrayBuilder *builder,
GArrowDecimal64 **values,
gint64 values_length,
const gboolean *is_valids,
gint64 is_valids_length,
GError **error)
{
return garrow_array_builder_append_values(
GARROW_ARRAY_BUILDER(builder),
values,
values_length,
is_valids,
is_valids_length,
error,
"[decimal64-array-builder][append-values]",
[](guint8 *output, GArrowDecimal64 *value, gsize size) {
auto arrow_decimal = garrow_decimal64_get_raw(value);
arrow_decimal->ToBytes(output);
});
}

G_DEFINE_TYPE(GArrowDecimal128ArrayBuilder,
garrow_decimal128_array_builder,
GARROW_TYPE_FIXED_SIZE_BINARY_ARRAY_BUILDER)
Expand Down Expand Up @@ -6581,6 +6785,12 @@ garrow_array_builder_new_raw(std::shared_ptr<arrow::ArrayBuilder> *arrow_builder
case arrow::Type::type::MAP:
type = GARROW_TYPE_MAP_ARRAY_BUILDER;
break;
case arrow::Type::type::DECIMAL32:
type = GARROW_TYPE_DECIMAL32_ARRAY_BUILDER;
break;
case arrow::Type::type::DECIMAL64:
type = GARROW_TYPE_DECIMAL64_ARRAY_BUILDER;
break;
case arrow::Type::type::DECIMAL128:
type = GARROW_TYPE_DECIMAL128_ARRAY_BUILDER;
break;
Expand Down
Loading

0 comments on commit 3c75419

Please sign in to comment.