From 1c23c639ca0707ab5277fe41b8ff89c80360355f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Fri, 8 Mar 2024 12:06:10 +0100 Subject: [PATCH 01/30] MINOR: [Release] Update versions for 16.0.0-SNAPSHOT --- ci/scripts/PKGBUILD | 2 +- r/DESCRIPTION | 2 +- r/NEWS.md | 4 +++- r/pkgdown/assets/versions.json | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ci/scripts/PKGBUILD b/ci/scripts/PKGBUILD index 50d4fc28c58f3..1995f1b67fdd3 100644 --- a/ci/scripts/PKGBUILD +++ b/ci/scripts/PKGBUILD @@ -18,7 +18,7 @@ _realname=arrow pkgbase=mingw-w64-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" -pkgver=15.0.0.9000 +pkgver=15.0.1.9000 pkgrel=8000 pkgdesc="Apache Arrow is a cross-language development platform for in-memory data (mingw-w64)" arch=("any") diff --git a/r/DESCRIPTION b/r/DESCRIPTION index 21cc4dec902d2..ab39714864d28 100644 --- a/r/DESCRIPTION +++ b/r/DESCRIPTION @@ -1,6 +1,6 @@ Package: arrow Title: Integration to 'Apache' 'Arrow' -Version: 15.0.0.9000 +Version: 15.0.1.9000 Authors@R: c( person("Neal", "Richardson", email = "neal.p.richardson@gmail.com", role = c("aut")), person("Ian", "Cook", email = "ianmcook@gmail.com", role = c("aut")), diff --git a/r/NEWS.md b/r/NEWS.md index 06c49c7be006f..07c0562d67168 100644 --- a/r/NEWS.md +++ b/r/NEWS.md @@ -17,7 +17,9 @@ under the License. --> -# arrow 15.0.0.9000 +# arrow 15.0.1.9000 + +# arrow 15.0.1 # arrow 15.0.0 diff --git a/r/pkgdown/assets/versions.json b/r/pkgdown/assets/versions.json index 0b7f9884f9b6f..44b4c76e4ca56 100644 --- a/r/pkgdown/assets/versions.json +++ b/r/pkgdown/assets/versions.json @@ -1,10 +1,10 @@ [ { - "name": "15.0.0.9000 (dev)", + "name": "15.0.1.9000 (dev)", "version": "dev/" }, { - "name": "15.0.0 (release)", + "name": "15.0.1 (release)", "version": "" }, { From f589e08a2e86e0562e68ed3aaa8e0c8c1e93c5d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Fri, 8 Mar 2024 12:06:11 +0100 Subject: [PATCH 02/30] MINOR: [Release] Update .deb/.rpm changelogs for 15.0.1 --- .../linux-packages/apache-arrow-apt-source/debian/changelog | 6 ++++++ .../apache-arrow-release/yum/apache-arrow-release.spec.in | 3 +++ dev/tasks/linux-packages/apache-arrow/debian/changelog | 6 ++++++ dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in | 3 +++ 4 files changed, 18 insertions(+) diff --git a/dev/tasks/linux-packages/apache-arrow-apt-source/debian/changelog b/dev/tasks/linux-packages/apache-arrow-apt-source/debian/changelog index bc83f0ed7c4b0..0ee56839e9d45 100644 --- a/dev/tasks/linux-packages/apache-arrow-apt-source/debian/changelog +++ b/dev/tasks/linux-packages/apache-arrow-apt-source/debian/changelog @@ -1,3 +1,9 @@ +apache-arrow-apt-source (15.0.1-1) unstable; urgency=low + + * New upstream release. + + -- Raúl Cumplido Fri, 23 Feb 2024 13:06:19 -0000 + apache-arrow-apt-source (15.0.0-1) unstable; urgency=low * New upstream release. diff --git a/dev/tasks/linux-packages/apache-arrow-release/yum/apache-arrow-release.spec.in b/dev/tasks/linux-packages/apache-arrow-release/yum/apache-arrow-release.spec.in index 9b6c963593fc3..2919c5b703a1b 100644 --- a/dev/tasks/linux-packages/apache-arrow-release/yum/apache-arrow-release.spec.in +++ b/dev/tasks/linux-packages/apache-arrow-release/yum/apache-arrow-release.spec.in @@ -102,6 +102,9 @@ else fi %changelog +* Fri Feb 23 2024 Raúl Cumplido - 15.0.1-1 +- New upstream release. + * Tue Jan 16 2024 Raúl Cumplido - 15.0.0-1 - New upstream release. diff --git a/dev/tasks/linux-packages/apache-arrow/debian/changelog b/dev/tasks/linux-packages/apache-arrow/debian/changelog index edff045a48111..b025afe9e5027 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/changelog +++ b/dev/tasks/linux-packages/apache-arrow/debian/changelog @@ -1,3 +1,9 @@ +apache-arrow (15.0.1-1) unstable; urgency=low + + * New upstream release. + + -- Raúl Cumplido Fri, 23 Feb 2024 13:06:19 -0000 + apache-arrow (15.0.0-1) unstable; urgency=low * New upstream release. diff --git a/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in b/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in index 79b4eadd92265..bcdc3ed7d8a7f 100644 --- a/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in +++ b/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in @@ -864,6 +864,9 @@ Documentation for Apache Parquet GLib. %{_datadir}/gtk-doc/html/parquet-glib/ %changelog +* Fri Feb 23 2024 Raúl Cumplido - 15.0.1-1 +- New upstream release. + * Tue Jan 16 2024 Raúl Cumplido - 15.0.0-1 - New upstream release. From 0148db4f97bfcf80237b265ee0d9a4b61194ffde Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Fri, 8 Mar 2024 15:11:30 +0100 Subject: [PATCH 03/30] GH-38821: [C++] Strengthen handling of duplicate slashes in S3, GCS (#40371) ### Rationale for this change Giving a path such as "bucket//key" to some S3 and GCS filesystem APIs could silently succeed or crash. Make sure those paths instead return an error, as other instances of duplicate slashes already do. ### Are these changes tested? Yes. ### Are there any user-facing changes? Yes. Some paths that were accepted by some filesystems can now return an error. * GitHub Issue: #38821 Authored-by: Antoine Pitrou Signed-off-by: Antoine Pitrou --- cpp/src/arrow/filesystem/filesystem_test.cc | 12 ++++++++++++ cpp/src/arrow/filesystem/gcsfs.cc | 9 +++++++++ cpp/src/arrow/filesystem/gcsfs_test.cc | 14 ++++++++++++++ cpp/src/arrow/filesystem/path_util.cc | 12 ++++++++++++ cpp/src/arrow/filesystem/path_util.h | 4 ++++ cpp/src/arrow/filesystem/s3fs.cc | 17 ++++++++--------- cpp/src/arrow/filesystem/s3fs_test.cc | 8 ++++++++ 7 files changed, 67 insertions(+), 9 deletions(-) diff --git a/cpp/src/arrow/filesystem/filesystem_test.cc b/cpp/src/arrow/filesystem/filesystem_test.cc index c76c3d27e8f8e..8477647b2cd73 100644 --- a/cpp/src/arrow/filesystem/filesystem_test.cc +++ b/cpp/src/arrow/filesystem/filesystem_test.cc @@ -152,6 +152,18 @@ TEST(PathUtil, GetAbstractPathParent) { AssertPairEqual(pair, {"abc", "def\\ghi"}); } +TEST(PathUtil, ValidateAbstractPath) { + ASSERT_OK(ValidateAbstractPath("")); + ASSERT_OK(ValidateAbstractPath("abc")); + ASSERT_OK(ValidateAbstractPath("abc/def")); + ASSERT_OK(ValidateAbstractPath("abc/def.ghi")); + ASSERT_OK(ValidateAbstractPath("abc/def\\ghi")); + + // Extraneous separators + ASSERT_RAISES(Invalid, ValidateAbstractPath("//")); + ASSERT_RAISES(Invalid, ValidateAbstractPath("abc//def")); +} + TEST(PathUtil, ValidateAbstractPathParts) { ASSERT_OK(ValidateAbstractPathParts({})); ASSERT_OK(ValidateAbstractPathParts({"abc"})); diff --git a/cpp/src/arrow/filesystem/gcsfs.cc b/cpp/src/arrow/filesystem/gcsfs.cc index d41cb49022c0c..1f091e980bf97 100644 --- a/cpp/src/arrow/filesystem/gcsfs.cc +++ b/cpp/src/arrow/filesystem/gcsfs.cc @@ -73,9 +73,18 @@ struct GcsPath { path.full_path = s; path.bucket = s.substr(0, first_sep); path.object = s.substr(first_sep + 1); + RETURN_NOT_OK(Validate(path)); return path; } + static Status Validate(const GcsPath& path) { + auto st = internal::ValidateAbstractPath(path.full_path); + if (!st.ok()) { + return Status::Invalid(st.message(), " in path ", path.full_path); + } + return Status::OK(); + } + GcsPath parent() const { auto object_parent = internal::GetAbstractPathParent(object).first; if (object_parent.empty()) return GcsPath{bucket, bucket, ""}; diff --git a/cpp/src/arrow/filesystem/gcsfs_test.cc b/cpp/src/arrow/filesystem/gcsfs_test.cc index 7a8afc0ee473a..a6022a8d21681 100644 --- a/cpp/src/arrow/filesystem/gcsfs_test.cc +++ b/cpp/src/arrow/filesystem/gcsfs_test.cc @@ -861,6 +861,14 @@ TEST_F(GcsIntegrationTest, CreateDirUri) { ASSERT_RAISES(Invalid, fs->CreateDir("gs://" + RandomBucketName(), true)); } +TEST_F(GcsIntegrationTest, CreateDirExtraneousSlashes) { + auto fs = GcsFileSystem::Make(TestGcsOptions()); + ASSERT_RAISES(Invalid, + fs->CreateDir(RandomBucketName() + "//somedir", /*recursive=*/true)); + ASSERT_RAISES(Invalid, fs->CreateDir(RandomBucketName() + "/somedir//newdir", + /*recursive=*/true)); +} + TEST_F(GcsIntegrationTest, DeleteBucketDirSuccess) { auto fs = GcsFileSystem::Make(TestGcsOptions()); ASSERT_OK(fs->CreateDir("pyarrow-filesystem/", /*recursive=*/true)); @@ -888,6 +896,12 @@ TEST_F(GcsIntegrationTest, DeleteDirUri) { ASSERT_RAISES(Invalid, fs->DeleteDir("gs://" + PreexistingBucketPath())); } +TEST_F(GcsIntegrationTest, DeleteDirExtraneousSlashes) { + auto fs = GcsFileSystem::Make(TestGcsOptions()); + ASSERT_RAISES(Invalid, fs->DeleteDir(PreexistingBucketPath() + "/somedir")); + ASSERT_RAISES(Invalid, fs->DeleteDir(PreexistingBucketPath() + "somedir//newdir")); +} + TEST_F(GcsIntegrationTest, DeleteDirContentsSuccess) { auto fs = GcsFileSystem::Make(TestGcsOptions()); ASSERT_OK_AND_ASSIGN(auto hierarchy, CreateHierarchy(fs)); diff --git a/cpp/src/arrow/filesystem/path_util.cc b/cpp/src/arrow/filesystem/path_util.cc index 9c895ae76c7b8..f38537e59f426 100644 --- a/cpp/src/arrow/filesystem/path_util.cc +++ b/cpp/src/arrow/filesystem/path_util.cc @@ -137,6 +137,18 @@ Status ValidateAbstractPathParts(const std::vector& parts) { return Status::OK(); } +Status ValidateAbstractPath(std::string_view path) { + auto pos = path.find_first_of(kSep); + while (pos != path.npos) { + ++pos; + if (path.length() > pos && path[pos] == kSep) { + return Status::Invalid("Empty path component"); + } + pos = path.find_first_of(kSep, pos); + } + return Status::OK(); +} + std::string ConcatAbstractPath(std::string_view base, std::string_view stem) { DCHECK(!stem.empty()); if (base.empty()) { diff --git a/cpp/src/arrow/filesystem/path_util.h b/cpp/src/arrow/filesystem/path_util.h index 1da7afd3f9381..d49d9d2efa7f6 100644 --- a/cpp/src/arrow/filesystem/path_util.h +++ b/cpp/src/arrow/filesystem/path_util.h @@ -63,6 +63,10 @@ ARROW_EXPORT int GetAbstractPathDepth(std::string_view path); ARROW_EXPORT std::pair GetAbstractPathParent(const std::string& s); +// Validate an abstract path. +ARROW_EXPORT +Status ValidateAbstractPath(std::string_view path); + // Validate the components of an abstract path. ARROW_EXPORT Status ValidateAbstractPathParts(const std::vector& parts); diff --git a/cpp/src/arrow/filesystem/s3fs.cc b/cpp/src/arrow/filesystem/s3fs.cc index b14f96e4dd75f..77fd951ba29c4 100644 --- a/cpp/src/arrow/filesystem/s3fs.cc +++ b/cpp/src/arrow/filesystem/s3fs.cc @@ -154,10 +154,10 @@ using internal::S3Backend; using internal::ToAwsString; using internal::ToURLEncodedAwsString; -constexpr const char kSep = '/'; -constexpr const char kAwsEndpointUrlEnvVar[] = "AWS_ENDPOINT_URL"; -constexpr const char kAwsEndpointUrlS3EnvVar[] = "AWS_ENDPOINT_URL_S3"; -constexpr const char kAwsDirectoryContentType[] = "application/x-directory"; +static constexpr const char kSep = '/'; +static constexpr const char kAwsEndpointUrlEnvVar[] = "AWS_ENDPOINT_URL"; +static constexpr const char kAwsEndpointUrlS3EnvVar[] = "AWS_ENDPOINT_URL_S3"; +static constexpr const char kAwsDirectoryContentType[] = "application/x-directory"; // ----------------------------------------------------------------------- // S3ProxyOptions implementation @@ -482,12 +482,11 @@ struct S3Path { } static Status Validate(const S3Path& path) { - auto result = internal::ValidateAbstractPathParts(path.key_parts); - if (!result.ok()) { - return Status::Invalid(result.message(), " in path ", path.full_path); - } else { - return result; + auto st = internal::ValidateAbstractPath(path.full_path); + if (!st.ok()) { + return Status::Invalid(st.message(), " in path ", path.full_path); } + return Status::OK(); } Aws::String ToAwsString() const { diff --git a/cpp/src/arrow/filesystem/s3fs_test.cc b/cpp/src/arrow/filesystem/s3fs_test.cc index ad7aaa1bd43cf..2ed97c5e9729e 100644 --- a/cpp/src/arrow/filesystem/s3fs_test.cc +++ b/cpp/src/arrow/filesystem/s3fs_test.cc @@ -935,6 +935,10 @@ TEST_F(TestS3FS, CreateDir) { // URI ASSERT_RAISES(Invalid, fs_->CreateDir("s3:bucket/newdir2")); + + // Extraneous slashes + ASSERT_RAISES(Invalid, fs_->CreateDir("bucket//somedir")); + ASSERT_RAISES(Invalid, fs_->CreateDir("bucket/somedir//newdir")); } TEST_F(TestS3FS, DeleteFile) { @@ -994,6 +998,10 @@ TEST_F(TestS3FS, DeleteDir) { // URI ASSERT_RAISES(Invalid, fs_->DeleteDir("s3:empty-bucket")); + + // Extraneous slashes + ASSERT_RAISES(Invalid, fs_->DeleteDir("bucket//newdir")); + ASSERT_RAISES(Invalid, fs_->DeleteDir("bucket/newdir//newsub")); } TEST_F(TestS3FS, DeleteDirContents) { From 7e286dd004a8fcf2de0f58615793338076741208 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Fri, 8 Mar 2024 10:42:06 -0500 Subject: [PATCH 04/30] GH-38923: [GLib] Fix spelling (#38924) ### Rationale for this change ### What changes are included in this PR? Spelling fixes to c_glib/ ### Are these changes tested? ### Are there any user-facing changes? * Closes: #38923 Lead-authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com> Co-authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- c_glib/arrow-dataset-glib/dataset-factory.h | 2 +- c_glib/arrow-flight-sql-glib/server.h | 2 +- c_glib/arrow-glib/array-builder.cpp | 4 ++-- c_glib/arrow-glib/buffer.cpp | 2 +- c_glib/arrow-glib/composite-array.cpp | 2 +- c_glib/arrow-glib/compute.cpp | 14 +++++++------- c_glib/arrow-glib/expression.cpp | 2 +- c_glib/arrow-glib/input-stream.cpp | 2 +- c_glib/arrow-glib/local-file-system.cpp | 2 +- c_glib/arrow-glib/metadata-version.cpp | 2 +- c_glib/arrow-glib/output-stream.cpp | 8 ++++---- c_glib/parquet-glib/arrow-file-reader.cpp | 12 ++++++------ c_glib/parquet-glib/arrow-file-writer.cpp | 8 ++++---- c_glib/parquet-glib/statistics.cpp | 2 +- c_glib/test/flight/test-client-options.rb | 2 +- c_glib/test/gandiva/test-native-function.rb | 2 +- c_glib/test/helper/readable.rb | 2 +- c_glib/test/test-array.rb | 4 ++-- c_glib/test/test-decimal128-data-type.rb | 2 +- c_glib/test/test-decimal256-data-type.rb | 2 +- c_glib/test/test-dictionary-array-builder.rb | 2 +- c_glib/test/test-extension-data-type.rb | 2 +- c_glib/test/test-fixed-size-binary-array.rb | 2 +- 23 files changed, 42 insertions(+), 42 deletions(-) diff --git a/c_glib/arrow-dataset-glib/dataset-factory.h b/c_glib/arrow-dataset-glib/dataset-factory.h index 292a9ca70dd89..ce15babba4ac1 100644 --- a/c_glib/arrow-dataset-glib/dataset-factory.h +++ b/c_glib/arrow-dataset-glib/dataset-factory.h @@ -100,7 +100,7 @@ GARROW_AVAILABLE_IN_5_0 gboolean gadataset_file_system_dataset_factory_add_selector( GADatasetFileSystemDatasetFactory *factory, - GArrorFileSelector *selector, + GArrowFileSelector *selector, GError **error); */ diff --git a/c_glib/arrow-flight-sql-glib/server.h b/c_glib/arrow-flight-sql-glib/server.h index 106b6e40db38f..90eb5ee7e4170 100644 --- a/c_glib/arrow-flight-sql-glib/server.h +++ b/c_glib/arrow-flight-sql-glib/server.h @@ -202,7 +202,7 @@ G_DECLARE_DERIVABLE_TYPE(GAFlightSQLServer, /** * GAFlightSQLServerClass: * @get_flight_info_statement: A virtual function to implement - * `GetFlightInfoStatment` API that gets a #GAFlightInfo for executing a + * `GetFlightInfoStatement` API that gets a #GAFlightInfo for executing a * SQL query. * @do_get_statement: A virtual function to implement `DoGetStatement` API * that gets a #GAFlightDataStream containing the query results. diff --git a/c_glib/arrow-glib/array-builder.cpp b/c_glib/arrow-glib/array-builder.cpp index ee6ec69e98366..5171161970bf5 100644 --- a/c_glib/arrow-glib/array-builder.cpp +++ b/c_glib/arrow-glib/array-builder.cpp @@ -5179,7 +5179,7 @@ garrow_binary_dictionary_array_builder_append_indices(GArrowBinaryDictionaryArra * garrow_binary_dictionary_array_builder_get_dictionary_length: * @builder: A #GArrowBinaryDictionaryArrayBuilder. * - * Returns: A number of entries in the dicitonary. + * Returns: A number of entries in the dictionary. * * Since: 2.0.0 */ @@ -5413,7 +5413,7 @@ garrow_string_dictionary_array_builder_append_indices(GArrowStringDictionaryArra * garrow_string_dictionary_array_builder_get_dictionary_length: * @builder: A #GArrowStringDictionaryArrayBuilder. * - * Returns: A number of entries in the dicitonary. + * Returns: A number of entries in the dictionary. * * Since: 2.0.0 */ diff --git a/c_glib/arrow-glib/buffer.cpp b/c_glib/arrow-glib/buffer.cpp index 58f47518c82e6..86d88cebd5ee4 100644 --- a/c_glib/arrow-glib/buffer.cpp +++ b/c_glib/arrow-glib/buffer.cpp @@ -307,7 +307,7 @@ garrow_buffer_get_data(GArrowBuffer *buffer) * @buffer: A #GArrowBuffer. * * Returns: (transfer full) (nullable): The data of the buffer. If the - * buffer is imutable, it returns %NULL. The data is owned by the + * buffer is immutable, it returns %NULL. The data is owned by the * buffer. You should not free the data. * * Since: 0.3.0 diff --git a/c_glib/arrow-glib/composite-array.cpp b/c_glib/arrow-glib/composite-array.cpp index 36d460c9e0276..6ca22e82389e4 100644 --- a/c_glib/arrow-glib/composite-array.cpp +++ b/c_glib/arrow-glib/composite-array.cpp @@ -2077,7 +2077,7 @@ garrow_run_end_encoded_array_find_physical_offset( * range of values from offset to length. * * Avoid calling this function if the physical length can be - * estabilished in some other way (e.g. when iterating over the runs + * established in some other way (e.g. when iterating over the runs * sequentially until the end). This function uses binary-search, so * it has a O(log N) cost. * diff --git a/c_glib/arrow-glib/compute.cpp b/c_glib/arrow-glib/compute.cpp index 14be097221dea..1415d953a584d 100644 --- a/c_glib/arrow-glib/compute.cpp +++ b/c_glib/arrow-glib/compute.cpp @@ -231,7 +231,7 @@ G_BEGIN_DECLS * #GArrowUTF8NormalizeOptions is a class to customize the * `utf8_normalize` function. * - * #GArrowQuantileOptions is a class to customize the `qunatile` + * #GArrowQuantileOptions is a class to customize the `quantile` * function. * * #GArrowIndexOptions is a class to customize the `index` function. @@ -5434,7 +5434,7 @@ garrow_record_batch_take(GArrowRecordBatch *record_batch, * @options: (nullable): A #GArrowFilterOptions. * @error: (nullable): Return location for a #GError or %NULL. * - * Returns: (nullable) (transfer full): The #GArrowArray filterd + * Returns: (nullable) (transfer full): The #GArrowArray filtered * with a boolean selection filter. Nulls in the filter will * result in nulls in the output. * @@ -5670,7 +5670,7 @@ garrow_table_sort_indices(GArrowTable *table, * @options: (nullable): A #GArrowFilterOptions. * @error: (nullable): Return location for a #GError or %NULL. * - * Returns: (nullable) (transfer full): The #GArrowTable filterd + * Returns: (nullable) (transfer full): The #GArrowTable filtered * with a boolean selection filter. Nulls in the filter will * result in nulls in the output. * @@ -5709,7 +5709,7 @@ garrow_table_filter(GArrowTable *table, * @options: (nullable): A #GArrowFilterOptions. * @error: (nullable): Return location for a #GError or %NULL. * - * Returns: (nullable) (transfer full): The #GArrowTable filterd + * Returns: (nullable) (transfer full): The #GArrowTable filtered * with a chunked array filter. Nulls in the filter will * result in nulls in the output. * @@ -5750,7 +5750,7 @@ garrow_table_filter_chunked_array(GArrowTable *table, * @options: (nullable): A #GArrowFilterOptions. * @error: (nullable): Return location for a #GError or %NULL. * - * Returns: (nullable) (transfer full): The #GArrowChunkedArray filterd + * Returns: (nullable) (transfer full): The #GArrowChunkedArray filtered * with a boolean selection filter. Nulls in the filter will * result in nulls in the output. * @@ -5789,7 +5789,7 @@ garrow_chunked_array_filter(GArrowChunkedArray *chunked_array, * @options: (nullable): A #GArrowFilterOptions. * @error: (nullable): Return location for a #GError or %NULL. * - * Returns: (nullable) (transfer full): The #GArrowChunkedArray filterd + * Returns: (nullable) (transfer full): The #GArrowChunkedArray filtered * with a chunked array filter. Nulls in the filter will * result in nulls in the output. * @@ -5830,7 +5830,7 @@ garrow_chunked_array_filter_chunked_array(GArrowChunkedArray *chunked_array, * @options: (nullable): A #GArrowFilterOptions. * @error: (nullable): Return location for a #GError or %NULL. * - * Returns: (nullable) (transfer full): The #GArrowRecordBatch filterd + * Returns: (nullable) (transfer full): The #GArrowRecordBatch filtered * with a boolean selection filter. Nulls in the filter will * result in nulls in the output. * diff --git a/c_glib/arrow-glib/expression.cpp b/c_glib/arrow-glib/expression.cpp index 419f668823d0a..48b5fd055e4d0 100644 --- a/c_glib/arrow-glib/expression.cpp +++ b/c_glib/arrow-glib/expression.cpp @@ -166,7 +166,7 @@ garrow_field_expression_class_init(GArrowFieldExpressionClass *klass) * @reference: A field name or dot path. * @error: (nullable): Return location for a #GError or %NULL. * - * Returns: A newly created #GArrowFieldExpression on sucess, %NULL on + * Returns: A newly created #GArrowFieldExpression on success, %NULL on * error. * * Since: 6.0.0 diff --git a/c_glib/arrow-glib/input-stream.cpp b/c_glib/arrow-glib/input-stream.cpp index 844c83d629b8f..b65e89845480c 100644 --- a/c_glib/arrow-glib/input-stream.cpp +++ b/c_glib/arrow-glib/input-stream.cpp @@ -697,7 +697,7 @@ garrow_file_input_stream_new_file_descriptor(gint file_descriptor, /** * garrow_file_input_stream_get_file_descriptor: - * @stream: A #GArrowFileInuptStream. + * @stream: A #GArrowFileInputStream. * * Returns: The file descriptor of @stream. * diff --git a/c_glib/arrow-glib/local-file-system.cpp b/c_glib/arrow-glib/local-file-system.cpp index c4b29658e31c9..ae503bf73136b 100644 --- a/c_glib/arrow-glib/local-file-system.cpp +++ b/c_glib/arrow-glib/local-file-system.cpp @@ -28,7 +28,7 @@ G_BEGIN_DECLS * @title: Local file system classes * @include: arrow-glib/arrow-glib.h * - * #GArrowLocalFileSystemOptions is a class for specifyiing options of + * #GArrowLocalFileSystemOptions is a class for specifying options of * an instance of #GArrowLocalFileSystem. * * #GArrowLocalFileSystem is a class for an implementation of a file system diff --git a/c_glib/arrow-glib/metadata-version.cpp b/c_glib/arrow-glib/metadata-version.cpp index 69cbaec37e94a..ffefeb2f08dcd 100644 --- a/c_glib/arrow-glib/metadata-version.cpp +++ b/c_glib/arrow-glib/metadata-version.cpp @@ -22,7 +22,7 @@ /** * SECTION: metadata-version * @title: GArrowMetadataVersion - * @short_description: Metadata version mapgging between Arrow and arrow-glib + * @short_description: Metadata version mapping between Arrow and arrow-glib * * #GArrowMetadataVersion provides metadata versions corresponding * to `arrow::ipc::MetadataVersion` values. diff --git a/c_glib/arrow-glib/output-stream.cpp b/c_glib/arrow-glib/output-stream.cpp index b5b51584c496f..a9317e9f28007 100644 --- a/c_glib/arrow-glib/output-stream.cpp +++ b/c_glib/arrow-glib/output-stream.cpp @@ -395,13 +395,13 @@ namespace garrow { int64_t n_bytes) override { GError *error = NULL; gsize n_written_bytes; - auto successed = g_output_stream_write_all(output_stream_, + auto succeeded = g_output_stream_write_all(output_stream_, data, n_bytes, &n_written_bytes, NULL, &error); - if (successed) { + if (succeeded) { position_ += n_written_bytes; return arrow::Status::OK(); } else { @@ -415,8 +415,8 @@ namespace garrow { arrow::Status Flush() override { GError *error = NULL; - auto successed = g_output_stream_flush(output_stream_, NULL, &error); - if (successed) { + auto succeeded = g_output_stream_flush(output_stream_, NULL, &error); + if (succeeded) { return arrow::Status::OK(); } else { return garrow_error_to_status(error, diff --git a/c_glib/parquet-glib/arrow-file-reader.cpp b/c_glib/parquet-glib/arrow-file-reader.cpp index fd21a9e9c3ab9..f7a4b09f814ac 100644 --- a/c_glib/parquet-glib/arrow-file-reader.cpp +++ b/c_glib/parquet-glib/arrow-file-reader.cpp @@ -123,7 +123,7 @@ gparquet_arrow_file_reader_class_init(GParquetArrowFileReaderClass *klass) /** * gparquet_arrow_file_reader_new_arrow: * @source: Arrow source to be read. - * @error: (nullable): Return locatipcn for a #GError or %NULL. + * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (nullable): A newly created #GParquetArrowFileReader. * @@ -152,7 +152,7 @@ gparquet_arrow_file_reader_new_arrow(GArrowSeekableInputStream *source, /** * gparquet_arrow_file_reader_new_path: * @path: Path to be read. - * @error: (nullable): Return locatipcn for a #GError or %NULL. + * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (nullable): A newly created #GParquetArrowFileReader. * @@ -189,7 +189,7 @@ gparquet_arrow_file_reader_new_path(const gchar *path, /** * gparquet_arrow_file_reader_read_table: * @reader: A #GParquetArrowFileReader. - * @error: (nullable): Return locatipcn for a #GError or %NULL. + * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (transfer full) (nullable): A read #GArrowTable. * @@ -220,7 +220,7 @@ gparquet_arrow_file_reader_read_table(GParquetArrowFileReader *reader, * If an index is negative, the index is counted backward from the * end of the columns. `-1` means the last column. * @n_column_indices: The number of elements of @column_indices. - * @error: (nullable): Return locatipcn for a #GError or %NULL. + * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (transfer full) (nullable): A read #GArrowTable. * @@ -273,7 +273,7 @@ gparquet_arrow_file_reader_read_row_group(GParquetArrowFileReader *reader, /** * gparquet_arrow_file_reader_get_schema: * @reader: A #GParquetArrowFileReader. - * @error: (nullable): Return locatipcn for a #GError or %NULL. + * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (transfer full) (nullable): A got #GArrowSchema. * @@ -302,7 +302,7 @@ gparquet_arrow_file_reader_get_schema(GParquetArrowFileReader *reader, * @i: The index of the column to be read. * If an index is negative, the index is counted backward from the * end of the columns. `-1` means the last column. - * @error: (nullable): Return locatipcn for a #GError or %NULL. + * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (transfer full) (nullable): A read #GArrowChunkedArray. * diff --git a/c_glib/parquet-glib/arrow-file-writer.cpp b/c_glib/parquet-glib/arrow-file-writer.cpp index 537e833053214..f923edbf5e5c8 100644 --- a/c_glib/parquet-glib/arrow-file-writer.cpp +++ b/c_glib/parquet-glib/arrow-file-writer.cpp @@ -406,7 +406,7 @@ gparquet_arrow_file_writer_class_init(GParquetArrowFileWriterClass *klass) * @schema: Arrow schema for written data. * @sink: Arrow output stream to be written. * @writer_properties: (nullable): A #GParquetWriterProperties. - * @error: (nullable): Return locatipcn for a #GError or %NULL. + * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (nullable): A newly created #GParquetArrowFileWriter. * @@ -451,7 +451,7 @@ gparquet_arrow_file_writer_new_arrow(GArrowSchema *schema, * @schema: Arrow schema for written data. * @path: Path to be read. * @writer_properties: (nullable): A #GParquetWriterProperties. - * @error: (nullable): Return locatipcn for a #GError or %NULL. + * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (nullable): A newly created #GParquetArrowFileWriter. * @@ -505,7 +505,7 @@ gparquet_arrow_file_writer_new_path(GArrowSchema *schema, * @writer: A #GParquetArrowFileWriter. * @table: A table to be written. * @chunk_size: The max number of rows in a row group. - * @error: (nullable): Return locatipcn for a #GError or %NULL. + * @error: (nullable): Return location for a #GError or %NULL. * * Returns: %TRUE on success, %FALSE if there was an error. * @@ -528,7 +528,7 @@ gparquet_arrow_file_writer_write_table(GParquetArrowFileWriter *writer, /** * gparquet_arrow_file_writer_close: * @writer: A #GParquetArrowFileWriter. - * @error: (nullable): Return locatipcn for a #GError or %NULL. + * @error: (nullable): Return location for a #GError or %NULL. * * Returns: %TRUE on success, %FALSE if there was an error. * diff --git a/c_glib/parquet-glib/statistics.cpp b/c_glib/parquet-glib/statistics.cpp index 5dae756bf62e2..596768d98007c 100644 --- a/c_glib/parquet-glib/statistics.cpp +++ b/c_glib/parquet-glib/statistics.cpp @@ -169,7 +169,7 @@ gparquet_statistics_get_n_nulls(GParquetStatistics *statistics) } /** - * gparquet_statistics_has_n_distinct_valuess: + * gparquet_statistics_has_n_distinct_values: * @statistics: A #GParquetStatistics. * * Returns: %TRUE if the number of distinct values is set, %FALSE otherwise. diff --git a/c_glib/test/flight/test-client-options.rb b/c_glib/test/flight/test-client-options.rb index b1a67c60699c2..e1f3a2f850a44 100644 --- a/c_glib/test/flight/test-client-options.rb +++ b/c_glib/test/flight/test-client-options.rb @@ -51,7 +51,7 @@ def test_write_size_limit_bytes assert_equal(100, @options.write_size_limit_bytes) end - def test_disable_server_verifiation + def test_disable_server_verification assert do not @options.disable_server_verification? end diff --git a/c_glib/test/gandiva/test-native-function.rb b/c_glib/test/gandiva/test-native-function.rb index 630a1f7c32d2a..4d4d6fc7d3f66 100644 --- a/c_glib/test/gandiva/test-native-function.rb +++ b/c_glib/test/gandiva/test-native-function.rb @@ -59,7 +59,7 @@ def test_to_string modulo.to_s) end - sub_test_case("get_result_nullbale_type") do + sub_test_case("get_result_nullable_type") do def test_if_null assert_equal(Gandiva::ResultNullableType::IF_NULL, @not.result_nullable_type) diff --git a/c_glib/test/helper/readable.rb b/c_glib/test/helper/readable.rb index 81bf0795c6b50..cea5faf7681de 100644 --- a/c_glib/test/helper/readable.rb +++ b/c_glib/test/helper/readable.rb @@ -19,7 +19,7 @@ module Helper module Readable def read_table(input, type: :file) if input.is_a?(Arrow::Buffer) - input_stream = Arrow::BufferIntputStream.new(input) + input_stream = Arrow::BufferInputStream.new(input) else input_stream = Arrow::FileInputStream.new(input) end diff --git a/c_glib/test/test-array.rb b/c_glib/test/test-array.rb index c03aecf1732b3..4da641b203f9c 100644 --- a/c_glib/test/test-array.rb +++ b/c_glib/test/test-array.rb @@ -141,12 +141,12 @@ def test_no_diff def test_diff array = build_string_array(["Start", "Shutdown", "Reboot"]) - other_array = build_string_array(["Start", "Shutdonw", "Reboot"]) + other_array = build_string_array(["Start", "Running", "Reboot"]) assert_equal(<<-STRING.chomp, array.diff_unified(other_array)) @@ -1, +1 @@ -"Shutdown" -+"Shutdonw" ++"Running" STRING end diff --git a/c_glib/test/test-decimal128-data-type.rb b/c_glib/test/test-decimal128-data-type.rb index 92f2f47f0bd71..f0e62c9d131b4 100644 --- a/c_glib/test/test-decimal128-data-type.rb +++ b/c_glib/test/test-decimal128-data-type.rb @@ -41,7 +41,7 @@ def test_scale assert_equal(2, data_type.scale) end - def test_deciaml_data_type_new + def test_decimal_data_type_new assert_equal(Arrow::Decimal128DataType.new(8, 2), Arrow::DecimalDataType.new(8, 2)) end diff --git a/c_glib/test/test-decimal256-data-type.rb b/c_glib/test/test-decimal256-data-type.rb index b26f7396043cf..6d803f7ce9020 100644 --- a/c_glib/test/test-decimal256-data-type.rb +++ b/c_glib/test/test-decimal256-data-type.rb @@ -41,7 +41,7 @@ def test_scale assert_equal(2, data_type.scale) end - def test_deciaml_data_type_new + def test_decimal_data_type_new assert_equal(Arrow::Decimal256DataType.new(39, 1), Arrow::DecimalDataType.new(39, 1)) end diff --git a/c_glib/test/test-dictionary-array-builder.rb b/c_glib/test/test-dictionary-array-builder.rb index 4531e44f4a4ee..2d14563c840c8 100644 --- a/c_glib/test/test-dictionary-array-builder.rb +++ b/c_glib/test/test-dictionary-array-builder.rb @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -class TestDictinaryArrayBuilder < Test::Unit::TestCase +class TestDictionaryArrayBuilder < Test::Unit::TestCase include Helper::Buildable def setup diff --git a/c_glib/test/test-extension-data-type.rb b/c_glib/test/test-extension-data-type.rb index 59c6395e98df2..6c114b81e2c33 100644 --- a/c_glib/test/test-extension-data-type.rb +++ b/c_glib/test/test-extension-data-type.rb @@ -91,7 +91,7 @@ def test_wrap_chunked_array ["a" * 16, nil]) storage2 = build_fixed_size_binary_array(data_type.storage_data_type, ["c" * 16]) - chunkd_array = Arrow::ChunkedArray.new([storage1, storage2]) + chunked_array = Arrow::ChunkedArray.new([storage1, storage2]) extension_chunked_array = data_type.wrap_chunked_array(chunked_array) assert_equal([ data_type, diff --git a/c_glib/test/test-fixed-size-binary-array.rb b/c_glib/test/test-fixed-size-binary-array.rb index 29189e78a7d9c..8de32c57a622b 100644 --- a/c_glib/test/test-fixed-size-binary-array.rb +++ b/c_glib/test/test-fixed-size-binary-array.rb @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -class TestFixedSizeBinaryrray < Test::Unit::TestCase +class TestFixedSizeBinaryArray < Test::Unit::TestCase include Helper::Buildable def setup From 8325ad1c167faa74e70c9d43647fabdb2ac41b6a Mon Sep 17 00:00:00 2001 From: Hyunseok Seo Date: Sun, 10 Mar 2024 02:27:39 +0900 Subject: [PATCH 05/30] GH-40422: [C++][FlightRPC] Add missing expiration_time arguments (#40425) ### Rationale for this change This happens when `-DARROW_BUILD_BENCHMARKS=ON` and sometimes cannot be detected by CI. ### What changes are included in this PR? Add missing `expiration_time` and `app_metadata` arguments as default. ### Are these changes tested? yes (build and run unit test) ### Are there any user-facing changes? No * GitHub Issue: #40422 Authored-by: Hyunseok Seo Signed-off-by: David Li --- cpp/src/arrow/flight/integration_tests/test_integration.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/arrow/flight/integration_tests/test_integration.cc b/cpp/src/arrow/flight/integration_tests/test_integration.cc index 464e6832c39c7..21f57efd122c3 100644 --- a/cpp/src/arrow/flight/integration_tests/test_integration.cc +++ b/cpp/src/arrow/flight/integration_tests/test_integration.cc @@ -2087,7 +2087,7 @@ class ReuseConnectionServer : public FlightServerBase { const FlightDescriptor& descriptor, std::unique_ptr* info) override { auto location = Location::ReuseConnection(); - auto endpoint = FlightEndpoint{{"reuse"}, {location}}; + auto endpoint = FlightEndpoint{{"reuse"}, {location}, std::nullopt, ""}; ARROW_ASSIGN_OR_RAISE(auto info_data, FlightInfo::Make(arrow::Schema({}), descriptor, {endpoint}, -1, -1)); *info = std::make_unique(std::move(info_data)); From 6a7a6ee308b69c12f46f874cb3d52892e172d7b7 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Sun, 10 Mar 2024 05:41:36 +0900 Subject: [PATCH 06/30] GH-40432: [C++] Add missing Threads::Threads dependency to arrow_static (#40433) ### Rationale for this change `libarrow.a` uses `std::mutex` and so on. So we need to link to `Threads::Threads`. But #39824 dropped it accidentally. ### What changes are included in this PR? Add unexpectedly dropped `Threads::Threads` dependency to `arrow_static` again. ### Are these changes tested? Yes. ### Are there any user-facing changes? Yes. * GitHub Issue: #40432 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- cpp/src/arrow/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index 0bf55e38f92b5..b53d76e74765f 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -137,6 +137,7 @@ endif() if(ARROW_ENABLE_THREADING) list(APPEND ARROW_SHARED_PRIVATE_LINK_LIBS Threads::Threads) list(APPEND ARROW_STATIC_LINK_LIBS Threads::Threads) + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS Threads::Threads) endif() if(NOT MSVC_TOOLCHAIN) From 4de08748afa7dc2b7f36017ed608bfee3cab70e1 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Sun, 10 Mar 2024 16:54:24 +0900 Subject: [PATCH 07/30] GH-39935: [GLib][Docs] Use GI-DocGen instead of GTK-Doc (#40427) ### Rationale for this change DI-DocGen is a new documentation generator for GObject-based libraries. GTK-Doc is still maintained but abandoned. ### What changes are included in this PR? Use GI-DocGen. ### Are these changes tested? Yes. ### Are there any user-facing changes? Yes. * GitHub Issue: #39935 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- c_glib/Brewfile | 2 - c_glib/arrow-cuda-glib/meson.build | 4 +- c_glib/arrow-dataset-glib/meson.build | 8 +- c_glib/arrow-flight-glib/meson.build | 10 +- c_glib/arrow-flight-sql-glib/meson.build | 16 +- c_glib/arrow-glib/meson.build | 6 +- c_glib/doc/arrow-cuda-glib.toml.in | 55 +++ c_glib/doc/arrow-dataset-glib.toml.in | 55 +++ .../arrow-dataset-glib-docs.xml | 92 ----- c_glib/doc/arrow-dataset-glib/entities.xml.in | 24 -- c_glib/doc/arrow-dataset-glib/meson.build | 83 ----- c_glib/doc/arrow-flight-glib.toml.in | 55 +++ .../arrow-flight-glib-docs.xml | 75 ----- c_glib/doc/arrow-flight-glib/entities.xml.in | 24 -- c_glib/doc/arrow-flight-glib/meson.build | 83 ----- c_glib/doc/arrow-flight-sql-glib.toml.in | 55 +++ .../arrow-flight-sql-glib-docs.xml | 70 ---- .../doc/arrow-flight-sql-glib/entities.xml.in | 24 -- c_glib/doc/arrow-flight-sql-glib/meson.build | 89 ----- c_glib/doc/arrow-glib.toml.in | 87 +++++ c_glib/doc/arrow-glib/arrow-glib-docs.xml | 313 ------------------ c_glib/doc/arrow-glib/entities.xml.in | 24 -- c_glib/doc/arrow-glib/meson.build | 93 ------ c_glib/doc/gandiva-glib.toml.in | 55 +++ c_glib/doc/gandiva-glib/entities.xml.in | 24 -- c_glib/doc/gandiva-glib/gandiva-glib-docs.xml | 132 -------- c_glib/doc/gandiva-glib/meson.build | 83 ----- c_glib/doc/meson.build | 93 ++++++ c_glib/doc/parquet-glib.toml.in | 55 +++ c_glib/doc/parquet-glib/entities.xml.in | 24 -- c_glib/doc/parquet-glib/meson.build | 83 ----- c_glib/doc/parquet-glib/parquet-glib-docs.xml | 98 ------ c_glib/doc/urlmap.js | 29 ++ c_glib/example/vala/meson.build | 4 +- c_glib/gandiva-glib/meson.build | 4 +- c_glib/meson.build | 69 ++-- c_glib/meson_options.txt | 14 +- c_glib/parquet-glib/meson.build | 4 +- ci/docker/linux-apt-c-glib.dockerfile | 2 +- ci/docker/linux-apt-docs.dockerfile | 2 +- ci/scripts/c_glib_build.sh | 6 +- ci/scripts/msys2_setup.sh | 1 - .../apt/debian-bookworm/Dockerfile | 2 +- .../apt/debian-bullseye/Dockerfile | 10 +- .../apache-arrow/apt/debian-trixie/Dockerfile | 2 +- .../apache-arrow/apt/ubuntu-focal/Dockerfile | 3 +- .../apache-arrow/apt/ubuntu-jammy/Dockerfile | 2 +- .../apache-arrow/apt/ubuntu-noble/Dockerfile | 2 +- .../apache-arrow/debian/control.in | 3 +- .../debian/libarrow-dataset-glib-doc.doc-base | 4 +- .../debian/libarrow-dataset-glib-doc.install | 2 +- .../debian/libarrow-dataset-glib-doc.links | 4 +- .../debian/libarrow-flight-glib-doc.doc-base | 4 +- .../debian/libarrow-flight-glib-doc.install | 2 +- .../debian/libarrow-flight-glib-doc.links | 4 +- .../libarrow-flight-sql-glib-doc.doc-base | 4 +- .../libarrow-flight-sql-glib-doc.install | 2 +- .../debian/libarrow-flight-sql-glib-doc.links | 7 +- .../debian/libarrow-glib-doc.doc-base | 4 +- .../debian/libarrow-glib-doc.install | 5 +- .../debian/libarrow-glib-doc.links | 3 +- .../debian/libgandiva-glib-doc.doc-base | 4 +- .../debian/libgandiva-glib-doc.install | 2 +- .../debian/libgandiva-glib-doc.links | 3 +- .../debian/libparquet-glib-doc.doc-base | 4 +- .../debian/libparquet-glib-doc.install | 2 +- .../debian/libparquet-glib-doc.links | 4 +- .../linux-packages/apache-arrow/debian/rules | 2 +- .../apache-arrow/yum/almalinux-8/Dockerfile | 2 +- .../apache-arrow/yum/almalinux-9/Dockerfile | 2 +- .../yum/amazon-linux-2023/Dockerfile | 3 +- .../apache-arrow/yum/arrow.spec.in | 45 ++- .../apache-arrow/yum/centos-7/Dockerfile | 2 +- .../yum/centos-8-stream/Dockerfile | 2 +- .../yum/centos-9-stream/Dockerfile | 2 +- 75 files changed, 712 insertions(+), 1565 deletions(-) create mode 100644 c_glib/doc/arrow-cuda-glib.toml.in create mode 100644 c_glib/doc/arrow-dataset-glib.toml.in delete mode 100644 c_glib/doc/arrow-dataset-glib/arrow-dataset-glib-docs.xml delete mode 100644 c_glib/doc/arrow-dataset-glib/entities.xml.in delete mode 100644 c_glib/doc/arrow-dataset-glib/meson.build create mode 100644 c_glib/doc/arrow-flight-glib.toml.in delete mode 100644 c_glib/doc/arrow-flight-glib/arrow-flight-glib-docs.xml delete mode 100644 c_glib/doc/arrow-flight-glib/entities.xml.in delete mode 100644 c_glib/doc/arrow-flight-glib/meson.build create mode 100644 c_glib/doc/arrow-flight-sql-glib.toml.in delete mode 100644 c_glib/doc/arrow-flight-sql-glib/arrow-flight-sql-glib-docs.xml delete mode 100644 c_glib/doc/arrow-flight-sql-glib/entities.xml.in delete mode 100644 c_glib/doc/arrow-flight-sql-glib/meson.build create mode 100644 c_glib/doc/arrow-glib.toml.in delete mode 100644 c_glib/doc/arrow-glib/arrow-glib-docs.xml delete mode 100644 c_glib/doc/arrow-glib/entities.xml.in delete mode 100644 c_glib/doc/arrow-glib/meson.build create mode 100644 c_glib/doc/gandiva-glib.toml.in delete mode 100644 c_glib/doc/gandiva-glib/entities.xml.in delete mode 100644 c_glib/doc/gandiva-glib/gandiva-glib-docs.xml delete mode 100644 c_glib/doc/gandiva-glib/meson.build create mode 100644 c_glib/doc/meson.build create mode 100644 c_glib/doc/parquet-glib.toml.in delete mode 100644 c_glib/doc/parquet-glib/entities.xml.in delete mode 100644 c_glib/doc/parquet-glib/meson.build delete mode 100644 c_glib/doc/parquet-glib/parquet-glib-docs.xml create mode 100644 c_glib/doc/urlmap.js diff --git a/c_glib/Brewfile b/c_glib/Brewfile index 5ab502036961a..d281e047350bd 100644 --- a/c_glib/Brewfile +++ b/c_glib/Brewfile @@ -16,7 +16,5 @@ # under the License. brew "gobject-introspection" -brew "gtk-doc" -brew "libtool" brew "meson" brew "vala" diff --git a/c_glib/arrow-cuda-glib/meson.build b/c_glib/arrow-cuda-glib/meson.build index 1718e2fc990d5..88029e6dc2073 100644 --- a/c_glib/arrow-cuda-glib/meson.build +++ b/c_glib/arrow-cuda-glib/meson.build @@ -72,15 +72,13 @@ if have_gi dependencies: gir_dependencies, export_packages: 'arrow-cuda-glib', extra_args: gir_extra_args, - fatal_warnings: gi_fatal_warnings, header: 'arrow-cuda-glib/arrow-cuda-glib.h', identifier_prefix: 'GArrowCUDA', includes: [ 'Arrow-1.0', ], - install: true, + kwargs: generate_gi_common_args, namespace: 'ArrowCUDA', - nsversion: api_version, sources: sources + c_headers, symbol_prefix: 'garrow_cuda') diff --git a/c_glib/arrow-dataset-glib/meson.build b/c_glib/arrow-dataset-glib/meson.build index 4037cf00b7a13..0c869a4183efa 100644 --- a/c_glib/arrow-dataset-glib/meson.build +++ b/c_glib/arrow-dataset-glib/meson.build @@ -88,7 +88,7 @@ pkgconfig.generate(libarrow_dataset_glib, version: version) if have_gi - dataset_glib_gir = \ + arrow_dataset_glib_gir = \ gnome.generate_gir(libarrow_dataset_glib, dependencies: declare_dependency(sources: arrow_glib_gir), export_packages: 'arrow-dataset-glib', @@ -96,15 +96,13 @@ if have_gi '--warn-all', '--include-uninstalled=./arrow-glib/Arrow-1.0.gir', ], - fatal_warnings: gi_fatal_warnings, header: 'arrow-dataset-glib/arrow-dataset-glib.h', identifier_prefix: 'GADataset', includes: [ 'Arrow-1.0', ], - install: true, + kwargs: generate_gi_common_args, namespace: 'ArrowDataset', - nsversion: api_version, sources: sources + c_headers + enums, symbol_prefix: 'gadataset') @@ -115,6 +113,6 @@ if have_gi arrow_glib_vapi, 'gio-2.0', ], - sources: [dataset_glib_gir[0]]) + sources: [arrow_dataset_glib_gir[0]]) endif endif diff --git a/c_glib/arrow-flight-glib/meson.build b/c_glib/arrow-flight-glib/meson.build index b869fd226b86a..70db7400b124a 100644 --- a/c_glib/arrow-flight-glib/meson.build +++ b/c_glib/arrow-flight-glib/meson.build @@ -65,7 +65,7 @@ pkgconfig.generate(libarrow_flight_glib, version: version) if have_gi - flight_glib_gir = \ + arrow_flight_glib_gir = \ gnome.generate_gir(libarrow_flight_glib, dependencies: declare_dependency(sources: arrow_glib_gir), export_packages: 'arrow-flight-glib', @@ -73,26 +73,24 @@ if have_gi '--warn-all', '--include-uninstalled=./arrow-glib/Arrow-1.0.gir', ], - fatal_warnings: gi_fatal_warnings, header: 'arrow-flight-glib/arrow-flight-glib.h', identifier_prefix: 'GAFlight', includes: [ 'Arrow-1.0', ], - install: true, + kwargs: generate_gi_common_args, namespace: 'ArrowFlight', - nsversion: api_version, sources: sources + c_headers, symbol_prefix: 'gaflight') if generate_vapi - flight_glib_vapi = \ + arrow_flight_glib_vapi = \ gnome.generate_vapi('arrow-flight-glib', install: true, packages: [ arrow_glib_vapi, 'gio-2.0', ], - sources: [flight_glib_gir[0]]) + sources: [arrow_flight_glib_gir[0]]) endif endif diff --git a/c_glib/arrow-flight-sql-glib/meson.build b/c_glib/arrow-flight-sql-glib/meson.build index f1ea6d67cb04e..e7abc605bb819 100644 --- a/c_glib/arrow-flight-sql-glib/meson.build +++ b/c_glib/arrow-flight-sql-glib/meson.build @@ -63,27 +63,25 @@ pkgconfig.generate(libarrow_flight_sql_glib, version: version) if have_gi - flight_sql_glib_gir_dependencies = \ - declare_dependency(sources: [arrow_glib_gir, flight_glib_gir]) - flight_sql_glib_gir = \ + arrow_flight_sql_glib_gir_dependencies = \ + declare_dependency(sources: [arrow_glib_gir, arrow_flight_glib_gir]) + arrow_flight_sql_glib_gir = \ gnome.generate_gir(libarrow_flight_sql_glib, - dependencies: flight_sql_glib_gir_dependencies, + dependencies: arrow_flight_sql_glib_gir_dependencies, export_packages: 'arrow-flight-sql-glib', extra_args: [ '--warn-all', '--include-uninstalled=./arrow-glib/Arrow-1.0.gir', '--include-uninstalled=./arrow-flight-glib/ArrowFlight-1.0.gir', ], - fatal_warnings: gi_fatal_warnings, header: 'arrow-flight-sql-glib/arrow-flight-sql-glib.h', identifier_prefix: 'GAFlightSQL', includes: [ 'Arrow-1.0', 'ArrowFlight-1.0', ], - install: true, + kwargs: generate_gi_common_args, namespace: 'ArrowFlightSQL', - nsversion: api_version, sources: sources + c_headers, symbol_prefix: 'gaflightsql') @@ -91,10 +89,10 @@ if have_gi gnome.generate_vapi('arrow-flight-sql-glib', install: true, packages: [ - flight_glib_vapi, + arrow_flight_glib_vapi, arrow_glib_vapi, 'gio-2.0', ], - sources: [flight_sql_glib_gir[0]]) + sources: [arrow_flight_sql_glib_gir[0]]) endif endif diff --git a/c_glib/arrow-glib/meson.build b/c_glib/arrow-glib/meson.build index b26dcc4c080eb..7efba11bf9417 100644 --- a/c_glib/arrow-glib/meson.build +++ b/c_glib/arrow-glib/meson.build @@ -279,18 +279,16 @@ if have_gi extra_args: [ '--warn-all', ], - fatal_warnings: gi_fatal_warnings, header: 'arrow-glib/arrow-glib.h', identifier_prefix: 'GArrow', includes: [ 'GObject-2.0', 'Gio-2.0', ], - install: true, namespace: 'Arrow', - nsversion: api_version, sources: sources + c_headers + enums, - symbol_prefix: 'garrow') + symbol_prefix: 'garrow', + kwargs: generate_gi_common_args) if generate_vapi arrow_glib_vapi = gnome.generate_vapi('arrow-glib', diff --git a/c_glib/doc/arrow-cuda-glib.toml.in b/c_glib/doc/arrow-cuda-glib.toml.in new file mode 100644 index 0000000000000..fbd491487aabd --- /dev/null +++ b/c_glib/doc/arrow-cuda-glib.toml.in @@ -0,0 +1,55 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[library] +name = "Apache Arrow CUDA GLib" +version = "@VERSION@" +browse_url = "https://github.com/apache/arrow/tree/@SOURCE_REFERENCE@/c_glib/arrow-cuda-glib/" +repository_url = "https://github.com/apache/arrow.git" +website_url = "https://arrow.apache.org/docs/c_glib/arrow-cuda-glib/" +authors = "The Apache Software Foundation" +license = "Apache-2.0" +description = "Apache Arrow CUDA GLib API" +dependencies = ["Arrow-1.0"] +related = ["Gio-2.0", "GObject-2.0"] +search_index = true + +[dependencies."Arrow-1.0"] +name = "Arrow" +description = "Apache Arrow GLib API" +docs_url = "https://arrow.apache.org/docs/c_glib/arrow-glib/" + +[related."Gio-2.0"] +name = "GIO" +description = "GObject Interfaces and Objects, Networking, IPC, and I/O" +docs_url = "https://docs.gtk.org/gio/" + +[related."GObject-2.0"] +name = "GObject" +description = "The base type system library" +docs_url = "https://docs.gtk.org/gobject/" + +[source-location] +base_url = "https://github.com/apache/arrow/blob/@SOURCE_REFERENCE@/c_glib/arrow-cuda-glib" + +[extra] +content_base_url = "https://github.com/apache/arrow/blob/@SOURCE_REFERENCE@/c_glib/doc/" +content_files = [ +] +content_images = [ +] +urlmap_file = "urlmap.js" diff --git a/c_glib/doc/arrow-dataset-glib.toml.in b/c_glib/doc/arrow-dataset-glib.toml.in new file mode 100644 index 0000000000000..1e76bab4db30f --- /dev/null +++ b/c_glib/doc/arrow-dataset-glib.toml.in @@ -0,0 +1,55 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[library] +name = "Apache Arrow Dataset GLib" +version = "@VERSION@" +browse_url = "https://github.com/apache/arrow/tree/@SOURCE_REFERENCE@/c_glib/arrow-dataset-glib/" +repository_url = "https://github.com/apache/arrow.git" +website_url = "https://arrow.apache.org/docs/c_glib/arrow-dataset-glib/" +authors = "The Apache Software Foundation" +license = "Apache-2.0" +description = "Apache Arrow Dataset GLib API" +dependencies = ["Arrow-1.0"] +related = ["Gio-2.0", "GObject-2.0"] +search_index = true + +[dependencies."Arrow-1.0"] +name = "Arrow" +description = "Apache Arrow GLib API" +docs_url = "https://arrow.apache.org/docs/c_glib/arrow-glib/" + +[related."Gio-2.0"] +name = "GIO" +description = "GObject Interfaces and Objects, Networking, IPC, and I/O" +docs_url = "https://docs.gtk.org/gio/" + +[related."GObject-2.0"] +name = "GObject" +description = "The base type system library" +docs_url = "https://docs.gtk.org/gobject/" + +[source-location] +base_url = "https://github.com/apache/arrow/blob/@SOURCE_REFERENCE@/c_glib/arrow-dataset-glib" + +[extra] +content_base_url = "https://github.com/apache/arrow/blob/@SOURCE_REFERENCE@/c_glib/doc/" +content_files = [ +] +content_images = [ +] +urlmap_file = "urlmap.js" diff --git a/c_glib/doc/arrow-dataset-glib/arrow-dataset-glib-docs.xml b/c_glib/doc/arrow-dataset-glib/arrow-dataset-glib-docs.xml deleted file mode 100644 index e6066379ceba3..0000000000000 --- a/c_glib/doc/arrow-dataset-glib/arrow-dataset-glib-docs.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - %gtkdocentities; -]> - - - &package_name; Reference Manual - - for &package_string;. - - - - - - Data - - Partitioning - - Dataset - - Dataset factory - - - - Scan - - Fragment - - File format - - - - - - Object Hierarchy - - - - API Index - - - - Index of deprecated API - - - - Index of new symbols in 11.0.0 - - - - Index of new symbols in 6.0.0 - - - - Index of new symbols in 5.0.0 - - - - Index of new symbols in 4.0.0 - - - - Index of new symbols in 3.0.0 - - - - diff --git a/c_glib/doc/arrow-dataset-glib/entities.xml.in b/c_glib/doc/arrow-dataset-glib/entities.xml.in deleted file mode 100644 index aa5addb4e8431..0000000000000 --- a/c_glib/doc/arrow-dataset-glib/entities.xml.in +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/c_glib/doc/arrow-dataset-glib/meson.build b/c_glib/doc/arrow-dataset-glib/meson.build deleted file mode 100644 index ca037b7e36a2e..0000000000000 --- a/c_glib/doc/arrow-dataset-glib/meson.build +++ /dev/null @@ -1,83 +0,0 @@ -# -*- indent-tabs-mode: nil -*- -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -package_id = 'arrow-dataset-glib' -package_name = 'Apache Arrow Dataset GLib' -entities_conf = configuration_data() -entities_conf.set('PACKAGE', package_id) -entities_conf.set('PACKAGE_BUGREPORT', - 'https://issues.apache.org/jira/browse/ARROW') -entities_conf.set('PACKAGE_NAME', package_name) -entities_conf.set('PACKAGE_STRING', - ' '.join([package_id, version])) -entities_conf.set('PACKAGE_URL', 'https://arrow.apache.org/') -entities_conf.set('PACKAGE_VERSION', version) -configure_file(input: 'entities.xml.in', - output: 'entities.xml', - configuration: entities_conf) - -private_headers = [ -] - -content_files = [ -] - -html_images = [ -] - -glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix') -glib_doc_path = join_paths(glib_prefix, 'share', 'gtk-doc', 'html') -arrow_glib_doc_path = join_paths(data_dir, - 'gtk-doc', - 'html', - 'arrow-glib') -doc_path = join_paths(data_dir, 'gtk-doc', 'html', package_id) - -source_directories = [ - join_paths(meson.source_root(), package_id), - join_paths(meson.build_root(), package_id), -] -dependencies = [ - arrow_glib, - arrow_dataset_glib, -] -ignore_headers = [] -gnome.gtkdoc(package_id, - main_xml: package_id + '-docs.xml', - src_dir: source_directories, - dependencies: dependencies, - ignore_headers: ignore_headers, - gobject_typesfile: package_id + '.types', - scan_args: [ - '--rebuild-types', - '--deprecated-guards=GARROW_DISABLE_DEPRECATED', - ], - mkdb_args: [ - '--output-format=xml', - '--name-space=gadataset', - '--source-suffixes=c,cpp,h', - ], - fixxref_args: [ - '--html-dir=' + doc_path, - '--extra-dir=' + join_paths(glib_doc_path, 'glib'), - '--extra-dir=' + join_paths(glib_doc_path, 'gobject'), - '--extra-dir=' + arrow_glib_doc_path, - ], - html_assets: html_images, - install: true) diff --git a/c_glib/doc/arrow-flight-glib.toml.in b/c_glib/doc/arrow-flight-glib.toml.in new file mode 100644 index 0000000000000..9fef030f431f6 --- /dev/null +++ b/c_glib/doc/arrow-flight-glib.toml.in @@ -0,0 +1,55 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[library] +name = "Apache Arrow Flight GLib" +version = "@VERSION@" +browse_url = "https://github.com/apache/arrow/tree/@SOURCE_REFERENCE@/c_glib/arrow-flight-glib/" +repository_url = "https://github.com/apache/arrow.git" +website_url = "https://arrow.apache.org/docs/c_glib/arrow-flight-glib/" +authors = "The Apache Software Foundation" +license = "Apache-2.0" +description = "Apache Arrow Flight GLib API" +dependencies = ["Arrow-1.0"] +related = ["Gio-2.0", "GObject-2.0"] +search_index = true + +[dependencies."Arrow-1.0"] +name = "Arrow" +description = "Apache Arrow GLib API" +docs_url = "https://arrow.apache.org/docs/c_glib/arrow-glib/" + +[related."Gio-2.0"] +name = "GIO" +description = "GObject Interfaces and Objects, Networking, IPC, and I/O" +docs_url = "https://docs.gtk.org/gio/" + +[related."GObject-2.0"] +name = "GObject" +description = "The base type system library" +docs_url = "https://docs.gtk.org/gobject/" + +[source-location] +base_url = "https://github.com/apache/arrow/blob/@SOURCE_REFERENCE@/c_glib/arrow-flight-glib" + +[extra] +content_base_url = "https://github.com/apache/arrow/blob/@SOURCE_REFERENCE@/c_glib/doc/" +content_files = [ +] +content_images = [ +] +urlmap_file = "urlmap.js" diff --git a/c_glib/doc/arrow-flight-glib/arrow-flight-glib-docs.xml b/c_glib/doc/arrow-flight-glib/arrow-flight-glib-docs.xml deleted file mode 100644 index e58ff375c5964..0000000000000 --- a/c_glib/doc/arrow-flight-glib/arrow-flight-glib-docs.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - %gtkdocentities; -]> - - - &package_name; Reference Manual - - for &package_string;. - - - - - - RPC - - - - - - - Object Hierarchy - - - - API Index - - - - Index of deprecated API - - - - Index of new symbols in 14.0.0 - - - - Index of new symbols in 12.0.0 - - - - Index of new symbols in 6.0.0 - - - - Index of new symbols in 5.0.0 - - - - diff --git a/c_glib/doc/arrow-flight-glib/entities.xml.in b/c_glib/doc/arrow-flight-glib/entities.xml.in deleted file mode 100644 index aa5addb4e8431..0000000000000 --- a/c_glib/doc/arrow-flight-glib/entities.xml.in +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/c_glib/doc/arrow-flight-glib/meson.build b/c_glib/doc/arrow-flight-glib/meson.build deleted file mode 100644 index 64524409c72df..0000000000000 --- a/c_glib/doc/arrow-flight-glib/meson.build +++ /dev/null @@ -1,83 +0,0 @@ -# -*- indent-tabs-mode: nil -*- -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -package_id = 'arrow-flight-glib' -package_name = 'Apache Arrow Flight GLib' -entities_conf = configuration_data() -entities_conf.set('PACKAGE', package_id) -entities_conf.set('PACKAGE_BUGREPORT', - 'https://issues.apache.org/jira/browse/ARROW') -entities_conf.set('PACKAGE_NAME', package_name) -entities_conf.set('PACKAGE_STRING', - ' '.join([package_id, version])) -entities_conf.set('PACKAGE_URL', 'https://arrow.apache.org/') -entities_conf.set('PACKAGE_VERSION', version) -configure_file(input: 'entities.xml.in', - output: 'entities.xml', - configuration: entities_conf) - -private_headers = [ -] - -content_files = [ -] - -html_images = [ -] - -glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix') -glib_doc_path = join_paths(glib_prefix, 'share', 'gtk-doc', 'html') -arrow_glib_doc_path = join_paths(data_dir, - 'gtk-doc', - 'html', - 'arrow-glib') -doc_path = join_paths(data_dir, 'gtk-doc', 'html', package_id) - -source_directories = [ - join_paths(meson.source_root(), package_id), - join_paths(meson.build_root(), package_id), -] -dependencies = [ - arrow_glib, - arrow_flight_glib, -] -ignore_headers = [] -gnome.gtkdoc(package_id, - main_xml: package_id + '-docs.xml', - src_dir: source_directories, - dependencies: dependencies, - ignore_headers: ignore_headers, - gobject_typesfile: package_id + '.types', - scan_args: [ - '--rebuild-types', - '--deprecated-guards=GARROW_DISABLE_DEPRECATED', - ], - mkdb_args: [ - '--output-format=xml', - '--name-space=gaflight', - '--source-suffixes=c,cpp,h', - ], - fixxref_args: [ - '--html-dir=' + doc_path, - '--extra-dir=' + join_paths(glib_doc_path, 'glib'), - '--extra-dir=' + join_paths(glib_doc_path, 'gobject'), - '--extra-dir=' + arrow_glib_doc_path, - ], - html_assets: html_images, - install: true) diff --git a/c_glib/doc/arrow-flight-sql-glib.toml.in b/c_glib/doc/arrow-flight-sql-glib.toml.in new file mode 100644 index 0000000000000..e4b9c3a83aa33 --- /dev/null +++ b/c_glib/doc/arrow-flight-sql-glib.toml.in @@ -0,0 +1,55 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[library] +name = "Apache Arrow Flight SQL GLib" +version = "@VERSION@" +browse_url = "https://github.com/apache/arrow/tree/@SOURCE_REFERENCE@/c_glib/arrow-flight-sql-glib/" +repository_url = "https://github.com/apache/arrow.git" +website_url = "https://arrow.apache.org/docs/c_glib/arrow-flight-sql-glib/" +authors = "The Apache Software Foundation" +license = "Apache-2.0" +description = "Apache Arrow Flight SQL GLib API" +dependencies = ["ArrowFlight-1.0", "Arrow-1.0"] +related = ["GObject-2.0"] +search_index = true + +[dependencies."ArrowFlight-1.0"] +name = "ArrowFlight" +description = "Apache Arrow Flight GLib API" +docs_url = "https://arrow.apache.org/docs/c_glib/arrow-flight-glib/" + +[dependencies."Arrow-1.0"] +name = "Arrow" +description = "Apache Arrow GLib API" +docs_url = "https://arrow.apache.org/docs/c_glib/arrow-glib/" + +[related."GObject-2.0"] +name = "GObject" +description = "The base type system library" +docs_url = "https://docs.gtk.org/gobject/" + +[source-location] +base_url = "https://github.com/apache/arrow/blob/@SOURCE_REFERENCE@/c_glib/arrow-flight-sql-glib" + +[extra] +content_base_url = "https://github.com/apache/arrow/blob/@SOURCE_REFERENCE@/c_glib/doc/" +content_files = [ +] +content_images = [ +] +urlmap_file = "urlmap.js" diff --git a/c_glib/doc/arrow-flight-sql-glib/arrow-flight-sql-glib-docs.xml b/c_glib/doc/arrow-flight-sql-glib/arrow-flight-sql-glib-docs.xml deleted file mode 100644 index f87d657461140..0000000000000 --- a/c_glib/doc/arrow-flight-sql-glib/arrow-flight-sql-glib-docs.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - %gtkdocentities; -]> - - - &package_name; Reference Manual - - for &package_string;. - - - - - - SQL - - - - - - Object Hierarchy - - - - API Index - - - - Index of deprecated API - - - - Index of new symbols in 14.0.0 - - - - Index of new symbols in 13.0.0 - - - - Index of new symbols in 9.0.0 - - - - diff --git a/c_glib/doc/arrow-flight-sql-glib/entities.xml.in b/c_glib/doc/arrow-flight-sql-glib/entities.xml.in deleted file mode 100644 index aa5addb4e8431..0000000000000 --- a/c_glib/doc/arrow-flight-sql-glib/entities.xml.in +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/c_glib/doc/arrow-flight-sql-glib/meson.build b/c_glib/doc/arrow-flight-sql-glib/meson.build deleted file mode 100644 index 46a7cc490595e..0000000000000 --- a/c_glib/doc/arrow-flight-sql-glib/meson.build +++ /dev/null @@ -1,89 +0,0 @@ -# -*- indent-tabs-mode: nil -*- -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -package_id = 'arrow-flight-sql-glib' -package_name = 'Apache Arrow Flight SQL GLib' -entities_conf = configuration_data() -entities_conf.set('PACKAGE', package_id) -entities_conf.set('PACKAGE_BUGREPORT', - 'https://issues.apache.org/jira/browse/ARROW') -entities_conf.set('PACKAGE_NAME', package_name) -entities_conf.set('PACKAGE_STRING', - ' '.join([package_id, version])) -entities_conf.set('PACKAGE_URL', 'https://arrow.apache.org/') -entities_conf.set('PACKAGE_VERSION', version) -configure_file(input: 'entities.xml.in', - output: 'entities.xml', - configuration: entities_conf) - -private_headers = [ -] - -content_files = [ -] - -html_images = [ -] - -glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix') -glib_doc_path = join_paths(glib_prefix, 'share', 'gtk-doc', 'html') -arrow_glib_doc_path = join_paths(data_dir, - 'gtk-doc', - 'html', - 'arrow-glib') -arrow_flight_glib_doc_path = join_paths(data_dir, - 'gtk-doc', - 'html', - 'arrow-flight-glib') -doc_path = join_paths(data_dir, 'gtk-doc', 'html', package_id) - -source_directories = [ - join_paths(meson.source_root(), package_id), - join_paths(meson.build_root(), package_id), -] -dependencies = [ - arrow_glib, - arrow_flight_glib, - arrow_flight_sql_glib, -] -ignore_headers = [] -gnome.gtkdoc(package_id, - main_xml: package_id + '-docs.xml', - src_dir: source_directories, - dependencies: dependencies, - ignore_headers: ignore_headers, - gobject_typesfile: package_id + '.types', - scan_args: [ - '--rebuild-types', - '--deprecated-guards=GARROW_DISABLE_DEPRECATED', - ], - mkdb_args: [ - '--output-format=xml', - '--name-space=gaflightsql', - '--source-suffixes=c,cpp,h', - ], - fixxref_args: [ - '--html-dir=' + doc_path, - '--extra-dir=' + join_paths(glib_doc_path, 'glib'), - '--extra-dir=' + join_paths(glib_doc_path, 'gobject'), - '--extra-dir=' + arrow_glib_doc_path, - '--extra-dir=' + arrow_flight_glib_doc_path, - ], - html_assets: html_images, - install: true) diff --git a/c_glib/doc/arrow-glib.toml.in b/c_glib/doc/arrow-glib.toml.in new file mode 100644 index 0000000000000..28402310d500a --- /dev/null +++ b/c_glib/doc/arrow-glib.toml.in @@ -0,0 +1,87 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[library] +name = "Apache Arrow GLib" +version = "@VERSION@" +browse_url = "https://github.com/apache/arrow/tree/@SOURCE_REFERENCE@/c_glib/arrow-glib/" +repository_url = "https://github.com/apache/arrow.git" +website_url = "https://arrow.apache.org/docs/c_glib/arrow-glib/" +authors = "The Apache Software Foundation" +license = "Apache-2.0" +description = "Apache Arrow GLib API" +dependencies = ["Gio-2.0", "GObject-2.0"] +related = [ + "ArrowCUDA-1.0", + "ArrowData-1.0", + "ArrowFlight-1.0", + "ArrowFlightSQL-1.0", + "Gandiva-1.0", + "Parquet-1.0", +] +search_index = true + +[dependencies."Gio-2.0"] +name = "Gio" +description = "GObject Interfaces and Objects, Networking, IPC, and I/O" +docs_url = "https://docs.gtk.org/gio/" + +[dependencies."GObject-2.0"] +name = "GObject" +description = "The base type system library" +docs_url = "https://docs.gtk.org/gobject/" + +[related."ArrowCUDA-1.0"] +name = "Apache Arrow CUDA GLib" +description = "Apache Arrow CUDA GLib API" +docs_url = "https://arrow.apache.org/docs/c_glib/arrow-cuda-glib/" + +[related."ArrowDataset-1.0"] +name = "Apache Arrow Dataset GLib" +description = "Apache Arrow Dataset GLib API" +docs_url = "https://arrow.apache.org/docs/c_glib/arrow-dataset-glib/" + +[related."ArrowFlight-1.0"] +name = "Apache Arrow Flight GLib" +description = "Apache Arrow Flight GLib API" +docs_url = "https://arrow.apache.org/docs/c_glib/arrow-flight-glib/" + +[related."ArrowFlightSQL-1.0"] +name = "Apache Arrow FlightSQL GLib" +description = "Apache Arrow FlightSQL GLib API" +docs_url = "https://arrow.apache.org/docs/c_glib/arrow-flight-sql-glib/" + +[related."Gandiva-1.0"] +name = "Apache Gandiva GLib" +description = "Apache Gandiva GLib API" +docs_url = "https://arrow.apache.org/docs/c_glib/gandiva-glib/" + +[related."Parquet-1.0"] +name = "Apache Parquet GLib" +description = "Apache Parquet GLib API" +docs_url = "https://arrow.apache.org/docs/c_glib/arrow-parquet-glib/" + +[source-location] +base_url = "https://github.com/apache/arrow/blob/@SOURCE_REFERENCE@/c_glib/arrow-glib" + +[extra] +content_base_url = "https://github.com/apache/arrow/blob/@SOURCE_REFERENCE@/c_glib/doc/" +content_files = [ +] +content_images = [ +] +urlmap_file = "urlmap.js" diff --git a/c_glib/doc/arrow-glib/arrow-glib-docs.xml b/c_glib/doc/arrow-glib/arrow-glib-docs.xml deleted file mode 100644 index e92eb955675ed..0000000000000 --- a/c_glib/doc/arrow-glib/arrow-glib-docs.xml +++ /dev/null @@ -1,313 +0,0 @@ - - - - - %gtkdocentities; -]> - - - &package_name; Reference Manual - - for &package_string;. - - - - - - Data - - Array - - - - - Array builder - - - - Tensor - - - - Value - - - - - Scalar - - - - Type - - - - - - Schema - - - - - Table - - - - - - Table builder - - - - Computation - - - - - - Buffer - - - - Codec - - - - Error - - - - - - File system API - - File system - - - - Local file system - - - - - - IO - - Mode - - - - Input - - - - - Output - - - - - - Input and output - - - - - - IPC - - Metadata - - - - Options - - - - Reader - - - - - Writer - - - - - - GPU - - CUDA - - - - - - Memory - - Memory pool - - - - - - Misc - - Version - - - - - - Object Hierarchy - - - - API Index - - - - Index of deprecated API - - - - Index of new symbols in 16.0.0 - - - - Index of new symbols in 13.0.0 - - - - Index of new symbols in 12.0.0 - - - - Index of new symbols in 11.0.0 - - - - Index of new symbols in 10.0.0 - - - - Index of new symbols in 9.0.0 - - - - Index of new symbols in 8.0.0 - - - - Index of new symbols in 7.0.0 - - - - Index of new symbols in 6.0.0 - - - - Index of new symbols in 5.0.0 - - - - Index of new symbols in 4.0.0 - - - - Index of new symbols in 3.0.0 - - - - Index of new symbols in 2.0.0 - - - - Index of new symbols in 1.0.0 - - - - Index of new symbols in 0.17.0 - - - - Index of new symbols in 0.16.0 - - - - Index of new symbols in 0.15.0 - - - - Index of new symbols in 0.14.0 - - - - Index of new symbols in 0.13.0 - - - - Index of new symbols in 0.12.0 - - - - Index of new symbols in 0.11.0 - - - - Index of new symbols in 0.10.0 - - - - Index of new symbols in 0.9.0 - - - - Index of new symbols in 0.8.0 - - - - Index of new symbols in 0.7.0 - - - - Index of new symbols in 0.6.0 - - - - Index of new symbols in 0.5.0 - - - - Index of new symbols in 0.4.0 - - - - Index of new symbols in 0.3.0 - - - - diff --git a/c_glib/doc/arrow-glib/entities.xml.in b/c_glib/doc/arrow-glib/entities.xml.in deleted file mode 100644 index aa5addb4e8431..0000000000000 --- a/c_glib/doc/arrow-glib/entities.xml.in +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/c_glib/doc/arrow-glib/meson.build b/c_glib/doc/arrow-glib/meson.build deleted file mode 100644 index eeb2fd85dad48..0000000000000 --- a/c_glib/doc/arrow-glib/meson.build +++ /dev/null @@ -1,93 +0,0 @@ -# -*- indent-tabs-mode: nil -*- -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -package_id = meson.project_name() -package_name = 'Apache Arrow GLib' -entities_conf = configuration_data() -entities_conf.set('PACKAGE', package_id) -entities_conf.set('PACKAGE_BUGREPORT', - 'https://issues.apache.org/jira/browse/ARROW') -entities_conf.set('PACKAGE_NAME', package_name) -entities_conf.set('PACKAGE_STRING', - ' '.join([package_name, version])) -entities_conf.set('PACKAGE_URL', 'https://arrow.apache.org/') -entities_conf.set('PACKAGE_VERSION', version) -configure_file(input: 'entities.xml.in', - output: 'entities.xml', - configuration: entities_conf) - -private_headers = [ -] - -content_files = [ -] - -html_images = [ -] - -glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix') -glib_doc_path = join_paths(glib_prefix, 'share', 'gtk-doc', 'html') -doc_path = join_paths(data_dir, 'gtk-doc', 'html', package_id) - -source_directories = [ - join_paths(meson.source_root(), package_id), - join_paths(meson.build_root(), package_id), -] -dependencies = [ - arrow_glib, -] -if arrow_cuda.found() - source_directories += [ - join_paths(meson.source_root(), 'arrow-cuda-glib'), - join_paths(meson.build_root(), 'arrow-cuda-glib'), - ] - dependencies += [ - arrow_cuda_glib, - ] -endif -ignore_headers = [ - join_paths(meson.source_root(), 'arrow-glib', 'gobject-type.h'), -] -if not have_arrow_orc - ignore_headers += [ - join_paths(meson.source_root(), 'arrow-glib', 'orc-file-reader.h'), - ] -endif -gnome.gtkdoc(package_id, - main_xml: package_id + '-docs.xml', - src_dir: source_directories, - dependencies: dependencies, - ignore_headers: ignore_headers, - gobject_typesfile: package_id + '.types', - scan_args: [ - '--rebuild-types', - '--deprecated-guards=GARROW_DISABLE_DEPRECATED', - ], - mkdb_args: [ - '--output-format=xml', - '--name-space=garrow', - '--source-suffixes=c,cpp,h', - ], - fixxref_args: [ - '--html-dir=' + doc_path, - '--extra-dir=' + join_paths(glib_doc_path, 'glib'), - '--extra-dir=' + join_paths(glib_doc_path, 'gobject'), - ], - html_assets: html_images, - install: true) diff --git a/c_glib/doc/gandiva-glib.toml.in b/c_glib/doc/gandiva-glib.toml.in new file mode 100644 index 0000000000000..56bf5b75d7f68 --- /dev/null +++ b/c_glib/doc/gandiva-glib.toml.in @@ -0,0 +1,55 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[library] +name = "Apache Arrow Gandiva GLib" +version = "@VERSION@" +browse_url = "https://github.com/apache/arrow/tree/@SOURCE_REFERENCE@/c_glib/gandiva-glib/" +repository_url = "https://github.com/apache/arrow.git" +website_url = "https://arrow.apache.org/docs/c_glib/gandiva-glib/" +authors = "The Apache Software Foundation" +license = "Apache-2.0" +description = "Apache Arrow Gandiva GLib API" +dependencies = ["Arrow-1.0"] +related = ["Parquet-1.0", "GObject-2.0"] +search_index = true + +[dependencies."Arrow-1.0"] +name = "Arrow" +description = "Apache Arrow GLib API" +docs_url = "https://arrow.apache.org/docs/c_glib/arrow-glib/" + +[related."Parquet-1.0"] +name = "Apache Parquet GLib" +description = "Apache Parquet GLib API" +docs_url = "https://arrow.apache.org/docs/c_glib/arrow-parquet-glib/" + +[related."GObject-2.0"] +name = "GObject" +description = "The base type system library" +docs_url = "https://docs.gtk.org/gobject/" + +[source-location] +base_url = "https://github.com/apache/arrow/blob/@SOURCE_REFERENCE@/c_glib/gandiva-glib" + +[extra] +content_base_url = "https://github.com/apache/arrow/blob/@SOURCE_REFERENCE@/c_glib/doc/" +content_files = [ +] +content_images = [ +] +urlmap_file = "urlmap.js" diff --git a/c_glib/doc/gandiva-glib/entities.xml.in b/c_glib/doc/gandiva-glib/entities.xml.in deleted file mode 100644 index aa5addb4e8431..0000000000000 --- a/c_glib/doc/gandiva-glib/entities.xml.in +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/c_glib/doc/gandiva-glib/gandiva-glib-docs.xml b/c_glib/doc/gandiva-glib/gandiva-glib-docs.xml deleted file mode 100644 index a5c32f11337e8..0000000000000 --- a/c_glib/doc/gandiva-glib/gandiva-glib-docs.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - - %gtkdocentities; -]> - - - &package_name; Reference Manual - - for &package_string;. - - - - - - Evaluate Expression - - Expression - - - - Filter - - - - Selection vector - - - - Projector - - - - - - Expression Tree - - Node - - - - - - Function - - Registry - - - - Signature - - - - Native function - - - - - - Misc - - Version - - - - - - Object Hierarchy - - - - API Index - - - - Index of deprecated API - - - - Index of new symbols in 15.0.0 - - - - Index of new symbols in 4.0.0 - - - - Index of new symbols in 1.0.0 - - - - Index of new symbols in 0.17.0 - - - - Index of new symbols in 0.15.0 - - - - Index of new symbols in 0.14.0 - - - - Index of new symbols in 0.12.0 - - - - diff --git a/c_glib/doc/gandiva-glib/meson.build b/c_glib/doc/gandiva-glib/meson.build deleted file mode 100644 index 7ff815f42a17a..0000000000000 --- a/c_glib/doc/gandiva-glib/meson.build +++ /dev/null @@ -1,83 +0,0 @@ -# -*- indent-tabs-mode: nil -*- -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -package_id = 'gandiva-glib' -package_name = 'Gandiva GLib' -entities_conf = configuration_data() -entities_conf.set('PACKAGE', package_id) -entities_conf.set('PACKAGE_BUGREPORT', - 'https://issues.apache.org/jira/browse/ARROW') -entities_conf.set('PACKAGE_NAME', package_name) -entities_conf.set('PACKAGE_STRING', - ' '.join([package_name, version])) -entities_conf.set('PACKAGE_URL', 'https://arrow.apache.org/') -entities_conf.set('PACKAGE_VERSION', version) -configure_file(input: 'entities.xml.in', - output: 'entities.xml', - configuration: entities_conf) - -private_headers = [ -] - -content_files = [ -] - -html_images = [ -] - -glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix') -glib_doc_path = join_paths(glib_prefix, 'share', 'gtk-doc', 'html') -arrow_glib_doc_path = join_paths(data_dir, - 'gtk-doc', - 'html', - 'arrow-glib') -doc_path = join_paths(data_dir, 'gtk-doc', 'html', package_id) - -source_directories = [ - join_paths(meson.source_root(), package_id), - join_paths(meson.build_root(), package_id), -] -dependencies = [ - arrow_glib, - gandiva_glib, -] -ignore_headers = [] -gnome.gtkdoc(package_id, - main_xml: package_id + '-docs.xml', - src_dir: source_directories, - dependencies: dependencies, - ignore_headers: ignore_headers, - gobject_typesfile: package_id + '.types', - scan_args: [ - '--rebuild-types', - '--deprecated-guards=GGANDIVA_DISABLE_DEPRECATED', - ], - mkdb_args: [ - '--output-format=xml', - '--name-space=ggandiva', - '--source-suffixes=c,cpp,h', - ], - fixxref_args: [ - '--html-dir=' + doc_path, - '--extra-dir=' + join_paths(glib_doc_path, 'glib'), - '--extra-dir=' + join_paths(glib_doc_path, 'gobject'), - '--extra-dir=' + arrow_glib_doc_path, - ], - html_assets: html_images, - install: true) diff --git a/c_glib/doc/meson.build b/c_glib/doc/meson.build new file mode 100644 index 0000000000000..8d0ac4229b2a6 --- /dev/null +++ b/c_glib/doc/meson.build @@ -0,0 +1,93 @@ +# -*- indent-tabs-mode: nil -*- +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +source_reference = get_option('source_reference') +gi_docgen = find_program('gi-docgen') + +gi_docgen_toml_conf = configuration_data() +gi_docgen_toml_conf.set('SOURCE_REFERENCE', source_reference) +# We can't use "version.replace('-SNAPSHOT', '.dev')" here because +# Ubuntu 20.04's Meson is < 0.58.0. +if version_tag == '' + gi_docgen_version_tag = '' +else + # GI-DocGen doesn't like MAJOR.MINOR.PATCH-SNAPSHOT format. + gi_docgen_version_tag = '.dev' +endif +gi_docgen_version = '@0@.@1@.@2@@3@'.format(version_major, + version_minor, + version_micro, + gi_docgen_version_tag) +gi_docgen_toml_conf.set('VERSION', gi_docgen_version) + +gir_top_build_dir = meson.current_build_dir() / '..' +arrow_glib_gir_dir = gir_top_build_dir / 'arrow-glib' +arrow_flight_glib_gir_dir = gir_top_build_dir / 'arrow-flight-glib' +entries = [['arrow-glib', arrow_glib_gir[0]]] +if arrow_cuda.found() + entries += [['arrow-cuda-glib', arrow_cuda_glib_gir[0]]] +endif +if arrow_dataset.found() + entries += [['arrow-dataset-glib', arrow_dataset_glib_gir[0]]] +endif +if arrow_flight.found() + entries += [['arrow-flight-glib', arrow_flight_glib_gir[0]]] +endif +if arrow_flight_sql.found() + entries += [['arrow-flight-sql-glib', arrow_flight_sql_glib_gir[0]]] +endif +if gandiva.found() + entries += [['gandiva-glib', gandiva_glib_gir[0]]] +endif +if parquet.found() + entries += [['parquet-glib', parquet_glib_gir[0]]] +endif +foreach entry : entries + module_name = entry[0] + gir = entry[1] + gi_docgen_toml = configure_file(input: '@0@.toml.in'.format(module_name), + output: '@0@.toml'.format(module_name), + configuration: gi_docgen_toml_conf) + gir_dir = gir_top_build_dir / module_name + current_source_dir = meson.current_source_dir() + command = [ + gi_docgen, + 'generate', + '--add-include-path=@0@'.format(arrow_flight_glib_gir_dir), + '--add-include-path=@0@'.format(arrow_glib_gir_dir), + '--add-include-path=@0@'.format(gir_dir), + '--config=@INPUT0@', + '--content-dir=@0@'.format(current_source_dir), + '--no-namespace-dir', + '--output-dir=@OUTPUT@', + '--quiet', + ] + if get_option('werror') + command += ['--fatal-warnings'] + endif + command += ['@INPUT1@'] + custom_target('@0@-doc'.format(module_name), + input: [gi_docgen_toml, gir], + depend_files: ['urlmap.js'], + output: module_name, + command: command, + build_by_default: true, + install: true, + install_dir: doc_dir) +endforeach diff --git a/c_glib/doc/parquet-glib.toml.in b/c_glib/doc/parquet-glib.toml.in new file mode 100644 index 0000000000000..119ed0b563414 --- /dev/null +++ b/c_glib/doc/parquet-glib.toml.in @@ -0,0 +1,55 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[library] +name = "Apache Parquet GLib" +version = "@VERSION@" +browse_url = "https://github.com/apache/arrow/tree/@SOURCE_REFERENCE@/c_glib/parquet-glib/" +repository_url = "https://github.com/apache/arrow.git" +website_url = "https://arrow.apache.org/docs/c_glib/parquet-glib/" +authors = "The Apache Software Foundation" +license = "Apache-2.0" +description = "Apache Parquet GLib API" +dependencies = ["Arrow-1.0"] +related = ["Gio-2.0", "GObject-2.0"] +search_index = true + +[dependencies."Arrow-1.0"] +name = "Arrow" +description = "Apache Arrow GLib API" +docs_url = "https://arrow.apache.org/docs/c_glib/arrow-glib/" + +[related."Gio-2.0"] +name = "GIO" +description = "GObject Interfaces and Objects, Networking, IPC, and I/O" +docs_url = "https://docs.gtk.org/gio/" + +[related."GObject-2.0"] +name = "GObject" +description = "The base type system library" +docs_url = "https://docs.gtk.org/gobject/" + +[source-location] +base_url = "https://github.com/apache/arrow/blob/@SOURCE_REFERENCE@/c_glib/parquet-glib" + +[extra] +content_base_url = "https://github.com/apache/arrow/blob/@SOURCE_REFERENCE@/c_glib/doc/" +content_files = [ +] +content_images = [ +] +urlmap_file = "urlmap.js" diff --git a/c_glib/doc/parquet-glib/entities.xml.in b/c_glib/doc/parquet-glib/entities.xml.in deleted file mode 100644 index aa5addb4e8431..0000000000000 --- a/c_glib/doc/parquet-glib/entities.xml.in +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/c_glib/doc/parquet-glib/meson.build b/c_glib/doc/parquet-glib/meson.build deleted file mode 100644 index f4ee794d05a1a..0000000000000 --- a/c_glib/doc/parquet-glib/meson.build +++ /dev/null @@ -1,83 +0,0 @@ -# -*- indent-tabs-mode: nil -*- -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -package_id = 'parquet-glib' -package_name = 'Apache Parquet GLib' -entities_conf = configuration_data() -entities_conf.set('PACKAGE', package_id) -entities_conf.set('PACKAGE_BUGREPORT', - 'https://issues.apache.org/jira/browse/PARQUET') -entities_conf.set('PACKAGE_NAME', package_name) -entities_conf.set('PACKAGE_STRING', - ' '.join([package_name, version])) -entities_conf.set('PACKAGE_URL', 'https://arrow.apache.org/') -entities_conf.set('PACKAGE_VERSION', version) -configure_file(input: 'entities.xml.in', - output: 'entities.xml', - configuration: entities_conf) - -private_headers = [ -] - -content_files = [ -] - -html_images = [ -] - -glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix') -glib_doc_path = join_paths(glib_prefix, 'share', 'gtk-doc', 'html') -arrow_glib_doc_path = join_paths(data_dir, - 'gtk-doc', - 'html', - 'arrow-glib') -doc_path = join_paths(data_dir, 'gtk-doc', 'html', package_id) - -source_directories = [ - join_paths(meson.source_root(), package_id), - join_paths(meson.build_root(), package_id), -] -dependencies = [ - parquet_glib, - arrow_glib, -] -ignore_headers = [] -gnome.gtkdoc(package_id, - main_xml: package_id + '-docs.xml', - src_dir: source_directories, - dependencies: dependencies, - ignore_headers: ignore_headers, - gobject_typesfile: package_id + '.types', - scan_args: [ - '--rebuild-types', - '--deprecated-guards=GARROW_DISABLE_DEPRECATED', - ], - mkdb_args: [ - '--output-format=xml', - '--name-space=gparquet', - '--source-suffixes=c,cpp,h', - ], - fixxref_args: [ - '--html-dir=' + doc_path, - '--extra-dir=' + join_paths(glib_doc_path, 'glib'), - '--extra-dir=' + join_paths(glib_doc_path, 'gobject'), - '--extra-dir=' + arrow_glib_doc_path, - ], - html_assets: html_images, - install: true) diff --git a/c_glib/doc/parquet-glib/parquet-glib-docs.xml b/c_glib/doc/parquet-glib/parquet-glib-docs.xml deleted file mode 100644 index 05cfb74b64b4f..0000000000000 --- a/c_glib/doc/parquet-glib/parquet-glib-docs.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - %gtkdocentities; -]> - - - &package_name; Reference Manual - - for &package_string;. - - - - - - Arrow - - IO - - - - - - - Data - - Meta - - - - - - - Object Hierarchy - - - - API Index - - - - Index of deprecated API - - - - Index of new symbols in 8.0.0 - - - - Index of new symbols in 6.0.0 - - - - Index of new symbols in 1.0.0 - - - - Index of new symbols in 0.17.0 - - - - Index of new symbols in 0.15.0 - - - - Index of new symbols in 0.12.0 - - - - Index of new symbols in 0.11.0 - - - - diff --git a/c_glib/doc/urlmap.js b/c_glib/doc/urlmap.js new file mode 100644 index 0000000000000..4760a3ab04c05 --- /dev/null +++ b/c_glib/doc/urlmap.js @@ -0,0 +1,29 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +baseURLs = [ + ["Arrow", "https://arrow.apache.org/docs/c_glib/arrow-glib/"], + ["ArrowCUDA", "https://arrow.apache.org/docs/c_glib/arrow-cuda-glib/"], + ["ArrowDataset", "https://arrow.apache.org/docs/c_glib/arrow-dataset-glib/"], + ["ArrowFlight", "https://arrow.apache.org/docs/c_glib/arrow-flight-glib/"], + ["ArrowFlightSQL", "https://arrow.apache.org/docs/c_glib/arrow-flight-sql-glib/"], + ["GIO", "https://docs.gtk.org/gio/"], + ["GLib", "https://docs.gtk.org/glib/"], + ["GObject", "https://docs.gtk.org/gobject/"], + ["Gandiva", "https://arrow.apache.org/docs/c_glib/gandiva-glib/"], + ["Parquet", "https://arrow.apache.org/docs/c_glib/parquet-glib/"], +] diff --git a/c_glib/example/vala/meson.build b/c_glib/example/vala/meson.build index 42e40f692a25a..474f0b1e9a51a 100644 --- a/c_glib/example/vala/meson.build +++ b/c_glib/example/vala/meson.build @@ -20,8 +20,8 @@ if generate_vapi vala_example_executable_kwargs = { 'c_args': [ - '-I' + meson.build_root(), - '-I' + meson.source_root(), + '-I' + project_build_root, + '-I' + project_source_root, ], 'dependencies': [ arrow_glib_vapi, diff --git a/c_glib/gandiva-glib/meson.build b/c_glib/gandiva-glib/meson.build index 52729f64da007..d5cab109dcf89 100644 --- a/c_glib/gandiva-glib/meson.build +++ b/c_glib/gandiva-glib/meson.build @@ -111,15 +111,13 @@ if have_gi '--warn-all', '--include-uninstalled=./arrow-glib/Arrow-1.0.gir', ], - fatal_warnings: gi_fatal_warnings, header: 'gandiva-glib/gandiva-glib.h', identifier_prefix: 'GGandiva', includes: [ 'Arrow-1.0' ], - install: true, + kwargs: generate_gi_common_args, namespace: 'Gandiva', - nsversion: api_version, sources: sources + c_headers + enums, symbol_prefix: 'ggandiva') diff --git a/c_glib/meson.build b/c_glib/meson.build index ffd41d4d574a7..04d0129855b20 100644 --- a/c_glib/meson.build +++ b/c_glib/meson.build @@ -18,11 +18,24 @@ # under the License. project('arrow-glib', 'c', 'cpp', - license: 'Apache-2.0', default_options: [ 'c_std=c99', 'cpp_std=c++17', - ]) + ], + license: 'Apache-2.0', + # Debian: + # https://packages.debian.org/search?keywords=meson + # + # * bullseye: 0.56.2 + # * bullseye-backports:1.0.0 + # * bookworm: 1.0.0 + # + # Ubuntu: + # https://packages.ubuntu.com/search?keywords=meson + # + # * 20.04: 0.53.2 + # * 22.04: 0.61.2 + meson_version: '>=0.53.2') version = '16.0.0-SNAPSHOT' if version.endswith('-SNAPSHOT') @@ -41,9 +54,18 @@ so_version = version_major * 100 + version_minor so_version_patch = version_micro library_version = '@0@.@1@.@2@'.format(so_version, so_version_patch, 0) +if meson.version().version_compare('>=0.56.0') + project_build_root = meson.project_build_root() + project_source_root = meson.project_source_root() +else + project_build_root = meson.build_root() + project_source_root = meson.source_root() +endif + prefix = get_option('prefix') include_dir = join_paths(prefix, get_option('includedir')) data_dir = join_paths(prefix, get_option('datadir')) +doc_dir = join_paths(data_dir, 'doc') gir_dir = join_paths(data_dir, 'gir-1.0') vapi_dir = join_paths(data_dir, 'vala', 'vapi') @@ -55,7 +77,13 @@ base_include_directories = [ include_directories('.') ] -gi_fatal_warnings = (build_machine.system() != 'windows') +generate_gi_common_args = { + 'install': true, + 'nsversion': api_version, +} +if get_option('werror') and meson.version().version_compare('>=0.55.0') + generate_gi_common_args += {'fatal_warnings': true} +endif have_gi = dependency('gobject-introspection-1.0', required: false).found() if have_gi pkgconfig_variables += ['girdir=@0@'.format(gir_dir)] @@ -71,7 +99,7 @@ arrow_cpp_build_type = get_option('arrow_cpp_build_type') if arrow_cpp_build_dir == '' arrow_cpp_build_lib_dir = '' else - arrow_cpp_build_lib_dir = join_paths(meson.source_root(), + arrow_cpp_build_lib_dir = join_paths(project_source_root, arrow_cpp_build_dir, arrow_cpp_build_type.to_lower()) endif @@ -166,36 +194,23 @@ if parquet.found() endif subdir('example') -if get_option('gtk_doc') - subdir('doc/arrow-glib') - if arrow_dataset.found() - subdir('doc/arrow-dataset-glib') - endif - if arrow_flight.found() - subdir('doc/arrow-flight-glib') - endif - if arrow_flight_sql.found() - subdir('doc/arrow-flight-sql-glib') - endif - if gandiva.found() - subdir('doc/gandiva-glib') - endif - if parquet.found() - subdir('doc/parquet-glib') - endif +if get_option('doc') + subdir('doc') endif install_data('../LICENSE.txt', 'README.md', - install_dir: join_paths(data_dir, 'doc', meson.project_name())) + install_dir: data_dir / meson.project_name()) run_test = find_program('test/run-test.sh') test('unit test', run_test, env: [ - 'ARROW_GLIB_TYPELIB_DIR=@0@/arrow-glib'.format(meson.build_root()), - 'ARROW_CUDA_GLIB_TYPELIB_DIR=@0@/arrow-cuda-glib'.format(meson.build_root()), - 'ARROW_DATASET_GLIB_TYPELIB_DIR=@0@/arrow-dataset-glib'.format(meson.build_root()), - 'GANDIVA_GLIB_TYPELIB_DIR=@0@/gandiva-glib'.format(meson.build_root()), - 'PARQUET_GLIB_TYPELIB_DIR=@0@/parquet-glib'.format(meson.build_root()), + 'ARROW_CUDA_GLIB_TYPELIB_DIR=@0@/arrow-cuda-glib'.format(project_build_root), + 'ARROW_DATASET_GLIB_TYPELIB_DIR=@0@/arrow-dataset-glib'.format(project_build_root), + 'ARROW_FLIGHT_GLIB_TYPELIB_DIR=@0@/arrow-flight-glib'.format(project_build_root), + 'ARROW_FLIGHT_SQL_GLIB_TYPELIB_DIR=@0@/arrow-flight-sql-glib'.format(project_build_root), + 'ARROW_GLIB_TYPELIB_DIR=@0@/arrow-glib'.format(project_build_root), + 'GANDIVA_GLIB_TYPELIB_DIR=@0@/gandiva-glib'.format(project_build_root), + 'PARQUET_GLIB_TYPELIB_DIR=@0@/parquet-glib'.format(project_build_root), ]) diff --git a/c_glib/meson_options.txt b/c_glib/meson_options.txt index 6631fccf2d73e..e2aa74872d9e7 100644 --- a/c_glib/meson_options.txt +++ b/c_glib/meson_options.txt @@ -27,10 +27,22 @@ option('arrow_cpp_build_type', value: 'release', description: '-DCMAKE_BUILD_TYPE option value for Arrow C++') +option('doc', + type: 'boolean', + value: false, + description: 'Build document') + option('gtk_doc', type: 'boolean', value: false, - description: 'Build document by GTK-Doc') + # This requires Meson 0.63.0 or later + # deprecated: 'doc', + description: 'Build document') + +option('source_reference', + type: 'string', + value: 'main', + description: 'Source reference (revision/branch/tag/...) to refer source URL in documents generated by GI-DocGen') option('vapi', type: 'boolean', diff --git a/c_glib/parquet-glib/meson.build b/c_glib/parquet-glib/meson.build index 08288484bf9b4..67de0bf2d91fb 100644 --- a/c_glib/parquet-glib/meson.build +++ b/c_glib/parquet-glib/meson.build @@ -80,15 +80,13 @@ if have_gi '--warn-all', '--include-uninstalled=./arrow-glib/Arrow-1.0.gir', ], - fatal_warnings: gi_fatal_warnings, header: 'parquet-glib/parquet-glib.h', identifier_prefix: 'GParquet', includes: [ 'Arrow-1.0', ], - install: true, + kwargs: generate_gi_common_args, namespace: 'Parquet', - nsversion: api_version, sources: sources + c_headers, symbol_prefix: 'gparquet') diff --git a/ci/docker/linux-apt-c-glib.dockerfile b/ci/docker/linux-apt-c-glib.dockerfile index dd2e2ac438220..b89301bedafe4 100644 --- a/ci/docker/linux-apt-c-glib.dockerfile +++ b/ci/docker/linux-apt-c-glib.dockerfile @@ -20,7 +20,7 @@ FROM ${base} RUN apt-get update -y -q && \ apt-get install -y -q \ - gtk-doc-tools \ + gi-docgen \ libgirepository1.0-dev \ libglib2.0-doc \ lsb-release \ diff --git a/ci/docker/linux-apt-docs.dockerfile b/ci/docker/linux-apt-docs.dockerfile index 3d102796b8c00..93412ca81cdd5 100644 --- a/ci/docker/linux-apt-docs.dockerfile +++ b/ci/docker/linux-apt-docs.dockerfile @@ -35,8 +35,8 @@ RUN apt-get update -y && \ automake \ curl \ doxygen \ + gi-docgen \ gobject-introspection \ - gtk-doc-tools \ libcurl4-openssl-dev \ libfontconfig1-dev \ libfribidi-dev \ diff --git a/ci/scripts/c_glib_build.sh b/ci/scripts/c_glib_build.sh index 6e3e33afb150a..c4d2c4fdb5617 100755 --- a/ci/scripts/c_glib_build.sh +++ b/ci/scripts/c_glib_build.sh @@ -26,7 +26,7 @@ build_root=${2} : ${ARROW_GLIB_WERROR:=false} : ${ARROW_GLIB_VAPI:=true} : ${BUILD_DOCS_C_GLIB:=OFF} -with_gtk_doc=$([ "${BUILD_DOCS_C_GLIB}" == "ON" ] && echo "true" || echo "false") +with_doc=$([ "${BUILD_DOCS_C_GLIB}" == "ON" ] && echo "true" || echo "false") export PKG_CONFIG_PATH=${ARROW_HOME}/lib/pkgconfig @@ -39,7 +39,7 @@ mkdir -p ${build_dir} meson setup \ --prefix=$ARROW_HOME \ --libdir=lib \ - -Dgtk_doc=${with_gtk_doc} \ + -Ddoc=${with_doc} \ -Dvapi=${ARROW_GLIB_VAPI} \ -Dwerror=${ARROW_GLIB_WERROR} \ ${build_dir} \ @@ -52,5 +52,5 @@ popd if [ "${BUILD_DOCS_C_GLIB}" == "ON" ]; then mkdir -p ${build_root}/docs/c_glib - rsync -a ${ARROW_HOME}/share/gtk-doc/html/ ${build_root}/docs/c_glib + cp -a ${ARROW_HOME}/share/doc/*-glib/ ${build_root}/docs/c_glib/ fi diff --git a/ci/scripts/msys2_setup.sh b/ci/scripts/msys2_setup.sh index 8bd36328ec607..155522342eb9f 100755 --- a/ci/scripts/msys2_setup.sh +++ b/ci/scripts/msys2_setup.sh @@ -68,7 +68,6 @@ esac case "${target}" in c_glib|ruby) packages+=(${MINGW_PACKAGE_PREFIX}-gobject-introspection) - packages+=(${MINGW_PACKAGE_PREFIX}-gtk-doc) packages+=(${MINGW_PACKAGE_PREFIX}-meson) packages+=(${MINGW_PACKAGE_PREFIX}-vala) ;; diff --git a/dev/tasks/linux-packages/apache-arrow/apt/debian-bookworm/Dockerfile b/dev/tasks/linux-packages/apache-arrow/apt/debian-bookworm/Dockerfile index 762bc909e1cc9..f7aa57848bd36 100644 --- a/dev/tasks/linux-packages/apache-arrow/apt/debian-bookworm/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/apt/debian-bookworm/Dockerfile @@ -42,8 +42,8 @@ RUN \ cmake \ debhelper \ devscripts \ + gi-docgen \ git \ - gtk-doc-tools \ libboost-filesystem-dev \ libboost-system-dev \ libbrotli-dev \ diff --git a/dev/tasks/linux-packages/apache-arrow/apt/debian-bullseye/Dockerfile b/dev/tasks/linux-packages/apache-arrow/apt/debian-bullseye/Dockerfile index 86cea77c14527..2edcd4d5ed216 100644 --- a/dev/tasks/linux-packages/apache-arrow/apt/debian-bullseye/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/apt/debian-bullseye/Dockerfile @@ -22,6 +22,10 @@ RUN \ echo "debconf debconf/frontend select Noninteractive" | \ debconf-set-selections +RUN \ + echo "deb http://deb.debian.org/debian bullseye-backports main" > \ + /etc/apt/sources.list.d/backports.list + RUN \ echo 'APT::Install-Recommends "false";' > \ /etc/apt/apt.conf.d/disable-install-recommends @@ -39,7 +43,6 @@ RUN \ debhelper \ devscripts \ git \ - gtk-doc-tools \ libboost-filesystem-dev \ libboost-system-dev \ libbrotli-dev \ @@ -63,7 +66,6 @@ RUN \ libzstd-dev \ llvm-dev \ lsb-release \ - meson \ ninja-build \ nlohmann-json3-dev \ pkg-config \ @@ -77,5 +79,9 @@ RUN \ if apt list | grep '^nvidia-cuda-toolkit/'; then \ apt install -y -V ${quiet} nvidia-cuda-toolkit; \ fi && \ + apt install -y -V -t bullseye-backports ${quiet} \ + meson && \ + pip3 install gi-docgen && \ + ln -fs /usr/local/bin/gi-docgen /usr/bin && \ apt clean && \ rm -rf /var/lib/apt/lists/* diff --git a/dev/tasks/linux-packages/apache-arrow/apt/debian-trixie/Dockerfile b/dev/tasks/linux-packages/apache-arrow/apt/debian-trixie/Dockerfile index 70289e9af7ea0..8a6accbfc8b16 100644 --- a/dev/tasks/linux-packages/apache-arrow/apt/debian-trixie/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/apt/debian-trixie/Dockerfile @@ -43,8 +43,8 @@ RUN \ cmake \ debhelper \ devscripts \ + gi-docgen \ git \ - gtk-doc-tools \ libboost-filesystem-dev \ libboost-system-dev \ libbrotli-dev \ diff --git a/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-focal/Dockerfile b/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-focal/Dockerfile index 63bafe11fe8e8..fdd0362680c5a 100644 --- a/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-focal/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-focal/Dockerfile @@ -37,7 +37,6 @@ RUN \ debhelper \ devscripts \ git \ - gtk-doc-tools \ libboost-filesystem-dev \ libboost-system-dev \ libbrotli-dev \ @@ -75,5 +74,7 @@ RUN \ if apt list | grep '^nvidia-cuda-toolkit/'; then \ apt install -y -V ${quiet} nvidia-cuda-toolkit; \ fi && \ + pip3 install gi-docgen && \ + ln -fs /usr/local/bin/gi-docgen /usr/bin && \ apt clean && \ rm -rf /var/lib/apt/lists/* diff --git a/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-jammy/Dockerfile b/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-jammy/Dockerfile index bbae48b0f2b3b..ad3db51252f87 100644 --- a/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-jammy/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-jammy/Dockerfile @@ -36,8 +36,8 @@ RUN \ cmake \ debhelper \ devscripts \ + gi-docgen \ git \ - gtk-doc-tools \ libboost-filesystem-dev \ libboost-system-dev \ libbrotli-dev \ diff --git a/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-noble/Dockerfile b/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-noble/Dockerfile index 33f2d9a35371b..386be00c37ed7 100644 --- a/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-noble/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-noble/Dockerfile @@ -37,8 +37,8 @@ RUN \ cmake \ debhelper \ devscripts \ + gi-docgen \ git \ - gtk-doc-tools \ libboost-filesystem-dev \ libboost-system-dev \ libbrotli-dev \ diff --git a/dev/tasks/linux-packages/apache-arrow/debian/control.in b/dev/tasks/linux-packages/apache-arrow/debian/control.in index 5b8de89dcd67e..5258fa97f4b74 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/control.in +++ b/dev/tasks/linux-packages/apache-arrow/debian/control.in @@ -5,9 +5,10 @@ Maintainer: Apache Arrow Developers Build-Depends: cmake, debhelper (>= 12), +# TODO: Enable this after we drop support for Ubuntu 20.04. +# gi-docgen, git, gobject-introspection, - gtk-doc-tools, libboost-filesystem-dev, libboost-system-dev, libbrotli-dev, diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dataset-glib-doc.doc-base b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dataset-glib-doc.doc-base index 5ec8156b05d6c..9ce1079019553 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dataset-glib-doc.doc-base +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dataset-glib-doc.doc-base @@ -5,5 +5,5 @@ Abstract: Apache Arrow Dataset GLib provides an API to read and write semantic d Section: Programming Format: HTML -Index: /usr/share/gtk-doc/html/arrow-dataset-glib/index.html -Files: /usr/share/gtk-doc/html/arrow-dataset-glib/*.html +Index: /usr/share/doc/libarrow-dataset-glib-doc/arrow-dataset-glib/index.html +Files: /usr/share/doc/libarrow-dataset-glib-doc/arrow-dataset-glib/*.html diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dataset-glib-doc.install b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dataset-glib-doc.install index 523bc206e1e03..4d8e3e11942d9 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dataset-glib-doc.install +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dataset-glib-doc.install @@ -1 +1 @@ -usr/share/gtk-doc/html/arrow-dataset-glib +usr/share/doc/arrow-dataset-glib usr/share/doc/libarrow-dataset-glib-doc/ diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dataset-glib-doc.links b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dataset-glib-doc.links index 3d880362b5e9f..a7dd825ecac69 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dataset-glib-doc.links +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-dataset-glib-doc.links @@ -1,3 +1,5 @@ -usr/share/gtk-doc/html/arrow-dataset-glib usr/share/doc/libarrow-dataset-glib-doc/arrow-dataset-glib +usr/share/doc/libarrow-dataset-glib-doc/arrow-dataset-glib usr/share/devhelp/books/arrow-dataset-glib +usr/share/doc/libarrow-glib-doc/arrow-glib usr/share/doc/libarrow-dataset-glib-doc/arrow-glib +usr/share/doc/libglib2.0-doc/gio usr/share/doc/libarrow-dataset-glib-doc/gio usr/share/doc/libglib2.0-doc/glib usr/share/doc/libarrow-dataset-glib-doc/glib usr/share/doc/libglib2.0-doc/gobject usr/share/doc/libarrow-dataset-glib-doc/gobject diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-glib-doc.doc-base b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-glib-doc.doc-base index 94b17c11b9d04..f2fd6f6bfef81 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-glib-doc.doc-base +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-glib-doc.doc-base @@ -5,5 +5,5 @@ Abstract: Apache Arrow Flight GLib provides a general-purpose client-server fram Section: Programming Format: HTML -Index: /usr/share/gtk-doc/html/arrow-flight-glib/index.html -Files: /usr/share/gtk-doc/html/arrow-flight-glib/*.html +Index: /usr/share/doc/libarrow-flight-glib-doc/arrow-flight-glib/index.html +Files: /usr/share/doc/libarrow-flight-glib-doc/arrow-flight-glib/*.html diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-glib-doc.install b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-glib-doc.install index 3c95f17ed771a..432b0f0b5d296 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-glib-doc.install +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-glib-doc.install @@ -1 +1 @@ -usr/share/gtk-doc/html/arrow-flight-glib +usr/share/doc/arrow-flight-glib usr/share/doc/libarrow-flight-glib-doc/ diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-glib-doc.links b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-glib-doc.links index d55c89a1b0809..5f9a15fc03db0 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-glib-doc.links +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-glib-doc.links @@ -1,3 +1,5 @@ -usr/share/gtk-doc/html/arrow-flight-glib usr/share/doc/libarrow-flight-glib-doc/arrow-flight-glib +usr/share/doc/libarrow-flight-glib-doc/arrow-flight-glib usr/share/devhelp/books/arrow-flight-glib +usr/share/doc/libarrow-glib-doc/arrow-glib usr/share/doc/libarrow-flight-glib-doc/arrow-glib +usr/share/doc/libglib2.0-doc/gio usr/share/doc/libarrow-flight-glib-doc/gio usr/share/doc/libglib2.0-doc/glib usr/share/doc/libarrow-flight-glib-doc/glib usr/share/doc/libglib2.0-doc/gobject usr/share/doc/libarrow-flight-glib-doc/gobject diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-sql-glib-doc.doc-base b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-sql-glib-doc.doc-base index 5569fa83ed5c5..60a8f18ddcfbd 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-sql-glib-doc.doc-base +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-sql-glib-doc.doc-base @@ -5,5 +5,5 @@ Abstract: Apache Arrow Flight SQL GLib provides a client-server framework to int Section: Programming Format: HTML -Index: /usr/share/gtk-doc/html/arrow-flight-sql-glib/index.html -Files: /usr/share/gtk-doc/html/arrow-flight-sql-glib/*.html +Index: /usr/share/doc/libarrow-flight-sql-glib-doc/arrow-flight-sql-glib/index.html +Files: /usr/share/doc/libarrow-flight-sql-glib-doc/arrow-flight-sql-glib/*.html diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-sql-glib-doc.install b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-sql-glib-doc.install index c069c0c67d80d..e1187d1a2c611 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-sql-glib-doc.install +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-sql-glib-doc.install @@ -1 +1 @@ -usr/share/gtk-doc/html/arrow-flight-sql-glib +usr/share/doc/arrow-flight-sql-glib usr/share/doc/libarrow-flight-sql-glib-doc/ diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-sql-glib-doc.links b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-sql-glib-doc.links index 96c26e3664d80..1555a20a71002 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-sql-glib-doc.links +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-flight-sql-glib-doc.links @@ -1,5 +1,6 @@ +usr/share/doc/libarrow-flight-glib-doc/arrow-glib usr/share/doc/libarrow-flight-sql-glib-doc/arrow-flight-glib +usr/share/doc/libarrow-flight-sql-glib-doc/arrow-flight-sql-glib usr/share/devhelp/books/arrow-flight-sql-glib +usr/share/doc/libarrow-glib-doc/arrow-glib usr/share/doc/libarrow-flight-sql-glib-doc/arrow-glib +usr/share/doc/libglib2.0-doc/gio usr/share/doc/libarrow-flight-sql-glib-doc/gio usr/share/doc/libglib2.0-doc/glib usr/share/doc/libarrow-flight-sql-glib-doc/glib usr/share/doc/libglib2.0-doc/gobject usr/share/doc/libarrow-flight-sql-glib-doc/gobject -usr/share/gtk-doc/html/arrow-flight-glib usr/share/doc/libarrow-flight-glib-doc/arrow-flight-glib -usr/share/gtk-doc/html/arrow-flight-sql-glib usr/share/doc/libarrow-flight-glib-doc/arrow-flight-sql-glib -usr/share/gtk-doc/html/arrow-glib usr/share/doc/libarrow-flight-glib-doc/arrow-glib diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-glib-doc.doc-base b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-glib-doc.doc-base index 8ae4ffb6ddaa5..4f0c5acc22240 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-glib-doc.doc-base +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-glib-doc.doc-base @@ -5,5 +5,5 @@ Abstract: Apache Arrow GLib is a data processing library for analysis that uses Section: Programming Format: HTML -Index: /usr/share/gtk-doc/html/arrow-glib/index.html -Files: /usr/share/gtk-doc/html/arrow-glib/*.html +Index: /usr/share/doc/libarrow-glib-doc/arrow-glib/index.html +Files: /usr/share/doc/libarrow-glib-doc/arrow-glib/*.html diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-glib-doc.install b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-glib-doc.install index 912a29c585084..f6d4e3cd9d82b 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-glib-doc.install +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-glib-doc.install @@ -1,2 +1,3 @@ -usr/share/doc/arrow-glib/ -usr/share/gtk-doc/html/arrow-glib +usr/share/arrow-glib/*.md +usr/share/arrow-glib/*.txt +usr/share/doc/arrow-glib usr/share/doc/libarrow-glib-doc/ diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-glib-doc.links b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-glib-doc.links index 556987d0a8065..10689c01e0abc 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-glib-doc.links +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-glib-doc.links @@ -1,3 +1,4 @@ -usr/share/gtk-doc/html/arrow-glib usr/share/doc/libarrow-glib-doc/arrow-glib +usr/share/doc/libarrow-glib-doc/arrow-glib usr/share/devhelp/books/arrow-glib +usr/share/doc/libglib2.0-doc/gio usr/share/doc/libarrow-glib-doc/gio usr/share/doc/libglib2.0-doc/glib usr/share/doc/libarrow-glib-doc/glib usr/share/doc/libglib2.0-doc/gobject usr/share/doc/libarrow-glib-doc/gobject diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libgandiva-glib-doc.doc-base b/dev/tasks/linux-packages/apache-arrow/debian/libgandiva-glib-doc.doc-base index 2bf913062fb8c..24b1cb83b04d9 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libgandiva-glib-doc.doc-base +++ b/dev/tasks/linux-packages/apache-arrow/debian/libgandiva-glib-doc.doc-base @@ -5,5 +5,5 @@ Abstract: Gandiva GLib is a toolset for compiling and evaluating expressions on Section: Programming Format: HTML -Index: /usr/share/gtk-doc/html/gandiva-glib/index.html -Files: /usr/share/gtk-doc/html/gandiva-glib/*.html +Index: /usr/share/doc/libgandiva-glib-doc/gandiva-glib/index.html +Files: /usr/share/doc/libgandiva-glib-doc/gandiva-glib/*.html diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libgandiva-glib-doc.install b/dev/tasks/linux-packages/apache-arrow/debian/libgandiva-glib-doc.install index 358e4e5c768be..d96dd268c6715 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libgandiva-glib-doc.install +++ b/dev/tasks/linux-packages/apache-arrow/debian/libgandiva-glib-doc.install @@ -1 +1 @@ -usr/share/gtk-doc/html/gandiva-glib +usr/share/doc/gandiva-glib usr/share/doc/libgandiva-glib-doc/ diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libgandiva-glib-doc.links b/dev/tasks/linux-packages/apache-arrow/debian/libgandiva-glib-doc.links index 234794e232efb..2abd41c0bf29a 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libgandiva-glib-doc.links +++ b/dev/tasks/linux-packages/apache-arrow/debian/libgandiva-glib-doc.links @@ -1,3 +1,4 @@ -usr/share/gtk-doc/html/gandiva-glib usr/share/doc/libgandiva-glib-doc/gandiva-glib +usr/share/doc/libgandiva-glib-doc/gandiva-glib usr/share/devhelp/books/gandiva-glib +usr/share/doc/libarrow-glib-doc/arrow-glib usr/share/doc/libgandiva-glib-doc/arrow-glib usr/share/doc/libglib2.0-doc/glib usr/share/doc/libgandiva-glib-doc/glib usr/share/doc/libglib2.0-doc/gobject usr/share/doc/libgandiva-glib-doc/gobject diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libparquet-glib-doc.doc-base b/dev/tasks/linux-packages/apache-arrow/debian/libparquet-glib-doc.doc-base index cc68e2df6c11f..199d9501871d3 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libparquet-glib-doc.doc-base +++ b/dev/tasks/linux-packages/apache-arrow/debian/libparquet-glib-doc.doc-base @@ -5,5 +5,5 @@ Abstract: Apache Parquet GLib is a columnar storage format processing library th Section: Programming Format: HTML -Index: /usr/share/gtk-doc/html/parquet-glib/index.html -Files: /usr/share/gtk-doc/html/parquet-glib/*.html +Index: /usr/share/doc/libparquet-glib-doc/parquet-glib/index.html +Files: /usr/share/doc/libparquet-glib-doc/parquet-glib/*.html diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libparquet-glib-doc.install b/dev/tasks/linux-packages/apache-arrow/debian/libparquet-glib-doc.install index 5843ea3dab8b3..3b4530cca1f53 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libparquet-glib-doc.install +++ b/dev/tasks/linux-packages/apache-arrow/debian/libparquet-glib-doc.install @@ -1 +1 @@ -usr/share/gtk-doc/html/parquet-glib +usr/share/doc/parquet-glib usr/share/doc/libparquet-glib-doc/ diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libparquet-glib-doc.links b/dev/tasks/linux-packages/apache-arrow/debian/libparquet-glib-doc.links index c31f346b174d6..e4d32da3b34fc 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libparquet-glib-doc.links +++ b/dev/tasks/linux-packages/apache-arrow/debian/libparquet-glib-doc.links @@ -1,3 +1,5 @@ -usr/share/gtk-doc/html/parquet-glib usr/share/doc/libparquet-glib-doc/parquet-glib +usr/share/doc/libparquet-glib-doc/parquet-glib usr/share/devhelp/books/parquet-glib +usr/share/doc/libarrow-glib-doc/arrow-glib usr/share/doc/libparquet-glib-doc/arrow-glib +usr/share/doc/libglib2.0-doc/gio usr/share/doc/libparquet-glib-doc/gio usr/share/doc/libglib2.0-doc/glib usr/share/doc/libparquet-glib-doc/glib usr/share/doc/libglib2.0-doc/gobject usr/share/doc/libparquet-glib-doc/gobject diff --git a/dev/tasks/linux-packages/apache-arrow/debian/rules b/dev/tasks/linux-packages/apache-arrow/debian/rules index c5086950511b0..36c43cf0d5968 100755 --- a/dev/tasks/linux-packages/apache-arrow/debian/rules +++ b/dev/tasks/linux-packages/apache-arrow/debian/rules @@ -64,7 +64,7 @@ override_dh_auto_build: -- \ -Darrow_cpp_build_type=$(BUILD_TYPE) \ -Darrow_cpp_build_dir=../cpp_build \ - -Dgtk_doc=true \ + -Ddoc=true \ -Dvapi=true env \ LD_LIBRARY_PATH=$(CURDIR)/cpp_build/$(BUILD_TYPE) \ diff --git a/dev/tasks/linux-packages/apache-arrow/yum/almalinux-8/Dockerfile b/dev/tasks/linux-packages/apache-arrow/yum/almalinux-8/Dockerfile index 5a5fd903bfc36..d846915ab21de 100644 --- a/dev/tasks/linux-packages/apache-arrow/yum/almalinux-8/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/yum/almalinux-8/Dockerfile @@ -39,7 +39,6 @@ RUN \ git \ glog-devel \ gobject-introspection-devel \ - gtk-doc \ json-devel \ libarchive \ libzstd-devel \ @@ -61,5 +60,6 @@ RUN \ thrift-devel \ # utf8proc-devel \ vala \ + which \ zlib-devel && \ dnf clean ${quiet} all diff --git a/dev/tasks/linux-packages/apache-arrow/yum/almalinux-9/Dockerfile b/dev/tasks/linux-packages/apache-arrow/yum/almalinux-9/Dockerfile index f3ae6295dfb47..222ab1b58d34d 100644 --- a/dev/tasks/linux-packages/apache-arrow/yum/almalinux-9/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/yum/almalinux-9/Dockerfile @@ -41,7 +41,6 @@ RUN \ gflags-devel \ git \ gobject-introspection-devel \ - gtk-doc \ json-devel \ libarchive \ libzstd-devel \ @@ -63,5 +62,6 @@ RUN \ thrift-devel \ utf8proc-devel \ vala \ + which \ zlib-devel && \ dnf clean ${quiet} all diff --git a/dev/tasks/linux-packages/apache-arrow/yum/amazon-linux-2023/Dockerfile b/dev/tasks/linux-packages/apache-arrow/yum/amazon-linux-2023/Dockerfile index cc2c55545a07d..7f0f3e90a363a 100644 --- a/dev/tasks/linux-packages/apache-arrow/yum/amazon-linux-2023/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/yum/amazon-linux-2023/Dockerfile @@ -38,7 +38,6 @@ RUN \ gobject-introspection-devel \ grpc-devel \ grpc-plugins \ - gtk-doc \ libzstd-devel \ llvm-devel \ lz4-devel \ @@ -49,6 +48,7 @@ RUN \ pkg-config \ protobuf-compiler \ protobuf-devel \ + python3-pip \ rapidjson-devel \ re2-devel \ rpmdevtools \ @@ -56,5 +56,6 @@ RUN \ tar \ utf8proc-devel \ vala \ + which \ zlib-devel && \ dnf clean ${quiet} all diff --git a/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in b/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in index bcdc3ed7d8a7f..4d78fbf3e81c7 100644 --- a/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in +++ b/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in @@ -82,6 +82,8 @@ %define have_thrift (%{_rhel} >= 8) %define have_utf8proc (%{_rhel} >= 9 || %{_amzn} >= 2023) +%define enable_glib_doc (%{_rhel} >= 9 || %{is_amazon_linux}) + Name: @PACKAGE@ Version: @VERSION@ Release: @RELEASE@%{?dist} @@ -142,7 +144,6 @@ BuildRequires: ncurses-devel %endif BuildRequires: gobject-introspection-devel -BuildRequires: gtk-doc %if %{use_vala} BuildRequires: vala %endif @@ -199,22 +200,25 @@ cd c_glib %if %{_amzn} >= 2023 # Do nothing %else - %if (%{_rhel} >= 8 || "%{_arch}" != "aarch64") - pip3 install meson + %if %{is_centos_7} + # Meson 0.62.0 or later requires Python 3.7 or later. + pip3 install 'meson<0.62.0' %else - # Meson 0.57.0 or later requires Ninja 1.8.2 or later but EPEL for - # Amazon Linux 2 aarch64 provides Ninja 1.7.2. We can remove - # '<0.57.0' once we drop support for Amazon Linux 2. - pip3 install 'meson<0.57.0' + pip3 install meson %endif %endif +%if %{enable_glib_doc} + pip3 install gi-docgen +%endif meson setup build \ --default-library=both \ --libdir=%{_libdir} \ --prefix=%{_prefix} \ -Darrow_cpp_build_dir=../cpp/%{arrow_cmake_builddir} \ -Darrow_cpp_build_type=$cpp_build_type \ - -Dgtk_doc=true \ +%if %{enable_glib_doc} + -Ddoc=true \ +%endif %if %{use_vala} -Dvapi=true %endif @@ -596,8 +600,11 @@ Documentation for Apache Arrow GLib. %defattr(-,root,root,-) %doc README.md %license LICENSE.txt NOTICE.txt +%{_datadir}/arrow-glib/*.txt +%{_datadir}/arrow-glib/*.md +%if %{enable_glib_doc} %{_docdir}/arrow-glib/ -%{_datadir}/gtk-doc/html/arrow-glib/ +%endif %package -n %{name}%{major_version}-dataset-glib-libs Summary: Runtime libraries for Apache Arrow Dataset GLib @@ -649,7 +656,9 @@ Documentation for Apache Arrow dataset GLib. %defattr(-,root,root,-) %doc README.md %license LICENSE.txt NOTICE.txt -%{_datadir}/gtk-doc/html/arrow-dataset-glib/ +%if %{enable_glib_doc} +%{_docdir}/arrow-dataset-glib/ +%endif %if %{use_flight} %package -n %{name}%{major_version}-flight-glib-libs @@ -702,7 +711,9 @@ Documentation for Apache Arrow Flight GLib. %defattr(-,root,root,-) %doc README.md %license LICENSE.txt NOTICE.txt -%{_datadir}/gtk-doc/html/arrow-flight-glib/ +%if %{enable_glib_doc} +%{_docdir}/arrow-flight-glib/ +%endif %package -n %{name}%{major_version}-flight-sql-glib-libs Summary: Runtime libraries for Apache Arrow Flight SQL GLib @@ -754,7 +765,9 @@ Documentation for Apache Arrow Flight SQL GLib. %defattr(-,root,root,-) %doc README.md %license LICENSE.txt NOTICE.txt -%{_datadir}/gtk-doc/html/arrow-flight-sql-glib/ + %if %{enable_glib_doc} +%{_docdir}/arrow-flight-sql-glib/ + %endif %endif %if %{use_gandiva} @@ -808,7 +821,9 @@ Documentation for Gandiva GLib. %defattr(-,root,root,-) %doc README.md %license LICENSE.txt NOTICE.txt -%{_datadir}/gtk-doc/html/gandiva-glib/ + %if %{enable_glib_doc} +%{_docdir}/gandiva-glib/ + %endif %endif %package -n parquet%{major_version}-glib-libs @@ -861,7 +876,9 @@ Documentation for Apache Parquet GLib. %defattr(-,root,root,-) %doc README.md %license LICENSE.txt NOTICE.txt -%{_datadir}/gtk-doc/html/parquet-glib/ +%if %{enable_glib_doc} +%{_docdir}/parquet-glib/ +%endif %changelog * Fri Feb 23 2024 Raúl Cumplido - 15.0.1-1 diff --git a/dev/tasks/linux-packages/apache-arrow/yum/centos-7/Dockerfile b/dev/tasks/linux-packages/apache-arrow/yum/centos-7/Dockerfile index 1da8e0fb79621..3c52a5663f773 100644 --- a/dev/tasks/linux-packages/apache-arrow/yum/centos-7/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/yum/centos-7/Dockerfile @@ -44,7 +44,6 @@ RUN \ git \ glog-devel \ gobject-introspection-devel \ - gtk-doc \ json-devel \ libzstd-devel \ lz4-devel \ @@ -58,6 +57,7 @@ RUN \ tar \ thrift-devel \ vala \ + which \ zlib-devel && \ yum clean ${quiet} all diff --git a/dev/tasks/linux-packages/apache-arrow/yum/centos-8-stream/Dockerfile b/dev/tasks/linux-packages/apache-arrow/yum/centos-8-stream/Dockerfile index 5a23c5e04d645..acc29d3e3776c 100644 --- a/dev/tasks/linux-packages/apache-arrow/yum/centos-8-stream/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/yum/centos-8-stream/Dockerfile @@ -39,7 +39,6 @@ RUN \ git \ glog-devel \ gobject-introspection-devel \ - gtk-doc \ json-devel \ libarchive \ libzstd-devel \ @@ -60,5 +59,6 @@ RUN \ tar \ thrift-devel \ vala \ + which \ zlib-devel && \ dnf clean ${quiet} all diff --git a/dev/tasks/linux-packages/apache-arrow/yum/centos-9-stream/Dockerfile b/dev/tasks/linux-packages/apache-arrow/yum/centos-9-stream/Dockerfile index b1e1630103c34..9522d999af5b7 100644 --- a/dev/tasks/linux-packages/apache-arrow/yum/centos-9-stream/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/yum/centos-9-stream/Dockerfile @@ -38,7 +38,6 @@ RUN \ gflags-devel \ git \ gobject-introspection-devel \ - gtk-doc \ json-devel \ libarchive \ libzstd-devel \ @@ -59,5 +58,6 @@ RUN \ thrift-devel \ utf8proc-devel \ vala \ + which \ zlib-devel && \ dnf clean ${quiet} all From 8c7820a576ff5197a40ba529f838ae13f4ff4095 Mon Sep 17 00:00:00 2001 From: Bryce Mecum Date: Sun, 10 Mar 2024 16:25:39 -0800 Subject: [PATCH 08/30] MINOR: [R][Docs] Fix typo in s3_bucket example code (#40447) ### Rationale for this change The current code is invalid R code and will error so I'd like to fix that. ### Are these changes tested? Yes, but manually. Current code: ```r > Sys.setenv("ARROW_S3_LOG_LEVEL","DEBUG") Error in Sys.setenv("ARROW_S3_LOG_LEVEL", "DEBUG") : all arguments must be named ``` New code: ```r > Sys.setenv("ARROW_S3_LOG_LEVEL"="DEBUG") ``` ### Are there any user-facing changes? Correct docs. Authored-by: Bryce Mecum Signed-off-by: Sutou Kouhei --- r/R/filesystem.R | 2 +- r/man/s3_bucket.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/r/R/filesystem.R b/r/R/filesystem.R index c6f92cba1932c..0e4484d1b583d 100644 --- a/r/R/filesystem.R +++ b/r/R/filesystem.R @@ -486,7 +486,7 @@ default_s3_options <- list( #' @examplesIf FALSE #' # Turn on debug logging. The following line of code should be run in a fresh #' # R session prior to any calls to `s3_bucket()` (or other S3 functions) -#' Sys.setenv("ARROW_S3_LOG_LEVEL", "DEBUG") +#' Sys.setenv("ARROW_S3_LOG_LEVEL"="DEBUG") #' bucket <- s3_bucket("voltrondata-labs-datasets") #' #' @export diff --git a/r/man/s3_bucket.Rd b/r/man/s3_bucket.Rd index 1b30a5cde1177..bffcfa5c387db 100644 --- a/r/man/s3_bucket.Rd +++ b/r/man/s3_bucket.Rd @@ -35,7 +35,7 @@ bucket <- s3_bucket("voltrondata-labs-datasets") \dontshow{if (FALSE) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Turn on debug logging. The following line of code should be run in a fresh # R session prior to any calls to `s3_bucket()` (or other S3 functions) -Sys.setenv("ARROW_S3_LOG_LEVEL", "DEBUG") +Sys.setenv("ARROW_S3_LOG_LEVEL"="DEBUG") bucket <- s3_bucket("voltrondata-labs-datasets") \dontshow{\}) # examplesIf} } From f299db0215c3178c542e2ab608013d6b6f43d783 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Mon, 11 Mar 2024 09:59:29 +0900 Subject: [PATCH 09/30] GH-40445: [C++] Fix static build on Windows (#40446) ### Rationale for this change ```text LINK : warning LNK4217: symbol 'uriEscapeExA' defined in 'arrow_static.lib(unity_0_c.c.obj)' is imported by 'arrow_static.lib(unity_5_cxx.cxx.obj)' in function '"class std::basic_string,class std::allocator > __cdecl arrow::internal::UriEscape(class std::basic_string_view >)" (?UriEscape@ internal@ arrow@@ YA?AV?$basic_string@ DU?$char_traits@ D@ std@@ V?$allocator@ D@ 2@@ std@@ V?$basic_string_view@ DU?$char_traits@ D@ std@@@ 4@@ Z)' LINK : warning LNK4217: symbol 'uriUnescapeInPlaceA' defined in 'arrow_static.lib(unity_0_c.c.obj)' is imported by 'arrow_static.lib(unity_5_cxx.cxx.obj)' in function '"class std::basic_string,class std::allocator > __cdecl arrow::internal::UriUnescape(class std::basic_string_view >)" (?UriUnescape@ internal@ arrow@@ YA?AV?$basic_string@ DU?$char_traits@ D@ std@@ V?$allocator@ D@ 2@@ std@@ V?$basic_string_view@ DU?$char_traits@ D@ std@@@ 4@@ Z)' LINK : warning LNK4217: symbol 'uriWindowsFilenameToUriStringA' defined in 'arrow_static.lib(unity_0_c.c.obj)' is imported by 'arrow_static.lib(unity_5_cxx.cxx.obj)' in function '"class arrow::Result,class std::allocator > > __cdecl arrow::internal::UriFromAbsolutePath(class std::basic_string_view >)" (?UriFromAbsolutePath@ internal@ arrow@@ YA?AV?$Result@ V?$basic_string@ DU?$char_traits@ D@ std@@ V?$allocator@ D@ 2@@ std@@@ 2@ V?$basic_string_view@ DU?$char_traits@ D@ std@@@ std@@@ Z)' arrow_static.lib(unity_5_cxx.cxx.obj) : error LNK2019: unresolved external symbol __imp_uriParseSingleUriExA referenced in function "public: class arrow::Status __cdecl arrow::internal::Uri::Parse(class std::basic_string,class std::allocator > const &)" (?Parse@ Uri@ internal@ arrow@@ QEAA?AVStatus@ 3@ AEBV?$basic_string@ DU?$char_traits@ D@ std@@ V?$allocator@ D@ 2@@ std@@@ Z) arrow_static.lib(unity_5_cxx.cxx.obj) : error LNK2019: unresolved external symbol __imp_uriFreeUriMembersA referenced in function "public: __cdecl arrow::internal::Uri::Impl::~Impl(void)" (??1Impl@ Uri@ internal@ arrow@@ QEAA@ XZ) arrow_static.lib(unity_5_cxx.cxx.obj) : error LNK2019: unresolved external symbol __imp_uriDissectQueryMallocA referenced in function "public: class arrow::Result,class std::allocator >,class std::basic_string,class std::allocator > >,class std::allocator,class std::allocator >,class std::basic_string,class std::allocator > > > > > __cdecl arrow::internal::Uri::query_items(void)const " (?query_items@ Uri@ internal@ arrow@@ QEBA?AV?$Result@ V?$vector@ U?$pair@ V?$basic_string@ DU?$char_traits@ D@ std@@ V?$allocator@ D@ 2@@ std@@ V12@@ std@@ V?$allocator@ U?$pair@ V?$basic_string@ DU?$char_traits@ D@ std@@ V?$allocator@ D@ 2@@ std@@ V12@@ std@@@ 2@@ std@@@ 3@ XZ) arrow_static.lib(unity_5_cxx.cxx.obj) : error LNK2019: unresolved external symbol __imp_uriFreeQueryListA referenced in function "public: class arrow::Result,class std::allocator >,class std::basic_string,class std::allocator > >,class std::allocator,class std::allocator >,class std::basic_string,class std::allocator > > > > > __cdecl arrow::internal::Uri::query_items(void)const " (?query_items@ Uri@ internal@ arrow@@ QEBA?AV?$Result@ V?$vector@ U?$pair@ V?$basic_string@ DU?$char_traits@ D@ std@@ V?$allocator@ D@ 2@@ std@@ V12@@ std@@ V?$allocator@ U?$pair@ V?$basic_string@ DU?$char_traits@ D@ std@@ V?$allocator@ D@ 2@@ std@@ V12@@ std@@@ 2@@ std@@@ 3@ XZ) aws-c-io.lib(secure_channel_tls_handler.c.obj) : error LNK2019: unresolved external symbol __imp_CertFreeCertificateContext referenced in function s_ctx_new aws-c-io.lib(windows_pki_utils.c.obj) : error LNK2001: unresolved external symbol __imp_CertFreeCertificateContext aws-c-io.lib(secure_channel_tls_handler.c.obj) : error LNK2019: unresolved external symbol __imp_CertCreateCertificateChainEngine referenced in function s_manually_verify_peer_cert aws-c-io.lib(secure_channel_tls_handler.c.obj) : error LNK2019: unresolved external symbol __imp_CertFreeCertificateChainEngine referenced in function s_manually_verify_peer_cert aws-c-io.lib(secure_channel_tls_handler.c.obj) : error LNK2019: unresolved external symbol __imp_CertGetCertificateChain referenced in function s_manually_verify_peer_cert aws-c-io.lib(secure_channel_tls_handler.c.obj) : error LNK2019: unresolved external symbol __imp_CertFreeCertificateChain referenced in function s_manually_verify_peer_cert aws-c-io.lib(secure_channel_tls_handler.c.obj) : error LNK2019: unresolved external symbol __imp_CertVerifyCertificateChainPolicy referenced in function s_manually_verify_peer_cert aws-c-io.lib(windows_pki_utils.c.obj) : error LNK2019: unresolved external symbol __imp_CryptDecodeObjectEx referenced in function aws_import_key_pair_to_cert_context aws-c-io.lib(windows_pki_utils.c.obj) : error LNK2019: unresolved external symbol __imp_CertOpenStore referenced in function aws_import_key_pair_to_cert_context aws-c-io.lib(windows_pki_utils.c.obj) : error LNK2019: unresolved external symbol __imp_CertCloseStore referenced in function aws_close_cert_store aws-c-io.lib(windows_pki_utils.c.obj) : error LNK2019: unresolved external symbol __imp_CertFindCertificateInStore referenced in function aws_load_cert_from_system_cert_store aws-c-io.lib(windows_pki_utils.c.obj) : error LNK2019: unresolved external symbol __imp_CertSetCertificateContextProperty referenced in function aws_import_key_pair_to_cert_context aws-c-io.lib(windows_pki_utils.c.obj) : error LNK2019: unresolved external symbol __imp_CertAddCertificateContextToStore referenced in function aws_import_key_pair_to_cert_context aws-c-io.lib(windows_pki_utils.c.obj) : error LNK2019: unresolved external symbol __imp_CryptQueryObject referenced in function aws_import_key_pair_to_cert_context aws-c-io.lib(windows_pki_utils.c.obj) : error LNK2019: unresolved external symbol __imp_CryptStringToBinaryA referenced in function aws_load_cert_from_system_cert_store ``` ### What changes are included in this PR? * Add missing `URI_STATIC_BUILD` macro definition that was removed by #39824 accidentally. * Add missing `crypt32.lib` dependency to `aws-c-io`. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #40445 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 3 +++ cpp/src/arrow/CMakeLists.txt | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index b6b6ac18ea8cb..4de7741d340f9 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -5018,6 +5018,9 @@ macro(build_awssdk) "ncrypt.lib" "Secur32.lib" "Shlwapi.lib") + set_property(TARGET AWS::aws-c-io + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES "crypt32.lib") endif() # AWSSDK is static-only build diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index b53d76e74765f..c97645594e3d8 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -478,7 +478,7 @@ set_source_files_properties(vendored/datetime/tz.cpp arrow_add_object_library(ARROW_VENDORED ${ARROW_VENDORED_SRCS}) # Disable DLL exports in vendored uriparser library foreach(ARROW_VENDORED_TARGET ${ARROW_VENDORED_TARGETS}) - target_compile_definitions(${ARROW_VENDORED_TARGET} PUBLIC URI_STATIC_BUILD) + target_compile_definitions(${ARROW_VENDORED_TARGET} PRIVATE URI_STATIC_BUILD) endforeach() set(ARROW_UTIL_SRCS @@ -559,6 +559,11 @@ endif() arrow_add_object_library(ARROW_UTIL ${ARROW_UTIL_SRCS}) +# Disable DLL exports in vendored uriparser library +foreach(ARROW_UTIL_TARGET ${ARROW_UTIL_TARGETS}) + target_compile_definitions(${ARROW_UTIL_TARGET} PRIVATE URI_STATIC_BUILD) +endforeach() + if(ARROW_USE_BOOST) foreach(ARROW_UTIL_TARGET ${ARROW_UTIL_TARGETS}) target_link_libraries(${ARROW_UTIL_TARGET} PRIVATE Boost::headers) From bf07ce266511c6a2445f4b0fcd970e9d2e694431 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Mon, 11 Mar 2024 10:48:27 +0900 Subject: [PATCH 10/30] GH-40443: [Python] Suppress python/examples/minimal_build/Dockerfile.* warnings (#40444) ### Rationale for this change python/examples/minimal_build/Dockerfile.fedora:20 DL3040 warning: `dnf clean all` missing after dnf command. python/examples/minimal_build/Dockerfile.fedora:20 DL3041 warning: Specify version with `dnf install -y -`. python/examples/minimal_build/Dockerfile.fedora:32 DL3042 warning: Avoid use of cache directory with pip. Use `pip install --no-cache-dir ` python/examples/minimal_build/Dockerfile.ubuntu:38 DL3042 warning: Avoid use of cache directory with pip. Use `pip install --no-cache-dir ` ### What changes are included in this PR? * Ignore "DL3041 warning: Specify version with `dnf install -y -`." because we don't specify version. * Suppress other warnings. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #40443 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- .hadolint.yaml | 5 +++-- .pre-commit-config.yaml | 2 +- python/examples/minimal_build/Dockerfile.fedora | 5 +++-- python/examples/minimal_build/Dockerfile.ubuntu | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.hadolint.yaml b/.hadolint.yaml index a6d7d03f84f9e..6d326d7317ee3 100644 --- a/.hadolint.yaml +++ b/.hadolint.yaml @@ -18,7 +18,8 @@ ignored: - DL3008 - DL3013 + - DL3015 # Avoid additional packages by specifying `--no-install-recommends` - DL3018 - - DL3015 # Avoid additional packages by specifying `--no-install-recommends` - - DL3028 # Ruby gem version pinning + - DL3028 # Ruby gem version pinning - DL3007 # r-sanitizer must use latest + - DL3041 # Specify version with `dnf install -y -`. diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d3c7624f63e71..917f9cc425ae8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,7 +33,7 @@ repos: name: Docker Format language: docker_image types: - - dockerfile + - dockerfile entry: --entrypoint /bin/hadolint hadolint/hadolint:latest - exclude: ^dev/.*$ - repo: https://github.com/pycqa/flake8 diff --git a/python/examples/minimal_build/Dockerfile.fedora b/python/examples/minimal_build/Dockerfile.fedora index e7b9600b67b0e..24a90337aa454 100644 --- a/python/examples/minimal_build/Dockerfile.fedora +++ b/python/examples/minimal_build/Dockerfile.fedora @@ -27,6 +27,7 @@ RUN dnf update -y && \ make \ cmake \ ninja-build \ - python3-devel + python3-devel && \ + dnf clean all -RUN pip3 install -U pip setuptools +RUN pip3 install --no-cache-dir -U pip setuptools diff --git a/python/examples/minimal_build/Dockerfile.ubuntu b/python/examples/minimal_build/Dockerfile.ubuntu index e059c91017f16..ebea4b045e592 100644 --- a/python/examples/minimal_build/Dockerfile.ubuntu +++ b/python/examples/minimal_build/Dockerfile.ubuntu @@ -35,4 +35,4 @@ RUN apt-get update -y -q && \ && \ apt-get clean && rm -rf /var/lib/apt/lists* -RUN pip3 install -U pip setuptools +RUN pip3 install --no-cache-dir -U pip setuptools From 6ebd555a1095e64c04ccf4f6a0762d85b0bd0376 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Mon, 11 Mar 2024 10:50:46 +0900 Subject: [PATCH 11/30] GH-40439: [Python] Fix flake8 failures in python/benchmarks/parquet.py (#40440) ### Rationale for this change Failures: /arrow/python/benchmarks/parquet.py:18:1: F401 'shutil' imported but unused /arrow/python/benchmarks/parquet.py:19:1: F401 'tempfile' imported but unused /arrow/python/benchmarks/parquet.py:23:1: F401 'pandas as pd' imported but unused ### What changes are included in this PR? * Remove unused imports. * Add python/benchmarks/ to lint targets. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #40439 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- dev/archery/archery/utils/lint.py | 9 +++++---- python/benchmarks/parquet.py | 4 ---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/dev/archery/archery/utils/lint.py b/dev/archery/archery/utils/lint.py index 3efe5994055db..15f22ca2e6e5c 100644 --- a/dev/archery/archery/utils/lint.py +++ b/dev/archery/archery/utils/lint.py @@ -187,11 +187,12 @@ def python_linter(src, fix=False): return # Gather files for autopep8 - patterns = ["python/pyarrow/**/*.py", + patterns = ["python/benchmarks/**/*.py", + "python/examples/**/*.py", + "python/pyarrow/**/*.py", "python/pyarrow/**/*.pyx", "python/pyarrow/**/*.pxd", "python/pyarrow/**/*.pxi", - "python/examples/**/*.py", "dev/*.py", "dev/archery/**/*.py", "dev/release/**/*.py"] @@ -232,8 +233,8 @@ def python_linter(src, fix=False): yield LintResult.from_cmd( flake8("--extend-exclude=" + ','.join(flake8_exclude), "--config=" + os.path.join(src.python, "setup.cfg"), - setup_py, src.pyarrow, os.path.join(src.python, "examples"), - src.dev, check=False)) + setup_py, src.pyarrow, os.path.join(src.python, "benchmarks"), + os.path.join(src.python, "examples"), src.dev, check=False)) logger.info("Running Cython linter (cython-lint)") diff --git a/python/benchmarks/parquet.py b/python/benchmarks/parquet.py index e459ea2c369b4..ca39919b4b9b7 100644 --- a/python/benchmarks/parquet.py +++ b/python/benchmarks/parquet.py @@ -15,12 +15,8 @@ # specific language governing permissions and limitations # under the License. -import shutil -import tempfile - from pandas.util.testing import rands import numpy as np -import pandas as pd import pyarrow as pa try: From 6a78580f0ce7d35c938e1c26c73e70cda3eec004 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Mon, 11 Mar 2024 13:53:09 +0900 Subject: [PATCH 12/30] GH-31545: [GLib] Enable clang-format (#40451) ### Rationale for this change This will help new contributors. ### What changes are included in this PR? Create `c_glib/.clang-format` based on the current style. But there are many changes... ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #31545 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- .pre-commit-config.yaml | 7 + c_glib/.clang-format | 45 + c_glib/arrow-cuda-glib/cuda.cpp | 185 +- c_glib/arrow-cuda-glib/cuda.h | 39 +- c_glib/arrow-cuda-glib/cuda.hpp | 12 +- .../arrow-dataset-glib/dataset-definition.h | 6 +- c_glib/arrow-dataset-glib/dataset-factory.cpp | 159 +- c_glib/arrow-dataset-glib/dataset-factory.h | 36 +- c_glib/arrow-dataset-glib/dataset.cpp | 186 +- c_glib/arrow-dataset-glib/dataset.h | 14 +- c_glib/arrow-dataset-glib/dataset.hpp | 19 +- c_glib/arrow-dataset-glib/file-format.cpp | 148 +- c_glib/arrow-dataset-glib/file-format.h | 41 +- c_glib/arrow-dataset-glib/file-format.hpp | 8 +- c_glib/arrow-dataset-glib/fragment.cpp | 48 +- c_glib/arrow-dataset-glib/fragment.h | 10 +- c_glib/arrow-dataset-glib/fragment.hpp | 7 +- c_glib/arrow-dataset-glib/partitioning.cpp | 205 +- c_glib/arrow-dataset-glib/partitioning.h | 41 +- c_glib/arrow-dataset-glib/partitioning.hpp | 3 +- c_glib/arrow-dataset-glib/scanner.cpp | 91 +- c_glib/arrow-dataset-glib/scanner.h | 25 +- c_glib/arrow-dataset-glib/scanner.hpp | 3 +- c_glib/arrow-flight-glib/client.cpp | 156 +- c_glib/arrow-flight-glib/client.h | 31 +- c_glib/arrow-flight-glib/client.hpp | 9 +- c_glib/arrow-flight-glib/common.cpp | 313 ++- c_glib/arrow-flight-glib/common.h | 96 +- c_glib/arrow-flight-glib/common.hpp | 4 +- c_glib/arrow-flight-glib/server.cpp | 416 ++-- c_glib/arrow-flight-glib/server.h | 95 +- c_glib/arrow-flight-glib/server.hpp | 40 +- c_glib/arrow-flight-sql-glib/client.cpp | 157 +- c_glib/arrow-flight-sql-glib/client.h | 44 +- c_glib/arrow-flight-sql-glib/client.hpp | 6 +- c_glib/arrow-flight-sql-glib/server.cpp | 345 ++-- c_glib/arrow-flight-sql-glib/server.h | 126 +- c_glib/arrow-flight-sql-glib/server.hpp | 10 +- c_glib/arrow-glib/array-builder.cpp | 1701 +++++++--------- c_glib/arrow-glib/array-builder.h | 1366 +++++++------ c_glib/arrow-glib/array-builder.hpp | 4 +- c_glib/arrow-glib/basic-array-definition.h | 13 +- c_glib/arrow-glib/basic-array.cpp | 736 +++---- c_glib/arrow-glib/basic-array.h | 667 +++---- c_glib/arrow-glib/basic-array.hpp | 6 +- c_glib/arrow-glib/basic-data-type.cpp | 522 ++--- c_glib/arrow-glib/basic-data-type.h | 198 +- c_glib/arrow-glib/basic-data-type.hpp | 13 +- c_glib/arrow-glib/buffer.cpp | 127 +- c_glib/arrow-glib/buffer.h | 104 +- c_glib/arrow-glib/buffer.hpp | 3 +- c_glib/arrow-glib/chunked-array-definition.h | 8 +- c_glib/arrow-glib/chunked-array.cpp | 73 +- c_glib/arrow-glib/chunked-array.h | 47 +- c_glib/arrow-glib/chunked-array.hpp | 8 +- c_glib/arrow-glib/codec.cpp | 34 +- c_glib/arrow-glib/codec.h | 14 +- c_glib/arrow-glib/composite-array.cpp | 591 +++--- c_glib/arrow-glib/composite-array.h | 170 +- c_glib/arrow-glib/composite-data-type.cpp | 124 +- c_glib/arrow-glib/composite-data-type.h | 86 +- c_glib/arrow-glib/compute-definition.h | 22 +- c_glib/arrow-glib/compute.cpp | 1729 +++++++---------- c_glib/arrow-glib/compute.h | 375 ++-- c_glib/arrow-glib/compute.hpp | 75 +- c_glib/arrow-glib/datum.cpp | 206 +- c_glib/arrow-glib/datum.h | 55 +- c_glib/arrow-glib/datum.hpp | 15 +- c_glib/arrow-glib/decimal.cpp | 150 +- c_glib/arrow-glib/decimal.h | 156 +- c_glib/arrow-glib/error.cpp | 21 +- c_glib/arrow-glib/error.h | 9 +- c_glib/arrow-glib/error.hpp | 43 +- c_glib/arrow-glib/expression.cpp | 46 +- c_glib/arrow-glib/expression.h | 16 +- c_glib/arrow-glib/expression.hpp | 1 - c_glib/arrow-glib/field.cpp | 79 +- c_glib/arrow-glib/field.h | 43 +- c_glib/arrow-glib/field.hpp | 8 +- c_glib/arrow-glib/file-mode.hpp | 6 +- c_glib/arrow-glib/file-system.cpp | 329 ++-- c_glib/arrow-glib/file-system.h | 142 +- c_glib/arrow-glib/file-system.hpp | 9 +- c_glib/arrow-glib/file.cpp | 10 +- c_glib/arrow-glib/file.h | 20 +- c_glib/arrow-glib/file.hpp | 3 +- c_glib/arrow-glib/gobject-type.h | 161 +- c_glib/arrow-glib/input-stream.cpp | 376 ++-- c_glib/arrow-glib/input-stream.h | 114 +- c_glib/arrow-glib/input-stream.hpp | 26 +- c_glib/arrow-glib/internal-hash-table.hpp | 18 +- c_glib/arrow-glib/interval.cpp | 86 +- c_glib/arrow-glib/interval.h | 16 +- c_glib/arrow-glib/interval.hpp | 1 - c_glib/arrow-glib/ipc-options.cpp | 64 +- c_glib/arrow-glib/ipc-options.h | 17 +- c_glib/arrow-glib/local-file-system.cpp | 39 +- c_glib/arrow-glib/local-file-system.h | 3 +- c_glib/arrow-glib/local-file-system.hpp | 1 - c_glib/arrow-glib/memory-pool.cpp | 28 +- c_glib/arrow-glib/memory-pool.h | 20 +- c_glib/arrow-glib/metadata-version.hpp | 6 +- c_glib/arrow-glib/orc-file-reader.cpp | 97 +- c_glib/arrow-glib/orc-file-reader.h | 26 +- c_glib/arrow-glib/output-stream.cpp | 222 ++- c_glib/arrow-glib/output-stream.h | 150 +- c_glib/arrow-glib/output-stream.hpp | 23 +- c_glib/arrow-glib/readable.cpp | 20 +- c_glib/arrow-glib/readable.h | 16 +- c_glib/arrow-glib/readable.hpp | 3 +- c_glib/arrow-glib/reader.cpp | 441 ++--- c_glib/arrow-glib/reader.h | 216 +- c_glib/arrow-glib/reader.hpp | 21 +- c_glib/arrow-glib/record-batch.cpp | 119 +- c_glib/arrow-glib/record-batch.h | 81 +- c_glib/arrow-glib/record-batch.hpp | 6 +- c_glib/arrow-glib/scalar.cpp | 815 ++++---- c_glib/arrow-glib/scalar.h | 247 +-- c_glib/arrow-glib/schema.cpp | 52 +- c_glib/arrow-glib/schema.h | 70 +- c_glib/arrow-glib/schema.hpp | 6 +- c_glib/arrow-glib/table-builder.cpp | 42 +- c_glib/arrow-glib/table-builder.h | 30 +- c_glib/arrow-glib/table-builder.hpp | 6 +- c_glib/arrow-glib/table.cpp | 116 +- c_glib/arrow-glib/table.h | 71 +- c_glib/arrow-glib/table.hpp | 6 +- c_glib/arrow-glib/tensor.cpp | 61 +- c_glib/arrow-glib/tensor.h | 66 +- c_glib/arrow-glib/tensor.hpp | 11 +- c_glib/arrow-glib/type.h | 3 +- c_glib/arrow-glib/type.hpp | 12 +- c_glib/arrow-glib/writable-file.cpp | 7 +- c_glib/arrow-glib/writable-file.h | 18 +- c_glib/arrow-glib/writable.cpp | 7 +- c_glib/arrow-glib/writable.h | 19 +- c_glib/arrow-glib/writer.cpp | 92 +- c_glib/arrow-glib/writer.h | 152 +- c_glib/arrow-glib/writer.hpp | 15 +- c_glib/example/build.c | 3 +- c_glib/example/extension-type.c | 82 +- c_glib/example/read-file.c | 43 +- c_glib/example/read-stream.c | 40 +- c_glib/example/receive-network.c | 54 +- c_glib/example/send-network.c | 44 +- c_glib/gandiva-glib/expression.cpp | 95 +- c_glib/gandiva-glib/expression.h | 22 +- c_glib/gandiva-glib/expression.hpp | 9 +- c_glib/gandiva-glib/filter.cpp | 77 +- c_glib/gandiva-glib/filter.h | 10 +- c_glib/gandiva-glib/function-registry.cpp | 47 +- c_glib/gandiva-glib/function-registry.h | 10 +- c_glib/gandiva-glib/function-signature.cpp | 23 +- c_glib/gandiva-glib/function-signature.h | 26 +- c_glib/gandiva-glib/function-signature.hpp | 7 +- c_glib/gandiva-glib/native-function.cpp | 45 +- c_glib/gandiva-glib/native-function.h | 23 +- c_glib/gandiva-glib/native-function.hpp | 6 +- c_glib/gandiva-glib/node.cpp | 363 ++-- c_glib/gandiva-glib/node.h | 88 +- c_glib/gandiva-glib/node.hpp | 3 +- c_glib/gandiva-glib/projector.cpp | 131 +- c_glib/gandiva-glib/projector.h | 16 +- c_glib/gandiva-glib/projector.hpp | 7 +- c_glib/gandiva-glib/selection-vector.cpp | 84 +- c_glib/gandiva-glib/selection-vector.h | 27 +- c_glib/parquet-glib/arrow-file-reader.cpp | 91 +- c_glib/parquet-glib/arrow-file-reader.h | 12 +- c_glib/parquet-glib/arrow-file-writer.cpp | 79 +- c_glib/parquet-glib/arrow-file-writer.h | 17 +- c_glib/parquet-glib/metadata.cpp | 160 +- c_glib/parquet-glib/metadata.h | 38 +- c_glib/parquet-glib/metadata.hpp | 13 +- c_glib/parquet-glib/statistics.cpp | 136 +- c_glib/parquet-glib/statistics.h | 39 +- c_glib/parquet-glib/statistics.hpp | 3 +- 176 files changed, 8378 insertions(+), 11305 deletions(-) create mode 100644 c_glib/.clang-format diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 917f9cc425ae8..af47aa4e50cff 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -52,3 +52,10 @@ repos: hooks: - id: cython-lint args: [--no-pycodestyle] + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v14.0.6 + hooks: + - id: clang-format + name: C/GLib Format + files: >- + ^c_glib/ diff --git a/c_glib/.clang-format b/c_glib/.clang-format new file mode 100644 index 0000000000000..f1009b78bb89f --- /dev/null +++ b/c_glib/.clang-format @@ -0,0 +1,45 @@ + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +--- +AlignAfterOpenBracket: true +AlignConsecutiveMacros: AcrossEmptyLines +AllowAllArgumentsOnNextLine: false +AllowShortEnumsOnASingleLine: false +AllowShortIfStatementsOnASingleLine: false +AlwaysBreakAfterReturnType: All +BinPackArguments: false +BinPackParameters: false +BraceWrapping: + AfterFunction: true + AfterStruct: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +ColumnLimit: 90 +ConstructorInitializerIndentWidth: 2 +ContinuationIndentWidth: 2 +IndentCaseBlocks: true +IndentPPDirectives: AfterHash +IndentWidth: 2 +NamespaceIndentation: All +PPIndentWidth: 2 +PackConstructorInitializers: CurrentLine +SortIncludes: Never +--- +Language: JavaScript +SpacesInContainerLiterals: false diff --git a/c_glib/arrow-cuda-glib/cuda.cpp b/c_glib/arrow-cuda-glib/cuda.cpp index 13525b5906fa5..66790558d3f39 100644 --- a/c_glib/arrow-cuda-glib/cuda.cpp +++ b/c_glib/arrow-cuda-glib/cuda.cpp @@ -70,9 +70,7 @@ G_BEGIN_DECLS * #GArrowCUDABuffer. */ -G_DEFINE_TYPE(GArrowCUDADeviceManager, - garrow_cuda_device_manager, - G_TYPE_OBJECT) +G_DEFINE_TYPE(GArrowCUDADeviceManager, garrow_cuda_device_manager, G_TYPE_OBJECT) static void garrow_cuda_device_manager_init(GArrowCUDADeviceManager *object) @@ -98,8 +96,7 @@ garrow_cuda_device_manager_new(GError **error) { auto arrow_manager = arrow::cuda::CudaDeviceManager::Instance(); if (garrow::check(error, arrow_manager, "[cuda][device-manager][new]")) { - auto manager = g_object_new(GARROW_CUDA_TYPE_DEVICE_MANAGER, - NULL); + auto manager = g_object_new(GARROW_CUDA_TYPE_DEVICE_MANAGER, NULL); return GARROW_CUDA_DEVICE_MANAGER(manager); } else { return NULL; @@ -125,8 +122,7 @@ garrow_cuda_device_manager_get_context(GArrowCUDADeviceManager *manager, { auto arrow_manager = arrow::cuda::CudaDeviceManager::Instance(); auto arrow_cuda_context = (*arrow_manager)->GetContext(gpu_number); - if (garrow::check(error, arrow_cuda_context, - "[cuda][device-manager][get-context]]")) { + if (garrow::check(error, arrow_cuda_context, "[cuda][device-manager][get-context]]")) { return garrow_cuda_context_new_raw(&(*arrow_cuda_context)); } else { return NULL; @@ -148,8 +144,8 @@ garrow_cuda_device_manager_get_n_devices(GArrowCUDADeviceManager *manager) return (*arrow_manager)->num_devices(); } - -typedef struct GArrowCUDAContextPrivate_ { +typedef struct GArrowCUDAContextPrivate_ +{ std::shared_ptr context; } GArrowCUDAContextPrivate; @@ -157,14 +153,11 @@ enum { PROP_CONTEXT = 1 }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowCUDAContext, - garrow_cuda_context, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowCUDAContext, garrow_cuda_context, G_TYPE_OBJECT) -#define GARROW_CUDA_CONTEXT_GET_PRIVATE(object) \ - static_cast( \ - garrow_cuda_context_get_instance_private( \ - GARROW_CUDA_CONTEXT(object))) +#define GARROW_CUDA_CONTEXT_GET_PRIVATE(object) \ + static_cast( \ + garrow_cuda_context_get_instance_private(GARROW_CUDA_CONTEXT(object))) static void garrow_cuda_context_finalize(GObject *object) @@ -186,8 +179,8 @@ garrow_cuda_context_set_property(GObject *object, switch (prop_id) { case PROP_CONTEXT: - priv->context = - *static_cast *>(g_value_get_pointer(value)); + priv->context = *static_cast *>( + g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -212,7 +205,7 @@ static void garrow_cuda_context_init(GArrowCUDAContext *object) { auto priv = GARROW_CUDA_CONTEXT_GET_PRIVATE(object); - new(&priv->context) std::shared_ptr; + new (&priv->context) std::shared_ptr; } static void @@ -222,7 +215,7 @@ garrow_cuda_context_class_init(GArrowCUDAContextClass *klass) auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_cuda_context_finalize; + gobject_class->finalize = garrow_cuda_context_finalize; gobject_class->set_property = garrow_cuda_context_set_property; gobject_class->get_property = garrow_cuda_context_get_property; @@ -231,11 +224,11 @@ garrow_cuda_context_class_init(GArrowCUDAContextClass *klass) * * Since: 0.8.0 */ - spec = g_param_spec_pointer("context", - "Context", - "The raw std::shared_ptr", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "context", + "Context", + "The raw std::shared_ptr", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_CONTEXT, spec); } @@ -254,10 +247,7 @@ garrow_cuda_context_get_allocated_size(GArrowCUDAContext *context) return arrow_context->bytes_allocated(); } - -G_DEFINE_TYPE(GArrowCUDABuffer, - garrow_cuda_buffer, - GARROW_TYPE_BUFFER) +G_DEFINE_TYPE(GArrowCUDABuffer, garrow_cuda_buffer, GARROW_TYPE_BUFFER) static void garrow_cuda_buffer_init(GArrowCUDABuffer *object) @@ -281,15 +271,13 @@ garrow_cuda_buffer_class_init(GArrowCUDABufferClass *klass) * Since: 0.8.0 */ GArrowCUDABuffer * -garrow_cuda_buffer_new(GArrowCUDAContext *context, - gint64 size, - GError **error) +garrow_cuda_buffer_new(GArrowCUDAContext *context, gint64 size, GError **error) { auto arrow_context = garrow_cuda_context_get_raw(context); auto arrow_buffer_result = arrow_context->Allocate(size); if (garrow::check(error, arrow_buffer_result, "[cuda][buffer][new]")) { std::shared_ptr arrow_buffer = - std::move(*arrow_buffer_result); + std::move(*arrow_buffer_result); return garrow_cuda_buffer_new_raw(&arrow_buffer); } else { return NULL; @@ -341,8 +329,8 @@ garrow_cuda_buffer_new_record_batch(GArrowCUDAContext *context, { auto arrow_context = garrow_cuda_context_get_raw(context); auto arrow_record_batch = garrow_record_batch_get_raw(record_batch); - auto arrow_buffer = arrow::cuda::SerializeRecordBatch(*arrow_record_batch, - arrow_context.get()); + auto arrow_buffer = + arrow::cuda::SerializeRecordBatch(*arrow_record_batch, arrow_context.get()); if (garrow::check(error, arrow_buffer, "[cuda][buffer][new-record-batch]")) { return garrow_cuda_buffer_new_raw(&(*arrow_buffer)); } else { @@ -398,9 +386,7 @@ garrow_cuda_buffer_copy_from_host(GArrowCUDABuffer *buffer, { auto arrow_buffer = garrow_cuda_buffer_get_raw(buffer); auto status = arrow_buffer->CopyFromHost(0, data, size); - return garrow_error_check(error, - status, - "[cuda][buffer][copy-from-host]"); + return garrow_error_check(error, status, "[cuda][buffer][copy-from-host]"); } /** @@ -466,15 +452,12 @@ garrow_cuda_buffer_read_record_batch(GArrowCUDABuffer *buffer, if (options) { auto arrow_options = garrow_read_options_get_raw(options); - auto arrow_dictionary_memo = - garrow_read_options_get_dictionary_memo_raw(options); - auto arrow_record_batch = - arrow::cuda::ReadRecordBatch(arrow_schema, - arrow_dictionary_memo, - arrow_buffer, - arrow_options->memory_pool); - if (garrow::check(error, arrow_record_batch, - "[cuda][buffer][read-record-batch]")) { + auto arrow_dictionary_memo = garrow_read_options_get_dictionary_memo_raw(options); + auto arrow_record_batch = arrow::cuda::ReadRecordBatch(arrow_schema, + arrow_dictionary_memo, + arrow_buffer, + arrow_options->memory_pool); + if (garrow::check(error, arrow_record_batch, "[cuda][buffer][read-record-batch]")) { return garrow_record_batch_new_raw(&(*arrow_record_batch)); } else { return NULL; @@ -482,12 +465,8 @@ garrow_cuda_buffer_read_record_batch(GArrowCUDABuffer *buffer, } else { auto arrow_pool = arrow::default_memory_pool(); auto arrow_record_batch = - arrow::cuda::ReadRecordBatch(arrow_schema, - nullptr, - arrow_buffer, - arrow_pool); - if (garrow::check(error, arrow_record_batch, - "[cuda][buffer][read-record-batch]")) { + arrow::cuda::ReadRecordBatch(arrow_schema, nullptr, arrow_buffer, arrow_pool); + if (garrow::check(error, arrow_record_batch, "[cuda][buffer][read-record-batch]")) { return garrow_record_batch_new_raw(&(*arrow_record_batch)); } else { return NULL; @@ -495,10 +474,7 @@ garrow_cuda_buffer_read_record_batch(GArrowCUDABuffer *buffer, } } - -G_DEFINE_TYPE(GArrowCUDAHostBuffer, - garrow_cuda_host_buffer, - GARROW_TYPE_MUTABLE_BUFFER) +G_DEFINE_TYPE(GArrowCUDAHostBuffer, garrow_cuda_host_buffer, GARROW_TYPE_MUTABLE_BUFFER) static void garrow_cuda_host_buffer_init(GArrowCUDAHostBuffer *object) @@ -534,8 +510,8 @@ garrow_cuda_host_buffer_new(gint gpu_number, gint64 size, GError **error) } } - -typedef struct GArrowCUDAIPCMemoryHandlePrivate_ { +typedef struct GArrowCUDAIPCMemoryHandlePrivate_ +{ std::shared_ptr ipc_memory_handle; } GArrowCUDAIPCMemoryHandlePrivate; @@ -547,9 +523,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowCUDAIPCMemoryHandle, garrow_cuda_ipc_memory_handle, G_TYPE_OBJECT) -#define GARROW_CUDA_IPC_MEMORY_HANDLE_GET_PRIVATE(object) \ - static_cast( \ - garrow_cuda_ipc_memory_handle_get_instance_private( \ +#define GARROW_CUDA_IPC_MEMORY_HANDLE_GET_PRIVATE(object) \ + static_cast( \ + garrow_cuda_ipc_memory_handle_get_instance_private( \ GARROW_CUDA_IPC_MEMORY_HANDLE(object))) static void @@ -573,7 +549,8 @@ garrow_cuda_ipc_memory_handle_set_property(GObject *object, switch (prop_id) { case PROP_IPC_MEMORY_HANDLE: priv->ipc_memory_handle = - *static_cast *>(g_value_get_pointer(value)); + *static_cast *>( + g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -606,7 +583,7 @@ garrow_cuda_ipc_memory_handle_class_init(GArrowCUDAIPCMemoryHandleClass *klass) auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_cuda_ipc_memory_handle_finalize; + gobject_class->finalize = garrow_cuda_ipc_memory_handle_finalize; gobject_class->set_property = garrow_cuda_ipc_memory_handle_set_property; gobject_class->get_property = garrow_cuda_ipc_memory_handle_get_property; @@ -615,11 +592,11 @@ garrow_cuda_ipc_memory_handle_class_init(GArrowCUDAIPCMemoryHandleClass *klass) * * Since: 0.8.0 */ - spec = g_param_spec_pointer("ipc-memory-handle", - "IPC Memory Handle", - "The raw std::shared_ptr", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "ipc-memory-handle", + "IPC Memory Handle", + "The raw std::shared_ptr", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_IPC_MEMORY_HANDLE, spec); } @@ -635,9 +612,7 @@ garrow_cuda_ipc_memory_handle_class_init(GArrowCUDAIPCMemoryHandleClass *klass) * Since: 0.8.0 */ GArrowCUDAIPCMemoryHandle * -garrow_cuda_ipc_memory_handle_new(const guint8 *data, - gsize size, - GError **error) +garrow_cuda_ipc_memory_handle_new(const guint8 *data, gsize size, GError **error) { auto arrow_handle = arrow::cuda::CudaIpcMemHandle::FromBuffer(data); if (garrow::check(error, arrow_handle, "[cuda][ipc-memory-handle][new]")) { @@ -660,13 +635,11 @@ garrow_cuda_ipc_memory_handle_new(const guint8 *data, * Since: 0.8.0 */ GArrowBuffer * -garrow_cuda_ipc_memory_handle_serialize(GArrowCUDAIPCMemoryHandle *handle, - GError **error) +garrow_cuda_ipc_memory_handle_serialize(GArrowCUDAIPCMemoryHandle *handle, GError **error) { auto arrow_handle = garrow_cuda_ipc_memory_handle_get_raw(handle); auto arrow_buffer = arrow_handle->Serialize(arrow::default_memory_pool()); - if (garrow::check(error, arrow_buffer, - "[cuda][ipc-memory-handle][serialize]")) { + if (garrow::check(error, arrow_buffer, "[cuda][ipc-memory-handle][serialize]")) { return garrow_buffer_new_raw(&(*arrow_buffer)); } else { return NULL; @@ -674,7 +647,8 @@ garrow_cuda_ipc_memory_handle_serialize(GArrowCUDAIPCMemoryHandle *handle, } static GArrowBuffer * -garrow_cuda_buffer_input_stream_buffer_new_raw_readable_interface(std::shared_ptr *arrow_buffer) +garrow_cuda_buffer_input_stream_buffer_new_raw_readable_interface( + std::shared_ptr *arrow_buffer) { auto arrow_cuda_buffer = reinterpret_cast *>(arrow_buffer); @@ -695,17 +669,15 @@ garrow_cuda_buffer_input_stream_readable_interface_init(GArrowReadableInterface { iface->buffer_new_raw = garrow_cuda_buffer_input_stream_buffer_new_raw_readable_interface; - iface->get_raw = - garrow_cuda_buffer_input_stream_get_raw_readable_interface; + iface->get_raw = garrow_cuda_buffer_input_stream_get_raw_readable_interface; } G_DEFINE_TYPE_WITH_CODE( GArrowCUDABufferInputStream, garrow_cuda_buffer_input_stream, GARROW_TYPE_BUFFER_INPUT_STREAM, - G_IMPLEMENT_INTERFACE( - GARROW_TYPE_READABLE, - garrow_cuda_buffer_input_stream_readable_interface_init)) + G_IMPLEMENT_INTERFACE(GARROW_TYPE_READABLE, + garrow_cuda_buffer_input_stream_readable_interface_init)) static void garrow_cuda_buffer_input_stream_init(GArrowCUDABufferInputStream *object) @@ -730,12 +702,10 @@ GArrowCUDABufferInputStream * garrow_cuda_buffer_input_stream_new(GArrowCUDABuffer *buffer) { auto arrow_buffer = garrow_cuda_buffer_get_raw(buffer); - auto arrow_reader = - std::make_shared(arrow_buffer); + auto arrow_reader = std::make_shared(arrow_buffer); return garrow_cuda_buffer_input_stream_new_raw(&arrow_reader); } - G_DEFINE_TYPE(GArrowCUDABufferOutputStream, garrow_cuda_buffer_output_stream, GARROW_TYPE_OUTPUT_STREAM) @@ -763,8 +733,7 @@ GArrowCUDABufferOutputStream * garrow_cuda_buffer_output_stream_new(GArrowCUDABuffer *buffer) { auto arrow_buffer = garrow_cuda_buffer_get_raw(buffer); - auto arrow_writer = - std::make_shared(arrow_buffer); + auto arrow_writer = std::make_shared(arrow_buffer); return garrow_cuda_buffer_output_stream_new_raw(&arrow_writer); } @@ -828,15 +797,13 @@ garrow_cuda_buffer_output_stream_get_buffered_size(GArrowCUDABufferOutputStream return arrow_stream->num_bytes_buffered(); } - G_END_DECLS GArrowCUDAContext * garrow_cuda_context_new_raw(std::shared_ptr *arrow_context) { - return GARROW_CUDA_CONTEXT(g_object_new(GARROW_CUDA_TYPE_CONTEXT, - "context", arrow_context, - NULL)); + return GARROW_CUDA_CONTEXT( + g_object_new(GARROW_CUDA_TYPE_CONTEXT, "context", arrow_context, NULL)); } std::shared_ptr @@ -850,10 +817,12 @@ garrow_cuda_context_get_raw(GArrowCUDAContext *context) } GArrowCUDAIPCMemoryHandle * -garrow_cuda_ipc_memory_handle_new_raw(std::shared_ptr *arrow_handle) +garrow_cuda_ipc_memory_handle_new_raw( + std::shared_ptr *arrow_handle) { auto handle = g_object_new(GARROW_CUDA_TYPE_IPC_MEMORY_HANDLE, - "ipc-memory-handle", arrow_handle, + "ipc-memory-handle", + arrow_handle, NULL); return GARROW_CUDA_IPC_MEMORY_HANDLE(handle); } @@ -871,9 +840,8 @@ garrow_cuda_ipc_memory_handle_get_raw(GArrowCUDAIPCMemoryHandle *handle) GArrowCUDABuffer * garrow_cuda_buffer_new_raw(std::shared_ptr *arrow_buffer) { - return GARROW_CUDA_BUFFER(g_object_new(GARROW_CUDA_TYPE_BUFFER, - "buffer", arrow_buffer, - NULL)); + return GARROW_CUDA_BUFFER( + g_object_new(GARROW_CUDA_TYPE_BUFFER, "buffer", arrow_buffer, NULL)); } std::shared_ptr @@ -887,11 +855,10 @@ garrow_cuda_buffer_get_raw(GArrowCUDABuffer *buffer) } GArrowCUDAHostBuffer * -garrow_cuda_host_buffer_new_raw(std::shared_ptr *arrow_buffer) +garrow_cuda_host_buffer_new_raw( + std::shared_ptr *arrow_buffer) { - auto buffer = g_object_new(GARROW_CUDA_TYPE_HOST_BUFFER, - "buffer", arrow_buffer, - NULL); + auto buffer = g_object_new(GARROW_CUDA_TYPE_HOST_BUFFER, "buffer", arrow_buffer, NULL); return GARROW_CUDA_HOST_BUFFER(buffer); } @@ -906,10 +873,12 @@ garrow_cuda_host_buffer_get_raw(GArrowCUDAHostBuffer *buffer) } GArrowCUDABufferInputStream * -garrow_cuda_buffer_input_stream_new_raw(std::shared_ptr *arrow_reader) +garrow_cuda_buffer_input_stream_new_raw( + std::shared_ptr *arrow_reader) { auto input_stream = g_object_new(GARROW_CUDA_TYPE_BUFFER_INPUT_STREAM, - "input-stream", arrow_reader, + "input-stream", + arrow_reader, NULL); return GARROW_CUDA_BUFFER_INPUT_STREAM(input_stream); } @@ -920,16 +889,17 @@ garrow_cuda_buffer_input_stream_get_raw(GArrowCUDABufferInputStream *input_strea if (!input_stream) return nullptr; - auto arrow_reader = - garrow_input_stream_get_raw(GARROW_INPUT_STREAM(input_stream)); + auto arrow_reader = garrow_input_stream_get_raw(GARROW_INPUT_STREAM(input_stream)); return std::static_pointer_cast(arrow_reader); } GArrowCUDABufferOutputStream * -garrow_cuda_buffer_output_stream_new_raw(std::shared_ptr *arrow_writer) +garrow_cuda_buffer_output_stream_new_raw( + std::shared_ptr *arrow_writer) { auto output_stream = g_object_new(GARROW_CUDA_TYPE_BUFFER_OUTPUT_STREAM, - "output-stream", arrow_writer, + "output-stream", + arrow_writer, NULL); return GARROW_CUDA_BUFFER_OUTPUT_STREAM(output_stream); } @@ -940,7 +910,6 @@ garrow_cuda_buffer_output_stream_get_raw(GArrowCUDABufferOutputStream *output_st if (!output_stream) return nullptr; - auto arrow_writer = - garrow_output_stream_get_raw(GARROW_OUTPUT_STREAM(output_stream)); + auto arrow_writer = garrow_output_stream_get_raw(GARROW_OUTPUT_STREAM(output_stream)); return std::static_pointer_cast(arrow_writer); } diff --git a/c_glib/arrow-cuda-glib/cuda.h b/c_glib/arrow-cuda-glib/cuda.h index 3c98daeaf758d..863743a620bf8 100644 --- a/c_glib/arrow-cuda-glib/cuda.h +++ b/c_glib/arrow-cuda-glib/cuda.h @@ -35,22 +35,16 @@ struct _GArrowCUDADeviceManagerClass }; #define GARROW_CUDA_TYPE_CONTEXT (garrow_cuda_context_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowCUDAContext, - garrow_cuda_context, - GARROW_CUDA, - CONTEXT, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowCUDAContext, garrow_cuda_context, GARROW_CUDA, CONTEXT, GObject) struct _GArrowCUDAContextClass { GObjectClass parent_class; }; #define GARROW_CUDA_TYPE_BUFFER (garrow_cuda_buffer_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowCUDABuffer, - garrow_cuda_buffer, - GARROW_CUDA, - BUFFER, - GArrowBuffer) +G_DECLARE_DERIVABLE_TYPE( + GArrowCUDABuffer, garrow_cuda_buffer, GARROW_CUDA, BUFFER, GArrowBuffer) struct _GArrowCUDABufferClass { GArrowBufferClass parent_class; @@ -67,8 +61,7 @@ struct _GArrowCUDAHostBufferClass GArrowMutableBufferClass parent_class; }; -#define GARROW_CUDA_TYPE_IPC_MEMORY_HANDLE \ - (garrow_cuda_ipc_memory_handle_get_type()) +#define GARROW_CUDA_TYPE_IPC_MEMORY_HANDLE (garrow_cuda_ipc_memory_handle_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowCUDAIPCMemoryHandle, garrow_cuda_ipc_memory_handle, GARROW_CUDA, @@ -79,8 +72,7 @@ struct _GArrowCUDAIPCMemoryHandleClass GObjectClass parent_class; }; -#define GARROW_CUDA_TYPE_BUFFER_INPUT_STREAM \ - (garrow_cuda_buffer_input_stream_get_type()) +#define GARROW_CUDA_TYPE_BUFFER_INPUT_STREAM (garrow_cuda_buffer_input_stream_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowCUDABufferInputStream, garrow_cuda_buffer_input_stream, GARROW_CUDA, @@ -91,7 +83,7 @@ struct _GArrowCUDABufferInputStreamClass GArrowBufferInputStreamClass parent_class; }; -#define GARROW_CUDA_TYPE_BUFFER_OUTPUT_STREAM \ +#define GARROW_CUDA_TYPE_BUFFER_OUTPUT_STREAM \ (garrow_cuda_buffer_output_stream_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowCUDABufferOutputStream, garrow_cuda_buffer_output_stream, @@ -116,11 +108,8 @@ garrow_cuda_device_manager_get_n_devices(GArrowCUDADeviceManager *manager); gint64 garrow_cuda_context_get_allocated_size(GArrowCUDAContext *context); - GArrowCUDABuffer * -garrow_cuda_buffer_new(GArrowCUDAContext *context, - gint64 size, - GError **error); +garrow_cuda_buffer_new(GArrowCUDAContext *context, gint64 size, GError **error); GArrowCUDABuffer * garrow_cuda_buffer_new_ipc(GArrowCUDAContext *context, GArrowCUDAIPCMemoryHandle *handle, @@ -140,8 +129,7 @@ garrow_cuda_buffer_copy_from_host(GArrowCUDABuffer *buffer, gint64 size, GError **error); GArrowCUDAIPCMemoryHandle * -garrow_cuda_buffer_export(GArrowCUDABuffer *buffer, - GError **error); +garrow_cuda_buffer_export(GArrowCUDABuffer *buffer, GError **error); GArrowCUDAContext * garrow_cuda_buffer_get_context(GArrowCUDABuffer *buffer); GArrowRecordBatch * @@ -150,16 +138,11 @@ garrow_cuda_buffer_read_record_batch(GArrowCUDABuffer *buffer, GArrowReadOptions *options, GError **error); - GArrowCUDAHostBuffer * -garrow_cuda_host_buffer_new(gint gpu_number, - gint64 size, - GError **error); +garrow_cuda_host_buffer_new(gint gpu_number, gint64 size, GError **error); GArrowCUDAIPCMemoryHandle * -garrow_cuda_ipc_memory_handle_new(const guint8 *data, - gsize size, - GError **error); +garrow_cuda_ipc_memory_handle_new(const guint8 *data, gsize size, GError **error); GArrowBuffer * garrow_cuda_ipc_memory_handle_serialize(GArrowCUDAIPCMemoryHandle *handle, diff --git a/c_glib/arrow-cuda-glib/cuda.hpp b/c_glib/arrow-cuda-glib/cuda.hpp index 0f8985a9de4f5..fc0bc4f0bcb6d 100644 --- a/c_glib/arrow-cuda-glib/cuda.hpp +++ b/c_glib/arrow-cuda-glib/cuda.hpp @@ -29,7 +29,8 @@ std::shared_ptr garrow_cuda_context_get_raw(GArrowCUDAContext *context); GArrowCUDAIPCMemoryHandle * -garrow_cuda_ipc_memory_handle_new_raw(std::shared_ptr *arrow_handle); +garrow_cuda_ipc_memory_handle_new_raw( + std::shared_ptr *arrow_handle); std::shared_ptr garrow_cuda_ipc_memory_handle_get_raw(GArrowCUDAIPCMemoryHandle *handle); @@ -39,16 +40,19 @@ std::shared_ptr garrow_cuda_buffer_get_raw(GArrowCUDABuffer *buffer); GArrowCUDAHostBuffer * -garrow_cuda_host_buffer_new_raw(std::shared_ptr *arrow_buffer); +garrow_cuda_host_buffer_new_raw( + std::shared_ptr *arrow_buffer); std::shared_ptr garrow_cuda_host_buffer_get_raw(GArrowCUDAHostBuffer *buffer); GArrowCUDABufferInputStream * -garrow_cuda_buffer_input_stream_new_raw(std::shared_ptr *arrow_reader); +garrow_cuda_buffer_input_stream_new_raw( + std::shared_ptr *arrow_reader); std::shared_ptr garrow_cuda_buffer_input_stream_get_raw(GArrowCUDABufferInputStream *input_stream); GArrowCUDABufferOutputStream * -garrow_cuda_buffer_output_stream_new_raw(std::shared_ptr *arrow_writer); +garrow_cuda_buffer_output_stream_new_raw( + std::shared_ptr *arrow_writer); std::shared_ptr garrow_cuda_buffer_output_stream_get_raw(GArrowCUDABufferOutputStream *output_stream); diff --git a/c_glib/arrow-dataset-glib/dataset-definition.h b/c_glib/arrow-dataset-glib/dataset-definition.h index d0e71b7fbdd7e..f278b05a135f5 100644 --- a/c_glib/arrow-dataset-glib/dataset-definition.h +++ b/c_glib/arrow-dataset-glib/dataset-definition.h @@ -24,11 +24,7 @@ G_BEGIN_DECLS #define GADATASET_TYPE_DATASET (gadataset_dataset_get_type()) -G_DECLARE_DERIVABLE_TYPE(GADatasetDataset, - gadataset_dataset, - GADATASET, - DATASET, - GObject) +G_DECLARE_DERIVABLE_TYPE(GADatasetDataset, gadataset_dataset, GADATASET, DATASET, GObject) struct _GADatasetDatasetClass { GObjectClass parent_class; diff --git a/c_glib/arrow-dataset-glib/dataset-factory.cpp b/c_glib/arrow-dataset-glib/dataset-factory.cpp index 97cab555420fb..cc664176b64cd 100644 --- a/c_glib/arrow-dataset-glib/dataset-factory.cpp +++ b/c_glib/arrow-dataset-glib/dataset-factory.cpp @@ -44,7 +44,8 @@ G_BEGIN_DECLS * Since: 5.0.0 */ -struct GADatasetFinishOptionsPrivate { +struct GADatasetFinishOptionsPrivate +{ arrow::dataset::FinishOptions options; GArrowSchema *schema; }; @@ -60,10 +61,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GADatasetFinishOptions, gadataset_finish_options, G_TYPE_OBJECT) -#define GADATASET_FINISH_OPTIONS_GET_PRIVATE(obj) \ - static_cast( \ - gadataset_finish_options_get_instance_private( \ - GADATASET_FINISH_OPTIONS(obj))) +#define GADATASET_FINISH_OPTIONS_GET_PRIVATE(obj) \ + static_cast( \ + gadataset_finish_options_get_instance_private(GADATASET_FINISH_OPTIONS(obj))) static void gadataset_finish_options_finalize(GObject *object) @@ -161,7 +161,7 @@ static void gadataset_finish_options_init(GADatasetFinishOptions *object) { auto priv = GADATASET_FINISH_OPTIONS_GET_PRIVATE(object); - new(&priv->options) arrow::dataset::FinishOptions; + new (&priv->options) arrow::dataset::FinishOptions; } static void @@ -174,11 +174,11 @@ gadataset_finish_options_class_init(GADatasetFinishOptionsClass *klass) gobject_class->get_property = gadataset_finish_options_get_property; GParamSpec *spec; - spec = g_param_spec_pointer("finish-options", - "Finish options", - "The raw arrow::dataset::FinishOptions *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "finish-options", + "Finish options", + "The raw arrow::dataset::FinishOptions *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_FINISH_OPTIONS, spec); /** @@ -240,8 +240,8 @@ gadataset_finish_options_new(void) return gadataset_finish_options_new_raw(nullptr); } - -typedef struct GADatasetDatasetFactoryPrivate_ { +typedef struct GADatasetDatasetFactoryPrivate_ +{ std::shared_ptr factory; } GADatasetDatasetFactoryPrivate; @@ -253,10 +253,9 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GADatasetDatasetFactory, gadataset_dataset_factory, G_TYPE_OBJECT) -#define GADATASET_DATASET_FACTORY_GET_PRIVATE(obj) \ - static_cast( \ - gadataset_dataset_factory_get_instance_private( \ - GADATASET_DATASET_FACTORY(obj))) +#define GADATASET_DATASET_FACTORY_GET_PRIVATE(obj) \ + static_cast( \ + gadataset_dataset_factory_get_instance_private(GADATASET_DATASET_FACTORY(obj))) static void gadataset_dataset_factory_finalize(GObject *object) @@ -295,23 +294,23 @@ static void gadataset_dataset_factory_init(GADatasetDatasetFactory *object) { auto priv = GADATASET_DATASET_FACTORY_GET_PRIVATE(object); - new(&priv->factory) std::shared_ptr; + new (&priv->factory) std::shared_ptr; } static void gadataset_dataset_factory_class_init(GADatasetDatasetFactoryClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = gadataset_dataset_factory_finalize; + gobject_class->finalize = gadataset_dataset_factory_finalize; gobject_class->set_property = gadataset_dataset_factory_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("dataset-factory", - "Dataset factory", - "The raw " - "std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "dataset-factory", + "Dataset factory", + "The raw " + "std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_DATASET_FACTORY, spec); } @@ -345,8 +344,8 @@ gadataset_dataset_factory_finish(GADatasetDatasetFactory *factory, } } - -typedef struct GADatasetFileSystemDatasetFactoryPrivate_ { +typedef struct GADatasetFileSystemDatasetFactoryPrivate_ +{ GADatasetFileFormat *format; GArrowFileSystem *file_system; GADatasetPartitioning *partitioning; @@ -365,9 +364,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GADatasetFileSystemDatasetFactory, gadataset_file_system_dataset_factory, GADATASET_TYPE_DATASET_FACTORY) -#define GADATASET_FILE_SYSTEM_DATASET_FACTORY_GET_PRIVATE(obj) \ - static_cast( \ - gadataset_file_system_dataset_factory_get_instance_private( \ +#define GADATASET_FILE_SYSTEM_DATASET_FACTORY_GET_PRIVATE(obj) \ + static_cast( \ + gadataset_file_system_dataset_factory_get_instance_private( \ GADATASET_FILE_SYSTEM_DATASET_FACTORY(obj))) static void @@ -395,8 +394,7 @@ gadataset_file_system_dataset_factory_dispose(GObject *object) priv->files = NULL; } - G_OBJECT_CLASS( - gadataset_file_system_dataset_factory_parent_class)->dispose(object); + G_OBJECT_CLASS(gadataset_file_system_dataset_factory_parent_class)->dispose(object); } static void @@ -404,8 +402,7 @@ gadataset_file_system_dataset_factory_finalize(GObject *object) { auto priv = GADATASET_FILE_SYSTEM_DATASET_FACTORY_GET_PRIVATE(object); priv->options.~FileSystemFactoryOptions(); - G_OBJECT_CLASS( - gadataset_file_system_dataset_factory_parent_class)->finalize(object); + G_OBJECT_CLASS(gadataset_file_system_dataset_factory_parent_class)->finalize(object); } static void @@ -430,8 +427,7 @@ gadataset_file_system_dataset_factory_set_property(GObject *object, if (partitioning) { g_object_ref(partitioning); priv->partitioning = GADATASET_PARTITIONING(partitioning); - priv->options.partitioning = - gadataset_partitioning_get_raw(priv->partitioning); + priv->options.partitioning = gadataset_partitioning_get_raw(priv->partitioning); } else { priv->options.partitioning = arrow::dataset::Partitioning::Default(); } @@ -477,11 +473,10 @@ gadataset_file_system_dataset_factory_get_property(GObject *object, } static void -gadataset_file_system_dataset_factory_init( - GADatasetFileSystemDatasetFactory *object) +gadataset_file_system_dataset_factory_init(GADatasetFileSystemDatasetFactory *object) { auto priv = GADATASET_FILE_SYSTEM_DATASET_FACTORY_GET_PRIVATE(object); - new(&priv->options) arrow::dataset::FileSystemFactoryOptions; + new (&priv->options) arrow::dataset::FileSystemFactoryOptions; } static void @@ -489,8 +484,8 @@ gadataset_file_system_dataset_factory_class_init( GADatasetFileSystemDatasetFactoryClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = gadataset_file_system_dataset_factory_dispose; - gobject_class->finalize = gadataset_file_system_dataset_factory_finalize; + gobject_class->dispose = gadataset_file_system_dataset_factory_dispose; + gobject_class->finalize = gadataset_file_system_dataset_factory_finalize; gobject_class->set_property = gadataset_file_system_dataset_factory_set_property; gobject_class->get_property = gadataset_file_system_dataset_factory_get_property; @@ -502,12 +497,12 @@ gadataset_file_system_dataset_factory_class_init( * * Since: 5.0.0 */ - spec = g_param_spec_object("format", - "Format", - "Format passed to GADatasetFileSystemDataset", - GADATASET_TYPE_FILE_FORMAT, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "format", + "Format", + "Format passed to GADatasetFileSystemDataset", + GADATASET_TYPE_FILE_FORMAT, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_FORMAT, spec); /** @@ -568,9 +563,7 @@ GADatasetFileSystemDatasetFactory * gadataset_file_system_dataset_factory_new(GADatasetFileFormat *format) { return GADATASET_FILE_SYSTEM_DATASET_FACTORY( - g_object_new(GADATASET_TYPE_FILE_SYSTEM_DATASET_FACTORY, - "format", format, - NULL)); + g_object_new(GADATASET_TYPE_FILE_SYSTEM_DATASET_FACTORY, "format", format, NULL)); } /** @@ -592,9 +585,7 @@ gadataset_file_system_dataset_factory_set_file_system( const gchar *context = "[file-system-dataset-factory][set-file-system]"; auto priv = GADATASET_FILE_SYSTEM_DATASET_FACTORY_GET_PRIVATE(factory); if (priv->file_system) { - garrow::check(error, - arrow::Status::Invalid("file system is already set"), - context); + garrow::check(error, arrow::Status::Invalid("file system is already set"), context); return FALSE; } priv->file_system = file_system; @@ -614,21 +605,16 @@ gadataset_file_system_dataset_factory_set_file_system( */ gboolean gadataset_file_system_dataset_factory_set_file_system_uri( - GADatasetFileSystemDatasetFactory *factory, - const gchar *uri, - GError **error) + GADatasetFileSystemDatasetFactory *factory, const gchar *uri, GError **error) { const gchar *context = "[file-system-dataset-factory][set-file-system-uri]"; auto priv = GADATASET_FILE_SYSTEM_DATASET_FACTORY_GET_PRIVATE(factory); if (priv->file_system) { - garrow::check(error, - arrow::Status::Invalid("file system is already set"), - context); + garrow::check(error, arrow::Status::Invalid("file system is already set"), context); return FALSE; } std::string internal_path; - auto arrow_file_system_result = - arrow::fs::FileSystemFromUri(uri, &internal_path); + auto arrow_file_system_result = arrow::fs::FileSystemFromUri(uri, &internal_path); if (!garrow::check(error, arrow_file_system_result, context)) { return FALSE; } @@ -654,17 +640,14 @@ gadataset_file_system_dataset_factory_set_file_system_uri( * Since: 5.0.0 */ gboolean -gadataset_file_system_dataset_factory_add_path( - GADatasetFileSystemDatasetFactory *factory, - const gchar *path, - GError **error) +gadataset_file_system_dataset_factory_add_path(GADatasetFileSystemDatasetFactory *factory, + const gchar *path, + GError **error) { const gchar *context = "[file-system-dataset-factory][add-path]"; auto priv = GADATASET_FILE_SYSTEM_DATASET_FACTORY_GET_PRIVATE(factory); if (!priv->file_system) { - garrow::check(error, - arrow::Status::Invalid("file system isn't set"), - context); + garrow::check(error, arrow::Status::Invalid("file system isn't set"), context); return FALSE; } auto arrow_file_system = garrow_file_system_get_raw(priv->file_system); @@ -689,25 +672,20 @@ gadataset_file_system_dataset_factory_add_path( * Since: 5.0.0 */ GADatasetFileSystemDataset * -gadataset_file_system_dataset_factory_finish( - GADatasetFileSystemDatasetFactory *factory, - GADatasetFinishOptions *options, - GError **error) +gadataset_file_system_dataset_factory_finish(GADatasetFileSystemDatasetFactory *factory, + GADatasetFinishOptions *options, + GError **error) { const gchar *context = "[file-system-dataset-factory][finish]"; auto priv = GADATASET_FILE_SYSTEM_DATASET_FACTORY_GET_PRIVATE(factory); if (!priv->file_system) { - garrow::check(error, - arrow::Status::Invalid("file system isn't set"), - context); + garrow::check(error, arrow::Status::Invalid("file system isn't set"), context); return NULL; } auto arrow_file_system = garrow_file_system_get_raw(priv->file_system); auto arrow_format = gadataset_file_format_get_raw(priv->format); - arrow::Result> - arrow_factory_result; - if (priv->files && - !priv->files->next && + arrow::Result> arrow_factory_result; + if (priv->files && !priv->files->next && garrow_file_info_is_dir(GARROW_FILE_INFO(priv->files->data))) { auto file = GARROW_FILE_INFO(priv->files->data); arrow::fs::FileSelector arrow_selector; @@ -744,24 +722,25 @@ gadataset_file_system_dataset_factory_finish( return NULL; } auto arrow_dataset = *arrow_dataset_result; - return GADATASET_FILE_SYSTEM_DATASET( - gadataset_dataset_new_raw(&arrow_dataset, - "dataset", &arrow_dataset, - "file-system", priv->file_system, - "format", priv->format, - "partitioning", priv->partitioning, - NULL)); + return GADATASET_FILE_SYSTEM_DATASET(gadataset_dataset_new_raw(&arrow_dataset, + "dataset", + &arrow_dataset, + "file-system", + priv->file_system, + "format", + priv->format, + "partitioning", + priv->partitioning, + NULL)); } - G_END_DECLS GADatasetFinishOptions * gadataset_finish_options_new_raw(arrow::dataset::FinishOptions *options) { - return GADATASET_FINISH_OPTIONS(g_object_new(GADATASET_TYPE_FINISH_OPTIONS, - "finish-options", options, - NULL)); + return GADATASET_FINISH_OPTIONS( + g_object_new(GADATASET_TYPE_FINISH_OPTIONS, "finish-options", options, NULL)); } arrow::dataset::FinishOptions * diff --git a/c_glib/arrow-dataset-glib/dataset-factory.h b/c_glib/arrow-dataset-glib/dataset-factory.h index ce15babba4ac1..1dc875837fe21 100644 --- a/c_glib/arrow-dataset-glib/dataset-factory.h +++ b/c_glib/arrow-dataset-glib/dataset-factory.h @@ -24,11 +24,8 @@ G_BEGIN_DECLS #define GADATASET_TYPE_FINISH_OPTIONS (gadataset_finish_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GADatasetFinishOptions, - gadataset_finish_options, - GADATASET, - FINISH_OPTIONS, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GADatasetFinishOptions, gadataset_finish_options, GADATASET, FINISH_OPTIONS, GObject) struct _GADatasetFinishOptionsClass { GObjectClass parent_class; @@ -39,11 +36,8 @@ GADatasetFinishOptions * gadataset_finish_options_new(void); #define GADATASET_TYPE_DATASET_FACTORY (gadataset_dataset_factory_get_type()) -G_DECLARE_DERIVABLE_TYPE(GADatasetDatasetFactory, - gadataset_dataset_factory, - GADATASET, - DATASET_FACTORY, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GADatasetDatasetFactory, gadataset_dataset_factory, GADATASET, DATASET_FACTORY, GObject) struct _GADatasetDatasetFactoryClass { GObjectClass parent_class; @@ -55,8 +49,7 @@ gadataset_dataset_factory_finish(GADatasetDatasetFactory *factory, GADatasetFinishOptions *options, GError **error); - -#define GADATASET_TYPE_FILE_SYSTEM_DATASET_FACTORY \ +#define GADATASET_TYPE_FILE_SYSTEM_DATASET_FACTORY \ (gadataset_file_system_dataset_factory_get_type()) G_DECLARE_DERIVABLE_TYPE(GADatasetFileSystemDatasetFactory, gadataset_file_system_dataset_factory, @@ -79,16 +72,13 @@ gadataset_file_system_dataset_factory_set_file_system( GError **error); gboolean gadataset_file_system_dataset_factory_set_file_system_uri( - GADatasetFileSystemDatasetFactory *factory, - const gchar *uri, - GError **error); + GADatasetFileSystemDatasetFactory *factory, const gchar *uri, GError **error); GARROW_AVAILABLE_IN_5_0 gboolean -gadataset_file_system_dataset_factory_add_path( - GADatasetFileSystemDatasetFactory *factory, - const gchar *path, - GError **error); +gadataset_file_system_dataset_factory_add_path(GADatasetFileSystemDatasetFactory *factory, + const gchar *path, + GError **error); /* GARROW_AVAILABLE_IN_5_0 gboolean @@ -106,10 +96,8 @@ gadataset_file_system_dataset_factory_add_selector( GARROW_AVAILABLE_IN_5_0 GADatasetFileSystemDataset * -gadataset_file_system_dataset_factory_finish( - GADatasetFileSystemDatasetFactory *factory, - GADatasetFinishOptions *options, - GError **error); - +gadataset_file_system_dataset_factory_finish(GADatasetFileSystemDatasetFactory *factory, + GADatasetFinishOptions *options, + GError **error); G_END_DECLS diff --git a/c_glib/arrow-dataset-glib/dataset.cpp b/c_glib/arrow-dataset-glib/dataset.cpp index 8613bedad4295..704d6b589ee94 100644 --- a/c_glib/arrow-dataset-glib/dataset.cpp +++ b/c_glib/arrow-dataset-glib/dataset.cpp @@ -45,7 +45,8 @@ G_BEGIN_DECLS * Since: 5.0.0 */ -typedef struct GADatasetDatasetPrivate_ { +typedef struct GADatasetDatasetPrivate_ +{ std::shared_ptr dataset; } GADatasetDatasetPrivate; @@ -53,14 +54,11 @@ enum { PROP_DATASET = 1, }; -G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GADatasetDataset, - gadataset_dataset, - G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GADatasetDataset, gadataset_dataset, G_TYPE_OBJECT) -#define GADATASET_DATASET_GET_PRIVATE(obj) \ - static_cast( \ - gadataset_dataset_get_instance_private( \ - GADATASET_DATASET(obj))) +#define GADATASET_DATASET_GET_PRIVATE(obj) \ + static_cast( \ + gadataset_dataset_get_instance_private(GADATASET_DATASET(obj))) static void gadataset_dataset_finalize(GObject *object) @@ -80,9 +78,8 @@ gadataset_dataset_set_property(GObject *object, switch (prop_id) { case PROP_DATASET: - priv->dataset = - *static_cast *>( - g_value_get_pointer(value)); + priv->dataset = *static_cast *>( + g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -94,23 +91,23 @@ static void gadataset_dataset_init(GADatasetDataset *object) { auto priv = GADATASET_DATASET_GET_PRIVATE(object); - new(&priv->dataset) std::shared_ptr; + new (&priv->dataset) std::shared_ptr; } static void gadataset_dataset_class_init(GADatasetDatasetClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = gadataset_dataset_finalize; + gobject_class->finalize = gadataset_dataset_finalize; gobject_class->set_property = gadataset_dataset_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("dataset", - "Dataset", - "The raw " - "std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "dataset", + "Dataset", + "The raw " + "std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_DATASET, spec); } @@ -125,8 +122,7 @@ gadataset_dataset_class_init(GADatasetDatasetClass *klass) * Since: 5.0.0 */ GADatasetScannerBuilder * -gadataset_dataset_begin_scan(GADatasetDataset *dataset, - GError **error) +gadataset_dataset_begin_scan(GADatasetDataset *dataset, GError **error) { return gadataset_scanner_builder_new(dataset, error); } @@ -142,28 +138,21 @@ gadataset_dataset_begin_scan(GADatasetDataset *dataset, * Since: 5.0.0 */ GArrowTable * -gadataset_dataset_to_table(GADatasetDataset *dataset, - GError **error) +gadataset_dataset_to_table(GADatasetDataset *dataset, GError **error) { auto arrow_dataset = gadataset_dataset_get_raw(dataset); auto arrow_scanner_builder_result = arrow_dataset->NewScan(); - if (!garrow::check(error, - arrow_scanner_builder_result, - "[dataset][to-table]")) { + if (!garrow::check(error, arrow_scanner_builder_result, "[dataset][to-table]")) { return NULL; } auto arrow_scanner_builder = *arrow_scanner_builder_result; auto arrow_scanner_result = arrow_scanner_builder->Finish(); - if (!garrow::check(error, - arrow_scanner_result, - "[dataset][to-table]")) { + if (!garrow::check(error, arrow_scanner_result, "[dataset][to-table]")) { return NULL; } auto arrow_scanner = *arrow_scanner_result; auto arrow_table_result = arrow_scanner->ToTable(); - if (!garrow::check(error, - arrow_scanner_result, - "[dataset][to-table]")) { + if (!garrow::check(error, arrow_scanner_result, "[dataset][to-table]")) { return NULL; } return garrow_table_new_raw(&(*arrow_table_result)); @@ -187,8 +176,8 @@ gadataset_dataset_get_type_name(GADatasetDataset *dataset) return g_strndup(type_name.data(), type_name.size()); } - -typedef struct GADatasetFileSystemDatasetWriteOptionsPrivate_ { +typedef struct GADatasetFileSystemDatasetWriteOptionsPrivate_ +{ arrow::dataset::FileSystemDatasetWriteOptions options; GADatasetFileWriteOptions *file_write_options; GArrowFileSystem *file_system; @@ -208,9 +197,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GADatasetFileSystemDatasetWriteOptions, gadataset_file_system_dataset_write_options, G_TYPE_OBJECT) -#define GADATASET_FILE_SYSTEM_DATASET_WRITE_OPTIONS_GET_PRIVATE(obj) \ - static_cast( \ - gadataset_file_system_dataset_write_options_get_instance_private( \ +#define GADATASET_FILE_SYSTEM_DATASET_WRITE_OPTIONS_GET_PRIVATE(obj) \ + static_cast( \ + gadataset_file_system_dataset_write_options_get_instance_private( \ GADATASET_FILE_SYSTEM_DATASET_WRITE_OPTIONS(obj))) static void @@ -218,8 +207,8 @@ gadataset_file_system_dataset_write_options_finalize(GObject *object) { auto priv = GADATASET_FILE_SYSTEM_DATASET_WRITE_OPTIONS_GET_PRIVATE(object); priv->options.~FileSystemDatasetWriteOptions(); - G_OBJECT_CLASS(gadataset_file_system_dataset_write_options_parent_class)-> - finalize(object); + G_OBJECT_CLASS(gadataset_file_system_dataset_write_options_parent_class) + ->finalize(object); } static void @@ -242,8 +231,8 @@ gadataset_file_system_dataset_write_options_dispose(GObject *object) priv->partitioning = NULL; } - G_OBJECT_CLASS(gadataset_file_system_dataset_write_options_parent_class)-> - dispose(object); + G_OBJECT_CLASS(gadataset_file_system_dataset_write_options_parent_class) + ->dispose(object); } static void @@ -264,8 +253,7 @@ gadataset_file_system_dataset_write_options_set_property(GObject *object, auto old_file_write_options = priv->file_write_options; if (file_write_options) { g_object_ref(file_write_options); - priv->file_write_options = - GADATASET_FILE_WRITE_OPTIONS(file_write_options); + priv->file_write_options = GADATASET_FILE_WRITE_OPTIONS(file_write_options); priv->options.file_write_options = gadataset_file_write_options_get_raw(priv->file_write_options); } else { @@ -308,8 +296,7 @@ gadataset_file_system_dataset_write_options_set_property(GObject *object, if (partitioning) { g_object_ref(partitioning); priv->partitioning = GADATASET_PARTITIONING(partitioning); - priv->options.partitioning = - gadataset_partitioning_get_raw(priv->partitioning); + priv->options.partitioning = gadataset_partitioning_get_raw(priv->partitioning); } else { priv->options.partitioning = arrow::dataset::Partitioning::Default(); } @@ -368,7 +355,7 @@ gadataset_file_system_dataset_write_options_init( GADatasetFileSystemDatasetWriteOptions *object) { auto priv = GADATASET_FILE_SYSTEM_DATASET_WRITE_OPTIONS_GET_PRIVATE(object); - new(&(priv->options)) arrow::dataset::FileSystemDatasetWriteOptions; + new (&(priv->options)) arrow::dataset::FileSystemDatasetWriteOptions; priv->options.partitioning = arrow::dataset::Partitioning::Default(); } @@ -377,14 +364,10 @@ gadataset_file_system_dataset_write_options_class_init( GADatasetFileSystemDatasetWriteOptionsClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = - gadataset_file_system_dataset_write_options_finalize; - gobject_class->dispose = - gadataset_file_system_dataset_write_options_dispose; - gobject_class->set_property = - gadataset_file_system_dataset_write_options_set_property; - gobject_class->get_property = - gadataset_file_system_dataset_write_options_get_property; + gobject_class->finalize = gadataset_file_system_dataset_write_options_finalize; + gobject_class->dispose = gadataset_file_system_dataset_write_options_dispose; + gobject_class->set_property = gadataset_file_system_dataset_write_options_set_property; + gobject_class->get_property = gadataset_file_system_dataset_write_options_get_property; arrow::dataset::FileSystemDatasetWriteOptions default_options; GParamSpec *spec; @@ -493,12 +476,11 @@ GADatasetFileSystemDatasetWriteOptions * gadataset_file_system_dataset_write_options_new(void) { return GADATASET_FILE_SYSTEM_DATASET_WRITE_OPTIONS( - g_object_new(GADATASET_TYPE_FILE_SYSTEM_DATASET_WRITE_OPTIONS, - NULL)); + g_object_new(GADATASET_TYPE_FILE_SYSTEM_DATASET_WRITE_OPTIONS, NULL)); } - -typedef struct GADatasetFileSystemDatasetPrivate_ { +typedef struct GADatasetFileSystemDatasetPrivate_ +{ GADatasetFileFormat *format; GArrowFileSystem *file_system; GADatasetPartitioning *partitioning; @@ -514,9 +496,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GADatasetFileSystemDataset, gadataset_file_system_dataset, GADATASET_TYPE_DATASET) -#define GADATASET_FILE_SYSTEM_DATASET_GET_PRIVATE(obj) \ - static_cast( \ - gadataset_file_system_dataset_get_instance_private( \ +#define GADATASET_FILE_SYSTEM_DATASET_GET_PRIVATE(obj) \ + static_cast( \ + gadataset_file_system_dataset_get_instance_private( \ GADATASET_FILE_SYSTEM_DATASET(obj))) static void @@ -594,7 +576,7 @@ static void gadataset_file_system_dataset_class_init(GADatasetFileSystemDatasetClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = gadataset_file_system_dataset_dispose; + gobject_class->dispose = gadataset_file_system_dataset_dispose; gobject_class->set_property = gadataset_file_system_dataset_set_property; gobject_class->get_property = gadataset_file_system_dataset_get_property; @@ -606,15 +588,13 @@ gadataset_file_system_dataset_class_init(GADatasetFileSystemDatasetClass *klass) * * Since: 5.0.0 */ - spec = g_param_spec_object("format", - "Format", - "Format of the dataset", - GADATASET_TYPE_FILE_FORMAT, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property(gobject_class, - PROP_FILE_SYSTEM_DATASET_FORMAT, - spec); + spec = g_param_spec_object( + "format", + "Format", + "Format of the dataset", + GADATASET_TYPE_FILE_FORMAT, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property(gobject_class, PROP_FILE_SYSTEM_DATASET_FORMAT, spec); /** * GADatasetFileSystemDataset:file-system: @@ -623,12 +603,12 @@ gadataset_file_system_dataset_class_init(GADatasetFileSystemDatasetClass *klass) * * Since: 5.0.0 */ - spec = g_param_spec_object("file-system", - "File system", - "File system of the dataset", - GARROW_TYPE_FILE_SYSTEM, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "file-system", + "File system", + "File system of the dataset", + GARROW_TYPE_FILE_SYSTEM, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_FILE_SYSTEM_DATASET_FILE_SYSTEM, spec); @@ -640,12 +620,12 @@ gadataset_file_system_dataset_class_init(GADatasetFileSystemDatasetClass *klass) * * Since: 6.0.0 */ - spec = g_param_spec_object("partitioning", - "Partitioning", - "Partitioning of the dataset", - GADATASET_TYPE_PARTITIONING, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "partitioning", + "Partitioning", + "Partitioning of the dataset", + GADATASET_TYPE_PARTITIONING, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_FILE_SYSTEM_DATASET_PARTITIONING, spec); @@ -668,56 +648,42 @@ gadataset_file_system_dataset_write_scanner( GError **error) { auto arrow_scanner = gadataset_scanner_get_raw(scanner); - auto arrow_options = - gadataset_file_system_dataset_write_options_get_raw(options); - auto status = - arrow::dataset::FileSystemDataset::Write(*arrow_options, arrow_scanner); - return garrow::check(error, - status, - "[file-system-dataset][write-scanner]"); + auto arrow_options = gadataset_file_system_dataset_write_options_get_raw(options); + auto status = arrow::dataset::FileSystemDataset::Write(*arrow_options, arrow_scanner); + return garrow::check(error, status, "[file-system-dataset][write-scanner]"); } - G_END_DECLS GADatasetDataset * -gadataset_dataset_new_raw( - std::shared_ptr *arrow_dataset) +gadataset_dataset_new_raw(std::shared_ptr *arrow_dataset) { - return gadataset_dataset_new_raw(arrow_dataset, - "dataset", arrow_dataset, - NULL); + return gadataset_dataset_new_raw(arrow_dataset, "dataset", arrow_dataset, NULL); } GADatasetDataset * -gadataset_dataset_new_raw( - std::shared_ptr *arrow_dataset, - const gchar *first_property_name, - ...) +gadataset_dataset_new_raw(std::shared_ptr *arrow_dataset, + const gchar *first_property_name, + ...) { va_list args; va_start(args, first_property_name); - auto array = gadataset_dataset_new_raw_valist(arrow_dataset, - first_property_name, - args); + auto array = gadataset_dataset_new_raw_valist(arrow_dataset, first_property_name, args); va_end(args); return array; } GADatasetDataset * -gadataset_dataset_new_raw_valist( - std::shared_ptr *arrow_dataset, - const gchar *first_property_name, - va_list args) +gadataset_dataset_new_raw_valist(std::shared_ptr *arrow_dataset, + const gchar *first_property_name, + va_list args) { GType type = GADATASET_TYPE_DATASET; const auto type_name = (*arrow_dataset)->type_name(); if (type_name == "filesystem") { type = GADATASET_TYPE_FILE_SYSTEM_DATASET; } - return GADATASET_DATASET(g_object_new_valist(type, - first_property_name, - args)); + return GADATASET_DATASET(g_object_new_valist(type, first_property_name, args)); } std::shared_ptr diff --git a/c_glib/arrow-dataset-glib/dataset.h b/c_glib/arrow-dataset-glib/dataset.h index 6c003ca82c804..57f6c7729f073 100644 --- a/c_glib/arrow-dataset-glib/dataset.h +++ b/c_glib/arrow-dataset-glib/dataset.h @@ -27,18 +27,15 @@ G_BEGIN_DECLS GARROW_AVAILABLE_IN_5_0 GADatasetScannerBuilder * -gadataset_dataset_begin_scan(GADatasetDataset *dataset, - GError **error); +gadataset_dataset_begin_scan(GADatasetDataset *dataset, GError **error); GARROW_AVAILABLE_IN_5_0 GArrowTable * -gadataset_dataset_to_table(GADatasetDataset *dataset, - GError **error); +gadataset_dataset_to_table(GADatasetDataset *dataset, GError **error); GARROW_AVAILABLE_IN_5_0 gchar * gadataset_dataset_get_type_name(GADatasetDataset *dataset); - -#define GADATASET_TYPE_FILE_SYSTEM_DATASET_WRITE_OPTIONS \ +#define GADATASET_TYPE_FILE_SYSTEM_DATASET_WRITE_OPTIONS \ (gadataset_file_system_dataset_write_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GADatasetFileSystemDatasetWriteOptions, gadataset_file_system_dataset_write_options, @@ -54,9 +51,7 @@ GARROW_AVAILABLE_IN_6_0 GADatasetFileSystemDatasetWriteOptions * gadataset_file_system_dataset_write_options_new(void); - -#define GADATASET_TYPE_FILE_SYSTEM_DATASET \ - (gadataset_file_system_dataset_get_type()) +#define GADATASET_TYPE_FILE_SYSTEM_DATASET (gadataset_file_system_dataset_get_type()) G_DECLARE_DERIVABLE_TYPE(GADatasetFileSystemDataset, gadataset_file_system_dataset, GADATASET, @@ -74,5 +69,4 @@ gadataset_file_system_dataset_write_scanner( GADatasetFileSystemDatasetWriteOptions *options, GError **error); - G_END_DECLS diff --git a/c_glib/arrow-dataset-glib/dataset.hpp b/c_glib/arrow-dataset-glib/dataset.hpp index 1dab391e8af14..30d2f45cba72a 100644 --- a/c_glib/arrow-dataset-glib/dataset.hpp +++ b/c_glib/arrow-dataset-glib/dataset.hpp @@ -23,24 +23,19 @@ #include - GADatasetDataset * -gadataset_dataset_new_raw( - std::shared_ptr *arrow_dataset); +gadataset_dataset_new_raw(std::shared_ptr *arrow_dataset); GADatasetDataset * -gadataset_dataset_new_raw( - std::shared_ptr *arrow_dataset, - const gchar *first_property_name, - ...); +gadataset_dataset_new_raw(std::shared_ptr *arrow_dataset, + const gchar *first_property_name, + ...); GADatasetDataset * -gadataset_dataset_new_raw_valist( - std::shared_ptr *arrow_dataset, - const gchar *first_property_name, - va_list arg); +gadataset_dataset_new_raw_valist(std::shared_ptr *arrow_dataset, + const gchar *first_property_name, + va_list arg); std::shared_ptr gadataset_dataset_get_raw(GADatasetDataset *dataset); - arrow::dataset::FileSystemDatasetWriteOptions * gadataset_file_system_dataset_write_options_get_raw( GADatasetFileSystemDatasetWriteOptions *options); diff --git a/c_glib/arrow-dataset-glib/file-format.cpp b/c_glib/arrow-dataset-glib/file-format.cpp index db0eb064ebabe..121c6511f6a68 100644 --- a/c_glib/arrow-dataset-glib/file-format.cpp +++ b/c_glib/arrow-dataset-glib/file-format.cpp @@ -50,7 +50,8 @@ G_BEGIN_DECLS * Since: 3.0.0 */ -typedef struct GADatasetFileWriteOptionsPrivate_ { +typedef struct GADatasetFileWriteOptionsPrivate_ +{ std::shared_ptr options; } GADatasetFileWriteOptionsPrivate; @@ -62,9 +63,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GADatasetFileWriteOptions, gadataset_file_write_options, G_TYPE_OBJECT) -#define GADATASET_FILE_WRITE_OPTIONS_GET_PRIVATE(obj) \ - static_cast( \ - gadataset_file_write_options_get_instance_private( \ +#define GADATASET_FILE_WRITE_OPTIONS_GET_PRIVATE(obj) \ + static_cast( \ + gadataset_file_write_options_get_instance_private( \ GADATASET_FILE_WRITE_OPTIONS(obj))) static void @@ -85,9 +86,8 @@ gadataset_file_write_options_set_property(GObject *object, switch (prop_id) { case PROP_OPTIONS: - priv->options = - *static_cast *>( - g_value_get_pointer(value)); + priv->options = *static_cast *>( + g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -99,7 +99,7 @@ static void gadataset_file_write_options_init(GADatasetFileWriteOptions *object) { auto priv = GADATASET_FILE_WRITE_OPTIONS_GET_PRIVATE(object); - new(&priv->options) std::shared_ptr; + new (&priv->options) std::shared_ptr; } static void @@ -107,21 +107,21 @@ gadataset_file_write_options_class_init(GADatasetFileWriteOptionsClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = gadataset_file_write_options_finalize; + gobject_class->finalize = gadataset_file_write_options_finalize; gobject_class->set_property = gadataset_file_write_options_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("options", - "Options", - "The raw " - "std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "options", + "Options", + "The raw " + "std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_OPTIONS, spec); } - -typedef struct GADatasetFileWriterPrivate_ { +typedef struct GADatasetFileWriterPrivate_ +{ std::shared_ptr writer; } GADatasetFileWriterPrivate; @@ -129,14 +129,11 @@ enum { PROP_WRITER = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GADatasetFileWriter, - gadataset_file_writer, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GADatasetFileWriter, gadataset_file_writer, G_TYPE_OBJECT) -#define GADATASET_FILE_WRITER_GET_PRIVATE(obj) \ - static_cast( \ - gadataset_file_writer_get_instance_private( \ - GADATASET_FILE_WRITER(obj))) +#define GADATASET_FILE_WRITER_GET_PRIVATE(obj) \ + static_cast( \ + gadataset_file_writer_get_instance_private(GADATASET_FILE_WRITER(obj))) static void gadataset_file_writer_finalize(GObject *object) @@ -156,9 +153,8 @@ gadataset_file_writer_set_property(GObject *object, switch (prop_id) { case PROP_WRITER: - priv->writer = - *static_cast *>( - g_value_get_pointer(value)); + priv->writer = *static_cast *>( + g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -170,7 +166,7 @@ static void gadataset_file_writer_init(GADatasetFileWriter *object) { auto priv = GADATASET_FILE_WRITER_GET_PRIVATE(object); - new(&(priv->writer)) std::shared_ptr; + new (&(priv->writer)) std::shared_ptr; } static void @@ -178,16 +174,16 @@ gadataset_file_writer_class_init(GADatasetFileWriterClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = gadataset_file_writer_finalize; + gobject_class->finalize = gadataset_file_writer_finalize; gobject_class->set_property = gadataset_file_writer_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("writer", - "Writer", - "The raw " - "std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "writer", + "Writer", + "The raw " + "std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_WRITER, spec); } @@ -230,9 +226,7 @@ gadataset_file_writer_write_record_batch_reader(GADatasetFileWriter *writer, const auto arrow_writer = gadataset_file_writer_get_raw(writer); auto arrow_reader = garrow_record_batch_reader_get_raw(reader); auto status = arrow_writer->Write(arrow_reader.get()); - return garrow::check(error, - status, - "[file-writer][write-record-batch-reader]"); + return garrow::check(error, status, "[file-writer][write-record-batch-reader]"); } /** @@ -245,18 +239,15 @@ gadataset_file_writer_write_record_batch_reader(GADatasetFileWriter *writer, * Since: 6.0.0 */ gboolean -gadataset_file_writer_finish(GADatasetFileWriter *writer, - GError **error) +gadataset_file_writer_finish(GADatasetFileWriter *writer, GError **error) { const auto arrow_writer = gadataset_file_writer_get_raw(writer); auto status = arrow_writer->Finish().status(); - return garrow::check(error, - status, - "[file-writer][finish]"); + return garrow::check(error, status, "[file-writer][finish]"); } - -typedef struct GADatasetFileFormatPrivate_ { +typedef struct GADatasetFileFormatPrivate_ +{ std::shared_ptr format; } GADatasetFileFormatPrivate; @@ -264,14 +255,11 @@ enum { PROP_FORMAT = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GADatasetFileFormat, - gadataset_file_format, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GADatasetFileFormat, gadataset_file_format, G_TYPE_OBJECT) -#define GADATASET_FILE_FORMAT_GET_PRIVATE(obj) \ - static_cast( \ - gadataset_file_format_get_instance_private( \ - GADATASET_FILE_FORMAT(obj))) +#define GADATASET_FILE_FORMAT_GET_PRIVATE(obj) \ + static_cast( \ + gadataset_file_format_get_instance_private(GADATASET_FILE_FORMAT(obj))) static void gadataset_file_format_finalize(GObject *object) @@ -291,9 +279,8 @@ gadataset_file_format_set_property(GObject *object, switch (prop_id) { case PROP_FORMAT: - priv->format = - *static_cast *>( - g_value_get_pointer(value)); + priv->format = *static_cast *>( + g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -305,7 +292,7 @@ static void gadataset_file_format_init(GADatasetFileFormat *object) { auto priv = GADATASET_FILE_FORMAT_GET_PRIVATE(object); - new(&priv->format) std::shared_ptr; + new (&priv->format) std::shared_ptr; } static void @@ -313,15 +300,15 @@ gadataset_file_format_class_init(GADatasetFileFormatClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = gadataset_file_format_finalize; + gobject_class->finalize = gadataset_file_format_finalize; gobject_class->set_property = gadataset_file_format_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("format", - "Format", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "format", + "Format", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_FORMAT, spec); } @@ -388,11 +375,10 @@ gadataset_file_format_open_writer(GADatasetFileFormat *format, auto arrow_file_system = garrow_file_system_get_raw(file_system); auto arrow_schema = garrow_schema_get_raw(schema); auto arrow_options = gadataset_file_write_options_get_raw(options); - auto arrow_writer_result = - arrow_format->MakeWriter(arrow_destination, - arrow_schema, - arrow_options, - {arrow_file_system, path}); + auto arrow_writer_result = arrow_format->MakeWriter(arrow_destination, + arrow_schema, + arrow_options, + {arrow_file_system, path}); if (garrow::check(error, arrow_writer_result, "[file-format][open-writer]")) { auto arrow_writer = *arrow_writer_result; return gadataset_file_writer_new_raw(&arrow_writer); @@ -419,7 +405,6 @@ gadataset_file_format_equal(GADatasetFileFormat *format, return arrow_format->Equals(*arrow_other_format); } - G_DEFINE_TYPE(GADatasetCSVFileFormat, gadataset_csv_file_format, GADATASET_TYPE_FILE_FORMAT) @@ -449,7 +434,6 @@ gadataset_csv_file_format_new(void) return GADATASET_CSV_FILE_FORMAT(gadataset_file_format_new_raw(&arrow_format)); } - G_DEFINE_TYPE(GADatasetIPCFileFormat, gadataset_ipc_file_format, GADATASET_TYPE_FILE_FORMAT) @@ -479,7 +463,6 @@ gadataset_ipc_file_format_new(void) return GADATASET_IPC_FILE_FORMAT(gadataset_file_format_new_raw(&arrow_format)); } - G_DEFINE_TYPE(GADatasetParquetFileFormat, gadataset_parquet_file_format, GADATASET_TYPE_FILE_FORMAT) @@ -506,11 +489,9 @@ gadataset_parquet_file_format_new(void) { std::shared_ptr arrow_format = std::make_shared(); - return GADATASET_PARQUET_FILE_FORMAT( - gadataset_file_format_new_raw(&arrow_format)); + return GADATASET_PARQUET_FILE_FORMAT(gadataset_file_format_new_raw(&arrow_format)); } - G_END_DECLS GADatasetFileWriteOptions * @@ -518,9 +499,7 @@ gadataset_file_write_options_new_raw( std::shared_ptr *arrow_options) { return GADATASET_FILE_WRITE_OPTIONS( - g_object_new(GADATASET_TYPE_FILE_WRITE_OPTIONS, - "options", arrow_options, - NULL)); + g_object_new(GADATASET_TYPE_FILE_WRITE_OPTIONS, "options", arrow_options, NULL)); } std::shared_ptr @@ -530,14 +509,11 @@ gadataset_file_write_options_get_raw(GADatasetFileWriteOptions *options) return priv->options; } - GADatasetFileWriter * -gadataset_file_writer_new_raw( - std::shared_ptr *arrow_writer) +gadataset_file_writer_new_raw(std::shared_ptr *arrow_writer) { - return GADATASET_FILE_WRITER(g_object_new(GADATASET_TYPE_FILE_WRITER, - "writer", arrow_writer, - NULL)); + return GADATASET_FILE_WRITER( + g_object_new(GADATASET_TYPE_FILE_WRITER, "writer", arrow_writer, NULL)); } std::shared_ptr @@ -547,10 +523,8 @@ gadataset_file_writer_get_raw(GADatasetFileWriter *writer) return priv->writer; } - GADatasetFileFormat * -gadataset_file_format_new_raw( - std::shared_ptr *arrow_format) +gadataset_file_format_new_raw(std::shared_ptr *arrow_format) { GType type = GADATASET_TYPE_FILE_FORMAT; const auto &type_name = (*arrow_format)->type_name(); @@ -561,9 +535,7 @@ gadataset_file_format_new_raw( } else if (type_name == "parquet") { type = GADATASET_TYPE_PARQUET_FILE_FORMAT; } - return GADATASET_FILE_FORMAT(g_object_new(type, - "format", arrow_format, - NULL)); + return GADATASET_FILE_FORMAT(g_object_new(type, "format", arrow_format, NULL)); } std::shared_ptr diff --git a/c_glib/arrow-dataset-glib/file-format.h b/c_glib/arrow-dataset-glib/file-format.h index 16a8340747ce4..29487e59d70dd 100644 --- a/c_glib/arrow-dataset-glib/file-format.h +++ b/c_glib/arrow-dataset-glib/file-format.h @@ -23,8 +23,7 @@ G_BEGIN_DECLS -#define GADATASET_TYPE_FILE_WRITE_OPTIONS \ - (gadataset_file_write_options_get_type()) +#define GADATASET_TYPE_FILE_WRITE_OPTIONS (gadataset_file_write_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GADatasetFileWriteOptions, gadataset_file_write_options, GADATASET, @@ -35,14 +34,9 @@ struct _GADatasetFileWriteOptionsClass GObjectClass parent_class; }; - -#define GADATASET_TYPE_FILE_WRITER \ - (gadataset_file_writer_get_type()) -G_DECLARE_DERIVABLE_TYPE(GADatasetFileWriter, - gadataset_file_writer, - GADATASET, - FILE_WRITER, - GObject) +#define GADATASET_TYPE_FILE_WRITER (gadataset_file_writer_get_type()) +G_DECLARE_DERIVABLE_TYPE( + GADatasetFileWriter, gadataset_file_writer, GADATASET, FILE_WRITER, GObject) struct _GADatasetFileWriterClass { GObjectClass parent_class; @@ -60,16 +54,11 @@ gadataset_file_writer_write_record_batch_reader(GADatasetFileWriter *writer, GError **error); GARROW_AVAILABLE_IN_6_0 gboolean -gadataset_file_writer_finish(GADatasetFileWriter *writer, - GError **error); - +gadataset_file_writer_finish(GADatasetFileWriter *writer, GError **error); #define GADATASET_TYPE_FILE_FORMAT (gadataset_file_format_get_type()) -G_DECLARE_DERIVABLE_TYPE(GADatasetFileFormat, - gadataset_file_format, - GADATASET, - FILE_FORMAT, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GADatasetFileFormat, gadataset_file_format, GADATASET, FILE_FORMAT, GObject) struct _GADatasetFileFormatClass { GObjectClass parent_class; @@ -96,7 +85,6 @@ gboolean gadataset_file_format_equal(GADatasetFileFormat *format, GADatasetFileFormat *other_format); - #define GADATASET_TYPE_CSV_FILE_FORMAT (gadataset_csv_file_format_get_type()) G_DECLARE_DERIVABLE_TYPE(GADatasetCSVFileFormat, gadataset_csv_file_format, @@ -109,8 +97,8 @@ struct _GADatasetCSVFileFormatClass }; GARROW_AVAILABLE_IN_3_0 -GADatasetCSVFileFormat *gadataset_csv_file_format_new(void); - +GADatasetCSVFileFormat * +gadataset_csv_file_format_new(void); #define GADATASET_TYPE_IPC_FILE_FORMAT (gadataset_ipc_file_format_get_type()) G_DECLARE_DERIVABLE_TYPE(GADatasetIPCFileFormat, @@ -124,11 +112,10 @@ struct _GADatasetIPCFileFormatClass }; GARROW_AVAILABLE_IN_3_0 -GADatasetIPCFileFormat *gadataset_ipc_file_format_new(void); +GADatasetIPCFileFormat * +gadataset_ipc_file_format_new(void); - -#define GADATASET_TYPE_PARQUET_FILE_FORMAT \ - (gadataset_parquet_file_format_get_type()) +#define GADATASET_TYPE_PARQUET_FILE_FORMAT (gadataset_parquet_file_format_get_type()) G_DECLARE_DERIVABLE_TYPE(GADatasetParquetFileFormat, gadataset_parquet_file_format, GADATASET, @@ -140,7 +127,7 @@ struct _GADatasetParquetFileFormatClass }; GARROW_AVAILABLE_IN_3_0 -GADatasetParquetFileFormat *gadataset_parquet_file_format_new(void); - +GADatasetParquetFileFormat * +gadataset_parquet_file_format_new(void); G_END_DECLS diff --git a/c_glib/arrow-dataset-glib/file-format.hpp b/c_glib/arrow-dataset-glib/file-format.hpp index 636dc5c015b3c..f425fa0246394 100644 --- a/c_glib/arrow-dataset-glib/file-format.hpp +++ b/c_glib/arrow-dataset-glib/file-format.hpp @@ -29,16 +29,12 @@ gadataset_file_write_options_new_raw( std::shared_ptr gadataset_file_write_options_get_raw(GADatasetFileWriteOptions *options); - GADatasetFileWriter * -gadataset_file_writer_new_raw( - std::shared_ptr *arrow_writer); +gadataset_file_writer_new_raw(std::shared_ptr *arrow_writer); std::shared_ptr gadataset_file_writer_get_raw(GADatasetFileWriter *writer); - GADatasetFileFormat * -gadataset_file_format_new_raw( - std::shared_ptr *arrow_format); +gadataset_file_format_new_raw(std::shared_ptr *arrow_format); std::shared_ptr gadataset_file_format_get_raw(GADatasetFileFormat *format); diff --git a/c_glib/arrow-dataset-glib/fragment.cpp b/c_glib/arrow-dataset-glib/fragment.cpp index f2f0cd1c3e9bc..0a8efe4acd4ea 100644 --- a/c_glib/arrow-dataset-glib/fragment.cpp +++ b/c_glib/arrow-dataset-glib/fragment.cpp @@ -39,7 +39,8 @@ G_BEGIN_DECLS /* arrow::dataset::Fragment */ -typedef struct GADatasetFragmentPrivate_ { +typedef struct GADatasetFragmentPrivate_ +{ std::shared_ptr fragment; } GADatasetFragmentPrivate; @@ -47,14 +48,11 @@ enum { PROP_FRAGMENT = 1, }; -G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GADatasetFragment, - gadataset_fragment, - G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GADatasetFragment, gadataset_fragment, G_TYPE_OBJECT) -#define GADATASET_FRAGMENT_GET_PRIVATE(obj) \ - static_cast( \ - gadataset_fragment_get_instance_private( \ - GADATASET_FRAGMENT(obj))) +#define GADATASET_FRAGMENT_GET_PRIVATE(obj) \ + static_cast( \ + gadataset_fragment_get_instance_private(GADATASET_FRAGMENT(obj))) static void gadataset_fragment_finalize(GObject *object) @@ -76,9 +74,8 @@ gadataset_fragment_set_property(GObject *object, switch (prop_id) { case PROP_FRAGMENT: - priv->fragment = - *static_cast *>( - g_value_get_pointer(value)); + priv->fragment = *static_cast *>( + g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -90,7 +87,7 @@ static void gadataset_fragment_init(GADatasetFragment *object) { auto priv = GADATASET_FRAGMENT_GET_PRIVATE(object); - new(&priv->fragment) std::shared_ptr; + new (&priv->fragment) std::shared_ptr; } static void @@ -98,15 +95,15 @@ gadataset_fragment_class_init(GADatasetFragmentClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = gadataset_fragment_finalize; + gobject_class->finalize = gadataset_fragment_finalize; gobject_class->set_property = gadataset_fragment_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("fragment", - "Fragment", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "fragment", + "Fragment", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_FRAGMENT, spec); } @@ -158,13 +155,10 @@ gadataset_in_memory_fragment_new(GArrowSchema *schema, G_END_DECLS GADatasetFragment * -gadataset_fragment_new_raw( - std::shared_ptr *arrow_fragment) +gadataset_fragment_new_raw(std::shared_ptr *arrow_fragment) { - auto fragment = - GADATASET_FRAGMENT(g_object_new(GADATASET_TYPE_FRAGMENT, - "fragment", arrow_fragment, - NULL)); + auto fragment = GADATASET_FRAGMENT( + g_object_new(GADATASET_TYPE_FRAGMENT, "fragment", arrow_fragment, NULL)); return fragment; } @@ -179,9 +173,7 @@ GADatasetInMemoryFragment * gadataset_in_memory_fragment_new_raw( std::shared_ptr *arrow_fragment) { - auto fragment = - GADATASET_IN_MEMORY_FRAGMENT(g_object_new(GADATASET_TYPE_IN_MEMORY_FRAGMENT, - "fragment", arrow_fragment, - NULL)); + auto fragment = GADATASET_IN_MEMORY_FRAGMENT( + g_object_new(GADATASET_TYPE_IN_MEMORY_FRAGMENT, "fragment", arrow_fragment, NULL)); return fragment; } diff --git a/c_glib/arrow-dataset-glib/fragment.h b/c_glib/arrow-dataset-glib/fragment.h index 9376b6cf3ee08..49acc360a3679 100644 --- a/c_glib/arrow-dataset-glib/fragment.h +++ b/c_glib/arrow-dataset-glib/fragment.h @@ -26,11 +26,8 @@ G_BEGIN_DECLS /* arrow::dataset::Fragment */ #define GADATASET_TYPE_FRAGMENT (gadataset_fragment_get_type()) -G_DECLARE_DERIVABLE_TYPE(GADatasetFragment, - gadataset_fragment, - GADATASET, - FRAGMENT, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GADatasetFragment, gadataset_fragment, GADATASET, FRAGMENT, GObject) struct _GADatasetFragmentClass { GObjectClass parent_class; @@ -38,8 +35,7 @@ struct _GADatasetFragmentClass /* arrow::dataset::InMemoryFragment */ -#define GADATASET_TYPE_IN_MEMORY_FRAGMENT \ - (gadataset_in_memory_fragment_get_type()) +#define GADATASET_TYPE_IN_MEMORY_FRAGMENT (gadataset_in_memory_fragment_get_type()) G_DECLARE_DERIVABLE_TYPE(GADatasetInMemoryFragment, gadataset_in_memory_fragment, GADATASET, diff --git a/c_glib/arrow-dataset-glib/fragment.hpp b/c_glib/arrow-dataset-glib/fragment.hpp index 904f83653965b..7360905723c22 100644 --- a/c_glib/arrow-dataset-glib/fragment.hpp +++ b/c_glib/arrow-dataset-glib/fragment.hpp @@ -26,10 +26,9 @@ std::shared_ptr gadataset_fragment_get_raw(GADatasetFragment *fragment); -GADatasetFragment* -gadataset_fragment_new_raw( - std::shared_ptr *arrow_fragment); +GADatasetFragment * +gadataset_fragment_new_raw(std::shared_ptr *arrow_fragment); -GADatasetInMemoryFragment* +GADatasetInMemoryFragment * gadataset_in_memory_fragment_new_raw( std::shared_ptr *arrow_fragment); diff --git a/c_glib/arrow-dataset-glib/partitioning.cpp b/c_glib/arrow-dataset-glib/partitioning.cpp index b22289b5d01fc..8506b6a4df8ec 100644 --- a/c_glib/arrow-dataset-glib/partitioning.cpp +++ b/c_glib/arrow-dataset-glib/partitioning.cpp @@ -56,7 +56,8 @@ G_BEGIN_DECLS * Since: 6.0.0 */ -struct GADatasetPartitioningFactoryOptionsPrivate { +struct GADatasetPartitioningFactoryOptionsPrivate +{ gboolean infer_dictionary; GArrowSchema *schema; GADatasetSegmentEncoding segment_encoding; @@ -72,9 +73,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GADatasetPartitioningFactoryOptions, gadataset_partitioning_factory_options, G_TYPE_OBJECT) -#define GADATASET_PARTITIONING_FACTORY_OPTIONS_GET_PRIVATE(obj) \ - static_cast( \ - gadataset_partitioning_factory_options_get_instance_private( \ +#define GADATASET_PARTITIONING_FACTORY_OPTIONS_GET_PRIVATE(obj) \ + static_cast( \ + gadataset_partitioning_factory_options_get_instance_private( \ GADATASET_PARTITIONING_FACTORY_OPTIONS(obj))) static void @@ -155,8 +156,7 @@ gadataset_partitioning_factory_options_get_property(GObject *object, } static void -gadataset_partitioning_factory_options_init( - GADatasetPartitioningFactoryOptions *object) +gadataset_partitioning_factory_options_init(GADatasetPartitioningFactoryOptions *object) { } @@ -167,10 +167,8 @@ gadataset_partitioning_factory_options_class_init( auto gobject_class = G_OBJECT_CLASS(klass); gobject_class->dispose = gadataset_partitioning_factory_options_dispose; - gobject_class->set_property = - gadataset_partitioning_factory_options_set_property; - gobject_class->get_property = - gadataset_partitioning_factory_options_get_property; + gobject_class->set_property = gadataset_partitioning_factory_options_set_property; + gobject_class->get_property = gadataset_partitioning_factory_options_get_property; arrow::dataset::PartitioningFactoryOptions default_options; GParamSpec *spec; @@ -210,9 +208,7 @@ gadataset_partitioning_factory_options_class_init( "against the schema and update internal state", GARROW_TYPE_SCHEMA, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_FACTORY_OPTIONS_SCHEMA, - spec); + g_object_class_install_property(gobject_class, PROP_FACTORY_OPTIONS_SCHEMA, spec); /** * GADatasetPartitioningFactoryOptions:segment-encoding: @@ -222,15 +218,15 @@ gadataset_partitioning_factory_options_class_init( * * Since: 11.0.0 */ - spec = g_param_spec_enum("segment-encoding", - "Segment encoding", - "After splitting a path into components, " - "decode the path components before " - "parsing according to this scheme", - GADATASET_TYPE_SEGMENT_ENCODING, - static_cast( - default_options.segment_encoding), - static_cast(G_PARAM_READWRITE)); + spec = g_param_spec_enum( + "segment-encoding", + "Segment encoding", + "After splitting a path into components, " + "decode the path components before " + "parsing according to this scheme", + GADATASET_TYPE_SEGMENT_ENCODING, + static_cast(default_options.segment_encoding), + static_cast(G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_FACTORY_OPTIONS_SEGMENT_ENCODING, spec); @@ -247,12 +243,11 @@ GADatasetPartitioningFactoryOptions * gadataset_partitioning_factory_options_new(void) { return GADATASET_PARTITIONING_FACTORY_OPTIONS( - g_object_new(GADATASET_TYPE_PARTITIONING_FACTORY_OPTIONS, - nullptr)); + g_object_new(GADATASET_TYPE_PARTITIONING_FACTORY_OPTIONS, nullptr)); } - -struct GADatasetPartitioningPrivate { +struct GADatasetPartitioningPrivate +{ std::shared_ptr partitioning; }; @@ -264,10 +259,9 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GADatasetPartitioning, gadataset_partitioning, G_TYPE_OBJECT) -#define GADATASET_PARTITIONING_GET_PRIVATE(obj) \ - static_cast( \ - gadataset_partitioning_get_instance_private( \ - GADATASET_PARTITIONING(obj))) +#define GADATASET_PARTITIONING_GET_PRIVATE(obj) \ + static_cast( \ + gadataset_partitioning_get_instance_private(GADATASET_PARTITIONING(obj))) static void gadataset_partitioning_finalize(GObject *object) @@ -287,9 +281,8 @@ gadataset_partitioning_set_property(GObject *object, switch (prop_id) { case PROP_PARTITIONING: - priv->partitioning = - *static_cast *>( - g_value_get_pointer(value)); + priv->partitioning = *static_cast *>( + g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -301,7 +294,7 @@ static void gadataset_partitioning_init(GADatasetPartitioning *object) { auto priv = GADATASET_PARTITIONING_GET_PRIVATE(object); - new(&priv->partitioning) std::shared_ptr; + new (&priv->partitioning) std::shared_ptr; } static void @@ -309,16 +302,16 @@ gadataset_partitioning_class_init(GADatasetPartitioningClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = gadataset_partitioning_finalize; + gobject_class->finalize = gadataset_partitioning_finalize; gobject_class->set_property = gadataset_partitioning_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("partitioning", - "Partitioning", - "The raw " - "std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "partitioning", + "Partitioning", + "The raw " + "std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_PARTITIONING, spec); } @@ -337,11 +330,9 @@ gadataset_partitioning_get_type_name(GADatasetPartitioning *partitioning) { auto arrow_partitioning = gadataset_partitioning_get_raw(partitioning); auto arrow_type_name = arrow_partitioning->type_name(); - return g_strndup(arrow_type_name.c_str(), - arrow_type_name.size()); + return g_strndup(arrow_type_name.c_str(), arrow_type_name.size()); } - /** * gadataset_partitioning_create_default: * @@ -357,8 +348,8 @@ gadataset_partitioning_create_default(void) return gadataset_partitioning_new_raw(&arrow_partitioning); } - -struct GADatasetKeyValuePartitioningOptionsPrivate { +struct GADatasetKeyValuePartitioningOptionsPrivate +{ GADatasetSegmentEncoding segment_encoding; }; @@ -370,9 +361,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GADatasetKeyValuePartitioningOptions, gadataset_key_value_partitioning_options, G_TYPE_OBJECT) -#define GADATASET_KEY_VALUE_PARTITIONING_OPTIONS_GET_PRIVATE(obj) \ - static_cast( \ - gadataset_key_value_partitioning_options_get_instance_private( \ +#define GADATASET_KEY_VALUE_PARTITIONING_OPTIONS_GET_PRIVATE(obj) \ + static_cast( \ + gadataset_key_value_partitioning_options_get_instance_private( \ GADATASET_KEY_VALUE_PARTITIONING_OPTIONS(obj))) static void @@ -424,10 +415,8 @@ gadataset_key_value_partitioning_options_class_init( { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->set_property = - gadataset_key_value_partitioning_options_set_property; - gobject_class->get_property = - gadataset_key_value_partitioning_options_get_property; + gobject_class->set_property = gadataset_key_value_partitioning_options_set_property; + gobject_class->get_property = gadataset_key_value_partitioning_options_get_property; arrow::dataset::KeyValuePartitioningOptions default_options; GParamSpec *spec; @@ -439,18 +428,16 @@ gadataset_key_value_partitioning_options_class_init( * * Since: 11.0.0 */ - spec = g_param_spec_enum("segment-encoding", - "Segment encoding", - "After splitting a path into components, " - "decode the path components before " - "parsing according to this scheme", - GADATASET_TYPE_SEGMENT_ENCODING, - static_cast( - default_options.segment_encoding), - static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_OPTIONS_SEGMENT_ENCODING, - spec); + spec = g_param_spec_enum( + "segment-encoding", + "Segment encoding", + "After splitting a path into components, " + "decode the path components before " + "parsing according to this scheme", + GADATASET_TYPE_SEGMENT_ENCODING, + static_cast(default_options.segment_encoding), + static_cast(G_PARAM_READWRITE)); + g_object_class_install_property(gobject_class, PROP_OPTIONS_SEGMENT_ENCODING, spec); } /** @@ -464,11 +451,9 @@ GADatasetKeyValuePartitioningOptions * gadataset_key_value_partitioning_options_new(void) { return GADATASET_KEY_VALUE_PARTITIONING_OPTIONS( - g_object_new(GADATASET_TYPE_KEY_VALUE_PARTITIONING_OPTIONS, - nullptr)); + g_object_new(GADATASET_TYPE_KEY_VALUE_PARTITIONING_OPTIONS, nullptr)); } - G_DEFINE_ABSTRACT_TYPE(GADatasetKeyValuePartitioning, gadataset_key_value_partitioning, GADATASET_TYPE_PARTITIONING) @@ -479,19 +464,17 @@ gadataset_key_value_partitioning_init(GADatasetKeyValuePartitioning *object) } static void -gadataset_key_value_partitioning_class_init( - GADatasetKeyValuePartitioningClass *klass) +gadataset_key_value_partitioning_class_init(GADatasetKeyValuePartitioningClass *klass) { } G_END_DECLS template GADatasetPartitioning * -garrow_key_value_partitioning_new( - GArrowSchema *schema, - GList *dictionaries, - PartitioningOptions &arrow_options, - GError **error) +garrow_key_value_partitioning_new(GArrowSchema *schema, + GList *dictionaries, + PartitioningOptions &arrow_options, + GError **error) { auto arrow_schema = garrow_schema_get_raw(schema); std::vector> arrow_dictionaries; @@ -503,12 +486,8 @@ garrow_key_value_partitioning_new( arrow_dictionaries.push_back(nullptr); } } - auto arrow_partitioning = - std::static_pointer_cast( - std::make_shared( - arrow_schema, - arrow_dictionaries, - arrow_options)); + auto arrow_partitioning = std::static_pointer_cast( + std::make_shared(arrow_schema, arrow_dictionaries, arrow_options)); return gadataset_partitioning_new_raw(&arrow_partitioning); } G_BEGIN_DECLS @@ -523,8 +502,7 @@ gadataset_directory_partitioning_init(GADatasetDirectoryPartitioning *object) } static void -gadataset_directory_partitioning_class_init( - GADatasetDirectoryPartitioningClass *klass) +gadataset_directory_partitioning_class_init(GADatasetDirectoryPartitioningClass *klass) { } @@ -542,11 +520,10 @@ gadataset_directory_partitioning_class_init( * Since: 6.0.0 */ GADatasetDirectoryPartitioning * -gadataset_directory_partitioning_new( - GArrowSchema *schema, - GList *dictionaries, - GADatasetKeyValuePartitioningOptions *options, - GError **error) +gadataset_directory_partitioning_new(GArrowSchema *schema, + GList *dictionaries, + GADatasetKeyValuePartitioningOptions *options, + GError **error) { arrow::dataset::KeyValuePartitioningOptions arrow_options; if (options) { @@ -554,11 +531,14 @@ gadataset_directory_partitioning_new( } return GADATASET_DIRECTORY_PARTITIONING( garrow_key_value_partitioning_new( - schema, dictionaries, arrow_options, error)); + schema, + dictionaries, + arrow_options, + error)); } - -struct GADatasetHivePartitioningOptionsPrivate { +struct GADatasetHivePartitioningOptionsPrivate +{ gchar *null_fallback; }; @@ -570,9 +550,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GADatasetHivePartitioningOptions, gadataset_hive_partitioning_options, GADATASET_TYPE_KEY_VALUE_PARTITIONING_OPTIONS) -#define GADATASET_HIVE_PARTITIONING_OPTIONS_GET_PRIVATE(obj) \ - static_cast( \ - gadataset_hive_partitioning_options_get_instance_private( \ +#define GADATASET_HIVE_PARTITIONING_OPTIONS_GET_PRIVATE(obj) \ + static_cast( \ + gadataset_hive_partitioning_options_get_instance_private( \ GADATASET_HIVE_PARTITIONING_OPTIONS(obj))) static void @@ -631,8 +611,7 @@ gadataset_hive_partitioning_options_get_property(GObject *object, } static void -gadataset_hive_partitioning_options_init( - GADatasetHivePartitioningOptions *object) +gadataset_hive_partitioning_options_init(GADatasetHivePartitioningOptions *object) { } @@ -661,9 +640,7 @@ gadataset_hive_partitioning_options_class_init( "The fallback string for null", default_options.null_fallback.c_str(), static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_OPTIONS_NULL_FALLBACK, - spec); + g_object_class_install_property(gobject_class, PROP_OPTIONS_NULL_FALLBACK, spec); } /** @@ -677,11 +654,9 @@ GADatasetHivePartitioningOptions * gadataset_hive_partitioning_options_new(void) { return GADATASET_HIVE_PARTITIONING_OPTIONS( - g_object_new(GADATASET_TYPE_HIVE_PARTITIONING_OPTIONS, - nullptr)); + g_object_new(GADATASET_TYPE_HIVE_PARTITIONING_OPTIONS, nullptr)); } - G_DEFINE_TYPE(GADatasetHivePartitioning, gadataset_hive_partitioning, GADATASET_TYPE_KEY_VALUE_PARTITIONING) @@ -692,8 +667,7 @@ gadataset_hive_partitioning_init(GADatasetHivePartitioning *object) } static void -gadataset_hive_partitioning_class_init( - GADatasetHivePartitioningClass *klass) +gadataset_hive_partitioning_class_init(GADatasetHivePartitioningClass *klass) { } @@ -721,8 +695,10 @@ gadataset_hive_partitioning_new(GArrowSchema *schema, arrow_options = gadataset_hive_partitioning_options_get_raw(options); } return GADATASET_HIVE_PARTITIONING( - garrow_key_value_partitioning_new( - schema, dictionaries, arrow_options, error)); + garrow_key_value_partitioning_new(schema, + dictionaries, + arrow_options, + error)); } /** @@ -735,8 +711,7 @@ gadataset_hive_partitioning_new(GArrowSchema *schema, * Since: 11.0.0 */ gchar * -gadataset_hive_partitioning_get_null_fallback( - GADatasetHivePartitioning *partitioning) +gadataset_hive_partitioning_get_null_fallback(GADatasetHivePartitioning *partitioning) { const auto arrow_partitioning = std::static_pointer_cast( @@ -745,7 +720,6 @@ gadataset_hive_partitioning_get_null_fallback( return g_strdup(null_fallback.c_str()); } - G_END_DECLS arrow::dataset::PartitioningFactoryOptions @@ -775,13 +749,11 @@ gadataset_key_value_partitioning_options_get_raw( } arrow::dataset::HivePartitioningOptions -gadataset_hive_partitioning_options_get_raw( - GADatasetHivePartitioningOptions *options) +gadataset_hive_partitioning_options_get_raw(GADatasetHivePartitioningOptions *options) { auto priv = GADATASET_HIVE_PARTITIONING_OPTIONS_GET_PRIVATE(options); - auto arrow_key_value_options = - gadataset_key_value_partitioning_options_get_raw( - GADATASET_KEY_VALUE_PARTITIONING_OPTIONS(options)); + auto arrow_key_value_options = gadataset_key_value_partitioning_options_get_raw( + GADATASET_KEY_VALUE_PARTITIONING_OPTIONS(options)); arrow::dataset::HivePartitioningOptions arrow_options; arrow_options.segment_encoding = arrow_key_value_options.segment_encoding; arrow_options.null_fallback = priv->null_fallback; @@ -799,9 +771,8 @@ gadataset_partitioning_new_raw( } else if (arrow_type_name == "hive") { type = GADATASET_TYPE_HIVE_PARTITIONING; } - return GADATASET_PARTITIONING(g_object_new(type, - "partitioning", arrow_partitioning, - nullptr)); + return GADATASET_PARTITIONING( + g_object_new(type, "partitioning", arrow_partitioning, nullptr)); } std::shared_ptr diff --git a/c_glib/arrow-dataset-glib/partitioning.h b/c_glib/arrow-dataset-glib/partitioning.h index ca347b895b984..ccf476272e429 100644 --- a/c_glib/arrow-dataset-glib/partitioning.h +++ b/c_glib/arrow-dataset-glib/partitioning.h @@ -37,8 +37,7 @@ typedef enum { GADATASET_SEGMENT_ENCODING_URI, } GADatasetSegmentEncoding; - -#define GADATASET_TYPE_PARTITIONING_FACTORY_OPTIONS \ +#define GADATASET_TYPE_PARTITIONING_FACTORY_OPTIONS \ (gadataset_partitioning_factory_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GADatasetPartitioningFactoryOptions, gadataset_partitioning_factory_options, @@ -54,13 +53,9 @@ GARROW_AVAILABLE_IN_11_0 GADatasetPartitioningFactoryOptions * gadataset_partitioning_factory_options_new(void); - #define GADATASET_TYPE_PARTITIONING (gadataset_partitioning_get_type()) -G_DECLARE_DERIVABLE_TYPE(GADatasetPartitioning, - gadataset_partitioning, - GADATASET, - PARTITIONING, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GADatasetPartitioning, gadataset_partitioning, GADATASET, PARTITIONING, GObject) struct _GADatasetPartitioningClass { GObjectClass parent_class; @@ -70,13 +65,11 @@ GARROW_AVAILABLE_IN_6_0 gchar * gadataset_partitioning_get_type_name(GADatasetPartitioning *partitioning); - GARROW_AVAILABLE_IN_12_0 GADatasetPartitioning * gadataset_partitioning_create_default(void); - -#define GADATASET_TYPE_KEY_VALUE_PARTITIONING_OPTIONS \ +#define GADATASET_TYPE_KEY_VALUE_PARTITIONING_OPTIONS \ (gadataset_key_value_partitioning_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GADatasetKeyValuePartitioningOptions, gadataset_key_value_partitioning_options, @@ -92,8 +85,7 @@ GARROW_AVAILABLE_IN_11_0 GADatasetKeyValuePartitioningOptions * gadataset_key_value_partitioning_options_new(void); - -#define GADATASET_TYPE_KEY_VALUE_PARTITIONING \ +#define GADATASET_TYPE_KEY_VALUE_PARTITIONING \ (gadataset_key_value_partitioning_get_type()) G_DECLARE_DERIVABLE_TYPE(GADatasetKeyValuePartitioning, gadataset_key_value_partitioning, @@ -105,8 +97,7 @@ struct _GADatasetKeyValuePartitioningClass GADatasetPartitioningClass parent_class; }; - -#define GADATASET_TYPE_DIRECTORY_PARTITIONING \ +#define GADATASET_TYPE_DIRECTORY_PARTITIONING \ (gadataset_directory_partitioning_get_type()) G_DECLARE_DERIVABLE_TYPE(GADatasetDirectoryPartitioning, gadataset_directory_partitioning, @@ -120,14 +111,12 @@ struct _GADatasetDirectoryPartitioningClass GARROW_AVAILABLE_IN_6_0 GADatasetDirectoryPartitioning * -gadataset_directory_partitioning_new( - GArrowSchema *schema, - GList *dictionaries, - GADatasetKeyValuePartitioningOptions *options, - GError **error); - +gadataset_directory_partitioning_new(GArrowSchema *schema, + GList *dictionaries, + GADatasetKeyValuePartitioningOptions *options, + GError **error); -#define GADATASET_TYPE_HIVE_PARTITIONING_OPTIONS \ +#define GADATASET_TYPE_HIVE_PARTITIONING_OPTIONS \ (gadataset_hive_partitioning_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GADatasetHivePartitioningOptions, gadataset_hive_partitioning_options, @@ -143,9 +132,7 @@ GARROW_AVAILABLE_IN_11_0 GADatasetHivePartitioningOptions * gadataset_hive_partitioning_options_new(void); - -#define GADATASET_TYPE_HIVE_PARTITIONING \ - (gadataset_hive_partitioning_get_type()) +#define GADATASET_TYPE_HIVE_PARTITIONING (gadataset_hive_partitioning_get_type()) G_DECLARE_DERIVABLE_TYPE(GADatasetHivePartitioning, gadataset_hive_partitioning, GADATASET, @@ -164,8 +151,6 @@ gadataset_hive_partitioning_new(GArrowSchema *schema, GError **error); GARROW_AVAILABLE_IN_11_0 gchar * -gadataset_hive_partitioning_get_null_fallback( - GADatasetHivePartitioning *partitioning); - +gadataset_hive_partitioning_get_null_fallback(GADatasetHivePartitioning *partitioning); G_END_DECLS diff --git a/c_glib/arrow-dataset-glib/partitioning.hpp b/c_glib/arrow-dataset-glib/partitioning.hpp index 4ce8667e78992..a57a44d714024 100644 --- a/c_glib/arrow-dataset-glib/partitioning.hpp +++ b/c_glib/arrow-dataset-glib/partitioning.hpp @@ -32,8 +32,7 @@ gadataset_key_value_partitioning_options_get_raw( GADatasetKeyValuePartitioningOptions *options); arrow::dataset::HivePartitioningOptions -gadataset_hive_partitioning_options_get_raw( - GADatasetHivePartitioningOptions *options); +gadataset_hive_partitioning_options_get_raw(GADatasetHivePartitioningOptions *options); GADatasetPartitioning * gadataset_partitioning_new_raw( diff --git a/c_glib/arrow-dataset-glib/scanner.cpp b/c_glib/arrow-dataset-glib/scanner.cpp index 07a5d4aeadae9..717532db9220f 100644 --- a/c_glib/arrow-dataset-glib/scanner.cpp +++ b/c_glib/arrow-dataset-glib/scanner.cpp @@ -40,7 +40,8 @@ G_BEGIN_DECLS * Since: 5.0.0 */ -typedef struct GADatasetScannerPrivate_ { +typedef struct GADatasetScannerPrivate_ +{ std::shared_ptr scanner; } GADatasetScannerPrivate; @@ -48,14 +49,11 @@ enum { PROP_SCANNER = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GADatasetScanner, - gadataset_scanner, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GADatasetScanner, gadataset_scanner, G_TYPE_OBJECT) -#define GADATASET_SCANNER_GET_PRIVATE(obj) \ - static_cast( \ - gadataset_scanner_get_instance_private( \ - GADATASET_SCANNER(obj))) +#define GADATASET_SCANNER_GET_PRIVATE(obj) \ + static_cast( \ + gadataset_scanner_get_instance_private(GADATASET_SCANNER(obj))) static void gadataset_scanner_finalize(GObject *object) @@ -75,9 +73,8 @@ gadataset_scanner_set_property(GObject *object, switch (prop_id) { case PROP_SCANNER: - priv->scanner = - *static_cast *>( - g_value_get_pointer(value)); + priv->scanner = *static_cast *>( + g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -89,22 +86,22 @@ static void gadataset_scanner_init(GADatasetScanner *object) { auto priv = GADATASET_SCANNER_GET_PRIVATE(object); - new(&priv->scanner) std::shared_ptr; + new (&priv->scanner) std::shared_ptr; } static void gadataset_scanner_class_init(GADatasetScannerClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = gadataset_scanner_finalize; + gobject_class->finalize = gadataset_scanner_finalize; gobject_class->set_property = gadataset_scanner_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("scanner", - "Scanner", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "scanner", + "Scanner", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_SCANNER, spec); } @@ -119,8 +116,7 @@ gadataset_scanner_class_init(GADatasetScannerClass *klass) * Since: 5.0.0 */ GArrowTable * -gadataset_scanner_to_table(GADatasetScanner *scanner, - GError **error) +gadataset_scanner_to_table(GADatasetScanner *scanner, GError **error) { auto arrow_scanner = gadataset_scanner_get_raw(scanner); auto arrow_table_result = arrow_scanner->ToTable(); @@ -132,8 +128,8 @@ gadataset_scanner_to_table(GADatasetScanner *scanner, } } - -typedef struct GADatasetScannerBuilderPrivate_ { +typedef struct GADatasetScannerBuilderPrivate_ +{ std::shared_ptr scanner_builder; } GADatasetScannerBuilderPrivate; @@ -145,10 +141,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GADatasetScannerBuilder, gadataset_scanner_builder, G_TYPE_OBJECT) -#define GADATASET_SCANNER_BUILDER_GET_PRIVATE(obj) \ - static_cast( \ - gadataset_scanner_builder_get_instance_private( \ - GADATASET_SCANNER_BUILDER(obj))) +#define GADATASET_SCANNER_BUILDER_GET_PRIVATE(obj) \ + static_cast( \ + gadataset_scanner_builder_get_instance_private(GADATASET_SCANNER_BUILDER(obj))) static void gadataset_scanner_builder_finalize(GObject *object) @@ -182,23 +177,23 @@ static void gadataset_scanner_builder_init(GADatasetScannerBuilder *object) { auto priv = GADATASET_SCANNER_BUILDER_GET_PRIVATE(object); - new(&priv->scanner_builder) std::shared_ptr; + new (&priv->scanner_builder) std::shared_ptr; } static void gadataset_scanner_builder_class_init(GADatasetScannerBuilderClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = gadataset_scanner_builder_finalize; + gobject_class->finalize = gadataset_scanner_builder_finalize; gobject_class->set_property = gadataset_scanner_builder_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("scanner-builder", - "Scanner builder", - "The raw " - "std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "scanner-builder", + "Scanner builder", + "The raw " + "std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_SCANNER_BUILDER, spec); } @@ -217,9 +212,7 @@ gadataset_scanner_builder_new(GADatasetDataset *dataset, GError **error) { auto arrow_dataset = gadataset_dataset_get_raw(dataset); auto arrow_scanner_builder_result = arrow_dataset->NewScan(); - if (garrow::check(error, - arrow_scanner_builder_result, - "[scanner-builder][new]")) { + if (garrow::check(error, arrow_scanner_builder_result, "[scanner-builder][new]")) { auto arrow_scanner_builder = *arrow_scanner_builder_result; return gadataset_scanner_builder_new_raw(&arrow_scanner_builder); } else { @@ -236,8 +229,7 @@ gadataset_scanner_builder_new(GADatasetDataset *dataset, GError **error) * Since: 6.0.0 */ GADatasetScannerBuilder * -gadataset_scanner_builder_new_record_batch_reader( - GArrowRecordBatchReader *reader) +gadataset_scanner_builder_new_record_batch_reader(GArrowRecordBatchReader *reader) { auto arrow_reader = garrow_record_batch_reader_get_raw(reader); auto arrow_scanner_builder = @@ -278,8 +270,7 @@ gadataset_scanner_builder_set_filter(GADatasetScannerBuilder *builder, * Since: 5.0.0 */ GADatasetScanner * -gadataset_scanner_builder_finish(GADatasetScannerBuilder *builder, - GError **error) +gadataset_scanner_builder_finish(GADatasetScannerBuilder *builder, GError **error) { auto arrow_builder = gadataset_scanner_builder_get_raw(builder); auto arrow_scanner_result = arrow_builder->Finish(); @@ -291,17 +282,13 @@ gadataset_scanner_builder_finish(GADatasetScannerBuilder *builder, } } - G_END_DECLS GADatasetScanner * -gadataset_scanner_new_raw( - std::shared_ptr *arrow_scanner) +gadataset_scanner_new_raw(std::shared_ptr *arrow_scanner) { - auto scanner = - GADATASET_SCANNER(g_object_new(GADATASET_TYPE_SCANNER, - "scanner", arrow_scanner, - NULL)); + auto scanner = GADATASET_SCANNER( + g_object_new(GADATASET_TYPE_SCANNER, "scanner", arrow_scanner, NULL)); return scanner; } @@ -316,10 +303,10 @@ GADatasetScannerBuilder * gadataset_scanner_builder_new_raw( std::shared_ptr *arrow_scanner_builder) { - return GADATASET_SCANNER_BUILDER( - g_object_new(GADATASET_TYPE_SCANNER_BUILDER, - "scanner-builder", arrow_scanner_builder, - NULL)); + return GADATASET_SCANNER_BUILDER(g_object_new(GADATASET_TYPE_SCANNER_BUILDER, + "scanner-builder", + arrow_scanner_builder, + NULL)); } std::shared_ptr diff --git a/c_glib/arrow-dataset-glib/scanner.h b/c_glib/arrow-dataset-glib/scanner.h index 464661c9d0f7a..3c7432fb268e4 100644 --- a/c_glib/arrow-dataset-glib/scanner.h +++ b/c_glib/arrow-dataset-glib/scanner.h @@ -25,11 +25,7 @@ G_BEGIN_DECLS #define GADATASET_TYPE_SCANNER (gadataset_scanner_get_type()) -G_DECLARE_DERIVABLE_TYPE(GADatasetScanner, - gadataset_scanner, - GADATASET, - SCANNER, - GObject) +G_DECLARE_DERIVABLE_TYPE(GADatasetScanner, gadataset_scanner, GADATASET, SCANNER, GObject) struct _GADatasetScannerClass { GObjectClass parent_class; @@ -37,15 +33,11 @@ struct _GADatasetScannerClass GARROW_AVAILABLE_IN_5_0 GArrowTable * -gadataset_scanner_to_table(GADatasetScanner *scanner, - GError **error); +gadataset_scanner_to_table(GADatasetScanner *scanner, GError **error); #define GADATASET_TYPE_SCANNER_BUILDER (gadataset_scanner_builder_get_type()) -G_DECLARE_DERIVABLE_TYPE(GADatasetScannerBuilder, - gadataset_scanner_builder, - GADATASET, - SCANNER_BUILDER, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GADatasetScannerBuilder, gadataset_scanner_builder, GADATASET, SCANNER_BUILDER, GObject) struct _GADatasetScannerBuilderClass { GObjectClass parent_class; @@ -53,12 +45,10 @@ struct _GADatasetScannerBuilderClass GARROW_AVAILABLE_IN_5_0 GADatasetScannerBuilder * -gadataset_scanner_builder_new(GADatasetDataset *dataset, - GError **error); +gadataset_scanner_builder_new(GADatasetDataset *dataset, GError **error); GARROW_AVAILABLE_IN_6_0 GADatasetScannerBuilder * -gadataset_scanner_builder_new_record_batch_reader( - GArrowRecordBatchReader *reader); +gadataset_scanner_builder_new_record_batch_reader(GArrowRecordBatchReader *reader); GARROW_AVAILABLE_IN_6_0 gboolean @@ -68,7 +58,6 @@ gadataset_scanner_builder_set_filter(GADatasetScannerBuilder *builder, GARROW_AVAILABLE_IN_5_0 GADatasetScanner * -gadataset_scanner_builder_finish(GADatasetScannerBuilder *builder, - GError **error); +gadataset_scanner_builder_finish(GADatasetScannerBuilder *builder, GError **error); G_END_DECLS diff --git a/c_glib/arrow-dataset-glib/scanner.hpp b/c_glib/arrow-dataset-glib/scanner.hpp index 663ab6fc44b82..028754a1813fd 100644 --- a/c_glib/arrow-dataset-glib/scanner.hpp +++ b/c_glib/arrow-dataset-glib/scanner.hpp @@ -25,8 +25,7 @@ #include GADatasetScanner * -gadataset_scanner_new_raw( - std::shared_ptr *arrow_scanner); +gadataset_scanner_new_raw(std::shared_ptr *arrow_scanner); std::shared_ptr gadataset_scanner_get_raw(GADatasetScanner *scanner); diff --git a/c_glib/arrow-flight-glib/client.cpp b/c_glib/arrow-flight-glib/client.cpp index 60dec29dbbdfb..80c47e336f872 100644 --- a/c_glib/arrow-flight-glib/client.cpp +++ b/c_glib/arrow-flight-glib/client.cpp @@ -56,18 +56,16 @@ gaflight_stream_reader_class_init(GAFlightStreamReaderClass *klass) { } -typedef struct GAFlightCallOptionsPrivate_ { +typedef struct GAFlightCallOptionsPrivate_ +{ arrow::flight::FlightCallOptions options; } GAFlightCallOptionsPrivate; -G_DEFINE_TYPE_WITH_PRIVATE(GAFlightCallOptions, - gaflight_call_options, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GAFlightCallOptions, gaflight_call_options, G_TYPE_OBJECT) -#define GAFLIGHT_CALL_OPTIONS_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_call_options_get_instance_private( \ - GAFLIGHT_CALL_OPTIONS(obj))) +#define GAFLIGHT_CALL_OPTIONS_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_call_options_get_instance_private(GAFLIGHT_CALL_OPTIONS(obj))) static void gaflight_call_options_finalize(GObject *object) @@ -83,7 +81,7 @@ static void gaflight_call_options_init(GAFlightCallOptions *object) { auto priv = GAFLIGHT_CALL_OPTIONS_GET_PRIVATE(object); - new(&priv->options) arrow::flight::FlightCallOptions; + new (&priv->options) arrow::flight::FlightCallOptions; } static void @@ -165,8 +163,8 @@ gaflight_call_options_foreach_header(GAFlightCallOptions *options, } } - -struct GAFlightClientOptionsPrivate { +struct GAFlightClientOptionsPrivate +{ arrow::flight::FlightClientOptions options; }; @@ -179,14 +177,11 @@ enum { PROP_DISABLE_SERVER_VERIFICATION, }; -G_DEFINE_TYPE_WITH_PRIVATE(GAFlightClientOptions, - gaflight_client_options, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GAFlightClientOptions, gaflight_client_options, G_TYPE_OBJECT) -#define GAFLIGHT_CLIENT_OPTIONS_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_client_options_get_instance_private( \ - GAFLIGHT_CLIENT_OPTIONS(obj))) +#define GAFLIGHT_CLIENT_OPTIONS_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_client_options_get_instance_private(GAFLIGHT_CLIENT_OPTIONS(obj))) static void gaflight_client_options_finalize(GObject *object) @@ -268,7 +263,7 @@ static void gaflight_client_options_init(GAFlightClientOptions *object) { auto priv = GAFLIGHT_CLIENT_OPTIONS_GET_PRIVATE(object); - new(&(priv->options)) arrow::flight::FlightClientOptions; + new (&(priv->options)) arrow::flight::FlightClientOptions; priv->options = arrow::flight::FlightClientOptions::Defaults(); } @@ -295,9 +290,7 @@ gaflight_client_options_class_init(GAFlightClientOptionsClass *klass) nullptr, options.tls_root_certs.c_str(), static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_TLS_ROOT_CERTIFICATES, - spec); + g_object_class_install_property(gobject_class, PROP_TLS_ROOT_CERTIFICATES, spec); /** * GAFlightClientOptions:override-host-name: @@ -311,9 +304,7 @@ gaflight_client_options_class_init(GAFlightClientOptionsClass *klass) nullptr, options.override_hostname.c_str(), static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_OVERRIDE_HOST_NAME, - spec); + g_object_class_install_property(gobject_class, PROP_OVERRIDE_HOST_NAME, spec); /** * GAFlightClientOptions:certificate-chain: @@ -327,9 +318,7 @@ gaflight_client_options_class_init(GAFlightClientOptionsClass *klass) nullptr, options.cert_chain.c_str(), static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_CERTIFICATE_CHAIN, - spec); + g_object_class_install_property(gobject_class, PROP_CERTIFICATE_CHAIN, spec); /** * GAFlightClientOptions:private-key: @@ -344,9 +333,7 @@ gaflight_client_options_class_init(GAFlightClientOptionsClass *klass) nullptr, options.private_key.c_str(), static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_PRIVATE_KEY, - spec); + g_object_class_install_property(gobject_class, PROP_PRIVATE_KEY, spec); /** * GAFlightClientOptions:write-size-limit-bytes: @@ -366,9 +353,7 @@ gaflight_client_options_class_init(GAFlightClientOptionsClass *klass) INT64_MAX, options.write_size_limit_bytes, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_WRITE_SIZE_LIMIT_BYTES, - spec); + g_object_class_install_property(gobject_class, PROP_WRITE_SIZE_LIMIT_BYTES, spec); /** * GAFlightClientOptions:disable-server-verification: @@ -383,9 +368,7 @@ gaflight_client_options_class_init(GAFlightClientOptionsClass *klass) NULL, options.disable_server_verification, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_DISABLE_SERVER_VERIFICATION, - spec); + g_object_class_install_property(gobject_class, PROP_DISABLE_SERVER_VERIFICATION, spec); } /** @@ -402,8 +385,8 @@ gaflight_client_options_new(void) g_object_new(GAFLIGHT_TYPE_CLIENT_OPTIONS, NULL)); } - -struct GAFlightClientPrivate { +struct GAFlightClientPrivate +{ std::shared_ptr client; }; @@ -411,14 +394,11 @@ enum { PROP_CLIENT = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GAFlightClient, - gaflight_client, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GAFlightClient, gaflight_client, G_TYPE_OBJECT) -#define GAFLIGHT_CLIENT_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_client_get_instance_private( \ - GAFLIGHT_CLIENT(obj))) +#define GAFLIGHT_CLIENT_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_client_get_instance_private(GAFLIGHT_CLIENT(obj))) static void gaflight_client_finalize(GObject *object) @@ -440,9 +420,8 @@ gaflight_client_set_property(GObject *object, switch (prop_id) { case PROP_CLIENT: - priv->client = - *(static_cast *>( - g_value_get_pointer(value))); + priv->client = *(static_cast *>( + g_value_get_pointer(value))); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -454,7 +433,7 @@ static void gaflight_client_init(GAFlightClient *object) { auto priv = GAFLIGHT_CLIENT_GET_PRIVATE(object); - new(&priv->client) std::shared_ptr; + new (&priv->client) std::shared_ptr; } static void @@ -466,11 +445,11 @@ gaflight_client_class_init(GAFlightClientClass *klass) gobject_class->set_property = gaflight_client_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("client", - "Client", - "The raw std::shared_ptr", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "client", + "Client", + "The raw std::shared_ptr", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_CLIENT, spec); } @@ -498,8 +477,7 @@ gaflight_client_new(GAFlightLocation *location, result = arrow::flight::FlightClient::Connect(*flight_location); } if (garrow::check(error, result, "[flight-client][new]")) { - std::shared_ptr flight_client = - std::move(*result); + std::shared_ptr flight_client = std::move(*result); return gaflight_client_new_raw(&flight_client); } else { return NULL; @@ -516,14 +494,11 @@ gaflight_client_new(GAFlightLocation *location, * Since: 8.0.0 */ gboolean -gaflight_client_close(GAFlightClient *client, - GError **error) +gaflight_client_close(GAFlightClient *client, GError **error) { auto flight_client = gaflight_client_get_raw(client); auto status = flight_client->Close(); - return garrow::check(error, - status, - "[flight-client][close]"); + return garrow::check(error, status, "[flight-client][close]"); } /** @@ -557,19 +532,13 @@ gaflight_client_authenticate_basic_token(GAFlightClient *client, if (options) { flight_options = gaflight_call_options_get_raw(options); } - auto result = flight_client->AuthenticateBasicToken(*flight_options, - user, - password); - if (!garrow::check(error, - result, - "[flight-client][authenticate-basic-token]")) { + auto result = flight_client->AuthenticateBasicToken(*flight_options, user, password); + if (!garrow::check(error, result, "[flight-client][authenticate-basic-token]")) { return FALSE; } auto bearer_token = *result; - *bearer_name = g_strndup(bearer_token.first.data(), - bearer_token.first.size()); - *bearer_value = g_strndup(bearer_token.second.data(), - bearer_token.second.size()); + *bearer_name = g_strndup(bearer_token.first.data(), bearer_token.first.size()); + *bearer_value = g_strndup(bearer_token.second.data(), bearer_token.second.size()); return TRUE; } @@ -605,18 +574,14 @@ gaflight_client_list_flights(GAFlightClient *client, std::unique_ptr flight_listing; auto result = flight_client->ListFlights(*flight_options, *flight_criteria); auto status = std::move(result).Value(&flight_listing); - if (!garrow::check(error, - status, - "[flight-client][list-flights]")) { + if (!garrow::check(error, status, "[flight-client][list-flights]")) { return NULL; } GList *listing = NULL; std::unique_ptr flight_info; while (true) { status = flight_listing->Next().Value(&flight_info); - if (!garrow::check(error, - status, - "[flight-client][list-flights]")) { + if (!garrow::check(error, status, "[flight-client][list-flights]")) { g_list_free_full(listing, g_object_unref); return NULL; } @@ -654,8 +619,7 @@ gaflight_client_get_flight_info(GAFlightClient *client, if (options) { flight_options = gaflight_call_options_get_raw(options); } - auto result = flight_client->GetFlightInfo(*flight_options, - *flight_descriptor); + auto result = flight_client->GetFlightInfo(*flight_options, *flight_descriptor); if (!garrow::check(error, result, "[flight-client][get-flight-info]")) { return NULL; } @@ -690,29 +654,25 @@ gaflight_client_do_get(GAFlightClient *client, flight_options = gaflight_call_options_get_raw(options); } auto result = flight_client->DoGet(*flight_options, *flight_ticket); - if (!garrow::check(error, - result, - "[flight-client][do-get]")) { + if (!garrow::check(error, result, "[flight-client][do-get]")) { return nullptr; } auto flight_reader = std::move(*result); return gaflight_stream_reader_new_raw(flight_reader.release(), TRUE); } - G_END_DECLS - GAFlightStreamReader * -gaflight_stream_reader_new_raw( - arrow::flight::FlightStreamReader *flight_reader, - gboolean is_owner) -{ - return GAFLIGHT_STREAM_READER( - g_object_new(GAFLIGHT_TYPE_STREAM_READER, - "reader", flight_reader, - "is-owner", is_owner, - NULL)); +gaflight_stream_reader_new_raw(arrow::flight::FlightStreamReader *flight_reader, + gboolean is_owner) +{ + return GAFLIGHT_STREAM_READER(g_object_new(GAFLIGHT_TYPE_STREAM_READER, + "reader", + flight_reader, + "is-owner", + is_owner, + NULL)); } arrow::flight::FlightCallOptions * @@ -737,10 +697,8 @@ gaflight_client_get_raw(GAFlightClient *client) } GAFlightClient * -gaflight_client_new_raw( - std::shared_ptr *flight_client) +gaflight_client_new_raw(std::shared_ptr *flight_client) { - return GAFLIGHT_CLIENT(g_object_new(GAFLIGHT_TYPE_CLIENT, - "client", flight_client, - NULL)); + return GAFLIGHT_CLIENT( + g_object_new(GAFLIGHT_TYPE_CLIENT, "client", flight_client, NULL)); } diff --git a/c_glib/arrow-flight-glib/client.h b/c_glib/arrow-flight-glib/client.h index 42b18bfa6075a..f67d58371d583 100644 --- a/c_glib/arrow-flight-glib/client.h +++ b/c_glib/arrow-flight-glib/client.h @@ -23,9 +23,7 @@ G_BEGIN_DECLS - -#define GAFLIGHT_TYPE_STREAM_READER \ - (gaflight_stream_reader_get_type()) +#define GAFLIGHT_TYPE_STREAM_READER (gaflight_stream_reader_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightStreamReader, gaflight_stream_reader, GAFLIGHT, @@ -36,13 +34,9 @@ struct _GAFlightStreamReaderClass GAFlightRecordBatchReaderClass parent_class; }; - #define GAFLIGHT_TYPE_CALL_OPTIONS (gaflight_call_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GAFlightCallOptions, - gaflight_call_options, - GAFLIGHT, - CALL_OPTIONS, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GAFlightCallOptions, gaflight_call_options, GAFLIGHT, CALL_OPTIONS, GObject) struct _GAFlightCallOptionsClass { GObjectClass parent_class; @@ -66,13 +60,9 @@ gaflight_call_options_foreach_header(GAFlightCallOptions *options, GAFlightHeaderFunc func, gpointer user_data); - #define GAFLIGHT_TYPE_CLIENT_OPTIONS (gaflight_client_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GAFlightClientOptions, - gaflight_client_options, - GAFLIGHT, - CLIENT_OPTIONS, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GAFlightClientOptions, gaflight_client_options, GAFLIGHT, CLIENT_OPTIONS, GObject) struct _GAFlightClientOptionsClass { GObjectClass parent_class; @@ -82,13 +72,8 @@ GARROW_AVAILABLE_IN_5_0 GAFlightClientOptions * gaflight_client_options_new(void); - #define GAFLIGHT_TYPE_CLIENT (gaflight_client_get_type()) -G_DECLARE_DERIVABLE_TYPE(GAFlightClient, - gaflight_client, - GAFLIGHT, - CLIENT, - GObject) +G_DECLARE_DERIVABLE_TYPE(GAFlightClient, gaflight_client, GAFLIGHT, CLIENT, GObject) struct _GAFlightClientClass { GObjectClass parent_class; @@ -102,8 +87,7 @@ gaflight_client_new(GAFlightLocation *location, GARROW_AVAILABLE_IN_8_0 gboolean -gaflight_client_close(GAFlightClient *client, - GError **error); +gaflight_client_close(GAFlightClient *client, GError **error); GARROW_AVAILABLE_IN_12_0 gboolean @@ -136,5 +120,4 @@ gaflight_client_do_get(GAFlightClient *client, GAFlightCallOptions *options, GError **error); - G_END_DECLS diff --git a/c_glib/arrow-flight-glib/client.hpp b/c_glib/arrow-flight-glib/client.hpp index b6b768b8d3197..6d7bdcecf3006 100644 --- a/c_glib/arrow-flight-glib/client.hpp +++ b/c_glib/arrow-flight-glib/client.hpp @@ -23,11 +23,9 @@ #include - GAFlightStreamReader * -gaflight_stream_reader_new_raw( - arrow::flight::FlightStreamReader *flight_reader, - gboolean is_owner); +gaflight_stream_reader_new_raw(arrow::flight::FlightStreamReader *flight_reader, + gboolean is_owner); arrow::flight::FlightCallOptions * gaflight_call_options_get_raw(GAFlightCallOptions *options); @@ -38,5 +36,4 @@ gaflight_client_options_get_raw(GAFlightClientOptions *options); std::shared_ptr gaflight_client_get_raw(GAFlightClient *client); GAFlightClient * -gaflight_client_new_raw( - std::shared_ptr *flight_client); +gaflight_client_new_raw(std::shared_ptr *flight_client); diff --git a/c_glib/arrow-flight-glib/common.cpp b/c_glib/arrow-flight-glib/common.cpp index 5aee3483032ae..efc544f10cf66 100644 --- a/c_glib/arrow-flight-glib/common.cpp +++ b/c_glib/arrow-flight-glib/common.cpp @@ -53,7 +53,6 @@ G_BEGIN_DECLS * Since: 5.0.0 */ - /** * GAFlightHeaderFunc: * @name: A header name. @@ -68,8 +67,8 @@ G_BEGIN_DECLS * Since: 9.0.0 */ - -typedef struct GAFlightCriteriaPrivate_ { +typedef struct GAFlightCriteriaPrivate_ +{ arrow::flight::Criteria criteria; GBytes *expression; } GAFlightCriteriaPrivate; @@ -78,14 +77,11 @@ enum { PROP_EXPRESSION = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GAFlightCriteria, - gaflight_criteria, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GAFlightCriteria, gaflight_criteria, G_TYPE_OBJECT) -#define GAFLIGHT_CRITERIA_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_criteria_get_instance_private( \ - GAFLIGHT_CRITERIA(obj))) +#define GAFLIGHT_CRITERIA_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_criteria_get_instance_private(GAFLIGHT_CRITERIA(obj))) static void gaflight_criteria_dispose(GObject *object) @@ -127,8 +123,7 @@ gaflight_criteria_set_property(GObject *object, { gsize size; auto data = g_bytes_get_data(priv->expression, &size); - priv->criteria.expression.assign(static_cast(data), - size); + priv->criteria.expression.assign(static_cast(data), size); } break; default: @@ -159,7 +154,7 @@ static void gaflight_criteria_init(GAFlightCriteria *object) { auto priv = GAFLIGHT_CRITERIA_GET_PRIVATE(object); - new(&priv->criteria) arrow::flight::Criteria; + new (&priv->criteria) arrow::flight::Criteria; } static void @@ -201,24 +196,19 @@ GAFlightCriteria * gaflight_criteria_new(GBytes *expression) { return GAFLIGHT_CRITERIA( - g_object_new(GAFLIGHT_TYPE_CRITERIA, - "expression", expression, - NULL)); + g_object_new(GAFLIGHT_TYPE_CRITERIA, "expression", expression, NULL)); } - -typedef struct GAFlightLocationPrivate_ { +typedef struct GAFlightLocationPrivate_ +{ arrow::flight::Location location; } GAFlightLocationPrivate; -G_DEFINE_TYPE_WITH_PRIVATE(GAFlightLocation, - gaflight_location, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GAFlightLocation, gaflight_location, G_TYPE_OBJECT) -#define GAFLIGHT_LOCATION_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_location_get_instance_private( \ - GAFLIGHT_LOCATION(obj))) +#define GAFLIGHT_LOCATION_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_location_get_instance_private(GAFLIGHT_LOCATION(obj))) static void gaflight_location_finalize(GObject *object) @@ -234,7 +224,7 @@ static void gaflight_location_init(GAFlightLocation *object) { auto priv = GAFLIGHT_LOCATION_GET_PRIVATE(object); - new(&priv->location) arrow::flight::Location; + new (&priv->location) arrow::flight::Location; } static void @@ -255,8 +245,7 @@ gaflight_location_class_init(GAFlightLocationClass *klass) * Since: 5.0.0 */ GAFlightLocation * -gaflight_location_new(const gchar *uri, - GError **error) +gaflight_location_new(const gchar *uri, GError **error) { auto location = GAFLIGHT_LOCATION(g_object_new(GAFLIGHT_TYPE_LOCATION, NULL)); auto flight_location = gaflight_location_get_raw(location); @@ -316,16 +305,15 @@ gaflight_location_get_scheme(GAFlightLocation *location) * Since: 5.0.0 */ gboolean -gaflight_location_equal(GAFlightLocation *location, - GAFlightLocation *other_location) +gaflight_location_equal(GAFlightLocation *location, GAFlightLocation *other_location) { const auto flight_location = gaflight_location_get_raw(location); const auto flight_other_location = gaflight_location_get_raw(other_location); return flight_location->Equals(*flight_other_location); } - -typedef struct GAFlightDescriptorPrivate_ { +typedef struct GAFlightDescriptorPrivate_ +{ arrow::flight::FlightDescriptor descriptor; } GAFlightDescriptorPrivate; @@ -337,10 +325,9 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GAFlightDescriptor, gaflight_descriptor, G_TYPE_OBJECT) -#define GAFLIGHT_DESCRIPTOR_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_descriptor_get_instance_private( \ - GAFLIGHT_DESCRIPTOR(obj))) +#define GAFLIGHT_DESCRIPTOR_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_descriptor_get_instance_private(GAFLIGHT_DESCRIPTOR(obj))) static void gaflight_descriptor_finalize(GObject *object) @@ -362,8 +349,8 @@ gaflight_descriptor_set_property(GObject *object, switch (prop_id) { case PROP_DESCRIPTOR: - priv->descriptor = *static_cast( - g_value_get_pointer(value)); + priv->descriptor = + *static_cast(g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -375,7 +362,7 @@ static void gaflight_descriptor_init(GAFlightDescriptor *object) { auto priv = GAFLIGHT_DESCRIPTOR_GET_PRIVATE(object); - new(&priv->descriptor) arrow::flight::FlightDescriptor; + new (&priv->descriptor) arrow::flight::FlightDescriptor; } static void @@ -387,11 +374,11 @@ gaflight_descriptor_class_init(GAFlightDescriptorClass *klass) gobject_class->set_property = gaflight_descriptor_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("descriptor", - "Descriptor", - "The raw arrow::flight::FlightDescriptor", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "descriptor", + "Descriptor", + "The raw arrow::flight::FlightDescriptor", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_EXPRESSION, spec); } @@ -427,17 +414,12 @@ gboolean gaflight_descriptor_equal(GAFlightDescriptor *descriptor, GAFlightDescriptor *other_descriptor) { - const auto flight_descriptor = - gaflight_descriptor_get_raw(descriptor); - const auto flight_other_descriptor = - gaflight_descriptor_get_raw(other_descriptor); + const auto flight_descriptor = gaflight_descriptor_get_raw(descriptor); + const auto flight_other_descriptor = gaflight_descriptor_get_raw(other_descriptor); return flight_descriptor->Equals(*flight_other_descriptor); } - -G_DEFINE_TYPE(GAFlightPathDescriptor, - gaflight_path_descriptor, - GAFLIGHT_TYPE_DESCRIPTOR) +G_DEFINE_TYPE(GAFlightPathDescriptor, gaflight_path_descriptor, GAFLIGHT_TYPE_DESCRIPTOR) static void gaflight_path_descriptor_init(GAFlightPathDescriptor *object) @@ -460,16 +442,14 @@ gaflight_path_descriptor_class_init(GAFlightPathDescriptorClass *klass) * Since: 5.0.0 */ GAFlightPathDescriptor * -gaflight_path_descriptor_new(const gchar **paths, - gsize n_paths) +gaflight_path_descriptor_new(const gchar **paths, gsize n_paths) { std::vector flight_paths; for (gsize i = 0; i < n_paths; i++) { flight_paths.push_back(paths[i]); } auto flight_descriptor = arrow::flight::FlightDescriptor::Path(flight_paths); - return GAFLIGHT_PATH_DESCRIPTOR( - gaflight_descriptor_new_raw(&flight_descriptor)); + return GAFLIGHT_PATH_DESCRIPTOR(gaflight_descriptor_new_raw(&flight_descriptor)); } /** @@ -502,7 +482,6 @@ gaflight_path_descriptor_get_paths(GAFlightPathDescriptor *descriptor) } } - G_DEFINE_TYPE(GAFlightCommandDescriptor, gaflight_command_descriptor, GAFLIGHT_TYPE_DESCRIPTOR) @@ -529,8 +508,7 @@ GAFlightCommandDescriptor * gaflight_command_descriptor_new(const gchar *command) { auto flight_descriptor = arrow::flight::FlightDescriptor::Command(command); - return GAFLIGHT_COMMAND_DESCRIPTOR( - gaflight_descriptor_new_raw(&flight_descriptor)); + return GAFLIGHT_COMMAND_DESCRIPTOR(gaflight_descriptor_new_raw(&flight_descriptor)); } /** @@ -552,8 +530,8 @@ gaflight_command_descriptor_get_command(GAFlightCommandDescriptor *descriptor) return g_strdup(flight_command.c_str()); } - -typedef struct GAFlightTicketPrivate_ { +typedef struct GAFlightTicketPrivate_ +{ arrow::flight::Ticket ticket; GBytes *data; } GAFlightTicketPrivate; @@ -562,14 +540,11 @@ enum { PROP_DATA = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GAFlightTicket, - gaflight_ticket, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GAFlightTicket, gaflight_ticket, G_TYPE_OBJECT) -#define GAFLIGHT_TICKET_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_ticket_get_instance_private( \ - GAFLIGHT_TICKET(obj))) +#define GAFLIGHT_TICKET_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_ticket_get_instance_private(GAFLIGHT_TICKET(obj))) static void gaflight_ticket_dispose(GObject *object) @@ -611,8 +586,7 @@ gaflight_ticket_set_property(GObject *object, { gsize size; auto data = g_bytes_get_data(priv->data, &size); - priv->ticket.ticket.assign(static_cast(data), - size); + priv->ticket.ticket.assign(static_cast(data), size); } break; default: @@ -643,7 +617,7 @@ static void gaflight_ticket_init(GAFlightTicket *object) { auto priv = GAFLIGHT_TICKET_GET_PRIVATE(object); - new(&priv->ticket) arrow::flight::Ticket; + new (&priv->ticket) arrow::flight::Ticket; } static void @@ -685,10 +659,7 @@ gaflight_ticket_class_init(GAFlightTicketClass *klass) GAFlightTicket * gaflight_ticket_new(GBytes *data) { - return GAFLIGHT_TICKET( - g_object_new(GAFLIGHT_TYPE_TICKET, - "data", data, - NULL)); + return GAFLIGHT_TICKET(g_object_new(GAFLIGHT_TYPE_TICKET, "data", data, NULL)); } /** @@ -701,16 +672,15 @@ gaflight_ticket_new(GBytes *data) * Since: 5.0.0 */ gboolean -gaflight_ticket_equal(GAFlightTicket *ticket, - GAFlightTicket *other_ticket) +gaflight_ticket_equal(GAFlightTicket *ticket, GAFlightTicket *other_ticket) { const auto flight_ticket = gaflight_ticket_get_raw(ticket); const auto flight_other_ticket = gaflight_ticket_get_raw(other_ticket); return flight_ticket->Equals(*flight_other_ticket); } - -typedef struct GAFlightEndpointPrivate_ { +typedef struct GAFlightEndpointPrivate_ +{ arrow::flight::FlightEndpoint endpoint; GAFlightTicket *ticket; GList *locations; @@ -720,14 +690,11 @@ enum { PROP_TICKET = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GAFlightEndpoint, - gaflight_endpoint, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GAFlightEndpoint, gaflight_endpoint, G_TYPE_OBJECT) -#define GAFLIGHT_ENDPOINT_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_endpoint_get_instance_private( \ - GAFLIGHT_ENDPOINT(obj))) +#define GAFLIGHT_ENDPOINT_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_endpoint_get_instance_private(GAFLIGHT_ENDPOINT(obj))) static void gaflight_endpoint_dispose(GObject *object) @@ -779,7 +746,7 @@ static void gaflight_endpoint_init(GAFlightEndpoint *object) { auto priv = GAFLIGHT_ENDPOINT_GET_PRIVATE(object); - new(&priv->endpoint) arrow::flight::FlightEndpoint; + new (&priv->endpoint) arrow::flight::FlightEndpoint; } static void @@ -817,8 +784,7 @@ gaflight_endpoint_class_init(GAFlightEndpointClass *klass) * Since: 5.0.0 */ GAFlightEndpoint * -gaflight_endpoint_new(GAFlightTicket *ticket, - GList *locations) +gaflight_endpoint_new(GAFlightTicket *ticket, GList *locations) { auto endpoint = gaflight_endpoint_new_raw(nullptr, ticket); auto priv = GAFLIGHT_ENDPOINT_GET_PRIVATE(endpoint); @@ -840,8 +806,7 @@ gaflight_endpoint_new(GAFlightTicket *ticket, * Since: 5.0.0 */ gboolean -gaflight_endpoint_equal(GAFlightEndpoint *endpoint, - GAFlightEndpoint *other_endpoint) +gaflight_endpoint_equal(GAFlightEndpoint *endpoint, GAFlightEndpoint *other_endpoint) { const auto flight_endpoint = gaflight_endpoint_get_raw(endpoint); const auto flight_other_endpoint = gaflight_endpoint_get_raw(other_endpoint); @@ -867,15 +832,14 @@ gaflight_endpoint_get_locations(GAFlightEndpoint *endpoint) const auto flight_endpoint = gaflight_endpoint_get_raw(endpoint); GList *locations = NULL; for (const auto &flight_location : flight_endpoint->locations) { - auto location = gaflight_location_new(flight_location.ToString().c_str(), - nullptr); + auto location = gaflight_location_new(flight_location.ToString().c_str(), nullptr); locations = g_list_prepend(locations, location); } return g_list_reverse(locations); } - -typedef struct GAFlightInfoPrivate_ { +typedef struct GAFlightInfoPrivate_ +{ arrow::flight::FlightInfo info; } GAFlightInfoPrivate; @@ -883,14 +847,11 @@ enum { PROP_INFO = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GAFlightInfo, - gaflight_info, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GAFlightInfo, gaflight_info, G_TYPE_OBJECT) -#define GAFLIGHT_INFO_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_info_get_instance_private( \ - GAFLIGHT_INFO(obj))) +#define GAFLIGHT_INFO_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_info_get_instance_private(GAFLIGHT_INFO(obj))) static void gaflight_info_finalize(GObject *object) @@ -913,9 +874,8 @@ gaflight_info_set_property(GObject *object, switch (prop_id) { case PROP_INFO: { - auto info = - static_cast(g_value_get_pointer(value)); - new(&(priv->info)) arrow::flight::FlightInfo(*info); + auto info = static_cast(g_value_get_pointer(value)); + new (&(priv->info)) arrow::flight::FlightInfo(*info); } break; default: @@ -938,11 +898,11 @@ gaflight_info_class_init(GAFlightInfoClass *klass) gobject_class->set_property = gaflight_info_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("info", - "Info", - "The raw arrow::flight::FlightInfo *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "info", + "Info", + "The raw arrow::flight::FlightInfo *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_INFO, spec); } @@ -974,15 +934,12 @@ gaflight_info_new(GArrowSchema *schema, auto endpoint = GAFLIGHT_ENDPOINT(node->data); flight_endpoints.push_back(*gaflight_endpoint_get_raw(endpoint)); } - auto flight_info_result = - arrow::flight::FlightInfo::Make(*arrow_schema, - *flight_descriptor, - flight_endpoints, - total_records, - total_bytes); - if (!garrow::check(error, - flight_info_result, - "[flight-info][new]")) { + auto flight_info_result = arrow::flight::FlightInfo::Make(*arrow_schema, + *flight_descriptor, + flight_endpoints, + total_records, + total_bytes); + if (!garrow::check(error, flight_info_result, "[flight-info][new]")) { return NULL; } return gaflight_info_new_raw(&(*flight_info_result)); @@ -999,22 +956,15 @@ gaflight_info_new(GArrowSchema *schema, * Since: 5.0.0 */ gboolean -gaflight_info_equal(GAFlightInfo *info, - GAFlightInfo *other_info) +gaflight_info_equal(GAFlightInfo *info, GAFlightInfo *other_info) { const auto flight_info = gaflight_info_get_raw(info); const auto flight_other_info = gaflight_info_get_raw(other_info); - return - (flight_info->serialized_schema() == - flight_other_info->serialized_schema()) && - (flight_info->descriptor() == - flight_other_info->descriptor()) && - (flight_info->endpoints() == - flight_other_info->endpoints()) && - (flight_info->total_records() == - flight_other_info->total_records()) && - (flight_info->total_bytes() == - flight_other_info->total_bytes()); + return (flight_info->serialized_schema() == flight_other_info->serialized_schema()) && + (flight_info->descriptor() == flight_other_info->descriptor()) && + (flight_info->endpoints() == flight_other_info->endpoints()) && + (flight_info->total_records() == flight_other_info->total_records()) && + (flight_info->total_bytes() == flight_other_info->total_bytes()); } /** @@ -1028,9 +978,7 @@ gaflight_info_equal(GAFlightInfo *info, * Since: 5.0.0 */ GArrowSchema * -gaflight_info_get_schema(GAFlightInfo *info, - GArrowReadOptions *options, - GError **error) +gaflight_info_get_schema(GAFlightInfo *info, GArrowReadOptions *options, GError **error) { const auto flight_info = gaflight_info_get_raw(info); arrow::Status status; @@ -1115,7 +1063,8 @@ gaflight_info_get_total_bytes(GAFlightInfo *info) return flight_info->total_bytes(); } -typedef struct GAFlightStreamChunkPrivate_ { +typedef struct GAFlightStreamChunkPrivate_ +{ arrow::flight::FlightStreamChunk chunk; } GAFlightStreamChunkPrivate; @@ -1123,14 +1072,11 @@ enum { PROP_CHUNK = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GAFlightStreamChunk, - gaflight_stream_chunk, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GAFlightStreamChunk, gaflight_stream_chunk, G_TYPE_OBJECT) -#define GAFLIGHT_STREAM_CHUNK_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_stream_chunk_get_instance_private( \ - GAFLIGHT_STREAM_CHUNK(obj))) +#define GAFLIGHT_STREAM_CHUNK_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_stream_chunk_get_instance_private(GAFLIGHT_STREAM_CHUNK(obj))) static void gaflight_stream_chunk_finalize(GObject *object) @@ -1153,8 +1099,7 @@ gaflight_stream_chunk_set_property(GObject *object, switch (prop_id) { case PROP_CHUNK: priv->chunk = - *static_cast( - g_value_get_pointer(value)); + *static_cast(g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -1176,11 +1121,11 @@ gaflight_stream_chunk_class_init(GAFlightStreamChunkClass *klass) gobject_class->set_property = gaflight_stream_chunk_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("chunk", - "Stream chunk", - "The raw arrow::flight::FlightStreamChunk *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "chunk", + "Stream chunk", + "The raw arrow::flight::FlightStreamChunk *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_CHUNK, spec); } @@ -1220,8 +1165,8 @@ gaflight_stream_chunk_get_metadata(GAFlightStreamChunk *chunk) } } - -typedef struct GAFlightRecordBatchReaderPrivate_ { +typedef struct GAFlightRecordBatchReaderPrivate_ +{ arrow::flight::MetadataRecordBatchReader *reader; bool is_owner; } GAFlightRecordBatchReaderPrivate; @@ -1235,9 +1180,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GAFlightRecordBatchReader, gaflight_record_batch_reader, G_TYPE_OBJECT) -#define GAFLIGHT_RECORD_BATCH_READER_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_record_batch_reader_get_instance_private( \ +#define GAFLIGHT_RECORD_BATCH_READER_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_record_batch_reader_get_instance_private( \ GAFLIGHT_RECORD_BATCH_READER(obj))) static void @@ -1261,8 +1206,7 @@ gaflight_record_batch_reader_set_property(GObject *object, switch (prop_id) { case PROP_READER: priv->reader = - static_cast( - g_value_get_pointer(value)); + static_cast(g_value_get_pointer(value)); break; case PROP_IS_OWNER: priv->is_owner = g_value_get_boolean(value); @@ -1287,19 +1231,19 @@ gaflight_record_batch_reader_class_init(GAFlightRecordBatchReaderClass *klass) gobject_class->set_property = gaflight_record_batch_reader_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("reader", - nullptr, - nullptr, - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "reader", + nullptr, + nullptr, + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_READER, spec); - spec = g_param_spec_boolean("is-owner", - nullptr, - nullptr, - TRUE, - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_boolean( + "is-owner", + nullptr, + nullptr, + TRUE, + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_IS_OWNER, spec); } @@ -1314,8 +1258,7 @@ gaflight_record_batch_reader_class_init(GAFlightRecordBatchReaderClass *klass) * Since: 6.0.0 */ GAFlightStreamChunk * -gaflight_record_batch_reader_read_next(GAFlightRecordBatchReader *reader, - GError **error) +gaflight_record_batch_reader_read_next(GAFlightRecordBatchReader *reader, GError **error) { auto flight_reader = gaflight_record_batch_reader_get_raw(reader); arrow::flight::FlightStreamChunk flight_chunk; @@ -1341,8 +1284,7 @@ gaflight_record_batch_reader_read_next(GAFlightRecordBatchReader *reader, * Since: 6.0.0 */ GArrowTable * -gaflight_record_batch_reader_read_all(GAFlightRecordBatchReader *reader, - GError **error) +gaflight_record_batch_reader_read_all(GAFlightRecordBatchReader *reader, GError **error) { auto flight_reader = gaflight_record_batch_reader_get_raw(reader); std::shared_ptr arrow_table; @@ -1354,18 +1296,16 @@ gaflight_record_batch_reader_read_all(GAFlightRecordBatchReader *reader, } } - G_END_DECLS - GAFlightCriteria * gaflight_criteria_new_raw(const arrow::flight::Criteria *flight_criteria) { auto criteria = g_object_new(GAFLIGHT_TYPE_CRITERIA, NULL); auto priv = GAFLIGHT_CRITERIA_GET_PRIVATE(criteria); priv->criteria = *flight_criteria; - priv->expression = g_bytes_new(priv->criteria.expression.data(), - priv->criteria.expression.size()); + priv->expression = + g_bytes_new(priv->criteria.expression.data(), priv->criteria.expression.size()); return GAFLIGHT_CRITERIA(criteria); } @@ -1384,8 +1324,7 @@ gaflight_location_get_raw(GAFlightLocation *location) } GAFlightDescriptor * -gaflight_descriptor_new_raw( - const arrow::flight::FlightDescriptor *flight_descriptor) +gaflight_descriptor_new_raw(const arrow::flight::FlightDescriptor *flight_descriptor) { GType gtype = GAFLIGHT_TYPE_DESCRIPTOR; switch (flight_descriptor->type) { @@ -1398,9 +1337,7 @@ gaflight_descriptor_new_raw( default: break; } - return GAFLIGHT_DESCRIPTOR(g_object_new(gtype, - "descriptor", flight_descriptor, - NULL)); + return GAFLIGHT_DESCRIPTOR(g_object_new(gtype, "descriptor", flight_descriptor, NULL)); } arrow::flight::FlightDescriptor * @@ -1416,8 +1353,7 @@ gaflight_ticket_new_raw(const arrow::flight::Ticket *flight_ticket) auto ticket = g_object_new(GAFLIGHT_TYPE_TICKET, NULL); auto priv = GAFLIGHT_TICKET_GET_PRIVATE(ticket); priv->ticket = *flight_ticket; - priv->data = g_bytes_new(priv->ticket.ticket.data(), - priv->ticket.ticket.size()); + priv->data = g_bytes_new(priv->ticket.ticket.data(), priv->ticket.ticket.size()); return GAFLIGHT_TICKET(ticket); } @@ -1432,8 +1368,7 @@ GAFlightEndpoint * gaflight_endpoint_new_raw(const arrow::flight::FlightEndpoint *flight_endpoint, GAFlightTicket *ticket) { - auto endpoint = GAFLIGHT_ENDPOINT(g_object_new(GAFLIGHT_TYPE_ENDPOINT, - NULL)); + auto endpoint = GAFLIGHT_ENDPOINT(g_object_new(GAFLIGHT_TYPE_ENDPOINT, NULL)); auto priv = GAFLIGHT_ENDPOINT_GET_PRIVATE(endpoint); if (ticket) { priv->ticket = ticket; @@ -1463,9 +1398,7 @@ gaflight_endpoint_get_raw(GAFlightEndpoint *endpoint) GAFlightInfo * gaflight_info_new_raw(arrow::flight::FlightInfo *flight_info) { - return GAFLIGHT_INFO(g_object_new(GAFLIGHT_TYPE_INFO, - "info", flight_info, - NULL)); + return GAFLIGHT_INFO(g_object_new(GAFLIGHT_TYPE_INFO, "info", flight_info, NULL)); } arrow::flight::FlightInfo * @@ -1479,9 +1412,7 @@ GAFlightStreamChunk * gaflight_stream_chunk_new_raw(arrow::flight::FlightStreamChunk *flight_chunk) { return GAFLIGHT_STREAM_CHUNK( - g_object_new(GAFLIGHT_TYPE_STREAM_CHUNK, - "chunk", flight_chunk, - NULL)); + g_object_new(GAFLIGHT_TYPE_STREAM_CHUNK, "chunk", flight_chunk, NULL)); } arrow::flight::FlightStreamChunk * diff --git a/c_glib/arrow-flight-glib/common.h b/c_glib/arrow-flight-glib/common.h index 469ff4097f59e..fcb23b1885ea7 100644 --- a/c_glib/arrow-flight-glib/common.h +++ b/c_glib/arrow-flight-glib/common.h @@ -23,18 +23,12 @@ G_BEGIN_DECLS - -typedef void(*GAFlightHeaderFunc)(const gchar *name, - const gchar *value, - gpointer user_data); - +typedef void (*GAFlightHeaderFunc)(const gchar *name, + const gchar *value, + gpointer user_data); #define GAFLIGHT_TYPE_CRITERIA (gaflight_criteria_get_type()) -G_DECLARE_DERIVABLE_TYPE(GAFlightCriteria, - gaflight_criteria, - GAFLIGHT, - CRITERIA, - GObject) +G_DECLARE_DERIVABLE_TYPE(GAFlightCriteria, gaflight_criteria, GAFLIGHT, CRITERIA, GObject) struct _GAFlightCriteriaClass { GObjectClass parent_class; @@ -44,13 +38,8 @@ GARROW_AVAILABLE_IN_5_0 GAFlightCriteria * gaflight_criteria_new(GBytes *expression); - #define GAFLIGHT_TYPE_LOCATION (gaflight_location_get_type()) -G_DECLARE_DERIVABLE_TYPE(GAFlightLocation, - gaflight_location, - GAFLIGHT, - LOCATION, - GObject) +G_DECLARE_DERIVABLE_TYPE(GAFlightLocation, gaflight_location, GAFLIGHT, LOCATION, GObject) struct _GAFlightLocationClass { GObjectClass parent_class; @@ -58,8 +47,7 @@ struct _GAFlightLocationClass GARROW_AVAILABLE_IN_5_0 GAFlightLocation * -gaflight_location_new(const gchar *uri, - GError **error); +gaflight_location_new(const gchar *uri, GError **error); GARROW_AVAILABLE_IN_5_0 gchar * @@ -71,16 +59,11 @@ gaflight_location_get_scheme(GAFlightLocation *location); GARROW_AVAILABLE_IN_5_0 gboolean -gaflight_location_equal(GAFlightLocation *location, - GAFlightLocation *other_location); - +gaflight_location_equal(GAFlightLocation *location, GAFlightLocation *other_location); #define GAFLIGHT_TYPE_DESCRIPTOR (gaflight_descriptor_get_type()) -G_DECLARE_DERIVABLE_TYPE(GAFlightDescriptor, - gaflight_descriptor, - GAFLIGHT, - DESCRIPTOR, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GAFlightDescriptor, gaflight_descriptor, GAFLIGHT, DESCRIPTOR, GObject) struct _GAFlightDescriptorClass { GObjectClass parent_class; @@ -95,7 +78,6 @@ gboolean gaflight_descriptor_equal(GAFlightDescriptor *descriptor, GAFlightDescriptor *other_descriptor); - #define GAFLIGHT_TYPE_PATH_DESCRIPTOR (gaflight_path_descriptor_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightPathDescriptor, gaflight_path_descriptor, @@ -109,14 +91,12 @@ struct _GAFlightPathDescriptorClass GARROW_AVAILABLE_IN_5_0 GAFlightPathDescriptor * -gaflight_path_descriptor_new(const gchar **paths, - gsize n_paths); +gaflight_path_descriptor_new(const gchar **paths, gsize n_paths); GARROW_AVAILABLE_IN_5_0 gchar ** gaflight_path_descriptor_get_paths(GAFlightPathDescriptor *descriptor); - #define GAFLIGHT_TYPE_COMMAND_DESCRIPTOR (gaflight_command_descriptor_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightCommandDescriptor, gaflight_command_descriptor, @@ -136,13 +116,8 @@ GARROW_AVAILABLE_IN_5_0 gchar * gaflight_command_descriptor_get_command(GAFlightCommandDescriptor *descriptor); - #define GAFLIGHT_TYPE_TICKET (gaflight_ticket_get_type()) -G_DECLARE_DERIVABLE_TYPE(GAFlightTicket, - gaflight_ticket, - GAFLIGHT, - TICKET, - GObject) +G_DECLARE_DERIVABLE_TYPE(GAFlightTicket, gaflight_ticket, GAFLIGHT, TICKET, GObject) struct _GAFlightTicketClass { GObjectClass parent_class; @@ -154,16 +129,10 @@ gaflight_ticket_new(GBytes *data); GARROW_AVAILABLE_IN_5_0 gboolean -gaflight_ticket_equal(GAFlightTicket *ticket, - GAFlightTicket *other_ticket); - +gaflight_ticket_equal(GAFlightTicket *ticket, GAFlightTicket *other_ticket); #define GAFLIGHT_TYPE_ENDPOINT (gaflight_endpoint_get_type()) -G_DECLARE_DERIVABLE_TYPE(GAFlightEndpoint, - gaflight_endpoint, - GAFLIGHT, - ENDPOINT, - GObject) +G_DECLARE_DERIVABLE_TYPE(GAFlightEndpoint, gaflight_endpoint, GAFLIGHT, ENDPOINT, GObject) struct _GAFlightEndpointClass { GObjectClass parent_class; @@ -171,25 +140,18 @@ struct _GAFlightEndpointClass GARROW_AVAILABLE_IN_5_0 GAFlightEndpoint * -gaflight_endpoint_new(GAFlightTicket *ticket, - GList *locations); +gaflight_endpoint_new(GAFlightTicket *ticket, GList *locations); GARROW_AVAILABLE_IN_5_0 gboolean -gaflight_endpoint_equal(GAFlightEndpoint *endpoint, - GAFlightEndpoint *other_endpoint); +gaflight_endpoint_equal(GAFlightEndpoint *endpoint, GAFlightEndpoint *other_endpoint); GARROW_AVAILABLE_IN_5_0 GList * gaflight_endpoint_get_locations(GAFlightEndpoint *endpoint); - #define GAFLIGHT_TYPE_INFO (gaflight_info_get_type()) -G_DECLARE_DERIVABLE_TYPE(GAFlightInfo, - gaflight_info, - GAFLIGHT, - INFO, - GObject) +G_DECLARE_DERIVABLE_TYPE(GAFlightInfo, gaflight_info, GAFLIGHT, INFO, GObject) struct _GAFlightInfoClass { GObjectClass parent_class; @@ -206,14 +168,11 @@ gaflight_info_new(GArrowSchema *schema, GARROW_AVAILABLE_IN_5_0 gboolean -gaflight_info_equal(GAFlightInfo *info, - GAFlightInfo *other_info); +gaflight_info_equal(GAFlightInfo *info, GAFlightInfo *other_info); GARROW_AVAILABLE_IN_5_0 GArrowSchema * -gaflight_info_get_schema(GAFlightInfo *info, - GArrowReadOptions *options, - GError **error); +gaflight_info_get_schema(GAFlightInfo *info, GArrowReadOptions *options, GError **error); GARROW_AVAILABLE_IN_5_0 GAFlightDescriptor * gaflight_info_get_descriptor(GAFlightInfo *info); @@ -227,13 +186,9 @@ GARROW_AVAILABLE_IN_5_0 gint64 gaflight_info_get_total_bytes(GAFlightInfo *info); - #define GAFLIGHT_TYPE_STREAM_CHUNK (gaflight_stream_chunk_get_type()) -G_DECLARE_DERIVABLE_TYPE(GAFlightStreamChunk, - gaflight_stream_chunk, - GAFLIGHT, - STREAM_CHUNK, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GAFlightStreamChunk, gaflight_stream_chunk, GAFLIGHT, STREAM_CHUNK, GObject) struct _GAFlightStreamChunkClass { GObjectClass parent_class; @@ -246,9 +201,7 @@ GARROW_AVAILABLE_IN_6_0 GArrowBuffer * gaflight_stream_chunk_get_metadata(GAFlightStreamChunk *chunk); - -#define GAFLIGHT_TYPE_RECORD_BATCH_READER \ - (gaflight_record_batch_reader_get_type()) +#define GAFLIGHT_TYPE_RECORD_BATCH_READER (gaflight_record_batch_reader_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightRecordBatchReader, gaflight_record_batch_reader, GAFLIGHT, @@ -261,13 +214,10 @@ struct _GAFlightRecordBatchReaderClass GARROW_AVAILABLE_IN_6_0 GAFlightStreamChunk * -gaflight_record_batch_reader_read_next(GAFlightRecordBatchReader *reader, - GError **error); +gaflight_record_batch_reader_read_next(GAFlightRecordBatchReader *reader, GError **error); GARROW_AVAILABLE_IN_6_0 GArrowTable * -gaflight_record_batch_reader_read_all(GAFlightRecordBatchReader *reader, - GError **error); - +gaflight_record_batch_reader_read_all(GAFlightRecordBatchReader *reader, GError **error); G_END_DECLS diff --git a/c_glib/arrow-flight-glib/common.hpp b/c_glib/arrow-flight-glib/common.hpp index d23f7c8867f5f..b748d6f382184 100644 --- a/c_glib/arrow-flight-glib/common.hpp +++ b/c_glib/arrow-flight-glib/common.hpp @@ -23,7 +23,6 @@ #include - GAFlightCriteria * gaflight_criteria_new_raw(const arrow::flight::Criteria *flight_criteria); arrow::flight::Criteria * @@ -33,8 +32,7 @@ arrow::flight::Location * gaflight_location_get_raw(GAFlightLocation *location); GAFlightDescriptor * -gaflight_descriptor_new_raw( - const arrow::flight::FlightDescriptor *flight_descriptor); +gaflight_descriptor_new_raw(const arrow::flight::FlightDescriptor *flight_descriptor); arrow::flight::FlightDescriptor * gaflight_descriptor_get_raw(GAFlightDescriptor *descriptor); diff --git a/c_glib/arrow-flight-glib/server.cpp b/c_glib/arrow-flight-glib/server.cpp index 9deb1623b16cd..f7444918e90f6 100644 --- a/c_glib/arrow-flight-glib/server.cpp +++ b/c_glib/arrow-flight-glib/server.cpp @@ -63,8 +63,8 @@ G_BEGIN_DECLS * Since: 5.0.0 */ - -typedef struct GAFlightDataStreamPrivate_ { +typedef struct GAFlightDataStreamPrivate_ +{ arrow::flight::FlightDataStream *stream; } GAFlightDataStreamPrivate; @@ -72,14 +72,11 @@ enum { PROP_STREAM = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GAFlightDataStream, - gaflight_data_stream, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GAFlightDataStream, gaflight_data_stream, G_TYPE_OBJECT) -#define GAFLIGHT_DATA_STREAM_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_data_stream_get_instance_private( \ - GAFLIGHT_DATA_STREAM(obj))) +#define GAFLIGHT_DATA_STREAM_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_data_stream_get_instance_private(GAFLIGHT_DATA_STREAM(obj))) static void gaflight_data_stream_finalize(GObject *object) @@ -101,8 +98,8 @@ gaflight_data_stream_set_property(GObject *object, switch (prop_id) { case PROP_STREAM: - priv->stream = static_cast( - g_value_get_pointer(value)); + priv->stream = + static_cast(g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -124,16 +121,16 @@ gaflight_data_stream_class_init(GAFlightDataStreamClass *klass) gobject_class->set_property = gaflight_data_stream_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("stream", - "Stream", - "The raw arrow::flight::FlightDataStream *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "stream", + "Stream", + "The raw arrow::flight::FlightDataStream *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_STREAM, spec); } - -typedef struct GAFlightRecordBatchStreamPrivate_ { +typedef struct GAFlightRecordBatchStreamPrivate_ +{ GArrowRecordBatchReader *reader; } GAFlightRecordBatchStreamPrivate; @@ -145,9 +142,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GAFlightRecordBatchStream, gaflight_record_batch_stream, GAFLIGHT_TYPE_DATA_STREAM) -#define GAFLIGHT_RECORD_BATCH_STREAM_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_record_batch_stream_get_instance_private( \ +#define GAFLIGHT_RECORD_BATCH_STREAM_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_record_batch_stream_get_instance_private( \ GAFLIGHT_RECORD_BATCH_STREAM(obj))) static void @@ -221,12 +218,12 @@ gaflight_record_batch_stream_class_init(GAFlightRecordBatchStreamClass *klass) * * Since: 6.0.0 */ - spec = g_param_spec_object("reader", - "Reader", - "The reader that produces record batches", - GARROW_TYPE_RECORD_BATCH_READER, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "reader", + "Reader", + "The reader that produces record batches", + GARROW_TYPE_RECORD_BATCH_READER, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_READER, spec); } @@ -252,16 +249,17 @@ gaflight_record_batch_stream_new(GArrowRecordBatchReader *reader, } else { arrow_options = &arrow_options_default; } - auto stream = std::make_unique< - arrow::flight::RecordBatchStream>(arrow_reader, *arrow_options); + auto stream = + std::make_unique(arrow_reader, *arrow_options); return static_cast( g_object_new(GAFLIGHT_TYPE_RECORD_BATCH_STREAM, - "stream", stream.release(), - "reader", reader, + "stream", + stream.release(), + "reader", + reader, NULL)); } - G_DEFINE_TYPE(GAFlightMessageReader, gaflight_message_reader, GAFLIGHT_TYPE_RECORD_BATCH_READER) @@ -292,8 +290,8 @@ gaflight_message_reader_get_descriptor(GAFlightMessageReader *reader) return gaflight_descriptor_new_raw(&flight_descriptor); } - -struct GAFlightServerCallContextPrivate { +struct GAFlightServerCallContextPrivate +{ arrow::flight::ServerCallContext *call_context; std::string current_incoming_header_key; std::string current_incoming_header_value; @@ -307,9 +305,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GAFlightServerCallContext, gaflight_server_call_context, G_TYPE_OBJECT) -#define GAFLIGHT_SERVER_CALL_CONTEXT_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_server_call_context_get_instance_private( \ +#define GAFLIGHT_SERVER_CALL_CONTEXT_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_server_call_context_get_instance_private( \ GAFLIGHT_SERVER_CALL_CONTEXT(obj))) static void @@ -332,8 +330,7 @@ gaflight_server_call_context_set_property(GObject *object, switch (prop_id) { case PROP_CALL_CONTEXT: priv->call_context = - static_cast( - g_value_get_pointer(value)); + static_cast(g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -345,8 +342,8 @@ static void gaflight_server_call_context_init(GAFlightServerCallContext *object) { auto priv = GAFLIGHT_SERVER_CALL_CONTEXT_GET_PRIVATE(object); - new(&(priv->current_incoming_header_key)) std::string; - new(&(priv->current_incoming_header_value)) std::string; + new (&(priv->current_incoming_header_key)) std::string; + new (&(priv->current_incoming_header_value)) std::string; } static void @@ -358,11 +355,11 @@ gaflight_server_call_context_class_init(GAFlightServerCallContextClass *klass) gobject_class->set_property = gaflight_server_call_context_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("call-context", - "Call context", - "The raw arrow::flight::ServerCallContext", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "call-context", + "Call context", + "The raw arrow::flight::ServerCallContext", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_CALL_CONTEXT, spec); } @@ -377,10 +374,9 @@ gaflight_server_call_context_class_init(GAFlightServerCallContextClass *klass) * Since: 14.0.0 */ void -gaflight_server_call_context_foreach_incoming_header( - GAFlightServerCallContext *context, - GAFlightHeaderFunc func, - gpointer user_data) +gaflight_server_call_context_foreach_incoming_header(GAFlightServerCallContext *context, + GAFlightHeaderFunc func, + gpointer user_data) { auto priv = GAFLIGHT_SERVER_CALL_CONTEXT_GET_PRIVATE(context); auto flight_context = gaflight_server_call_context_get_raw(context); @@ -393,8 +389,8 @@ gaflight_server_call_context_foreach_incoming_header( } } - -struct GAFlightServerAuthSenderPrivate { +struct GAFlightServerAuthSenderPrivate +{ arrow::flight::ServerAuthSender *sender; }; @@ -406,10 +402,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GAFlightServerAuthSender, gaflight_server_auth_sender, G_TYPE_OBJECT) -#define GAFLIGHT_SERVER_AUTH_SENDER_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_server_auth_sender_get_instance_private( \ - GAFLIGHT_SERVER_AUTH_SENDER(obj))) +#define GAFLIGHT_SERVER_AUTH_SENDER_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_server_auth_sender_get_instance_private(GAFLIGHT_SERVER_AUTH_SENDER(obj))) static void gaflight_server_auth_sender_set_property(GObject *object, @@ -443,11 +438,11 @@ gaflight_server_auth_sender_class_init(GAFlightServerAuthSenderClass *klass) gobject_class->set_property = gaflight_server_auth_sender_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("sender", - "Sender", - "The raw arrow::flight::ServerAuthSender *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "sender", + "Sender", + "The raw arrow::flight::ServerAuthSender *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_SERVER_AUTH_SENDER, spec); } @@ -476,8 +471,8 @@ gaflight_server_auth_sender_write(GAFlightServerAuthSender *sender, return garrow::check(error, status, "[flight-server-auth-sender][write]"); } - -struct GAFlightServerAuthReaderPrivate { +struct GAFlightServerAuthReaderPrivate +{ arrow::flight::ServerAuthReader *reader; }; @@ -489,10 +484,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GAFlightServerAuthReader, gaflight_server_auth_reader, G_TYPE_OBJECT) -#define GAFLIGHT_SERVER_AUTH_READER_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_server_auth_reader_get_instance_private( \ - GAFLIGHT_SERVER_AUTH_READER(obj))) +#define GAFLIGHT_SERVER_AUTH_READER_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_server_auth_reader_get_instance_private(GAFLIGHT_SERVER_AUTH_READER(obj))) static void gaflight_server_auth_reader_set_property(GObject *object, @@ -526,11 +520,11 @@ gaflight_server_auth_reader_class_init(GAFlightServerAuthReaderClass *klass) gobject_class->set_property = gaflight_server_auth_reader_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("reader", - "Reader", - "The raw arrow::flight::ServerAuthReader *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "reader", + "Reader", + "The raw arrow::flight::ServerAuthReader *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_SERVER_AUTH_READER, spec); } @@ -547,8 +541,7 @@ gaflight_server_auth_reader_class_init(GAFlightServerAuthReaderClass *klass) * Since: 12.0.0 */ GBytes * -gaflight_server_auth_reader_read(GAFlightServerAuthReader *reader, - GError **error) +gaflight_server_auth_reader_read(GAFlightServerAuthReader *reader, GError **error) { auto flight_reader = gaflight_server_auth_reader_get_raw(reader); std::string flight_message; @@ -559,8 +552,8 @@ gaflight_server_auth_reader_read(GAFlightServerAuthReader *reader, return g_bytes_new(flight_message.data(), flight_message.size()); } - -struct GAFlightServerAuthHandlerPrivate { +struct GAFlightServerAuthHandlerPrivate +{ std::shared_ptr handler; }; @@ -572,9 +565,9 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GAFlightServerAuthHandler, gaflight_server_auth_handler, G_TYPE_OBJECT) -#define GAFLIGHT_SERVER_AUTH_HANDLER_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_server_auth_handler_get_instance_private( \ +#define GAFLIGHT_SERVER_AUTH_HANDLER_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_server_auth_handler_get_instance_private( \ GAFLIGHT_SERVER_AUTH_HANDLER(obj))) static void @@ -596,9 +589,8 @@ gaflight_server_auth_handler_set_property(GObject *object, switch (prop_id) { case PROP_SERVER_AUTH_HANDLER: if (g_value_get_pointer(value)) { - priv->handler = - *static_cast*>( - g_value_get_pointer(value)); + priv->handler = *static_cast *>( + g_value_get_pointer(value)); } break; default: @@ -611,7 +603,7 @@ static void gaflight_server_auth_handler_init(GAFlightServerAuthHandler *object) { auto priv = GAFLIGHT_SERVER_AUTH_HANDLER_GET_PRIVATE(object); - new(&priv->handler) std::shared_ptr; + new (&priv->handler) std::shared_ptr; } static void @@ -623,29 +615,30 @@ gaflight_server_auth_handler_class_init(GAFlightServerAuthHandlerClass *klass) gobject_class->set_property = gaflight_server_auth_handler_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("handler", - "Handler", - "The raw std::shared_ptr<" - "arrow::flight::ServerAuthHandler>", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "handler", + "Handler", + "The raw std::shared_ptr<" + "arrow::flight::ServerAuthHandler>", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_SERVER_AUTH_HANDLER, spec); } - G_END_DECLS namespace gaflight { class ServerCustomAuthHandler : public arrow::flight::ServerAuthHandler { public: explicit ServerCustomAuthHandler(GAFlightServerCustomAuthHandler *handler) : arrow::flight::ServerAuthHandler(), - handler_(handler) { + handler_(handler) + { } arrow::Status Authenticate(const arrow::flight::ServerCallContext &context, arrow::flight::ServerAuthSender *sender, - arrow::flight::ServerAuthReader *reader) override { + arrow::flight::ServerAuthReader *reader) override + { auto klass = GAFLIGHT_SERVER_CUSTOM_AUTH_HANDLER_GET_CLASS(handler_); auto gacontext = gaflight_server_call_context_new_raw(&context); auto gasender = gaflight_server_auth_sender_new_raw(sender); @@ -668,7 +661,8 @@ namespace gaflight { arrow::Status IsValid(const arrow::flight::ServerCallContext &context, const std::string &token, - std::string *peer_identity) override { + std::string *peer_identity) override + { auto klass = GAFLIGHT_SERVER_CUSTOM_AUTH_HANDLER_GET_CLASS(handler_); auto gacontext = gaflight_server_call_context_new_raw(&context); auto gtoken = g_bytes_new_static(token.data(), token.size()); @@ -678,11 +672,9 @@ namespace gaflight { g_object_unref(gacontext); if (gpeer_identity) { gsize gpeer_identity_size; - auto gpeer_identity_data = g_bytes_get_data(gpeer_identity, - &gpeer_identity_size); - *peer_identity = - std::string(static_cast(gpeer_identity_data), - gpeer_identity_size); + auto gpeer_identity_data = g_bytes_get_data(gpeer_identity, &gpeer_identity_size); + *peer_identity = std::string(static_cast(gpeer_identity_data), + gpeer_identity_size); g_bytes_unref(gpeer_identity); } if (error) { @@ -698,7 +690,7 @@ namespace gaflight { private: GAFlightServerCustomAuthHandler *handler_; }; -} +} // namespace gaflight G_BEGIN_DECLS G_DEFINE_TYPE(GAFlightServerCustomAuthHandler, @@ -732,25 +724,20 @@ gaflight_server_custom_auth_handler_class_init( * Since: 12.0.0 */ void -gaflight_server_custom_auth_handler_authenticate( - GAFlightServerCustomAuthHandler *handler, - GAFlightServerCallContext *context, - GAFlightServerAuthSender *sender, - GAFlightServerAuthReader *reader, - GError **error) +gaflight_server_custom_auth_handler_authenticate(GAFlightServerCustomAuthHandler *handler, + GAFlightServerCallContext *context, + GAFlightServerAuthSender *sender, + GAFlightServerAuthReader *reader, + GError **error) { auto flight_handler = - gaflight_server_auth_handler_get_raw( - GAFLIGHT_SERVER_AUTH_HANDLER(handler)); + gaflight_server_auth_handler_get_raw(GAFLIGHT_SERVER_AUTH_HANDLER(handler)); auto flight_context = gaflight_server_call_context_get_raw(context); auto flight_sender = gaflight_server_auth_sender_get_raw(sender); auto flight_reader = gaflight_server_auth_reader_get_raw(reader); - auto status = flight_handler->Authenticate(*flight_context, - flight_sender, - flight_reader); - garrow::check(error, - status, - "[flight-server-custom-auth-handler][authenticate]"); + auto status = + flight_handler->Authenticate(*flight_context, flight_sender, flight_reader); + garrow::check(error, status, "[flight-server-custom-auth-handler][authenticate]"); } /** @@ -769,36 +756,32 @@ gaflight_server_custom_auth_handler_authenticate( * Since: 12.0.0 */ GBytes * -gaflight_server_custom_auth_handler_is_valid( - GAFlightServerCustomAuthHandler *handler, - GAFlightServerCallContext *context, - GBytes *token, - GError **error) +gaflight_server_custom_auth_handler_is_valid(GAFlightServerCustomAuthHandler *handler, + GAFlightServerCallContext *context, + GBytes *token, + GError **error) { auto flight_handler = - gaflight_server_auth_handler_get_raw( - GAFLIGHT_SERVER_AUTH_HANDLER(handler)); + gaflight_server_auth_handler_get_raw(GAFLIGHT_SERVER_AUTH_HANDLER(handler)); gsize token_size; auto token_data = g_bytes_get_data(token, &token_size); auto flight_context = gaflight_server_call_context_get_raw(context); std::string flight_token(static_cast(token_data), token_size); std::string flight_peer_identity; - auto status = flight_handler->IsValid(*flight_context, - flight_token, - &flight_peer_identity); + auto status = + flight_handler->IsValid(*flight_context, flight_token, &flight_peer_identity); if (garrow::check(error, status, "[flight-server-custom-auth-handler]" "[is-valid]")) { - return g_bytes_new(flight_peer_identity.data(), - flight_peer_identity.size()); + return g_bytes_new(flight_peer_identity.data(), flight_peer_identity.size()); } else { return nullptr; } } - -typedef struct GAFlightServerOptionsPrivate_ { +typedef struct GAFlightServerOptionsPrivate_ +{ arrow::flight::FlightServerOptions options; GAFlightLocation *location; GAFlightServerAuthHandler *auth_handler; @@ -809,14 +792,11 @@ enum { PROP_AUTH_HANDLER, }; -G_DEFINE_TYPE_WITH_PRIVATE(GAFlightServerOptions, - gaflight_server_options, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GAFlightServerOptions, gaflight_server_options, G_TYPE_OBJECT) -#define GAFLIGHT_SERVER_OPTIONS_GET_PRIVATE(obj) \ - static_cast( \ - gaflight_server_options_get_instance_private( \ - GAFLIGHT_SERVER_OPTIONS(obj))) +#define GAFLIGHT_SERVER_OPTIONS_GET_PRIVATE(obj) \ + static_cast( \ + gaflight_server_options_get_instance_private(GAFLIGHT_SERVER_OPTIONS(obj))) static void gaflight_server_options_dispose(GObject *object) @@ -859,7 +839,7 @@ gaflight_server_options_set_property(GObject *object, { priv->location = GAFLIGHT_LOCATION(g_value_dup_object(value)); auto flight_location = gaflight_location_get_raw(priv->location); - new(&(priv->options)) arrow::flight::FlightServerOptions(*flight_location); + new (&(priv->options)) arrow::flight::FlightServerOptions(*flight_location); } break; case PROP_AUTH_HANDLER: @@ -867,8 +847,7 @@ gaflight_server_options_set_property(GObject *object, if (priv->auth_handler) { g_object_unref(priv->auth_handler); } - priv->auth_handler = - GAFLIGHT_SERVER_AUTH_HANDLER(g_value_dup_object(value)); + priv->auth_handler = GAFLIGHT_SERVER_AUTH_HANDLER(g_value_dup_object(value)); if (priv->auth_handler) { priv->options.auth_handler = gaflight_server_auth_handler_get_raw(priv->auth_handler); @@ -927,12 +906,12 @@ gaflight_server_options_class_init(GAFlightServerOptionsClass *klass) * * Since: 5.0.0 */ - spec = g_param_spec_object("location", - "Location", - "The location to be listened", - GAFLIGHT_TYPE_LOCATION, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "location", + "Location", + "The location to be listened", + GAFLIGHT_TYPE_LOCATION, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_LOCATION, spec); /** @@ -962,48 +941,37 @@ GAFlightServerOptions * gaflight_server_options_new(GAFlightLocation *location) { return static_cast( - g_object_new(GAFLIGHT_TYPE_SERVER_OPTIONS, - "location", location, - NULL)); + g_object_new(GAFLIGHT_TYPE_SERVER_OPTIONS, "location", location, NULL)); } - -G_DEFINE_INTERFACE(GAFlightServable, - gaflight_servable, - G_TYPE_OBJECT) +G_DEFINE_INTERFACE(GAFlightServable, gaflight_servable, G_TYPE_OBJECT) static void gaflight_servable_default_init(GAFlightServableInterface *iface) { } - G_END_DECLS namespace gaflight { class Server : public arrow::flight::FlightServerBase { public: - explicit Server(GAFlightServer *gaserver) : - FlightServerBase(), - gaserver_(gaserver) { - } + explicit Server(GAFlightServer *gaserver) : FlightServerBase(), gaserver_(gaserver) {} ~Server() override = default; arrow::Status - ListFlights( - const arrow::flight::ServerCallContext &context, - const arrow::flight::Criteria *criteria, - std::unique_ptr *listing) override { + ListFlights(const arrow::flight::ServerCallContext &context, + const arrow::flight::Criteria *criteria, + std::unique_ptr *listing) override + { auto gacontext = gaflight_server_call_context_new_raw(&context); GAFlightCriteria *gacriteria = nullptr; if (criteria) { gacriteria = gaflight_criteria_new_raw(criteria); } GError *gerror = nullptr; - auto gaflights = gaflight_server_list_flights(gaserver_, - gacontext, - gacriteria, - &gerror); + auto gaflights = + gaflight_server_list_flights(gaserver_, gacontext, gacriteria, &gerror); if (gacriteria) { g_object_unref(gacriteria); } @@ -1020,22 +988,20 @@ namespace gaflight { g_object_unref(gaflight); } g_list_free(gaflights); - *listing = std::make_unique< - arrow::flight::SimpleFlightListing>(flights); + *listing = std::make_unique(flights); return arrow::Status::OK(); } arrow::Status GetFlightInfo(const arrow::flight::ServerCallContext &context, const arrow::flight::FlightDescriptor &request, - std::unique_ptr *info) override { + std::unique_ptr *info) override + { auto gacontext = gaflight_server_call_context_new_raw(&context); auto garequest = gaflight_descriptor_new_raw(&request); GError *gerror = nullptr; - auto gainfo = gaflight_server_get_flight_info(gaserver_, - gacontext, - garequest, - &gerror); + auto gainfo = + gaflight_server_get_flight_info(gaserver_, gacontext, garequest, &gerror); g_object_unref(garequest); g_object_unref(gacontext); if (gerror) { @@ -1043,23 +1009,20 @@ namespace gaflight { arrow::StatusCode::UnknownError, "[flight-server][get-flight-info]"); } - *info = std::make_unique( - *gaflight_info_get_raw(gainfo)); + *info = std::make_unique(*gaflight_info_get_raw(gainfo)); g_object_unref(gainfo); return arrow::Status::OK(); } - arrow::Status DoGet( - const arrow::flight::ServerCallContext &context, - const arrow::flight::Ticket &ticket, - std::unique_ptr *stream) override { + arrow::Status + DoGet(const arrow::flight::ServerCallContext &context, + const arrow::flight::Ticket &ticket, + std::unique_ptr *stream) override + { auto gacontext = gaflight_server_call_context_new_raw(&context); auto gaticket = gaflight_ticket_new_raw(&ticket); GError *gerror = nullptr; - auto gastream = gaflight_server_do_get(gaserver_, - gacontext, - gaticket, - &gerror); + auto gastream = gaflight_server_do_get(gaserver_, gacontext, gaticket, &gerror); g_object_unref(gaticket); g_object_unref(gacontext); if (gerror) { @@ -1074,10 +1037,11 @@ namespace gaflight { private: GAFlightServer *gaserver_; }; -}; +}; // namespace gaflight G_BEGIN_DECLS -struct GAFlightServerPrivate { +struct GAFlightServerPrivate +{ gaflight::Server server; }; @@ -1092,18 +1056,13 @@ gaflight_server_servable_interface_init(GAFlightServableInterface *iface) iface->get_raw = gaflight_server_servable_get_raw; } -G_DEFINE_ABSTRACT_TYPE_WITH_CODE(GAFlightServer, - gaflight_server, - G_TYPE_OBJECT, - G_ADD_PRIVATE(GAFlightServer); - G_IMPLEMENT_INTERFACE( - GAFLIGHT_TYPE_SERVABLE, - gaflight_server_servable_interface_init)) +G_DEFINE_ABSTRACT_TYPE_WITH_CODE( + GAFlightServer, gaflight_server, G_TYPE_OBJECT, G_ADD_PRIVATE(GAFlightServer); + G_IMPLEMENT_INTERFACE(GAFLIGHT_TYPE_SERVABLE, gaflight_server_servable_interface_init)) -#define GAFLIGHT_SERVER_GET_PRIVATE(object) \ - static_cast( \ - gaflight_server_get_instance_private( \ - GAFLIGHT_SERVER(object))) +#define GAFLIGHT_SERVER_GET_PRIVATE(object) \ + static_cast( \ + gaflight_server_get_instance_private(GAFLIGHT_SERVER(object))) G_END_DECLS static arrow::flight::FlightServerBase * @@ -1127,7 +1086,7 @@ static void gaflight_server_init(GAFlightServer *object) { auto priv = GAFLIGHT_SERVER_GET_PRIVATE(object); - new(&(priv->server)) gaflight::Server(object); + new (&(priv->server)) gaflight::Server(object); } static void @@ -1170,8 +1129,7 @@ gaflight_server_listen(GAFlightServer *server, gint gaflight_server_get_port(GAFlightServer *server) { - const auto flight_server = - gaflight_servable_get_raw(GAFLIGHT_SERVABLE(server)); + const auto flight_server = gaflight_servable_get_raw(GAFLIGHT_SERVABLE(server)); return flight_server->port(); } @@ -1188,13 +1146,10 @@ gaflight_server_get_port(GAFlightServer *server) * Since: 5.0.0 */ gboolean -gaflight_server_shutdown(GAFlightServer *server, - GError **error) +gaflight_server_shutdown(GAFlightServer *server, GError **error) { auto flight_server = gaflight_servable_get_raw(GAFLIGHT_SERVABLE(server)); - return garrow::check(error, - flight_server->Shutdown(), - "[flight-server][shutdown]"); + return garrow::check(error, flight_server->Shutdown(), "[flight-server][shutdown]"); } /** @@ -1217,10 +1172,7 @@ gaflight_server_list_flights(GAFlightServer *server, { auto klass = GAFLIGHT_SERVER_GET_CLASS(server); if (!(klass && klass->list_flights)) { - g_set_error(error, - GARROW_ERROR, - GARROW_ERROR_NOT_IMPLEMENTED, - "not implemented"); + g_set_error(error, GARROW_ERROR, GARROW_ERROR_NOT_IMPLEMENTED, "not implemented"); return nullptr; } return (*(klass->list_flights))(server, context, criteria, error); @@ -1245,10 +1197,7 @@ gaflight_server_get_flight_info(GAFlightServer *server, { auto klass = GAFLIGHT_SERVER_GET_CLASS(server); if (!(klass && klass->get_flight_info)) { - g_set_error(error, - GARROW_ERROR, - GARROW_ERROR_NOT_IMPLEMENTED, - "not implemented"); + g_set_error(error, GARROW_ERROR, GARROW_ERROR_NOT_IMPLEMENTED, "not implemented"); return nullptr; } return (*(klass->get_flight_info))(server, context, request, error); @@ -1273,19 +1222,14 @@ gaflight_server_do_get(GAFlightServer *server, { auto klass = GAFLIGHT_SERVER_GET_CLASS(server); if (!(klass && klass->do_get)) { - g_set_error(error, - GARROW_ERROR, - GARROW_ERROR_NOT_IMPLEMENTED, - "not implemented"); + g_set_error(error, GARROW_ERROR, GARROW_ERROR_NOT_IMPLEMENTED, "not implemented"); return nullptr; } return (*(klass->do_get))(server, context, ticket, error); } - G_END_DECLS - arrow::flight::FlightDataStream * gaflight_data_stream_get_raw(GAFlightDataStream *stream) { @@ -1293,17 +1237,16 @@ gaflight_data_stream_get_raw(GAFlightDataStream *stream) return priv->stream; } - GAFlightMessageReader * -gaflight_message_reader_new_raw( - arrow::flight::FlightMessageReader *flight_reader, - gboolean is_owner) -{ - return GAFLIGHT_MESSAGE_READER( - g_object_new(GAFLIGHT_TYPE_MESSAGE_READER, - "reader", flight_reader, - "is-owner", is_owner, - NULL)); +gaflight_message_reader_new_raw(arrow::flight::FlightMessageReader *flight_reader, + gboolean is_owner) +{ + return GAFLIGHT_MESSAGE_READER(g_object_new(GAFLIGHT_TYPE_MESSAGE_READER, + "reader", + flight_reader, + "is-owner", + is_owner, + NULL)); } arrow::flight::FlightMessageReader * @@ -1314,15 +1257,14 @@ gaflight_message_reader_get_raw(GAFlightMessageReader *reader) return static_cast(flight_reader); } - GAFlightServerCallContext * gaflight_server_call_context_new_raw( const arrow::flight::ServerCallContext *flight_call_context) { - return GAFLIGHT_SERVER_CALL_CONTEXT( - g_object_new(GAFLIGHT_TYPE_SERVER_CALL_CONTEXT, - "call-context", flight_call_context, - NULL)); + return GAFLIGHT_SERVER_CALL_CONTEXT(g_object_new(GAFLIGHT_TYPE_SERVER_CALL_CONTEXT, + "call-context", + flight_call_context, + NULL)); } const arrow::flight::ServerCallContext * @@ -1333,13 +1275,10 @@ gaflight_server_call_context_get_raw(GAFlightServerCallContext *call_context) } GAFlightServerAuthSender * -gaflight_server_auth_sender_new_raw( - arrow::flight::ServerAuthSender *flight_sender) +gaflight_server_auth_sender_new_raw(arrow::flight::ServerAuthSender *flight_sender) { return GAFLIGHT_SERVER_AUTH_SENDER( - g_object_new(GAFLIGHT_TYPE_SERVER_AUTH_SENDER, - "sender", flight_sender, - nullptr)); + g_object_new(GAFLIGHT_TYPE_SERVER_AUTH_SENDER, "sender", flight_sender, nullptr)); } arrow::flight::ServerAuthSender * @@ -1350,13 +1289,10 @@ gaflight_server_auth_sender_get_raw(GAFlightServerAuthSender *sender) } GAFlightServerAuthReader * -gaflight_server_auth_reader_new_raw( - arrow::flight::ServerAuthReader *flight_reader) +gaflight_server_auth_reader_new_raw(arrow::flight::ServerAuthReader *flight_reader) { return GAFLIGHT_SERVER_AUTH_READER( - g_object_new(GAFLIGHT_TYPE_SERVER_AUTH_READER, - "reader", flight_reader, - nullptr)); + g_object_new(GAFLIGHT_TYPE_SERVER_AUTH_READER, "reader", flight_reader, nullptr)); } arrow::flight::ServerAuthReader * diff --git a/c_glib/arrow-flight-glib/server.h b/c_glib/arrow-flight-glib/server.h index 77ecf36fd5221..89f5a0a596e9e 100644 --- a/c_glib/arrow-flight-glib/server.h +++ b/c_glib/arrow-flight-glib/server.h @@ -23,22 +23,15 @@ G_BEGIN_DECLS - -#define GAFLIGHT_TYPE_DATA_STREAM \ - (gaflight_data_stream_get_type()) -G_DECLARE_DERIVABLE_TYPE(GAFlightDataStream, - gaflight_data_stream, - GAFLIGHT, - DATA_STREAM, - GObject) +#define GAFLIGHT_TYPE_DATA_STREAM (gaflight_data_stream_get_type()) +G_DECLARE_DERIVABLE_TYPE( + GAFlightDataStream, gaflight_data_stream, GAFLIGHT, DATA_STREAM, GObject) struct _GAFlightDataStreamClass { GObjectClass parent_class; }; - -#define GAFLIGHT_TYPE_RECORD_BATCH_STREAM \ - (gaflight_record_batch_stream_get_type()) +#define GAFLIGHT_TYPE_RECORD_BATCH_STREAM (gaflight_record_batch_stream_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightRecordBatchStream, gaflight_record_batch_stream, GAFLIGHT, @@ -54,9 +47,7 @@ GAFlightRecordBatchStream * gaflight_record_batch_stream_new(GArrowRecordBatchReader *reader, GArrowWriteOptions *options); - -#define GAFLIGHT_TYPE_MESSAGE_READER \ - (gaflight_message_reader_get_type()) +#define GAFLIGHT_TYPE_MESSAGE_READER (gaflight_message_reader_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightMessageReader, gaflight_message_reader, GAFLIGHT, @@ -71,9 +62,7 @@ GARROW_AVAILABLE_IN_14_0 GAFlightDescriptor * gaflight_message_reader_get_descriptor(GAFlightMessageReader *reader); - -#define GAFLIGHT_TYPE_SERVER_CALL_CONTEXT \ - (gaflight_server_call_context_get_type()) +#define GAFLIGHT_TYPE_SERVER_CALL_CONTEXT (gaflight_server_call_context_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightServerCallContext, gaflight_server_call_context, GAFLIGHT, @@ -86,14 +75,11 @@ struct _GAFlightServerCallContextClass GARROW_AVAILABLE_IN_14_0 void -gaflight_server_call_context_foreach_incoming_header( - GAFlightServerCallContext *context, - GAFlightHeaderFunc func, - gpointer user_data); - +gaflight_server_call_context_foreach_incoming_header(GAFlightServerCallContext *context, + GAFlightHeaderFunc func, + gpointer user_data); -#define GAFLIGHT_TYPE_SERVER_AUTH_SENDER \ - (gaflight_server_auth_sender_get_type()) +#define GAFLIGHT_TYPE_SERVER_AUTH_SENDER (gaflight_server_auth_sender_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightServerAuthSender, gaflight_server_auth_sender, GAFLIGHT, @@ -110,9 +96,7 @@ gaflight_server_auth_sender_write(GAFlightServerAuthSender *sender, GBytes *message, GError **error); - -#define GAFLIGHT_TYPE_SERVER_AUTH_READER \ - (gaflight_server_auth_reader_get_type()) +#define GAFLIGHT_TYPE_SERVER_AUTH_READER (gaflight_server_auth_reader_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightServerAuthReader, gaflight_server_auth_reader, GAFLIGHT, @@ -125,12 +109,9 @@ struct _GAFlightServerAuthReaderClass GARROW_AVAILABLE_IN_12_0 GBytes * -gaflight_server_auth_reader_read(GAFlightServerAuthReader *reader, - GError **error); - +gaflight_server_auth_reader_read(GAFlightServerAuthReader *reader, GError **error); -#define GAFLIGHT_TYPE_SERVER_AUTH_HANDLER \ - (gaflight_server_auth_handler_get_type()) +#define GAFLIGHT_TYPE_SERVER_AUTH_HANDLER (gaflight_server_auth_handler_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightServerAuthHandler, gaflight_server_auth_handler, GAFLIGHT, @@ -141,7 +122,7 @@ struct _GAFlightServerAuthHandlerClass GObjectClass parent_class; }; -#define GAFLIGHT_TYPE_SERVER_CUSTOM_AUTH_HANDLER \ +#define GAFLIGHT_TYPE_SERVER_CUSTOM_AUTH_HANDLER \ (gaflight_server_custom_auth_handler_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightServerCustomAuthHandler, gaflight_server_custom_auth_handler, @@ -173,28 +154,22 @@ struct _GAFlightServerCustomAuthHandlerClass GARROW_AVAILABLE_IN_12_0 void -gaflight_server_custom_auth_handler_authenticate( - GAFlightServerCustomAuthHandler *handler, - GAFlightServerCallContext *context, - GAFlightServerAuthSender *sender, - GAFlightServerAuthReader *reader, - GError **error); +gaflight_server_custom_auth_handler_authenticate(GAFlightServerCustomAuthHandler *handler, + GAFlightServerCallContext *context, + GAFlightServerAuthSender *sender, + GAFlightServerAuthReader *reader, + GError **error); GARROW_AVAILABLE_IN_12_0 GBytes * -gaflight_server_custom_auth_handler_is_valid( - GAFlightServerCustomAuthHandler *handler, - GAFlightServerCallContext *context, - GBytes *token, - GError **error); - +gaflight_server_custom_auth_handler_is_valid(GAFlightServerCustomAuthHandler *handler, + GAFlightServerCallContext *context, + GBytes *token, + GError **error); #define GAFLIGHT_TYPE_SERVER_OPTIONS (gaflight_server_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GAFlightServerOptions, - gaflight_server_options, - GAFLIGHT, - SERVER_OPTIONS, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GAFlightServerOptions, gaflight_server_options, GAFLIGHT, SERVER_OPTIONS, GObject) struct _GAFlightServerOptionsClass { GObjectClass parent_class; @@ -204,21 +179,11 @@ GARROW_AVAILABLE_IN_5_0 GAFlightServerOptions * gaflight_server_options_new(GAFlightLocation *location); - #define GAFLIGHT_TYPE_SERVABLE (gaflight_servable_get_type()) -G_DECLARE_INTERFACE(GAFlightServable, - gaflight_servable, - GAFLIGHT, - SERVABLE, - GObject) - +G_DECLARE_INTERFACE(GAFlightServable, gaflight_servable, GAFLIGHT, SERVABLE, GObject) #define GAFLIGHT_TYPE_SERVER (gaflight_server_get_type()) -G_DECLARE_DERIVABLE_TYPE(GAFlightServer, - gaflight_server, - GAFLIGHT, - SERVER, - GObject) +G_DECLARE_DERIVABLE_TYPE(GAFlightServer, gaflight_server, GAFLIGHT, SERVER, GObject) /** * GAFlightServerClass: * @list_flights: A virtual function to implement `ListFlights` API. @@ -254,12 +219,10 @@ gint gaflight_server_get_port(GAFlightServer *server); GARROW_AVAILABLE_IN_5_0 gboolean -gaflight_server_shutdown(GAFlightServer *server, - GError **error); +gaflight_server_shutdown(GAFlightServer *server, GError **error); GARROW_AVAILABLE_IN_5_0 gboolean -gaflight_server_wait(GAFlightServer *server, - GError **error); +gaflight_server_wait(GAFlightServer *server, GError **error); GARROW_AVAILABLE_IN_5_0 GList * diff --git a/c_glib/arrow-flight-glib/server.hpp b/c_glib/arrow-flight-glib/server.hpp index 6b273dc9e5a8f..70da867d5b0e9 100644 --- a/c_glib/arrow-flight-glib/server.hpp +++ b/c_glib/arrow-flight-glib/server.hpp @@ -23,18 +23,15 @@ #include - arrow::flight::FlightDataStream * gaflight_data_stream_get_raw(GAFlightDataStream *stream); GAFlightMessageReader * -gaflight_message_reader_new_raw( - arrow::flight::FlightMessageReader *flight_reader, - gboolean is_owner); +gaflight_message_reader_new_raw(arrow::flight::FlightMessageReader *flight_reader, + gboolean is_owner); arrow::flight::FlightMessageReader * gaflight_message_reader_get_raw(GAFlightMessageReader *reader); - GAFlightServerCallContext * gaflight_server_call_context_new_raw( const arrow::flight::ServerCallContext *flight_call_context); @@ -42,14 +39,12 @@ const arrow::flight::ServerCallContext * gaflight_server_call_context_get_raw(GAFlightServerCallContext *call_context); GAFlightServerAuthSender * -gaflight_server_auth_sender_new_raw( - arrow::flight::ServerAuthSender *flight_sender); +gaflight_server_auth_sender_new_raw(arrow::flight::ServerAuthSender *flight_sender); arrow::flight::ServerAuthSender * gaflight_server_auth_sender_get_raw(GAFlightServerAuthSender *sender); GAFlightServerAuthReader * -gaflight_server_auth_reader_new_raw( - arrow::flight::ServerAuthReader *flight_reader); +gaflight_server_auth_reader_new_raw(arrow::flight::ServerAuthReader *flight_reader); arrow::flight::ServerAuthReader * gaflight_server_auth_reader_get_raw(GAFlightServerAuthReader *reader); @@ -59,7 +54,6 @@ gaflight_server_auth_handler_get_raw(GAFlightServerAuthHandler *handler); arrow::flight::FlightServerOptions * gaflight_server_options_get_raw(GAFlightServerOptions *options); - struct _GAFlightServableInterface { GTypeInterface parent_iface; @@ -70,30 +64,34 @@ struct _GAFlightServableInterface arrow::flight::FlightServerBase * gaflight_servable_get_raw(GAFlightServable *servable); - namespace gaflight { class DataStream : public arrow::flight::FlightDataStream { public: - explicit DataStream(GAFlightDataStream *gastream) : - arrow::flight::FlightDataStream(), - gastream_(gastream) { + explicit DataStream(GAFlightDataStream *gastream) + : arrow::flight::FlightDataStream(), + gastream_(gastream) + { } - ~DataStream() override { - g_object_unref(gastream_); - } + ~DataStream() override { g_object_unref(gastream_); } - std::shared_ptr schema() override { + std::shared_ptr + schema() override + { auto stream = gaflight_data_stream_get_raw(gastream_); return stream->schema(); } - arrow::Result GetSchemaPayload() override { + arrow::Result + GetSchemaPayload() override + { auto stream = gaflight_data_stream_get_raw(gastream_); return stream->GetSchemaPayload(); } - arrow::Result Next() override { + arrow::Result + Next() override + { auto stream = gaflight_data_stream_get_raw(gastream_); return stream->Next(); } @@ -101,4 +99,4 @@ namespace gaflight { private: GAFlightDataStream *gastream_; }; -}; +}; // namespace gaflight diff --git a/c_glib/arrow-flight-sql-glib/client.cpp b/c_glib/arrow-flight-sql-glib/client.cpp index 8e1cf11549710..cd0f477818bd3 100644 --- a/c_glib/arrow-flight-sql-glib/client.cpp +++ b/c_glib/arrow-flight-sql-glib/client.cpp @@ -37,7 +37,8 @@ G_BEGIN_DECLS * Since: 9.0.0 */ -struct GAFlightSQLPreparedStatementPrivate { +struct GAFlightSQLPreparedStatementPrivate +{ std::shared_ptr statement; GAFlightSQLClient *client; }; @@ -51,9 +52,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GAFlightSQLPreparedStatement, gaflightsql_prepared_statement, G_TYPE_OBJECT) -#define GAFLIGHTSQL_PREPARED_STATEMENT_GET_PRIVATE(object) \ - static_cast( \ - gaflightsql_prepared_statement_get_instance_private( \ +#define GAFLIGHTSQL_PREPARED_STATEMENT_GET_PRIVATE(object) \ + static_cast( \ + gaflightsql_prepared_statement_get_instance_private( \ GAFLIGHTSQL_PREPARED_STATEMENT(object))) static void @@ -122,12 +123,11 @@ static void gaflightsql_prepared_statement_init(GAFlightSQLPreparedStatement *object) { auto priv = GAFLIGHTSQL_PREPARED_STATEMENT_GET_PRIVATE(object); - new(&priv->statement) std::shared_ptr; + new (&priv->statement) std::shared_ptr; } static void -gaflightsql_prepared_statement_class_init( - GAFlightSQLPreparedStatementClass *klass) +gaflightsql_prepared_statement_class_init(GAFlightSQLPreparedStatementClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); @@ -137,11 +137,11 @@ gaflightsql_prepared_statement_class_init( gobject_class->get_property = gaflightsql_prepared_statement_get_property; GParamSpec *spec; - spec = g_param_spec_pointer("statement", - nullptr, - nullptr, - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "statement", + nullptr, + nullptr, + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_STATEMENT, spec); /** @@ -151,15 +151,13 @@ gaflightsql_prepared_statement_class_init( * * Since: 14.0.0 */ - spec = g_param_spec_object("client", - nullptr, - nullptr, - GAFLIGHTSQL_TYPE_CLIENT, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property(gobject_class, - PROP_PREPARED_STATEMENT_CLIENT, - spec); + spec = g_param_spec_object( + "client", + nullptr, + nullptr, + GAFLIGHTSQL_TYPE_CLIENT, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property(gobject_class, PROP_PREPARED_STATEMENT_CLIENT, spec); } /** @@ -185,9 +183,7 @@ gaflightsql_prepared_statement_execute(GAFlightSQLPreparedStatement *statement, flight_options = gaflight_call_options_get_raw(options); } auto result = flight_sql_statement->Execute(*flight_options); - if (!garrow::check(error, - result, - "[flight-sql-prepared-statement][execute]")) { + if (!garrow::check(error, result, "[flight-sql-prepared-statement][execute]")) { return nullptr; } auto flight_info = std::move(*result); @@ -205,10 +201,9 @@ gaflightsql_prepared_statement_execute(GAFlightSQLPreparedStatement *statement, * Since: 14.0.0 */ gint64 -gaflightsql_prepared_statement_execute_update( - GAFlightSQLPreparedStatement *statement, - GAFlightCallOptions *options, - GError **error) +gaflightsql_prepared_statement_execute_update(GAFlightSQLPreparedStatement *statement, + GAFlightCallOptions *options, + GError **error) { auto flight_sql_statement = gaflightsql_prepared_statement_get_raw(statement); arrow::flight::FlightCallOptions flight_default_options; @@ -217,9 +212,7 @@ gaflightsql_prepared_statement_execute_update( flight_options = gaflight_call_options_get_raw(options); } auto result = flight_sql_statement->ExecuteUpdate(*flight_options); - if (!garrow::check(error, - result, - "[flight-sql-prepared-statement][execute-update]")) { + if (!garrow::check(error, result, "[flight-sql-prepared-statement][execute-update]")) { return 0; } return *result; @@ -251,8 +244,7 @@ gaflightsql_prepared_statement_get_parameter_schema( * Since: 14.0.0 */ GArrowSchema * -gaflightsql_prepared_statement_get_dataset_schema( - GAFlightSQLPreparedStatement *statement) +gaflightsql_prepared_statement_get_dataset_schema(GAFlightSQLPreparedStatement *statement) { auto flight_sql_statement = gaflightsql_prepared_statement_get_raw(statement); auto arrow_schema = flight_sql_statement->dataset_schema(); @@ -271,10 +263,9 @@ gaflightsql_prepared_statement_get_dataset_schema( * Since: 14.0.0 */ gboolean -gaflightsql_prepared_statement_set_record_batch( - GAFlightSQLPreparedStatement *statement, - GArrowRecordBatch *record_batch, - GError **error) +gaflightsql_prepared_statement_set_record_batch(GAFlightSQLPreparedStatement *statement, + GArrowRecordBatch *record_batch, + GError **error) { auto flight_sql_statement = gaflightsql_prepared_statement_get_raw(statement); auto arrow_record_batch = garrow_record_batch_get_raw(record_batch); @@ -350,8 +341,8 @@ gaflightsql_prepared_statement_is_closed(GAFlightSQLPreparedStatement *statement return flight_sql_statement->IsClosed(); } - -struct GAFlightSQLClientPrivate { +struct GAFlightSQLClientPrivate +{ arrow::flight::sql::FlightSqlClient *client; GAFlightClient *flight_client; }; @@ -361,14 +352,11 @@ enum { PROP_FLIGHT_CLIENT, }; -G_DEFINE_TYPE_WITH_PRIVATE(GAFlightSQLClient, - gaflightsql_client, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GAFlightSQLClient, gaflightsql_client, G_TYPE_OBJECT) -#define GAFLIGHTSQL_CLIENT_GET_PRIVATE(object) \ - static_cast( \ - gaflightsql_client_get_instance_private( \ - GAFLIGHTSQL_CLIENT(object))) +#define GAFLIGHTSQL_CLIENT_GET_PRIVATE(object) \ + static_cast( \ + gaflightsql_client_get_instance_private(GAFLIGHTSQL_CLIENT(object))) static void gaflightsql_client_dispose(GObject *object) @@ -404,8 +392,7 @@ gaflightsql_client_set_property(GObject *object, switch (prop_id) { case PROP_CLIENT: priv->client = - static_cast( - g_value_get_pointer(value)); + static_cast(g_value_get_pointer(value)); break; case PROP_FLIGHT_CLIENT: priv->flight_client = GAFLIGHT_CLIENT(g_value_dup_object(value)); @@ -450,11 +437,11 @@ gaflightsql_client_class_init(GAFlightSQLClientClass *klass) gobject_class->get_property = gaflightsql_client_get_property; GParamSpec *spec; - spec = g_param_spec_pointer("client", - "Client", - "The raw arrow::flight::sql::FlightSqlClient *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "client", + "Client", + "The raw arrow::flight::sql::FlightSqlClient *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_CLIENT, spec); /** @@ -464,12 +451,12 @@ gaflightsql_client_class_init(GAFlightSQLClientClass *klass) * * Since: 9.0.0 */ - spec = g_param_spec_object("flight-client", - "Flight client", - "The underlying Flight client", - GAFLIGHT_TYPE_CLIENT, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "flight-client", + "Flight client", + "The underlying Flight client", + GAFLIGHT_TYPE_CLIENT, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_FLIGHT_CLIENT, spec); } @@ -485,8 +472,7 @@ GAFlightSQLClient * gaflightsql_client_new(GAFlightClient *client) { auto flight_client = gaflight_client_get_raw(client); - auto flight_sql_client = - new arrow::flight::sql::FlightSqlClient(flight_client); + auto flight_sql_client = new arrow::flight::sql::FlightSqlClient(flight_client); return gaflightsql_client_new_raw(flight_sql_client, client); } @@ -515,9 +501,7 @@ gaflightsql_client_execute(GAFlightSQLClient *client, flight_options = gaflight_call_options_get_raw(options); } auto result = flight_sql_client->Execute(*flight_options, query); - if (!garrow::check(error, - result, - "[flight-sql-client][execute]")) { + if (!garrow::check(error, result, "[flight-sql-client][execute]")) { return nullptr; } auto flight_info = std::move(*result); @@ -548,9 +532,7 @@ gaflightsql_client_execute_update(GAFlightSQLClient *client, flight_options = gaflight_call_options_get_raw(options); } auto result = flight_sql_client->ExecuteUpdate(*flight_options, query); - if (!garrow::check(error, - result, - "[flight-sql-client][execute-update]")) { + if (!garrow::check(error, result, "[flight-sql-client][execute-update]")) { return 0; } return *result; @@ -583,9 +565,7 @@ gaflightsql_client_do_get(GAFlightSQLClient *client, flight_options = gaflight_call_options_get_raw(options); } auto result = flight_sql_client->DoGet(*flight_options, *flight_ticket); - if (!garrow::check(error, - result, - "[flight-sql-client][do-get]")) { + if (!garrow::check(error, result, "[flight-sql-client][do-get]")) { return nullptr; } auto flight_reader = std::move(*result); @@ -617,30 +597,26 @@ gaflightsql_client_prepare(GAFlightSQLClient *client, flight_options = gaflight_call_options_get_raw(options); } auto result = flight_sql_client->Prepare(*flight_options, query); - if (!garrow::check(error, - result, - "[flight-sql-client][prepare]")) { + if (!garrow::check(error, result, "[flight-sql-client][prepare]")) { return nullptr; } auto flight_sql_statement = std::move(*result); - return gaflightsql_prepared_statement_new_raw(&flight_sql_statement, - client); + return gaflightsql_prepared_statement_new_raw(&flight_sql_statement, client); } - G_END_DECLS - GAFlightSQLPreparedStatement * gaflightsql_prepared_statement_new_raw( std::shared_ptr *flight_sql_statement, GAFlightSQLClient *client) { - return GAFLIGHTSQL_PREPARED_STATEMENT( - g_object_new(GAFLIGHTSQL_TYPE_PREPARED_STATEMENT, - "statement", flight_sql_statement, - "client", client, - nullptr)); + return GAFLIGHTSQL_PREPARED_STATEMENT(g_object_new(GAFLIGHTSQL_TYPE_PREPARED_STATEMENT, + "statement", + flight_sql_statement, + "client", + client, + nullptr)); } std::shared_ptr @@ -650,17 +626,16 @@ gaflightsql_prepared_statement_get_raw(GAFlightSQLPreparedStatement *statement) return priv->statement; } - GAFlightSQLClient * -gaflightsql_client_new_raw( - arrow::flight::sql::FlightSqlClient *flight_sql_client, - GAFlightClient *client) +gaflightsql_client_new_raw(arrow::flight::sql::FlightSqlClient *flight_sql_client, + GAFlightClient *client) { - return GAFLIGHTSQL_CLIENT( - g_object_new(GAFLIGHTSQL_TYPE_CLIENT, - "client", flight_sql_client, - "flight_client", client, - nullptr)); + return GAFLIGHTSQL_CLIENT(g_object_new(GAFLIGHTSQL_TYPE_CLIENT, + "client", + flight_sql_client, + "flight_client", + client, + nullptr)); } arrow::flight::sql::FlightSqlClient * diff --git a/c_glib/arrow-flight-sql-glib/client.h b/c_glib/arrow-flight-sql-glib/client.h index f2a025fef099b..9a5a8987f7195 100644 --- a/c_glib/arrow-flight-sql-glib/client.h +++ b/c_glib/arrow-flight-sql-glib/client.h @@ -23,9 +23,7 @@ G_BEGIN_DECLS - -#define GAFLIGHTSQL_TYPE_PREPARED_STATEMENT \ - (gaflightsql_prepared_statement_get_type()) +#define GAFLIGHTSQL_TYPE_PREPARED_STATEMENT (gaflightsql_prepared_statement_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightSQLPreparedStatement, gaflightsql_prepared_statement, GAFLIGHTSQL, @@ -38,17 +36,15 @@ struct _GAFlightSQLPreparedStatementClass GARROW_AVAILABLE_IN_14_0 GAFlightInfo * -gaflightsql_prepared_statement_execute( - GAFlightSQLPreparedStatement *statement, - GAFlightCallOptions *options, - GError **error); +gaflightsql_prepared_statement_execute(GAFlightSQLPreparedStatement *statement, + GAFlightCallOptions *options, + GError **error); GARROW_AVAILABLE_IN_14_0 gint64 -gaflightsql_prepared_statement_execute_update( - GAFlightSQLPreparedStatement *statement, - GAFlightCallOptions *options, - GError **error); +gaflightsql_prepared_statement_execute_update(GAFlightSQLPreparedStatement *statement, + GAFlightCallOptions *options, + GError **error); GARROW_AVAILABLE_IN_14_0 GArrowSchema * @@ -62,10 +58,9 @@ gaflightsql_prepared_statement_get_dataset_schema( GARROW_AVAILABLE_IN_14_0 gboolean -gaflightsql_prepared_statement_set_record_batch( - GAFlightSQLPreparedStatement *statement, - GArrowRecordBatch *record_batch, - GError **error); +gaflightsql_prepared_statement_set_record_batch(GAFlightSQLPreparedStatement *statement, + GArrowRecordBatch *record_batch, + GError **error); GARROW_AVAILABLE_IN_14_0 gboolean @@ -76,23 +71,17 @@ gaflightsql_prepared_statement_set_record_batch_reader( GARROW_AVAILABLE_IN_14_0 gboolean -gaflightsql_prepared_statement_close( - GAFlightSQLPreparedStatement *statement, - GAFlightCallOptions *options, - GError **error); +gaflightsql_prepared_statement_close(GAFlightSQLPreparedStatement *statement, + GAFlightCallOptions *options, + GError **error); GARROW_AVAILABLE_IN_14_0 gboolean -gaflightsql_prepared_statement_is_closed( - GAFlightSQLPreparedStatement *statement); - +gaflightsql_prepared_statement_is_closed(GAFlightSQLPreparedStatement *statement); #define GAFLIGHTSQL_TYPE_CLIENT (gaflightsql_client_get_type()) -G_DECLARE_DERIVABLE_TYPE(GAFlightSQLClient, - gaflightsql_client, - GAFLIGHTSQL, - CLIENT, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GAFlightSQLClient, gaflightsql_client, GAFLIGHTSQL, CLIENT, GObject) struct _GAFlightSQLClientClass { GObjectClass parent_class; @@ -130,5 +119,4 @@ gaflightsql_client_prepare(GAFlightSQLClient *client, GAFlightCallOptions *options, GError **error); - G_END_DECLS diff --git a/c_glib/arrow-flight-sql-glib/client.hpp b/c_glib/arrow-flight-sql-glib/client.hpp index 09136f8819d52..11f17478f642e 100644 --- a/c_glib/arrow-flight-sql-glib/client.hpp +++ b/c_glib/arrow-flight-sql-glib/client.hpp @@ -23,7 +23,6 @@ #include - GAFlightSQLPreparedStatement * gaflightsql_prepared_statement_new_raw( std::shared_ptr *flight_sql_statement, @@ -32,8 +31,7 @@ std::shared_ptr gaflightsql_prepared_statement_get_raw(GAFlightSQLPreparedStatement *statement); GAFlightSQLClient * -gaflightsql_client_new_raw( - arrow::flight::sql::FlightSqlClient *flight_sql_client, - GAFlightClient *client); +gaflightsql_client_new_raw(arrow::flight::sql::FlightSqlClient *flight_sql_client, + GAFlightClient *client); arrow::flight::sql::FlightSqlClient * gaflightsql_client_get_raw(GAFlightSQLClient *client); diff --git a/c_glib/arrow-flight-sql-glib/server.cpp b/c_glib/arrow-flight-sql-glib/server.cpp index 518b771732a0f..bea916430b99e 100644 --- a/c_glib/arrow-flight-sql-glib/server.cpp +++ b/c_glib/arrow-flight-sql-glib/server.cpp @@ -51,8 +51,8 @@ G_BEGIN_DECLS * Since: 9.0.0 */ - -struct GAFlightSQLCommandPrivate { +struct GAFlightSQLCommandPrivate +{ void *command; }; @@ -60,14 +60,11 @@ enum { PROP_COMMAND = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GAFlightSQLCommand, - gaflightsql_command, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GAFlightSQLCommand, gaflightsql_command, G_TYPE_OBJECT) -#define GAFLIGHTSQL_COMMAND_GET_PRIVATE(object) \ - static_cast( \ - gaflightsql_command_get_instance_private( \ - GAFLIGHTSQL_COMMAND(object))) +#define GAFLIGHTSQL_COMMAND_GET_PRIVATE(object) \ + static_cast( \ + gaflightsql_command_get_instance_private(GAFLIGHTSQL_COMMAND(object))) static void gaflightsql_command_set_property(GObject *object, @@ -99,15 +96,14 @@ gaflightsql_command_class_init(GAFlightSQLCommandClass *klass) gobject_class->set_property = gaflightsql_command_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("command", - "Command", - "The raw command struct", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "command", + "Command", + "The raw command struct", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_COMMAND, spec); } - G_DEFINE_TYPE(GAFlightSQLStatementQuery, gaflightsql_statement_query, GAFLIGHTSQL_TYPE_COMMAND) @@ -137,7 +133,6 @@ gaflightsql_statement_query_get_query(GAFlightSQLStatementQuery *command) return statement_query->query.c_str(); } - G_DEFINE_TYPE(GAFlightSQLStatementUpdate, gaflightsql_statement_update, GAFLIGHTSQL_TYPE_COMMAND) @@ -167,14 +162,12 @@ gaflightsql_statement_update_get_query(GAFlightSQLStatementUpdate *command) return statement_update->query.c_str(); } - G_DEFINE_TYPE(GAFlightSQLPreparedStatementUpdate, gaflightsql_prepared_statement_update, GAFLIGHTSQL_TYPE_COMMAND) static void -gaflightsql_prepared_statement_update_init( - GAFlightSQLPreparedStatementUpdate *object) +gaflightsql_prepared_statement_update_init(GAFlightSQLPreparedStatementUpdate *object) { } @@ -202,14 +195,13 @@ gaflightsql_prepared_statement_update_get_handle( update->prepared_statement_handle.size()); } - G_DEFINE_TYPE(GAFlightSQLStatementQueryTicket, gaflightsql_statement_query_ticket, GAFLIGHTSQL_TYPE_COMMAND) -#define GAFLIGHTSQL_STATEMENT_QUERY_TICKET_GET_PRIVATE(object) \ - static_cast( \ - gaflightsql_statement_query_ticket_get_instance_private( \ +#define GAFLIGHTSQL_STATEMENT_QUERY_TICKET_GET_PRIVATE(object) \ + static_cast( \ + gaflightsql_statement_query_ticket_get_instance_private( \ GAFLIGHTSQL_STATEMENT_QUERY_TICKET(object))) static void @@ -218,8 +210,7 @@ gaflightsql_statement_query_ticket_init(GAFlightSQLStatementQueryTicket *object) } static void -gaflightsql_statement_query_ticket_class_init( - GAFlightSQLStatementQueryTicketClass *klass) +gaflightsql_statement_query_ticket_class_init(GAFlightSQLStatementQueryTicketClass *klass) { } @@ -234,18 +225,14 @@ gaflightsql_statement_query_ticket_class_init( * Since: 9.0.0 */ GBytes * -gaflightsql_statement_query_ticket_generate_handle(const gchar *query, - GError **error) +gaflightsql_statement_query_ticket_generate_handle(const gchar *query, GError **error) { auto result = arrow::flight::sql::CreateStatementQueryTicket(query); - if (!garrow::check(error, - result, - "[flight-sql-statement-query-ticket][new]")) { + if (!garrow::check(error, result, "[flight-sql-statement-query-ticket][new]")) { return nullptr; } auto flight_sql_handle = std::move(*result); - return g_bytes_new(flight_sql_handle.data(), - flight_sql_handle.size()); + return g_bytes_new(flight_sql_handle.data(), flight_sql_handle.size()); } /** @@ -258,17 +245,15 @@ gaflightsql_statement_query_ticket_generate_handle(const gchar *query, * Since: 9.0.0 */ GBytes * -gaflightsql_statement_query_ticket_get_handle( - GAFlightSQLStatementQueryTicket *command) +gaflightsql_statement_query_ticket_get_handle(GAFlightSQLStatementQueryTicket *command) { - auto statement_query_ticket = - gaflightsql_statement_query_ticket_get_raw(command); + auto statement_query_ticket = gaflightsql_statement_query_ticket_get_raw(command); auto &handle = statement_query_ticket->statement_handle; return g_bytes_new_static(handle.data(), handle.size()); } - -struct GAFlightSQLCreatePreparedStatementRequestPrivate { +struct GAFlightSQLCreatePreparedStatementRequestPrivate +{ arrow::flight::sql::ActionCreatePreparedStatementRequest *request; }; @@ -280,9 +265,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GAFlightSQLCreatePreparedStatementRequest, gaflightsql_create_prepared_statement_request, G_TYPE_OBJECT) -#define GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_REQUEST_GET_PRIVATE(object) \ - static_cast( \ - gaflightsql_create_prepared_statement_request_get_instance_private( \ +#define GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_REQUEST_GET_PRIVATE(object) \ + static_cast( \ + gaflightsql_create_prepared_statement_request_get_instance_private( \ GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_REQUEST(object))) static void @@ -320,11 +305,11 @@ gaflightsql_create_prepared_statement_request_class_init( gaflightsql_create_prepared_statement_request_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("request", - nullptr, - nullptr, - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "request", + nullptr, + nullptr, + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_REQUEST, spec); } @@ -360,8 +345,8 @@ gaflightsql_create_prepared_statement_request_get_transaction_id( return priv->request->transaction_id.c_str(); } - -struct GAFlightSQLCreatePreparedStatementResultPrivate { +struct GAFlightSQLCreatePreparedStatementResultPrivate +{ arrow::flight::sql::ActionCreatePreparedStatementResult result; }; @@ -369,9 +354,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GAFlightSQLCreatePreparedStatementResult, gaflightsql_create_prepared_statement_result, G_TYPE_OBJECT) -#define GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(object) \ - static_cast( \ - gaflightsql_create_prepared_statement_result_get_instance_private( \ +#define GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(object) \ + static_cast( \ + gaflightsql_create_prepared_statement_result_get_instance_private( \ GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT(object))) static void @@ -379,7 +364,8 @@ gaflightsql_create_prepared_statement_result_finalize(GObject *object) { auto priv = GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(object); priv->result.~ActionCreatePreparedStatementResult(); - G_OBJECT_CLASS(gaflightsql_create_prepared_statement_result_parent_class)->finalize(object); + G_OBJECT_CLASS(gaflightsql_create_prepared_statement_result_parent_class) + ->finalize(object); } static void @@ -387,7 +373,7 @@ gaflightsql_create_prepared_statement_result_init( GAFlightSQLCreatePreparedStatementResult *object) { auto priv = GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(object); - new(&(priv->result)) arrow::flight::sql::ActionCreatePreparedStatementResult(); + new (&(priv->result)) arrow::flight::sql::ActionCreatePreparedStatementResult(); } static void @@ -395,8 +381,7 @@ gaflightsql_create_prepared_statement_result_class_init( GAFlightSQLCreatePreparedStatementResultClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = - gaflightsql_create_prepared_statement_result_finalize; + gobject_class->finalize = gaflightsql_create_prepared_statement_result_finalize; } /** @@ -410,8 +395,7 @@ GAFlightSQLCreatePreparedStatementResult * gaflightsql_create_prepared_statement_result_new(void) { return GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT( - g_object_new(GAFLIGHTSQL_TYPE_CREATE_PREPARED_STATEMENT_RESULT, - nullptr)); + g_object_new(GAFLIGHTSQL_TYPE_CREATE_PREPARED_STATEMENT_RESULT, nullptr)); } /** @@ -423,11 +407,9 @@ gaflightsql_create_prepared_statement_result_new(void) */ void gaflightsql_create_prepared_statement_result_set_dataset_schema( - GAFlightSQLCreatePreparedStatementResult *result, - GArrowSchema *schema) + GAFlightSQLCreatePreparedStatementResult *result, GArrowSchema *schema) { - auto priv = - GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(result); + auto priv = GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(result); priv->result.dataset_schema = garrow_schema_get_raw(schema); } @@ -443,8 +425,7 @@ GArrowSchema * gaflightsql_create_prepared_statement_result_get_dataset_schema( GAFlightSQLCreatePreparedStatementResult *result) { - auto priv = - GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(result); + auto priv = GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(result); if (!priv->result.dataset_schema) { return nullptr; } @@ -460,11 +441,9 @@ gaflightsql_create_prepared_statement_result_get_dataset_schema( */ void gaflightsql_create_prepared_statement_result_set_parameter_schema( - GAFlightSQLCreatePreparedStatementResult *result, - GArrowSchema *schema) + GAFlightSQLCreatePreparedStatementResult *result, GArrowSchema *schema) { - auto priv = - GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(result); + auto priv = GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(result); priv->result.parameter_schema = garrow_schema_get_raw(schema); } @@ -480,8 +459,7 @@ GArrowSchema * gaflightsql_create_prepared_statement_result_get_parameter_schema( GAFlightSQLCreatePreparedStatementResult *result) { - auto priv = - GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(result); + auto priv = GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(result); if (!priv->result.parameter_schema) { return nullptr; } @@ -497,11 +475,9 @@ gaflightsql_create_prepared_statement_result_get_parameter_schema( */ void gaflightsql_create_prepared_statement_result_set_handle( - GAFlightSQLCreatePreparedStatementResult *result, - GBytes *handle) + GAFlightSQLCreatePreparedStatementResult *result, GBytes *handle) { - auto priv = - GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(result); + auto priv = GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(result); size_t handle_size; auto handle_data = g_bytes_get_data(handle, &handle_size); priv->result.prepared_statement_handle = @@ -521,14 +497,13 @@ GBytes * gaflightsql_create_prepared_statement_result_get_handle( GAFlightSQLCreatePreparedStatementResult *result) { - auto priv = - GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(result); + auto priv = GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(result); return g_bytes_new_static(priv->result.prepared_statement_handle.data(), priv->result.prepared_statement_handle.length()); } - -struct GAFlightSQLClosePreparedStatementRequestPrivate { +struct GAFlightSQLClosePreparedStatementRequestPrivate +{ arrow::flight::sql::ActionClosePreparedStatementRequest *request; }; @@ -536,9 +511,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GAFlightSQLClosePreparedStatementRequest, gaflightsql_close_prepared_statement_request, G_TYPE_OBJECT) -#define GAFLIGHTSQL_CLOSE_PREPARED_STATEMENT_REQUEST_GET_PRIVATE(object) \ - static_cast( \ - gaflightsql_close_prepared_statement_request_get_instance_private( \ +#define GAFLIGHTSQL_CLOSE_PREPARED_STATEMENT_REQUEST_GET_PRIVATE(object) \ + static_cast( \ + gaflightsql_close_prepared_statement_request_get_instance_private( \ GAFLIGHTSQL_CLOSE_PREPARED_STATEMENT_REQUEST(object))) static void @@ -572,15 +547,14 @@ gaflightsql_close_prepared_statement_request_class_init( GAFlightSQLClosePreparedStatementRequestClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->set_property = - gaflightsql_close_prepared_statement_request_set_property; + gobject_class->set_property = gaflightsql_close_prepared_statement_request_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("request", - nullptr, - nullptr, - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "request", + nullptr, + nullptr, + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_REQUEST, spec); } @@ -602,23 +576,23 @@ gaflightsql_close_prepared_statement_request_get_handle( priv->request->prepared_statement_handle.length()); } - G_END_DECLS namespace gaflightsql { class Server : public arrow::flight::sql::FlightSqlServerBase { public: - explicit Server(GAFlightSQLServer *gaserver) : - FlightSqlServerBase(), - gaserver_(gaserver) { + explicit Server(GAFlightSQLServer *gaserver) + : FlightSqlServerBase(), + gaserver_(gaserver) + { } ~Server() override = default; arrow::Result> - GetFlightInfoStatement( - const arrow::flight::ServerCallContext& context, - const arrow::flight::sql::StatementQuery& command, - const arrow::flight::FlightDescriptor& descriptor) override { + GetFlightInfoStatement(const arrow::flight::ServerCallContext &context, + const arrow::flight::sql::StatementQuery &command, + const arrow::flight::FlightDescriptor &descriptor) override + { auto gacontext = gaflight_server_call_context_new_raw(&context); auto gacommand = gaflightsql_statement_query_new_raw(&command); auto gadescriptor = gaflight_descriptor_new_raw(&descriptor); @@ -633,25 +607,20 @@ namespace gaflightsql { g_object_unref(gacontext); if (gerror) { auto context = "[flight-sql-server][get-flight-info-statement]"; - return garrow_error_to_status(gerror, - arrow::StatusCode::UnknownError, - context); + return garrow_error_to_status(gerror, arrow::StatusCode::UnknownError, context); } - return std::make_unique( - *gaflight_info_get_raw(gainfo)); + return std::make_unique(*gaflight_info_get_raw(gainfo)); } arrow::Result> - DoGetStatement( - const arrow::flight::ServerCallContext &context, - const arrow::flight::sql::StatementQueryTicket& command) override { + DoGetStatement(const arrow::flight::ServerCallContext &context, + const arrow::flight::sql::StatementQueryTicket &command) override + { auto gacontext = gaflight_server_call_context_new_raw(&context); auto gacommand = gaflightsql_statement_query_ticket_new_raw(&command); GError *gerror = nullptr; - auto gastream = gaflightsql_server_do_get_statement(gaserver_, - gacontext, - gacommand, - &gerror); + auto gastream = + gaflightsql_server_do_get_statement(gaserver_, gacontext, gacommand, &gerror); g_object_unref(gacommand); g_object_unref(gacontext); if (gerror) { @@ -665,7 +634,8 @@ namespace gaflightsql { arrow::Result DoPutCommandStatementUpdate( const arrow::flight::ServerCallContext &context, - const arrow::flight::sql::StatementUpdate &command) override { + const arrow::flight::sql::StatementUpdate &command) override + { auto gacontext = gaflight_server_call_context_new_raw(&context); auto gacommand = gaflightsql_statement_update_new_raw(&command); GError *gerror = nullptr; @@ -689,7 +659,8 @@ namespace gaflightsql { DoPutPreparedStatementUpdate( const arrow::flight::ServerCallContext &context, const arrow::flight::sql::PreparedStatementUpdate &command, - arrow::flight::FlightMessageReader *reader) override { + arrow::flight::FlightMessageReader *reader) override + { auto gacontext = gaflight_server_call_context_new_raw(&context); auto gacommand = gaflightsql_prepared_statement_update_new_raw(&command); auto gareader = gaflight_message_reader_new_raw(reader, FALSE); @@ -715,22 +686,21 @@ namespace gaflightsql { arrow::Result CreatePreparedStatement( const arrow::flight::ServerCallContext &context, - const arrow::flight::sql::ActionCreatePreparedStatementRequest &request) override { + const arrow::flight::sql::ActionCreatePreparedStatementRequest &request) override + { auto gacontext = gaflight_server_call_context_new_raw(&context); auto garequest = gaflightsql_create_prepared_statement_request_new_raw(&request); GError *gerror = nullptr; - auto garesult = - gaflightsql_server_create_prepared_statement(gaserver_, - gacontext, - garequest, - &gerror); + auto garesult = gaflightsql_server_create_prepared_statement(gaserver_, + gacontext, + garequest, + &gerror); g_object_unref(garequest); g_object_unref(gacontext); if (gerror) { - return garrow_error_to_status( - gerror, - arrow::StatusCode::UnknownError, - "[flight-sql-server][create-prepared-statement]"); + return garrow_error_to_status(gerror, + arrow::StatusCode::UnknownError, + "[flight-sql-server][create-prepared-statement]"); } auto garesult_priv = GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_RESULT_GET_PRIVATE(garesult); @@ -742,7 +712,8 @@ namespace gaflightsql { arrow::Status ClosePreparedStatement( const arrow::flight::ServerCallContext &context, - const arrow::flight::sql::ActionClosePreparedStatementRequest &request) override { + const arrow::flight::sql::ActionClosePreparedStatementRequest &request) override + { auto gacontext = gaflight_server_call_context_new_raw(&context); auto garequest = gaflightsql_close_prepared_statement_request_new_raw(&request); GError *gerror = nullptr; @@ -753,10 +724,9 @@ namespace gaflightsql { g_object_unref(garequest); g_object_unref(gacontext); if (gerror) { - return garrow_error_to_status( - gerror, - arrow::StatusCode::UnknownError, - "[flight-sql-server][close-prepared-statement]"); + return garrow_error_to_status(gerror, + arrow::StatusCode::UnknownError, + "[flight-sql-server][close-prepared-statement]"); } else { return arrow::Status::OK(); } @@ -765,10 +735,11 @@ namespace gaflightsql { private: GAFlightSQLServer *gaserver_; }; -}; +}; // namespace gaflightsql G_BEGIN_DECLS -struct GAFlightSQLServerPrivate { +struct GAFlightSQLServerPrivate +{ gaflightsql::Server server; }; @@ -783,18 +754,17 @@ gaflightsql_server_servable_interface_init(GAFlightServableInterface *iface) iface->get_raw = gaflightsql_server_servable_get_raw; } -G_DEFINE_ABSTRACT_TYPE_WITH_CODE(GAFlightSQLServer, - gaflightsql_server, - GAFLIGHT_TYPE_SERVER, - G_ADD_PRIVATE(GAFlightSQLServer); - G_IMPLEMENT_INTERFACE( - GAFLIGHT_TYPE_SERVABLE, - gaflightsql_server_servable_interface_init)) +G_DEFINE_ABSTRACT_TYPE_WITH_CODE( + GAFlightSQLServer, + gaflightsql_server, + GAFLIGHT_TYPE_SERVER, + G_ADD_PRIVATE(GAFlightSQLServer); + G_IMPLEMENT_INTERFACE(GAFLIGHT_TYPE_SERVABLE, + gaflightsql_server_servable_interface_init)) -#define GAFLIGHTSQL_SERVER_GET_PRIVATE(object) \ - static_cast( \ - gaflightsql_server_get_instance_private( \ - GAFLIGHTSQL_SERVER(object))) +#define GAFLIGHTSQL_SERVER_GET_PRIVATE(object) \ + static_cast( \ + gaflightsql_server_get_instance_private(GAFLIGHTSQL_SERVER(object))) G_END_DECLS static arrow::flight::FlightServerBase * @@ -817,7 +787,7 @@ static void gaflightsql_server_init(GAFlightSQLServer *object) { auto priv = GAFLIGHTSQL_SERVER_GET_PRIVATE(object); - new(&(priv->server)) gaflightsql::Server(object); + new (&(priv->server)) gaflightsql::Server(object); } static void @@ -841,26 +811,19 @@ gaflightsql_server_class_init(GAFlightSQLServerClass *klass) * Since: 9.0.0 */ GAFlightInfo * -gaflightsql_server_get_flight_info_statement( - GAFlightSQLServer *server, - GAFlightServerCallContext *context, - GAFlightSQLStatementQuery *command, - GAFlightDescriptor *descriptor, - GError **error) +gaflightsql_server_get_flight_info_statement(GAFlightSQLServer *server, + GAFlightServerCallContext *context, + GAFlightSQLStatementQuery *command, + GAFlightDescriptor *descriptor, + GError **error) { auto klass = GAFLIGHTSQL_SERVER_GET_CLASS(server); if (!(klass && klass->get_flight_info_statement)) { - g_set_error(error, - GARROW_ERROR, - GARROW_ERROR_NOT_IMPLEMENTED, - "not implemented"); + g_set_error(error, GARROW_ERROR, GARROW_ERROR_NOT_IMPLEMENTED, "not implemented"); return NULL; } - return (*(klass->get_flight_info_statement))(server, - context, - command, - descriptor, - error); + return ( + *(klass->get_flight_info_statement))(server, context, command, descriptor, error); } /** @@ -883,10 +846,7 @@ gaflightsql_server_do_get_statement(GAFlightSQLServer *server, { auto klass = GAFLIGHTSQL_SERVER_GET_CLASS(server); if (!(klass && klass->do_get_statement)) { - g_set_error(error, - GARROW_ERROR, - GARROW_ERROR_NOT_IMPLEMENTED, - "not implemented"); + g_set_error(error, GARROW_ERROR, GARROW_ERROR_NOT_IMPLEMENTED, "not implemented"); return nullptr; } return (*(klass->do_get_statement))(server, context, ticket, error); @@ -904,18 +864,14 @@ gaflightsql_server_do_get_statement(GAFlightSQLServer *server, * Since: 13.0.0 */ gint64 -gaflightsql_server_do_put_command_statement_update( - GAFlightSQLServer *server, - GAFlightServerCallContext *context, - GAFlightSQLStatementUpdate *command, - GError **error) +gaflightsql_server_do_put_command_statement_update(GAFlightSQLServer *server, + GAFlightServerCallContext *context, + GAFlightSQLStatementUpdate *command, + GError **error) { auto klass = GAFLIGHTSQL_SERVER_GET_CLASS(server); if (!(klass && klass->do_put_command_statement_update)) { - g_set_error(error, - GARROW_ERROR, - GARROW_ERROR_NOT_IMPLEMENTED, - "not implemented"); + g_set_error(error, GARROW_ERROR, GARROW_ERROR_NOT_IMPLEMENTED, "not implemented"); return 0; } return klass->do_put_command_statement_update(server, context, command, error); @@ -943,14 +899,10 @@ gaflightsql_server_do_put_prepared_statement_update( { auto klass = GAFLIGHTSQL_SERVER_GET_CLASS(server); if (!(klass && klass->do_put_prepared_statement_update)) { - g_set_error(error, - GARROW_ERROR, - GARROW_ERROR_NOT_IMPLEMENTED, - "not implemented"); + g_set_error(error, GARROW_ERROR, GARROW_ERROR_NOT_IMPLEMENTED, "not implemented"); return 0; } - return klass->do_put_prepared_statement_update( - server, context, command, reader, error); + return klass->do_put_prepared_statement_update(server, context, command, reader, error); } /** @@ -976,10 +928,7 @@ gaflightsql_server_create_prepared_statement( { auto klass = GAFLIGHTSQL_SERVER_GET_CLASS(server); if (!(klass && klass->create_prepared_statement)) { - g_set_error(error, - GARROW_ERROR, - GARROW_ERROR_NOT_IMPLEMENTED, - "not implemented"); + g_set_error(error, GARROW_ERROR, GARROW_ERROR_NOT_IMPLEMENTED, "not implemented"); return nullptr; } return klass->create_prepared_statement(server, context, request, error); @@ -1003,27 +952,20 @@ gaflightsql_server_close_prepared_statement( { auto klass = GAFLIGHTSQL_SERVER_GET_CLASS(server); if (!(klass && klass->close_prepared_statement)) { - g_set_error(error, - GARROW_ERROR, - GARROW_ERROR_NOT_IMPLEMENTED, - "not implemented"); + g_set_error(error, GARROW_ERROR, GARROW_ERROR_NOT_IMPLEMENTED, "not implemented"); return; } return klass->close_prepared_statement(server, context, request, error); } - G_END_DECLS - GAFlightSQLStatementQuery * gaflightsql_statement_query_new_raw( const arrow::flight::sql::StatementQuery *flight_command) { return GAFLIGHTSQL_STATEMENT_QUERY( - g_object_new(GAFLIGHTSQL_TYPE_STATEMENT_QUERY, - "command", flight_command, - nullptr)); + g_object_new(GAFLIGHTSQL_TYPE_STATEMENT_QUERY, "command", flight_command, nullptr)); } const arrow::flight::sql::StatementQuery * @@ -1033,15 +975,12 @@ gaflightsql_statement_query_get_raw(GAFlightSQLStatementQuery *command) return static_cast(priv->command); } - GAFlightSQLStatementUpdate * gaflightsql_statement_update_new_raw( const arrow::flight::sql::StatementUpdate *flight_command) { return GAFLIGHTSQL_STATEMENT_UPDATE( - g_object_new(GAFLIGHTSQL_TYPE_STATEMENT_UPDATE, - "command", flight_command, - nullptr)); + g_object_new(GAFLIGHTSQL_TYPE_STATEMENT_UPDATE, "command", flight_command, nullptr)); } const arrow::flight::sql::StatementUpdate * @@ -1051,54 +990,50 @@ gaflightsql_statement_update_get_raw(GAFlightSQLStatementUpdate *command) return static_cast(priv->command); } - GAFlightSQLPreparedStatementUpdate * gaflightsql_prepared_statement_update_new_raw( const arrow::flight::sql::PreparedStatementUpdate *flight_command) { return GAFLIGHTSQL_PREPARED_STATEMENT_UPDATE( g_object_new(GAFLIGHTSQL_TYPE_PREPARED_STATEMENT_UPDATE, - "command", flight_command, + "command", + flight_command, nullptr)); } const arrow::flight::sql::PreparedStatementUpdate * -gaflightsql_prepared_statement_update_get_raw( - GAFlightSQLPreparedStatementUpdate *command) +gaflightsql_prepared_statement_update_get_raw(GAFlightSQLPreparedStatementUpdate *command) { auto priv = GAFLIGHTSQL_COMMAND_GET_PRIVATE(command); - return static_cast( - priv->command); + return static_cast(priv->command); } - GAFlightSQLStatementQueryTicket * gaflightsql_statement_query_ticket_new_raw( const arrow::flight::sql::StatementQueryTicket *flight_command) { return GAFLIGHTSQL_STATEMENT_QUERY_TICKET( g_object_new(GAFLIGHTSQL_TYPE_STATEMENT_QUERY_TICKET, - "command", flight_command, + "command", + flight_command, nullptr)); } const arrow::flight::sql::StatementQueryTicket * -gaflightsql_statement_query_ticket_get_raw( - GAFlightSQLStatementQueryTicket *command) +gaflightsql_statement_query_ticket_get_raw(GAFlightSQLStatementQueryTicket *command) { auto priv = GAFLIGHTSQL_COMMAND_GET_PRIVATE(command); - return static_cast( - priv->command); + return static_cast(priv->command); } - GAFlightSQLCreatePreparedStatementRequest * gaflightsql_create_prepared_statement_request_new_raw( const arrow::flight::sql::ActionCreatePreparedStatementRequest *flight_request) { return GAFLIGHTSQL_CREATE_PREPARED_STATEMENT_REQUEST( g_object_new(GAFLIGHTSQL_TYPE_CREATE_PREPARED_STATEMENT_REQUEST, - "request", flight_request, + "request", + flight_request, nullptr)); } @@ -1110,14 +1045,14 @@ gaflightsql_create_prepared_statement_request_get_raw( return priv->request; } - GAFlightSQLClosePreparedStatementRequest * gaflightsql_close_prepared_statement_request_new_raw( const arrow::flight::sql::ActionClosePreparedStatementRequest *flight_request) { return GAFLIGHTSQL_CLOSE_PREPARED_STATEMENT_REQUEST( g_object_new(GAFLIGHTSQL_TYPE_CLOSE_PREPARED_STATEMENT_REQUEST, - "request", flight_request, + "request", + flight_request, nullptr)); } diff --git a/c_glib/arrow-flight-sql-glib/server.h b/c_glib/arrow-flight-sql-glib/server.h index 90eb5ee7e4170..d6fd7e4d10394 100644 --- a/c_glib/arrow-flight-sql-glib/server.h +++ b/c_glib/arrow-flight-sql-glib/server.h @@ -23,19 +23,14 @@ G_BEGIN_DECLS - #define GAFLIGHTSQL_TYPE_COMMAND (gaflightsql_command_get_type()) -G_DECLARE_DERIVABLE_TYPE(GAFlightSQLCommand, - gaflightsql_command, - GAFLIGHTSQL, - COMMAND, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GAFlightSQLCommand, gaflightsql_command, GAFLIGHTSQL, COMMAND, GObject) struct _GAFlightSQLCommandClass { GObjectClass parent_class; }; - #define GAFLIGHTSQL_TYPE_STATEMENT_QUERY (gaflightsql_statement_query_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightSQLStatementQuery, gaflightsql_statement_query, @@ -51,7 +46,6 @@ GARROW_AVAILABLE_IN_9_0 const gchar * gaflightsql_statement_query_get_query(GAFlightSQLStatementQuery *command); - #define GAFLIGHTSQL_TYPE_STATEMENT_UPDATE (gaflightsql_statement_update_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightSQLStatementUpdate, gaflightsql_statement_update, @@ -67,8 +61,7 @@ GARROW_AVAILABLE_IN_13_0 const gchar * gaflightsql_statement_update_get_query(GAFlightSQLStatementUpdate *command); - -#define GAFLIGHTSQL_TYPE_PREPARED_STATEMENT_UPDATE \ +#define GAFLIGHTSQL_TYPE_PREPARED_STATEMENT_UPDATE \ (gaflightsql_prepared_statement_update_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightSQLPreparedStatementUpdate, gaflightsql_prepared_statement_update, @@ -85,8 +78,7 @@ GBytes * gaflightsql_prepared_statement_update_get_handle( GAFlightSQLPreparedStatementUpdate *command); - -#define GAFLIGHTSQL_TYPE_STATEMENT_QUERY_TICKET \ +#define GAFLIGHTSQL_TYPE_STATEMENT_QUERY_TICKET \ (gaflightsql_statement_query_ticket_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightSQLStatementQueryTicket, gaflightsql_statement_query_ticket, @@ -100,15 +92,12 @@ struct _GAFlightSQLStatementQueryTicketClass GARROW_AVAILABLE_IN_9_0 GBytes * -gaflightsql_statement_query_ticket_generate_handle(const gchar *query, - GError **error); +gaflightsql_statement_query_ticket_generate_handle(const gchar *query, GError **error); GARROW_AVAILABLE_IN_9_0 GBytes * -gaflightsql_statement_query_ticket_get_handle( - GAFlightSQLStatementQueryTicket *command); +gaflightsql_statement_query_ticket_get_handle(GAFlightSQLStatementQueryTicket *command); - -#define GAFLIGHTSQL_TYPE_CREATE_PREPARED_STATEMENT_REQUEST \ +#define GAFLIGHTSQL_TYPE_CREATE_PREPARED_STATEMENT_REQUEST \ (gaflightsql_create_prepared_statement_request_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightSQLCreatePreparedStatementRequest, gaflightsql_create_prepared_statement_request, @@ -130,8 +119,7 @@ const gchar * gaflightsql_create_prepared_statement_request_get_transaction_id( GAFlightSQLCreatePreparedStatementRequest *request); - -#define GAFLIGHTSQL_TYPE_CREATE_PREPARED_STATEMENT_RESULT \ +#define GAFLIGHTSQL_TYPE_CREATE_PREPARED_STATEMENT_RESULT \ (gaflightsql_create_prepared_statement_result_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightSQLCreatePreparedStatementResult, gaflightsql_create_prepared_statement_result, @@ -149,8 +137,7 @@ gaflightsql_create_prepared_statement_result_new(void); GARROW_AVAILABLE_IN_14_0 void gaflightsql_create_prepared_statement_result_set_dataset_schema( - GAFlightSQLCreatePreparedStatementResult *result, - GArrowSchema *schema); + GAFlightSQLCreatePreparedStatementResult *result, GArrowSchema *schema); GARROW_AVAILABLE_IN_14_0 GArrowSchema * gaflightsql_create_prepared_statement_result_get_dataset_schema( @@ -158,8 +145,7 @@ gaflightsql_create_prepared_statement_result_get_dataset_schema( GARROW_AVAILABLE_IN_14_0 void gaflightsql_create_prepared_statement_result_set_parameter_schema( - GAFlightSQLCreatePreparedStatementResult *result, - GArrowSchema *schema); + GAFlightSQLCreatePreparedStatementResult *result, GArrowSchema *schema); GARROW_AVAILABLE_IN_14_0 GArrowSchema * gaflightsql_create_prepared_statement_result_get_parameter_schema( @@ -167,15 +153,13 @@ gaflightsql_create_prepared_statement_result_get_parameter_schema( GARROW_AVAILABLE_IN_14_0 void gaflightsql_create_prepared_statement_result_set_handle( - GAFlightSQLCreatePreparedStatementResult *result, - GBytes *handle); + GAFlightSQLCreatePreparedStatementResult *result, GBytes *handle); GARROW_AVAILABLE_IN_14_0 GBytes * gaflightsql_create_prepared_statement_result_get_handle( GAFlightSQLCreatePreparedStatementResult *result); - -#define GAFLIGHTSQL_TYPE_CLOSE_PREPARED_STATEMENT_REQUEST \ +#define GAFLIGHTSQL_TYPE_CLOSE_PREPARED_STATEMENT_REQUEST \ (gaflightsql_close_prepared_statement_request_get_type()) G_DECLARE_DERIVABLE_TYPE(GAFlightSQLClosePreparedStatementRequest, gaflightsql_close_prepared_statement_request, @@ -192,13 +176,9 @@ GBytes * gaflightsql_close_prepared_statement_request_get_handle( GAFlightSQLClosePreparedStatementRequest *request); - #define GAFLIGHTSQL_TYPE_SERVER (gaflightsql_server_get_type()) -G_DECLARE_DERIVABLE_TYPE(GAFlightSQLServer, - gaflightsql_server, - GAFLIGHTSQL, - SERVER, - GAFlightServer) +G_DECLARE_DERIVABLE_TYPE( + GAFlightSQLServer, gaflightsql_server, GAFLIGHTSQL, SERVER, GAFlightServer) /** * GAFlightSQLServerClass: * @get_flight_info_statement: A virtual function to implement @@ -222,62 +202,54 @@ struct _GAFlightSQLServerClass { GAFlightServerClass parent_class; - GAFlightInfo *(*get_flight_info_statement)( - GAFlightSQLServer *server, - GAFlightServerCallContext *context, - GAFlightSQLStatementQuery *command, - GAFlightDescriptor *descriptor, - GError **error); - GAFlightDataStream *(*do_get_statement)( - GAFlightSQLServer *server, - GAFlightServerCallContext *context, - GAFlightSQLStatementQueryTicket *ticket, - GError **error); - gint64 (*do_put_command_statement_update)( - GAFlightSQLServer *server, - GAFlightServerCallContext *context, - GAFlightSQLStatementUpdate *command, - GError **error); - gint64 (*do_put_prepared_statement_update)( - GAFlightSQLServer *server, - GAFlightServerCallContext *context, - GAFlightSQLPreparedStatementUpdate *command, - GAFlightMessageReader *reader, - GError **error); + GAFlightInfo *(*get_flight_info_statement)(GAFlightSQLServer *server, + GAFlightServerCallContext *context, + GAFlightSQLStatementQuery *command, + GAFlightDescriptor *descriptor, + GError **error); + GAFlightDataStream *(*do_get_statement)(GAFlightSQLServer *server, + GAFlightServerCallContext *context, + GAFlightSQLStatementQueryTicket *ticket, + GError **error); + gint64 (*do_put_command_statement_update)(GAFlightSQLServer *server, + GAFlightServerCallContext *context, + GAFlightSQLStatementUpdate *command, + GError **error); + gint64 (*do_put_prepared_statement_update)(GAFlightSQLServer *server, + GAFlightServerCallContext *context, + GAFlightSQLPreparedStatementUpdate *command, + GAFlightMessageReader *reader, + GError **error); GAFlightSQLCreatePreparedStatementResult *(*create_prepared_statement)( GAFlightSQLServer *server, GAFlightServerCallContext *context, GAFlightSQLCreatePreparedStatementRequest *request, GError **error); - void (*close_prepared_statement)( - GAFlightSQLServer *server, - GAFlightServerCallContext *context, - GAFlightSQLClosePreparedStatementRequest *request, - GError **error); + void (*close_prepared_statement)(GAFlightSQLServer *server, + GAFlightServerCallContext *context, + GAFlightSQLClosePreparedStatementRequest *request, + GError **error); }; GARROW_AVAILABLE_IN_9_0 GAFlightInfo * -gaflightsql_server_get_flight_info_statement( - GAFlightSQLServer *server, - GAFlightServerCallContext *context, - GAFlightSQLStatementQuery *command, - GAFlightDescriptor *descriptor, - GError **error); +gaflightsql_server_get_flight_info_statement(GAFlightSQLServer *server, + GAFlightServerCallContext *context, + GAFlightSQLStatementQuery *command, + GAFlightDescriptor *descriptor, + GError **error); GARROW_AVAILABLE_IN_9_0 GAFlightDataStream * -gaflightsql_server_do_get_statement( - GAFlightSQLServer *server, - GAFlightServerCallContext *context, - GAFlightSQLStatementQueryTicket *ticket, - GError **error); +gaflightsql_server_do_get_statement(GAFlightSQLServer *server, + GAFlightServerCallContext *context, + GAFlightSQLStatementQueryTicket *ticket, + GError **error); GARROW_AVAILABLE_IN_13_0 gint64 -gaflightsql_server_do_put_command_statement_update( - GAFlightSQLServer *server, - GAFlightServerCallContext *context, - GAFlightSQLStatementUpdate *command, - GError **error); +gaflightsql_server_do_put_command_statement_update(GAFlightSQLServer *server, + GAFlightServerCallContext *context, + GAFlightSQLStatementUpdate *command, + GError **error); /* We can restore this after we bump version to 14.0.0-SNAPSHOT. */ /* GARROW_AVAILABLE_IN_14_0 */ gint64 diff --git a/c_glib/arrow-flight-sql-glib/server.hpp b/c_glib/arrow-flight-sql-glib/server.hpp index bdecf054a4d61..acce6f971a4a1 100644 --- a/c_glib/arrow-flight-sql-glib/server.hpp +++ b/c_glib/arrow-flight-sql-glib/server.hpp @@ -23,20 +23,17 @@ #include - GAFlightSQLStatementQuery * gaflightsql_statement_query_new_raw( const arrow::flight::sql::StatementQuery *flight_command); const arrow::flight::sql::StatementQuery * -gaflightsql_statement_query_get_raw( - GAFlightSQLStatementQuery *command); +gaflightsql_statement_query_get_raw(GAFlightSQLStatementQuery *command); GAFlightSQLStatementUpdate * gaflightsql_statement_update_new_raw( const arrow::flight::sql::StatementUpdate *flight_command); const arrow::flight::sql::StatementUpdate * -gaflightsql_statement_update_get_raw( - GAFlightSQLStatementUpdate *command); +gaflightsql_statement_update_get_raw(GAFlightSQLStatementUpdate *command); GAFlightSQLPreparedStatementUpdate * gaflightsql_prepared_statement_update_new_raw( @@ -49,8 +46,7 @@ GAFlightSQLStatementQueryTicket * gaflightsql_statement_query_ticket_new_raw( const arrow::flight::sql::StatementQueryTicket *flight_command); const arrow::flight::sql::StatementQueryTicket * -gaflightsql_statement_query_ticket_get_raw( - GAFlightSQLStatementQueryTicket *command); +gaflightsql_statement_query_ticket_get_raw(GAFlightSQLStatementQueryTicket *command); GAFlightSQLCreatePreparedStatementRequest * gaflightsql_create_prepared_statement_request_new_raw( diff --git a/c_glib/arrow-glib/array-builder.cpp b/c_glib/arrow-glib/array-builder.cpp index 5171161970bf5..6d8ce4a35ac0a 100644 --- a/c_glib/arrow-glib/array-builder.cpp +++ b/c_glib/arrow-glib/array-builder.cpp @@ -81,9 +81,7 @@ garrow_array_builder_append_values(VALUE *values, for (gint64 j = 0; j < n_values; ++j) { valid_bytes[j] = chunked_is_valids[j]; } - auto status = append_function(values + offset, - n_values, - valid_bytes); + auto status = append_function(values + offset, n_values, valid_bytes); if (!garrow_error_check(error, status, context)) { return FALSE; } @@ -174,8 +172,7 @@ garrow_array_builder_append_values(GArrowArrayBuilder *builder, if (value) { size_t data_size; auto raw_data = g_bytes_get_data(value, &data_size); - strings.push_back(std::string(static_cast(raw_data), - data_size)); + strings.push_back(std::string(static_cast(raw_data), data_size)); if (valid_bytes) { valid_bytes_buffer[j] = is_valids[offset + j]; } @@ -202,19 +199,17 @@ garrow_array_builder_append_values(GArrowArrayBuilder *builder, template gboolean -garrow_array_builder_append_values( - GArrowArrayBuilder *builder, - VALUE *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error, - const gchar *context, - GET_VALUE_FUNCTION get_value_function) +garrow_array_builder_append_values(GArrowArrayBuilder *builder, + VALUE *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error, + const gchar *context, + GET_VALUE_FUNCTION get_value_function) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(builder)); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(builder)); if (is_valids_length > 0 && values_length != is_valids_length) { g_set_error(error, GARROW_ERROR, @@ -260,9 +255,7 @@ garrow_array_builder_append_values( value = values[offset + j]; } if (value) { - get_value_function(data + (value_size * j), - value, - value_size); + get_value_function(data + (value_size * j), value, value_size); } else { is_valid = false; if (!valid_bytes) { @@ -348,7 +341,6 @@ garrow_array_builder_append_values(GArrowArrayBuilder *builder, return TRUE; } - G_BEGIN_DECLS /** @@ -481,7 +473,8 @@ G_BEGIN_DECLS * #GArrowSparseUnionArray. */ -struct GArrowArrayBuilderPrivate { +struct GArrowArrayBuilderPrivate +{ std::shared_ptr array_builder; GList *children; }; @@ -495,10 +488,9 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowArrayBuilder, garrow_array_builder, G_TYPE_OBJECT) -#define GARROW_ARRAY_BUILDER_GET_PRIVATE(obj) \ - static_cast( \ - garrow_array_builder_get_instance_private( \ - GARROW_ARRAY_BUILDER(obj))) +#define GARROW_ARRAY_BUILDER_GET_PRIVATE(obj) \ + static_cast( \ + garrow_array_builder_get_instance_private(GARROW_ARRAY_BUILDER(obj))) static void garrow_array_builder_finalize(GObject *object) @@ -528,8 +520,7 @@ garrow_array_builder_set_property(GObject *object, switch (prop_id) { case PROP_ARRAY_BUILDER: priv->array_builder = - *static_cast *>( - g_value_get_pointer(value)); + *static_cast *>(g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -541,7 +532,7 @@ static void garrow_array_builder_init(GArrowArrayBuilder *builder) { auto priv = GARROW_ARRAY_BUILDER_GET_PRIVATE(builder); - new(&priv->array_builder) std::shared_ptr; + new (&priv->array_builder) std::shared_ptr; } static void @@ -549,16 +540,16 @@ garrow_array_builder_class_init(GArrowArrayBuilderClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_array_builder_finalize; - gobject_class->dispose = garrow_array_builder_dispose; + gobject_class->finalize = garrow_array_builder_finalize; + gobject_class->dispose = garrow_array_builder_dispose; gobject_class->set_property = garrow_array_builder_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("array-builder", - "Array builder", - "The raw std::shared_ptr", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "array-builder", + "Array builder", + "The raw std::shared_ptr", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_ARRAY_BUILDER, spec); } @@ -573,8 +564,7 @@ garrow_array_builder_new(const std::shared_ptr &type, if (!garrow_error_check(error, status, context)) { return nullptr; } - std::shared_ptr - shared_arrow_builder(std::move(arrow_builder)); + std::shared_ptr shared_arrow_builder(std::move(arrow_builder)); return garrow_array_builder_new_raw(&shared_arrow_builder); } @@ -700,8 +690,7 @@ garrow_array_builder_get_n_nulls(GArrowArrayBuilder *builder) * Since: 12.0.0 */ GArrowArrayBuilder * -garrow_array_builder_get_child(GArrowArrayBuilder *builder, - gint i) +garrow_array_builder_get_child(GArrowArrayBuilder *builder, gint i) { auto children = garrow_array_builder_get_children(builder); auto child = g_list_nth_data(children, i); @@ -745,9 +734,7 @@ garrow_array_builder_get_children(GArrowArrayBuilder *builder) * Since: 2.0.0 */ gboolean -garrow_array_builder_resize(GArrowArrayBuilder *builder, - gint64 capacity, - GError **error) +garrow_array_builder_resize(GArrowArrayBuilder *builder, gint64 capacity, GError **error) { auto arrow_builder = garrow_array_builder_get_raw(builder); auto status = arrow_builder->Resize(capacity); @@ -784,8 +771,7 @@ garrow_array_builder_reserve(GArrowArrayBuilder *builder, * Since: 3.0.0 */ gboolean -garrow_array_builder_append_null(GArrowArrayBuilder *builder, - GError **error) +garrow_array_builder_append_null(GArrowArrayBuilder *builder, GError **error) { auto arrow_builder = garrow_array_builder_get_raw(builder); auto status = arrow_builder->AppendNull(); @@ -806,9 +792,7 @@ garrow_array_builder_append_null(GArrowArrayBuilder *builder, * Since: 3.0.0 */ gboolean -garrow_array_builder_append_nulls(GArrowArrayBuilder *builder, - gint64 n, - GError **error) +garrow_array_builder_append_nulls(GArrowArrayBuilder *builder, gint64 n, GError **error) { const gchar *context = "[array-builder][append-nulls]"; if (n < 0) { @@ -840,14 +824,11 @@ garrow_array_builder_append_nulls(GArrowArrayBuilder *builder, * Since: 3.0.0 */ gboolean -garrow_array_builder_append_empty_value(GArrowArrayBuilder *builder, - GError **error) +garrow_array_builder_append_empty_value(GArrowArrayBuilder *builder, GError **error) { auto arrow_builder = garrow_array_builder_get_raw(builder); auto status = arrow_builder->AppendEmptyValue(); - return garrow_error_check(error, - status, - "[array-builder][append-empty-value]"); + return garrow_error_check(error, status, "[array-builder][append-empty-value]"); } /** @@ -888,7 +869,6 @@ garrow_array_builder_append_empty_values(GArrowArrayBuilder *builder, return garrow_error_check(error, status, context); } - G_DEFINE_TYPE(GArrowNullArrayBuilder, garrow_null_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -913,9 +893,8 @@ garrow_null_array_builder_class_init(GArrowNullArrayBuilderClass *klass) GArrowNullArrayBuilder * garrow_null_array_builder_new(void) { - auto builder = garrow_array_builder_new(arrow::null(), - NULL, - "[null-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow::null(), NULL, "[null-array-builder][new]"); return GARROW_NULL_ARRAY_BUILDER(builder); } @@ -932,8 +911,7 @@ garrow_null_array_builder_new(void) * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_null_array_builder_append_null(GArrowNullArrayBuilder *builder, - GError **error) +garrow_null_array_builder_append_null(GArrowNullArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -959,12 +937,9 @@ garrow_null_array_builder_append_nulls(GArrowNullArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowBooleanArrayBuilder, garrow_boolean_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -987,9 +962,8 @@ garrow_boolean_array_builder_class_init(GArrowBooleanArrayBuilderClass *klass) GArrowBooleanArrayBuilder * garrow_boolean_array_builder_new(void) { - auto builder = garrow_array_builder_new(arrow::boolean(), - NULL, - "[boolean-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow::boolean(), NULL, "[boolean-array-builder][new]"); return GARROW_BOOLEAN_ARRAY_BUILDER(builder); } @@ -1027,11 +1001,11 @@ garrow_boolean_array_builder_append_value(GArrowBooleanArrayBuilder *builder, gboolean value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - static_cast(value), - error, - "[boolean-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + static_cast(value), + error, + "[boolean-array-builder][append-value]"); } /** @@ -1065,14 +1039,14 @@ garrow_boolean_array_builder_append_values(GArrowBooleanArrayBuilder *builder, for (gint64 i = 0; i < values_length; ++i) { arrow_values[i] = values[i]; } - return garrow_array_builder_append_values - (GARROW_ARRAY_BUILDER(builder), - arrow_values, - values_length, - is_valids, - is_valids_length, - error, - "[boolean-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + arrow_values, + values_length, + is_valids, + is_valids_length, + error, + "[boolean-array-builder][append-values]"); } /** @@ -1113,15 +1087,10 @@ garrow_boolean_array_builder_append_nulls(GArrowBooleanArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - -G_DEFINE_TYPE(GArrowIntArrayBuilder, - garrow_int_array_builder, - GARROW_TYPE_ARRAY_BUILDER) +G_DEFINE_TYPE(GArrowIntArrayBuilder, garrow_int_array_builder, GARROW_TYPE_ARRAY_BUILDER) static void garrow_int_array_builder_init(GArrowIntArrayBuilder *builder) @@ -1144,11 +1113,10 @@ GArrowIntArrayBuilder * garrow_int_array_builder_new(void) { auto memory_pool = arrow::default_memory_pool(); - auto arrow_builder = - std::static_pointer_cast( - std::make_shared(memory_pool)); - auto builder = garrow_array_builder_new_raw(&arrow_builder, - GARROW_TYPE_INT_ARRAY_BUILDER); + auto arrow_builder = std::static_pointer_cast( + std::make_shared(memory_pool)); + auto builder = + garrow_array_builder_new_raw(&arrow_builder, GARROW_TYPE_INT_ARRAY_BUILDER); return GARROW_INT_ARRAY_BUILDER(builder); } @@ -1188,11 +1156,11 @@ garrow_int_array_builder_append_value(GArrowIntArrayBuilder *builder, gint64 value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[int-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[int-array-builder][append-value]"); } /** @@ -1222,14 +1190,14 @@ garrow_int_array_builder_append_values(GArrowIntArrayBuilder *builder, gint64 is_valids_length, GError **error) { - return garrow_array_builder_append_values - (GARROW_ARRAY_BUILDER(builder), - reinterpret_cast(values), - values_length, - is_valids, - is_valids_length, - error, - "[int-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + reinterpret_cast(values), + values_length, + is_valids, + is_valids_length, + error, + "[int-array-builder][append-values]"); } /** @@ -1245,8 +1213,7 @@ garrow_int_array_builder_append_values(GArrowIntArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_int_array_builder_append_null(GArrowIntArrayBuilder *builder, - GError **error) +garrow_int_array_builder_append_null(GArrowIntArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -1272,12 +1239,9 @@ garrow_int_array_builder_append_nulls(GArrowIntArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowUIntArrayBuilder, garrow_uint_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -1303,11 +1267,10 @@ GArrowUIntArrayBuilder * garrow_uint_array_builder_new(void) { auto memory_pool = arrow::default_memory_pool(); - auto arrow_builder = - std::static_pointer_cast( - std::make_shared(memory_pool)); - auto builder = garrow_array_builder_new_raw(&arrow_builder, - GARROW_TYPE_UINT_ARRAY_BUILDER); + auto arrow_builder = std::static_pointer_cast( + std::make_shared(memory_pool)); + auto builder = + garrow_array_builder_new_raw(&arrow_builder, GARROW_TYPE_UINT_ARRAY_BUILDER); return GARROW_UINT_ARRAY_BUILDER(builder); } @@ -1347,11 +1310,11 @@ garrow_uint_array_builder_append_value(GArrowUIntArrayBuilder *builder, guint64 value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[uint-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[uint-array-builder][append-value]"); } /** @@ -1381,14 +1344,14 @@ garrow_uint_array_builder_append_values(GArrowUIntArrayBuilder *builder, gint64 is_valids_length, GError **error) { - return garrow_array_builder_append_values - (GARROW_ARRAY_BUILDER(builder), - reinterpret_cast(values), - values_length, - is_valids, - is_valids_length, - error, - "[uint-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + reinterpret_cast(values), + values_length, + is_valids, + is_valids_length, + error, + "[uint-array-builder][append-values]"); } /** @@ -1404,8 +1367,7 @@ garrow_uint_array_builder_append_values(GArrowUIntArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_uint_array_builder_append_null(GArrowUIntArrayBuilder *builder, - GError **error) +garrow_uint_array_builder_append_null(GArrowUIntArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -1431,12 +1393,9 @@ garrow_uint_array_builder_append_nulls(GArrowUIntArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowInt8ArrayBuilder, garrow_int8_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -1459,9 +1418,8 @@ garrow_int8_array_builder_class_init(GArrowInt8ArrayBuilderClass *klass) GArrowInt8ArrayBuilder * garrow_int8_array_builder_new(void) { - auto builder = garrow_array_builder_new(arrow::int8(), - NULL, - "[int8-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow::int8(), NULL, "[int8-array-builder][new]"); return GARROW_INT8_ARRAY_BUILDER(builder); } @@ -1499,11 +1457,11 @@ garrow_int8_array_builder_append_value(GArrowInt8ArrayBuilder *builder, gint8 value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[int8-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[int8-array-builder][append-value]"); } /** @@ -1533,14 +1491,14 @@ garrow_int8_array_builder_append_values(GArrowInt8ArrayBuilder *builder, 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, - "[int8-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + values_length, + is_valids, + is_valids_length, + error, + "[int8-array-builder][append-values]"); } /** @@ -1554,8 +1512,7 @@ garrow_int8_array_builder_append_values(GArrowInt8ArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_int8_array_builder_append_null(GArrowInt8ArrayBuilder *builder, - GError **error) +garrow_int8_array_builder_append_null(GArrowInt8ArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -1581,12 +1538,9 @@ garrow_int8_array_builder_append_nulls(GArrowInt8ArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowUInt8ArrayBuilder, garrow_uint8_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -1609,9 +1563,8 @@ garrow_uint8_array_builder_class_init(GArrowUInt8ArrayBuilderClass *klass) GArrowUInt8ArrayBuilder * garrow_uint8_array_builder_new(void) { - auto builder = garrow_array_builder_new(arrow::uint8(), - NULL, - "[uint8-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow::uint8(), NULL, "[uint8-array-builder][new]"); return GARROW_UINT8_ARRAY_BUILDER(builder); } @@ -1646,14 +1599,14 @@ garrow_uint8_array_builder_append(GArrowUInt8ArrayBuilder *builder, */ gboolean garrow_uint8_array_builder_append_value(GArrowUInt8ArrayBuilder *builder, - guint8 value, - GError **error) + guint8 value, + GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[uint8-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[uint8-array-builder][append-value]"); } /** @@ -1683,14 +1636,14 @@ garrow_uint8_array_builder_append_values(GArrowUInt8ArrayBuilder *builder, 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, - "[uint8-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + values_length, + is_valids, + is_valids_length, + error, + "[uint8-array-builder][append-values]"); } /** @@ -1704,8 +1657,7 @@ garrow_uint8_array_builder_append_values(GArrowUInt8ArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_uint8_array_builder_append_null(GArrowUInt8ArrayBuilder *builder, - GError **error) +garrow_uint8_array_builder_append_null(GArrowUInt8ArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -1731,12 +1683,9 @@ garrow_uint8_array_builder_append_nulls(GArrowUInt8ArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowInt16ArrayBuilder, garrow_int16_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -1759,9 +1708,8 @@ garrow_int16_array_builder_class_init(GArrowInt16ArrayBuilderClass *klass) GArrowInt16ArrayBuilder * garrow_int16_array_builder_new(void) { - auto builder = garrow_array_builder_new(arrow::int16(), - NULL, - "[int16-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow::int16(), NULL, "[int16-array-builder][new]"); return GARROW_INT16_ARRAY_BUILDER(builder); } @@ -1799,11 +1747,11 @@ garrow_int16_array_builder_append_value(GArrowInt16ArrayBuilder *builder, gint16 value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[int16-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[int16-array-builder][append-value]"); } /** @@ -1833,14 +1781,14 @@ garrow_int16_array_builder_append_values(GArrowInt16ArrayBuilder *builder, 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, - "[int16-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + values_length, + is_valids, + is_valids_length, + error, + "[int16-array-builder][append-values]"); } /** @@ -1854,8 +1802,7 @@ garrow_int16_array_builder_append_values(GArrowInt16ArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_int16_array_builder_append_null(GArrowInt16ArrayBuilder *builder, - GError **error) +garrow_int16_array_builder_append_null(GArrowInt16ArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -1881,12 +1828,9 @@ garrow_int16_array_builder_append_nulls(GArrowInt16ArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowUInt16ArrayBuilder, garrow_uint16_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -1909,9 +1853,8 @@ garrow_uint16_array_builder_class_init(GArrowUInt16ArrayBuilderClass *klass) GArrowUInt16ArrayBuilder * garrow_uint16_array_builder_new(void) { - auto builder = garrow_array_builder_new(arrow::uint16(), - NULL, - "[uint16-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow::uint16(), NULL, "[uint16-array-builder][new]"); return GARROW_UINT16_ARRAY_BUILDER(builder); } @@ -1949,11 +1892,11 @@ garrow_uint16_array_builder_append_value(GArrowUInt16ArrayBuilder *builder, guint16 value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[uint16-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[uint16-array-builder][append-value]"); } /** @@ -1983,14 +1926,14 @@ garrow_uint16_array_builder_append_values(GArrowUInt16ArrayBuilder *builder, 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, - "[uint16-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + values_length, + is_valids, + is_valids_length, + error, + "[uint16-array-builder][append-values]"); } /** @@ -2004,8 +1947,7 @@ garrow_uint16_array_builder_append_values(GArrowUInt16ArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_uint16_array_builder_append_null(GArrowUInt16ArrayBuilder *builder, - GError **error) +garrow_uint16_array_builder_append_null(GArrowUInt16ArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -2031,12 +1973,9 @@ garrow_uint16_array_builder_append_nulls(GArrowUInt16ArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowInt32ArrayBuilder, garrow_int32_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -2059,9 +1998,8 @@ garrow_int32_array_builder_class_init(GArrowInt32ArrayBuilderClass *klass) GArrowInt32ArrayBuilder * garrow_int32_array_builder_new(void) { - auto builder = garrow_array_builder_new(arrow::int32(), - NULL, - "[int32-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow::int32(), NULL, "[int32-array-builder][new]"); return GARROW_INT32_ARRAY_BUILDER(builder); } @@ -2099,11 +2037,11 @@ garrow_int32_array_builder_append_value(GArrowInt32ArrayBuilder *builder, gint32 value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[int32-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[int32-array-builder][append-value]"); } /** @@ -2133,14 +2071,14 @@ garrow_int32_array_builder_append_values(GArrowInt32ArrayBuilder *builder, 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, - "[int32-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + values_length, + is_valids, + is_valids_length, + error, + "[int32-array-builder][append-values]"); } /** @@ -2154,8 +2092,7 @@ garrow_int32_array_builder_append_values(GArrowInt32ArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_int32_array_builder_append_null(GArrowInt32ArrayBuilder *builder, - GError **error) +garrow_int32_array_builder_append_null(GArrowInt32ArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -2181,12 +2118,9 @@ garrow_int32_array_builder_append_nulls(GArrowInt32ArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowUInt32ArrayBuilder, garrow_uint32_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -2209,9 +2143,8 @@ garrow_uint32_array_builder_class_init(GArrowUInt32ArrayBuilderClass *klass) GArrowUInt32ArrayBuilder * garrow_uint32_array_builder_new(void) { - auto builder = garrow_array_builder_new(arrow::uint32(), - NULL, - "[uint32-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow::uint32(), NULL, "[uint32-array-builder][new]"); return GARROW_UINT32_ARRAY_BUILDER(builder); } @@ -2249,11 +2182,11 @@ garrow_uint32_array_builder_append_value(GArrowUInt32ArrayBuilder *builder, guint32 value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[uint32-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[uint32-array-builder][append-value]"); } /** @@ -2283,14 +2216,14 @@ garrow_uint32_array_builder_append_values(GArrowUInt32ArrayBuilder *builder, 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, - "[uint32-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + values_length, + is_valids, + is_valids_length, + error, + "[uint32-array-builder][append-values]"); } /** @@ -2304,8 +2237,7 @@ garrow_uint32_array_builder_append_values(GArrowUInt32ArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_uint32_array_builder_append_null(GArrowUInt32ArrayBuilder *builder, - GError **error) +garrow_uint32_array_builder_append_null(GArrowUInt32ArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -2331,12 +2263,9 @@ garrow_uint32_array_builder_append_nulls(GArrowUInt32ArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowInt64ArrayBuilder, garrow_int64_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -2359,9 +2288,8 @@ garrow_int64_array_builder_class_init(GArrowInt64ArrayBuilderClass *klass) GArrowInt64ArrayBuilder * garrow_int64_array_builder_new(void) { - auto builder = garrow_array_builder_new(arrow::int64(), - NULL, - "[int64-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow::int64(), NULL, "[int64-array-builder][new]"); return GARROW_INT64_ARRAY_BUILDER(builder); } @@ -2399,11 +2327,11 @@ garrow_int64_array_builder_append_value(GArrowInt64ArrayBuilder *builder, gint64 value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[int64-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[int64-array-builder][append-value]"); } /** @@ -2433,14 +2361,14 @@ garrow_int64_array_builder_append_values(GArrowInt64ArrayBuilder *builder, gint64 is_valids_length, GError **error) { - return garrow_array_builder_append_values - (GARROW_ARRAY_BUILDER(builder), - reinterpret_cast(values), - values_length, - is_valids, - is_valids_length, - error, - "[int64-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + reinterpret_cast(values), + values_length, + is_valids, + is_valids_length, + error, + "[int64-array-builder][append-values]"); } /** @@ -2454,8 +2382,7 @@ garrow_int64_array_builder_append_values(GArrowInt64ArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_int64_array_builder_append_null(GArrowInt64ArrayBuilder *builder, - GError **error) +garrow_int64_array_builder_append_null(GArrowInt64ArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -2481,12 +2408,9 @@ garrow_int64_array_builder_append_nulls(GArrowInt64ArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowUInt64ArrayBuilder, garrow_uint64_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -2509,9 +2433,8 @@ garrow_uint64_array_builder_class_init(GArrowUInt64ArrayBuilderClass *klass) GArrowUInt64ArrayBuilder * garrow_uint64_array_builder_new(void) { - auto builder = garrow_array_builder_new(arrow::uint64(), - NULL, - "[uint64-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow::uint64(), NULL, "[uint64-array-builder][new]"); return GARROW_UINT64_ARRAY_BUILDER(builder); } @@ -2528,8 +2451,8 @@ garrow_uint64_array_builder_new(void) */ gboolean garrow_uint64_array_builder_append(GArrowUInt64ArrayBuilder *builder, - guint64 value, - GError **error) + guint64 value, + GError **error) { return garrow_uint64_array_builder_append_value(builder, value, error); } @@ -2549,11 +2472,11 @@ garrow_uint64_array_builder_append_value(GArrowUInt64ArrayBuilder *builder, guint64 value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[uint64-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[uint64-array-builder][append-value]"); } /** @@ -2583,14 +2506,14 @@ garrow_uint64_array_builder_append_values(GArrowUInt64ArrayBuilder *builder, gint64 is_valids_length, GError **error) { - return garrow_array_builder_append_values - (GARROW_ARRAY_BUILDER(builder), - reinterpret_cast(values), - values_length, - is_valids, - is_valids_length, - error, - "[uint64-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + reinterpret_cast(values), + values_length, + is_valids, + is_valids_length, + error, + "[uint64-array-builder][append-values]"); } /** @@ -2604,8 +2527,7 @@ garrow_uint64_array_builder_append_values(GArrowUInt64ArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_uint64_array_builder_append_null(GArrowUInt64ArrayBuilder *builder, - GError **error) +garrow_uint64_array_builder_append_null(GArrowUInt64ArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -2631,12 +2553,9 @@ garrow_uint64_array_builder_append_nulls(GArrowUInt64ArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowHalfFloatArrayBuilder, garrow_half_float_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -2647,8 +2566,7 @@ garrow_half_float_array_builder_init(GArrowHalfFloatArrayBuilder *builder) } static void -garrow_half_float_array_builder_class_init( - GArrowHalfFloatArrayBuilderClass *klass) +garrow_half_float_array_builder_class_init(GArrowHalfFloatArrayBuilderClass *klass) { } @@ -2679,16 +2597,15 @@ garrow_half_float_array_builder_new(void) * Since: 11.0.0 */ gboolean -garrow_half_float_array_builder_append_value( - GArrowHalfFloatArrayBuilder *builder, - guint16 value, - GError **error) +garrow_half_float_array_builder_append_value(GArrowHalfFloatArrayBuilder *builder, + guint16 value, + GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[half-float-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[half-float-array-builder][append-value]"); } /** @@ -2711,25 +2628,23 @@ garrow_half_float_array_builder_append_value( * Since: 11.0.0 */ gboolean -garrow_half_float_array_builder_append_values( - GArrowHalfFloatArrayBuilder *builder, - const guint16 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error) +garrow_half_float_array_builder_append_values(GArrowHalfFloatArrayBuilder *builder, + const guint16 *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, - "[half-float-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + values_length, + is_valids, + is_valids_length, + error, + "[half-float-array-builder][append-values]"); } - G_DEFINE_TYPE(GArrowFloatArrayBuilder, garrow_float_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -2752,9 +2667,8 @@ garrow_float_array_builder_class_init(GArrowFloatArrayBuilderClass *klass) GArrowFloatArrayBuilder * garrow_float_array_builder_new(void) { - auto builder = garrow_array_builder_new(arrow::float32(), - NULL, - "[float-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow::float32(), NULL, "[float-array-builder][new]"); return GARROW_FLOAT_ARRAY_BUILDER(builder); } @@ -2792,11 +2706,11 @@ garrow_float_array_builder_append_value(GArrowFloatArrayBuilder *builder, gfloat value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[float-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[float-array-builder][append-value]"); } /** @@ -2826,14 +2740,14 @@ garrow_float_array_builder_append_values(GArrowFloatArrayBuilder *builder, 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, - "[float-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + values_length, + is_valids, + is_valids_length, + error, + "[float-array-builder][append-values]"); } /** @@ -2847,8 +2761,7 @@ garrow_float_array_builder_append_values(GArrowFloatArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_float_array_builder_append_null(GArrowFloatArrayBuilder *builder, - GError **error) +garrow_float_array_builder_append_null(GArrowFloatArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -2874,12 +2787,9 @@ garrow_float_array_builder_append_nulls(GArrowFloatArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowDoubleArrayBuilder, garrow_double_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -2902,9 +2812,8 @@ garrow_double_array_builder_class_init(GArrowDoubleArrayBuilderClass *klass) GArrowDoubleArrayBuilder * garrow_double_array_builder_new(void) { - auto builder = garrow_array_builder_new(arrow::float64(), - NULL, - "[double-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow::float64(), NULL, "[double-array-builder][new]"); return GARROW_DOUBLE_ARRAY_BUILDER(builder); } @@ -2942,11 +2851,11 @@ garrow_double_array_builder_append_value(GArrowDoubleArrayBuilder *builder, gdouble value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[double-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[double-array-builder][append-value]"); } /** @@ -2976,14 +2885,14 @@ garrow_double_array_builder_append_values(GArrowDoubleArrayBuilder *builder, 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, - "[double-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + values_length, + is_valids, + is_valids_length, + error, + "[double-array-builder][append-values]"); } /** @@ -2997,8 +2906,7 @@ garrow_double_array_builder_append_values(GArrowDoubleArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_double_array_builder_append_null(GArrowDoubleArrayBuilder *builder, - GError **error) +garrow_double_array_builder_append_null(GArrowDoubleArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -3024,12 +2932,9 @@ garrow_double_array_builder_append_nulls(GArrowDoubleArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowBinaryArrayBuilder, garrow_binary_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -3052,9 +2957,8 @@ garrow_binary_array_builder_class_init(GArrowBinaryArrayBuilderClass *klass) GArrowBinaryArrayBuilder * garrow_binary_array_builder_new(void) { - auto builder = garrow_array_builder_new(arrow::binary(), - NULL, - "[binary-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow::binary(), NULL, "[binary-array-builder][new]"); return GARROW_BINARY_ARRAY_BUILDER(builder); } @@ -3096,13 +3000,10 @@ garrow_binary_array_builder_append_value(GArrowBinaryArrayBuilder *builder, gint32 length, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto status = arrow_builder->Append(value, length); - return garrow_error_check(error, - status, - "[binary-array-builder][append-value]"); + return garrow_error_check(error, status, "[binary-array-builder][append-value]"); } /** @@ -3120,16 +3021,12 @@ garrow_binary_array_builder_append_value_bytes(GArrowBinaryArrayBuilder *builder GBytes *value, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); gsize size; auto data = g_bytes_get_data(value, &size); - auto status = arrow_builder->Append(static_cast(data), - size); - return garrow_error_check(error, - status, - "[binary-array-builder][append-value-bytes]"); + auto status = arrow_builder->Append(static_cast(data), size); + return garrow_error_check(error, status, "[binary-array-builder][append-value-bytes]"); } /** @@ -3159,14 +3056,14 @@ garrow_binary_array_builder_append_values(GArrowBinaryArrayBuilder *builder, 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, - "[binary-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + values_length, + is_valids, + is_valids_length, + error, + "[binary-array-builder][append-values]"); } /** @@ -3180,8 +3077,7 @@ garrow_binary_array_builder_append_values(GArrowBinaryArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_binary_array_builder_append_null(GArrowBinaryArrayBuilder *builder, - GError **error) +garrow_binary_array_builder_append_null(GArrowBinaryArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -3204,12 +3100,9 @@ garrow_binary_array_builder_append_nulls(GArrowBinaryArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowLargeBinaryArrayBuilder, garrow_large_binary_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -3257,13 +3150,10 @@ garrow_large_binary_array_builder_append_value(GArrowLargeBinaryArrayBuilder *bu gint64 length, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto status = arrow_builder->Append(value, length); - return garrow_error_check(error, - status, - "[large-binary-array-builder][append-value]"); + return garrow_error_check(error, status, "[large-binary-array-builder][append-value]"); } /** @@ -3277,17 +3167,14 @@ garrow_large_binary_array_builder_append_value(GArrowLargeBinaryArrayBuilder *bu * Since: 0.16.0 */ gboolean -garrow_large_binary_array_builder_append_value_bytes(GArrowLargeBinaryArrayBuilder *builder, - GBytes *value, - GError **error) +garrow_large_binary_array_builder_append_value_bytes( + GArrowLargeBinaryArrayBuilder *builder, GBytes *value, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); gsize size; gconstpointer data = g_bytes_get_data(value, &size); - auto status = arrow_builder->Append(static_cast(data), - size); + auto status = arrow_builder->Append(static_cast(data), size); return garrow_error_check(error, status, "[large-binary-array-builder][append-value-bytes]"); @@ -3320,14 +3207,14 @@ garrow_large_binary_array_builder_append_values(GArrowLargeBinaryArrayBuilder *b 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, - "[large-binary-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + values_length, + is_valids, + is_valids_length, + error, + "[large-binary-array-builder][append-values]"); } /** @@ -3367,12 +3254,9 @@ garrow_large_binary_array_builder_append_nulls(GArrowLargeBinaryArrayBuilder *bu gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowStringArrayBuilder, garrow_string_array_builder, GARROW_TYPE_BINARY_ARRAY_BUILDER) @@ -3395,9 +3279,8 @@ garrow_string_array_builder_class_init(GArrowStringArrayBuilderClass *klass) GArrowStringArrayBuilder * garrow_string_array_builder_new(void) { - auto builder = garrow_array_builder_new(arrow::utf8(), - NULL, - "[string-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow::utf8(), NULL, "[string-array-builder][new]"); return GARROW_STRING_ARRAY_BUILDER(builder); } @@ -3456,11 +3339,10 @@ garrow_string_array_builder_append_string(GArrowStringArrayBuilder *builder, const gchar *value, GError **error) { - return garrow_string_array_builder_append_string_len( - builder, - value, - static_cast(strlen(value)), - error); + return garrow_string_array_builder_append_string_len(builder, + value, + static_cast(strlen(value)), + error); } /** @@ -3480,13 +3362,10 @@ garrow_string_array_builder_append_string_len(GArrowStringArrayBuilder *builder, gint32 length, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto status = arrow_builder->Append(value, length); - return garrow_error_check(error, - status, - "[string-array-builder][append-string]"); + return garrow_error_check(error, status, "[string-array-builder][append-string]"); } /** @@ -3554,17 +3433,16 @@ garrow_string_array_builder_append_strings(GArrowStringArrayBuilder *builder, 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, - "[string-array-builder][append-strings]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + values_length, + is_valids, + is_valids_length, + error, + "[string-array-builder][append-strings]"); } - G_DEFINE_TYPE(GArrowLargeStringArrayBuilder, garrow_large_string_array_builder, GARROW_TYPE_LARGE_BINARY_ARRAY_BUILDER) @@ -3628,15 +3506,15 @@ garrow_large_string_array_builder_append_string(GArrowLargeStringArrayBuilder *b * * Since: 8.0.0 */ -gboolean garrow_large_string_array_builder_append_string_len( +gboolean +garrow_large_string_array_builder_append_string_len( GArrowLargeStringArrayBuilder *builder, const gchar *value, gint64 length, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto status = arrow_builder->Append(value, length); return garrow_error_check(error, status, @@ -3670,24 +3548,22 @@ garrow_large_string_array_builder_append_strings(GArrowLargeStringArrayBuilder * 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, - "[large-string-array-builder][append-strings]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + values_length, + is_valids, + is_valids_length, + error, + "[large-string-array-builder][append-strings]"); } - G_DEFINE_TYPE(GArrowFixedSizeBinaryArrayBuilder, garrow_fixed_size_binary_array_builder, GARROW_TYPE_ARRAY_BUILDER) static void -garrow_fixed_size_binary_array_builder_init( - GArrowFixedSizeBinaryArrayBuilder *builder) +garrow_fixed_size_binary_array_builder_init(GArrowFixedSizeBinaryArrayBuilder *builder) { } @@ -3704,14 +3580,12 @@ garrow_fixed_size_binary_array_builder_class_init( * Returns: A newly created #GArrowFixedSizeBinaryArrayBuilder. */ GArrowFixedSizeBinaryArrayBuilder * -garrow_fixed_size_binary_array_builder_new( - GArrowFixedSizeBinaryDataType *data_type) +garrow_fixed_size_binary_array_builder_new(GArrowFixedSizeBinaryDataType *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, - "[fixed-size-binary-array-builder][new]"); + auto builder = garrow_array_builder_new(arrow_data_type, + NULL, + "[fixed-size-binary-array-builder][new]"); return GARROW_FIXED_SIZE_BINARY_ARRAY_BUILDER(builder); } @@ -3734,9 +3608,8 @@ garrow_fixed_size_binary_array_builder_append_value( GError **error) { const gchar *context = "[fixed-size-binary-array-builder][append-value]"; - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); arrow::Status status; if (value) { if (arrow_builder->byte_width() != length) { @@ -3768,14 +3641,11 @@ garrow_fixed_size_binary_array_builder_append_value( */ gboolean garrow_fixed_size_binary_array_builder_append_value_bytes( - GArrowFixedSizeBinaryArrayBuilder *builder, - GBytes *value, - GError **error) + GArrowFixedSizeBinaryArrayBuilder *builder, GBytes *value, GError **error) { const gchar *context = "[fixed-size-binary-array-builder][append-value-bytes]"; - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); gsize size; auto data = g_bytes_get_data(value, &size); @@ -3865,16 +3735,15 @@ garrow_fixed_size_binary_array_builder_append_values_packed( gint64 is_valids_length, GError **error) { - return garrow_array_builder_append_values - (GARROW_ARRAY_BUILDER(builder), - values, - is_valids, - is_valids_length, - error, - "[fixed-size-binary-array-builder][append-values-packed]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + is_valids, + is_valids_length, + error, + "[fixed-size-binary-array-builder][append-values-packed]"); } - G_DEFINE_TYPE(GArrowDate32ArrayBuilder, garrow_date32_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -3899,9 +3768,8 @@ garrow_date32_array_builder_class_init(GArrowDate32ArrayBuilderClass *klass) GArrowDate32ArrayBuilder * garrow_date32_array_builder_new(void) { - auto builder = garrow_array_builder_new(arrow::date32(), - NULL, - "[date32-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow::date32(), NULL, "[date32-array-builder][new]"); return GARROW_DATE32_ARRAY_BUILDER(builder); } @@ -3941,11 +3809,11 @@ garrow_date32_array_builder_append_value(GArrowDate32ArrayBuilder *builder, gint32 value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[date32-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[date32-array-builder][append-value]"); } /** @@ -3976,14 +3844,14 @@ garrow_date32_array_builder_append_values(GArrowDate32ArrayBuilder *builder, 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, - "[date32-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + values_length, + is_valids, + is_valids_length, + error, + "[date32-array-builder][append-values]"); } /** @@ -3999,8 +3867,7 @@ garrow_date32_array_builder_append_values(GArrowDate32ArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_date32_array_builder_append_null(GArrowDate32ArrayBuilder *builder, - GError **error) +garrow_date32_array_builder_append_null(GArrowDate32ArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -4026,12 +3893,9 @@ garrow_date32_array_builder_append_nulls(GArrowDate32ArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowDate64ArrayBuilder, garrow_date64_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -4056,9 +3920,8 @@ garrow_date64_array_builder_class_init(GArrowDate64ArrayBuilderClass *klass) GArrowDate64ArrayBuilder * garrow_date64_array_builder_new(void) { - auto builder = garrow_array_builder_new(arrow::date64(), - NULL, - "[date64-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow::date64(), NULL, "[date64-array-builder][new]"); return GARROW_DATE64_ARRAY_BUILDER(builder); } @@ -4098,11 +3961,11 @@ garrow_date64_array_builder_append_value(GArrowDate64ArrayBuilder *builder, gint64 value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[date64-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[date64-array-builder][append-value]"); } /** @@ -4133,14 +3996,14 @@ garrow_date64_array_builder_append_values(GArrowDate64ArrayBuilder *builder, gint64 is_valids_length, GError **error) { - return garrow_array_builder_append_values - (GARROW_ARRAY_BUILDER(builder), - reinterpret_cast(values), - values_length, - is_valids, - is_valids_length, - error, - "[date64-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + reinterpret_cast(values), + values_length, + is_valids, + is_valids_length, + error, + "[date64-array-builder][append-values]"); } /** @@ -4156,8 +4019,7 @@ garrow_date64_array_builder_append_values(GArrowDate64ArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_date64_array_builder_append_null(GArrowDate64ArrayBuilder *builder, - GError **error) +garrow_date64_array_builder_append_null(GArrowDate64ArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -4183,12 +4045,9 @@ garrow_date64_array_builder_append_nulls(GArrowDate64ArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowTimestampArrayBuilder, garrow_timestamp_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -4215,9 +4074,8 @@ GArrowTimestampArrayBuilder * garrow_timestamp_array_builder_new(GArrowTimestampDataType *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, - "[timestamp-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow_data_type, NULL, "[timestamp-array-builder][new]"); return GARROW_TIMESTAMP_ARRAY_BUILDER(builder); } @@ -4257,11 +4115,11 @@ garrow_timestamp_array_builder_append_value(GArrowTimestampArrayBuilder *builder gint64 value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[timestamp-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[timestamp-array-builder][append-value]"); } /** @@ -4292,14 +4150,14 @@ garrow_timestamp_array_builder_append_values(GArrowTimestampArrayBuilder *builde gint64 is_valids_length, GError **error) { - return garrow_array_builder_append_values - (GARROW_ARRAY_BUILDER(builder), - reinterpret_cast(values), - values_length, - is_valids, - is_valids_length, - error, - "[timestamp-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + reinterpret_cast(values), + values_length, + is_valids, + is_valids_length, + error, + "[timestamp-array-builder][append-values]"); } /** @@ -4342,12 +4200,9 @@ garrow_timestamp_array_builder_append_nulls(GArrowTimestampArrayBuilder *builder gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowTime32ArrayBuilder, garrow_time32_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -4374,9 +4229,8 @@ GArrowTime32ArrayBuilder * garrow_time32_array_builder_new(GArrowTime32DataType *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, - "[time32-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow_data_type, NULL, "[time32-array-builder][new]"); return GARROW_TIME32_ARRAY_BUILDER(builder); } @@ -4416,11 +4270,11 @@ garrow_time32_array_builder_append_value(GArrowTime32ArrayBuilder *builder, gint32 value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[time32-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[time32-array-builder][append-value]"); } /** @@ -4451,14 +4305,14 @@ garrow_time32_array_builder_append_values(GArrowTime32ArrayBuilder *builder, 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, - "[time32-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + values_length, + is_valids, + is_valids_length, + error, + "[time32-array-builder][append-values]"); } /** @@ -4474,8 +4328,7 @@ garrow_time32_array_builder_append_values(GArrowTime32ArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_time32_array_builder_append_null(GArrowTime32ArrayBuilder *builder, - GError **error) +garrow_time32_array_builder_append_null(GArrowTime32ArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -4501,12 +4354,9 @@ garrow_time32_array_builder_append_nulls(GArrowTime32ArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowTime64ArrayBuilder, garrow_time64_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -4533,9 +4383,8 @@ GArrowTime64ArrayBuilder * garrow_time64_array_builder_new(GArrowTime64DataType *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, - "[time64-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow_data_type, NULL, "[time64-array-builder][new]"); return GARROW_TIME64_ARRAY_BUILDER(builder); } @@ -4575,11 +4424,11 @@ garrow_time64_array_builder_append_value(GArrowTime64ArrayBuilder *builder, gint64 value, GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[time64-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[time64-array-builder][append-value]"); } /** @@ -4610,14 +4459,14 @@ garrow_time64_array_builder_append_values(GArrowTime64ArrayBuilder *builder, gint64 is_valids_length, GError **error) { - return garrow_array_builder_append_values - (GARROW_ARRAY_BUILDER(builder), - reinterpret_cast(values), - values_length, - is_valids, - is_valids_length, - error, - "[time64-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + reinterpret_cast(values), + values_length, + is_valids, + is_valids_length, + error, + "[time64-array-builder][append-values]"); } /** @@ -4633,8 +4482,7 @@ garrow_time64_array_builder_append_values(GArrowTime64ArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_time64_array_builder_append_null(GArrowTime64ArrayBuilder *builder, - GError **error) +garrow_time64_array_builder_append_null(GArrowTime64ArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -4660,19 +4508,15 @@ garrow_time64_array_builder_append_nulls(GArrowTime64ArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } - G_DEFINE_TYPE(GArrowMonthIntervalArrayBuilder, garrow_month_interval_array_builder, GARROW_TYPE_ARRAY_BUILDER) static void -garrow_month_interval_array_builder_init( - GArrowMonthIntervalArrayBuilder *builder) +garrow_month_interval_array_builder_init(GArrowMonthIntervalArrayBuilder *builder) { } @@ -4709,16 +4553,15 @@ garrow_month_interval_array_builder_new(void) * Since: 8.0.0 */ gboolean -garrow_month_interval_array_builder_append_value( - GArrowMonthIntervalArrayBuilder *builder, - gint32 value, - GError **error) +garrow_month_interval_array_builder_append_value(GArrowMonthIntervalArrayBuilder *builder, + gint32 value, + GError **error) { - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - value, - error, - "[month-interval-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + value, + error, + "[month-interval-array-builder][append-value]"); } /** @@ -4749,24 +4592,22 @@ garrow_month_interval_array_builder_append_values( 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, - "[month-interval-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + values, + values_length, + is_valids, + is_valids_length, + error, + "[month-interval-array-builder][append-values]"); } - G_DEFINE_TYPE(GArrowDayTimeIntervalArrayBuilder, garrow_day_time_interval_array_builder, GARROW_TYPE_ARRAY_BUILDER) static void -garrow_day_time_interval_array_builder_init( - GArrowDayTimeIntervalArrayBuilder *builder) +garrow_day_time_interval_array_builder_init(GArrowDayTimeIntervalArrayBuilder *builder) { } @@ -4804,20 +4645,17 @@ garrow_day_time_interval_array_builder_new(void) */ gboolean garrow_day_time_interval_array_builder_append_value( - GArrowDayTimeIntervalArrayBuilder *builder, - GArrowDayMillisecond *value, - GError **error) + GArrowDayTimeIntervalArrayBuilder *builder, GArrowDayMillisecond *value, GError **error) { if (value) { auto arrow_day_millisecond = garrow_day_millisecond_get_raw(value); - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - *arrow_day_millisecond, - error, - "[day-time-interval-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + *arrow_day_millisecond, + error, + "[day-time-interval-array-builder][append-value]"); } else { - return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), - error); + return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } } @@ -4849,9 +4687,8 @@ garrow_day_time_interval_array_builder_append_values( gint64 is_valids_length, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); return garrow_array_builder_append_values( values, @@ -4880,7 +4717,6 @@ garrow_day_time_interval_array_builder_append_values( }); } - G_DEFINE_TYPE(GArrowMonthDayNanoIntervalArrayBuilder, garrow_month_day_nano_interval_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -4907,10 +4743,9 @@ garrow_month_day_nano_interval_array_builder_class_init( GArrowMonthDayNanoIntervalArrayBuilder * garrow_month_day_nano_interval_array_builder_new(void) { - auto builder = - garrow_array_builder_new(arrow::month_day_nano_interval(), - NULL, - "[month-day-nano-interval-array-builder][new]"); + auto builder = garrow_array_builder_new(arrow::month_day_nano_interval(), + NULL, + "[month-day-nano-interval-array-builder][new]"); return GARROW_MONTH_DAY_NANO_INTERVAL_ARRAY_BUILDER(builder); } @@ -4938,8 +4773,7 @@ garrow_month_day_nano_interval_array_builder_append_value( error, "[month-day-nano-interval-array-builder][append-value]"); } else { - return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), - error); + return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } } @@ -4971,9 +4805,8 @@ garrow_month_day_nano_interval_array_builder_append_values( gint64 is_valids_length, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); return garrow_array_builder_append_values( values, @@ -5002,7 +4835,6 @@ garrow_month_day_nano_interval_array_builder_append_values( }); } - G_DEFINE_TYPE(GArrowBinaryDictionaryArrayBuilder, garrow_binary_dictionary_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -5013,11 +4845,11 @@ garrow_binary_dictionary_array_builder_init(GArrowBinaryDictionaryArrayBuilder * } static void -garrow_binary_dictionary_array_builder_class_init(GArrowBinaryDictionaryArrayBuilderClass *klass) +garrow_binary_dictionary_array_builder_class_init( + GArrowBinaryDictionaryArrayBuilderClass *klass) { } - /** * garrow_binary_dictionary_array_builder_new: * @@ -5029,7 +4861,8 @@ GArrowBinaryDictionaryArrayBuilder * garrow_binary_dictionary_array_builder_new(void) { // We can use arrow:int8() for the index type of the following arrow_dict_type - // because arrow::MakeBuilder creates a dictionary builder with arrow::AdaptiveIntBuilder. + // because arrow::MakeBuilder creates a dictionary builder with + // arrow::AdaptiveIntBuilder. auto arrow_dict_type = arrow::dictionary(arrow::int8(), arrow::binary()); auto builder = garrow_array_builder_new(arrow_dict_type, nullptr, @@ -5050,8 +4883,8 @@ garrow_binary_dictionary_array_builder_new(void) * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_binary_dictionary_array_builder_append_null(GArrowBinaryDictionaryArrayBuilder *builder, - GError **error) +garrow_binary_dictionary_array_builder_append_null( + GArrowBinaryDictionaryArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -5068,14 +4901,14 @@ garrow_binary_dictionary_array_builder_append_null(GArrowBinaryDictionaryArrayBu * Since: 2.0.0 */ gboolean -garrow_binary_dictionary_array_builder_append_value(GArrowBinaryDictionaryArrayBuilder *builder, - const guint8 *value, - gint32 length, - GError **error) +garrow_binary_dictionary_array_builder_append_value( + GArrowBinaryDictionaryArrayBuilder *builder, + const guint8 *value, + gint32 length, + GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto status = arrow_builder->Append(value, length); return garrow_error_check(error, status, @@ -5093,17 +4926,14 @@ garrow_binary_dictionary_array_builder_append_value(GArrowBinaryDictionaryArrayB * Since: 2.0.0 */ gboolean -garrow_binary_dictionary_array_builder_append_value_bytes(GArrowBinaryDictionaryArrayBuilder *builder, - GBytes *value, - GError **error) +garrow_binary_dictionary_array_builder_append_value_bytes( + GArrowBinaryDictionaryArrayBuilder *builder, GBytes *value, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); gsize size; auto data = g_bytes_get_data(value, &size); - auto status = arrow_builder->Append(static_cast(data), - size); + auto status = arrow_builder->Append(static_cast(data), size); return garrow_error_check(error, status, "[binary-dictionary-array-builder][append-value-bytes]"); @@ -5120,13 +4950,11 @@ garrow_binary_dictionary_array_builder_append_value_bytes(GArrowBinaryDictionary * Since: 2.0.0 */ gboolean -garrow_binary_dictionary_array_builder_append_array(GArrowBinaryDictionaryArrayBuilder *builder, - GArrowBinaryArray *array, - GError **error) +garrow_binary_dictionary_array_builder_append_array( + GArrowBinaryDictionaryArrayBuilder *builder, GArrowBinaryArray *array, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); auto status = arrow_builder->AppendArray(*arrow_array); return garrow_error_check(error, @@ -5153,25 +4981,28 @@ garrow_binary_dictionary_array_builder_append_array(GArrowBinaryDictionaryArrayB * Since: 2.0.0 */ gboolean -garrow_binary_dictionary_array_builder_append_indices(GArrowBinaryDictionaryArrayBuilder *builder, - const gint64 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error) +garrow_binary_dictionary_array_builder_append_indices( + GArrowBinaryDictionaryArrayBuilder *builder, + const gint64 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error) { static const char *context = "[binary-dictionary-array-builder][append-indices]"; - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); - auto append_function = [&arrow_builder]( - const gint64 *values, - gint64 values_length, - const uint8_t *valid_bytes) -> arrow::Status { + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto append_function = [&arrow_builder](const gint64 *values, + gint64 values_length, + const uint8_t *valid_bytes) -> arrow::Status { return arrow_builder->AppendIndices(values, values_length, valid_bytes); }; - return garrow_array_builder_append_values(values, values_length, is_valids, - is_valids_length, error, context, + return garrow_array_builder_append_values(values, + values_length, + is_valids, + is_valids_length, + error, + context, append_function); } @@ -5183,11 +5014,12 @@ garrow_binary_dictionary_array_builder_append_indices(GArrowBinaryDictionaryArra * * Since: 2.0.0 */ -gint64 garrow_binary_dictionary_array_builder_get_dictionary_length(GArrowBinaryDictionaryArrayBuilder *builder) +gint64 +garrow_binary_dictionary_array_builder_get_dictionary_length( + GArrowBinaryDictionaryArrayBuilder *builder) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); return arrow_builder->dictionary_length(); } @@ -5203,15 +5035,15 @@ gint64 garrow_binary_dictionary_array_builder_get_dictionary_length(GArrowBinary * Since: 2.0.0 */ gboolean -garrow_binary_dictionary_array_builder_finish_delta(GArrowBinaryDictionaryArrayBuilder* builder, - GArrowArray **out_indices, - GArrowArray **out_delta, - GError **error) +garrow_binary_dictionary_array_builder_finish_delta( + GArrowBinaryDictionaryArrayBuilder *builder, + GArrowArray **out_indices, + GArrowArray **out_delta, + GError **error) { static const char *context = "[binary-dictionary-array-builder][finish-delta]"; - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); std::shared_ptr arrow_indices, arrow_delta; auto status = arrow_builder->FinishDelta(&arrow_indices, &arrow_delta); if (!garrow_error_check(error, status, context)) { @@ -5233,13 +5065,11 @@ garrow_binary_dictionary_array_builder_finish_delta(GArrowBinaryDictionaryArrayB * Since: 2.0.0 */ gboolean -garrow_binary_dictionary_array_builder_insert_memo_values(GArrowBinaryDictionaryArrayBuilder *builder, - GArrowBinaryArray *values, - GError **error) +garrow_binary_dictionary_array_builder_insert_memo_values( + GArrowBinaryDictionaryArrayBuilder *builder, GArrowBinaryArray *values, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(values)); auto status = arrow_builder->InsertMemoValues(*arrow_array); return garrow_error_check(error, @@ -5256,15 +5086,14 @@ garrow_binary_dictionary_array_builder_insert_memo_values(GArrowBinaryDictionary * Since: 2.0.0 */ void -garrow_binary_dictionary_array_builder_reset_full(GArrowBinaryDictionaryArrayBuilder *builder) +garrow_binary_dictionary_array_builder_reset_full( + GArrowBinaryDictionaryArrayBuilder *builder) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); arrow_builder->ResetFull(); } - G_DEFINE_TYPE(GArrowStringDictionaryArrayBuilder, garrow_string_dictionary_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -5275,11 +5104,11 @@ garrow_string_dictionary_array_builder_init(GArrowStringDictionaryArrayBuilder * } static void -garrow_string_dictionary_array_builder_class_init(GArrowStringDictionaryArrayBuilderClass *klass) +garrow_string_dictionary_array_builder_class_init( + GArrowStringDictionaryArrayBuilderClass *klass) { } - /** * garrow_string_dictionary_array_builder_new: * @@ -5291,7 +5120,8 @@ GArrowStringDictionaryArrayBuilder * garrow_string_dictionary_array_builder_new(void) { // We can use arrow:int8() for the index type of the following arrow_dict_type - // because arrow::MakeBuilder creates a dictionary builder with arrow::AdaptiveIntBuilder. + // because arrow::MakeBuilder creates a dictionary builder with + // arrow::AdaptiveIntBuilder. auto arrow_dict_type = arrow::dictionary(arrow::int8(), arrow::utf8()); auto builder = garrow_array_builder_new(arrow_dict_type, nullptr, @@ -5312,8 +5142,8 @@ garrow_string_dictionary_array_builder_new(void) * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_string_dictionary_array_builder_append_null(GArrowStringDictionaryArrayBuilder *builder, - GError **error) +garrow_string_dictionary_array_builder_append_null( + GArrowStringDictionaryArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -5329,15 +5159,12 @@ garrow_string_dictionary_array_builder_append_null(GArrowStringDictionaryArrayBu * Since: 2.0.0 */ gboolean -garrow_string_dictionary_array_builder_append_string(GArrowStringDictionaryArrayBuilder *builder, - const gchar *value, - GError **error) +garrow_string_dictionary_array_builder_append_string( + GArrowStringDictionaryArrayBuilder *builder, const gchar *value, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); - auto status = arrow_builder->Append(value, - static_cast(strlen(value))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto status = arrow_builder->Append(value, static_cast(strlen(value))); return garrow_error_check(error, status, "[string-dictionary-array-builder][append-string]"); @@ -5354,13 +5181,11 @@ garrow_string_dictionary_array_builder_append_string(GArrowStringDictionaryArray * Since: 2.0.0 */ gboolean -garrow_string_dictionary_array_builder_append_array(GArrowStringDictionaryArrayBuilder *builder, - GArrowStringArray *array, - GError **error) +garrow_string_dictionary_array_builder_append_array( + GArrowStringDictionaryArrayBuilder *builder, GArrowStringArray *array, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); auto status = arrow_builder->AppendArray(*arrow_array); return garrow_error_check(error, @@ -5387,25 +5212,28 @@ garrow_string_dictionary_array_builder_append_array(GArrowStringDictionaryArrayB * Since: 2.0.0 */ gboolean -garrow_string_dictionary_array_builder_append_indices(GArrowStringDictionaryArrayBuilder *builder, - const gint64 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error) +garrow_string_dictionary_array_builder_append_indices( + GArrowStringDictionaryArrayBuilder *builder, + const gint64 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error) { static const char *context = "[string-dictionary-array-builder][append-indices]"; - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); - auto append_function = [&arrow_builder]( - const gint64 *values, - gint64 values_length, - const uint8_t *valid_bytes) -> arrow::Status { + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto append_function = [&arrow_builder](const gint64 *values, + gint64 values_length, + const uint8_t *valid_bytes) -> arrow::Status { return arrow_builder->AppendIndices(values, values_length, valid_bytes); }; - return garrow_array_builder_append_values(values, values_length, is_valids, - is_valids_length, error, context, + return garrow_array_builder_append_values(values, + values_length, + is_valids, + is_valids_length, + error, + context, append_function); } @@ -5417,11 +5245,12 @@ garrow_string_dictionary_array_builder_append_indices(GArrowStringDictionaryArra * * Since: 2.0.0 */ -gint64 garrow_string_dictionary_array_builder_get_dictionary_length(GArrowStringDictionaryArrayBuilder *builder) +gint64 +garrow_string_dictionary_array_builder_get_dictionary_length( + GArrowStringDictionaryArrayBuilder *builder) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); return arrow_builder->dictionary_length(); } @@ -5437,15 +5266,15 @@ gint64 garrow_string_dictionary_array_builder_get_dictionary_length(GArrowString * Since: 2.0.0 */ gboolean -garrow_string_dictionary_array_builder_finish_delta(GArrowStringDictionaryArrayBuilder* builder, - GArrowArray **out_indices, - GArrowArray **out_delta, - GError **error) +garrow_string_dictionary_array_builder_finish_delta( + GArrowStringDictionaryArrayBuilder *builder, + GArrowArray **out_indices, + GArrowArray **out_delta, + GError **error) { static const char *context = "[string-dictionary-array-builder][finish-delta]"; - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); std::shared_ptr arrow_indices, arrow_delta; auto status = arrow_builder->FinishDelta(&arrow_indices, &arrow_delta); if (!garrow_error_check(error, status, context)) { @@ -5467,13 +5296,11 @@ garrow_string_dictionary_array_builder_finish_delta(GArrowStringDictionaryArrayB * Since: 2.0.0 */ gboolean -garrow_string_dictionary_array_builder_insert_memo_values(GArrowStringDictionaryArrayBuilder *builder, - GArrowStringArray *values, - GError **error) +garrow_string_dictionary_array_builder_insert_memo_values( + GArrowStringDictionaryArrayBuilder *builder, GArrowStringArray *values, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(values)); auto status = arrow_builder->InsertMemoValues(*arrow_array); return garrow_error_check(error, @@ -5490,16 +5317,16 @@ garrow_string_dictionary_array_builder_insert_memo_values(GArrowStringDictionary * Since: 2.0.0 */ void -garrow_string_dictionary_array_builder_reset_full(GArrowStringDictionaryArrayBuilder *builder) +garrow_string_dictionary_array_builder_reset_full( + GArrowStringDictionaryArrayBuilder *builder) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); arrow_builder->ResetFull(); } - -typedef struct GArrowListArrayBuilderPrivate_ { +typedef struct GArrowListArrayBuilderPrivate_ +{ GArrowArrayBuilder *value_builder; } GArrowListArrayBuilderPrivate; @@ -5507,10 +5334,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowListArrayBuilder, garrow_list_array_builder, GARROW_TYPE_ARRAY_BUILDER) -#define GARROW_LIST_ARRAY_BUILDER_GET_PRIVATE(obj) \ - static_cast( \ - garrow_list_array_builder_get_instance_private( \ - GARROW_LIST_ARRAY_BUILDER(obj))) +#define GARROW_LIST_ARRAY_BUILDER_GET_PRIVATE(obj) \ + static_cast( \ + garrow_list_array_builder_get_instance_private(GARROW_LIST_ARRAY_BUILDER(obj))) static void garrow_list_array_builder_dispose(GObject *object) @@ -5548,8 +5374,7 @@ garrow_list_array_builder_class_init(GArrowListArrayBuilderClass *klass) * Returns: A newly created #GArrowListArrayBuilder. */ GArrowListArrayBuilder * -garrow_list_array_builder_new(GArrowListDataType *data_type, - GError **error) +garrow_list_array_builder_new(GArrowListDataType *data_type, GError **error) { if (!GARROW_IS_LIST_DATA_TYPE(data_type)) { g_set_error(error, @@ -5559,11 +5384,9 @@ garrow_list_array_builder_new(GArrowListDataType *data_type, return NULL; } - auto arrow_data_type = - garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); - auto builder = garrow_array_builder_new(arrow_data_type, - error, - "[list-array-builder][new]"); + auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); + auto builder = + garrow_array_builder_new(arrow_data_type, error, "[list-array-builder][new]"); return GARROW_LIST_ARRAY_BUILDER(builder); } @@ -5614,8 +5437,7 @@ garrow_list_array_builder_new(GArrowListDataType *data_type, * Use garrow_list_array_builder_append_value() instead. */ gboolean -garrow_list_array_builder_append(GArrowListArrayBuilder *builder, - GError **error) +garrow_list_array_builder_append(GArrowListArrayBuilder *builder, GError **error) { return garrow_list_array_builder_append_value(builder, error); } @@ -5666,12 +5488,10 @@ garrow_list_array_builder_append(GArrowListArrayBuilder *builder, * Since: 0.12.0 */ gboolean -garrow_list_array_builder_append_value(GArrowListArrayBuilder *builder, - GError **error) +garrow_list_array_builder_append_value(GArrowListArrayBuilder *builder, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto status = arrow_builder->Append(); return garrow_error_check(error, status, "[list-array-builder][append-value]"); } @@ -5689,8 +5509,7 @@ garrow_list_array_builder_append_value(GArrowListArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_list_array_builder_append_null(GArrowListArrayBuilder *builder, - GError **error) +garrow_list_array_builder_append_null(GArrowListArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -5706,17 +5525,16 @@ garrow_list_array_builder_get_value_builder(GArrowListArrayBuilder *builder) { auto priv = GARROW_LIST_ARRAY_BUILDER_GET_PRIVATE(builder); if (!priv->value_builder) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto arrow_value_builder = arrow_builder->value_builder(); priv->value_builder = garrow_array_builder_new_raw(arrow_value_builder); } return priv->value_builder; } - -typedef struct GArrowLargeListArrayBuilderPrivate_ { +typedef struct GArrowLargeListArrayBuilderPrivate_ +{ GArrowArrayBuilder *value_builder; } GArrowLargeListArrayBuilderPrivate; @@ -5724,10 +5542,10 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowLargeListArrayBuilder, garrow_large_list_array_builder, GARROW_TYPE_ARRAY_BUILDER) -#define GARROW_LARGE_LIST_ARRAY_BUILDER_GET_PRIVATE(obj) \ - static_cast( \ - garrow_large_list_array_builder_get_instance_private( \ - GARROW_LARGE_LIST_ARRAY_BUILDER(obj))) +#define GARROW_LARGE_LIST_ARRAY_BUILDER_GET_PRIVATE(obj) \ + static_cast( \ + garrow_large_list_array_builder_get_instance_private( \ + GARROW_LARGE_LIST_ARRAY_BUILDER(obj))) static void garrow_large_list_array_builder_dispose(GObject *object) @@ -5765,8 +5583,7 @@ garrow_large_list_array_builder_class_init(GArrowLargeListArrayBuilderClass *kla * Since: 0.16.0 */ GArrowLargeListArrayBuilder * -garrow_large_list_array_builder_new(GArrowLargeListDataType *data_type, - GError **error) +garrow_large_list_array_builder_new(GArrowLargeListDataType *data_type, GError **error) { if (!GARROW_IS_LARGE_LIST_DATA_TYPE(data_type)) { g_set_error(error, @@ -5776,11 +5593,9 @@ garrow_large_list_array_builder_new(GArrowLargeListDataType *data_type, return NULL; } - auto arrow_data_type = - garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); - auto builder = garrow_array_builder_new(arrow_data_type, - error, - "[large-list-array-builder][new]"); + auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); + auto builder = + garrow_array_builder_new(arrow_data_type, error, "[large-list-array-builder][new]"); return GARROW_LARGE_LIST_ARRAY_BUILDER(builder); } @@ -5803,9 +5618,8 @@ gboolean garrow_large_list_array_builder_append_value(GArrowLargeListArrayBuilder *builder, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto status = arrow_builder->Append(); return garrow_error_check(error, status, "[large-list-array-builder][append-value]"); } @@ -5844,24 +5658,21 @@ garrow_large_list_array_builder_get_value_builder(GArrowLargeListArrayBuilder *b { auto priv = GARROW_LARGE_LIST_ARRAY_BUILDER_GET_PRIVATE(builder); if (!priv->value_builder) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto arrow_value_builder = arrow_builder->value_builder(); priv->value_builder = garrow_array_builder_new_raw(arrow_value_builder); } return priv->value_builder; } - G_DEFINE_TYPE(GArrowStructArrayBuilder, garrow_struct_array_builder, GARROW_TYPE_ARRAY_BUILDER) -#define GARROW_STRUCT_ARRAY_BUILDER_GET_PRIVATE(obj) \ - static_cast( \ - garrow_struct_array_builder_get_instance_private( \ - GARROW_STRUCT_ARRAY_BUILDER(obj))) +#define GARROW_STRUCT_ARRAY_BUILDER_GET_PRIVATE(obj) \ + static_cast( \ + garrow_struct_array_builder_get_instance_private(GARROW_STRUCT_ARRAY_BUILDER(obj))) static void garrow_struct_array_builder_init(GArrowStructArrayBuilder *builder) @@ -5881,8 +5692,7 @@ garrow_struct_array_builder_class_init(GArrowStructArrayBuilderClass *klass) * Returns: A newly created #GArrowStructArrayBuilder. */ GArrowStructArrayBuilder * -garrow_struct_array_builder_new(GArrowStructDataType *data_type, - GError **error) +garrow_struct_array_builder_new(GArrowStructDataType *data_type, GError **error) { if (!GARROW_IS_STRUCT_DATA_TYPE(data_type)) { g_set_error(error, @@ -5893,9 +5703,8 @@ garrow_struct_array_builder_new(GArrowStructDataType *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, - error, - "[struct-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow_data_type, error, "[struct-array-builder][new]"); return GARROW_STRUCT_ARRAY_BUILDER(builder); } @@ -5921,8 +5730,7 @@ garrow_struct_array_builder_new(GArrowStructDataType *data_type, * Use garrow_struct_array_builder_append_value() instead. */ gboolean -garrow_struct_array_builder_append(GArrowStructArrayBuilder *builder, - GError **error) +garrow_struct_array_builder_append(GArrowStructArrayBuilder *builder, GError **error) { return garrow_struct_array_builder_append_value(builder, error); } @@ -5951,13 +5759,10 @@ gboolean garrow_struct_array_builder_append_value(GArrowStructArrayBuilder *builder, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto status = arrow_builder->Append(); - return garrow_error_check(error, - status, - "[struct-array-builder][append-value]"); + return garrow_error_check(error, status, "[struct-array-builder][append-value]"); } /** @@ -5973,8 +5778,7 @@ garrow_struct_array_builder_append_value(GArrowStructArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_struct_array_builder_append_null(GArrowStructArrayBuilder *builder, - GError **error) +garrow_struct_array_builder_append_null(GArrowStructArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -5990,8 +5794,7 @@ garrow_struct_array_builder_append_null(GArrowStructArrayBuilder *builder, * Use garrow_array_builder_get_child() instead. */ GArrowArrayBuilder * -garrow_struct_array_builder_get_field_builder(GArrowStructArrayBuilder *builder, - gint i) +garrow_struct_array_builder_get_field_builder(GArrowStructArrayBuilder *builder, gint i) { return garrow_array_builder_get_child(GARROW_ARRAY_BUILDER(builder), i); } @@ -6012,8 +5815,8 @@ garrow_struct_array_builder_get_field_builders(GArrowStructArrayBuilder *builder return garrow_array_builder_get_children(GARROW_ARRAY_BUILDER(builder)); } - -typedef struct GArrowMapArrayBuilderPrivate_ { +typedef struct GArrowMapArrayBuilderPrivate_ +{ GArrowArrayBuilder *key_builder; GArrowArrayBuilder *item_builder; GArrowArrayBuilder *value_builder; @@ -6023,10 +5826,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowMapArrayBuilder, garrow_map_array_builder, GARROW_TYPE_ARRAY_BUILDER) -#define GARROW_MAP_ARRAY_BUILDER_GET_PRIVATE(object) \ - static_cast( \ - garrow_map_array_builder_get_instance_private( \ - GARROW_MAP_ARRAY_BUILDER(object))) +#define GARROW_MAP_ARRAY_BUILDER_GET_PRIVATE(object) \ + static_cast( \ + garrow_map_array_builder_get_instance_private(GARROW_MAP_ARRAY_BUILDER(object))) static void garrow_map_array_builder_dispose(GObject *object) @@ -6075,8 +5877,7 @@ garrow_map_array_builder_class_init(GArrowMapArrayBuilderClass *klass) * Since: 0.17.0 */ GArrowMapArrayBuilder * -garrow_map_array_builder_new(GArrowMapDataType *data_type, - GError **error) +garrow_map_array_builder_new(GArrowMapDataType *data_type, GError **error) { if (!GARROW_IS_MAP_DATA_TYPE(data_type)) { g_set_error(error, @@ -6087,9 +5888,8 @@ garrow_map_array_builder_new(GArrowMapDataType *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, - error, - "[map-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow_data_type, error, "[map-array-builder][new]"); if (builder) { return GARROW_MAP_ARRAY_BUILDER(builder); } else { @@ -6107,16 +5907,12 @@ garrow_map_array_builder_new(GArrowMapDataType *data_type, * Since: 0.17.0 */ gboolean -garrow_map_array_builder_append_value(GArrowMapArrayBuilder *builder, - GError **error) +garrow_map_array_builder_append_value(GArrowMapArrayBuilder *builder, GError **error) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto status = arrow_builder->Append(); - return garrow::check(error, - status, - "[map-array-builder][append-value]"); + return garrow::check(error, status, "[map-array-builder][append-value]"); } /** @@ -6146,14 +5942,14 @@ garrow_map_array_builder_append_values(GArrowMapArrayBuilder *builder, gint64 is_valids_length, GError **error) { - return garrow_array_builder_append_values - (GARROW_ARRAY_BUILDER(builder), - reinterpret_cast(offsets), - offsets_length, - is_valids, - is_valids_length, - error, - "[map-array-builder][append-values]"); + return garrow_array_builder_append_values( + GARROW_ARRAY_BUILDER(builder), + reinterpret_cast(offsets), + offsets_length, + is_valids, + is_valids_length, + error, + "[map-array-builder][append-values]"); } /** @@ -6169,8 +5965,7 @@ garrow_map_array_builder_append_values(GArrowMapArrayBuilder *builder, * Use garrow_array_builder_append_null() instead. */ gboolean -garrow_map_array_builder_append_null(GArrowMapArrayBuilder *builder, - GError **error) +garrow_map_array_builder_append_null(GArrowMapArrayBuilder *builder, GError **error) { return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } @@ -6196,9 +5991,7 @@ garrow_map_array_builder_append_nulls(GArrowMapArrayBuilder *builder, gint64 n, GError **error) { - return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), - n, - error); + return garrow_array_builder_append_nulls(GARROW_ARRAY_BUILDER(builder), n, error); } /** @@ -6214,9 +6007,8 @@ garrow_map_array_builder_get_key_builder(GArrowMapArrayBuilder *builder) { auto priv = GARROW_MAP_ARRAY_BUILDER_GET_PRIVATE(builder); if (!priv->key_builder) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto arrow_key_builder = arrow_builder->key_builder(); priv->key_builder = garrow_array_builder_new_raw(arrow_key_builder); } @@ -6236,9 +6028,8 @@ garrow_map_array_builder_get_item_builder(GArrowMapArrayBuilder *builder) { auto priv = GARROW_MAP_ARRAY_BUILDER_GET_PRIVATE(builder); if (!priv->item_builder) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto arrow_item_builder = arrow_builder->item_builder(); priv->item_builder = garrow_array_builder_new_raw(arrow_item_builder); } @@ -6261,16 +6052,14 @@ garrow_map_array_builder_get_value_builder(GArrowMapArrayBuilder *builder) { auto priv = GARROW_MAP_ARRAY_BUILDER_GET_PRIVATE(builder); if (!priv->value_builder) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto arrow_value_builder = arrow_builder->value_builder(); priv->value_builder = garrow_array_builder_new_raw(arrow_value_builder); } return priv->value_builder; } - G_DEFINE_TYPE(GArrowDecimal128ArrayBuilder, garrow_decimal128_array_builder, GARROW_TYPE_FIXED_SIZE_BINARY_ARRAY_BUILDER) @@ -6297,9 +6086,8 @@ GArrowDecimal128ArrayBuilder * garrow_decimal128_array_builder_new(GArrowDecimal128DataType *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, - "[decimal128-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow_data_type, NULL, "[decimal128-array-builder][new]"); return GARROW_DECIMAL128_ARRAY_BUILDER(builder); } @@ -6341,14 +6129,13 @@ garrow_decimal128_array_builder_append_value(GArrowDecimal128ArrayBuilder *build { if (value) { auto arrow_decimal = garrow_decimal128_get_raw(value); - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - *arrow_decimal, - error, - "[decimal128-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + *arrow_decimal, + error, + "[decimal128-array-builder][append-value]"); } else { - return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), - error); + return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } } @@ -6372,13 +6159,12 @@ garrow_decimal128_array_builder_append_value(GArrowDecimal128ArrayBuilder *build * Since: 3.0.0 */ gboolean -garrow_decimal128_array_builder_append_values( - GArrowDecimal128ArrayBuilder *builder, - GArrowDecimal128 **values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error) +garrow_decimal128_array_builder_append_values(GArrowDecimal128ArrayBuilder *builder, + GArrowDecimal128 **values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error) { return garrow_array_builder_append_values( GARROW_ARRAY_BUILDER(builder), @@ -6415,7 +6201,6 @@ garrow_decimal128_array_builder_append_null(GArrowDecimal128ArrayBuilder *builde return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } - G_DEFINE_TYPE(GArrowDecimal256ArrayBuilder, garrow_decimal256_array_builder, GARROW_TYPE_FIXED_SIZE_BINARY_ARRAY_BUILDER) @@ -6442,9 +6227,8 @@ GArrowDecimal256ArrayBuilder * garrow_decimal256_array_builder_new(GArrowDecimal256DataType *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, - "[decimal256-array-builder][new]"); + auto builder = + garrow_array_builder_new(arrow_data_type, NULL, "[decimal256-array-builder][new]"); return GARROW_DECIMAL256_ARRAY_BUILDER(builder); } @@ -6465,14 +6249,13 @@ garrow_decimal256_array_builder_append_value(GArrowDecimal256ArrayBuilder *build { if (value) { auto arrow_decimal = garrow_decimal256_get_raw(value); - return garrow_array_builder_append_value - (GARROW_ARRAY_BUILDER(builder), - *arrow_decimal, - error, - "[decimal256-array-builder][append-value]"); + return garrow_array_builder_append_value( + GARROW_ARRAY_BUILDER(builder), + *arrow_decimal, + error, + "[decimal256-array-builder][append-value]"); } else { - return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), - error); + return garrow_array_builder_append_null(GARROW_ARRAY_BUILDER(builder), error); } } @@ -6496,13 +6279,12 @@ garrow_decimal256_array_builder_append_value(GArrowDecimal256ArrayBuilder *build * Since: 3.0.0 */ gboolean -garrow_decimal256_array_builder_append_values( - GArrowDecimal256ArrayBuilder *builder, - GArrowDecimal256 **values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error) +garrow_decimal256_array_builder_append_values(GArrowDecimal256ArrayBuilder *builder, + GArrowDecimal256 **values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error) { return garrow_array_builder_append_values( GARROW_ARRAY_BUILDER(builder), @@ -6518,7 +6300,6 @@ garrow_decimal256_array_builder_append_values( }); } - G_DEFINE_ABSTRACT_TYPE(GArrowUnionArrayBuilder, garrow_union_array_builder, GARROW_TYPE_ARRAY_BUILDER) @@ -6548,9 +6329,8 @@ garrow_union_array_builder_append_child(GArrowUnionArrayBuilder *builder, GArrowArrayBuilder *child, const gchar *field_name) { - auto arrow_builder = - std::static_pointer_cast( - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); + auto arrow_builder = std::static_pointer_cast( + garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder))); auto arrow_child = garrow_array_builder_get_raw(child); if (!field_name) { field_name = ""; @@ -6584,8 +6364,7 @@ garrow_union_array_builder_append_value(GArrowUnionArrayBuilder *builder, gint8 value, GError **error) { - auto arrow_builder = - garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)); + auto arrow_builder = garrow_array_builder_get_raw(GARROW_ARRAY_BUILDER(builder)); arrow::Status status; if (GARROW_IS_DENSE_UNION_ARRAY_BUILDER(builder)) { auto arrow_union_builder = @@ -6596,12 +6375,9 @@ garrow_union_array_builder_append_value(GArrowUnionArrayBuilder *builder, std::static_pointer_cast(arrow_builder); status = arrow_union_builder->Append(value); } - return garrow_error_check(error, - status, - "[union-array-builder][append-value]"); + return garrow_error_check(error, status, "[union-array-builder][append-value]"); } - G_END_DECLS template GArrowArrayBuilder * @@ -6615,9 +6391,8 @@ garrow_union_array_builder_new(GArrowUnionDataType *data_type, return garrow_array_builder_new(arrow_data_type, error, context); } else { auto memory_pool = arrow::default_memory_pool(); - auto arrow_builder = - std::static_pointer_cast( - std::make_shared(memory_pool)); + auto arrow_builder = std::static_pointer_cast( + std::make_shared(memory_pool)); return garrow_array_builder_new_raw(&arrow_builder, builder_gtype); } } @@ -6651,22 +6426,19 @@ garrow_dense_union_array_builder_class_init(GArrowDenseUnionArrayBuilderClass *k * Since: 12.0.0 */ GArrowDenseUnionArrayBuilder * -garrow_dense_union_array_builder_new(GArrowDenseUnionDataType *data_type, - GError **error) +garrow_dense_union_array_builder_new(GArrowDenseUnionDataType *data_type, GError **error) { - auto builder = - garrow_union_array_builder_new( - GARROW_UNION_DATA_TYPE(data_type), - GARROW_TYPE_DENSE_UNION_ARRAY_BUILDER, - "[dense-union-array-builder][new]", - error); + auto builder = garrow_union_array_builder_new( + GARROW_UNION_DATA_TYPE(data_type), + GARROW_TYPE_DENSE_UNION_ARRAY_BUILDER, + "[dense-union-array-builder][new]", + error); if (!builder) { return nullptr; } return GARROW_DENSE_UNION_ARRAY_BUILDER(builder); } - G_DEFINE_TYPE(GArrowSparseUnionArrayBuilder, garrow_sparse_union_array_builder, GARROW_TYPE_UNION_ARRAY_BUILDER) @@ -6696,21 +6468,19 @@ garrow_sparse_union_array_builder_class_init(GArrowSparseUnionArrayBuilderClass */ GArrowSparseUnionArrayBuilder * garrow_sparse_union_array_builder_new(GArrowSparseUnionDataType *data_type, - GError **error) + GError **error) { - auto builder = - garrow_union_array_builder_new( - GARROW_UNION_DATA_TYPE(data_type), - GARROW_TYPE_SPARSE_UNION_ARRAY_BUILDER, - "[sparse-union-array-builder][new]", - error); + auto builder = garrow_union_array_builder_new( + GARROW_UNION_DATA_TYPE(data_type), + GARROW_TYPE_SPARSE_UNION_ARRAY_BUILDER, + "[sparse-union-array-builder][new]", + error); if (!builder) { return nullptr; } return GARROW_SPARSE_UNION_ARRAY_BUILDER(builder); } - G_END_DECLS GArrowArrayBuilder * @@ -6818,18 +6588,17 @@ garrow_array_builder_new_raw(std::shared_ptr *arrow_builder case arrow::Type::type::DICTIONARY: { auto dict_type = - std::static_pointer_cast( - (*arrow_builder)->type()); + std::static_pointer_cast((*arrow_builder)->type()); switch (dict_type->value_type()->id()) { - case arrow::Type::type::BINARY: - type = GARROW_TYPE_BINARY_DICTIONARY_ARRAY_BUILDER; - break; - case arrow::Type::type::STRING: - type = GARROW_TYPE_STRING_DICTIONARY_ARRAY_BUILDER; - break; - default: - type = GARROW_TYPE_ARRAY_BUILDER; - break; + case arrow::Type::type::BINARY: + type = GARROW_TYPE_BINARY_DICTIONARY_ARRAY_BUILDER; + break; + case arrow::Type::type::STRING: + type = GARROW_TYPE_STRING_DICTIONARY_ARRAY_BUILDER; + break; + default: + type = GARROW_TYPE_ARRAY_BUILDER; + break; } } break; @@ -6846,18 +6615,18 @@ garrow_array_builder_new_raw(std::shared_ptr *arrow_builder } auto builder = - GARROW_ARRAY_BUILDER(g_object_new(type, - "array-builder", arrow_builder, - NULL)); + GARROW_ARRAY_BUILDER(g_object_new(type, "array-builder", arrow_builder, NULL)); return builder; } GArrowArrayBuilder * -garrow_array_builder_new_raw(arrow::ArrayBuilder *arrow_builder, - GType type) +garrow_array_builder_new_raw(arrow::ArrayBuilder *arrow_builder, GType type) { - struct NothingDeleter { - void operator()(arrow::ArrayBuilder *arrow_builder) { + struct NothingDeleter + { + void + operator()(arrow::ArrayBuilder *arrow_builder) + { } }; std::shared_ptr arrow_shared_builder(arrow_builder, diff --git a/c_glib/arrow-glib/array-builder.h b/c_glib/arrow-glib/array-builder.h index 56b4cc71b6f89..8a1385b9b8c1b 100644 --- a/c_glib/arrow-glib/array-builder.h +++ b/c_glib/arrow-glib/array-builder.h @@ -26,11 +26,8 @@ G_BEGIN_DECLS #define GARROW_TYPE_ARRAY_BUILDER (garrow_array_builder_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowArrayBuilder, - garrow_array_builder, - GARROW, - ARRAY_BUILDER, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowArrayBuilder, garrow_array_builder, GARROW, ARRAY_BUILDER, GObject) struct _GArrowArrayBuilderClass { GObjectClass parent_class; @@ -38,51 +35,55 @@ struct _GArrowArrayBuilderClass GArrowDataType * garrow_array_builder_get_value_data_type(GArrowArrayBuilder *builder); -GArrowType garrow_array_builder_get_value_type(GArrowArrayBuilder *builder); +GArrowType +garrow_array_builder_get_value_type(GArrowArrayBuilder *builder); -GArrowArray *garrow_array_builder_finish(GArrowArrayBuilder *builder, - GError **error); +GArrowArray * +garrow_array_builder_finish(GArrowArrayBuilder *builder, GError **error); GARROW_AVAILABLE_IN_2_0 -void garrow_array_builder_reset(GArrowArrayBuilder *builder); +void +garrow_array_builder_reset(GArrowArrayBuilder *builder); GARROW_AVAILABLE_IN_2_0 -gint64 garrow_array_builder_get_capacity(GArrowArrayBuilder *builder); +gint64 +garrow_array_builder_get_capacity(GArrowArrayBuilder *builder); GARROW_AVAILABLE_IN_2_0 -gint64 garrow_array_builder_get_length(GArrowArrayBuilder *builder); +gint64 +garrow_array_builder_get_length(GArrowArrayBuilder *builder); GARROW_AVAILABLE_IN_2_0 -gint64 garrow_array_builder_get_n_nulls(GArrowArrayBuilder *builder); +gint64 +garrow_array_builder_get_n_nulls(GArrowArrayBuilder *builder); GARROW_AVAILABLE_IN_12_0 GArrowArrayBuilder * -garrow_array_builder_get_child(GArrowArrayBuilder *builder, - gint i); +garrow_array_builder_get_child(GArrowArrayBuilder *builder, gint i); GARROW_AVAILABLE_IN_12_0 GList * garrow_array_builder_get_children(GArrowArrayBuilder *builder); GARROW_AVAILABLE_IN_2_0 -gboolean garrow_array_builder_resize(GArrowArrayBuilder *builder, - gint64 capacity, - GError **error); +gboolean +garrow_array_builder_resize(GArrowArrayBuilder *builder, gint64 capacity, GError **error); GARROW_AVAILABLE_IN_2_0 -gboolean garrow_array_builder_reserve(GArrowArrayBuilder *builder, - gint64 additional_capacity, - GError **error); +gboolean +garrow_array_builder_reserve(GArrowArrayBuilder *builder, + gint64 additional_capacity, + GError **error); GARROW_AVAILABLE_IN_3_0 -gboolean garrow_array_builder_append_null(GArrowArrayBuilder *builder, - GError **error); +gboolean +garrow_array_builder_append_null(GArrowArrayBuilder *builder, GError **error); GARROW_AVAILABLE_IN_3_0 -gboolean garrow_array_builder_append_nulls(GArrowArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_array_builder_append_nulls(GArrowArrayBuilder *builder, gint64 n, GError **error); GARROW_AVAILABLE_IN_3_0 -gboolean garrow_array_builder_append_empty_value(GArrowArrayBuilder *builder, - GError **error); +gboolean +garrow_array_builder_append_empty_value(GArrowArrayBuilder *builder, GError **error); GARROW_AVAILABLE_IN_3_0 -gboolean garrow_array_builder_append_empty_values(GArrowArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_array_builder_append_empty_values(GArrowArrayBuilder *builder, + gint64 n, + GError **error); #define GARROW_TYPE_NULL_ARRAY_BUILDER (garrow_null_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowNullArrayBuilder, @@ -96,23 +97,23 @@ struct _GArrowNullArrayBuilderClass }; GARROW_AVAILABLE_IN_0_13 -GArrowNullArrayBuilder *garrow_null_array_builder_new(void); +GArrowNullArrayBuilder * +garrow_null_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) GARROW_AVAILABLE_IN_0_13 -gboolean garrow_null_array_builder_append_null(GArrowNullArrayBuilder *builder, - GError **error); +gboolean +garrow_null_array_builder_append_null(GArrowNullArrayBuilder *builder, GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) GARROW_AVAILABLE_IN_0_13 -gboolean garrow_null_array_builder_append_nulls(GArrowNullArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_null_array_builder_append_nulls(GArrowNullArrayBuilder *builder, + gint64 n, + GError **error); #endif - -#define GARROW_TYPE_BOOLEAN_ARRAY_BUILDER \ - (garrow_boolean_array_builder_get_type()) +#define GARROW_TYPE_BOOLEAN_ARRAY_BUILDER (garrow_boolean_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowBooleanArrayBuilder, garrow_boolean_array_builder, GARROW, @@ -123,35 +124,40 @@ struct _GArrowBooleanArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowBooleanArrayBuilder *garrow_boolean_array_builder_new(void); +GArrowBooleanArrayBuilder * +garrow_boolean_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_boolean_array_builder_append_value) -gboolean garrow_boolean_array_builder_append(GArrowBooleanArrayBuilder *builder, - gboolean value, - GError **error); +gboolean +garrow_boolean_array_builder_append(GArrowBooleanArrayBuilder *builder, + gboolean value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_boolean_array_builder_append_value(GArrowBooleanArrayBuilder *builder, - gboolean value, - GError **error); -gboolean garrow_boolean_array_builder_append_values(GArrowBooleanArrayBuilder *builder, - const gboolean *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_boolean_array_builder_append_value(GArrowBooleanArrayBuilder *builder, + gboolean value, + GError **error); +gboolean +garrow_boolean_array_builder_append_values(GArrowBooleanArrayBuilder *builder, + const gboolean *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_boolean_array_builder_append_null(GArrowBooleanArrayBuilder *builder, - GError **error); +gboolean +garrow_boolean_array_builder_append_null(GArrowBooleanArrayBuilder *builder, + GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_boolean_array_builder_append_nulls(GArrowBooleanArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_boolean_array_builder_append_nulls(GArrowBooleanArrayBuilder *builder, + gint64 n, + GError **error); #endif - #define GARROW_TYPE_INT_ARRAY_BUILDER (garrow_int_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowIntArrayBuilder, garrow_int_array_builder, @@ -163,35 +169,39 @@ struct _GArrowIntArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowIntArrayBuilder *garrow_int_array_builder_new(void); +GArrowIntArrayBuilder * +garrow_int_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_int_array_builder_append_value) -gboolean garrow_int_array_builder_append(GArrowIntArrayBuilder *builder, - gint64 value, - GError **error); +gboolean +garrow_int_array_builder_append(GArrowIntArrayBuilder *builder, + gint64 value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_int_array_builder_append_value(GArrowIntArrayBuilder *builder, - gint64 value, - GError **error); -gboolean garrow_int_array_builder_append_values(GArrowIntArrayBuilder *builder, - const gint64 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_int_array_builder_append_value(GArrowIntArrayBuilder *builder, + gint64 value, + GError **error); +gboolean +garrow_int_array_builder_append_values(GArrowIntArrayBuilder *builder, + const gint64 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_int_array_builder_append_null(GArrowIntArrayBuilder *builder, - GError **error); +gboolean +garrow_int_array_builder_append_null(GArrowIntArrayBuilder *builder, GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_int_array_builder_append_nulls(GArrowIntArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_int_array_builder_append_nulls(GArrowIntArrayBuilder *builder, + gint64 n, + GError **error); #endif - #define GARROW_TYPE_UINT_ARRAY_BUILDER (garrow_uint_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowUIntArrayBuilder, garrow_uint_array_builder, @@ -203,35 +213,39 @@ struct _GArrowUIntArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowUIntArrayBuilder *garrow_uint_array_builder_new(void); +GArrowUIntArrayBuilder * +garrow_uint_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_uint_array_builder_append_value) -gboolean garrow_uint_array_builder_append(GArrowUIntArrayBuilder *builder, - guint64 value, - GError **error); +gboolean +garrow_uint_array_builder_append(GArrowUIntArrayBuilder *builder, + guint64 value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_uint_array_builder_append_value(GArrowUIntArrayBuilder *builder, - guint64 value, - GError **error); -gboolean garrow_uint_array_builder_append_values(GArrowUIntArrayBuilder *builder, - const guint64 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_uint_array_builder_append_value(GArrowUIntArrayBuilder *builder, + guint64 value, + GError **error); +gboolean +garrow_uint_array_builder_append_values(GArrowUIntArrayBuilder *builder, + const guint64 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_uint_array_builder_append_null(GArrowUIntArrayBuilder *builder, - GError **error); +gboolean +garrow_uint_array_builder_append_null(GArrowUIntArrayBuilder *builder, GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_uint_array_builder_append_nulls(GArrowUIntArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_uint_array_builder_append_nulls(GArrowUIntArrayBuilder *builder, + gint64 n, + GError **error); #endif - #define GARROW_TYPE_INT8_ARRAY_BUILDER (garrow_int8_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowInt8ArrayBuilder, garrow_int8_array_builder, @@ -243,35 +257,39 @@ struct _GArrowInt8ArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowInt8ArrayBuilder *garrow_int8_array_builder_new(void); +GArrowInt8ArrayBuilder * +garrow_int8_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_int8_array_builder_append_value) -gboolean garrow_int8_array_builder_append(GArrowInt8ArrayBuilder *builder, - gint8 value, - GError **error); +gboolean +garrow_int8_array_builder_append(GArrowInt8ArrayBuilder *builder, + gint8 value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_int8_array_builder_append_value(GArrowInt8ArrayBuilder *builder, - gint8 value, - GError **error); -gboolean garrow_int8_array_builder_append_values(GArrowInt8ArrayBuilder *builder, - const gint8 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_int8_array_builder_append_value(GArrowInt8ArrayBuilder *builder, + gint8 value, + GError **error); +gboolean +garrow_int8_array_builder_append_values(GArrowInt8ArrayBuilder *builder, + const gint8 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_int8_array_builder_append_null(GArrowInt8ArrayBuilder *builder, - GError **error); +gboolean +garrow_int8_array_builder_append_null(GArrowInt8ArrayBuilder *builder, GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_int8_array_builder_append_nulls(GArrowInt8ArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_int8_array_builder_append_nulls(GArrowInt8ArrayBuilder *builder, + gint64 n, + GError **error); #endif - #define GARROW_TYPE_UINT8_ARRAY_BUILDER (garrow_uint8_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowUInt8ArrayBuilder, garrow_uint8_array_builder, @@ -283,35 +301,39 @@ struct _GArrowUInt8ArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowUInt8ArrayBuilder *garrow_uint8_array_builder_new(void); +GArrowUInt8ArrayBuilder * +garrow_uint8_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_uint8_array_builder_append_value) -gboolean garrow_uint8_array_builder_append(GArrowUInt8ArrayBuilder *builder, - guint8 value, - GError **error); +gboolean +garrow_uint8_array_builder_append(GArrowUInt8ArrayBuilder *builder, + guint8 value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_uint8_array_builder_append_value(GArrowUInt8ArrayBuilder *builder, - guint8 value, - GError **error); -gboolean garrow_uint8_array_builder_append_values(GArrowUInt8ArrayBuilder *builder, - const guint8 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_uint8_array_builder_append_value(GArrowUInt8ArrayBuilder *builder, + guint8 value, + GError **error); +gboolean +garrow_uint8_array_builder_append_values(GArrowUInt8ArrayBuilder *builder, + const guint8 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_uint8_array_builder_append_null(GArrowUInt8ArrayBuilder *builder, - GError **error); +gboolean +garrow_uint8_array_builder_append_null(GArrowUInt8ArrayBuilder *builder, GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_uint8_array_builder_append_nulls(GArrowUInt8ArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_uint8_array_builder_append_nulls(GArrowUInt8ArrayBuilder *builder, + gint64 n, + GError **error); #endif - #define GARROW_TYPE_INT16_ARRAY_BUILDER (garrow_int16_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowInt16ArrayBuilder, garrow_int16_array_builder, @@ -323,37 +345,40 @@ struct _GArrowInt16ArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowInt16ArrayBuilder *garrow_int16_array_builder_new(void); +GArrowInt16ArrayBuilder * +garrow_int16_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_int16_array_builder_append_value) -gboolean garrow_int16_array_builder_append(GArrowInt16ArrayBuilder *builder, - gint16 value, - GError **error); +gboolean +garrow_int16_array_builder_append(GArrowInt16ArrayBuilder *builder, + gint16 value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_int16_array_builder_append_value(GArrowInt16ArrayBuilder *builder, - gint16 value, - GError **error); -gboolean garrow_int16_array_builder_append_values(GArrowInt16ArrayBuilder *builder, - const gint16 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_int16_array_builder_append_value(GArrowInt16ArrayBuilder *builder, + gint16 value, + GError **error); +gboolean +garrow_int16_array_builder_append_values(GArrowInt16ArrayBuilder *builder, + const gint16 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_int16_array_builder_append_null(GArrowInt16ArrayBuilder *builder, - GError **error); +gboolean +garrow_int16_array_builder_append_null(GArrowInt16ArrayBuilder *builder, GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_int16_array_builder_append_nulls(GArrowInt16ArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_int16_array_builder_append_nulls(GArrowInt16ArrayBuilder *builder, + gint64 n, + GError **error); #endif - -#define GARROW_TYPE_UINT16_ARRAY_BUILDER \ - (garrow_uint16_array_builder_get_type()) +#define GARROW_TYPE_UINT16_ARRAY_BUILDER (garrow_uint16_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowUInt16ArrayBuilder, garrow_uint16_array_builder, GARROW, @@ -364,35 +389,40 @@ struct _GArrowUInt16ArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowUInt16ArrayBuilder *garrow_uint16_array_builder_new(void); +GArrowUInt16ArrayBuilder * +garrow_uint16_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_uint16_array_builder_append_value) -gboolean garrow_uint16_array_builder_append(GArrowUInt16ArrayBuilder *builder, - guint16 value, - GError **error); +gboolean +garrow_uint16_array_builder_append(GArrowUInt16ArrayBuilder *builder, + guint16 value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_uint16_array_builder_append_value(GArrowUInt16ArrayBuilder *builder, - guint16 value, - GError **error); -gboolean garrow_uint16_array_builder_append_values(GArrowUInt16ArrayBuilder *builder, - const guint16 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_uint16_array_builder_append_value(GArrowUInt16ArrayBuilder *builder, + guint16 value, + GError **error); +gboolean +garrow_uint16_array_builder_append_values(GArrowUInt16ArrayBuilder *builder, + const guint16 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_uint16_array_builder_append_null(GArrowUInt16ArrayBuilder *builder, - GError **error); +gboolean +garrow_uint16_array_builder_append_null(GArrowUInt16ArrayBuilder *builder, + GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_uint16_array_builder_append_nulls(GArrowUInt16ArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_uint16_array_builder_append_nulls(GArrowUInt16ArrayBuilder *builder, + gint64 n, + GError **error); #endif - #define GARROW_TYPE_INT32_ARRAY_BUILDER (garrow_int32_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowInt32ArrayBuilder, garrow_int32_array_builder, @@ -404,37 +434,40 @@ struct _GArrowInt32ArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowInt32ArrayBuilder *garrow_int32_array_builder_new(void); +GArrowInt32ArrayBuilder * +garrow_int32_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_int32_array_builder_append_value) -gboolean garrow_int32_array_builder_append(GArrowInt32ArrayBuilder *builder, - gint32 value, - GError **error); +gboolean +garrow_int32_array_builder_append(GArrowInt32ArrayBuilder *builder, + gint32 value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_int32_array_builder_append_value(GArrowInt32ArrayBuilder *builder, - gint32 value, - GError **error); -gboolean garrow_int32_array_builder_append_values(GArrowInt32ArrayBuilder *builder, - const gint32 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_int32_array_builder_append_value(GArrowInt32ArrayBuilder *builder, + gint32 value, + GError **error); +gboolean +garrow_int32_array_builder_append_values(GArrowInt32ArrayBuilder *builder, + const gint32 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_int32_array_builder_append_null(GArrowInt32ArrayBuilder *builder, - GError **error); +gboolean +garrow_int32_array_builder_append_null(GArrowInt32ArrayBuilder *builder, GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_int32_array_builder_append_nulls(GArrowInt32ArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_int32_array_builder_append_nulls(GArrowInt32ArrayBuilder *builder, + gint64 n, + GError **error); #endif - -#define GARROW_TYPE_UINT32_ARRAY_BUILDER \ - (garrow_uint32_array_builder_get_type()) +#define GARROW_TYPE_UINT32_ARRAY_BUILDER (garrow_uint32_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowUInt32ArrayBuilder, garrow_uint32_array_builder, GARROW, @@ -445,35 +478,40 @@ struct _GArrowUInt32ArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowUInt32ArrayBuilder *garrow_uint32_array_builder_new(void); +GArrowUInt32ArrayBuilder * +garrow_uint32_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_uint32_array_builder_append_value) -gboolean garrow_uint32_array_builder_append(GArrowUInt32ArrayBuilder *builder, - guint32 value, - GError **error); +gboolean +garrow_uint32_array_builder_append(GArrowUInt32ArrayBuilder *builder, + guint32 value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_uint32_array_builder_append_value(GArrowUInt32ArrayBuilder *builder, - guint32 value, - GError **error); -gboolean garrow_uint32_array_builder_append_values(GArrowUInt32ArrayBuilder *builder, - const guint32 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_uint32_array_builder_append_value(GArrowUInt32ArrayBuilder *builder, + guint32 value, + GError **error); +gboolean +garrow_uint32_array_builder_append_values(GArrowUInt32ArrayBuilder *builder, + const guint32 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_uint32_array_builder_append_null(GArrowUInt32ArrayBuilder *builder, - GError **error); +gboolean +garrow_uint32_array_builder_append_null(GArrowUInt32ArrayBuilder *builder, + GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_uint32_array_builder_append_nulls(GArrowUInt32ArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_uint32_array_builder_append_nulls(GArrowUInt32ArrayBuilder *builder, + gint64 n, + GError **error); #endif - #define GARROW_TYPE_INT64_ARRAY_BUILDER (garrow_int64_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowInt64ArrayBuilder, garrow_int64_array_builder, @@ -485,37 +523,40 @@ struct _GArrowInt64ArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowInt64ArrayBuilder *garrow_int64_array_builder_new(void); +GArrowInt64ArrayBuilder * +garrow_int64_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_int64_array_builder_append_value) -gboolean garrow_int64_array_builder_append(GArrowInt64ArrayBuilder *builder, - gint64 value, - GError **error); +gboolean +garrow_int64_array_builder_append(GArrowInt64ArrayBuilder *builder, + gint64 value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_int64_array_builder_append_value(GArrowInt64ArrayBuilder *builder, - gint64 value, - GError **error); -gboolean garrow_int64_array_builder_append_values(GArrowInt64ArrayBuilder *builder, - const gint64 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_int64_array_builder_append_value(GArrowInt64ArrayBuilder *builder, + gint64 value, + GError **error); +gboolean +garrow_int64_array_builder_append_values(GArrowInt64ArrayBuilder *builder, + const gint64 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_int64_array_builder_append_null(GArrowInt64ArrayBuilder *builder, - GError **error); +gboolean +garrow_int64_array_builder_append_null(GArrowInt64ArrayBuilder *builder, GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_int64_array_builder_append_nulls(GArrowInt64ArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_int64_array_builder_append_nulls(GArrowInt64ArrayBuilder *builder, + gint64 n, + GError **error); #endif - -#define GARROW_TYPE_UINT64_ARRAY_BUILDER \ - (garrow_uint64_array_builder_get_type()) +#define GARROW_TYPE_UINT64_ARRAY_BUILDER (garrow_uint64_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowUInt64ArrayBuilder, garrow_uint64_array_builder, GARROW, @@ -526,37 +567,41 @@ struct _GArrowUInt64ArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowUInt64ArrayBuilder *garrow_uint64_array_builder_new(void); +GArrowUInt64ArrayBuilder * +garrow_uint64_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_uint64_array_builder_append_value) -gboolean garrow_uint64_array_builder_append(GArrowUInt64ArrayBuilder *builder, - guint64 value, - GError **error); +gboolean +garrow_uint64_array_builder_append(GArrowUInt64ArrayBuilder *builder, + guint64 value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_uint64_array_builder_append_value(GArrowUInt64ArrayBuilder *builder, - guint64 value, - GError **error); -gboolean garrow_uint64_array_builder_append_values(GArrowUInt64ArrayBuilder *builder, - const guint64 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_uint64_array_builder_append_value(GArrowUInt64ArrayBuilder *builder, + guint64 value, + GError **error); +gboolean +garrow_uint64_array_builder_append_values(GArrowUInt64ArrayBuilder *builder, + const guint64 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_uint64_array_builder_append_null(GArrowUInt64ArrayBuilder *builder, - GError **error); +gboolean +garrow_uint64_array_builder_append_null(GArrowUInt64ArrayBuilder *builder, + GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_uint64_array_builder_append_nulls(GArrowUInt64ArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_uint64_array_builder_append_nulls(GArrowUInt64ArrayBuilder *builder, + gint64 n, + GError **error); #endif - -#define GARROW_TYPE_HALF_FLOAT_ARRAY_BUILDER \ - (garrow_half_float_array_builder_get_type()) +#define GARROW_TYPE_HALF_FLOAT_ARRAY_BUILDER (garrow_half_float_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowHalfFloatArrayBuilder, garrow_half_float_array_builder, GARROW, @@ -573,19 +618,17 @@ garrow_half_float_array_builder_new(void); GARROW_AVAILABLE_IN_11_0 gboolean -garrow_half_float_array_builder_append_value( - GArrowHalfFloatArrayBuilder *builder, - guint16 value, - GError **error); +garrow_half_float_array_builder_append_value(GArrowHalfFloatArrayBuilder *builder, + guint16 value, + GError **error); GARROW_AVAILABLE_IN_11_0 -gboolean garrow_half_float_array_builder_append_values( - GArrowHalfFloatArrayBuilder *builder, - const guint16 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); - +gboolean +garrow_half_float_array_builder_append_values(GArrowHalfFloatArrayBuilder *builder, + const guint16 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #define GARROW_TYPE_FLOAT_ARRAY_BUILDER (garrow_float_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowFloatArrayBuilder, @@ -598,37 +641,40 @@ struct _GArrowFloatArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowFloatArrayBuilder *garrow_float_array_builder_new(void); +GArrowFloatArrayBuilder * +garrow_float_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_float_array_builder_append_value) -gboolean garrow_float_array_builder_append(GArrowFloatArrayBuilder *builder, - gfloat value, - GError **error); +gboolean +garrow_float_array_builder_append(GArrowFloatArrayBuilder *builder, + gfloat value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_float_array_builder_append_value(GArrowFloatArrayBuilder *builder, - gfloat value, - GError **error); -gboolean garrow_float_array_builder_append_values(GArrowFloatArrayBuilder *builder, - const gfloat *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_float_array_builder_append_value(GArrowFloatArrayBuilder *builder, + gfloat value, + GError **error); +gboolean +garrow_float_array_builder_append_values(GArrowFloatArrayBuilder *builder, + const gfloat *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_float_array_builder_append_null(GArrowFloatArrayBuilder *builder, - GError **error); +gboolean +garrow_float_array_builder_append_null(GArrowFloatArrayBuilder *builder, GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_float_array_builder_append_nulls(GArrowFloatArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_float_array_builder_append_nulls(GArrowFloatArrayBuilder *builder, + gint64 n, + GError **error); #endif - -#define GARROW_TYPE_DOUBLE_ARRAY_BUILDER \ - (garrow_double_array_builder_get_type()) +#define GARROW_TYPE_DOUBLE_ARRAY_BUILDER (garrow_double_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDoubleArrayBuilder, garrow_double_array_builder, GARROW, @@ -639,37 +685,41 @@ struct _GArrowDoubleArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowDoubleArrayBuilder *garrow_double_array_builder_new(void); +GArrowDoubleArrayBuilder * +garrow_double_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_double_array_builder_append_value) -gboolean garrow_double_array_builder_append(GArrowDoubleArrayBuilder *builder, - gdouble value, - GError **error); +gboolean +garrow_double_array_builder_append(GArrowDoubleArrayBuilder *builder, + gdouble value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_double_array_builder_append_value(GArrowDoubleArrayBuilder *builder, - gdouble value, - GError **error); -gboolean garrow_double_array_builder_append_values(GArrowDoubleArrayBuilder *builder, - const gdouble *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_double_array_builder_append_value(GArrowDoubleArrayBuilder *builder, + gdouble value, + GError **error); +gboolean +garrow_double_array_builder_append_values(GArrowDoubleArrayBuilder *builder, + const gdouble *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_double_array_builder_append_null(GArrowDoubleArrayBuilder *builder, - GError **error); +gboolean +garrow_double_array_builder_append_null(GArrowDoubleArrayBuilder *builder, + GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_double_array_builder_append_nulls(GArrowDoubleArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_double_array_builder_append_nulls(GArrowDoubleArrayBuilder *builder, + gint64 n, + GError **error); #endif - -#define GARROW_TYPE_BINARY_ARRAY_BUILDER \ - (garrow_binary_array_builder_get_type()) +#define GARROW_TYPE_BINARY_ARRAY_BUILDER (garrow_binary_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowBinaryArrayBuilder, garrow_binary_array_builder, GARROW, @@ -680,44 +730,50 @@ struct _GArrowBinaryArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowBinaryArrayBuilder *garrow_binary_array_builder_new(void); +GArrowBinaryArrayBuilder * +garrow_binary_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_binary_array_builder_append_value) -gboolean garrow_binary_array_builder_append(GArrowBinaryArrayBuilder *builder, - const guint8 *value, - gint32 length, - GError **error); +gboolean +garrow_binary_array_builder_append(GArrowBinaryArrayBuilder *builder, + const guint8 *value, + gint32 length, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_binary_array_builder_append_value(GArrowBinaryArrayBuilder *builder, - const guint8 *value, - gint32 length, - GError **error); +gboolean +garrow_binary_array_builder_append_value(GArrowBinaryArrayBuilder *builder, + const guint8 *value, + gint32 length, + GError **error); GARROW_AVAILABLE_IN_0_16 -gboolean garrow_binary_array_builder_append_value_bytes(GArrowBinaryArrayBuilder *builder, - GBytes *value, - GError **error); +gboolean +garrow_binary_array_builder_append_value_bytes(GArrowBinaryArrayBuilder *builder, + GBytes *value, + GError **error); GARROW_AVAILABLE_IN_0_16 -gboolean garrow_binary_array_builder_append_values(GArrowBinaryArrayBuilder *builder, - GBytes **values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_binary_array_builder_append_values(GArrowBinaryArrayBuilder *builder, + GBytes **values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_binary_array_builder_append_null(GArrowBinaryArrayBuilder *builder, - GError **error); +gboolean +garrow_binary_array_builder_append_null(GArrowBinaryArrayBuilder *builder, + GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) GARROW_AVAILABLE_IN_0_16 -gboolean garrow_binary_array_builder_append_nulls(GArrowBinaryArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_binary_array_builder_append_nulls(GArrowBinaryArrayBuilder *builder, + gint64 n, + GError **error); #endif - -#define GARROW_TYPE_LARGE_BINARY_ARRAY_BUILDER \ +#define GARROW_TYPE_LARGE_BINARY_ARRAY_BUILDER \ (garrow_large_binary_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowLargeBinaryArrayBuilder, garrow_large_binary_array_builder, @@ -730,38 +786,41 @@ struct _GArrowLargeBinaryArrayBuilderClass }; GARROW_AVAILABLE_IN_0_16 -GArrowLargeBinaryArrayBuilder *garrow_large_binary_array_builder_new(void); +GArrowLargeBinaryArrayBuilder * +garrow_large_binary_array_builder_new(void); GARROW_AVAILABLE_IN_0_16 -gboolean garrow_large_binary_array_builder_append_value(GArrowLargeBinaryArrayBuilder *builder, - const guint8 *value, - gint64 length, - GError **error); +gboolean +garrow_large_binary_array_builder_append_value(GArrowLargeBinaryArrayBuilder *builder, + const guint8 *value, + gint64 length, + GError **error); GARROW_AVAILABLE_IN_0_16 -gboolean garrow_large_binary_array_builder_append_value_bytes(GArrowLargeBinaryArrayBuilder *builder, - GBytes *value, - GError **error); +gboolean +garrow_large_binary_array_builder_append_value_bytes( + GArrowLargeBinaryArrayBuilder *builder, GBytes *value, GError **error); GARROW_AVAILABLE_IN_0_16 -gboolean garrow_large_binary_array_builder_append_values(GArrowLargeBinaryArrayBuilder *builder, - GBytes **values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_large_binary_array_builder_append_values(GArrowLargeBinaryArrayBuilder *builder, + GBytes **values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) GARROW_AVAILABLE_IN_0_16 -gboolean garrow_large_binary_array_builder_append_null(GArrowLargeBinaryArrayBuilder *builder, - GError **error); +gboolean +garrow_large_binary_array_builder_append_null(GArrowLargeBinaryArrayBuilder *builder, + GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) GARROW_AVAILABLE_IN_0_16 -gboolean garrow_large_binary_array_builder_append_nulls(GArrowLargeBinaryArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_large_binary_array_builder_append_nulls(GArrowLargeBinaryArrayBuilder *builder, + gint64 n, + GError **error); #endif - -#define GARROW_TYPE_STRING_ARRAY_BUILDER \ - (garrow_string_array_builder_get_type()) +#define GARROW_TYPE_STRING_ARRAY_BUILDER (garrow_string_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowStringArrayBuilder, garrow_string_array_builder, GARROW, @@ -772,25 +831,29 @@ struct _GArrowStringArrayBuilderClass GArrowBinaryArrayBuilderClass parent_class; }; -GArrowStringArrayBuilder *garrow_string_array_builder_new(void); +GArrowStringArrayBuilder * +garrow_string_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_string_array_builder_append_value) -gboolean garrow_string_array_builder_append(GArrowStringArrayBuilder *builder, - const gchar *value, - GError **error); +gboolean +garrow_string_array_builder_append(GArrowStringArrayBuilder *builder, + const gchar *value, + GError **error); #endif #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_16_FOR(garrow_string_array_builder_append_string) GARROW_AVAILABLE_IN_0_12 -gboolean garrow_string_array_builder_append_value(GArrowStringArrayBuilder *builder, - const gchar *value, - GError **error); +gboolean +garrow_string_array_builder_append_value(GArrowStringArrayBuilder *builder, + const gchar *value, + GError **error); #endif GARROW_AVAILABLE_IN_0_16 -gboolean garrow_string_array_builder_append_string(GArrowStringArrayBuilder *builder, - const gchar *value, - GError **error); +gboolean +garrow_string_array_builder_append_string(GArrowStringArrayBuilder *builder, + const gchar *value, + GError **error); GARROW_AVAILABLE_IN_8_0 gboolean @@ -801,23 +864,24 @@ garrow_string_array_builder_append_string_len(GArrowStringArrayBuilder *builder, #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_16_FOR(garrow_string_array_builder_append_strings) -gboolean garrow_string_array_builder_append_values(GArrowStringArrayBuilder *builder, - const gchar **values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_string_array_builder_append_values(GArrowStringArrayBuilder *builder, + const gchar **values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #endif GARROW_AVAILABLE_IN_0_16 -gboolean garrow_string_array_builder_append_strings(GArrowStringArrayBuilder *builder, - const gchar **values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); - +gboolean +garrow_string_array_builder_append_strings(GArrowStringArrayBuilder *builder, + const gchar **values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); -#define GARROW_TYPE_LARGE_STRING_ARRAY_BUILDER \ +#define GARROW_TYPE_LARGE_STRING_ARRAY_BUILDER \ (garrow_large_string_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowLargeStringArrayBuilder, garrow_large_string_array_builder, @@ -830,27 +894,30 @@ struct _GArrowLargeStringArrayBuilderClass }; GARROW_AVAILABLE_IN_0_16 -GArrowLargeStringArrayBuilder *garrow_large_string_array_builder_new(void); +GArrowLargeStringArrayBuilder * +garrow_large_string_array_builder_new(void); GARROW_AVAILABLE_IN_0_16 -gboolean garrow_large_string_array_builder_append_string(GArrowLargeStringArrayBuilder *builder, - const gchar *value, - GError **error); +gboolean +garrow_large_string_array_builder_append_string(GArrowLargeStringArrayBuilder *builder, + const gchar *value, + GError **error); GARROW_AVAILABLE_IN_8_0 -gboolean garrow_large_string_array_builder_append_string_len( +gboolean +garrow_large_string_array_builder_append_string_len( GArrowLargeStringArrayBuilder *builder, const gchar *value, gint64 length, GError **error); GARROW_AVAILABLE_IN_0_16 -gboolean garrow_large_string_array_builder_append_strings(GArrowLargeStringArrayBuilder *builder, - const gchar **values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); - +gboolean +garrow_large_string_array_builder_append_strings(GArrowLargeStringArrayBuilder *builder, + const gchar **values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); -#define GARROW_TYPE_FIXED_SIZE_BINARY_ARRAY_BUILDER \ +#define GARROW_TYPE_FIXED_SIZE_BINARY_ARRAY_BUILDER \ (garrow_fixed_size_binary_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowFixedSizeBinaryArrayBuilder, garrow_fixed_size_binary_array_builder, @@ -864,8 +931,7 @@ struct _GArrowFixedSizeBinaryArrayBuilderClass GARROW_AVAILABLE_IN_3_0 GArrowFixedSizeBinaryArrayBuilder * -garrow_fixed_size_binary_array_builder_new( - GArrowFixedSizeBinaryDataType *data_type); +garrow_fixed_size_binary_array_builder_new(GArrowFixedSizeBinaryDataType *data_type); GARROW_AVAILABLE_IN_3_0 gboolean @@ -877,9 +943,7 @@ garrow_fixed_size_binary_array_builder_append_value( GARROW_AVAILABLE_IN_3_0 gboolean garrow_fixed_size_binary_array_builder_append_value_bytes( - GArrowFixedSizeBinaryArrayBuilder *builder, - GBytes *value, - GError **error); + GArrowFixedSizeBinaryArrayBuilder *builder, GBytes *value, GError **error); GARROW_AVAILABLE_IN_3_0 gboolean garrow_fixed_size_binary_array_builder_append_values( @@ -898,8 +962,7 @@ garrow_fixed_size_binary_array_builder_append_values_packed( gint64 is_valids_length, GError **error); -#define GARROW_TYPE_DATE32_ARRAY_BUILDER \ - (garrow_date32_array_builder_get_type()) +#define GARROW_TYPE_DATE32_ARRAY_BUILDER (garrow_date32_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDate32ArrayBuilder, garrow_date32_array_builder, GARROW, @@ -910,37 +973,41 @@ struct _GArrowDate32ArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowDate32ArrayBuilder *garrow_date32_array_builder_new(void); +GArrowDate32ArrayBuilder * +garrow_date32_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_date32_array_builder_append_value) -gboolean garrow_date32_array_builder_append(GArrowDate32ArrayBuilder *builder, - gint32 value, - GError **error); +gboolean +garrow_date32_array_builder_append(GArrowDate32ArrayBuilder *builder, + gint32 value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_date32_array_builder_append_value(GArrowDate32ArrayBuilder *builder, - gint32 value, - GError **error); -gboolean garrow_date32_array_builder_append_values(GArrowDate32ArrayBuilder *builder, - const gint32 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_date32_array_builder_append_value(GArrowDate32ArrayBuilder *builder, + gint32 value, + GError **error); +gboolean +garrow_date32_array_builder_append_values(GArrowDate32ArrayBuilder *builder, + const gint32 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_date32_array_builder_append_null(GArrowDate32ArrayBuilder *builder, - GError **error); +gboolean +garrow_date32_array_builder_append_null(GArrowDate32ArrayBuilder *builder, + GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_date32_array_builder_append_nulls(GArrowDate32ArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_date32_array_builder_append_nulls(GArrowDate32ArrayBuilder *builder, + gint64 n, + GError **error); #endif - -#define GARROW_TYPE_DATE64_ARRAY_BUILDER \ - (garrow_date64_array_builder_get_type()) +#define GARROW_TYPE_DATE64_ARRAY_BUILDER (garrow_date64_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDate64ArrayBuilder, garrow_date64_array_builder, GARROW, @@ -951,37 +1018,41 @@ struct _GArrowDate64ArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowDate64ArrayBuilder *garrow_date64_array_builder_new(void); +GArrowDate64ArrayBuilder * +garrow_date64_array_builder_new(void); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_date64_array_builder_append_value) -gboolean garrow_date64_array_builder_append(GArrowDate64ArrayBuilder *builder, - gint64 value, - GError **error); +gboolean +garrow_date64_array_builder_append(GArrowDate64ArrayBuilder *builder, + gint64 value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_date64_array_builder_append_value(GArrowDate64ArrayBuilder *builder, - gint64 value, - GError **error); -gboolean garrow_date64_array_builder_append_values(GArrowDate64ArrayBuilder *builder, - const gint64 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_date64_array_builder_append_value(GArrowDate64ArrayBuilder *builder, + gint64 value, + GError **error); +gboolean +garrow_date64_array_builder_append_values(GArrowDate64ArrayBuilder *builder, + const gint64 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_date64_array_builder_append_null(GArrowDate64ArrayBuilder *builder, - GError **error); +gboolean +garrow_date64_array_builder_append_null(GArrowDate64ArrayBuilder *builder, + GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_date64_array_builder_append_nulls(GArrowDate64ArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_date64_array_builder_append_nulls(GArrowDate64ArrayBuilder *builder, + gint64 n, + GError **error); #endif - -#define GARROW_TYPE_TIMESTAMP_ARRAY_BUILDER \ - (garrow_timestamp_array_builder_get_type()) +#define GARROW_TYPE_TIMESTAMP_ARRAY_BUILDER (garrow_timestamp_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowTimestampArrayBuilder, garrow_timestamp_array_builder, GARROW, @@ -997,33 +1068,36 @@ garrow_timestamp_array_builder_new(GArrowTimestampDataType *data_type); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_timestamp_array_builder_append_value) -gboolean garrow_timestamp_array_builder_append(GArrowTimestampArrayBuilder *builder, - gint64 value, - GError **error); +gboolean +garrow_timestamp_array_builder_append(GArrowTimestampArrayBuilder *builder, + gint64 value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_timestamp_array_builder_append_value(GArrowTimestampArrayBuilder *builder, - gint64 value, - GError **error); -gboolean garrow_timestamp_array_builder_append_values(GArrowTimestampArrayBuilder *builder, - const gint64 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_timestamp_array_builder_append_value(GArrowTimestampArrayBuilder *builder, + gint64 value, + GError **error); +gboolean +garrow_timestamp_array_builder_append_values(GArrowTimestampArrayBuilder *builder, + const gint64 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_timestamp_array_builder_append_null(GArrowTimestampArrayBuilder *builder, - GError **error); +gboolean +garrow_timestamp_array_builder_append_null(GArrowTimestampArrayBuilder *builder, + GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_timestamp_array_builder_append_nulls(GArrowTimestampArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_timestamp_array_builder_append_nulls(GArrowTimestampArrayBuilder *builder, + gint64 n, + GError **error); #endif - -#define GARROW_TYPE_TIME32_ARRAY_BUILDER \ - (garrow_time32_array_builder_get_type()) +#define GARROW_TYPE_TIME32_ARRAY_BUILDER (garrow_time32_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowTime32ArrayBuilder, garrow_time32_array_builder, GARROW, @@ -1034,37 +1108,41 @@ struct _GArrowTime32ArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowTime32ArrayBuilder *garrow_time32_array_builder_new(GArrowTime32DataType *data_type); +GArrowTime32ArrayBuilder * +garrow_time32_array_builder_new(GArrowTime32DataType *data_type); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_time32_array_builder_append_value) -gboolean garrow_time32_array_builder_append(GArrowTime32ArrayBuilder *builder, - gint32 value, - GError **error); +gboolean +garrow_time32_array_builder_append(GArrowTime32ArrayBuilder *builder, + gint32 value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_time32_array_builder_append_value(GArrowTime32ArrayBuilder *builder, - gint32 value, - GError **error); -gboolean garrow_time32_array_builder_append_values(GArrowTime32ArrayBuilder *builder, - const gint32 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_time32_array_builder_append_value(GArrowTime32ArrayBuilder *builder, + gint32 value, + GError **error); +gboolean +garrow_time32_array_builder_append_values(GArrowTime32ArrayBuilder *builder, + const gint32 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_time32_array_builder_append_null(GArrowTime32ArrayBuilder *builder, - GError **error); +gboolean +garrow_time32_array_builder_append_null(GArrowTime32ArrayBuilder *builder, + GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_time32_array_builder_append_nulls(GArrowTime32ArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_time32_array_builder_append_nulls(GArrowTime32ArrayBuilder *builder, + gint64 n, + GError **error); #endif - -#define GARROW_TYPE_TIME64_ARRAY_BUILDER \ - (garrow_time64_array_builder_get_type()) +#define GARROW_TYPE_TIME64_ARRAY_BUILDER (garrow_time64_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowTime64ArrayBuilder, garrow_time64_array_builder, GARROW, @@ -1075,36 +1153,41 @@ struct _GArrowTime64ArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowTime64ArrayBuilder *garrow_time64_array_builder_new(GArrowTime64DataType *data_type); +GArrowTime64ArrayBuilder * +garrow_time64_array_builder_new(GArrowTime64DataType *data_type); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_time64_array_builder_append_value) -gboolean garrow_time64_array_builder_append(GArrowTime64ArrayBuilder *builder, - gint64 value, - GError **error); +gboolean +garrow_time64_array_builder_append(GArrowTime64ArrayBuilder *builder, + gint64 value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_time64_array_builder_append_value(GArrowTime64ArrayBuilder *builder, - gint64 value, - GError **error); -gboolean garrow_time64_array_builder_append_values(GArrowTime64ArrayBuilder *builder, - const gint64 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +gboolean +garrow_time64_array_builder_append_value(GArrowTime64ArrayBuilder *builder, + gint64 value, + GError **error); +gboolean +garrow_time64_array_builder_append_values(GArrowTime64ArrayBuilder *builder, + const gint64 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_time64_array_builder_append_null(GArrowTime64ArrayBuilder *builder, - GError **error); +gboolean +garrow_time64_array_builder_append_null(GArrowTime64ArrayBuilder *builder, + GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) -gboolean garrow_time64_array_builder_append_nulls(GArrowTime64ArrayBuilder *builder, - gint64 n, - GError **error); +gboolean +garrow_time64_array_builder_append_nulls(GArrowTime64ArrayBuilder *builder, + gint64 n, + GError **error); #endif - -#define GARROW_TYPE_MONTH_INTERVAL_ARRAY_BUILDER \ +#define GARROW_TYPE_MONTH_INTERVAL_ARRAY_BUILDER \ (garrow_month_interval_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowMonthIntervalArrayBuilder, garrow_month_interval_array_builder, @@ -1122,10 +1205,9 @@ garrow_month_interval_array_builder_new(void); GARROW_AVAILABLE_IN_8_0 gboolean -garrow_month_interval_array_builder_append_value( - GArrowMonthIntervalArrayBuilder *builder, - gint32 value, - GError **error); +garrow_month_interval_array_builder_append_value(GArrowMonthIntervalArrayBuilder *builder, + gint32 value, + GError **error); GARROW_AVAILABLE_IN_8_0 gboolean garrow_month_interval_array_builder_append_values( @@ -1136,8 +1218,7 @@ garrow_month_interval_array_builder_append_values( gint64 is_valids_length, GError **error); - -#define GARROW_TYPE_DAY_TIME_INTERVAL_ARRAY_BUILDER \ +#define GARROW_TYPE_DAY_TIME_INTERVAL_ARRAY_BUILDER \ (garrow_day_time_interval_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDayTimeIntervalArrayBuilder, garrow_day_time_interval_array_builder, @@ -1169,8 +1250,7 @@ garrow_day_time_interval_array_builder_append_values( gint64 is_valids_length, GError **error); - -#define GARROW_TYPE_MONTH_DAY_NANO_INTERVAL_ARRAY_BUILDER \ +#define GARROW_TYPE_MONTH_DAY_NANO_INTERVAL_ARRAY_BUILDER \ (garrow_month_day_nano_interval_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowMonthDayNanoIntervalArrayBuilder, garrow_month_day_nano_interval_array_builder, @@ -1202,8 +1282,8 @@ garrow_month_day_nano_interval_array_builder_append_values( gint64 is_valids_length, GError **error); - -#define GARROW_TYPE_BINARY_DICTIONARY_ARRAY_BUILDER (garrow_binary_dictionary_array_builder_get_type()) +#define GARROW_TYPE_BINARY_DICTIONARY_ARRAY_BUILDER \ + (garrow_binary_dictionary_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowBinaryDictionaryArrayBuilder, garrow_binary_dictionary_array_builder, GARROW, @@ -1221,53 +1301,55 @@ garrow_binary_dictionary_array_builder_new(void); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) GARROW_AVAILABLE_IN_2_0 gboolean -garrow_binary_dictionary_array_builder_append_null(GArrowBinaryDictionaryArrayBuilder *builder, - GError **error); +garrow_binary_dictionary_array_builder_append_null( + GArrowBinaryDictionaryArrayBuilder *builder, GError **error); #endif GARROW_AVAILABLE_IN_2_0 gboolean -garrow_binary_dictionary_array_builder_append_value(GArrowBinaryDictionaryArrayBuilder *builder, - const guint8 *value, - gint32 length, - GError **error); +garrow_binary_dictionary_array_builder_append_value( + GArrowBinaryDictionaryArrayBuilder *builder, + const guint8 *value, + gint32 length, + GError **error); GARROW_AVAILABLE_IN_2_0 gboolean -garrow_binary_dictionary_array_builder_append_value_bytes(GArrowBinaryDictionaryArrayBuilder *builder, - GBytes *value, - GError **error); +garrow_binary_dictionary_array_builder_append_value_bytes( + GArrowBinaryDictionaryArrayBuilder *builder, GBytes *value, GError **error); GARROW_AVAILABLE_IN_2_0 gboolean -garrow_binary_dictionary_array_builder_append_array(GArrowBinaryDictionaryArrayBuilder *builder, - GArrowBinaryArray *array, - GError **error); +garrow_binary_dictionary_array_builder_append_array( + GArrowBinaryDictionaryArrayBuilder *builder, GArrowBinaryArray *array, GError **error); GARROW_AVAILABLE_IN_2_0 gboolean -garrow_binary_dictionary_array_builder_append_indices(GArrowBinaryDictionaryArrayBuilder *builder, - const gint64 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +garrow_binary_dictionary_array_builder_append_indices( + GArrowBinaryDictionaryArrayBuilder *builder, + const gint64 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); GARROW_AVAILABLE_IN_2_0 gint64 -garrow_binary_dictionary_array_builder_get_dictionary_length(GArrowBinaryDictionaryArrayBuilder *builder); +garrow_binary_dictionary_array_builder_get_dictionary_length( + GArrowBinaryDictionaryArrayBuilder *builder); GARROW_AVAILABLE_IN_2_0 gboolean -garrow_binary_dictionary_array_builder_finish_delta(GArrowBinaryDictionaryArrayBuilder* builder, - GArrowArray **out_indices, - GArrowArray **out_delta, - GError **error); +garrow_binary_dictionary_array_builder_finish_delta( + GArrowBinaryDictionaryArrayBuilder *builder, + GArrowArray **out_indices, + GArrowArray **out_delta, + GError **error); GARROW_AVAILABLE_IN_2_0 gboolean -garrow_binary_dictionary_array_builder_insert_memo_values(GArrowBinaryDictionaryArrayBuilder *builder, - GArrowBinaryArray *values, - GError **error); +garrow_binary_dictionary_array_builder_insert_memo_values( + GArrowBinaryDictionaryArrayBuilder *builder, GArrowBinaryArray *values, GError **error); GARROW_AVAILABLE_IN_2_0 void -garrow_binary_dictionary_array_builder_reset_full(GArrowBinaryDictionaryArrayBuilder *builder); +garrow_binary_dictionary_array_builder_reset_full( + GArrowBinaryDictionaryArrayBuilder *builder); - -#define GARROW_TYPE_STRING_DICTIONARY_ARRAY_BUILDER (garrow_string_dictionary_array_builder_get_type()) +#define GARROW_TYPE_STRING_DICTIONARY_ARRAY_BUILDER \ + (garrow_string_dictionary_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowStringDictionaryArrayBuilder, garrow_string_dictionary_array_builder, GARROW, @@ -1285,45 +1367,45 @@ garrow_string_dictionary_array_builder_new(void); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) GARROW_AVAILABLE_IN_2_0 gboolean -garrow_string_dictionary_array_builder_append_null(GArrowStringDictionaryArrayBuilder *builder, - GError **error); +garrow_string_dictionary_array_builder_append_null( + GArrowStringDictionaryArrayBuilder *builder, GError **error); #endif GARROW_AVAILABLE_IN_2_0 gboolean -garrow_string_dictionary_array_builder_append_string(GArrowStringDictionaryArrayBuilder *builder, - const gchar *value, - GError **error); +garrow_string_dictionary_array_builder_append_string( + GArrowStringDictionaryArrayBuilder *builder, const gchar *value, GError **error); GARROW_AVAILABLE_IN_2_0 gboolean -garrow_string_dictionary_array_builder_append_array(GArrowStringDictionaryArrayBuilder *builder, - GArrowStringArray *array, - GError **error); +garrow_string_dictionary_array_builder_append_array( + GArrowStringDictionaryArrayBuilder *builder, GArrowStringArray *array, GError **error); GARROW_AVAILABLE_IN_2_0 gboolean -garrow_string_dictionary_array_builder_append_indices(GArrowStringDictionaryArrayBuilder *builder, - const gint64 *values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +garrow_string_dictionary_array_builder_append_indices( + GArrowStringDictionaryArrayBuilder *builder, + const gint64 *values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); GARROW_AVAILABLE_IN_2_0 gint64 -garrow_string_dictionary_array_builder_get_dictionary_length(GArrowStringDictionaryArrayBuilder *builder); +garrow_string_dictionary_array_builder_get_dictionary_length( + GArrowStringDictionaryArrayBuilder *builder); GARROW_AVAILABLE_IN_2_0 gboolean -garrow_string_dictionary_array_builder_finish_delta(GArrowStringDictionaryArrayBuilder* builder, - GArrowArray **out_indices, - GArrowArray **out_delta, - GError **error); +garrow_string_dictionary_array_builder_finish_delta( + GArrowStringDictionaryArrayBuilder *builder, + GArrowArray **out_indices, + GArrowArray **out_delta, + GError **error); GARROW_AVAILABLE_IN_2_0 gboolean -garrow_string_dictionary_array_builder_insert_memo_values(GArrowStringDictionaryArrayBuilder *builder, - GArrowStringArray *values, - GError **error); +garrow_string_dictionary_array_builder_insert_memo_values( + GArrowStringDictionaryArrayBuilder *builder, GArrowStringArray *values, GError **error); GARROW_AVAILABLE_IN_2_0 void -garrow_string_dictionary_array_builder_reset_full(GArrowStringDictionaryArrayBuilder *builder); - +garrow_string_dictionary_array_builder_reset_full( + GArrowStringDictionaryArrayBuilder *builder); #define GARROW_TYPE_LIST_ARRAY_BUILDER (garrow_list_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowListArrayBuilder, @@ -1336,25 +1418,25 @@ struct _GArrowListArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowListArrayBuilder *garrow_list_array_builder_new(GArrowListDataType *data_type, - GError **error); +GArrowListArrayBuilder * +garrow_list_array_builder_new(GArrowListDataType *data_type, GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_list_array_builder_append_value) -gboolean garrow_list_array_builder_append(GArrowListArrayBuilder *builder, - GError **error); +gboolean +garrow_list_array_builder_append(GArrowListArrayBuilder *builder, GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_list_array_builder_append_value(GArrowListArrayBuilder *builder, - GError **error); +gboolean +garrow_list_array_builder_append_value(GArrowListArrayBuilder *builder, GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_list_array_builder_append_null(GArrowListArrayBuilder *builder, - GError **error); +gboolean +garrow_list_array_builder_append_null(GArrowListArrayBuilder *builder, GError **error); #endif -GArrowArrayBuilder *garrow_list_array_builder_get_value_builder(GArrowListArrayBuilder *builder); - +GArrowArrayBuilder * +garrow_list_array_builder_get_value_builder(GArrowListArrayBuilder *builder); #define GARROW_TYPE_LARGE_LIST_ARRAY_BUILDER (garrow_large_list_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowLargeListArrayBuilder, @@ -1368,23 +1450,24 @@ struct _GArrowLargeListArrayBuilderClass }; GARROW_AVAILABLE_IN_0_16 -GArrowLargeListArrayBuilder *garrow_large_list_array_builder_new(GArrowLargeListDataType *data_type, - GError **error); +GArrowLargeListArrayBuilder * +garrow_large_list_array_builder_new(GArrowLargeListDataType *data_type, GError **error); GARROW_AVAILABLE_IN_0_16 -gboolean garrow_large_list_array_builder_append_value(GArrowLargeListArrayBuilder *builder, - GError **error); +gboolean +garrow_large_list_array_builder_append_value(GArrowLargeListArrayBuilder *builder, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) GARROW_AVAILABLE_IN_0_16 -gboolean garrow_large_list_array_builder_append_null(GArrowLargeListArrayBuilder *builder, - GError **error); +gboolean +garrow_large_list_array_builder_append_null(GArrowLargeListArrayBuilder *builder, + GError **error); #endif GARROW_AVAILABLE_IN_0_16 -GArrowArrayBuilder *garrow_large_list_array_builder_get_value_builder(GArrowLargeListArrayBuilder *builder); - +GArrowArrayBuilder * +garrow_large_list_array_builder_get_value_builder(GArrowLargeListArrayBuilder *builder); -#define GARROW_TYPE_STRUCT_ARRAY_BUILDER \ - (garrow_struct_array_builder_get_type()) +#define GARROW_TYPE_STRUCT_ARRAY_BUILDER (garrow_struct_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowStructArrayBuilder, garrow_struct_array_builder, GARROW, @@ -1395,36 +1478,35 @@ struct _GArrowStructArrayBuilderClass GArrowArrayBuilderClass parent_class; }; -GArrowStructArrayBuilder *garrow_struct_array_builder_new(GArrowStructDataType *data_type, - GError **error); +GArrowStructArrayBuilder * +garrow_struct_array_builder_new(GArrowStructDataType *data_type, GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_struct_array_builder_append_value) -gboolean garrow_struct_array_builder_append(GArrowStructArrayBuilder *builder, - GError **error); +gboolean +garrow_struct_array_builder_append(GArrowStructArrayBuilder *builder, GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_struct_array_builder_append_value(GArrowStructArrayBuilder *builder, - GError **error); +gboolean +garrow_struct_array_builder_append_value(GArrowStructArrayBuilder *builder, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) -gboolean garrow_struct_array_builder_append_null(GArrowStructArrayBuilder *builder, - GError **error); +gboolean +garrow_struct_array_builder_append_null(GArrowStructArrayBuilder *builder, + GError **error); #endif #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_12_0_FOR(garrow_array_builder_get_child) GArrowArrayBuilder * -garrow_struct_array_builder_get_field_builder(GArrowStructArrayBuilder *builder, - gint i); +garrow_struct_array_builder_get_field_builder(GArrowStructArrayBuilder *builder, gint i); GARROW_DEPRECATED_IN_12_0_FOR(garrow_array_builder_get_children) GList * garrow_struct_array_builder_get_field_builders(GArrowStructArrayBuilder *builder); #endif - -#define GARROW_TYPE_MAP_ARRAY_BUILDER \ - (garrow_map_array_builder_get_type()) +#define GARROW_TYPE_MAP_ARRAY_BUILDER (garrow_map_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowMapArrayBuilder, garrow_map_array_builder, GARROW, @@ -1436,12 +1518,11 @@ struct _GArrowMapArrayBuilderClass }; GARROW_AVAILABLE_IN_0_17 -GArrowMapArrayBuilder *garrow_map_array_builder_new(GArrowMapDataType *data_type, - GError **error); +GArrowMapArrayBuilder * +garrow_map_array_builder_new(GArrowMapDataType *data_type, GError **error); GARROW_AVAILABLE_IN_0_17 gboolean -garrow_map_array_builder_append_value(GArrowMapArrayBuilder *builder, - GError **error); +garrow_map_array_builder_append_value(GArrowMapArrayBuilder *builder, GError **error); GARROW_AVAILABLE_IN_0_17 gboolean garrow_map_array_builder_append_values(GArrowMapArrayBuilder *builder, @@ -1454,8 +1535,7 @@ garrow_map_array_builder_append_values(GArrowMapArrayBuilder *builder, GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) GARROW_AVAILABLE_IN_0_17 gboolean -garrow_map_array_builder_append_null(GArrowMapArrayBuilder *builder, - GError **error); +garrow_map_array_builder_append_null(GArrowMapArrayBuilder *builder, GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_nulls) GARROW_AVAILABLE_IN_0_17 gboolean @@ -1473,7 +1553,6 @@ GARROW_AVAILABLE_IN_0_17 GArrowArrayBuilder * garrow_map_array_builder_get_value_builder(GArrowMapArrayBuilder *builder); - #define GARROW_TYPE_DECIMAL128_ARRAY_BUILDER (garrow_decimal128_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDecimal128ArrayBuilder, garrow_decimal128_array_builder, @@ -1485,35 +1564,37 @@ struct _GArrowDecimal128ArrayBuilderClass GArrowFixedSizeBinaryArrayBuilderClass parent_class; }; -GArrowDecimal128ArrayBuilder *garrow_decimal128_array_builder_new(GArrowDecimal128DataType *data_type); +GArrowDecimal128ArrayBuilder * +garrow_decimal128_array_builder_new(GArrowDecimal128DataType *data_type); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_decimal128_array_builder_append_value) -gboolean garrow_decimal128_array_builder_append(GArrowDecimal128ArrayBuilder *builder, - GArrowDecimal128 *value, - GError **error); +gboolean +garrow_decimal128_array_builder_append(GArrowDecimal128ArrayBuilder *builder, + GArrowDecimal128 *value, + GError **error); #endif GARROW_AVAILABLE_IN_0_12 -gboolean garrow_decimal128_array_builder_append_value(GArrowDecimal128ArrayBuilder *builder, - GArrowDecimal128 *value, - GError **error); +gboolean +garrow_decimal128_array_builder_append_value(GArrowDecimal128ArrayBuilder *builder, + GArrowDecimal128 *value, + GError **error); GARROW_AVAILABLE_IN_3_0 gboolean -garrow_decimal128_array_builder_append_values( - GArrowDecimal128ArrayBuilder *builder, - GArrowDecimal128 **values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); +garrow_decimal128_array_builder_append_values(GArrowDecimal128ArrayBuilder *builder, + GArrowDecimal128 **values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_builder_append_null) GARROW_AVAILABLE_IN_0_12 -gboolean garrow_decimal128_array_builder_append_null(GArrowDecimal128ArrayBuilder *builder, - GError **error); +gboolean +garrow_decimal128_array_builder_append_null(GArrowDecimal128ArrayBuilder *builder, + GError **error); #endif - #define GARROW_TYPE_DECIMAL256_ARRAY_BUILDER (garrow_decimal256_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDecimal256ArrayBuilder, garrow_decimal256_array_builder, @@ -1525,25 +1606,24 @@ struct _GArrowDecimal256ArrayBuilderClass GArrowFixedSizeBinaryArrayBuilderClass parent_class; }; -GArrowDecimal256ArrayBuilder *garrow_decimal256_array_builder_new(GArrowDecimal256DataType *data_type); +GArrowDecimal256ArrayBuilder * +garrow_decimal256_array_builder_new(GArrowDecimal256DataType *data_type); GARROW_AVAILABLE_IN_3_0 -gboolean garrow_decimal256_array_builder_append_value(GArrowDecimal256ArrayBuilder *builder, - GArrowDecimal256 *value, - GError **error); +gboolean +garrow_decimal256_array_builder_append_value(GArrowDecimal256ArrayBuilder *builder, + GArrowDecimal256 *value, + GError **error); GARROW_AVAILABLE_IN_3_0 gboolean -garrow_decimal256_array_builder_append_values( - GArrowDecimal256ArrayBuilder *builder, - GArrowDecimal256 **values, - gint64 values_length, - const gboolean *is_valids, - gint64 is_valids_length, - GError **error); - +garrow_decimal256_array_builder_append_values(GArrowDecimal256ArrayBuilder *builder, + GArrowDecimal256 **values, + gint64 values_length, + const gboolean *is_valids, + gint64 is_valids_length, + GError **error); -#define GARROW_TYPE_UNION_ARRAY_BUILDER \ - (garrow_union_array_builder_get_type()) +#define GARROW_TYPE_UNION_ARRAY_BUILDER (garrow_union_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowUnionArrayBuilder, garrow_union_array_builder, GARROW, @@ -1566,8 +1646,7 @@ garrow_union_array_builder_append_value(GArrowUnionArrayBuilder *builder, gint8 value, GError **error); - -#define GARROW_TYPE_DENSE_UNION_ARRAY_BUILDER \ +#define GARROW_TYPE_DENSE_UNION_ARRAY_BUILDER \ (garrow_dense_union_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDenseUnionArrayBuilder, garrow_dense_union_array_builder, @@ -1581,11 +1660,9 @@ struct _GArrowDenseUnionArrayBuilderClass GARROW_AVAILABLE_IN_12_0 GArrowDenseUnionArrayBuilder * -garrow_dense_union_array_builder_new(GArrowDenseUnionDataType *data_type, - GError **error); - +garrow_dense_union_array_builder_new(GArrowDenseUnionDataType *data_type, GError **error); -#define GARROW_TYPE_SPARSE_UNION_ARRAY_BUILDER \ +#define GARROW_TYPE_SPARSE_UNION_ARRAY_BUILDER \ (garrow_sparse_union_array_builder_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowSparseUnionArrayBuilder, garrow_sparse_union_array_builder, @@ -1602,5 +1679,4 @@ GArrowSparseUnionArrayBuilder * garrow_sparse_union_array_builder_new(GArrowSparseUnionDataType *data_type, GError **error); - G_END_DECLS diff --git a/c_glib/arrow-glib/array-builder.hpp b/c_glib/arrow-glib/array-builder.hpp index 89b91ac5798a6..561099f1479ec 100644 --- a/c_glib/arrow-glib/array-builder.hpp +++ b/c_glib/arrow-glib/array-builder.hpp @@ -24,9 +24,9 @@ GArrowArrayBuilder * garrow_array_builder_new_raw(std::shared_ptr *arrow_builder, - GType type=G_TYPE_INVALID); + GType type = G_TYPE_INVALID); GArrowArrayBuilder * garrow_array_builder_new_raw(arrow::ArrayBuilder *arrow_builder, - GType type=G_TYPE_INVALID); + GType type = G_TYPE_INVALID); std::shared_ptr garrow_array_builder_get_raw(GArrowArrayBuilder *builder); diff --git a/c_glib/arrow-glib/basic-array-definition.h b/c_glib/arrow-glib/basic-array-definition.h index d504422b66689..803e63f58e4cf 100644 --- a/c_glib/arrow-glib/basic-array-definition.h +++ b/c_glib/arrow-glib/basic-array-definition.h @@ -24,22 +24,15 @@ G_BEGIN_DECLS #define GARROW_TYPE_ARRAY (garrow_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowArray, - garrow_array, - GARROW, - ARRAY, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowArray, garrow_array, GARROW, ARRAY, GObject) struct _GArrowArrayClass { GObjectClass parent_class; }; #define GARROW_TYPE_EXTENSION_ARRAY (garrow_extension_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowExtensionArray, - garrow_extension_array, - GARROW, - EXTENSION_ARRAY, - GArrowArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowExtensionArray, garrow_extension_array, GARROW, EXTENSION_ARRAY, GArrowArray) struct _GArrowExtensionArrayClass { GArrowArrayClass parent_class; diff --git a/c_glib/arrow-glib/basic-array.cpp b/c_glib/arrow-glib/basic-array.cpp index c0860662c0346..f102a252467a3 100644 --- a/c_glib/arrow-glib/basic-array.cpp +++ b/c_glib/arrow-glib/basic-array.cpp @@ -157,16 +157,16 @@ G_BEGIN_DECLS * you need to use #GArrowTime64ArrayBuilder to create a new array. * * #GArrowMonthIntervalArray is a class for the month intarval array. - * It can store zero or more date data. If you don't have Arrow format - * data, you need to use #GArrowMonthIntervalArrayBuilder to create a + * It can store zero or more date data. If you don't have Arrow format + * data, you need to use #GArrowMonthIntervalArrayBuilder to create a * new array. * * #GArrowDayTimeIntervalArray is a class for the day time intarval array. - * It can store zero or more date data. If you don't have Arrow format - * data, you need to use #GArrowDayTimeIntervalArrayBuilder to create a + * It can store zero or more date data. If you don't have Arrow format + * data, you need to use #GArrowDayTimeIntervalArrayBuilder to create a * new array. * - * #GArrowMonthDayNanoIntervalArray is a class for the month day nano + * #GArrowMonthDayNanoIntervalArray is a class for the month day nano * intarval array. It can store zero or more date data. If you don't * have Arrow format data, you need to use #GArrowMonthDayNanoIntervalArray * to create a new array. @@ -185,7 +185,8 @@ G_BEGIN_DECLS * extension types. */ -typedef struct GArrowEqualOptionsPrivate_ { +typedef struct GArrowEqualOptionsPrivate_ +{ gboolean approx; arrow::EqualOptions options; } GArrowEqualOptionsPrivate; @@ -196,14 +197,11 @@ enum { PROP_ABSOLUTE_TOLERANCE, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowEqualOptions, - garrow_equal_options, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowEqualOptions, garrow_equal_options, G_TYPE_OBJECT) -#define GARROW_EQUAL_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_equal_options_get_instance_private( \ - GARROW_EQUAL_OPTIONS(object))) +#define GARROW_EQUAL_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_equal_options_get_instance_private(GARROW_EQUAL_OPTIONS(object))) static void garrow_equal_options_finalize(GObject *object) @@ -266,7 +264,7 @@ garrow_equal_options_init(GArrowEqualOptions *object) { auto priv = GARROW_EQUAL_OPTIONS_GET_PRIVATE(object); priv->approx = FALSE; - new(&priv->options) arrow::EqualOptions; + new (&priv->options) arrow::EqualOptions; priv->options = arrow::EqualOptions::Defaults(); } @@ -274,7 +272,7 @@ static void garrow_equal_options_class_init(GArrowEqualOptionsClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_equal_options_finalize; + gobject_class->finalize = garrow_equal_options_finalize; gobject_class->set_property = garrow_equal_options_set_property; gobject_class->get_property = garrow_equal_options_get_property; @@ -356,8 +354,8 @@ garrow_equal_options_is_approx(GArrowEqualOptions *options) return priv->approx; } - -typedef struct GArrowArrayPrivate_ { +typedef struct GArrowArrayPrivate_ +{ std::shared_ptr array; GArrowDataType *value_data_type; GArrowBuffer *null_bitmap; @@ -379,20 +377,15 @@ enum { PROP_PARENT, }; -G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowArray, - garrow_array, - G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowArray, garrow_array, G_TYPE_OBJECT) -#define GARROW_ARRAY_GET_PRIVATE(obj) \ - static_cast( \ - garrow_array_get_instance_private( \ - GARROW_ARRAY(obj))) +#define GARROW_ARRAY_GET_PRIVATE(obj) \ + static_cast(garrow_array_get_instance_private(GARROW_ARRAY(obj))) G_END_DECLS template const typename T::c_type * -garrow_array_get_values_raw(std::shared_ptr arrow_array, - gint64 *length) +garrow_array_get_values_raw(std::shared_ptr arrow_array, gint64 *length) { auto arrow_specific_array = std::static_pointer_cast::ArrayType>(arrow_array); @@ -512,7 +505,7 @@ static void garrow_array_init(GArrowArray *object) { auto priv = GARROW_ARRAY_GET_PRIVATE(object); - new(&priv->array) std::shared_ptr; + new (&priv->array) std::shared_ptr; } static void @@ -520,57 +513,57 @@ garrow_array_class_init(GArrowArrayClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_array_dispose; - gobject_class->finalize = garrow_array_finalize; + gobject_class->dispose = garrow_array_dispose; + gobject_class->finalize = garrow_array_finalize; gobject_class->set_property = garrow_array_set_property; gobject_class->get_property = garrow_array_get_property; GParamSpec *spec; - spec = g_param_spec_pointer("array", - "Array", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "array", + "Array", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_ARRAY, spec); - spec = g_param_spec_object("value-data-type", - "Value data type", - "The data type of each value", - GARROW_TYPE_DATA_TYPE, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "value-data-type", + "Value data type", + "The data type of each value", + GARROW_TYPE_DATA_TYPE, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_VALUE_DATA_TYPE, spec); - spec = g_param_spec_object("null-bitmap", - "NULL bitmap", - "The NULL bitmap", - GARROW_TYPE_BUFFER, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "null-bitmap", + "NULL bitmap", + "The NULL bitmap", + GARROW_TYPE_BUFFER, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_NULL_BITMAP, spec); - spec = g_param_spec_object("buffer1", - "Buffer1", - "The first buffer", - GARROW_TYPE_BUFFER, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "buffer1", + "Buffer1", + "The first buffer", + GARROW_TYPE_BUFFER, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_BUFFER1, spec); - spec = g_param_spec_object("buffer2", - "Buffer2", - "The second buffer", - GARROW_TYPE_BUFFER, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "buffer2", + "Buffer2", + "The second buffer", + GARROW_TYPE_BUFFER, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_BUFFER2, spec); - spec = g_param_spec_object("parent", - "Parent", - "The parent array", - GARROW_TYPE_ARRAY, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "parent", + "Parent", + "The parent array", + GARROW_TYPE_ARRAY, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_PARENT, spec); } @@ -589,14 +582,11 @@ garrow_array_class_init(GArrowArrayClass *klass) * Since: 6.0.0 */ GArrowArray * -garrow_array_import(gpointer c_abi_array, - GArrowDataType *data_type, - GError **error) +garrow_array_import(gpointer c_abi_array, GArrowDataType *data_type, GError **error) { auto arrow_data_type = garrow_data_type_get_raw(data_type); auto arrow_array_result = - arrow::ImportArray(static_cast(c_abi_array), - arrow_data_type); + arrow::ImportArray(static_cast(c_abi_array), arrow_data_type); if (garrow::check(error, arrow_array_result, "[array][import]")) { return garrow_array_new_raw(&(*arrow_array_result)); } else { @@ -635,8 +625,7 @@ garrow_array_export(GArrowArray *array, static_cast(*c_abi_array), static_cast(*c_abi_schema)); } else { - status = arrow::ExportArray(*arrow_array, - static_cast(*c_abi_array)); + status = arrow::ExportArray(*arrow_array, static_cast(*c_abi_array)); } if (garrow::check(error, status, "[array][export]")) { return true; @@ -901,15 +890,15 @@ garrow_array_get_value_type(GArrowArray *array) * values with the base #GArrowArray. */ GArrowArray * -garrow_array_slice(GArrowArray *array, - gint64 offset, - gint64 length) +garrow_array_slice(GArrowArray *array, gint64 offset, gint64 length) { const auto arrow_array = garrow_array_get_raw(array); auto arrow_sub_array = arrow_array->Slice(offset, length); return garrow_array_new_raw(&arrow_sub_array, - "array", &arrow_sub_array, - "parent", array, + "array", + &arrow_sub_array, + "parent", + array, NULL); } @@ -946,9 +935,7 @@ garrow_array_to_string(GArrowArray *array, GError **error) * Since: 0.15.0 */ GArrowArray * -garrow_array_view(GArrowArray *array, - GArrowDataType *return_type, - GError **error) +garrow_array_view(GArrowArray *array, GArrowDataType *return_type, GError **error) { auto arrow_array_raw = garrow_array_get_raw(array); auto arrow_return_type = garrow_data_type_get_raw(return_type); @@ -979,8 +966,7 @@ garrow_array_diff_unified(GArrowArray *array, GArrowArray *other_array) const auto arrow_array = garrow_array_get_raw(array); const auto arrow_other_array = garrow_array_get_raw(other_array); std::stringstream diff; - arrow_array->Equals(arrow_other_array, - arrow::EqualOptions().diff_sink(&diff)); + arrow_array->Equals(arrow_other_array, arrow::EqualOptions().diff_sink(&diff)); auto string = diff.str(); if (string.empty()) { return NULL; @@ -1001,9 +987,7 @@ garrow_array_diff_unified(GArrowArray *array, GArrowArray *other_array) * Since: 4.0.0 */ GArrowArray * -garrow_array_concatenate(GArrowArray *array, - GList *other_arrays, - GError **error) +garrow_array_concatenate(GArrowArray *array, GList *other_arrays, GError **error) { if (!other_arrays) { g_object_ref(array); @@ -1016,19 +1000,14 @@ garrow_array_concatenate(GArrowArray *array, arrow_arrays.push_back(garrow_array_get_raw(other_array)); } auto arrow_concatenated_array = arrow::Concatenate(arrow_arrays); - if (garrow::check(error, - arrow_concatenated_array, - "[array][concatenate]")) { + if (garrow::check(error, arrow_concatenated_array, "[array][concatenate]")) { return garrow_array_new_raw(&(*arrow_concatenated_array)); } else { return NULL; } } - -G_DEFINE_TYPE(GArrowNullArray, - garrow_null_array, - GARROW_TYPE_ARRAY) +G_DEFINE_TYPE(GArrowNullArray, garrow_null_array, GARROW_TYPE_ARRAY) static void garrow_null_array_init(GArrowNullArray *object) @@ -1055,10 +1034,7 @@ garrow_null_array_new(gint64 length) return GARROW_NULL_ARRAY(array); } - -G_DEFINE_TYPE(GArrowPrimitiveArray, - garrow_primitive_array, - GARROW_TYPE_ARRAY) +G_DEFINE_TYPE(GArrowPrimitiveArray, garrow_primitive_array, GARROW_TYPE_ARRAY) G_END_DECLS template @@ -1075,12 +1051,14 @@ garrow_primitive_array_new(gint64 length, arrow_data, arrow_bitmap, n_nulls); - auto arrow_array = - std::static_pointer_cast(arrow_specific_array); + auto arrow_array = std::static_pointer_cast(arrow_specific_array); return garrow_array_new_raw(&arrow_array, - "array", &arrow_array, - "null-bitmap", null_bitmap, - "buffer1", data, + "array", + &arrow_array, + "null-bitmap", + null_bitmap, + "buffer1", + data, NULL); }; @@ -1101,12 +1079,14 @@ garrow_primitive_array_new(GArrowDataType *data_type, arrow_data, arrow_bitmap, n_nulls); - auto arrow_array = - std::static_pointer_cast(arrow_specific_array); + auto arrow_array = std::static_pointer_cast(arrow_specific_array); return garrow_array_new_raw(&arrow_array, - "array", &arrow_array, - "null-bitmap", null_bitmap, - "buffer1", data, + "array", + &arrow_array, + "null-bitmap", + null_bitmap, + "buffer1", + data, NULL); }; G_BEGIN_DECLS @@ -1159,10 +1139,7 @@ garrow_primitive_array_get_data_buffer(GArrowPrimitiveArray *array) return garrow_buffer_new_raw(&arrow_data); } - -G_DEFINE_TYPE(GArrowBooleanArray, - garrow_boolean_array, - GARROW_TYPE_PRIMITIVE_ARRAY) +G_DEFINE_TYPE(GArrowBooleanArray, garrow_boolean_array, GARROW_TYPE_PRIMITIVE_ARRAY) static void garrow_boolean_array_init(GArrowBooleanArray *object) @@ -1195,10 +1172,8 @@ garrow_boolean_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = garrow_primitive_array_new(length, - data, - null_bitmap, - n_nulls); + auto array = + garrow_primitive_array_new(length, data, null_bitmap, n_nulls); return GARROW_BOOLEAN_ARRAY(array); } @@ -1210,8 +1185,7 @@ garrow_boolean_array_new(gint64 length, * Returns: The @i-th value. */ gboolean -garrow_boolean_array_get_value(GArrowBooleanArray *array, - gint64 i) +garrow_boolean_array_get_value(GArrowBooleanArray *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -1228,12 +1202,10 @@ garrow_boolean_array_get_value(GArrowBooleanArray *array, * It should be freed with g_free() when no longer needed. */ gboolean * -garrow_boolean_array_get_values(GArrowBooleanArray *array, - gint64 *length) +garrow_boolean_array_get_values(GArrowBooleanArray *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - auto arrow_boolean_array = - std::static_pointer_cast(arrow_array); + auto arrow_boolean_array = std::static_pointer_cast(arrow_array); *length = arrow_boolean_array->length(); auto values = static_cast(g_new(gboolean, *length)); for (gint64 i = 0; i < *length; ++i) { @@ -1242,10 +1214,7 @@ garrow_boolean_array_get_values(GArrowBooleanArray *array, return values; } - -G_DEFINE_TYPE(GArrowNumericArray, - garrow_numeric_array, - GARROW_TYPE_PRIMITIVE_ARRAY) +G_DEFINE_TYPE(GArrowNumericArray, garrow_numeric_array, GARROW_TYPE_PRIMITIVE_ARRAY) static void garrow_numeric_array_init(GArrowNumericArray *object) @@ -1257,10 +1226,7 @@ garrow_numeric_array_class_init(GArrowNumericArrayClass *klass) { } - -G_DEFINE_TYPE(GArrowInt8Array, - garrow_int8_array, - GARROW_TYPE_NUMERIC_ARRAY) +G_DEFINE_TYPE(GArrowInt8Array, garrow_int8_array, GARROW_TYPE_NUMERIC_ARRAY) static void garrow_int8_array_init(GArrowInt8Array *object) @@ -1293,10 +1259,8 @@ garrow_int8_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = garrow_primitive_array_new(length, - data, - null_bitmap, - n_nulls); + auto array = + garrow_primitive_array_new(length, data, null_bitmap, n_nulls); return GARROW_INT8_ARRAY(array); } @@ -1308,8 +1272,7 @@ garrow_int8_array_new(gint64 length, * Returns: The @i-th value. */ gint8 -garrow_int8_array_get_value(GArrowInt8Array *array, - gint64 i) +garrow_int8_array_get_value(GArrowInt8Array *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -1323,16 +1286,13 @@ garrow_int8_array_get_value(GArrowInt8Array *array, * Returns: (array length=length): The raw values. */ const gint8 * -garrow_int8_array_get_values(GArrowInt8Array *array, - gint64 *length) +garrow_int8_array_get_values(GArrowInt8Array *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return garrow_array_get_values_raw(arrow_array, length); } -G_DEFINE_TYPE(GArrowUInt8Array, - garrow_uint8_array, - GARROW_TYPE_NUMERIC_ARRAY) +G_DEFINE_TYPE(GArrowUInt8Array, garrow_uint8_array, GARROW_TYPE_NUMERIC_ARRAY) static void garrow_uint8_array_init(GArrowUInt8Array *object) @@ -1365,10 +1325,8 @@ garrow_uint8_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = garrow_primitive_array_new(length, - data, - null_bitmap, - n_nulls); + auto array = + garrow_primitive_array_new(length, data, null_bitmap, n_nulls); return GARROW_UINT8_ARRAY(array); } @@ -1380,8 +1338,7 @@ garrow_uint8_array_new(gint64 length, * Returns: The @i-th value. */ guint8 -garrow_uint8_array_get_value(GArrowUInt8Array *array, - gint64 i) +garrow_uint8_array_get_value(GArrowUInt8Array *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -1395,17 +1352,13 @@ garrow_uint8_array_get_value(GArrowUInt8Array *array, * Returns: (array length=length): The raw values. */ const guint8 * -garrow_uint8_array_get_values(GArrowUInt8Array *array, - gint64 *length) +garrow_uint8_array_get_values(GArrowUInt8Array *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return garrow_array_get_values_raw(arrow_array, length); } - -G_DEFINE_TYPE(GArrowInt16Array, - garrow_int16_array, - GARROW_TYPE_NUMERIC_ARRAY) +G_DEFINE_TYPE(GArrowInt16Array, garrow_int16_array, GARROW_TYPE_NUMERIC_ARRAY) static void garrow_int16_array_init(GArrowInt16Array *object) @@ -1438,10 +1391,8 @@ garrow_int16_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = garrow_primitive_array_new(length, - data, - null_bitmap, - n_nulls); + auto array = + garrow_primitive_array_new(length, data, null_bitmap, n_nulls); return GARROW_INT16_ARRAY(array); } @@ -1453,8 +1404,7 @@ garrow_int16_array_new(gint64 length, * Returns: The @i-th value. */ gint16 -garrow_int16_array_get_value(GArrowInt16Array *array, - gint64 i) +garrow_int16_array_get_value(GArrowInt16Array *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -1468,17 +1418,13 @@ garrow_int16_array_get_value(GArrowInt16Array *array, * Returns: (array length=length): The raw values. */ const gint16 * -garrow_int16_array_get_values(GArrowInt16Array *array, - gint64 *length) +garrow_int16_array_get_values(GArrowInt16Array *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return garrow_array_get_values_raw(arrow_array, length); } - -G_DEFINE_TYPE(GArrowUInt16Array, - garrow_uint16_array, - GARROW_TYPE_NUMERIC_ARRAY) +G_DEFINE_TYPE(GArrowUInt16Array, garrow_uint16_array, GARROW_TYPE_NUMERIC_ARRAY) static void garrow_uint16_array_init(GArrowUInt16Array *object) @@ -1511,10 +1457,8 @@ garrow_uint16_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = garrow_primitive_array_new(length, - data, - null_bitmap, - n_nulls); + auto array = + garrow_primitive_array_new(length, data, null_bitmap, n_nulls); return GARROW_UINT16_ARRAY(array); } @@ -1526,8 +1470,7 @@ garrow_uint16_array_new(gint64 length, * Returns: The @i-th value. */ guint16 -garrow_uint16_array_get_value(GArrowUInt16Array *array, - gint64 i) +garrow_uint16_array_get_value(GArrowUInt16Array *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -1541,17 +1484,13 @@ garrow_uint16_array_get_value(GArrowUInt16Array *array, * Returns: (array length=length): The raw values. */ const guint16 * -garrow_uint16_array_get_values(GArrowUInt16Array *array, - gint64 *length) +garrow_uint16_array_get_values(GArrowUInt16Array *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return garrow_array_get_values_raw(arrow_array, length); } - -G_DEFINE_TYPE(GArrowInt32Array, - garrow_int32_array, - GARROW_TYPE_NUMERIC_ARRAY) +G_DEFINE_TYPE(GArrowInt32Array, garrow_int32_array, GARROW_TYPE_NUMERIC_ARRAY) static void garrow_int32_array_init(GArrowInt32Array *object) @@ -1584,10 +1523,8 @@ garrow_int32_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = garrow_primitive_array_new(length, - data, - null_bitmap, - n_nulls); + auto array = + garrow_primitive_array_new(length, data, null_bitmap, n_nulls); return GARROW_INT32_ARRAY(array); } @@ -1599,8 +1536,7 @@ garrow_int32_array_new(gint64 length, * Returns: The @i-th value. */ gint32 -garrow_int32_array_get_value(GArrowInt32Array *array, - gint64 i) +garrow_int32_array_get_value(GArrowInt32Array *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -1614,17 +1550,13 @@ garrow_int32_array_get_value(GArrowInt32Array *array, * Returns: (array length=length): The raw values. */ const gint32 * -garrow_int32_array_get_values(GArrowInt32Array *array, - gint64 *length) +garrow_int32_array_get_values(GArrowInt32Array *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return garrow_array_get_values_raw(arrow_array, length); } - -G_DEFINE_TYPE(GArrowUInt32Array, - garrow_uint32_array, - GARROW_TYPE_NUMERIC_ARRAY) +G_DEFINE_TYPE(GArrowUInt32Array, garrow_uint32_array, GARROW_TYPE_NUMERIC_ARRAY) static void garrow_uint32_array_init(GArrowUInt32Array *object) @@ -1657,10 +1589,8 @@ garrow_uint32_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = garrow_primitive_array_new(length, - data, - null_bitmap, - n_nulls); + auto array = + garrow_primitive_array_new(length, data, null_bitmap, n_nulls); return GARROW_UINT32_ARRAY(array); } @@ -1672,8 +1602,7 @@ garrow_uint32_array_new(gint64 length, * Returns: The @i-th value. */ guint32 -garrow_uint32_array_get_value(GArrowUInt32Array *array, - gint64 i) +garrow_uint32_array_get_value(GArrowUInt32Array *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -1687,17 +1616,13 @@ garrow_uint32_array_get_value(GArrowUInt32Array *array, * Returns: (array length=length): The raw values. */ const guint32 * -garrow_uint32_array_get_values(GArrowUInt32Array *array, - gint64 *length) +garrow_uint32_array_get_values(GArrowUInt32Array *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return garrow_array_get_values_raw(arrow_array, length); } - -G_DEFINE_TYPE(GArrowInt64Array, - garrow_int64_array, - GARROW_TYPE_NUMERIC_ARRAY) +G_DEFINE_TYPE(GArrowInt64Array, garrow_int64_array, GARROW_TYPE_NUMERIC_ARRAY) static void garrow_int64_array_init(GArrowInt64Array *object) @@ -1730,10 +1655,8 @@ garrow_int64_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = garrow_primitive_array_new(length, - data, - null_bitmap, - n_nulls); + auto array = + garrow_primitive_array_new(length, data, null_bitmap, n_nulls); return GARROW_INT64_ARRAY(array); } @@ -1745,8 +1668,7 @@ garrow_int64_array_new(gint64 length, * Returns: The @i-th value. */ gint64 -garrow_int64_array_get_value(GArrowInt64Array *array, - gint64 i) +garrow_int64_array_get_value(GArrowInt64Array *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -1760,19 +1682,14 @@ garrow_int64_array_get_value(GArrowInt64Array *array, * Returns: (array length=length): The raw values. */ const gint64 * -garrow_int64_array_get_values(GArrowInt64Array *array, - gint64 *length) +garrow_int64_array_get_values(GArrowInt64Array *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - auto values = - garrow_array_get_values_raw(arrow_array, length); + auto values = garrow_array_get_values_raw(arrow_array, length); return reinterpret_cast(values); } - -G_DEFINE_TYPE(GArrowUInt64Array, - garrow_uint64_array, - GARROW_TYPE_NUMERIC_ARRAY) +G_DEFINE_TYPE(GArrowUInt64Array, garrow_uint64_array, GARROW_TYPE_NUMERIC_ARRAY) static void garrow_uint64_array_init(GArrowUInt64Array *object) @@ -1805,10 +1722,8 @@ garrow_uint64_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = garrow_primitive_array_new(length, - data, - null_bitmap, - n_nulls); + auto array = + garrow_primitive_array_new(length, data, null_bitmap, n_nulls); return GARROW_UINT64_ARRAY(array); } @@ -1820,8 +1735,7 @@ garrow_uint64_array_new(gint64 length, * Returns: The @i-th value. */ guint64 -garrow_uint64_array_get_value(GArrowUInt64Array *array, - gint64 i) +garrow_uint64_array_get_value(GArrowUInt64Array *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -1835,19 +1749,14 @@ garrow_uint64_array_get_value(GArrowUInt64Array *array, * Returns: (array length=length): The raw values. */ const guint64 * -garrow_uint64_array_get_values(GArrowUInt64Array *array, - gint64 *length) +garrow_uint64_array_get_values(GArrowUInt64Array *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - auto values = - garrow_array_get_values_raw(arrow_array, length); + auto values = garrow_array_get_values_raw(arrow_array, length); return reinterpret_cast(values); } - -G_DEFINE_TYPE(GArrowHalfFloatArray, - garrow_half_float_array, - GARROW_TYPE_NUMERIC_ARRAY) +G_DEFINE_TYPE(GArrowHalfFloatArray, garrow_half_float_array, GARROW_TYPE_NUMERIC_ARRAY) static void garrow_half_float_array_init(GArrowHalfFloatArray *object) @@ -1880,10 +1789,8 @@ garrow_half_float_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = garrow_primitive_array_new(length, - data, - null_bitmap, - n_nulls); + auto array = + garrow_primitive_array_new(length, data, null_bitmap, n_nulls); return GARROW_HALF_FLOAT_ARRAY(array); } @@ -1897,8 +1804,7 @@ garrow_half_float_array_new(gint64 length, * Since: 11.0.0 */ guint16 -garrow_half_float_array_get_value(GArrowHalfFloatArray *array, - gint64 i) +garrow_half_float_array_get_value(GArrowHalfFloatArray *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return std::static_pointer_cast(arrow_array)->Value(i); @@ -1914,17 +1820,13 @@ garrow_half_float_array_get_value(GArrowHalfFloatArray *array, * Since: 11.0.0 */ const guint16 * -garrow_half_float_array_get_values(GArrowHalfFloatArray *array, - gint64 *length) +garrow_half_float_array_get_values(GArrowHalfFloatArray *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return garrow_array_get_values_raw(arrow_array, length); } - -G_DEFINE_TYPE(GArrowFloatArray, - garrow_float_array, - GARROW_TYPE_NUMERIC_ARRAY) +G_DEFINE_TYPE(GArrowFloatArray, garrow_float_array, GARROW_TYPE_NUMERIC_ARRAY) static void garrow_float_array_init(GArrowFloatArray *object) @@ -1957,10 +1859,8 @@ garrow_float_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = garrow_primitive_array_new(length, - data, - null_bitmap, - n_nulls); + auto array = + garrow_primitive_array_new(length, data, null_bitmap, n_nulls); return GARROW_FLOAT_ARRAY(array); } @@ -1972,8 +1872,7 @@ garrow_float_array_new(gint64 length, * Returns: The @i-th value. */ gfloat -garrow_float_array_get_value(GArrowFloatArray *array, - gint64 i) +garrow_float_array_get_value(GArrowFloatArray *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -1987,17 +1886,13 @@ garrow_float_array_get_value(GArrowFloatArray *array, * Returns: (array length=length): The raw values. */ const gfloat * -garrow_float_array_get_values(GArrowFloatArray *array, - gint64 *length) +garrow_float_array_get_values(GArrowFloatArray *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return garrow_array_get_values_raw(arrow_array, length); } - -G_DEFINE_TYPE(GArrowDoubleArray, - garrow_double_array, - GARROW_TYPE_NUMERIC_ARRAY) +G_DEFINE_TYPE(GArrowDoubleArray, garrow_double_array, GARROW_TYPE_NUMERIC_ARRAY) static void garrow_double_array_init(GArrowDoubleArray *object) @@ -2030,10 +1925,8 @@ garrow_double_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = garrow_primitive_array_new(length, - data, - null_bitmap, - n_nulls); + auto array = + garrow_primitive_array_new(length, data, null_bitmap, n_nulls); return GARROW_DOUBLE_ARRAY(array); } @@ -2045,8 +1938,7 @@ garrow_double_array_new(gint64 length, * Returns: The @i-th value. */ gdouble -garrow_double_array_get_value(GArrowDoubleArray *array, - gint64 i) +garrow_double_array_get_value(GArrowDoubleArray *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -2060,14 +1952,12 @@ garrow_double_array_get_value(GArrowDoubleArray *array, * Returns: (array length=length): The raw values. */ const gdouble * -garrow_double_array_get_values(GArrowDoubleArray *array, - gint64 *length) +garrow_double_array_get_values(GArrowDoubleArray *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return garrow_array_get_values_raw(arrow_array, length); } - G_END_DECLS template GArrowArray * @@ -2080,30 +1970,30 @@ garrow_base_binary_array_new(gint64 length, const auto arrow_value_offsets = garrow_buffer_get_raw(value_offsets); const auto arrow_value_data = garrow_buffer_get_raw(value_data); const auto arrow_null_bitmap = garrow_buffer_get_raw(null_bitmap); - auto arrow_binary_array = - std::make_shared(length, - arrow_value_offsets, - arrow_value_data, - arrow_null_bitmap, - n_nulls); - auto arrow_array = - std::static_pointer_cast(arrow_binary_array); + auto arrow_binary_array = std::make_shared(length, + arrow_value_offsets, + arrow_value_data, + arrow_null_bitmap, + n_nulls); + auto arrow_array = std::static_pointer_cast(arrow_binary_array); return garrow_array_new_raw(&arrow_array, - "array", &arrow_array, - "null-bitmap", null_bitmap, - "buffer1", value_offsets, - "buffer2", value_data, + "array", + &arrow_array, + "null-bitmap", + null_bitmap, + "buffer1", + value_offsets, + "buffer2", + value_data, NULL); }; template GBytes * -garrow_base_binary_array_get_value(GArrowArray *array, - gint64 i) +garrow_base_binary_array_get_value(GArrowArray *array, gint64 i) { auto arrow_array = garrow_array_get_raw(array); - auto arrow_binary_array = - std::static_pointer_cast(arrow_array); + auto arrow_binary_array = std::static_pointer_cast(arrow_array); auto view = arrow_binary_array->GetView(i); return g_bytes_new_static(view.data(), view.length()); }; @@ -2119,8 +2009,7 @@ garrow_base_binary_array_get_data_buffer(GArrowArray *array) } auto arrow_array = garrow_array_get_raw(array); - auto arrow_binary_array = - std::static_pointer_cast(arrow_array); + auto arrow_binary_array = std::static_pointer_cast(arrow_array); auto arrow_data = arrow_binary_array->value_data(); return garrow_buffer_new_raw(&arrow_data); }; @@ -2136,16 +2025,13 @@ garrow_base_binary_array_get_offsets_buffer(GArrowArray *array) } auto arrow_array = garrow_array_get_raw(array); - auto arrow_binary_array = - std::static_pointer_cast(arrow_array); + auto arrow_binary_array = std::static_pointer_cast(arrow_array); auto arrow_offsets = arrow_binary_array->value_offsets(); return garrow_buffer_new_raw(&arrow_offsets); }; G_BEGIN_DECLS -G_DEFINE_TYPE(GArrowBinaryArray, - garrow_binary_array, - GARROW_TYPE_ARRAY) +G_DEFINE_TYPE(GArrowBinaryArray, garrow_binary_array, GARROW_TYPE_ARRAY) static void garrow_binary_array_init(GArrowBinaryArray *object) @@ -2180,12 +2066,11 @@ garrow_binary_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto binary_array = - garrow_base_binary_array_new(length, - value_offsets, - value_data, - null_bitmap, - n_nulls); + auto binary_array = garrow_base_binary_array_new(length, + value_offsets, + value_data, + null_bitmap, + n_nulls); return GARROW_BINARY_ARRAY(binary_array); } @@ -2197,11 +2082,9 @@ garrow_binary_array_new(gint64 length, * Returns: (transfer full): The @i-th value. */ GBytes * -garrow_binary_array_get_value(GArrowBinaryArray *array, - gint64 i) +garrow_binary_array_get_value(GArrowBinaryArray *array, gint64 i) { - return garrow_base_binary_array_get_value( - GARROW_ARRAY(array), i); + return garrow_base_binary_array_get_value(GARROW_ARRAY(array), i); } /** @@ -2246,10 +2129,7 @@ garrow_binary_array_get_offsets_buffer(GArrowBinaryArray *array) GARROW_ARRAY(array)); } - -G_DEFINE_TYPE(GArrowLargeBinaryArray, - garrow_large_binary_array, - GARROW_TYPE_ARRAY) +G_DEFINE_TYPE(GArrowLargeBinaryArray, garrow_large_binary_array, GARROW_TYPE_ARRAY) static void garrow_large_binary_array_init(GArrowLargeBinaryArray *object) @@ -2303,11 +2183,10 @@ garrow_large_binary_array_new(gint64 length, * Since: 0.16.0 */ GBytes * -garrow_large_binary_array_get_value(GArrowLargeBinaryArray *array, - gint64 i) +garrow_large_binary_array_get_value(GArrowLargeBinaryArray *array, gint64 i) { - return garrow_base_binary_array_get_value( - GARROW_ARRAY(array), i); + return garrow_base_binary_array_get_value(GARROW_ARRAY(array), + i); } /** @@ -2356,24 +2235,19 @@ garrow_large_binary_array_get_offsets_buffer(GArrowLargeBinaryArray *array) GARROW_ARRAY(array)); } - G_END_DECLS template gchar * -garrow_base_string_array_get_value(GArrowArray *array, - gint64 i) +garrow_base_string_array_get_value(GArrowArray *array, gint64 i) { auto arrow_array = garrow_array_get_raw(array); - auto arrow_string_array = - std::static_pointer_cast(arrow_array); + auto arrow_string_array = std::static_pointer_cast(arrow_array); auto view = arrow_string_array->GetView(i); return g_strndup(view.data(), view.length()); }; G_BEGIN_DECLS -G_DEFINE_TYPE(GArrowStringArray, - garrow_string_array, - GARROW_TYPE_BINARY_ARRAY) +G_DEFINE_TYPE(GArrowStringArray, garrow_string_array, GARROW_TYPE_BINARY_ARRAY) static void garrow_string_array_init(GArrowStringArray *object) @@ -2408,12 +2282,11 @@ garrow_string_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto string_array = - garrow_base_binary_array_new(length, - value_offsets, - value_data, - null_bitmap, - n_nulls); + auto string_array = garrow_base_binary_array_new(length, + value_offsets, + value_data, + null_bitmap, + n_nulls); return GARROW_STRING_ARRAY(string_array); } @@ -2425,14 +2298,11 @@ garrow_string_array_new(gint64 length, * Returns: The @i-th UTF-8 encoded string. */ gchar * -garrow_string_array_get_string(GArrowStringArray *array, - gint64 i) +garrow_string_array_get_string(GArrowStringArray *array, gint64 i) { - return garrow_base_string_array_get_value( - GARROW_ARRAY(array), i); + return garrow_base_string_array_get_value(GARROW_ARRAY(array), i); } - G_DEFINE_TYPE(GArrowLargeStringArray, garrow_large_string_array, GARROW_TYPE_LARGE_BINARY_ARRAY) @@ -2489,17 +2359,13 @@ garrow_large_string_array_new(gint64 length, * Since: 0.16.0 */ gchar * -garrow_large_string_array_get_string(GArrowLargeStringArray *array, - gint64 i) +garrow_large_string_array_get_string(GArrowLargeStringArray *array, gint64 i) { - return garrow_base_string_array_get_value( - GARROW_ARRAY(array), i); + return garrow_base_string_array_get_value(GARROW_ARRAY(array), + i); } - -G_DEFINE_TYPE(GArrowDate32Array, - garrow_date32_array, - GARROW_TYPE_NUMERIC_ARRAY) +G_DEFINE_TYPE(GArrowDate32Array, garrow_date32_array, GARROW_TYPE_NUMERIC_ARRAY) static void garrow_date32_array_init(GArrowDate32Array *object) @@ -2532,10 +2398,8 @@ garrow_date32_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = garrow_primitive_array_new(length, - data, - null_bitmap, - n_nulls); + auto array = + garrow_primitive_array_new(length, data, null_bitmap, n_nulls); return GARROW_DATE32_ARRAY(array); } @@ -2549,8 +2413,7 @@ garrow_date32_array_new(gint64 length, * Since: 0.7.0 */ gint32 -garrow_date32_array_get_value(GArrowDate32Array *array, - gint64 i) +garrow_date32_array_get_value(GArrowDate32Array *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -2566,17 +2429,13 @@ garrow_date32_array_get_value(GArrowDate32Array *array, * Since: 0.7.0 */ const gint32 * -garrow_date32_array_get_values(GArrowDate32Array *array, - gint64 *length) +garrow_date32_array_get_values(GArrowDate32Array *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return garrow_array_get_values_raw(arrow_array, length); } - -G_DEFINE_TYPE(GArrowDate64Array, - garrow_date64_array, - GARROW_TYPE_NUMERIC_ARRAY) +G_DEFINE_TYPE(GArrowDate64Array, garrow_date64_array, GARROW_TYPE_NUMERIC_ARRAY) static void garrow_date64_array_init(GArrowDate64Array *object) @@ -2609,10 +2468,8 @@ garrow_date64_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = garrow_primitive_array_new(length, - data, - null_bitmap, - n_nulls); + auto array = + garrow_primitive_array_new(length, data, null_bitmap, n_nulls); return GARROW_DATE64_ARRAY(array); } @@ -2626,8 +2483,7 @@ garrow_date64_array_new(gint64 length, * Since: 0.7.0 */ gint64 -garrow_date64_array_get_value(GArrowDate64Array *array, - gint64 i) +garrow_date64_array_get_value(GArrowDate64Array *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -2643,19 +2499,14 @@ garrow_date64_array_get_value(GArrowDate64Array *array, * Since: 0.7.0 */ const gint64 * -garrow_date64_array_get_values(GArrowDate64Array *array, - gint64 *length) +garrow_date64_array_get_values(GArrowDate64Array *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - auto values = - garrow_array_get_values_raw(arrow_array, length); + auto values = garrow_array_get_values_raw(arrow_array, length); return reinterpret_cast(values); } - -G_DEFINE_TYPE(GArrowTimestampArray, - garrow_timestamp_array, - GARROW_TYPE_NUMERIC_ARRAY) +G_DEFINE_TYPE(GArrowTimestampArray, garrow_timestamp_array, GARROW_TYPE_NUMERIC_ARRAY) static void garrow_timestamp_array_init(GArrowTimestampArray *object) @@ -2709,8 +2560,7 @@ garrow_timestamp_array_new(GArrowTimestampDataType *data_type, * Since: 0.7.0 */ gint64 -garrow_timestamp_array_get_value(GArrowTimestampArray *array, - gint64 i) +garrow_timestamp_array_get_value(GArrowTimestampArray *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -2726,19 +2576,14 @@ garrow_timestamp_array_get_value(GArrowTimestampArray *array, * Since: 0.7.0 */ const gint64 * -garrow_timestamp_array_get_values(GArrowTimestampArray *array, - gint64 *length) +garrow_timestamp_array_get_values(GArrowTimestampArray *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - auto values = - garrow_array_get_values_raw(arrow_array, length); + auto values = garrow_array_get_values_raw(arrow_array, length); return reinterpret_cast(values); } - -G_DEFINE_TYPE(GArrowTime32Array, - garrow_time32_array, - GARROW_TYPE_NUMERIC_ARRAY) +G_DEFINE_TYPE(GArrowTime32Array, garrow_time32_array, GARROW_TYPE_NUMERIC_ARRAY) static void garrow_time32_array_init(GArrowTime32Array *object) @@ -2773,12 +2618,11 @@ garrow_time32_array_new(GArrowTime32DataType *data_type, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = - garrow_primitive_array_new(GARROW_DATA_TYPE(data_type), - length, - data, - null_bitmap, - n_nulls); + auto array = garrow_primitive_array_new(GARROW_DATA_TYPE(data_type), + length, + data, + null_bitmap, + n_nulls); return GARROW_TIME32_ARRAY(array); } @@ -2792,8 +2636,7 @@ garrow_time32_array_new(GArrowTime32DataType *data_type, * Since: 0.7.0 */ gint32 -garrow_time32_array_get_value(GArrowTime32Array *array, - gint64 i) +garrow_time32_array_get_value(GArrowTime32Array *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -2809,17 +2652,13 @@ garrow_time32_array_get_value(GArrowTime32Array *array, * Since: 0.7.0 */ const gint32 * -garrow_time32_array_get_values(GArrowTime32Array *array, - gint64 *length) +garrow_time32_array_get_values(GArrowTime32Array *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return garrow_array_get_values_raw(arrow_array, length); } - -G_DEFINE_TYPE(GArrowTime64Array, - garrow_time64_array, - GARROW_TYPE_NUMERIC_ARRAY) +G_DEFINE_TYPE(GArrowTime64Array, garrow_time64_array, GARROW_TYPE_NUMERIC_ARRAY) static void garrow_time64_array_init(GArrowTime64Array *object) @@ -2854,12 +2693,11 @@ garrow_time64_array_new(GArrowTime64DataType *data_type, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = - garrow_primitive_array_new(GARROW_DATA_TYPE(data_type), - length, - data, - null_bitmap, - n_nulls); + auto array = garrow_primitive_array_new(GARROW_DATA_TYPE(data_type), + length, + data, + null_bitmap, + n_nulls); return GARROW_TIME64_ARRAY(array); } @@ -2873,8 +2711,7 @@ garrow_time64_array_new(GArrowTime64DataType *data_type, * Since: 0.7.0 */ gint64 -garrow_time64_array_get_value(GArrowTime64Array *array, - gint64 i) +garrow_time64_array_get_value(GArrowTime64Array *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -2890,16 +2727,13 @@ garrow_time64_array_get_value(GArrowTime64Array *array, * Since: 0.7.0 */ const gint64 * -garrow_time64_array_get_values(GArrowTime64Array *array, - gint64 *length) +garrow_time64_array_get_values(GArrowTime64Array *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - auto values = - garrow_array_get_values_raw(arrow_array, length); + auto values = garrow_array_get_values_raw(arrow_array, length); return reinterpret_cast(values); } - G_DEFINE_TYPE(GArrowMonthIntervalArray, garrow_month_interval_array, GARROW_TYPE_NUMERIC_ARRAY) @@ -2952,8 +2786,7 @@ garrow_month_interval_array_new(gint64 length, * Since: 8.0.0 */ gint32 -garrow_month_interval_array_get_value(GArrowMonthIntervalArray *array, - gint64 i) +garrow_month_interval_array_get_value(GArrowMonthIntervalArray *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); return static_cast(arrow_array.get())->Value(i); @@ -2969,15 +2802,12 @@ garrow_month_interval_array_get_value(GArrowMonthIntervalArray *array, * Since: 8.0.0 */ const gint32 * -garrow_month_interval_array_get_values(GArrowMonthIntervalArray *array, - gint64 *length) +garrow_month_interval_array_get_values(GArrowMonthIntervalArray *array, gint64 *length) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - return garrow_array_get_values_raw( - arrow_array, length); + return garrow_array_get_values_raw(arrow_array, length); } - G_DEFINE_TYPE(GArrowDayTimeIntervalArray, garrow_day_time_interval_array, GARROW_TYPE_PRIMITIVE_ARRAY) @@ -3013,11 +2843,10 @@ garrow_day_time_interval_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = garrow_primitive_array_new( - length, - data, - null_bitmap, - n_nulls); + auto array = garrow_primitive_array_new(length, + data, + null_bitmap, + n_nulls); return GARROW_DAY_TIME_INTERVAL_ARRAY(array); } @@ -3031,8 +2860,7 @@ garrow_day_time_interval_array_new(gint64 length, * Since: 8.0.0 */ GArrowDayMillisecond * -garrow_day_time_interval_array_get_value(GArrowDayTimeIntervalArray *array, - gint64 i) +garrow_day_time_interval_array_get_value(GArrowDayTimeIntervalArray *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); auto arrow_day_time_interval_array = @@ -3070,14 +2898,12 @@ garrow_day_time_interval_array_get_values(GArrowDayTimeIntervalArray *array) return g_list_reverse(values); } - G_DEFINE_TYPE(GArrowMonthDayNanoIntervalArray, garrow_month_day_nano_interval_array, GARROW_TYPE_PRIMITIVE_ARRAY) static void -garrow_month_day_nano_interval_array_init( - GArrowMonthDayNanoIntervalArray *object) +garrow_month_day_nano_interval_array_init(GArrowMonthDayNanoIntervalArray *object) { } @@ -3108,11 +2934,10 @@ garrow_month_day_nano_interval_array_new(gint64 length, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto array = garrow_primitive_array_new( - length, - data, - null_bitmap, - n_nulls); + auto array = garrow_primitive_array_new(length, + data, + null_bitmap, + n_nulls); return GARROW_MONTH_DAY_NANO_INTERVAL_ARRAY(array); } @@ -3126,9 +2951,8 @@ garrow_month_day_nano_interval_array_new(gint64 length, * Since: 8.0.0 */ GArrowMonthDayNano * -garrow_month_day_nano_interval_array_get_value( - GArrowMonthDayNanoIntervalArray *array, - gint64 i) +garrow_month_day_nano_interval_array_get_value(GArrowMonthDayNanoIntervalArray *array, + gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); auto arrow_month_day_nano_interval_array = @@ -3147,8 +2971,7 @@ garrow_month_day_nano_interval_array_get_value( * Since: 8.0.0 */ GList * -garrow_month_day_nano_interval_array_get_values( - GArrowMonthDayNanoIntervalArray *array) +garrow_month_day_nano_interval_array_get_values(GArrowMonthDayNanoIntervalArray *array) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); auto arrow_month_day_nano_interval_array = @@ -3167,7 +2990,6 @@ garrow_month_day_nano_interval_array_get_values( return g_list_reverse(values); } - G_DEFINE_TYPE(GArrowFixedSizeBinaryArray, garrow_fixed_size_binary_array, GARROW_TYPE_PRIMITIVE_ARRAY) @@ -3205,12 +3027,11 @@ garrow_fixed_size_binary_array_new(GArrowFixedSizeBinaryDataType *data_type, gint64 n_nulls) { auto array = - garrow_primitive_array_new( - GARROW_DATA_TYPE(data_type), - length, - data, - null_bitmap, - n_nulls); + garrow_primitive_array_new(GARROW_DATA_TYPE(data_type), + length, + data, + null_bitmap, + n_nulls); return GARROW_FIXED_SIZE_BINARY_ARRAY(array); } @@ -3241,15 +3062,13 @@ garrow_fixed_size_binary_array_get_byte_width(GArrowFixedSizeBinaryArray *array) * Since: 3.0.0 */ GBytes * -garrow_fixed_size_binary_array_get_value(GArrowFixedSizeBinaryArray *array, - gint64 i) +garrow_fixed_size_binary_array_get_value(GArrowFixedSizeBinaryArray *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); auto arrow_binary_array = std::static_pointer_cast(arrow_array); auto value = arrow_binary_array->GetValue(i); - return g_bytes_new_static(value, - arrow_binary_array->byte_width()); + return g_bytes_new_static(value, arrow_binary_array->byte_width()); } /** @@ -3268,11 +3087,9 @@ garrow_fixed_size_binary_array_get_values_bytes(GArrowFixedSizeBinaryArray *arra std::static_pointer_cast(arrow_array); auto value = arrow_binary_array->raw_values(); return g_bytes_new_static(value, - arrow_binary_array->byte_width() * - arrow_array->length()); + arrow_binary_array->byte_width() * arrow_array->length()); } - G_DEFINE_TYPE(GArrowDecimal128Array, garrow_decimal128_array, GARROW_TYPE_FIXED_SIZE_BINARY_ARRAY) @@ -3298,8 +3115,7 @@ garrow_decimal128_array_class_init(GArrowDecimal128ArrayClass *klass) * Since: 0.10.0 */ gchar * -garrow_decimal128_array_format_value(GArrowDecimal128Array *array, - gint64 i) +garrow_decimal128_array_format_value(GArrowDecimal128Array *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); auto arrow_decimal128_array = @@ -3318,8 +3134,7 @@ garrow_decimal128_array_format_value(GArrowDecimal128Array *array, * Since: 0.10.0 */ GArrowDecimal128 * -garrow_decimal128_array_get_value(GArrowDecimal128Array *array, - gint64 i) +garrow_decimal128_array_get_value(GArrowDecimal128Array *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); auto arrow_decimal128_array = @@ -3329,7 +3144,6 @@ garrow_decimal128_array_get_value(GArrowDecimal128Array *array, return garrow_decimal128_new_raw(&arrow_decimal128); } - G_DEFINE_TYPE(GArrowDecimal256Array, garrow_decimal256_array, GARROW_TYPE_FIXED_SIZE_BINARY_ARRAY) @@ -3355,8 +3169,7 @@ garrow_decimal256_array_class_init(GArrowDecimal256ArrayClass *klass) * Since: 3.0.0 */ gchar * -garrow_decimal256_array_format_value(GArrowDecimal256Array *array, - gint64 i) +garrow_decimal256_array_format_value(GArrowDecimal256Array *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); auto arrow_decimal256_array = @@ -3375,8 +3188,7 @@ garrow_decimal256_array_format_value(GArrowDecimal256Array *array, * Since: 3.0.0 */ GArrowDecimal256 * -garrow_decimal256_array_get_value(GArrowDecimal256Array *array, - gint64 i) +garrow_decimal256_array_get_value(GArrowDecimal256Array *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); auto arrow_decimal256_array = @@ -3386,8 +3198,8 @@ garrow_decimal256_array_get_value(GArrowDecimal256Array *array, return garrow_decimal256_new_raw(&arrow_decimal256); } - -typedef struct GArrowExtensionArrayPrivate_ { +typedef struct GArrowExtensionArrayPrivate_ +{ GArrowArray *storage; } GArrowExtensionArrayPrivate; @@ -3399,10 +3211,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowExtensionArray, garrow_extension_array, GARROW_TYPE_ARRAY) -#define GARROW_EXTENSION_ARRAY_GET_PRIVATE(obj) \ - static_cast( \ - garrow_extension_array_get_instance_private( \ - GARROW_EXTENSION_ARRAY(obj))) +#define GARROW_EXTENSION_ARRAY_GET_PRIVATE(obj) \ + static_cast( \ + garrow_extension_array_get_instance_private(GARROW_EXTENSION_ARRAY(obj))) static void garrow_extension_array_dispose(GObject *object) @@ -3463,17 +3274,17 @@ garrow_extension_array_class_init(GArrowExtensionArrayClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_extension_array_dispose; + gobject_class->dispose = garrow_extension_array_dispose; gobject_class->set_property = garrow_extension_array_set_property; gobject_class->get_property = garrow_extension_array_get_property; GParamSpec *spec; - spec = g_param_spec_object("storage", - "storage", - "The storage array", - GARROW_TYPE_ARRAY, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "storage", + "storage", + "The storage array", + GARROW_TYPE_ARRAY, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_STORAGE, spec); } @@ -3498,7 +3309,6 @@ garrow_extension_array_get_storage(GArrowExtensionArray *array) return garrow_array_new_raw(&(array_priv->array)); } - G_END_DECLS arrow::EqualOptions * @@ -3511,9 +3321,7 @@ garrow_equal_options_get_raw(GArrowEqualOptions *equal_options) GArrowArray * garrow_array_new_raw(std::shared_ptr *arrow_array) { - return garrow_array_new_raw(arrow_array, - "array", arrow_array, - NULL); + return garrow_array_new_raw(arrow_array, "array", arrow_array, NULL); } GArrowArray * @@ -3523,9 +3331,7 @@ garrow_array_new_raw(std::shared_ptr *arrow_array, { va_list args; va_start(args, first_property_name); - auto array = garrow_array_new_raw_valist(arrow_array, - first_property_name, - args); + auto array = garrow_array_new_raw_valist(arrow_array, first_property_name, args); va_end(args); return array; } @@ -3662,19 +3468,15 @@ garrow_array_new_raw_valist(std::shared_ptr *arrow_array, type = GARROW_TYPE_ARRAY; break; } - return GARROW_ARRAY(g_object_new_valist(type, - first_property_name, - args)); + return GARROW_ARRAY(g_object_new_valist(type, first_property_name, args)); } GArrowExtensionArray * garrow_extension_array_new_raw(std::shared_ptr *arrow_array, GArrowArray *storage) { - auto array = garrow_array_new_raw(arrow_array, - "array", arrow_array, - "storage", storage, - NULL); + auto array = + garrow_array_new_raw(arrow_array, "array", arrow_array, "storage", storage, NULL); return GARROW_EXTENSION_ARRAY(array); } diff --git a/c_glib/arrow-glib/basic-array.h b/c_glib/arrow-glib/basic-array.h index 1a846c2320a03..ee6f40b1ddc24 100644 --- a/c_glib/arrow-glib/basic-array.h +++ b/c_glib/arrow-glib/basic-array.h @@ -27,11 +27,8 @@ G_BEGIN_DECLS #define GARROW_TYPE_EQUAL_OPTIONS (garrow_equal_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowEqualOptions, - garrow_equal_options, - GARROW, - EQUAL_OPTIONS, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowEqualOptions, garrow_equal_options, GARROW, EQUAL_OPTIONS, GObject) struct _GArrowEqualOptionsClass { GObjectClass parent_class; @@ -44,12 +41,9 @@ GARROW_AVAILABLE_IN_5_0 gboolean garrow_equal_options_is_approx(GArrowEqualOptions *options); - GARROW_AVAILABLE_IN_6_0 GArrowArray * -garrow_array_import(gpointer c_abi_array, - GArrowDataType *data_type, - GError **error); +garrow_array_import(gpointer c_abi_array, GArrowDataType *data_type, GError **error); GARROW_AVAILABLE_IN_6_0 gboolean @@ -58,69 +52,67 @@ garrow_array_export(GArrowArray *array, gpointer *c_abi_schema, GError **error); -gboolean garrow_array_equal (GArrowArray *array, - GArrowArray *other_array); +gboolean +garrow_array_equal(GArrowArray *array, GArrowArray *other_array); GARROW_AVAILABLE_IN_5_0 -gboolean garrow_array_equal_options(GArrowArray *array, - GArrowArray *other_array, - GArrowEqualOptions *options); -gboolean garrow_array_equal_approx(GArrowArray *array, - GArrowArray *other_array); -gboolean garrow_array_equal_range (GArrowArray *array, - gint64 start_index, - GArrowArray *other_array, - gint64 other_start_index, - gint64 end_index, - GArrowEqualOptions *options); - -gboolean garrow_array_is_null (GArrowArray *array, - gint64 i); -gboolean garrow_array_is_valid (GArrowArray *array, - gint64 i); -gint64 garrow_array_get_length (GArrowArray *array); -gint64 garrow_array_get_offset (GArrowArray *array); -gint64 garrow_array_get_n_nulls (GArrowArray *array); -GArrowBuffer *garrow_array_get_null_bitmap(GArrowArray *array); -GArrowDataType *garrow_array_get_value_data_type(GArrowArray *array); -GArrowType garrow_array_get_value_type(GArrowArray *array); -GArrowArray *garrow_array_slice (GArrowArray *array, - gint64 offset, - gint64 length); -gchar *garrow_array_to_string (GArrowArray *array, - GError **error); +gboolean +garrow_array_equal_options(GArrowArray *array, + GArrowArray *other_array, + GArrowEqualOptions *options); +gboolean +garrow_array_equal_approx(GArrowArray *array, GArrowArray *other_array); +gboolean +garrow_array_equal_range(GArrowArray *array, + gint64 start_index, + GArrowArray *other_array, + gint64 other_start_index, + gint64 end_index, + GArrowEqualOptions *options); + +gboolean +garrow_array_is_null(GArrowArray *array, gint64 i); +gboolean +garrow_array_is_valid(GArrowArray *array, gint64 i); +gint64 +garrow_array_get_length(GArrowArray *array); +gint64 +garrow_array_get_offset(GArrowArray *array); +gint64 +garrow_array_get_n_nulls(GArrowArray *array); +GArrowBuffer * +garrow_array_get_null_bitmap(GArrowArray *array); +GArrowDataType * +garrow_array_get_value_data_type(GArrowArray *array); +GArrowType +garrow_array_get_value_type(GArrowArray *array); +GArrowArray * +garrow_array_slice(GArrowArray *array, gint64 offset, gint64 length); +gchar * +garrow_array_to_string(GArrowArray *array, GError **error); GARROW_AVAILABLE_IN_0_15 -GArrowArray *garrow_array_view(GArrowArray *array, - GArrowDataType *return_type, - GError **error); +GArrowArray * +garrow_array_view(GArrowArray *array, GArrowDataType *return_type, GError **error); GARROW_AVAILABLE_IN_0_15 -gchar *garrow_array_diff_unified(GArrowArray *array, - GArrowArray *other_array); +gchar * +garrow_array_diff_unified(GArrowArray *array, GArrowArray *other_array); GARROW_AVAILABLE_IN_4_0 -GArrowArray *garrow_array_concatenate(GArrowArray *array, - GList *other_arrays, - GError **error); - +GArrowArray * +garrow_array_concatenate(GArrowArray *array, GList *other_arrays, GError **error); #define GARROW_TYPE_NULL_ARRAY (garrow_null_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowNullArray, - garrow_null_array, - GARROW, - NULL_ARRAY, - GArrowArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowNullArray, garrow_null_array, GARROW, NULL_ARRAY, GArrowArray) struct _GArrowNullArrayClass { GArrowArrayClass parent_class; }; -GArrowNullArray *garrow_null_array_new(gint64 length); - +GArrowNullArray * +garrow_null_array_new(gint64 length); #define GARROW_TYPE_PRIMITIVE_ARRAY (garrow_primitive_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowPrimitiveArray, - garrow_primitive_array, - GARROW, - PRIMITIVE_ARRAY, - GArrowArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowPrimitiveArray, garrow_primitive_array, GARROW, PRIMITIVE_ARRAY, GArrowArray) struct _GArrowPrimitiveArrayClass { GArrowArrayClass parent_class; @@ -135,215 +127,184 @@ GARROW_AVAILABLE_IN_1_0 GArrowBuffer * garrow_primitive_array_get_data_buffer(GArrowPrimitiveArray *array); - #define GARROW_TYPE_BOOLEAN_ARRAY (garrow_boolean_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowBooleanArray, - garrow_boolean_array, - GARROW, - BOOLEAN_ARRAY, - GArrowPrimitiveArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowBooleanArray, garrow_boolean_array, GARROW, BOOLEAN_ARRAY, GArrowPrimitiveArray) struct _GArrowBooleanArrayClass { GArrowPrimitiveArrayClass parent_class; }; -GArrowBooleanArray *garrow_boolean_array_new(gint64 length, - GArrowBuffer *data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); +GArrowBooleanArray * +garrow_boolean_array_new(gint64 length, + GArrowBuffer *data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); -gboolean garrow_boolean_array_get_value (GArrowBooleanArray *array, - gint64 i); -gboolean *garrow_boolean_array_get_values(GArrowBooleanArray *array, - gint64 *length); +gboolean +garrow_boolean_array_get_value(GArrowBooleanArray *array, gint64 i); +gboolean * +garrow_boolean_array_get_values(GArrowBooleanArray *array, gint64 *length); #define GARROW_TYPE_NUMERIC_ARRAY (garrow_numeric_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowNumericArray, - garrow_numeric_array, - GARROW, - NUMERIC_ARRAY, - GArrowPrimitiveArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowNumericArray, garrow_numeric_array, GARROW, NUMERIC_ARRAY, GArrowPrimitiveArray) struct _GArrowNumericArrayClass { GArrowPrimitiveArrayClass parent_class; }; - #define GARROW_TYPE_INT8_ARRAY (garrow_int8_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowInt8Array, - garrow_int8_array, - GARROW, - INT8_ARRAY, - GArrowNumericArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowInt8Array, garrow_int8_array, GARROW, INT8_ARRAY, GArrowNumericArray) struct _GArrowInt8ArrayClass { GArrowNumericArrayClass parent_class; }; -GArrowInt8Array *garrow_int8_array_new(gint64 length, - GArrowBuffer *data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); - -gint8 garrow_int8_array_get_value(GArrowInt8Array *array, - gint64 i); -const gint8 *garrow_int8_array_get_values(GArrowInt8Array *array, - gint64 *length); +GArrowInt8Array * +garrow_int8_array_new(gint64 length, + GArrowBuffer *data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); +gint8 +garrow_int8_array_get_value(GArrowInt8Array *array, gint64 i); +const gint8 * +garrow_int8_array_get_values(GArrowInt8Array *array, gint64 *length); #define GARROW_TYPE_UINT8_ARRAY (garrow_uint8_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowUInt8Array, - garrow_uint8_array, - GARROW, - UINT8_ARRAY, - GArrowNumericArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowUInt8Array, garrow_uint8_array, GARROW, UINT8_ARRAY, GArrowNumericArray) struct _GArrowUInt8ArrayClass { GArrowNumericArrayClass parent_class; }; -GArrowUInt8Array *garrow_uint8_array_new(gint64 length, - GArrowBuffer *data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); - -guint8 garrow_uint8_array_get_value(GArrowUInt8Array *array, - gint64 i); -const guint8 *garrow_uint8_array_get_values(GArrowUInt8Array *array, - gint64 *length); +GArrowUInt8Array * +garrow_uint8_array_new(gint64 length, + GArrowBuffer *data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); +guint8 +garrow_uint8_array_get_value(GArrowUInt8Array *array, gint64 i); +const guint8 * +garrow_uint8_array_get_values(GArrowUInt8Array *array, gint64 *length); #define GARROW_TYPE_INT16_ARRAY (garrow_int16_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowInt16Array, - garrow_int16_array, - GARROW, - INT16_ARRAY, - GArrowNumericArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowInt16Array, garrow_int16_array, GARROW, INT16_ARRAY, GArrowNumericArray) struct _GArrowInt16ArrayClass { GArrowNumericArrayClass parent_class; }; -GArrowInt16Array *garrow_int16_array_new(gint64 length, - GArrowBuffer *data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); - -gint16 garrow_int16_array_get_value(GArrowInt16Array *array, - gint64 i); -const gint16 *garrow_int16_array_get_values(GArrowInt16Array *array, - gint64 *length); +GArrowInt16Array * +garrow_int16_array_new(gint64 length, + GArrowBuffer *data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); +gint16 +garrow_int16_array_get_value(GArrowInt16Array *array, gint64 i); +const gint16 * +garrow_int16_array_get_values(GArrowInt16Array *array, gint64 *length); #define GARROW_TYPE_UINT16_ARRAY (garrow_uint16_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowUInt16Array, - garrow_uint16_array, - GARROW, - UINT16_ARRAY, - GArrowNumericArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowUInt16Array, garrow_uint16_array, GARROW, UINT16_ARRAY, GArrowNumericArray) struct _GArrowUInt16ArrayClass { GArrowNumericArrayClass parent_class; }; -GArrowUInt16Array *garrow_uint16_array_new(gint64 length, - GArrowBuffer *data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); - -guint16 garrow_uint16_array_get_value(GArrowUInt16Array *array, - gint64 i); -const guint16 *garrow_uint16_array_get_values(GArrowUInt16Array *array, - gint64 *length); +GArrowUInt16Array * +garrow_uint16_array_new(gint64 length, + GArrowBuffer *data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); +guint16 +garrow_uint16_array_get_value(GArrowUInt16Array *array, gint64 i); +const guint16 * +garrow_uint16_array_get_values(GArrowUInt16Array *array, gint64 *length); #define GARROW_TYPE_INT32_ARRAY (garrow_int32_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowInt32Array, - garrow_int32_array, - GARROW, - INT32_ARRAY, - GArrowNumericArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowInt32Array, garrow_int32_array, GARROW, INT32_ARRAY, GArrowNumericArray) struct _GArrowInt32ArrayClass { GArrowNumericArrayClass parent_class; }; -GArrowInt32Array *garrow_int32_array_new(gint64 length, - GArrowBuffer *data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); - -gint32 garrow_int32_array_get_value(GArrowInt32Array *array, - gint64 i); -const gint32 *garrow_int32_array_get_values(GArrowInt32Array *array, - gint64 *length); +GArrowInt32Array * +garrow_int32_array_new(gint64 length, + GArrowBuffer *data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); +gint32 +garrow_int32_array_get_value(GArrowInt32Array *array, gint64 i); +const gint32 * +garrow_int32_array_get_values(GArrowInt32Array *array, gint64 *length); #define GARROW_TYPE_UINT32_ARRAY (garrow_uint32_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowUInt32Array, - garrow_uint32_array, - GARROW, - UINT32_ARRAY, - GArrowNumericArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowUInt32Array, garrow_uint32_array, GARROW, UINT32_ARRAY, GArrowNumericArray) struct _GArrowUInt32ArrayClass { GArrowNumericArrayClass parent_class; }; -GArrowUInt32Array *garrow_uint32_array_new(gint64 length, - GArrowBuffer *data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); - -guint32 garrow_uint32_array_get_value(GArrowUInt32Array *array, - gint64 i); -const guint32 *garrow_uint32_array_get_values(GArrowUInt32Array *array, - gint64 *length); +GArrowUInt32Array * +garrow_uint32_array_new(gint64 length, + GArrowBuffer *data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); +guint32 +garrow_uint32_array_get_value(GArrowUInt32Array *array, gint64 i); +const guint32 * +garrow_uint32_array_get_values(GArrowUInt32Array *array, gint64 *length); #define GARROW_TYPE_INT64_ARRAY (garrow_int64_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowInt64Array, - garrow_int64_array, - GARROW, - INT64_ARRAY, - GArrowNumericArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowInt64Array, garrow_int64_array, GARROW, INT64_ARRAY, GArrowNumericArray) struct _GArrowInt64ArrayClass { GArrowNumericArrayClass parent_class; }; -GArrowInt64Array *garrow_int64_array_new(gint64 length, - GArrowBuffer *data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); - -gint64 garrow_int64_array_get_value(GArrowInt64Array *array, - gint64 i); -const gint64 *garrow_int64_array_get_values(GArrowInt64Array *array, - gint64 *length); +GArrowInt64Array * +garrow_int64_array_new(gint64 length, + GArrowBuffer *data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); +gint64 +garrow_int64_array_get_value(GArrowInt64Array *array, gint64 i); +const gint64 * +garrow_int64_array_get_values(GArrowInt64Array *array, gint64 *length); #define GARROW_TYPE_UINT64_ARRAY (garrow_uint64_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowUInt64Array, - garrow_uint64_array, - GARROW, - UINT64_ARRAY, - GArrowNumericArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowUInt64Array, garrow_uint64_array, GARROW, UINT64_ARRAY, GArrowNumericArray) struct _GArrowUInt64ArrayClass { GArrowNumericArrayClass parent_class; }; -GArrowUInt64Array *garrow_uint64_array_new(gint64 length, - GArrowBuffer *data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); - -guint64 garrow_uint64_array_get_value(GArrowUInt64Array *array, - gint64 i); -const guint64 *garrow_uint64_array_get_values(GArrowUInt64Array *array, - gint64 *length); +GArrowUInt64Array * +garrow_uint64_array_new(gint64 length, + GArrowBuffer *data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); +guint64 +garrow_uint64_array_get_value(GArrowUInt64Array *array, gint64 i); +const guint64 * +garrow_uint64_array_get_values(GArrowUInt64Array *array, gint64 *length); #define GARROW_TYPE_HALF_FLOAT_ARRAY (garrow_half_float_array_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowHalfFloatArray, @@ -356,7 +317,6 @@ struct _GArrowHalfFloatArrayClass GArrowNumericArrayClass parent_class; }; - GARROW_AVAILABLE_IN_11_0 GArrowHalfFloatArray * garrow_half_float_array_new(gint64 length, @@ -366,85 +326,76 @@ garrow_half_float_array_new(gint64 length, GARROW_AVAILABLE_IN_11_0 guint16 -garrow_half_float_array_get_value(GArrowHalfFloatArray *array, - gint64 i); +garrow_half_float_array_get_value(GArrowHalfFloatArray *array, gint64 i); GARROW_AVAILABLE_IN_11_0 -const guint16* -garrow_half_float_array_get_values(GArrowHalfFloatArray *array, - gint64 *length); - +const guint16 * +garrow_half_float_array_get_values(GArrowHalfFloatArray *array, gint64 *length); #define GARROW_TYPE_FLOAT_ARRAY (garrow_float_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowFloatArray, - garrow_float_array, - GARROW, - FLOAT_ARRAY, - GArrowNumericArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowFloatArray, garrow_float_array, GARROW, FLOAT_ARRAY, GArrowNumericArray) struct _GArrowFloatArrayClass { GArrowNumericArrayClass parent_class; }; -GArrowFloatArray *garrow_float_array_new(gint64 length, - GArrowBuffer *data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); - -gfloat garrow_float_array_get_value(GArrowFloatArray *array, - gint64 i); -const gfloat *garrow_float_array_get_values(GArrowFloatArray *array, - gint64 *length); +GArrowFloatArray * +garrow_float_array_new(gint64 length, + GArrowBuffer *data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); +gfloat +garrow_float_array_get_value(GArrowFloatArray *array, gint64 i); +const gfloat * +garrow_float_array_get_values(GArrowFloatArray *array, gint64 *length); #define GARROW_TYPE_DOUBLE_ARRAY (garrow_double_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowDoubleArray, - garrow_double_array, - GARROW, - DOUBLE_ARRAY, - GArrowNumericArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowDoubleArray, garrow_double_array, GARROW, DOUBLE_ARRAY, GArrowNumericArray) struct _GArrowDoubleArrayClass { GArrowNumericArrayClass parent_class; }; -GArrowDoubleArray *garrow_double_array_new(gint64 length, - GArrowBuffer *data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); - -gdouble garrow_double_array_get_value(GArrowDoubleArray *array, - gint64 i); -const gdouble *garrow_double_array_get_values(GArrowDoubleArray *array, - gint64 *length); +GArrowDoubleArray * +garrow_double_array_new(gint64 length, + GArrowBuffer *data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); +gdouble +garrow_double_array_get_value(GArrowDoubleArray *array, gint64 i); +const gdouble * +garrow_double_array_get_values(GArrowDoubleArray *array, gint64 *length); #define GARROW_TYPE_BINARY_ARRAY (garrow_binary_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowBinaryArray, - garrow_binary_array, - GARROW, - BINARY_ARRAY, - GArrowArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowBinaryArray, garrow_binary_array, GARROW, BINARY_ARRAY, GArrowArray) struct _GArrowBinaryArrayClass { GArrowArrayClass parent_class; }; -GArrowBinaryArray *garrow_binary_array_new(gint64 length, - GArrowBuffer *value_offsets, - GArrowBuffer *value_data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); +GArrowBinaryArray * +garrow_binary_array_new(gint64 length, + GArrowBuffer *value_offsets, + GArrowBuffer *value_data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); -GBytes *garrow_binary_array_get_value(GArrowBinaryArray *array, - gint64 i); +GBytes * +garrow_binary_array_get_value(GArrowBinaryArray *array, gint64 i); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_1_0_FOR(garrow_binary_array_get_data_buffer) -GArrowBuffer *garrow_binary_array_get_buffer(GArrowBinaryArray *array); +GArrowBuffer * +garrow_binary_array_get_buffer(GArrowBinaryArray *array); #endif GARROW_AVAILABLE_IN_1_0 -GArrowBuffer *garrow_binary_array_get_data_buffer(GArrowBinaryArray *array); -GArrowBuffer *garrow_binary_array_get_offsets_buffer(GArrowBinaryArray *array); - +GArrowBuffer * +garrow_binary_array_get_data_buffer(GArrowBinaryArray *array); +GArrowBuffer * +garrow_binary_array_get_offsets_buffer(GArrowBinaryArray *array); #define GARROW_TYPE_LARGE_BINARY_ARRAY (garrow_large_binary_array_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowLargeBinaryArray, @@ -458,15 +409,16 @@ struct _GArrowLargeBinaryArrayClass }; GARROW_AVAILABLE_IN_0_16 -GArrowLargeBinaryArray *garrow_large_binary_array_new(gint64 length, - GArrowBuffer *value_offsets, - GArrowBuffer *value_data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); +GArrowLargeBinaryArray * +garrow_large_binary_array_new(gint64 length, + GArrowBuffer *value_offsets, + GArrowBuffer *value_data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); GARROW_AVAILABLE_IN_0_16 -GBytes *garrow_large_binary_array_get_value(GArrowLargeBinaryArray *array, - gint64 i); +GBytes * +garrow_large_binary_array_get_value(GArrowLargeBinaryArray *array, gint64 i); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_1_0_FOR(garrow_large_binary_array_get_data_buffer) GARROW_AVAILABLE_IN_0_16 @@ -477,29 +429,26 @@ GARROW_AVAILABLE_IN_1_0 GArrowBuffer * garrow_large_binary_array_get_data_buffer(GArrowLargeBinaryArray *array); GARROW_AVAILABLE_IN_0_16 -GArrowBuffer *garrow_large_binary_array_get_offsets_buffer(GArrowLargeBinaryArray *array); - +GArrowBuffer * +garrow_large_binary_array_get_offsets_buffer(GArrowLargeBinaryArray *array); #define GARROW_TYPE_STRING_ARRAY (garrow_string_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowStringArray, - garrow_string_array, - GARROW, - STRING_ARRAY, - GArrowBinaryArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowStringArray, garrow_string_array, GARROW, STRING_ARRAY, GArrowBinaryArray) struct _GArrowStringArrayClass { GArrowBinaryArrayClass parent_class; }; -GArrowStringArray *garrow_string_array_new(gint64 length, - GArrowBuffer *value_offsets, - GArrowBuffer *value_data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); - -gchar *garrow_string_array_get_string(GArrowStringArray *array, - gint64 i); +GArrowStringArray * +garrow_string_array_new(gint64 length, + GArrowBuffer *value_offsets, + GArrowBuffer *value_data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); +gchar * +garrow_string_array_get_string(GArrowStringArray *array, gint64 i); #define GARROW_TYPE_LARGE_STRING_ARRAY (garrow_large_string_array_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowLargeStringArray, @@ -513,60 +462,54 @@ struct _GArrowLargeStringArrayClass }; GARROW_AVAILABLE_IN_0_16 -GArrowLargeStringArray *garrow_large_string_array_new(gint64 length, - GArrowBuffer *value_offsets, - GArrowBuffer *value_data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); +GArrowLargeStringArray * +garrow_large_string_array_new(gint64 length, + GArrowBuffer *value_offsets, + GArrowBuffer *value_data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); GARROW_AVAILABLE_IN_0_16 -gchar *garrow_large_string_array_get_string(GArrowLargeStringArray *array, - gint64 i); - +gchar * +garrow_large_string_array_get_string(GArrowLargeStringArray *array, gint64 i); #define GARROW_TYPE_DATE32_ARRAY (garrow_date32_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowDate32Array, - garrow_date32_array, - GARROW, - DATE32_ARRAY, - GArrowNumericArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowDate32Array, garrow_date32_array, GARROW, DATE32_ARRAY, GArrowNumericArray) struct _GArrowDate32ArrayClass { GArrowNumericArrayClass parent_class; }; -GArrowDate32Array *garrow_date32_array_new(gint64 length, - GArrowBuffer *data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); - -gint32 garrow_date32_array_get_value(GArrowDate32Array *array, - gint64 i); -const gint32 *garrow_date32_array_get_values(GArrowDate32Array *array, - gint64 *length); +GArrowDate32Array * +garrow_date32_array_new(gint64 length, + GArrowBuffer *data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); +gint32 +garrow_date32_array_get_value(GArrowDate32Array *array, gint64 i); +const gint32 * +garrow_date32_array_get_values(GArrowDate32Array *array, gint64 *length); #define GARROW_TYPE_DATE64_ARRAY (garrow_date64_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowDate64Array, - garrow_date64_array, - GARROW, - DATE64_ARRAY, - GArrowNumericArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowDate64Array, garrow_date64_array, GARROW, DATE64_ARRAY, GArrowNumericArray) struct _GArrowDate64ArrayClass { GArrowNumericArrayClass parent_class; }; -GArrowDate64Array *garrow_date64_array_new(gint64 length, - GArrowBuffer *data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); - -gint64 garrow_date64_array_get_value(GArrowDate64Array *array, - gint64 i); -const gint64 *garrow_date64_array_get_values(GArrowDate64Array *array, - gint64 *length); +GArrowDate64Array * +garrow_date64_array_new(gint64 length, + GArrowBuffer *data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); +gint64 +garrow_date64_array_get_value(GArrowDate64Array *array, gint64 i); +const gint64 * +garrow_date64_array_get_values(GArrowDate64Array *array, gint64 *length); #define GARROW_TYPE_TIMESTAMP_ARRAY (garrow_timestamp_array_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowTimestampArray, @@ -579,66 +522,59 @@ struct _GArrowTimestampArrayClass GArrowNumericArrayClass parent_class; }; -GArrowTimestampArray *garrow_timestamp_array_new(GArrowTimestampDataType *data_type, - gint64 length, - GArrowBuffer *data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); - -gint64 garrow_timestamp_array_get_value(GArrowTimestampArray *array, - gint64 i); -const gint64 *garrow_timestamp_array_get_values(GArrowTimestampArray *array, - gint64 *length); +GArrowTimestampArray * +garrow_timestamp_array_new(GArrowTimestampDataType *data_type, + gint64 length, + GArrowBuffer *data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); +gint64 +garrow_timestamp_array_get_value(GArrowTimestampArray *array, gint64 i); +const gint64 * +garrow_timestamp_array_get_values(GArrowTimestampArray *array, gint64 *length); #define GARROW_TYPE_TIME32_ARRAY (garrow_time32_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowTime32Array, - garrow_time32_array, - GARROW, - TIME32_ARRAY, - GArrowNumericArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowTime32Array, garrow_time32_array, GARROW, TIME32_ARRAY, GArrowNumericArray) struct _GArrowTime32ArrayClass { GArrowNumericArrayClass parent_class; }; -GArrowTime32Array *garrow_time32_array_new(GArrowTime32DataType *data_type, - gint64 length, - GArrowBuffer *data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); - -gint32 garrow_time32_array_get_value(GArrowTime32Array *array, - gint64 i); -const gint32 *garrow_time32_array_get_values(GArrowTime32Array *array, - gint64 *length); +GArrowTime32Array * +garrow_time32_array_new(GArrowTime32DataType *data_type, + gint64 length, + GArrowBuffer *data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); +gint32 +garrow_time32_array_get_value(GArrowTime32Array *array, gint64 i); +const gint32 * +garrow_time32_array_get_values(GArrowTime32Array *array, gint64 *length); #define GARROW_TYPE_TIME64_ARRAY (garrow_time64_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowTime64Array, - garrow_time64_array, - GARROW, - TIME64_ARRAY, - GArrowNumericArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowTime64Array, garrow_time64_array, GARROW, TIME64_ARRAY, GArrowNumericArray) struct _GArrowTime64ArrayClass { GArrowNumericArrayClass parent_class; }; -GArrowTime64Array *garrow_time64_array_new(GArrowTime64DataType *data_type, - gint64 length, - GArrowBuffer *data, - GArrowBuffer *null_bitmap, - gint64 n_nulls); - -gint64 garrow_time64_array_get_value(GArrowTime64Array *array, - gint64 i); -const gint64 *garrow_time64_array_get_values(GArrowTime64Array *array, - gint64 *length); +GArrowTime64Array * +garrow_time64_array_new(GArrowTime64DataType *data_type, + gint64 length, + GArrowBuffer *data, + GArrowBuffer *null_bitmap, + gint64 n_nulls); +gint64 +garrow_time64_array_get_value(GArrowTime64Array *array, gint64 i); +const gint64 * +garrow_time64_array_get_values(GArrowTime64Array *array, gint64 *length); -#define GARROW_TYPE_MONTH_INTERVAL_ARRAY \ - (garrow_month_interval_array_get_type()) +#define GARROW_TYPE_MONTH_INTERVAL_ARRAY (garrow_month_interval_array_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowMonthIntervalArray, garrow_month_interval_array, GARROW, @@ -657,16 +593,12 @@ garrow_month_interval_array_new(gint64 length, gint64 n_nulls); GARROW_AVAILABLE_IN_8_0 gint32 -garrow_month_interval_array_get_value(GArrowMonthIntervalArray *array, - gint64 i); +garrow_month_interval_array_get_value(GArrowMonthIntervalArray *array, gint64 i); GARROW_AVAILABLE_IN_8_0 const gint32 * -garrow_month_interval_array_get_values(GArrowMonthIntervalArray *array, - gint64 *length); +garrow_month_interval_array_get_values(GArrowMonthIntervalArray *array, gint64 *length); - -#define GARROW_TYPE_DAY_TIME_INTERVAL_ARRAY \ - (garrow_day_time_interval_array_get_type()) +#define GARROW_TYPE_DAY_TIME_INTERVAL_ARRAY (garrow_day_time_interval_array_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDayTimeIntervalArray, garrow_day_time_interval_array, GARROW, @@ -685,14 +617,12 @@ garrow_day_time_interval_array_new(gint64 length, gint64 n_nulls); GARROW_AVAILABLE_IN_8_0 GArrowDayMillisecond * -garrow_day_time_interval_array_get_value(GArrowDayTimeIntervalArray *array, - gint64 i); +garrow_day_time_interval_array_get_value(GArrowDayTimeIntervalArray *array, gint64 i); GARROW_AVAILABLE_IN_8_0 GList * garrow_day_time_interval_array_get_values(GArrowDayTimeIntervalArray *array); - -#define GARROW_TYPE_MONTH_DAY_NANO_INTERVAL_ARRAY \ +#define GARROW_TYPE_MONTH_DAY_NANO_INTERVAL_ARRAY \ (garrow_month_day_nano_interval_array_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowMonthDayNanoIntervalArray, garrow_month_day_nano_interval_array, @@ -712,14 +642,11 @@ garrow_month_day_nano_interval_array_new(gint64 length, gint64 n_nulls); GARROW_AVAILABLE_IN_8_0 GArrowMonthDayNano * -garrow_month_day_nano_interval_array_get_value( - GArrowMonthDayNanoIntervalArray *array, - gint64 i); +garrow_month_day_nano_interval_array_get_value(GArrowMonthDayNanoIntervalArray *array, + gint64 i); GARROW_AVAILABLE_IN_8_0 GList * -garrow_month_day_nano_interval_array_get_values( - GArrowMonthDayNanoIntervalArray *array); - +garrow_month_day_nano_interval_array_get_values(GArrowMonthDayNanoIntervalArray *array); #define GARROW_TYPE_FIXED_SIZE_BINARY_ARRAY (garrow_fixed_size_binary_array_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowFixedSizeBinaryArray, @@ -744,13 +671,11 @@ gint32 garrow_fixed_size_binary_array_get_byte_width(GArrowFixedSizeBinaryArray *array); GARROW_AVAILABLE_IN_3_0 GBytes * -garrow_fixed_size_binary_array_get_value(GArrowFixedSizeBinaryArray *array, - gint64 i); +garrow_fixed_size_binary_array_get_value(GArrowFixedSizeBinaryArray *array, gint64 i); GARROW_AVAILABLE_IN_3_0 GBytes * garrow_fixed_size_binary_array_get_values_bytes(GArrowFixedSizeBinaryArray *array); - #define GARROW_TYPE_DECIMAL128_ARRAY (garrow_decimal128_array_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDecimal128Array, garrow_decimal128_array, @@ -762,10 +687,10 @@ struct _GArrowDecimal128ArrayClass GArrowFixedSizeBinaryArrayClass parent_class; }; -gchar *garrow_decimal128_array_format_value(GArrowDecimal128Array *array, - gint64 i); -GArrowDecimal128 *garrow_decimal128_array_get_value(GArrowDecimal128Array *array, - gint64 i); +gchar * +garrow_decimal128_array_format_value(GArrowDecimal128Array *array, gint64 i); +GArrowDecimal128 * +garrow_decimal128_array_get_value(GArrowDecimal128Array *array, gint64 i); #define GARROW_TYPE_DECIMAL256_ARRAY (garrow_decimal256_array_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDecimal256Array, @@ -778,15 +703,13 @@ struct _GArrowDecimal256ArrayClass GArrowFixedSizeBinaryArrayClass parent_class; }; -gchar *garrow_decimal256_array_format_value(GArrowDecimal256Array *array, - gint64 i); -GArrowDecimal256 *garrow_decimal256_array_get_value(GArrowDecimal256Array *array, - gint64 i); - +gchar * +garrow_decimal256_array_format_value(GArrowDecimal256Array *array, gint64 i); +GArrowDecimal256 * +garrow_decimal256_array_get_value(GArrowDecimal256Array *array, gint64 i); GARROW_AVAILABLE_IN_3_0 GArrowArray * garrow_extension_array_get_storage(GArrowExtensionArray *array); - G_END_DECLS diff --git a/c_glib/arrow-glib/basic-array.hpp b/c_glib/arrow-glib/basic-array.hpp index 3ef1c1969767f..f010cf3db4bc3 100644 --- a/c_glib/arrow-glib/basic-array.hpp +++ b/c_glib/arrow-glib/basic-array.hpp @@ -44,7 +44,9 @@ garrow_array_get_raw(GArrowArray *array); template inline std::shared_ptr::ArrayType> -garrow_array_get_raw(GArrowArray *array) { +garrow_array_get_raw(GArrowArray *array) +{ auto arrow_array = garrow_array_get_raw(array); - return std::static_pointer_cast::ArrayType>(arrow_array); + return std::static_pointer_cast::ArrayType>( + arrow_array); } diff --git a/c_glib/arrow-glib/basic-data-type.cpp b/c_glib/arrow-glib/basic-data-type.cpp index 98b2c92104507..36646a9733cd3 100644 --- a/c_glib/arrow-glib/basic-data-type.cpp +++ b/c_glib/arrow-glib/basic-data-type.cpp @@ -125,7 +125,8 @@ G_BEGIN_DECLS * data types. */ -struct GArrowDataTypePrivate { +struct GArrowDataTypePrivate +{ std::shared_ptr data_type; }; @@ -133,14 +134,11 @@ enum { PROP_DATA_TYPE = 1 }; -G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowDataType, - garrow_data_type, - G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowDataType, garrow_data_type, G_TYPE_OBJECT) -#define GARROW_DATA_TYPE_GET_PRIVATE(obj) \ - static_cast( \ - garrow_data_type_get_instance_private( \ - GARROW_DATA_TYPE(obj))) +#define GARROW_DATA_TYPE_GET_PRIVATE(obj) \ + static_cast( \ + garrow_data_type_get_instance_private(GARROW_DATA_TYPE(obj))) static void garrow_data_type_finalize(GObject *object) @@ -165,8 +163,7 @@ garrow_data_type_set_property(GObject *object, { auto data_type = g_value_get_pointer(value); if (data_type) { - priv->data_type = - *static_cast *>(data_type); + priv->data_type = *static_cast *>(data_type); } } break; @@ -193,7 +190,7 @@ static void garrow_data_type_init(GArrowDataType *object) { auto priv = GARROW_DATA_TYPE_GET_PRIVATE(object); - new(&priv->data_type) std::shared_ptr; + new (&priv->data_type) std::shared_ptr; } static void @@ -204,15 +201,15 @@ garrow_data_type_class_init(GArrowDataTypeClass *klass) gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_data_type_finalize; + gobject_class->finalize = garrow_data_type_finalize; gobject_class->set_property = garrow_data_type_set_property; gobject_class->get_property = garrow_data_type_get_property; - spec = g_param_spec_pointer("data-type", - "Data type", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "data-type", + "Data type", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_DATA_TYPE, spec); } @@ -277,8 +274,7 @@ garrow_data_type_export(GArrowDataType *data_type, GError **error) * otherwise. */ gboolean -garrow_data_type_equal(GArrowDataType *data_type, - GArrowDataType *other_data_type) +garrow_data_type_equal(GArrowDataType *data_type, GArrowDataType *other_data_type) { const auto arrow_data_type = garrow_data_type_get_raw(data_type); const auto arrow_other_data_type = garrow_data_type_get_raw(other_data_type); @@ -332,7 +328,6 @@ garrow_data_type_get_name(GArrowDataType *data_type) return g_strdup(name.c_str()); } - G_DEFINE_ABSTRACT_TYPE(GArrowFixedWidthDataType, garrow_fixed_width_data_type, GARROW_TYPE_DATA_TYPE) @@ -356,17 +351,13 @@ garrow_fixed_width_data_type_class_init(GArrowFixedWidthDataTypeClass *klass) gint garrow_fixed_width_data_type_get_bit_width(GArrowFixedWidthDataType *data_type) { - const auto arrow_data_type = - garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); + const auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); const auto arrow_fixed_width_type = std::static_pointer_cast(arrow_data_type); return arrow_fixed_width_type->bit_width(); } - -G_DEFINE_TYPE(GArrowNullDataType, - garrow_null_data_type, - GARROW_TYPE_DATA_TYPE) +G_DEFINE_TYPE(GArrowNullDataType, garrow_null_data_type, GARROW_TYPE_DATA_TYPE) static void garrow_null_data_type_init(GArrowNullDataType *object) @@ -388,14 +379,11 @@ garrow_null_data_type_new(void) { auto arrow_data_type = arrow::null(); - GArrowNullDataType *data_type = - GARROW_NULL_DATA_TYPE(g_object_new(GARROW_TYPE_NULL_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowNullDataType *data_type = GARROW_NULL_DATA_TYPE( + g_object_new(GARROW_TYPE_NULL_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - G_DEFINE_TYPE(GArrowBooleanDataType, garrow_boolean_data_type, GARROW_TYPE_FIXED_WIDTH_DATA_TYPE) @@ -420,14 +408,11 @@ garrow_boolean_data_type_new(void) { auto arrow_data_type = arrow::boolean(); - GArrowBooleanDataType *data_type = - GARROW_BOOLEAN_DATA_TYPE(g_object_new(GARROW_TYPE_BOOLEAN_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowBooleanDataType *data_type = GARROW_BOOLEAN_DATA_TYPE( + g_object_new(GARROW_TYPE_BOOLEAN_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - G_DEFINE_ABSTRACT_TYPE(GArrowNumericDataType, garrow_numeric_data_type, GARROW_TYPE_FIXED_WIDTH_DATA_TYPE) @@ -442,7 +427,6 @@ garrow_numeric_data_type_class_init(GArrowNumericDataTypeClass *klass) { } - G_DEFINE_ABSTRACT_TYPE(GArrowIntegerDataType, garrow_integer_data_type, GARROW_TYPE_NUMERIC_DATA_TYPE) @@ -468,16 +452,13 @@ garrow_integer_data_type_class_init(GArrowIntegerDataTypeClass *klass) gboolean garrow_integer_data_type_is_signed(GArrowIntegerDataType *data_type) { - const auto arrow_data_type = - garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); + const auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); const auto arrow_integer_type = std::static_pointer_cast(arrow_data_type); return arrow_integer_type->is_signed(); } -G_DEFINE_TYPE(GArrowInt8DataType, - garrow_int8_data_type, - GARROW_TYPE_INTEGER_DATA_TYPE) +G_DEFINE_TYPE(GArrowInt8DataType, garrow_int8_data_type, GARROW_TYPE_INTEGER_DATA_TYPE) static void garrow_int8_data_type_init(GArrowInt8DataType *object) @@ -499,17 +480,12 @@ garrow_int8_data_type_new(void) { auto arrow_data_type = arrow::int8(); - GArrowInt8DataType *data_type = - GARROW_INT8_DATA_TYPE(g_object_new(GARROW_TYPE_INT8_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowInt8DataType *data_type = GARROW_INT8_DATA_TYPE( + g_object_new(GARROW_TYPE_INT8_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - -G_DEFINE_TYPE(GArrowUInt8DataType, - garrow_uint8_data_type, - GARROW_TYPE_INTEGER_DATA_TYPE) +G_DEFINE_TYPE(GArrowUInt8DataType, garrow_uint8_data_type, GARROW_TYPE_INTEGER_DATA_TYPE) static void garrow_uint8_data_type_init(GArrowUInt8DataType *object) @@ -531,17 +507,12 @@ garrow_uint8_data_type_new(void) { auto arrow_data_type = arrow::uint8(); - GArrowUInt8DataType *data_type = - GARROW_UINT8_DATA_TYPE(g_object_new(GARROW_TYPE_UINT8_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowUInt8DataType *data_type = GARROW_UINT8_DATA_TYPE( + g_object_new(GARROW_TYPE_UINT8_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - -G_DEFINE_TYPE(GArrowInt16DataType, - garrow_int16_data_type, - GARROW_TYPE_INTEGER_DATA_TYPE) +G_DEFINE_TYPE(GArrowInt16DataType, garrow_int16_data_type, GARROW_TYPE_INTEGER_DATA_TYPE) static void garrow_int16_data_type_init(GArrowInt16DataType *object) @@ -563,14 +534,11 @@ garrow_int16_data_type_new(void) { auto arrow_data_type = arrow::int16(); - GArrowInt16DataType *data_type = - GARROW_INT16_DATA_TYPE(g_object_new(GARROW_TYPE_INT16_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowInt16DataType *data_type = GARROW_INT16_DATA_TYPE( + g_object_new(GARROW_TYPE_INT16_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - G_DEFINE_TYPE(GArrowUInt16DataType, garrow_uint16_data_type, GARROW_TYPE_INTEGER_DATA_TYPE) @@ -595,17 +563,12 @@ garrow_uint16_data_type_new(void) { auto arrow_data_type = arrow::uint16(); - GArrowUInt16DataType *data_type = - GARROW_UINT16_DATA_TYPE(g_object_new(GARROW_TYPE_UINT16_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowUInt16DataType *data_type = GARROW_UINT16_DATA_TYPE( + g_object_new(GARROW_TYPE_UINT16_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - -G_DEFINE_TYPE(GArrowInt32DataType, - garrow_int32_data_type, - GARROW_TYPE_INTEGER_DATA_TYPE) +G_DEFINE_TYPE(GArrowInt32DataType, garrow_int32_data_type, GARROW_TYPE_INTEGER_DATA_TYPE) static void garrow_int32_data_type_init(GArrowInt32DataType *object) @@ -627,14 +590,11 @@ garrow_int32_data_type_new(void) { auto arrow_data_type = arrow::int32(); - GArrowInt32DataType *data_type = - GARROW_INT32_DATA_TYPE(g_object_new(GARROW_TYPE_INT32_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowInt32DataType *data_type = GARROW_INT32_DATA_TYPE( + g_object_new(GARROW_TYPE_INT32_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - G_DEFINE_TYPE(GArrowUInt32DataType, garrow_uint32_data_type, GARROW_TYPE_INTEGER_DATA_TYPE) @@ -659,17 +619,12 @@ garrow_uint32_data_type_new(void) { auto arrow_data_type = arrow::uint32(); - GArrowUInt32DataType *data_type = - GARROW_UINT32_DATA_TYPE(g_object_new(GARROW_TYPE_UINT32_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowUInt32DataType *data_type = GARROW_UINT32_DATA_TYPE( + g_object_new(GARROW_TYPE_UINT32_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - -G_DEFINE_TYPE(GArrowInt64DataType, - garrow_int64_data_type, - GARROW_TYPE_INTEGER_DATA_TYPE) +G_DEFINE_TYPE(GArrowInt64DataType, garrow_int64_data_type, GARROW_TYPE_INTEGER_DATA_TYPE) static void garrow_int64_data_type_init(GArrowInt64DataType *object) @@ -691,14 +646,11 @@ garrow_int64_data_type_new(void) { auto arrow_data_type = arrow::int64(); - GArrowInt64DataType *data_type = - GARROW_INT64_DATA_TYPE(g_object_new(GARROW_TYPE_INT64_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowInt64DataType *data_type = GARROW_INT64_DATA_TYPE( + g_object_new(GARROW_TYPE_INT64_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - G_DEFINE_TYPE(GArrowUInt64DataType, garrow_uint64_data_type, GARROW_TYPE_INTEGER_DATA_TYPE) @@ -723,14 +675,11 @@ garrow_uint64_data_type_new(void) { auto arrow_data_type = arrow::uint64(); - GArrowUInt64DataType *data_type = - GARROW_UINT64_DATA_TYPE(g_object_new(GARROW_TYPE_UINT64_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowUInt64DataType *data_type = GARROW_UINT64_DATA_TYPE( + g_object_new(GARROW_TYPE_UINT64_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - G_DEFINE_ABSTRACT_TYPE(GArrowFloatingPointDataType, garrow_floating_point_data_type, GARROW_TYPE_NUMERIC_DATA_TYPE) @@ -745,7 +694,6 @@ garrow_floating_point_data_type_class_init(GArrowFloatingPointDataTypeClass *kla { } - G_DEFINE_TYPE(GArrowHalfFloatDataType, garrow_half_float_data_type, GARROW_TYPE_FLOATING_POINT_DATA_TYPE) @@ -771,14 +719,11 @@ GArrowHalfFloatDataType * garrow_half_float_data_type_new(void) { auto arrow_data_type = arrow::float16(); - auto data_type = - GARROW_HALF_FLOAT_DATA_TYPE(g_object_new(GARROW_TYPE_HALF_FLOAT_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + auto data_type = GARROW_HALF_FLOAT_DATA_TYPE( + g_object_new(GARROW_TYPE_HALF_FLOAT_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - G_DEFINE_TYPE(GArrowFloatDataType, garrow_float_data_type, GARROW_TYPE_FLOATING_POINT_DATA_TYPE) @@ -803,14 +748,11 @@ garrow_float_data_type_new(void) { auto arrow_data_type = arrow::float32(); - GArrowFloatDataType *data_type = - GARROW_FLOAT_DATA_TYPE(g_object_new(GARROW_TYPE_FLOAT_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowFloatDataType *data_type = GARROW_FLOAT_DATA_TYPE( + g_object_new(GARROW_TYPE_FLOAT_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - G_DEFINE_TYPE(GArrowDoubleDataType, garrow_double_data_type, GARROW_TYPE_FLOATING_POINT_DATA_TYPE) @@ -835,17 +777,12 @@ garrow_double_data_type_new(void) { auto arrow_data_type = arrow::float64(); - GArrowDoubleDataType *data_type = - GARROW_DOUBLE_DATA_TYPE(g_object_new(GARROW_TYPE_DOUBLE_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowDoubleDataType *data_type = GARROW_DOUBLE_DATA_TYPE( + g_object_new(GARROW_TYPE_DOUBLE_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - -G_DEFINE_TYPE(GArrowBinaryDataType, - garrow_binary_data_type, - GARROW_TYPE_DATA_TYPE) +G_DEFINE_TYPE(GArrowBinaryDataType, garrow_binary_data_type, GARROW_TYPE_DATA_TYPE) static void garrow_binary_data_type_init(GArrowBinaryDataType *object) @@ -867,14 +804,11 @@ garrow_binary_data_type_new(void) { auto arrow_data_type = arrow::binary(); - GArrowBinaryDataType *data_type = - GARROW_BINARY_DATA_TYPE(g_object_new(GARROW_TYPE_BINARY_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowBinaryDataType *data_type = GARROW_BINARY_DATA_TYPE( + g_object_new(GARROW_TYPE_BINARY_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - G_DEFINE_TYPE(GArrowFixedSizeBinaryDataType, garrow_fixed_size_binary_data_type, GARROW_TYPE_FIXED_WIDTH_DATA_TYPE) @@ -902,10 +836,11 @@ garrow_fixed_size_binary_data_type_new(gint32 byte_width) { auto arrow_fixed_size_binary_data_type = arrow::fixed_size_binary(byte_width); - auto fixed_size_binary_data_type = - GARROW_FIXED_SIZE_BINARY_DATA_TYPE(g_object_new(GARROW_TYPE_FIXED_SIZE_BINARY_DATA_TYPE, - "data-type", &arrow_fixed_size_binary_data_type, - NULL)); + auto fixed_size_binary_data_type = GARROW_FIXED_SIZE_BINARY_DATA_TYPE( + g_object_new(GARROW_TYPE_FIXED_SIZE_BINARY_DATA_TYPE, + "data-type", + &arrow_fixed_size_binary_data_type, + NULL)); return fixed_size_binary_data_type; } @@ -918,16 +853,15 @@ garrow_fixed_size_binary_data_type_new(gint32 byte_width) * Since: 0.12.0 */ gint32 -garrow_fixed_size_binary_data_type_get_byte_width(GArrowFixedSizeBinaryDataType *data_type) +garrow_fixed_size_binary_data_type_get_byte_width( + GArrowFixedSizeBinaryDataType *data_type) { - const auto arrow_data_type = - garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); + const auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); const auto arrow_fixed_size_binary_type = std::static_pointer_cast(arrow_data_type); return arrow_fixed_size_binary_type->byte_width(); } - G_DEFINE_TYPE(GArrowLargeBinaryDataType, garrow_large_binary_data_type, GARROW_TYPE_DATA_TYPE) @@ -956,15 +890,13 @@ garrow_large_binary_data_type_new(void) GArrowLargeBinaryDataType *data_type = GARROW_LARGE_BINARY_DATA_TYPE(g_object_new(GARROW_TYPE_LARGE_BINARY_DATA_TYPE, - "data-type", &arrow_data_type, + "data-type", + &arrow_data_type, NULL)); return data_type; } - -G_DEFINE_TYPE(GArrowStringDataType, - garrow_string_data_type, - GARROW_TYPE_DATA_TYPE) +G_DEFINE_TYPE(GArrowStringDataType, garrow_string_data_type, GARROW_TYPE_DATA_TYPE) static void garrow_string_data_type_init(GArrowStringDataType *object) @@ -986,14 +918,11 @@ garrow_string_data_type_new(void) { auto arrow_data_type = arrow::utf8(); - GArrowStringDataType *data_type = - GARROW_STRING_DATA_TYPE(g_object_new(GARROW_TYPE_STRING_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowStringDataType *data_type = GARROW_STRING_DATA_TYPE( + g_object_new(GARROW_TYPE_STRING_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - G_DEFINE_TYPE(GArrowLargeStringDataType, garrow_large_string_data_type, GARROW_TYPE_DATA_TYPE) @@ -1022,12 +951,12 @@ garrow_large_string_data_type_new(void) GArrowLargeStringDataType *data_type = GARROW_LARGE_STRING_DATA_TYPE(g_object_new(GARROW_TYPE_LARGE_STRING_DATA_TYPE, - "data-type", &arrow_data_type, + "data-type", + &arrow_data_type, NULL)); return data_type; } - G_DEFINE_ABSTRACT_TYPE(GArrowTemporalDataType, garrow_temporal_data_type, GARROW_TYPE_FIXED_WIDTH_DATA_TYPE) @@ -1042,7 +971,6 @@ garrow_temporal_data_type_class_init(GArrowTemporalDataTypeClass *klass) { } - G_DEFINE_TYPE(GArrowDate32DataType, garrow_date32_data_type, GARROW_TYPE_TEMPORAL_DATA_TYPE) @@ -1070,14 +998,11 @@ garrow_date32_data_type_new(void) { auto arrow_data_type = arrow::date32(); - GArrowDate32DataType *data_type = - GARROW_DATE32_DATA_TYPE(g_object_new(GARROW_TYPE_DATE32_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowDate32DataType *data_type = GARROW_DATE32_DATA_TYPE( + g_object_new(GARROW_TYPE_DATE32_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - G_DEFINE_TYPE(GArrowDate64DataType, garrow_date64_data_type, GARROW_TYPE_TEMPORAL_DATA_TYPE) @@ -1105,15 +1030,13 @@ garrow_date64_data_type_new(void) { auto arrow_data_type = arrow::date64(); - GArrowDate64DataType *data_type = - GARROW_DATE64_DATA_TYPE(g_object_new(GARROW_TYPE_DATE64_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowDate64DataType *data_type = GARROW_DATE64_DATA_TYPE( + g_object_new(GARROW_TYPE_DATE64_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - -struct GArrowTimestampDataTypePrivate { +struct GArrowTimestampDataTypePrivate +{ GTimeZone *time_zone; }; @@ -1125,10 +1048,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowTimestampDataType, garrow_timestamp_data_type, GARROW_TYPE_TEMPORAL_DATA_TYPE) -#define GARROW_TIMESTAMP_DATA_TYPE_GET_PRIVATE(object) \ - static_cast( \ - garrow_timestamp_data_type_get_instance_private( \ - GARROW_TIMESTAMP_DATA_TYPE(object))) +#define GARROW_TIMESTAMP_DATA_TYPE_GET_PRIVATE(object) \ + static_cast( \ + garrow_timestamp_data_type_get_instance_private(GARROW_TIMESTAMP_DATA_TYPE(object))) static void garrow_timestamp_data_type_dispose(GObject *object) @@ -1188,7 +1110,7 @@ static void garrow_timestamp_data_type_class_init(GArrowTimestampDataTypeClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_timestamp_data_type_dispose; + gobject_class->dispose = garrow_timestamp_data_type_dispose; gobject_class->set_property = garrow_timestamp_data_type_set_property; gobject_class->get_property = garrow_timestamp_data_type_get_property; @@ -1200,12 +1122,12 @@ garrow_timestamp_data_type_class_init(GArrowTimestampDataTypeClass *klass) * * Since: 16.0.0 */ - spec = g_param_spec_boxed("time-zone", - "Time zone", - "The time zone of this data type", - G_TYPE_TIME_ZONE, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_boxed( + "time-zone", + "Time zone", + "The time zone of this data type", + G_TYPE_TIME_ZONE, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_TIME_ZONE, spec); } @@ -1222,8 +1144,7 @@ garrow_timestamp_data_type_class_init(GArrowTimestampDataTypeClass *klass) * Since: 0.7.0 */ GArrowTimestampDataType * -garrow_timestamp_data_type_new(GArrowTimeUnit unit, - GTimeZone *time_zone) +garrow_timestamp_data_type_new(GArrowTimeUnit unit, GTimeZone *time_zone) { auto arrow_unit = garrow_time_unit_to_raw(unit); std::string arrow_timezone; @@ -1235,8 +1156,10 @@ garrow_timestamp_data_type_new(GArrowTimeUnit unit, auto arrow_data_type = arrow::timestamp(arrow_unit, arrow_timezone); auto data_type = GARROW_TIMESTAMP_DATA_TYPE(g_object_new(GARROW_TYPE_TIMESTAMP_DATA_TYPE, - "data-type", &arrow_data_type, - "time-zone", time_zone, + "data-type", + &arrow_data_type, + "time-zone", + time_zone, NULL)); return data_type; } @@ -1252,14 +1175,12 @@ garrow_timestamp_data_type_new(GArrowTimeUnit unit, GArrowTimeUnit garrow_timestamp_data_type_get_unit(GArrowTimestampDataType *data_type) { - const auto arrow_data_type = - garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); + const auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); const auto arrow_timestamp_data_type = std::static_pointer_cast(arrow_data_type); return garrow_time_unit_from_raw(arrow_timestamp_data_type->unit()); } - G_DEFINE_ABSTRACT_TYPE(GArrowTimeDataType, garrow_time_data_type, GARROW_TYPE_TEMPORAL_DATA_TYPE) @@ -1285,17 +1206,13 @@ garrow_time_data_type_class_init(GArrowTimeDataTypeClass *klass) GArrowTimeUnit garrow_time_data_type_get_unit(GArrowTimeDataType *time_data_type) { - const auto arrow_data_type = - garrow_data_type_get_raw(GARROW_DATA_TYPE(time_data_type)); + const auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(time_data_type)); const auto arrow_time_data_type = std::static_pointer_cast(arrow_data_type); return garrow_time_unit_from_raw(arrow_time_data_type->unit()); } - -G_DEFINE_TYPE(GArrowTime32DataType, - garrow_time32_data_type, - GARROW_TYPE_TIME_DATA_TYPE) +G_DEFINE_TYPE(GArrowTime32DataType, garrow_time32_data_type, GARROW_TYPE_TIME_DATA_TYPE) static void garrow_time32_data_type_init(GArrowTime32DataType *object) @@ -1353,17 +1270,12 @@ garrow_time32_data_type_new(GArrowTimeUnit unit, GError **error) auto arrow_unit = garrow_time_unit_to_raw(unit); auto arrow_data_type = arrow::time32(arrow_unit); - auto data_type = - GARROW_TIME32_DATA_TYPE(g_object_new(GARROW_TYPE_TIME32_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + auto data_type = GARROW_TIME32_DATA_TYPE( + g_object_new(GARROW_TYPE_TIME32_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - -G_DEFINE_TYPE(GArrowTime64DataType, - garrow_time64_data_type, - GARROW_TYPE_TIME_DATA_TYPE) +G_DEFINE_TYPE(GArrowTime64DataType, garrow_time64_data_type, GARROW_TYPE_TIME_DATA_TYPE) static void garrow_time64_data_type_init(GArrowTime64DataType *object) @@ -1421,14 +1333,11 @@ garrow_time64_data_type_new(GArrowTimeUnit unit, GError **error) auto arrow_unit = garrow_time_unit_to_raw(unit); auto arrow_data_type = arrow::time64(arrow_unit); - auto data_type = - GARROW_TIME64_DATA_TYPE(g_object_new(GARROW_TYPE_TIME64_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + auto data_type = GARROW_TIME64_DATA_TYPE( + g_object_new(GARROW_TYPE_TIME64_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } - G_DEFINE_ABSTRACT_TYPE(GArrowIntervalDataType, garrow_interval_data_type, GARROW_TYPE_TEMPORAL_DATA_TYPE) @@ -1460,7 +1369,6 @@ garrow_interval_data_type_get_interval_type(GArrowIntervalDataType *type) return garrow_interval_type_from_raw(arrow_interval_type->interval_type()); } - G_DEFINE_TYPE(GArrowMonthIntervalDataType, garrow_month_interval_data_type, GARROW_TYPE_INTERVAL_DATA_TYPE) @@ -1470,8 +1378,7 @@ garrow_month_interval_data_type_init(GArrowMonthIntervalDataType *object) } static void -garrow_month_interval_data_type_class_init( - GArrowMonthIntervalDataTypeClass *klass) +garrow_month_interval_data_type_class_init(GArrowMonthIntervalDataTypeClass *klass) { } @@ -1488,12 +1395,12 @@ garrow_month_interval_data_type_new(void) auto arrow_data_type = arrow::month_interval(); auto data_type = g_object_new(GARROW_TYPE_MONTH_INTERVAL_DATA_TYPE, - "data-type", &arrow_data_type, + "data-type", + &arrow_data_type, NULL); return GARROW_MONTH_INTERVAL_DATA_TYPE(data_type); } - G_DEFINE_TYPE(GArrowDayTimeIntervalDataType, garrow_day_time_interval_data_type, GARROW_TYPE_INTERVAL_DATA_TYPE) @@ -1504,8 +1411,7 @@ garrow_day_time_interval_data_type_init(GArrowDayTimeIntervalDataType *object) } static void -garrow_day_time_interval_data_type_class_init( - GArrowDayTimeIntervalDataTypeClass *klass) +garrow_day_time_interval_data_type_class_init(GArrowDayTimeIntervalDataTypeClass *klass) { } @@ -1522,19 +1428,18 @@ garrow_day_time_interval_data_type_new(void) auto arrow_data_type = arrow::day_time_interval(); auto data_type = g_object_new(GARROW_TYPE_DAY_TIME_INTERVAL_DATA_TYPE, - "data-type", &arrow_data_type, + "data-type", + &arrow_data_type, NULL); return GARROW_DAY_TIME_INTERVAL_DATA_TYPE(data_type); } - G_DEFINE_TYPE(GArrowMonthDayNanoIntervalDataType, garrow_month_day_nano_interval_data_type, GARROW_TYPE_INTERVAL_DATA_TYPE) static void -garrow_month_day_nano_interval_data_type_init( - GArrowMonthDayNanoIntervalDataType *object) +garrow_month_day_nano_interval_data_type_init(GArrowMonthDayNanoIntervalDataType *object) { } @@ -1557,12 +1462,12 @@ garrow_month_day_nano_interval_data_type_new(void) auto arrow_data_type = arrow::month_day_nano_interval(); auto data_type = g_object_new(GARROW_TYPE_MONTH_DAY_NANO_INTERVAL_DATA_TYPE, - "data-type", &arrow_data_type, + "data-type", + &arrow_data_type, NULL); return GARROW_MONTH_DAY_NANO_INTERVAL_DATA_TYPE(data_type); } - G_DEFINE_ABSTRACT_TYPE(GArrowDecimalDataType, garrow_decimal_data_type, GARROW_TYPE_FIXED_SIZE_BINARY_DATA_TYPE) @@ -1593,9 +1498,7 @@ garrow_decimal_data_type_class_init(GArrowDecimalDataTypeClass *klass) * Since: 0.10.0 */ GArrowDecimalDataType * -garrow_decimal_data_type_new(gint32 precision, - gint32 scale, - GError **error) +garrow_decimal_data_type_new(gint32 precision, gint32 scale, GError **error) { if (precision <= garrow_decimal128_data_type_max_precision()) { return GARROW_DECIMAL_DATA_TYPE( @@ -1642,7 +1545,6 @@ garrow_decimal_data_type_get_scale(GArrowDecimalDataType *decimal_data_type) return arrow_decimal_type->scale(); } - G_DEFINE_TYPE(GArrowDecimal128DataType, garrow_decimal128_data_type, GARROW_TYPE_DECIMAL_DATA_TYPE) @@ -1682,25 +1584,20 @@ garrow_decimal128_data_type_max_precision() * Since: 0.12.0 */ GArrowDecimal128DataType * -garrow_decimal128_data_type_new(gint32 precision, - gint32 scale, - GError **error) +garrow_decimal128_data_type_new(gint32 precision, gint32 scale, GError **error) { auto arrow_data_type_result = arrow::Decimal128Type::Make(precision, scale); - if (garrow::check(error, - arrow_data_type_result, - "[decimal128-data-type][new]")) { + if (garrow::check(error, arrow_data_type_result, "[decimal128-data-type][new]")) { auto arrow_data_type = *arrow_data_type_result; - return GARROW_DECIMAL128_DATA_TYPE( - g_object_new(GARROW_TYPE_DECIMAL128_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + return GARROW_DECIMAL128_DATA_TYPE(g_object_new(GARROW_TYPE_DECIMAL128_DATA_TYPE, + "data-type", + &arrow_data_type, + NULL)); } else { return NULL; } } - G_DEFINE_TYPE(GArrowDecimal256DataType, garrow_decimal256_data_type, GARROW_TYPE_DECIMAL_DATA_TYPE) @@ -1740,26 +1637,22 @@ garrow_decimal256_data_type_max_precision() * Since: 3.0.0 */ GArrowDecimal256DataType * -garrow_decimal256_data_type_new(gint32 precision, - gint32 scale, - GError **error) +garrow_decimal256_data_type_new(gint32 precision, gint32 scale, GError **error) { auto arrow_data_type_result = arrow::Decimal256Type::Make(precision, scale); - if (garrow::check(error, - arrow_data_type_result, - "[decimal256-data-type][new]")) { + if (garrow::check(error, arrow_data_type_result, "[decimal256-data-type][new]")) { auto arrow_data_type = *arrow_data_type_result; - return GARROW_DECIMAL256_DATA_TYPE( - g_object_new(GARROW_TYPE_DECIMAL256_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + return GARROW_DECIMAL256_DATA_TYPE(g_object_new(GARROW_TYPE_DECIMAL256_DATA_TYPE, + "data-type", + &arrow_data_type, + NULL)); } else { return NULL; } } - -typedef struct GArrowExtensionDataTypePrivate_ { +typedef struct GArrowExtensionDataTypePrivate_ +{ GArrowDataType *storage_data_type; } GArrowExtensionDataTypePrivate; @@ -1771,10 +1664,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowExtensionDataType, garrow_extension_data_type, GARROW_TYPE_DATA_TYPE) -#define GARROW_EXTENSION_DATA_TYPE_GET_PRIVATE(obj) \ - static_cast( \ - garrow_extension_data_type_get_instance_private( \ - GARROW_EXTENSION_DATA_TYPE(obj))) +#define GARROW_EXTENSION_DATA_TYPE_GET_PRIVATE(obj) \ + static_cast( \ + garrow_extension_data_type_get_instance_private(GARROW_EXTENSION_DATA_TYPE(obj))) static void garrow_extension_data_type_dispose(GObject *object) @@ -1834,17 +1726,17 @@ static void garrow_extension_data_type_class_init(GArrowExtensionDataTypeClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_extension_data_type_dispose; + gobject_class->dispose = garrow_extension_data_type_dispose; gobject_class->set_property = garrow_extension_data_type_set_property; gobject_class->get_property = garrow_extension_data_type_get_property; GParamSpec *spec; - spec = g_param_spec_object("storage-data-type", - "Storage data type", - "The underlying GArrowDataType", - GARROW_TYPE_DATA_TYPE, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "storage-data-type", + "Storage data type", + "The underlying GArrowDataType", + GARROW_TYPE_DATA_TYPE, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_STORAGE_DATA_TYPE, spec); } @@ -1861,9 +1753,8 @@ garrow_extension_data_type_class_init(GArrowExtensionDataTypeClass *klass) gchar * garrow_extension_data_type_get_extension_name(GArrowExtensionDataType *data_type) { - auto arrow_data_type = - std::static_pointer_cast( - garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type))); + auto arrow_data_type = std::static_pointer_cast( + garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type))); const auto name = arrow_data_type->extension_name(); return g_strdup(name.c_str()); } @@ -1883,8 +1774,8 @@ garrow_extension_data_type_wrap_array(GArrowExtensionDataType *data_type, { auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); auto arrow_storage = garrow_array_get_raw(storage); - auto arrow_extension_array = arrow::ExtensionType::WrapArray(arrow_data_type, - arrow_storage); + auto arrow_extension_array = + arrow::ExtensionType::WrapArray(arrow_data_type, arrow_storage); auto array = garrow_extension_array_new_raw(&arrow_extension_array, storage); return GARROW_EXTENSION_ARRAY(array); } @@ -1906,15 +1797,12 @@ garrow_extension_data_type_wrap_chunked_array(GArrowExtensionDataType *data_type auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); auto arrow_storage = garrow_chunked_array_get_raw(storage); auto arrow_extension_chunked_array = - arrow::ExtensionType::WrapArray(arrow_data_type, - arrow_storage); + arrow::ExtensionType::WrapArray(arrow_data_type, arrow_storage); return garrow_chunked_array_new_raw(&arrow_extension_chunked_array); } - static std::shared_ptr -garrow_extension_data_type_get_storage_data_type_raw( - GArrowExtensionDataType *data_type) +garrow_extension_data_type_get_storage_data_type_raw(GArrowExtensionDataType *data_type) { auto priv = GARROW_EXTENSION_DATA_TYPE_GET_PRIVATE(data_type); return garrow_data_type_get_raw(priv->storage_data_type); @@ -1923,22 +1811,25 @@ garrow_extension_data_type_get_storage_data_type_raw( G_END_DECLS namespace garrow { - GExtensionType::GExtensionType(GArrowExtensionDataType *garrow_data_type) : - arrow::ExtensionType( - garrow_extension_data_type_get_storage_data_type_raw(garrow_data_type)), - garrow_data_type_(garrow_data_type) { + GExtensionType::GExtensionType(GArrowExtensionDataType *garrow_data_type) + : arrow::ExtensionType( + garrow_extension_data_type_get_storage_data_type_raw(garrow_data_type)), + garrow_data_type_(garrow_data_type) + { g_object_ref(garrow_data_type_); } - GExtensionType::~GExtensionType() { - g_object_unref(garrow_data_type_); - } + GExtensionType::~GExtensionType() { g_object_unref(garrow_data_type_); } - GArrowExtensionDataType *GExtensionType::garrow_data_type() const { + GArrowExtensionDataType * + GExtensionType::garrow_data_type() const + { return garrow_data_type_; } - std::string GExtensionType::extension_name() const { + std::string + GExtensionType::extension_name() const + { auto klass = GARROW_EXTENSION_DATA_TYPE_GET_CLASS(garrow_data_type_); auto c_name = klass->get_extension_name(garrow_data_type_); std::string name(c_name); @@ -1946,35 +1837,37 @@ namespace garrow { return name; } - bool GExtensionType::ExtensionEquals(const arrow::ExtensionType& other) const { + bool + GExtensionType::ExtensionEquals(const arrow::ExtensionType &other) const + { if (extension_name() != other.extension_name()) { return false; } auto klass = GARROW_EXTENSION_DATA_TYPE_GET_CLASS(garrow_data_type_); auto garrow_other_data_type = - static_cast(other).garrow_data_type_; - return klass->equal(garrow_data_type_, - garrow_other_data_type); + static_cast(other).garrow_data_type_; + return klass->equal(garrow_data_type_, garrow_other_data_type); } std::shared_ptr - GExtensionType::MakeArray(std::shared_ptr data) const { + GExtensionType::MakeArray(std::shared_ptr data) const + { return std::make_shared(data); } arrow::Result> GExtensionType::Deserialize(std::shared_ptr storage_data_type, - const std::string& serialized_data) const { + const std::string &serialized_data) const + { auto klass = GARROW_EXTENSION_DATA_TYPE_GET_CLASS(garrow_data_type_); auto garrow_storage_data_type = garrow_data_type_new_raw(&storage_data_type); - GBytes *g_serialized_data = g_bytes_new_static(serialized_data.data(), - serialized_data.size()); + GBytes *g_serialized_data = + g_bytes_new_static(serialized_data.data(), serialized_data.size()); GError *error = NULL; - auto garrow_deserialized_data_type = - klass->deserialize(garrow_data_type_, - garrow_storage_data_type, - g_serialized_data, - &error); + auto garrow_deserialized_data_type = klass->deserialize(garrow_data_type_, + garrow_storage_data_type, + g_serialized_data, + &error); g_bytes_unref(g_serialized_data); g_object_unref(garrow_storage_data_type); if (error) { @@ -1983,34 +1876,35 @@ namespace garrow { "[extension-type][deserialize]"); } - auto deserialized_data_type = - garrow_data_type_get_raw(garrow_deserialized_data_type); + auto deserialized_data_type = garrow_data_type_get_raw(garrow_deserialized_data_type); g_object_unref(garrow_deserialized_data_type); return deserialized_data_type; } std::string - GExtensionType::Serialize() const { + GExtensionType::Serialize() const + { auto klass = GARROW_EXTENSION_DATA_TYPE_GET_CLASS(garrow_data_type_); auto g_bytes = klass->serialize(garrow_data_type_); gsize raw_data_size = 0; auto raw_data = g_bytes_get_data(g_bytes, &raw_data_size); - std::string data(static_cast(raw_data), - raw_data_size); + std::string data(static_cast(raw_data), raw_data_size); g_bytes_unref(g_bytes); return data; } - GType GExtensionType::array_gtype() const { + GType + GExtensionType::array_gtype() const + { auto klass = GARROW_EXTENSION_DATA_TYPE_GET_CLASS(garrow_data_type_); return klass->get_array_gtype(garrow_data_type_); } -} +} // namespace garrow G_BEGIN_DECLS - -typedef struct GArrowExtensionDataTypeRegistryPrivate_ { +typedef struct GArrowExtensionDataTypeRegistryPrivate_ +{ std::shared_ptr registry; } GArrowExtensionDataTypeRegistryPrivate; @@ -2022,9 +1916,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowExtensionDataTypeRegistry, garrow_extension_data_type_registry, G_TYPE_OBJECT) -#define GARROW_EXTENSION_DATA_TYPE_REGISTRY_GET_PRIVATE(obj) \ - static_cast( \ - garrow_extension_data_type_registry_get_instance_private( \ +#define GARROW_EXTENSION_DATA_TYPE_REGISTRY_GET_PRIVATE(obj) \ + static_cast( \ + garrow_extension_data_type_registry_get_instance_private( \ GARROW_EXTENSION_DATA_TYPE_REGISTRY(obj))) static void @@ -2047,8 +1941,8 @@ garrow_extension_data_type_registry_set_property(GObject *object, switch (prop_id) { case PROP_REGISTRY: - priv->registry = - *static_cast *>(g_value_get_pointer(value)); + priv->registry = *static_cast *>( + g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -2060,23 +1954,24 @@ static void garrow_extension_data_type_registry_init(GArrowExtensionDataTypeRegistry *object) { auto priv = GARROW_EXTENSION_DATA_TYPE_REGISTRY_GET_PRIVATE(object); - new(&priv->registry) std::shared_ptr; + new (&priv->registry) std::shared_ptr; } static void -garrow_extension_data_type_registry_class_init(GArrowExtensionDataTypeRegistryClass *klass) +garrow_extension_data_type_registry_class_init( + GArrowExtensionDataTypeRegistryClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_extension_data_type_registry_finalize; + gobject_class->finalize = garrow_extension_data_type_registry_finalize; gobject_class->set_property = garrow_extension_data_type_registry_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("registry", - "Registry", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "registry", + "Registry", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_REGISTRY, spec); } @@ -2107,10 +2002,9 @@ garrow_extension_data_type_registry_default(void) * Since: 3.0.0 */ gboolean -garrow_extension_data_type_registry_register( - GArrowExtensionDataTypeRegistry *registry, - GArrowExtensionDataType *data_type, - GError **error) +garrow_extension_data_type_registry_register(GArrowExtensionDataTypeRegistry *registry, + GArrowExtensionDataType *data_type, + GError **error) { const gchar *context = "[extension-data-type-registry][register]"; auto klass = GARROW_EXTENSION_DATA_TYPE_GET_CLASS(data_type); @@ -2146,9 +2040,8 @@ garrow_extension_data_type_registry_register( } auto arrow_registry = garrow_extension_data_type_registry_get_raw(registry); - auto arrow_data_type = - std::static_pointer_cast( - garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type))); + auto arrow_data_type = std::static_pointer_cast( + garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type))); auto status = arrow_registry->RegisterType(arrow_data_type); return garrow::check(error, status, context); } @@ -2167,16 +2060,13 @@ garrow_extension_data_type_registry_register( * Since: 3.0.0 */ gboolean -garrow_extension_data_type_registry_unregister( - GArrowExtensionDataTypeRegistry *registry, - const gchar *name, - GError **error) +garrow_extension_data_type_registry_unregister(GArrowExtensionDataTypeRegistry *registry, + const gchar *name, + GError **error) { auto arrow_registry = garrow_extension_data_type_registry_get_raw(registry); auto status = arrow_registry->UnregisterType(name); - return garrow::check(error, - status, - "[extension-data-type-registry][unregister]"); + return garrow::check(error, status, "[extension-data-type-registry][unregister]"); } /** @@ -2190,9 +2080,8 @@ garrow_extension_data_type_registry_unregister( * Since: 3.0.0 */ GArrowExtensionDataType * -garrow_extension_data_type_registry_lookup( - GArrowExtensionDataTypeRegistry *registry, - const gchar *name) +garrow_extension_data_type_registry_lookup(GArrowExtensionDataTypeRegistry *registry, + const gchar *name) { auto arrow_registry = garrow_extension_data_type_registry_get_raw(registry); auto arrow_extension_data_type = arrow_registry->GetType(name); @@ -2205,7 +2094,6 @@ garrow_extension_data_type_registry_lookup( return GARROW_EXTENSION_DATA_TYPE(data_type); } - G_END_DECLS GArrowDataType * @@ -2339,9 +2227,7 @@ garrow_data_type_new_raw(std::shared_ptr *arrow_data_type) type = GARROW_TYPE_DATA_TYPE; break; } - data_type = GARROW_DATA_TYPE(g_object_new(type, - "data-type", arrow_data_type, - NULL)); + data_type = GARROW_DATA_TYPE(g_object_new(type, "data-type", arrow_data_type, NULL)); return data_type; } @@ -2351,8 +2237,8 @@ garrow_data_type_get_raw(GArrowDataType *data_type) auto priv = GARROW_DATA_TYPE_GET_PRIVATE(data_type); if (!priv->data_type && g_type_is_a(G_OBJECT_TYPE(data_type), GARROW_TYPE_EXTENSION_DATA_TYPE)) { - priv->data_type = std::make_shared( - GARROW_EXTENSION_DATA_TYPE(data_type)); + priv->data_type = + std::make_shared(GARROW_EXTENSION_DATA_TYPE(data_type)); } return priv->data_type; } @@ -2362,14 +2248,14 @@ garrow_extension_data_type_registry_new_raw( std::shared_ptr *arrow_registry) { auto registry = g_object_new(GARROW_TYPE_EXTENSION_DATA_TYPE_REGISTRY, - "registry", arrow_registry, + "registry", + arrow_registry, NULL); return GARROW_EXTENSION_DATA_TYPE_REGISTRY(registry); } std::shared_ptr -garrow_extension_data_type_registry_get_raw( - GArrowExtensionDataTypeRegistry *registry) +garrow_extension_data_type_registry_get_raw(GArrowExtensionDataTypeRegistry *registry) { auto priv = GARROW_EXTENSION_DATA_TYPE_REGISTRY_GET_PRIVATE(registry); return priv->registry; diff --git a/c_glib/arrow-glib/basic-data-type.h b/c_glib/arrow-glib/basic-data-type.h index f1c5af409c9da..01c9e5ef6e40a 100644 --- a/c_glib/arrow-glib/basic-data-type.h +++ b/c_glib/arrow-glib/basic-data-type.h @@ -28,11 +28,7 @@ G_BEGIN_DECLS #define GARROW_TYPE_DATA_TYPE (garrow_data_type_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowDataType, - garrow_data_type, - GARROW, - DATA_TYPE, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowDataType, garrow_data_type, GARROW, DATA_TYPE, GObject) struct _GArrowDataTypeClass { GObjectClass parent_class; @@ -40,23 +36,22 @@ struct _GArrowDataTypeClass GARROW_AVAILABLE_IN_6_0 GArrowDataType * -garrow_data_type_import(gpointer c_abi_schema, - GError **error); +garrow_data_type_import(gpointer c_abi_schema, GError **error); GARROW_AVAILABLE_IN_6_0 gpointer -garrow_data_type_export(GArrowDataType *data_type, - GError **error); +garrow_data_type_export(GArrowDataType *data_type, GError **error); -gboolean garrow_data_type_equal (GArrowDataType *data_type, - GArrowDataType *other_data_type); -gchar *garrow_data_type_to_string (GArrowDataType *data_type); -GArrowType garrow_data_type_get_id (GArrowDataType *data_type); +gboolean +garrow_data_type_equal(GArrowDataType *data_type, GArrowDataType *other_data_type); +gchar * +garrow_data_type_to_string(GArrowDataType *data_type); +GArrowType +garrow_data_type_get_id(GArrowDataType *data_type); GARROW_AVAILABLE_IN_3_0 gchar * garrow_data_type_get_name(GArrowDataType *data_type); - #define GARROW_TYPE_FIXED_WIDTH_DATA_TYPE (garrow_fixed_width_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowFixedWidthDataType, garrow_fixed_width_data_type, @@ -68,26 +63,23 @@ struct _GArrowFixedWidthDataTypeClass GArrowDataTypeClass parent_class; }; -gint garrow_fixed_width_data_type_get_bit_width(GArrowFixedWidthDataType *data_type); +gint +garrow_fixed_width_data_type_get_bit_width(GArrowFixedWidthDataType *data_type); /* TODO: -GList *garrow_fixed_width_data_type_get_buffer_layout(GArrowFixedWidthDataType *data_type); +GList *garrow_fixed_width_data_type_get_buffer_layout(GArrowFixedWidthDataType +*data_type); */ - -#define GARROW_TYPE_NULL_DATA_TYPE \ - (garrow_null_data_type_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowNullDataType, - garrow_null_data_type, - GARROW, - NULL_DATA_TYPE, - GArrowDataType) +#define GARROW_TYPE_NULL_DATA_TYPE (garrow_null_data_type_get_type()) +G_DECLARE_DERIVABLE_TYPE( + GArrowNullDataType, garrow_null_data_type, GARROW, NULL_DATA_TYPE, GArrowDataType) struct _GArrowNullDataTypeClass { GArrowDataTypeClass parent_class; }; -GArrowNullDataType *garrow_null_data_type_new (void); - +GArrowNullDataType * +garrow_null_data_type_new(void); #define GARROW_TYPE_BOOLEAN_DATA_TYPE (garrow_boolean_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowBooleanDataType, @@ -100,8 +92,8 @@ struct _GArrowBooleanDataTypeClass GArrowFixedWidthDataTypeClass parent_class; }; -GArrowBooleanDataType *garrow_boolean_data_type_new (void); - +GArrowBooleanDataType * +garrow_boolean_data_type_new(void); #define GARROW_TYPE_NUMERIC_DATA_TYPE (garrow_numeric_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowNumericDataType, @@ -114,7 +106,6 @@ struct _GArrowNumericDataTypeClass GArrowFixedWidthDataTypeClass parent_class; }; - #define GARROW_TYPE_INTEGER_DATA_TYPE (garrow_integer_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowIntegerDataType, garrow_integer_data_type, @@ -127,7 +118,8 @@ struct _GArrowIntegerDataTypeClass }; GARROW_AVAILABLE_IN_0_16 -gboolean garrow_integer_data_type_is_signed(GArrowIntegerDataType *data_type); +gboolean +garrow_integer_data_type_is_signed(GArrowIntegerDataType *data_type); #define GARROW_TYPE_INT8_DATA_TYPE (garrow_int8_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowInt8DataType, @@ -140,8 +132,8 @@ struct _GArrowInt8DataTypeClass GArrowIntegerDataTypeClass parent_class; }; -GArrowInt8DataType *garrow_int8_data_type_new (void); - +GArrowInt8DataType * +garrow_int8_data_type_new(void); #define GARROW_TYPE_UINT8_DATA_TYPE (garrow_uint8_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowUInt8DataType, @@ -154,8 +146,8 @@ struct _GArrowUInt8DataTypeClass GArrowIntegerDataTypeClass parent_class; }; -GArrowUInt8DataType *garrow_uint8_data_type_new (void); - +GArrowUInt8DataType * +garrow_uint8_data_type_new(void); #define GARROW_TYPE_INT16_DATA_TYPE (garrow_int16_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowInt16DataType, @@ -168,8 +160,8 @@ struct _GArrowInt16DataTypeClass GArrowIntegerDataTypeClass parent_class; }; -GArrowInt16DataType *garrow_int16_data_type_new (void); - +GArrowInt16DataType * +garrow_int16_data_type_new(void); #define GARROW_TYPE_UINT16_DATA_TYPE (garrow_uint16_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowUInt16DataType, @@ -182,8 +174,8 @@ struct _GArrowUInt16DataTypeClass GArrowIntegerDataTypeClass parent_class; }; -GArrowUInt16DataType *garrow_uint16_data_type_new (void); - +GArrowUInt16DataType * +garrow_uint16_data_type_new(void); #define GARROW_TYPE_INT32_DATA_TYPE (garrow_int32_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowInt32DataType, @@ -196,8 +188,8 @@ struct _GArrowInt32DataTypeClass GArrowIntegerDataTypeClass parent_class; }; -GArrowInt32DataType *garrow_int32_data_type_new (void); - +GArrowInt32DataType * +garrow_int32_data_type_new(void); #define GARROW_TYPE_UINT32_DATA_TYPE (garrow_uint32_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowUInt32DataType, @@ -210,8 +202,8 @@ struct _GArrowUInt32DataTypeClass GArrowIntegerDataTypeClass parent_class; }; -GArrowUInt32DataType *garrow_uint32_data_type_new (void); - +GArrowUInt32DataType * +garrow_uint32_data_type_new(void); #define GARROW_TYPE_INT64_DATA_TYPE (garrow_int64_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowInt64DataType, @@ -224,8 +216,8 @@ struct _GArrowInt64DataTypeClass GArrowIntegerDataTypeClass parent_class; }; -GArrowInt64DataType *garrow_int64_data_type_new (void); - +GArrowInt64DataType * +garrow_int64_data_type_new(void); #define GARROW_TYPE_UINT64_DATA_TYPE (garrow_uint64_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowUInt64DataType, @@ -238,11 +230,10 @@ struct _GArrowUInt64DataTypeClass GArrowIntegerDataTypeClass parent_class; }; -GArrowUInt64DataType *garrow_uint64_data_type_new (void); - +GArrowUInt64DataType * +garrow_uint64_data_type_new(void); -#define GARROW_TYPE_FLOATING_POINT_DATA_TYPE \ - (garrow_floating_point_data_type_get_type()) +#define GARROW_TYPE_FLOATING_POINT_DATA_TYPE (garrow_floating_point_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowFloatingPointDataType, garrow_floating_point_data_type, GARROW, @@ -253,7 +244,6 @@ struct _GArrowFloatingPointDataTypeClass GArrowNumericDataTypeClass parent_class; }; - #define GARROW_TYPE_HALF_FLOAT_DATA_TYPE (garrow_half_float_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowHalfFloatDataType, garrow_half_float_data_type, @@ -266,8 +256,8 @@ struct _GArrowHalfFloatDataTypeClass }; GARROW_AVAILABLE_IN_11_0 -GArrowHalfFloatDataType *garrow_half_float_data_type_new(void); - +GArrowHalfFloatDataType * +garrow_half_float_data_type_new(void); #define GARROW_TYPE_FLOAT_DATA_TYPE (garrow_float_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowFloatDataType, @@ -280,8 +270,8 @@ struct _GArrowFloatDataTypeClass GArrowFloatingPointDataTypeClass parent_class; }; -GArrowFloatDataType *garrow_float_data_type_new (void); - +GArrowFloatDataType * +garrow_float_data_type_new(void); #define GARROW_TYPE_DOUBLE_DATA_TYPE (garrow_double_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDoubleDataType, @@ -294,24 +284,22 @@ struct _GArrowDoubleDataTypeClass GArrowFloatingPointDataTypeClass parent_class; }; -GArrowDoubleDataType *garrow_double_data_type_new (void); - +GArrowDoubleDataType * +garrow_double_data_type_new(void); #define GARROW_TYPE_BINARY_DATA_TYPE (garrow_binary_data_type_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowBinaryDataType, - garrow_binary_data_type, - GARROW, - BINARY_DATA_TYPE, - GArrowDataType) +G_DECLARE_DERIVABLE_TYPE( + GArrowBinaryDataType, garrow_binary_data_type, GARROW, BINARY_DATA_TYPE, GArrowDataType) struct _GArrowBinaryDataTypeClass { GArrowDataTypeClass parent_class; }; -GArrowBinaryDataType *garrow_binary_data_type_new (void); - +GArrowBinaryDataType * +garrow_binary_data_type_new(void); -#define GARROW_TYPE_FIXED_SIZE_BINARY_DATA_TYPE (garrow_fixed_size_binary_data_type_get_type()) +#define GARROW_TYPE_FIXED_SIZE_BINARY_DATA_TYPE \ + (garrow_fixed_size_binary_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowFixedSizeBinaryDataType, garrow_fixed_size_binary_data_type, GARROW, @@ -327,8 +315,8 @@ GArrowFixedSizeBinaryDataType * garrow_fixed_size_binary_data_type_new(gint32 byte_width); GARROW_AVAILABLE_IN_0_12 gint32 -garrow_fixed_size_binary_data_type_get_byte_width(GArrowFixedSizeBinaryDataType *data_type); - +garrow_fixed_size_binary_data_type_get_byte_width( + GArrowFixedSizeBinaryDataType *data_type); #define GARROW_TYPE_LARGE_BINARY_DATA_TYPE (garrow_large_binary_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowLargeBinaryDataType, @@ -342,8 +330,8 @@ struct _GArrowLargeBinaryDataTypeClass }; GARROW_AVAILABLE_IN_0_17 -GArrowLargeBinaryDataType *garrow_large_binary_data_type_new(void); - +GArrowLargeBinaryDataType * +garrow_large_binary_data_type_new(void); #define GARROW_TYPE_STRING_DATA_TYPE (garrow_string_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowStringDataType, @@ -356,8 +344,8 @@ struct _GArrowStringDataTypeClass GArrowBinaryDataTypeClass parent_class; }; -GArrowStringDataType *garrow_string_data_type_new (void); - +GArrowStringDataType * +garrow_string_data_type_new(void); #define GARROW_TYPE_LARGE_STRING_DATA_TYPE (garrow_large_string_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowLargeStringDataType, @@ -371,8 +359,8 @@ struct _GArrowLargeStringDataTypeClass }; GARROW_AVAILABLE_IN_0_17 -GArrowLargeStringDataType *garrow_large_string_data_type_new(void); - +GArrowLargeStringDataType * +garrow_large_string_data_type_new(void); #define GARROW_TYPE_TEMPORAL_DATA_TYPE (garrow_temporal_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowTemporalDataType, @@ -385,7 +373,6 @@ struct _GArrowTemporalDataTypeClass GArrowFixedWidthDataTypeClass parent_class; }; - #define GARROW_TYPE_DATE32_DATA_TYPE (garrow_date32_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDate32DataType, garrow_date32_data_type, @@ -397,8 +384,8 @@ struct _GArrowDate32DataTypeClass GArrowTemporalDataTypeClass parent_class; }; -GArrowDate32DataType *garrow_date32_data_type_new (void); - +GArrowDate32DataType * +garrow_date32_data_type_new(void); #define GARROW_TYPE_DATE64_DATA_TYPE (garrow_date64_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDate64DataType, @@ -411,8 +398,8 @@ struct _GArrowDate64DataTypeClass GArrowTemporalDataTypeClass parent_class; }; -GArrowDate64DataType *garrow_date64_data_type_new (void); - +GArrowDate64DataType * +garrow_date64_data_type_new(void); #define GARROW_TYPE_TIMESTAMP_DATA_TYPE (garrow_timestamp_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowTimestampDataType, @@ -426,12 +413,10 @@ struct _GArrowTimestampDataTypeClass }; GArrowTimestampDataType * -garrow_timestamp_data_type_new(GArrowTimeUnit unit, - GTimeZone *time_zone); +garrow_timestamp_data_type_new(GArrowTimeUnit unit, GTimeZone *time_zone); GArrowTimeUnit garrow_timestamp_data_type_get_unit(GArrowTimestampDataType *data_type); - #define GARROW_TYPE_TIME_DATA_TYPE (garrow_time_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowTimeDataType, garrow_time_data_type, @@ -443,8 +428,8 @@ struct _GArrowTimeDataTypeClass GArrowTemporalDataTypeClass parent_class; }; -GArrowTimeUnit garrow_time_data_type_get_unit (GArrowTimeDataType *time_data_type); - +GArrowTimeUnit +garrow_time_data_type_get_unit(GArrowTimeDataType *time_data_type); #define GARROW_TYPE_TIME32_DATA_TYPE (garrow_time32_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowTime32DataType, @@ -457,9 +442,8 @@ struct _GArrowTime32DataTypeClass GArrowTimeDataTypeClass parent_class; }; -GArrowTime32DataType *garrow_time32_data_type_new (GArrowTimeUnit unit, - GError **error); - +GArrowTime32DataType * +garrow_time32_data_type_new(GArrowTimeUnit unit, GError **error); #define GARROW_TYPE_TIME64_DATA_TYPE (garrow_time64_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowTime64DataType, @@ -472,9 +456,8 @@ struct _GArrowTime64DataTypeClass GArrowTimeDataTypeClass parent_class; }; -GArrowTime64DataType *garrow_time64_data_type_new (GArrowTimeUnit unit, - GError **error); - +GArrowTime64DataType * +garrow_time64_data_type_new(GArrowTimeUnit unit, GError **error); #define GARROW_TYPE_INTERVAL_DATA_TYPE (garrow_interval_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowIntervalDataType, @@ -491,9 +474,7 @@ GARROW_AVAILABLE_IN_7_0 GArrowIntervalType garrow_interval_data_type_get_interval_type(GArrowIntervalDataType *type); - -#define GARROW_TYPE_MONTH_INTERVAL_DATA_TYPE \ - (garrow_month_interval_data_type_get_type()) +#define GARROW_TYPE_MONTH_INTERVAL_DATA_TYPE (garrow_month_interval_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowMonthIntervalDataType, garrow_month_interval_data_type, GARROW, @@ -508,8 +489,7 @@ GARROW_AVAILABLE_IN_7_0 GArrowMonthIntervalDataType * garrow_month_interval_data_type_new(void); - -#define GARROW_TYPE_DAY_TIME_INTERVAL_DATA_TYPE \ +#define GARROW_TYPE_DAY_TIME_INTERVAL_DATA_TYPE \ (garrow_day_time_interval_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDayTimeIntervalDataType, garrow_day_time_interval_data_type, @@ -525,8 +505,7 @@ GARROW_AVAILABLE_IN_7_0 GArrowDayTimeIntervalDataType * garrow_day_time_interval_data_type_new(void); - -#define GARROW_TYPE_MONTH_DAY_NANO_INTERVAL_DATA_TYPE \ +#define GARROW_TYPE_MONTH_DAY_NANO_INTERVAL_DATA_TYPE \ (garrow_month_day_nano_interval_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowMonthDayNanoIntervalDataType, garrow_month_day_nano_interval_data_type, @@ -542,7 +521,6 @@ GARROW_AVAILABLE_IN_7_0 GArrowMonthDayNanoIntervalDataType * garrow_month_day_nano_interval_data_type_new(void); - #define GARROW_TYPE_DECIMAL_DATA_TYPE (garrow_decimal_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDecimalDataType, garrow_decimal_data_type, @@ -556,9 +534,10 @@ struct _GArrowDecimalDataTypeClass GArrowDecimalDataType * garrow_decimal_data_type_new(gint32 precision, gint32 scale, GError **error); -gint32 garrow_decimal_data_type_get_precision(GArrowDecimalDataType *decimal_data_type); -gint32 garrow_decimal_data_type_get_scale(GArrowDecimalDataType *decimal_data_type); - +gint32 +garrow_decimal_data_type_get_precision(GArrowDecimalDataType *decimal_data_type); +gint32 +garrow_decimal_data_type_get_scale(GArrowDecimalDataType *decimal_data_type); #define GARROW_TYPE_DECIMAL128_DATA_TYPE (garrow_decimal128_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDecimal128DataType, @@ -579,7 +558,6 @@ GARROW_AVAILABLE_IN_0_12 GArrowDecimal128DataType * garrow_decimal128_data_type_new(gint32 precision, gint32 scale, GError **error); - #define GARROW_TYPE_DECIMAL256_DATA_TYPE (garrow_decimal256_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDecimal256DataType, garrow_decimal256_data_type, @@ -648,8 +626,7 @@ GArrowChunkedArray * garrow_extension_data_type_wrap_chunked_array(GArrowExtensionDataType *data_type, GArrowChunkedArray *storage); - -#define GARROW_TYPE_EXTENSION_DATA_TYPE_REGISTRY \ +#define GARROW_TYPE_EXTENSION_DATA_TYPE_REGISTRY \ (garrow_extension_data_type_registry_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowExtensionDataTypeRegistry, garrow_extension_data_type_registry, @@ -667,20 +644,17 @@ garrow_extension_data_type_registry_default(void); GARROW_AVAILABLE_IN_3_0 gboolean -garrow_extension_data_type_registry_register( - GArrowExtensionDataTypeRegistry *registry, - GArrowExtensionDataType *data_type, - GError **error); +garrow_extension_data_type_registry_register(GArrowExtensionDataTypeRegistry *registry, + GArrowExtensionDataType *data_type, + GError **error); GARROW_AVAILABLE_IN_3_0 gboolean -garrow_extension_data_type_registry_unregister( - GArrowExtensionDataTypeRegistry *registry, - const gchar *name, - GError **error); +garrow_extension_data_type_registry_unregister(GArrowExtensionDataTypeRegistry *registry, + const gchar *name, + GError **error); GARROW_AVAILABLE_IN_3_0 GArrowExtensionDataType * -garrow_extension_data_type_registry_lookup( - GArrowExtensionDataTypeRegistry *registry, - const gchar *name); +garrow_extension_data_type_registry_lookup(GArrowExtensionDataTypeRegistry *registry, + const gchar *name); G_END_DECLS diff --git a/c_glib/arrow-glib/basic-data-type.hpp b/c_glib/arrow-glib/basic-data-type.hpp index ff1fe5e28f2db..c4d613590304a 100644 --- a/c_glib/arrow-glib/basic-data-type.hpp +++ b/c_glib/arrow-glib/basic-data-type.hpp @@ -32,8 +32,7 @@ GArrowExtensionDataTypeRegistry * garrow_extension_data_type_registry_new_raw( std::shared_ptr *arrow_registry); std::shared_ptr -garrow_extension_data_type_registry_get_raw( - GArrowExtensionDataTypeRegistry *registry); +garrow_extension_data_type_registry_get_raw(GArrowExtensionDataTypeRegistry *registry); namespace garrow { class GExtensionType : public arrow::ExtensionType { @@ -47,16 +46,18 @@ namespace garrow { GType array_gtype() const; - std::string extension_name() const override; + std::string + extension_name() const override; - bool ExtensionEquals(const arrow::ExtensionType& other) const override; + bool + ExtensionEquals(const arrow::ExtensionType &other) const override; std::shared_ptr MakeArray(std::shared_ptr data) const override; arrow::Result> Deserialize(std::shared_ptr storage_data_type, - const std::string& serialized_data) const override; + const std::string &serialized_data) const override; std::string Serialize() const override; @@ -64,4 +65,4 @@ namespace garrow { private: GArrowExtensionDataType *garrow_data_type_; }; -} +} // namespace garrow diff --git a/c_glib/arrow-glib/buffer.cpp b/c_glib/arrow-glib/buffer.cpp index 86d88cebd5ee4..c5ca418f63f0a 100644 --- a/c_glib/arrow-glib/buffer.cpp +++ b/c_glib/arrow-glib/buffer.cpp @@ -38,7 +38,8 @@ G_BEGIN_DECLS * #GArrowResizableBuffer is mutable and resizable. */ -typedef struct GArrowBufferPrivate_ { +typedef struct GArrowBufferPrivate_ +{ std::shared_ptr buffer; GBytes *data; GArrowBuffer *parent; @@ -52,10 +53,9 @@ enum { G_DEFINE_TYPE_WITH_PRIVATE(GArrowBuffer, garrow_buffer, G_TYPE_OBJECT) -#define GARROW_BUFFER_GET_PRIVATE(obj) \ - static_cast( \ - garrow_buffer_get_instance_private( \ - GARROW_BUFFER(obj))) +#define GARROW_BUFFER_GET_PRIVATE(obj) \ + static_cast( \ + garrow_buffer_get_instance_private(GARROW_BUFFER(obj))) static void garrow_buffer_dispose(GObject *object) @@ -132,7 +132,7 @@ static void garrow_buffer_init(GArrowBuffer *object) { auto priv = GARROW_BUFFER_GET_PRIVATE(object); - new(&priv->buffer) std::shared_ptr; + new (&priv->buffer) std::shared_ptr; } static void @@ -142,32 +142,32 @@ garrow_buffer_class_init(GArrowBufferClass *klass) auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_buffer_dispose; - gobject_class->finalize = garrow_buffer_finalize; + gobject_class->dispose = garrow_buffer_dispose; + gobject_class->finalize = garrow_buffer_finalize; gobject_class->set_property = garrow_buffer_set_property; gobject_class->get_property = garrow_buffer_get_property; - spec = g_param_spec_pointer("buffer", - "Buffer", - "The raw std::shared_ptr *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "buffer", + "Buffer", + "The raw std::shared_ptr *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_BUFFER, spec); - spec = g_param_spec_boxed("data", - "Data", - "The raw data passed as GBytes *", - G_TYPE_BYTES, - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_boxed( + "data", + "Data", + "The raw data passed as GBytes *", + G_TYPE_BYTES, + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_DATA, spec); - spec = g_param_spec_object("parent", - "Parent", - "The parent GArrowBuffer *", - GARROW_TYPE_BUFFER, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "parent", + "Parent", + "The parent GArrowBuffer *", + GARROW_TYPE_BUFFER, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_PARENT, spec); } @@ -203,8 +203,7 @@ garrow_buffer_new_bytes(GBytes *data) size_t data_size; auto raw_data = g_bytes_get_data(data, &data_size); auto arrow_buffer = - std::make_shared(static_cast(raw_data), - data_size); + std::make_shared(static_cast(raw_data), data_size); return garrow_buffer_new_raw_bytes(&arrow_buffer, data); } @@ -297,8 +296,7 @@ garrow_buffer_get_data(GArrowBuffer *buffer) } auto arrow_buffer = garrow_buffer_get_raw(buffer); - auto data = g_bytes_new_static(arrow_buffer->data(), - arrow_buffer->size()); + auto data = g_bytes_new_static(arrow_buffer->data(), arrow_buffer->size()); return data; } @@ -326,8 +324,7 @@ garrow_buffer_get_mutable_data(GArrowBuffer *buffer) return priv->data; } - return g_bytes_new_static(arrow_buffer->mutable_data(), - arrow_buffer->size()); + return g_bytes_new_static(arrow_buffer->mutable_data(), arrow_buffer->size()); } /** @@ -385,10 +382,7 @@ garrow_buffer_get_parent(GArrowBuffer *buffer) * Since: 0.3.0 */ GArrowBuffer * -garrow_buffer_copy(GArrowBuffer *buffer, - gint64 start, - gint64 size, - GError **error) +garrow_buffer_copy(GArrowBuffer *buffer, gint64 start, gint64 size, GError **error) { auto arrow_buffer = garrow_buffer_get_raw(buffer); auto maybe_copied_buffer = arrow_buffer->CopySlice(start, size); @@ -416,16 +410,11 @@ GArrowBuffer * garrow_buffer_slice(GArrowBuffer *buffer, gint64 offset, gint64 size) { auto arrow_parent_buffer = garrow_buffer_get_raw(buffer); - auto arrow_buffer = std::make_shared(arrow_parent_buffer, - offset, - size); + auto arrow_buffer = std::make_shared(arrow_parent_buffer, offset, size); return garrow_buffer_new_raw_parent(&arrow_buffer, buffer); } - -G_DEFINE_TYPE(GArrowMutableBuffer, - garrow_mutable_buffer, - GARROW_TYPE_BUFFER) +G_DEFINE_TYPE(GArrowMutableBuffer, garrow_mutable_buffer, GARROW_TYPE_BUFFER) static void garrow_mutable_buffer_init(GArrowMutableBuffer *object) @@ -489,19 +478,13 @@ garrow_mutable_buffer_new_bytes(GBytes *data) * Since: 0.3.0 */ GArrowMutableBuffer * -garrow_mutable_buffer_slice(GArrowMutableBuffer *buffer, - gint64 offset, - gint64 size) +garrow_mutable_buffer_slice(GArrowMutableBuffer *buffer, gint64 offset, gint64 size) { auto arrow_parent_buffer = garrow_buffer_get_raw(GARROW_BUFFER(buffer)); auto arrow_mutable_buffer = - std::make_shared(arrow_parent_buffer, - offset, - size); - auto arrow_buffer = - std::static_pointer_cast(arrow_mutable_buffer); - auto sliced_buffer = garrow_buffer_new_raw_parent(&arrow_buffer, - GARROW_BUFFER(buffer)); + std::make_shared(arrow_parent_buffer, offset, size); + auto arrow_buffer = std::static_pointer_cast(arrow_mutable_buffer); + auto sliced_buffer = garrow_buffer_new_raw_parent(&arrow_buffer, GARROW_BUFFER(buffer)); return GARROW_MUTABLE_BUFFER(sliced_buffer); } @@ -543,10 +526,7 @@ garrow_mutable_buffer_set_data(GArrowMutableBuffer *buffer, return TRUE; } - -G_DEFINE_TYPE(GArrowResizableBuffer, - garrow_resizable_buffer, - GARROW_TYPE_MUTABLE_BUFFER) +G_DEFINE_TYPE(GArrowResizableBuffer, garrow_resizable_buffer, GARROW_TYPE_MUTABLE_BUFFER) static void garrow_resizable_buffer_init(GArrowResizableBuffer *object) @@ -568,20 +548,17 @@ garrow_resizable_buffer_class_init(GArrowResizableBufferClass *klass) * Since: 0.10.0 */ GArrowResizableBuffer * -garrow_resizable_buffer_new(gint64 initial_size, - GError **error) +garrow_resizable_buffer_new(gint64 initial_size, GError **error) { auto maybe_buffer = arrow::AllocateResizableBuffer(initial_size); if (garrow::check(error, maybe_buffer, "[resizable-buffer][new]")) { - auto arrow_buffer = std::shared_ptr( - *std::move(maybe_buffer)); + auto arrow_buffer = std::shared_ptr(*std::move(maybe_buffer)); return garrow_resizable_buffer_new_raw(&arrow_buffer); } else { return NULL; } } - /** * garrow_resizable_buffer_resize: * @buffer: A #GArrowResizableBuffer. @@ -626,7 +603,6 @@ garrow_resizable_buffer_reserve(GArrowResizableBuffer *buffer, return garrow_error_check(error, status, "[resizable-buffer][capacity]"); } - G_END_DECLS GArrowBuffer * @@ -636,13 +612,10 @@ garrow_buffer_new_raw(std::shared_ptr *arrow_buffer) } GArrowBuffer * -garrow_buffer_new_raw_bytes(std::shared_ptr *arrow_buffer, - GBytes *data) +garrow_buffer_new_raw_bytes(std::shared_ptr *arrow_buffer, GBytes *data) { - auto buffer = GARROW_BUFFER(g_object_new(GARROW_TYPE_BUFFER, - "buffer", arrow_buffer, - "data", data, - NULL)); + auto buffer = GARROW_BUFFER( + g_object_new(GARROW_TYPE_BUFFER, "buffer", arrow_buffer, "data", data, NULL)); return buffer; } @@ -650,10 +623,8 @@ GArrowBuffer * garrow_buffer_new_raw_parent(std::shared_ptr *arrow_buffer, GArrowBuffer *parent) { - auto buffer = GARROW_BUFFER(g_object_new(G_OBJECT_TYPE(parent), - "buffer", arrow_buffer, - "parent", parent, - NULL)); + auto buffer = GARROW_BUFFER( + g_object_new(G_OBJECT_TYPE(parent), "buffer", arrow_buffer, "parent", parent, NULL)); return buffer; } @@ -677,19 +648,15 @@ GArrowMutableBuffer * garrow_mutable_buffer_new_raw_bytes(std::shared_ptr *arrow_buffer, GBytes *data) { - auto buffer = GARROW_MUTABLE_BUFFER(g_object_new(GARROW_TYPE_MUTABLE_BUFFER, - "buffer", arrow_buffer, - "data", data, - NULL)); + auto buffer = GARROW_MUTABLE_BUFFER( + g_object_new(GARROW_TYPE_MUTABLE_BUFFER, "buffer", arrow_buffer, "data", data, NULL)); return buffer; } GArrowResizableBuffer * garrow_resizable_buffer_new_raw(std::shared_ptr *arrow_buffer) { - auto buffer = - GARROW_RESIZABLE_BUFFER(g_object_new(GARROW_TYPE_RESIZABLE_BUFFER, - "buffer", arrow_buffer, - NULL)); + auto buffer = GARROW_RESIZABLE_BUFFER( + g_object_new(GARROW_TYPE_RESIZABLE_BUFFER, "buffer", arrow_buffer, NULL)); return buffer; } diff --git a/c_glib/arrow-glib/buffer.h b/c_glib/arrow-glib/buffer.h index a176071f25240..42bcb8702d41b 100644 --- a/c_glib/arrow-glib/buffer.h +++ b/c_glib/arrow-glib/buffer.h @@ -24,63 +24,60 @@ G_BEGIN_DECLS #define GARROW_TYPE_BUFFER (garrow_buffer_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowBuffer, - garrow_buffer, - GARROW, - BUFFER, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowBuffer, garrow_buffer, GARROW, BUFFER, GObject) struct _GArrowBufferClass { GObjectClass parent_class; }; -GArrowBuffer *garrow_buffer_new (const guint8 *data, - gint64 size); -GArrowBuffer *garrow_buffer_new_bytes (GBytes *data); -gboolean garrow_buffer_equal (GArrowBuffer *buffer, - GArrowBuffer *other_buffer); -gboolean garrow_buffer_equal_n_bytes(GArrowBuffer *buffer, - GArrowBuffer *other_buffer, - gint64 n_bytes); -gboolean garrow_buffer_is_mutable (GArrowBuffer *buffer); -gint64 garrow_buffer_get_capacity (GArrowBuffer *buffer); -GBytes *garrow_buffer_get_data (GArrowBuffer *buffer); -GBytes *garrow_buffer_get_mutable_data(GArrowBuffer *buffer); -gint64 garrow_buffer_get_size (GArrowBuffer *buffer); -GArrowBuffer *garrow_buffer_get_parent (GArrowBuffer *buffer); - -GArrowBuffer *garrow_buffer_copy (GArrowBuffer *buffer, - gint64 start, - gint64 size, - GError **error); -GArrowBuffer *garrow_buffer_slice (GArrowBuffer *buffer, - gint64 offset, - gint64 size); +GArrowBuffer * +garrow_buffer_new(const guint8 *data, gint64 size); +GArrowBuffer * +garrow_buffer_new_bytes(GBytes *data); +gboolean +garrow_buffer_equal(GArrowBuffer *buffer, GArrowBuffer *other_buffer); +gboolean +garrow_buffer_equal_n_bytes(GArrowBuffer *buffer, + GArrowBuffer *other_buffer, + gint64 n_bytes); +gboolean +garrow_buffer_is_mutable(GArrowBuffer *buffer); +gint64 +garrow_buffer_get_capacity(GArrowBuffer *buffer); +GBytes * +garrow_buffer_get_data(GArrowBuffer *buffer); +GBytes * +garrow_buffer_get_mutable_data(GArrowBuffer *buffer); +gint64 +garrow_buffer_get_size(GArrowBuffer *buffer); +GArrowBuffer * +garrow_buffer_get_parent(GArrowBuffer *buffer); +GArrowBuffer * +garrow_buffer_copy(GArrowBuffer *buffer, gint64 start, gint64 size, GError **error); +GArrowBuffer * +garrow_buffer_slice(GArrowBuffer *buffer, gint64 offset, gint64 size); #define GARROW_TYPE_MUTABLE_BUFFER (garrow_mutable_buffer_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowMutableBuffer, - garrow_mutable_buffer, - GARROW, - MUTABLE_BUFFER, - GArrowBuffer) +G_DECLARE_DERIVABLE_TYPE( + GArrowMutableBuffer, garrow_mutable_buffer, GARROW, MUTABLE_BUFFER, GArrowBuffer) struct _GArrowMutableBufferClass { GArrowBufferClass parent_class; }; -GArrowMutableBuffer *garrow_mutable_buffer_new (guint8 *data, - gint64 size); -GArrowMutableBuffer *garrow_mutable_buffer_new_bytes(GBytes *data); -GArrowMutableBuffer *garrow_mutable_buffer_slice(GArrowMutableBuffer *buffer, - gint64 offset, - gint64 size); -gboolean garrow_mutable_buffer_set_data(GArrowMutableBuffer *buffer, - gint64 offset, - const guint8 *data, - gint64 size, - GError **error); - +GArrowMutableBuffer * +garrow_mutable_buffer_new(guint8 *data, gint64 size); +GArrowMutableBuffer * +garrow_mutable_buffer_new_bytes(GBytes *data); +GArrowMutableBuffer * +garrow_mutable_buffer_slice(GArrowMutableBuffer *buffer, gint64 offset, gint64 size); +gboolean +garrow_mutable_buffer_set_data(GArrowMutableBuffer *buffer, + gint64 offset, + const guint8 *data, + gint64 size, + GError **error); #define GARROW_TYPE_RESIZABLE_BUFFER (garrow_resizable_buffer_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowResizableBuffer, @@ -93,14 +90,15 @@ struct _GArrowResizableBufferClass GArrowMutableBufferClass parent_class; }; - -GArrowResizableBuffer *garrow_resizable_buffer_new(gint64 initial_size, - GError **error); -gboolean garrow_resizable_buffer_resize(GArrowResizableBuffer *buffer, - gint64 new_size, - GError **error); -gboolean garrow_resizable_buffer_reserve(GArrowResizableBuffer *buffer, - gint64 new_capacity, - GError **error); +GArrowResizableBuffer * +garrow_resizable_buffer_new(gint64 initial_size, GError **error); +gboolean +garrow_resizable_buffer_resize(GArrowResizableBuffer *buffer, + gint64 new_size, + GError **error); +gboolean +garrow_resizable_buffer_reserve(GArrowResizableBuffer *buffer, + gint64 new_capacity, + GError **error); G_END_DECLS diff --git a/c_glib/arrow-glib/buffer.hpp b/c_glib/arrow-glib/buffer.hpp index 34a28be46cf3a..5d922371c3b6b 100644 --- a/c_glib/arrow-glib/buffer.hpp +++ b/c_glib/arrow-glib/buffer.hpp @@ -26,8 +26,7 @@ GArrowBuffer * garrow_buffer_new_raw(std::shared_ptr *arrow_buffer); GArrowBuffer * -garrow_buffer_new_raw_bytes(std::shared_ptr *arrow_buffer, - GBytes *data); +garrow_buffer_new_raw_bytes(std::shared_ptr *arrow_buffer, GBytes *data); GArrowBuffer * garrow_buffer_new_raw_parent(std::shared_ptr *arrow_buffer, GArrowBuffer *parent); diff --git a/c_glib/arrow-glib/chunked-array-definition.h b/c_glib/arrow-glib/chunked-array-definition.h index 539a4848e8060..b53574ca3296c 100644 --- a/c_glib/arrow-glib/chunked-array-definition.h +++ b/c_glib/arrow-glib/chunked-array-definition.h @@ -24,15 +24,11 @@ G_BEGIN_DECLS #define GARROW_TYPE_CHUNKED_ARRAY (garrow_chunked_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowChunkedArray, - garrow_chunked_array, - GARROW, - CHUNKED_ARRAY, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowChunkedArray, garrow_chunked_array, GARROW, CHUNKED_ARRAY, GObject) struct _GArrowChunkedArrayClass { GObjectClass parent_class; }; - G_END_DECLS diff --git a/c_glib/arrow-glib/chunked-array.cpp b/c_glib/arrow-glib/chunked-array.cpp index c0f2be4c083f1..39c8faad6c085 100644 --- a/c_glib/arrow-glib/chunked-array.cpp +++ b/c_glib/arrow-glib/chunked-array.cpp @@ -35,7 +35,8 @@ G_BEGIN_DECLS * makes a list of #GArrowArrays one logical large array. */ -struct GArrowChunkedArrayPrivate { +struct GArrowChunkedArrayPrivate +{ std::shared_ptr chunked_array; GArrowDataType *data_type; }; @@ -45,14 +46,11 @@ enum { PROP_DATA_TYPE, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowChunkedArray, - garrow_chunked_array, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowChunkedArray, garrow_chunked_array, G_TYPE_OBJECT) -#define GARROW_CHUNKED_ARRAY_GET_PRIVATE(obj) \ - static_cast( \ - garrow_chunked_array_get_instance_private( \ - GARROW_CHUNKED_ARRAY(obj))) +#define GARROW_CHUNKED_ARRAY_GET_PRIVATE(obj) \ + static_cast( \ + garrow_chunked_array_get_instance_private(GARROW_CHUNKED_ARRAY(obj))) static void garrow_chunked_array_dispose(GObject *object) @@ -116,7 +114,7 @@ static void garrow_chunked_array_init(GArrowChunkedArray *object) { auto priv = GARROW_CHUNKED_ARRAY_GET_PRIVATE(object); - new(&priv->chunked_array) std::shared_ptr; + new (&priv->chunked_array) std::shared_ptr; } static void @@ -127,24 +125,24 @@ garrow_chunked_array_class_init(GArrowChunkedArrayClass *klass) gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_chunked_array_dispose; - gobject_class->finalize = garrow_chunked_array_finalize; + gobject_class->dispose = garrow_chunked_array_dispose; + gobject_class->finalize = garrow_chunked_array_finalize; gobject_class->set_property = garrow_chunked_array_set_property; gobject_class->get_property = garrow_chunked_array_get_property; - spec = g_param_spec_pointer("chunked-array", - "Chunked array", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "chunked-array", + "Chunked array", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_CHUNKED_ARRAY, spec); - spec = g_param_spec_object("data-type", - "Data type", - "The data type of this chunked array", - GARROW_TYPE_DATA_TYPE, - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "data-type", + "Data type", + "The data type of this chunked array", + GARROW_TYPE_DATA_TYPE, + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_DATA_TYPE, spec); } @@ -188,8 +186,7 @@ GArrowChunkedArray * garrow_chunked_array_new_empty(GArrowDataType *data_type, GError **error) { auto arrow_data_type = garrow_data_type_get_raw(data_type); - auto arrow_chunked_array_result = - arrow::ChunkedArray::MakeEmpty(arrow_data_type); + auto arrow_chunked_array_result = arrow::ChunkedArray::MakeEmpty(arrow_data_type); if (garrow::check(error, arrow_chunked_array_result, "[chunked-array][new]")) { auto arrow_chunked_array = *arrow_chunked_array_result; return garrow_chunked_array_new_raw(&arrow_chunked_array); @@ -319,8 +316,7 @@ garrow_chunked_array_get_n_chunks(GArrowChunkedArray *chunked_array) * Returns: (transfer full): The i-th chunk of the chunked array. */ GArrowArray * -garrow_chunked_array_get_chunk(GArrowChunkedArray *chunked_array, - guint i) +garrow_chunked_array_get_chunk(GArrowChunkedArray *chunked_array, guint i) { const auto arrow_chunked_array = garrow_chunked_array_get_raw(chunked_array); auto arrow_chunk = arrow_chunked_array->chunk(i); @@ -358,7 +354,7 @@ garrow_chunked_array_get_chunks(GArrowChunkedArray *chunked_array) * `offset` to `offset + length` range. The sub #GArrowChunkedArray shares * values with the base #GArrowChunkedArray. */ -GArrowChunkedArray * +GArrowChunkedArray * garrow_chunked_array_slice(GArrowChunkedArray *chunked_array, guint64 offset, guint64 length) @@ -403,9 +399,7 @@ garrow_chunked_array_combine(GArrowChunkedArray *chunked_array, GError **error) { const auto arrow_chunked_array = garrow_chunked_array_get_raw(chunked_array); auto arrow_combined_array = arrow::Concatenate(arrow_chunked_array->chunks()); - if (garrow::check(error, - arrow_combined_array, - "[chunked-array][combine]")) { + if (garrow::check(error, arrow_combined_array, "[chunked-array][combine]")) { return garrow_array_new_raw(&(*arrow_combined_array)); } else { return NULL; @@ -415,22 +409,21 @@ garrow_chunked_array_combine(GArrowChunkedArray *chunked_array, GError **error) G_END_DECLS GArrowChunkedArray * -garrow_chunked_array_new_raw( - std::shared_ptr *arrow_chunked_array) +garrow_chunked_array_new_raw(std::shared_ptr *arrow_chunked_array) { return garrow_chunked_array_new_raw(arrow_chunked_array, nullptr); } GArrowChunkedArray * -garrow_chunked_array_new_raw( - std::shared_ptr *arrow_chunked_array, - GArrowDataType *data_type) +garrow_chunked_array_new_raw(std::shared_ptr *arrow_chunked_array, + GArrowDataType *data_type) { - auto chunked_array = - GARROW_CHUNKED_ARRAY(g_object_new(GARROW_TYPE_CHUNKED_ARRAY, - "chunked-array", arrow_chunked_array, - "data-type", data_type, - NULL)); + auto chunked_array = GARROW_CHUNKED_ARRAY(g_object_new(GARROW_TYPE_CHUNKED_ARRAY, + "chunked-array", + arrow_chunked_array, + "data-type", + data_type, + NULL)); return chunked_array; } diff --git a/c_glib/arrow-glib/chunked-array.h b/c_glib/arrow-glib/chunked-array.h index e8a2df931f42f..6ca497942ff2e 100644 --- a/c_glib/arrow-glib/chunked-array.h +++ b/c_glib/arrow-glib/chunked-array.h @@ -25,15 +25,14 @@ G_BEGIN_DECLS GArrowChunkedArray * -garrow_chunked_array_new(GList *chunks, - GError **error); +garrow_chunked_array_new(GList *chunks, GError **error); GARROW_AVAILABLE_IN_11_0 GArrowChunkedArray * -garrow_chunked_array_new_empty(GArrowDataType *data_type, - GError **error); +garrow_chunked_array_new_empty(GArrowDataType *data_type, GError **error); -gboolean garrow_chunked_array_equal(GArrowChunkedArray *chunked_array, - GArrowChunkedArray *other_chunked_array); +gboolean +garrow_chunked_array_equal(GArrowChunkedArray *chunked_array, + GArrowChunkedArray *other_chunked_array); GArrowDataType * garrow_chunked_array_get_value_data_type(GArrowChunkedArray *chunked_array); @@ -41,22 +40,28 @@ GArrowType garrow_chunked_array_get_value_type(GArrowChunkedArray *chunked_array); GARROW_DEPRECATED_IN_0_15_FOR(garrow_chunked_array_get_n_rows) -guint64 garrow_chunked_array_get_length (GArrowChunkedArray *chunked_array); +guint64 +garrow_chunked_array_get_length(GArrowChunkedArray *chunked_array); GARROW_AVAILABLE_IN_0_15 -guint64 garrow_chunked_array_get_n_rows (GArrowChunkedArray *chunked_array); -guint64 garrow_chunked_array_get_n_nulls(GArrowChunkedArray *chunked_array); -guint garrow_chunked_array_get_n_chunks (GArrowChunkedArray *chunked_array); - -GArrowArray *garrow_chunked_array_get_chunk(GArrowChunkedArray *chunked_array, - guint i); -GList *garrow_chunked_array_get_chunks(GArrowChunkedArray *chunked_array); -GArrowChunkedArray *garrow_chunked_array_slice(GArrowChunkedArray *chunked_array, - guint64 offset, - guint64 length); -gchar *garrow_chunked_array_to_string(GArrowChunkedArray *chunked_array, - GError **error); +guint64 +garrow_chunked_array_get_n_rows(GArrowChunkedArray *chunked_array); +guint64 +garrow_chunked_array_get_n_nulls(GArrowChunkedArray *chunked_array); +guint +garrow_chunked_array_get_n_chunks(GArrowChunkedArray *chunked_array); + +GArrowArray * +garrow_chunked_array_get_chunk(GArrowChunkedArray *chunked_array, guint i); +GList * +garrow_chunked_array_get_chunks(GArrowChunkedArray *chunked_array); +GArrowChunkedArray * +garrow_chunked_array_slice(GArrowChunkedArray *chunked_array, + guint64 offset, + guint64 length); +gchar * +garrow_chunked_array_to_string(GArrowChunkedArray *chunked_array, GError **error); GARROW_AVAILABLE_IN_4_0 -GArrowArray *garrow_chunked_array_combine(GArrowChunkedArray *chunked_array, - GError **error); +GArrowArray * +garrow_chunked_array_combine(GArrowChunkedArray *chunked_array, GError **error); G_END_DECLS diff --git a/c_glib/arrow-glib/chunked-array.hpp b/c_glib/arrow-glib/chunked-array.hpp index 06802366ec1fb..9ce6cc76adfbf 100644 --- a/c_glib/arrow-glib/chunked-array.hpp +++ b/c_glib/arrow-glib/chunked-array.hpp @@ -24,11 +24,9 @@ #include GArrowChunkedArray * -garrow_chunked_array_new_raw( - std::shared_ptr *arrow_chunked_array); +garrow_chunked_array_new_raw(std::shared_ptr *arrow_chunked_array); GArrowChunkedArray * -garrow_chunked_array_new_raw( - std::shared_ptr *arrow_chunked_array, - GArrowDataType *data_type); +garrow_chunked_array_new_raw(std::shared_ptr *arrow_chunked_array, + GArrowDataType *data_type); std::shared_ptr garrow_chunked_array_get_raw(GArrowChunkedArray *chunked_array); diff --git a/c_glib/arrow-glib/codec.cpp b/c_glib/arrow-glib/codec.cpp index fecf9770487cc..a14cda231761b 100644 --- a/c_glib/arrow-glib/codec.cpp +++ b/c_glib/arrow-glib/codec.cpp @@ -33,7 +33,8 @@ G_BEGIN_DECLS * #GArrowCodec is a class for compressing and decompressing data. */ -typedef struct GArrowCodecPrivate_ { +typedef struct GArrowCodecPrivate_ +{ std::shared_ptr codec; } GArrowCodecPrivate; @@ -43,10 +44,9 @@ enum { G_DEFINE_TYPE_WITH_PRIVATE(GArrowCodec, garrow_codec, G_TYPE_OBJECT) -#define GARROW_CODEC_GET_PRIVATE(object) \ - static_cast( \ - garrow_codec_get_instance_private( \ - GARROW_CODEC(object))) +#define GARROW_CODEC_GET_PRIVATE(object) \ + static_cast( \ + garrow_codec_get_instance_private(GARROW_CODEC(object))) static void garrow_codec_finalize(GObject *object) @@ -94,7 +94,7 @@ static void garrow_codec_init(GArrowCodec *object) { auto priv = GARROW_CODEC_GET_PRIVATE(object); - new(&priv->codec) std::shared_ptr; + new (&priv->codec) std::shared_ptr; } static void @@ -104,15 +104,15 @@ garrow_codec_class_init(GArrowCodecClass *klass) auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_codec_finalize; + gobject_class->finalize = garrow_codec_finalize; gobject_class->set_property = garrow_codec_set_property; gobject_class->get_property = garrow_codec_get_property; - spec = g_param_spec_pointer("codec", - "Codec", - "The raw std::shared_ptr *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "codec", + "Codec", + "The raw std::shared_ptr *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_CODEC, spec); } @@ -126,14 +126,12 @@ garrow_codec_class_init(GArrowCodecClass *klass) * Since: 0.12.0 */ GArrowCodec * -garrow_codec_new(GArrowCompressionType type, - GError **error) +garrow_codec_new(GArrowCompressionType type, GError **error) { auto arrow_type = garrow_compression_type_to_raw(type); auto arrow_codec = arrow::util::Codec::Create(arrow_type); if (garrow::check(error, arrow_codec, "[codec][new]")) { - std::shared_ptr arrow_codec_shared = - std::move(*arrow_codec); + std::shared_ptr arrow_codec_shared = std::move(*arrow_codec); return garrow_codec_new_raw(&arrow_codec_shared); } else { return NULL; @@ -249,9 +247,7 @@ garrow_compression_type_to_raw(GArrowCompressionType type) GArrowCodec * garrow_codec_new_raw(std::shared_ptr *arrow_codec) { - auto codec = GARROW_CODEC(g_object_new(GARROW_TYPE_CODEC, - "codec", arrow_codec, - NULL)); + auto codec = GARROW_CODEC(g_object_new(GARROW_TYPE_CODEC, "codec", arrow_codec, NULL)); return codec; } diff --git a/c_glib/arrow-glib/codec.h b/c_glib/arrow-glib/codec.h index 6e177af9eede3..5f7d53c8f875d 100644 --- a/c_glib/arrow-glib/codec.h +++ b/c_glib/arrow-glib/codec.h @@ -48,22 +48,18 @@ typedef enum { GARROW_COMPRESSION_TYPE_BZ2 } GArrowCompressionType; - #define GARROW_TYPE_CODEC (garrow_codec_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowCodec, - garrow_codec, - GARROW, - CODEC, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowCodec, garrow_codec, GARROW, CODEC, GObject) struct _GArrowCodecClass { GObjectClass parent_class; }; -GArrowCodec *garrow_codec_new(GArrowCompressionType type, - GError **error); +GArrowCodec * +garrow_codec_new(GArrowCompressionType type, GError **error); -const gchar *garrow_codec_get_name(GArrowCodec *codec); +const gchar * +garrow_codec_get_name(GArrowCodec *codec); GARROW_AVAILABLE_IN_2_0 GArrowCompressionType garrow_codec_get_compression_type(GArrowCodec *codec); diff --git a/c_glib/arrow-glib/composite-array.cpp b/c_glib/arrow-glib/composite-array.cpp index 6ca22e82389e4..cc254b26e1e4c 100644 --- a/c_glib/arrow-glib/composite-array.cpp +++ b/c_glib/arrow-glib/composite-array.cpp @@ -70,7 +70,8 @@ G_BEGIN_DECLS * array to a normal array by garrow_run_end_encoded_array_decode(). */ -typedef struct GArrowListArrayPrivate_ { +typedef struct GArrowListArrayPrivate_ +{ GArrowArray *raw_values; } GArrowListArrayPrivate; @@ -78,14 +79,11 @@ enum { PROP_RAW_VALUES = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowListArray, - garrow_list_array, - GARROW_TYPE_ARRAY) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowListArray, garrow_list_array, GARROW_TYPE_ARRAY) -#define GARROW_LIST_ARRAY_GET_PRIVATE(obj) \ - static_cast( \ - garrow_list_array_get_instance_private( \ - GARROW_LIST_ARRAY(obj))) +#define GARROW_LIST_ARRAY_GET_PRIVATE(obj) \ + static_cast( \ + garrow_list_array_get_instance_private(GARROW_LIST_ARRAY(obj))) G_END_DECLS template @@ -101,21 +99,24 @@ garrow_base_list_array_new(GArrowDataType *data_type, const auto arrow_value_offsets = garrow_buffer_get_raw(value_offsets); const auto arrow_values = garrow_array_get_raw(values); const auto arrow_null_bitmap = garrow_buffer_get_raw(null_bitmap); - auto arrow_list_array = - std::make_shared(arrow_data_type, - length, - arrow_value_offsets, - arrow_values, - arrow_null_bitmap, - n_nulls); - auto arrow_array = - std::static_pointer_cast(arrow_list_array); + auto arrow_list_array = std::make_shared(arrow_data_type, + length, + arrow_value_offsets, + arrow_values, + arrow_null_bitmap, + n_nulls); + auto arrow_array = std::static_pointer_cast(arrow_list_array); return garrow_array_new_raw(&arrow_array, - "array", &arrow_array, - "value-data-type", data_type, - "null-bitmap", null_bitmap, - "buffer1", value_offsets, - "raw-values", values, + "array", + &arrow_array, + "value-data-type", + data_type, + "null-bitmap", + null_bitmap, + "buffer1", + value_offsets, + "raw-values", + values, NULL); }; @@ -124,25 +125,19 @@ GArrowDataType * garrow_base_list_array_get_value_type(GArrowArray *array) { auto arrow_array = garrow_array_get_raw(array); - auto arrow_list_array = - std::static_pointer_cast(arrow_array); + auto arrow_list_array = std::static_pointer_cast(arrow_array); auto arrow_value_type = arrow_list_array->value_type(); return garrow_data_type_new_raw(&arrow_value_type); }; template GArrowArray * -garrow_base_list_array_get_value(GArrowArray *array, - gint64 i) +garrow_base_list_array_get_value(GArrowArray *array, gint64 i) { auto arrow_array = garrow_array_get_raw(array); - auto arrow_list_array = - std::static_pointer_cast(arrow_array); + auto arrow_list_array = std::static_pointer_cast(arrow_array); auto arrow_list = arrow_list_array->value_slice(i); - return garrow_array_new_raw(&arrow_list, - "array", &arrow_list, - "parent", array, - NULL); + return garrow_array_new_raw(&arrow_list, "array", &arrow_list, "parent", array, NULL); }; template @@ -150,12 +145,13 @@ GArrowArray * garrow_base_list_array_get_values(GArrowArray *array) { auto arrow_array = garrow_array_get_raw(array); - auto arrow_list_array = - std::static_pointer_cast(arrow_array); + auto arrow_list_array = std::static_pointer_cast(arrow_array); auto arrow_values = arrow_list_array->values(); return garrow_array_new_raw(&arrow_values, - "array", &arrow_values, - "parent", array, + "array", + &arrow_values, + "parent", + array, NULL); }; @@ -164,8 +160,7 @@ typename LIST_ARRAY_CLASS::offset_type garrow_base_list_array_get_value_offset(GArrowArray *array, gint64 i) { auto arrow_array = garrow_array_get_raw(array); - auto arrow_list_array = - std::static_pointer_cast(arrow_array); + auto arrow_list_array = std::static_pointer_cast(arrow_array); return arrow_list_array->value_offset(i); }; @@ -174,8 +169,7 @@ typename LIST_ARRAY_CLASS::offset_type garrow_base_list_array_get_value_length(GArrowArray *array, gint64 i) { auto arrow_array = garrow_array_get_raw(array); - auto arrow_list_array = - std::static_pointer_cast(arrow_array); + auto arrow_list_array = std::static_pointer_cast(arrow_array); return arrow_list_array->value_length(i); }; @@ -185,12 +179,10 @@ garrow_base_list_array_get_value_offsets(GArrowArray *array, gint64 *n_offsets) { auto arrow_array = garrow_array_get_raw(array); *n_offsets = arrow_array->length() + 1; - auto arrow_list_array = - std::static_pointer_cast(arrow_array); + auto arrow_list_array = std::static_pointer_cast(arrow_array); return arrow_list_array->raw_value_offsets(); }; - G_BEGIN_DECLS static void @@ -203,7 +195,6 @@ garrow_list_array_dispose(GObject *object) priv->raw_values = NULL; } - G_OBJECT_CLASS(garrow_list_array_parent_class)->dispose(object); } @@ -258,12 +249,12 @@ garrow_list_array_class_init(GArrowListArrayClass *klass) gobject_class->get_property = garrow_list_array_get_property; GParamSpec *spec; - spec = g_param_spec_object("raw-values", - "Raw values", - "The raw values", - GARROW_TYPE_ARRAY, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "raw-values", + "Raw values", + "The raw values", + GARROW_TYPE_ARRAY, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_RAW_VALUES, spec); } @@ -292,13 +283,12 @@ garrow_list_array_new(GArrowDataType *data_type, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto list_array = garrow_base_list_array_new( - data_type, - length, - value_offsets, - values, - null_bitmap, - n_nulls); + auto list_array = garrow_base_list_array_new(data_type, + length, + value_offsets, + values, + null_bitmap, + n_nulls); return GARROW_LIST_ARRAY(list_array); } @@ -311,8 +301,7 @@ garrow_list_array_new(GArrowDataType *data_type, GArrowDataType * garrow_list_array_get_value_type(GArrowListArray *array) { - return garrow_base_list_array_get_value_type( - GARROW_ARRAY(array)); + return garrow_base_list_array_get_value_type(GARROW_ARRAY(array)); } /** @@ -323,11 +312,9 @@ garrow_list_array_get_value_type(GArrowListArray *array) * Returns: (transfer full): The i-th list. */ GArrowArray * -garrow_list_array_get_value(GArrowListArray *array, - gint64 i) +garrow_list_array_get_value(GArrowListArray *array, gint64 i) { - return garrow_base_list_array_get_value( - GARROW_ARRAY(array), i); + return garrow_base_list_array_get_value(GARROW_ARRAY(array), i); } /** @@ -341,8 +328,7 @@ garrow_list_array_get_value(GArrowListArray *array, GArrowArray * garrow_list_array_get_values(GArrowListArray *array) { - return garrow_base_list_array_get_values( - GARROW_ARRAY(array)); + return garrow_base_list_array_get_values(GARROW_ARRAY(array)); } /** @@ -357,8 +343,8 @@ garrow_list_array_get_values(GArrowListArray *array) gint32 garrow_list_array_get_value_offset(GArrowListArray *array, gint64 i) { - return garrow_base_list_array_get_value_offset( - GARROW_ARRAY(array), i); + return garrow_base_list_array_get_value_offset(GARROW_ARRAY(array), + i); } /** @@ -373,8 +359,8 @@ garrow_list_array_get_value_offset(GArrowListArray *array, gint64 i) gint32 garrow_list_array_get_value_length(GArrowListArray *array, gint64 i) { - return garrow_base_list_array_get_value_length( - GARROW_ARRAY(array), i); + return garrow_base_list_array_get_value_length(GARROW_ARRAY(array), + i); } /** @@ -390,12 +376,12 @@ garrow_list_array_get_value_length(GArrowListArray *array, gint64 i) const gint32 * garrow_list_array_get_value_offsets(GArrowListArray *array, gint64 *n_offsets) { - return garrow_base_list_array_get_value_offsets( - GARROW_ARRAY(array), n_offsets); + return garrow_base_list_array_get_value_offsets(GARROW_ARRAY(array), + n_offsets); } - -typedef struct GArrowLargeListArrayPrivate_ { +typedef struct GArrowLargeListArrayPrivate_ +{ GArrowArray *raw_values; } GArrowLargeListArrayPrivate; @@ -403,10 +389,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowLargeListArray, garrow_large_list_array, GARROW_TYPE_ARRAY) -#define GARROW_LARGE_LIST_ARRAY_GET_PRIVATE(obj) \ - static_cast( \ - garrow_large_list_array_get_instance_private( \ - GARROW_LARGE_LIST_ARRAY(obj))) +#define GARROW_LARGE_LIST_ARRAY_GET_PRIVATE(obj) \ + static_cast( \ + garrow_large_list_array_get_instance_private(GARROW_LARGE_LIST_ARRAY(obj))) static void garrow_large_list_array_dispose(GObject *object) @@ -472,12 +457,12 @@ garrow_large_list_array_class_init(GArrowLargeListArrayClass *klass) gobject_class->get_property = garrow_large_list_array_get_property; GParamSpec *spec; - spec = g_param_spec_object("raw-values", - "Raw values", - "The raw values", - GARROW_TYPE_ARRAY, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "raw-values", + "Raw values", + "The raw values", + GARROW_TYPE_ARRAY, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_RAW_VALUES, spec); } @@ -506,13 +491,12 @@ garrow_large_list_array_new(GArrowDataType *data_type, GArrowBuffer *null_bitmap, gint64 n_nulls) { - auto large_list_array = garrow_base_list_array_new( - data_type, - length, - value_offsets, - values, - null_bitmap, - n_nulls); + auto large_list_array = garrow_base_list_array_new(data_type, + length, + value_offsets, + values, + null_bitmap, + n_nulls); return GARROW_LARGE_LIST_ARRAY(large_list_array); } @@ -541,12 +525,9 @@ garrow_large_list_array_get_value_type(GArrowLargeListArray *array) * Since: 0.16.0 */ GArrowArray * -garrow_large_list_array_get_value(GArrowLargeListArray *array, - gint64 i) +garrow_large_list_array_get_value(GArrowLargeListArray *array, gint64 i) { - return garrow_base_list_array_get_value( - GARROW_ARRAY(array), - i); + return garrow_base_list_array_get_value(GARROW_ARRAY(array), i); } /** @@ -560,8 +541,7 @@ garrow_large_list_array_get_value(GArrowLargeListArray *array, GArrowArray * garrow_large_list_array_get_values(GArrowLargeListArray *array) { - return garrow_base_list_array_get_values( - GARROW_ARRAY(array)); + return garrow_base_list_array_get_values(GARROW_ARRAY(array)); } /** @@ -577,7 +557,8 @@ gint64 garrow_large_list_array_get_value_offset(GArrowLargeListArray *array, gint64 i) { return garrow_base_list_array_get_value_offset( - GARROW_ARRAY(array), i); + GARROW_ARRAY(array), + i); } /** @@ -593,7 +574,8 @@ gint64 garrow_large_list_array_get_value_length(GArrowLargeListArray *array, gint64 i) { return garrow_base_list_array_get_value_length( - GARROW_ARRAY(array), i); + GARROW_ARRAY(array), + i); } /** @@ -607,26 +589,23 @@ garrow_large_list_array_get_value_length(GArrowLargeListArray *array, gint64 i) * Since: 2.0.0 */ const gint64 * -garrow_large_list_array_get_value_offsets(GArrowLargeListArray *array, - gint64 *n_offsets) +garrow_large_list_array_get_value_offsets(GArrowLargeListArray *array, gint64 *n_offsets) { return garrow_base_list_array_get_value_offsets( - GARROW_ARRAY(array), n_offsets); + GARROW_ARRAY(array), + n_offsets); } - -typedef struct GArrowStructArrayPrivate_ { +typedef struct GArrowStructArrayPrivate_ +{ GPtrArray *fields; } GArrowStructArrayPrivate; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowStructArray, - garrow_struct_array, - GARROW_TYPE_ARRAY) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowStructArray, garrow_struct_array, GARROW_TYPE_ARRAY) -#define GARROW_STRUCT_ARRAY_GET_PRIVATE(obj) \ - static_cast( \ - garrow_struct_array_get_instance_private( \ - GARROW_STRUCT_ARRAY(obj))) +#define GARROW_STRUCT_ARRAY_GET_PRIVATE(obj) \ + static_cast( \ + garrow_struct_array_get_instance_private(GARROW_STRUCT_ARRAY(obj))) static void garrow_struct_array_dispose(GObject *object) @@ -684,19 +663,18 @@ garrow_struct_array_new(GArrowDataType *data_type, arrow_fields.push_back(garrow_array_get_raw(field)); } const auto arrow_null_bitmap = garrow_buffer_get_raw(null_bitmap); - auto arrow_struct_array = - std::make_shared(arrow_data_type, - length, - arrow_fields, - arrow_null_bitmap, - n_nulls); - auto arrow_array = - std::static_pointer_cast(arrow_struct_array); - auto struct_array = - garrow_array_new_raw(&arrow_array, - "array", &arrow_array, - "null-bitmap", null_bitmap, - NULL); + auto arrow_struct_array = std::make_shared(arrow_data_type, + length, + arrow_fields, + arrow_null_bitmap, + n_nulls); + auto arrow_array = std::static_pointer_cast(arrow_struct_array); + auto struct_array = garrow_array_new_raw(&arrow_array, + "array", + &arrow_array, + "null-bitmap", + null_bitmap, + NULL); auto priv = GARROW_STRUCT_ARRAY_GET_PRIVATE(struct_array); priv->fields = g_ptr_array_sized_new(arrow_fields.size()); g_ptr_array_set_free_func(priv->fields, g_object_unref); @@ -713,8 +691,7 @@ garrow_struct_array_get_fields_internal(GArrowStructArray *array) auto priv = GARROW_STRUCT_ARRAY_GET_PRIVATE(array); if (!priv->fields) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - auto arrow_struct_array = - std::static_pointer_cast(arrow_array); + auto arrow_struct_array = std::static_pointer_cast(arrow_array); auto arrow_fields = arrow_struct_array->fields(); priv->fields = g_ptr_array_sized_new(arrow_fields.size()); g_ptr_array_set_free_func(priv->fields, g_object_unref); @@ -733,8 +710,7 @@ garrow_struct_array_get_fields_internal(GArrowStructArray *array) * Returns: (transfer full): The i-th field. */ GArrowArray * -garrow_struct_array_get_field(GArrowStructArray *array, - gint i) +garrow_struct_array_get_field(GArrowStructArray *array, gint i) { auto fields = garrow_struct_array_get_fields_internal(array); if (i < 0) { @@ -785,8 +761,7 @@ GList * garrow_struct_array_flatten(GArrowStructArray *array, GError **error) { const auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - auto arrow_struct_array = - std::static_pointer_cast(arrow_array); + auto arrow_struct_array = std::static_pointer_cast(arrow_array); auto memory_pool = arrow::default_memory_pool(); auto arrow_arrays = arrow_struct_array->Flatten(memory_pool); @@ -803,8 +778,8 @@ garrow_struct_array_flatten(GArrowStructArray *array, GError **error) return g_list_reverse(arrays); } - -typedef struct GArrowMapArrayPrivate_ { +typedef struct GArrowMapArrayPrivate_ +{ GArrowArray *offsets; GArrowArray *keys; GArrowArray *items; @@ -816,14 +791,11 @@ enum { PROP_ITEMS, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowMapArray, - garrow_map_array, - GARROW_TYPE_LIST_ARRAY) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowMapArray, garrow_map_array, GARROW_TYPE_LIST_ARRAY) -#define GARROW_MAP_ARRAY_GET_PRIVATE(obj) \ - static_cast( \ - garrow_map_array_get_instance_private( \ - GARROW_MAP_ARRAY(obj))) +#define GARROW_MAP_ARRAY_GET_PRIVATE(obj) \ + static_cast( \ + garrow_map_array_get_instance_private(GARROW_MAP_ARRAY(obj))) static void garrow_map_array_dispose(GObject *object) @@ -911,28 +883,28 @@ garrow_map_array_class_init(GArrowMapArrayClass *klass) gobject_class->get_property = garrow_map_array_get_property; GParamSpec *spec; - spec = g_param_spec_object("offsets", - "Offsets", - "The GArrowArray for offsets", - GARROW_TYPE_ARRAY, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "offsets", + "Offsets", + "The GArrowArray for offsets", + GARROW_TYPE_ARRAY, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_OFFSETS, spec); - spec = g_param_spec_object("keys", - "Keys", - "The GArrowArray for keys", - GARROW_TYPE_ARRAY, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "keys", + "Keys", + "The GArrowArray for keys", + GARROW_TYPE_ARRAY, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_KEYS, spec); - spec = g_param_spec_object("items", - "Items", - "The GArrowArray for items", - GARROW_TYPE_ARRAY, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "items", + "Items", + "The GArrowArray for items", + GARROW_TYPE_ARRAY, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_ITEMS, spec); } @@ -965,10 +937,14 @@ garrow_map_array_new(GArrowArray *offsets, if (garrow::check(error, arrow_array_result, "[map-array][new]")) { auto arrow_array = *arrow_array_result; return GARROW_MAP_ARRAY(garrow_array_new_raw(&arrow_array, - "array", &arrow_array, - "offsets", offsets, - "keys", keys, - "items", items, + "array", + &arrow_array, + "offsets", + offsets, + "keys", + keys, + "items", + items, NULL)); } else { return NULL; @@ -993,8 +969,7 @@ garrow_map_array_get_keys(GArrowMapArray *array) } auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - auto arrow_map_array = - std::static_pointer_cast(arrow_array); + auto arrow_map_array = std::static_pointer_cast(arrow_array); auto arrow_keys = arrow_map_array->keys(); return garrow_array_new_raw(&arrow_keys); } @@ -1017,14 +992,13 @@ garrow_map_array_get_items(GArrowMapArray *array) } auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - auto arrow_map_array = - std::static_pointer_cast(arrow_array); + auto arrow_map_array = std::static_pointer_cast(arrow_array); auto arrow_items = arrow_map_array->items(); return garrow_array_new_raw(&arrow_items); } - -typedef struct GArrowUnionArrayPrivate_ { +typedef struct GArrowUnionArrayPrivate_ +{ GArrowInt8Array *type_ids; GPtrArray *fields; } GArrowUnionArrayPrivate; @@ -1034,14 +1008,11 @@ enum { PROP_FIELDS, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowUnionArray, - garrow_union_array, - GARROW_TYPE_ARRAY) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowUnionArray, garrow_union_array, GARROW_TYPE_ARRAY) -#define GARROW_UNION_ARRAY_GET_PRIVATE(obj) \ - static_cast( \ - garrow_union_array_get_instance_private( \ - GARROW_UNION_ARRAY(obj))) +#define GARROW_UNION_ARRAY_GET_PRIVATE(obj) \ + static_cast( \ + garrow_union_array_get_instance_private(GARROW_UNION_ARRAY(obj))) static void garrow_union_array_dispose(GObject *object) @@ -1112,12 +1083,12 @@ garrow_union_array_class_init(GArrowUnionArrayClass *klass) gobject_class->get_property = garrow_union_array_get_property; GParamSpec *spec; - spec = g_param_spec_object("type-ids", - "Type IDs", - "The GArrowInt8Array for type IDs", - GARROW_TYPE_INT8_ARRAY, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "type-ids", + "Type IDs", + "The GArrowInt8Array for type IDs", + GARROW_TYPE_INT8_ARRAY, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_TYPE_IDS, spec); } @@ -1131,12 +1102,10 @@ garrow_union_array_class_init(GArrowUnionArrayClass *klass) * Since: 12.0.0 */ gint8 -garrow_union_array_get_type_code(GArrowUnionArray *array, - gint64 i) +garrow_union_array_get_type_code(GArrowUnionArray *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - auto arrow_union_array = - std::static_pointer_cast(arrow_array); + auto arrow_union_array = std::static_pointer_cast(arrow_array); return arrow_union_array->type_code(i); } @@ -1150,12 +1119,10 @@ garrow_union_array_get_type_code(GArrowUnionArray *array, * Since: 12.0.0 */ gint -garrow_union_array_get_child_id(GArrowUnionArray *array, - gint64 i) +garrow_union_array_get_child_id(GArrowUnionArray *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - auto arrow_union_array = - std::static_pointer_cast(arrow_array); + auto arrow_union_array = std::static_pointer_cast(arrow_array); return arrow_union_array->child_id(i); } @@ -1168,14 +1135,12 @@ garrow_union_array_get_child_id(GArrowUnionArray *array, * #GArrowArray or %NULL on out of range. */ GArrowArray * -garrow_union_array_get_field(GArrowUnionArray *array, - gint i) +garrow_union_array_get_field(GArrowUnionArray *array, gint i) { auto priv = GARROW_UNION_ARRAY_GET_PRIVATE(array); if (!priv->fields) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - auto arrow_union_array = - std::static_pointer_cast(arrow_array); + auto arrow_union_array = std::static_pointer_cast(arrow_array); auto n_fields = arrow_union_array->num_fields(); priv->fields = g_ptr_array_sized_new(n_fields); g_ptr_array_set_free_func(priv->fields, g_object_unref); @@ -1199,10 +1164,7 @@ garrow_union_array_get_field(GArrowUnionArray *array, return field; } - -G_DEFINE_TYPE(GArrowSparseUnionArray, - garrow_sparse_union_array, - GARROW_TYPE_UNION_ARRAY) +G_DEFINE_TYPE(GArrowSparseUnionArray, garrow_sparse_union_array, GARROW_TYPE_UNION_ARRAY) static void garrow_sparse_union_array_init(GArrowSparseUnionArray *object) @@ -1245,16 +1207,16 @@ garrow_sparse_union_array_new_internal(GArrowSparseUnionDataType *data_type, arrow_sparse_union_array_result = arrow::SparseUnionArray::Make(*arrow_type_ids, arrow_fields); } - if (garrow::check(error, - arrow_sparse_union_array_result, - context)) { + if (garrow::check(error, arrow_sparse_union_array_result, context)) { auto arrow_sparse_union_array = *arrow_sparse_union_array_result; - auto sparse_union_array = - garrow_array_new_raw(&arrow_sparse_union_array, - "array", &arrow_sparse_union_array, - "value-data-type", data_type, - "type-ids", type_ids, - NULL); + auto sparse_union_array = garrow_array_new_raw(&arrow_sparse_union_array, + "array", + &arrow_sparse_union_array, + "value-data-type", + data_type, + "type-ids", + type_ids, + NULL); auto priv = GARROW_UNION_ARRAY_GET_PRIVATE(sparse_union_array); priv->fields = g_ptr_array_sized_new(arrow_fields.size()); g_ptr_array_set_free_func(priv->fields, g_object_unref); @@ -1281,9 +1243,7 @@ garrow_sparse_union_array_new_internal(GArrowSparseUnionDataType *data_type, * Since: 0.12.0 */ GArrowSparseUnionArray * -garrow_sparse_union_array_new(GArrowInt8Array *type_ids, - GList *fields, - GError **error) +garrow_sparse_union_array_new(GArrowInt8Array *type_ids, GList *fields, GError **error) { return garrow_sparse_union_array_new_internal(NULL, type_ids, @@ -1311,16 +1271,15 @@ garrow_sparse_union_array_new_data_type(GArrowSparseUnionDataType *data_type, GList *fields, GError **error) { - return garrow_sparse_union_array_new_internal( - data_type, - type_ids, - fields, - error, - "[sparse-union-array][new][data-type]"); + return garrow_sparse_union_array_new_internal(data_type, + type_ids, + fields, + error, + "[sparse-union-array][new][data-type]"); } - -typedef struct GArrowDenseUnionArrayPrivate_ { +typedef struct GArrowDenseUnionArrayPrivate_ +{ GArrowInt32Array *value_offsets; } GArrowDenseUnionArrayPrivate; @@ -1332,10 +1291,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowDenseUnionArray, garrow_dense_union_array, GARROW_TYPE_UNION_ARRAY) -#define GARROW_DENSE_UNION_ARRAY_GET_PRIVATE(obj) \ - static_cast( \ - garrow_dense_union_array_get_instance_private( \ - GARROW_DENSE_UNION_ARRAY(obj))) +#define GARROW_DENSE_UNION_ARRAY_GET_PRIVATE(obj) \ + static_cast( \ + garrow_dense_union_array_get_instance_private(GARROW_DENSE_UNION_ARRAY(obj))) static void garrow_dense_union_array_dispose(GObject *object) @@ -1401,12 +1359,12 @@ garrow_dense_union_array_class_init(GArrowDenseUnionArrayClass *klass) gobject_class->get_property = garrow_dense_union_array_get_property; GParamSpec *spec; - spec = g_param_spec_object("value-offsets", - "Value offsets", - "The GArrowInt32Array for value offsets", - GARROW_TYPE_INT32_ARRAY, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "value-offsets", + "Value offsets", + "The GArrowInt32Array for value offsets", + GARROW_TYPE_INT32_ARRAY, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_VALUE_OFFSETS, spec); } @@ -1442,21 +1400,20 @@ garrow_dense_union_array_new_internal(GArrowDenseUnionDataType *data_type, arrow_union_data_type->type_codes()); } else { arrow_dense_union_array_result = - arrow::DenseUnionArray::Make(*arrow_type_ids, - *arrow_value_offsets, - arrow_fields); + arrow::DenseUnionArray::Make(*arrow_type_ids, *arrow_value_offsets, arrow_fields); } - if (garrow::check(error, - arrow_dense_union_array_result, - context)) { + if (garrow::check(error, arrow_dense_union_array_result, context)) { auto arrow_dense_union_array = *arrow_dense_union_array_result; - auto dense_union_array = - garrow_array_new_raw(&arrow_dense_union_array, - "array", &arrow_dense_union_array, - "value-data-type", data_type, - "type-ids", type_ids, - "value-offsets", value_offsets, - NULL); + auto dense_union_array = garrow_array_new_raw(&arrow_dense_union_array, + "array", + &arrow_dense_union_array, + "value-data-type", + data_type, + "type-ids", + type_ids, + "value-offsets", + value_offsets, + NULL); auto priv = GARROW_UNION_ARRAY_GET_PRIVATE(dense_union_array); priv->fields = g_ptr_array_sized_new(arrow_fields.size()); g_ptr_array_set_free_func(priv->fields, g_object_unref); @@ -1520,13 +1477,12 @@ garrow_dense_union_array_new_data_type(GArrowDenseUnionDataType *data_type, GList *fields, GError **error) { - return garrow_dense_union_array_new_internal( - data_type, - type_ids, - value_offsets, - fields, - error, - "[dense-union-array][new][data-type]"); + return garrow_dense_union_array_new_internal(data_type, + type_ids, + value_offsets, + fields, + error, + "[dense-union-array][new][data-type]"); } /** @@ -1539,8 +1495,7 @@ garrow_dense_union_array_new_data_type(GArrowDenseUnionDataType *data_type, * Since: 12.0.0 */ gint32 -garrow_dense_union_array_get_value_offset(GArrowDenseUnionArray *array, - gint64 i) +garrow_dense_union_array_get_value_offset(GArrowDenseUnionArray *array, gint64 i) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); auto arrow_dense_union_array = @@ -1548,8 +1503,8 @@ garrow_dense_union_array_get_value_offset(GArrowDenseUnionArray *array, return arrow_dense_union_array->value_offset(i); } - -typedef struct GArrowDictionaryArrayPrivate_ { +typedef struct GArrowDictionaryArrayPrivate_ +{ GArrowArray *indices; GArrowArray *dictionary; } GArrowDictionaryArrayPrivate; @@ -1563,10 +1518,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowDictionaryArray, garrow_dictionary_array, GARROW_TYPE_ARRAY) -#define GARROW_DICTIONARY_ARRAY_GET_PRIVATE(obj) \ - static_cast( \ - garrow_dictionary_array_get_instance_private( \ - GARROW_DICTIONARY_ARRAY(obj))) +#define GARROW_DICTIONARY_ARRAY_GET_PRIVATE(obj) \ + static_cast( \ + garrow_dictionary_array_get_instance_private(GARROW_DICTIONARY_ARRAY(obj))) static void garrow_dictionary_array_dispose(GObject *object) @@ -1643,20 +1597,20 @@ garrow_dictionary_array_class_init(GArrowDictionaryArrayClass *klass) gobject_class->get_property = garrow_dictionary_array_get_property; GParamSpec *spec; - spec = g_param_spec_object("indices", - "The indices", - "The GArrowArray for indices", - GARROW_TYPE_ARRAY, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "indices", + "The indices", + "The GArrowArray for indices", + GARROW_TYPE_ARRAY, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_INDICES, spec); - spec = g_param_spec_object("dictionary", - "The dictionary", - "The GArrowArray for dictionary", - GARROW_TYPE_ARRAY, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "dictionary", + "The dictionary", + "The GArrowArray for dictionary", + GARROW_TYPE_ARRAY, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_DICTIONARY, spec); } @@ -1682,20 +1636,19 @@ garrow_dictionary_array_new(GArrowDataType *data_type, const auto arrow_indices = garrow_array_get_raw(indices); const auto arrow_dictionary = garrow_array_get_raw(dictionary); auto arrow_dictionary_array_result = - arrow::DictionaryArray::FromArrays( - arrow_data_type, - arrow_indices, - arrow_dictionary); - if (garrow::check(error, - arrow_dictionary_array_result, - "[dictionary-array][new]")) { + arrow::DictionaryArray::FromArrays(arrow_data_type, arrow_indices, arrow_dictionary); + if (garrow::check(error, arrow_dictionary_array_result, "[dictionary-array][new]")) { auto arrow_array = std::static_pointer_cast(*arrow_dictionary_array_result); auto dictionary_array = garrow_array_new_raw(&arrow_array, - "array", &arrow_array, - "value-data-type", data_type, - "indices", indices, - "dictionary", dictionary, + "array", + &arrow_array, + "value-data-type", + data_type, + "indices", + indices, + "dictionary", + dictionary, NULL); return GARROW_DICTIONARY_ARRAY(dictionary_array); } else { @@ -1768,8 +1721,8 @@ garrow_dictionary_array_get_dictionary_data_type(GArrowDictionaryArray *array) return GARROW_DICTIONARY_DATA_TYPE(data_type); } - -struct GArrowRunEndEncodedArrayPrivate { +struct GArrowRunEndEncodedArrayPrivate +{ GArrowArray *run_ends; GArrowArray *values; }; @@ -1783,9 +1736,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowRunEndEncodedArray, garrow_run_end_encoded_array, GARROW_TYPE_ARRAY) -#define GARROW_RUN_END_ENCODED_ARRAY_GET_PRIVATE(obj) \ - static_cast( \ - garrow_run_end_encoded_array_get_instance_private( \ +#define GARROW_RUN_END_ENCODED_ARRAY_GET_PRIVATE(obj) \ + static_cast( \ + garrow_run_end_encoded_array_get_instance_private( \ GARROW_RUN_END_ENCODED_ARRAY(obj))) static void @@ -1863,20 +1816,20 @@ garrow_run_end_encoded_array_class_init(GArrowRunEndEncodedArrayClass *klass) gobject_class->get_property = garrow_run_end_encoded_array_get_property; GParamSpec *spec; - spec = g_param_spec_object("run-ends", - "The run-ends", - "The GArrowArray for run-ends", - GARROW_TYPE_ARRAY, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "run-ends", + "The run-ends", + "The GArrowArray for run-ends", + GARROW_TYPE_ARRAY, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_RUN_ENDS, spec); - spec = g_param_spec_object("values", - "The values", - "The GArrowArray for values", - GARROW_TYPE_ARRAY, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "values", + "The values", + "The GArrowArray for values", + GARROW_TYPE_ARRAY, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_VALUES, spec); } @@ -1906,24 +1859,26 @@ garrow_run_end_encoded_array_new(GArrowDataType *data_type, const auto arrow_run_ends = garrow_array_get_raw(run_ends); const auto arrow_values = garrow_array_get_raw(values); auto arrow_run_end_encoded_array_result = - arrow::RunEndEncodedArray::Make( - arrow_data_type, - logical_length, - arrow_run_ends, - arrow_values, - logical_offset); + arrow::RunEndEncodedArray::Make(arrow_data_type, + logical_length, + arrow_run_ends, + arrow_values, + logical_offset); if (garrow::check(error, arrow_run_end_encoded_array_result, "[run-end-encoded-array][new]")) { auto arrow_array = std::static_pointer_cast(*arrow_run_end_encoded_array_result); - auto run_end_encoded_array = - garrow_array_new_raw(&arrow_array, - "array", &arrow_array, - "value-data-type", data_type, - "run-ends", run_ends, - "values", values, - NULL); + auto run_end_encoded_array = garrow_array_new_raw(&arrow_array, + "array", + &arrow_array, + "value-data-type", + data_type, + "run-ends", + run_ends, + "values", + values, + NULL); return GARROW_RUN_END_ENCODED_ARRAY(run_end_encoded_array); } else { return nullptr; @@ -1998,9 +1953,8 @@ garrow_run_end_encoded_array_get_values(GArrowRunEndEncodedArray *array) * Since: 13.0.0 */ GArrowArray * -garrow_run_end_encoded_array_get_logical_run_ends( - GArrowRunEndEncodedArray *array, - GError **error) +garrow_run_end_encoded_array_get_logical_run_ends(GArrowRunEndEncodedArray *array, + GError **error) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); auto arrow_run_end_encoded_array = @@ -2013,9 +1967,7 @@ garrow_run_end_encoded_array_get_logical_run_ends( "[run-end-encoded-array][get-logical-run-ends]")) { auto arrow_array = std::static_pointer_cast(*arrow_logical_run_ends_result); - return garrow_array_new_raw(&arrow_array, - "array", &arrow_array, - NULL); + return garrow_array_new_raw(&arrow_array, "array", &arrow_array, NULL); } else { return nullptr; } @@ -2039,10 +1991,10 @@ garrow_run_end_encoded_array_get_logical_values(GArrowRunEndEncodedArray *array) auto arrow_run_end_encoded_array = std::static_pointer_cast(arrow_array); auto arrow_logical_values = - std::static_pointer_cast( - arrow_run_end_encoded_array->LogicalValues()); + std::static_pointer_cast(arrow_run_end_encoded_array->LogicalValues()); return garrow_array_new_raw(&arrow_logical_values, - "array", &arrow_logical_values, + "array", + &arrow_logical_values, NULL); } @@ -2057,8 +2009,7 @@ garrow_run_end_encoded_array_get_logical_values(GArrowRunEndEncodedArray *array) * Since: 13.0.0 */ gint64 -garrow_run_end_encoded_array_find_physical_offset( - GArrowRunEndEncodedArray *array) +garrow_run_end_encoded_array_find_physical_offset(GArrowRunEndEncodedArray *array) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); auto arrow_run_end_encoded_array = @@ -2084,8 +2035,7 @@ garrow_run_end_encoded_array_find_physical_offset( * Since: 13.0.0 */ gint64 -garrow_run_end_encoded_array_find_physical_length( - GArrowRunEndEncodedArray *array) +garrow_run_end_encoded_array_find_physical_length(GArrowRunEndEncodedArray *array) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); auto arrow_run_end_encoded_array = @@ -2093,5 +2043,4 @@ garrow_run_end_encoded_array_find_physical_length( return arrow_run_end_encoded_array->FindPhysicalLength(); } - G_END_DECLS diff --git a/c_glib/arrow-glib/composite-array.h b/c_glib/arrow-glib/composite-array.h index 3637e03fc2395..c6e19f1c74e22 100644 --- a/c_glib/arrow-glib/composite-array.h +++ b/c_glib/arrow-glib/composite-array.h @@ -27,110 +27,102 @@ G_BEGIN_DECLS #define GARROW_TYPE_LIST_ARRAY (garrow_list_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowListArray, - garrow_list_array, - GARROW, - LIST_ARRAY, - GArrowArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowListArray, garrow_list_array, GARROW, LIST_ARRAY, GArrowArray) struct _GArrowListArrayClass { GArrowArrayClass parent_class; }; -GArrowListArray *garrow_list_array_new(GArrowDataType *data_type, - gint64 length, - GArrowBuffer *value_offsets, - GArrowArray *values, - GArrowBuffer *null_bitmap, - gint64 n_nulls); +GArrowListArray * +garrow_list_array_new(GArrowDataType *data_type, + gint64 length, + GArrowBuffer *value_offsets, + GArrowArray *values, + GArrowBuffer *null_bitmap, + gint64 n_nulls); -GArrowDataType *garrow_list_array_get_value_type(GArrowListArray *array); -GArrowArray *garrow_list_array_get_value(GArrowListArray *array, - gint64 i); +GArrowDataType * +garrow_list_array_get_value_type(GArrowListArray *array); +GArrowArray * +garrow_list_array_get_value(GArrowListArray *array, gint64 i); GARROW_AVAILABLE_IN_2_0 -GArrowArray *garrow_list_array_get_values(GArrowListArray *array); +GArrowArray * +garrow_list_array_get_values(GArrowListArray *array); GARROW_AVAILABLE_IN_2_0 -gint32 garrow_list_array_get_value_offset(GArrowListArray *array, - gint64 i); +gint32 +garrow_list_array_get_value_offset(GArrowListArray *array, gint64 i); GARROW_AVAILABLE_IN_2_0 -gint32 garrow_list_array_get_value_length(GArrowListArray *array, - gint64 i); +gint32 +garrow_list_array_get_value_length(GArrowListArray *array, gint64 i); GARROW_AVAILABLE_IN_2_0 const gint32 * -garrow_list_array_get_value_offsets(GArrowListArray *array, - gint64 *n_offsets); - +garrow_list_array_get_value_offsets(GArrowListArray *array, gint64 *n_offsets); #define GARROW_TYPE_LARGE_LIST_ARRAY (garrow_large_list_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowLargeListArray, - garrow_large_list_array, - GARROW, - LARGE_LIST_ARRAY, - GArrowArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowLargeListArray, garrow_large_list_array, GARROW, LARGE_LIST_ARRAY, GArrowArray) struct _GArrowLargeListArrayClass { GArrowArrayClass parent_class; }; GARROW_AVAILABLE_IN_0_16 -GArrowLargeListArray *garrow_large_list_array_new(GArrowDataType *data_type, - gint64 length, - GArrowBuffer *value_offsets, - GArrowArray *values, - GArrowBuffer *null_bitmap, - gint64 n_nulls); +GArrowLargeListArray * +garrow_large_list_array_new(GArrowDataType *data_type, + gint64 length, + GArrowBuffer *value_offsets, + GArrowArray *values, + GArrowBuffer *null_bitmap, + gint64 n_nulls); GARROW_AVAILABLE_IN_0_16 -GArrowDataType *garrow_large_list_array_get_value_type(GArrowLargeListArray *array); +GArrowDataType * +garrow_large_list_array_get_value_type(GArrowLargeListArray *array); GARROW_AVAILABLE_IN_0_16 -GArrowArray *garrow_large_list_array_get_value(GArrowLargeListArray *array, - gint64 i); +GArrowArray * +garrow_large_list_array_get_value(GArrowLargeListArray *array, gint64 i); GARROW_AVAILABLE_IN_2_0 -GArrowArray *garrow_large_list_array_get_values(GArrowLargeListArray *array); +GArrowArray * +garrow_large_list_array_get_values(GArrowLargeListArray *array); GARROW_AVAILABLE_IN_2_0 -gint64 garrow_large_list_array_get_value_offset(GArrowLargeListArray *array, - gint64 i); +gint64 +garrow_large_list_array_get_value_offset(GArrowLargeListArray *array, gint64 i); GARROW_AVAILABLE_IN_2_0 -gint64 garrow_large_list_array_get_value_length(GArrowLargeListArray *array, - gint64 i); +gint64 +garrow_large_list_array_get_value_length(GArrowLargeListArray *array, gint64 i); GARROW_AVAILABLE_IN_2_0 const gint64 * -garrow_large_list_array_get_value_offsets(GArrowLargeListArray *array, - gint64 *n_offsets); - +garrow_large_list_array_get_value_offsets(GArrowLargeListArray *array, gint64 *n_offsets); #define GARROW_TYPE_STRUCT_ARRAY (garrow_struct_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowStructArray, - garrow_struct_array, - GARROW, - STRUCT_ARRAY, - GArrowArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowStructArray, garrow_struct_array, GARROW, STRUCT_ARRAY, GArrowArray) struct _GArrowStructArrayClass { GArrowArrayClass parent_class; }; -GArrowStructArray *garrow_struct_array_new(GArrowDataType *data_type, - gint64 length, - GList *fields, - GArrowBuffer *null_bitmap, - gint64 n_nulls); +GArrowStructArray * +garrow_struct_array_new(GArrowDataType *data_type, + gint64 length, + GList *fields, + GArrowBuffer *null_bitmap, + gint64 n_nulls); -GArrowArray *garrow_struct_array_get_field(GArrowStructArray *array, - gint i); +GArrowArray * +garrow_struct_array_get_field(GArrowStructArray *array, gint i); -GList *garrow_struct_array_get_fields(GArrowStructArray *array); +GList * +garrow_struct_array_get_fields(GArrowStructArray *array); GARROW_AVAILABLE_IN_0_10 -GList *garrow_struct_array_flatten(GArrowStructArray *array, GError **error); - +GList * +garrow_struct_array_flatten(GArrowStructArray *array, GError **error); #define GARROW_TYPE_MAP_ARRAY (garrow_map_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowMapArray, - garrow_map_array, - GARROW, - MAP_ARRAY, - GArrowListArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowMapArray, garrow_map_array, GARROW, MAP_ARRAY, GArrowListArray) struct _GArrowMapArrayClass { GArrowListArrayClass parent_class; @@ -149,13 +141,9 @@ GARROW_AVAILABLE_IN_0_17 GArrowArray * garrow_map_array_get_items(GArrowMapArray *array); - #define GARROW_TYPE_UNION_ARRAY (garrow_union_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowUnionArray, - garrow_union_array, - GARROW, - UNION_ARRAY, - GArrowArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowUnionArray, garrow_union_array, GARROW, UNION_ARRAY, GArrowArray) struct _GArrowUnionArrayClass { GArrowArrayClass parent_class; @@ -163,15 +151,12 @@ struct _GArrowUnionArrayClass GARROW_AVAILABLE_IN_12_0 gint8 -garrow_union_array_get_type_code(GArrowUnionArray *array, - gint64 i); +garrow_union_array_get_type_code(GArrowUnionArray *array, gint64 i); GARROW_AVAILABLE_IN_12_0 gint -garrow_union_array_get_child_id(GArrowUnionArray *array, - gint64 i); +garrow_union_array_get_child_id(GArrowUnionArray *array, gint64 i); GArrowArray * -garrow_union_array_get_field(GArrowUnionArray *array, - gint i); +garrow_union_array_get_field(GArrowUnionArray *array, gint i); #define GARROW_TYPE_SPARSE_UNION_ARRAY (garrow_sparse_union_array_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowSparseUnionArray, @@ -185,16 +170,13 @@ struct _GArrowSparseUnionArrayClass }; GArrowSparseUnionArray * -garrow_sparse_union_array_new(GArrowInt8Array *type_ids, - GList *fields, - GError **error); +garrow_sparse_union_array_new(GArrowInt8Array *type_ids, GList *fields, GError **error); GArrowSparseUnionArray * garrow_sparse_union_array_new_data_type(GArrowSparseUnionDataType *data_type, GArrowInt8Array *type_ids, GList *fields, GError **error); - #define GARROW_TYPE_DENSE_UNION_ARRAY (garrow_dense_union_array_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDenseUnionArray, garrow_dense_union_array, @@ -219,16 +201,11 @@ garrow_dense_union_array_new_data_type(GArrowDenseUnionDataType *data_type, GError **error); GARROW_AVAILABLE_IN_12_0 gint32 -garrow_dense_union_array_get_value_offset(GArrowDenseUnionArray *array, - gint64 i); - +garrow_dense_union_array_get_value_offset(GArrowDenseUnionArray *array, gint64 i); #define GARROW_TYPE_DICTIONARY_ARRAY (garrow_dictionary_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowDictionaryArray, - garrow_dictionary_array, - GARROW, - DICTIONARY_ARRAY, - GArrowArray) +G_DECLARE_DERIVABLE_TYPE( + GArrowDictionaryArray, garrow_dictionary_array, GARROW, DICTIONARY_ARRAY, GArrowArray) struct _GArrowDictionaryArrayClass { GArrowArrayClass parent_class; @@ -249,9 +226,7 @@ GArrowDictionaryDataType * garrow_dictionary_array_get_dictionary_data_type(GArrowDictionaryArray *array); #endif - -#define GARROW_TYPE_RUN_END_ENCODED_ARRAY \ - (garrow_run_end_encoded_array_get_type()) +#define GARROW_TYPE_RUN_END_ENCODED_ARRAY (garrow_run_end_encoded_array_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowRunEndEncodedArray, garrow_run_end_encoded_array, GARROW, @@ -278,21 +253,16 @@ GArrowArray * garrow_run_end_encoded_array_get_values(GArrowRunEndEncodedArray *array); GARROW_AVAILABLE_IN_13_0 GArrowArray * -garrow_run_end_encoded_array_get_logical_run_ends( - GArrowRunEndEncodedArray *array, - GError **error); +garrow_run_end_encoded_array_get_logical_run_ends(GArrowRunEndEncodedArray *array, + GError **error); GARROW_AVAILABLE_IN_13_0 GArrowArray * garrow_run_end_encoded_array_get_logical_values(GArrowRunEndEncodedArray *array); GARROW_AVAILABLE_IN_13_0 gint64 -garrow_run_end_encoded_array_find_physical_offset( - GArrowRunEndEncodedArray *array); +garrow_run_end_encoded_array_find_physical_offset(GArrowRunEndEncodedArray *array); GARROW_AVAILABLE_IN_13_0 gint64 -garrow_run_end_encoded_array_find_physical_length( - GArrowRunEndEncodedArray *array); - - +garrow_run_end_encoded_array_find_physical_length(GArrowRunEndEncodedArray *array); G_END_DECLS diff --git a/c_glib/arrow-glib/composite-data-type.cpp b/c_glib/arrow-glib/composite-data-type.cpp index f3dc7938d506f..914bb3196fa3a 100644 --- a/c_glib/arrow-glib/composite-data-type.cpp +++ b/c_glib/arrow-glib/composite-data-type.cpp @@ -51,9 +51,7 @@ G_BEGIN_DECLS * #GArrowRunEndEncodedDataType is a class for run end encoded data type. */ -G_DEFINE_TYPE(GArrowListDataType, - garrow_list_data_type, - GARROW_TYPE_DATA_TYPE) +G_DEFINE_TYPE(GArrowListDataType, garrow_list_data_type, GARROW_TYPE_DATA_TYPE) static void garrow_list_data_type_init(GArrowListDataType *object) @@ -75,13 +73,10 @@ GArrowListDataType * garrow_list_data_type_new(GArrowField *field) { auto arrow_field = garrow_field_get_raw(field); - auto arrow_data_type = - std::make_shared(arrow_field); + auto arrow_data_type = std::make_shared(arrow_field); - GArrowListDataType *data_type = - GARROW_LIST_DATA_TYPE(g_object_new(GARROW_TYPE_LIST_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowListDataType *data_type = GARROW_LIST_DATA_TYPE( + g_object_new(GARROW_TYPE_LIST_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } @@ -113,17 +108,13 @@ garrow_list_data_type_get_field(GArrowListDataType *list_data_type) { auto data_type = GARROW_DATA_TYPE(list_data_type); auto arrow_data_type = garrow_data_type_get_raw(data_type); - auto arrow_list_data_type = - static_cast(arrow_data_type.get()); + auto arrow_list_data_type = static_cast(arrow_data_type.get()); auto arrow_field = arrow_list_data_type->value_field(); return garrow_field_new_raw(&arrow_field, nullptr); } - -G_DEFINE_TYPE(GArrowLargeListDataType, - garrow_large_list_data_type, - GARROW_TYPE_DATA_TYPE) +G_DEFINE_TYPE(GArrowLargeListDataType, garrow_large_list_data_type, GARROW_TYPE_DATA_TYPE) static void garrow_large_list_data_type_init(GArrowLargeListDataType *object) @@ -147,13 +138,10 @@ GArrowLargeListDataType * garrow_large_list_data_type_new(GArrowField *field) { auto arrow_field = garrow_field_get_raw(field); - auto arrow_data_type = - std::make_shared(arrow_field); + auto arrow_data_type = std::make_shared(arrow_field); - GArrowLargeListDataType *data_type = - GARROW_LARGE_LIST_DATA_TYPE(g_object_new(GARROW_TYPE_LARGE_LIST_DATA_TYPE, - "data-type", &arrow_data_type, - NULL)); + GArrowLargeListDataType *data_type = GARROW_LARGE_LIST_DATA_TYPE( + g_object_new(GARROW_TYPE_LARGE_LIST_DATA_TYPE, "data-type", &arrow_data_type, NULL)); return data_type; } @@ -177,10 +165,7 @@ garrow_large_list_data_type_get_field(GArrowLargeListDataType *large_list_data_t return garrow_field_new_raw(&arrow_field, nullptr); } - -G_DEFINE_TYPE(GArrowStructDataType, - garrow_struct_data_type, - GARROW_TYPE_DATA_TYPE) +G_DEFINE_TYPE(GArrowStructDataType, garrow_struct_data_type, GARROW_TYPE_DATA_TYPE) static void garrow_struct_data_type_init(GArrowStructDataType *object) @@ -209,9 +194,8 @@ garrow_struct_data_type_new(GList *fields) } auto arrow_data_type = std::make_shared(arrow_fields); - auto data_type = g_object_new(GARROW_TYPE_STRUCT_DATA_TYPE, - "data-type", &arrow_data_type, - NULL); + auto data_type = + g_object_new(GARROW_TYPE_STRUCT_DATA_TYPE, "data-type", &arrow_data_type, NULL); return GARROW_STRUCT_DATA_TYPE(data_type); } @@ -264,8 +248,7 @@ garrow_struct_data_type_get_fields(GArrowStructDataType *struct_data_type) * Since: 0.12.0 */ GArrowField * -garrow_struct_data_type_get_field(GArrowStructDataType *struct_data_type, - gint i) +garrow_struct_data_type_get_field(GArrowStructDataType *struct_data_type, gint i) { auto data_type = GARROW_DATA_TYPE(struct_data_type); auto arrow_data_type = garrow_data_type_get_raw(data_type); @@ -336,10 +319,7 @@ garrow_struct_data_type_get_field_index(GArrowStructDataType *struct_data_type, return arrow_struct_data_type->GetFieldIndex(name); } - -G_DEFINE_TYPE(GArrowMapDataType, - garrow_map_data_type, - GARROW_TYPE_LIST_DATA_TYPE) +G_DEFINE_TYPE(GArrowMapDataType, garrow_map_data_type, GARROW_TYPE_LIST_DATA_TYPE) static void garrow_map_data_type_init(GArrowMapDataType *object) @@ -361,16 +341,14 @@ garrow_map_data_type_class_init(GArrowMapDataTypeClass *klass) * Since: 0.17.0 */ GArrowMapDataType * -garrow_map_data_type_new(GArrowDataType *key_type, - GArrowDataType *item_type) +garrow_map_data_type_new(GArrowDataType *key_type, GArrowDataType *item_type) { auto arrow_key_type = garrow_data_type_get_raw(key_type); auto arrow_item_type = garrow_data_type_get_raw(item_type); - auto arrow_data_type = std::make_shared(arrow_key_type, - arrow_item_type); - auto data_type = g_object_new(GARROW_TYPE_MAP_DATA_TYPE, - "data-type", &arrow_data_type, - NULL); + auto arrow_data_type = + std::make_shared(arrow_key_type, arrow_item_type); + auto data_type = + g_object_new(GARROW_TYPE_MAP_DATA_TYPE, "data-type", &arrow_data_type, NULL); return GARROW_MAP_DATA_TYPE(data_type); } @@ -387,8 +365,7 @@ garrow_map_data_type_get_key_type(GArrowMapDataType *map_data_type) { auto data_type = GARROW_DATA_TYPE(map_data_type); auto arrow_data_type = garrow_data_type_get_raw(data_type); - auto arrow_map_data_type = - std::static_pointer_cast(arrow_data_type); + auto arrow_map_data_type = std::static_pointer_cast(arrow_data_type); auto arrow_key_type = arrow_map_data_type->key_type(); return garrow_data_type_new_raw(&arrow_key_type); } @@ -406,16 +383,12 @@ garrow_map_data_type_get_item_type(GArrowMapDataType *map_data_type) { auto data_type = GARROW_DATA_TYPE(map_data_type); auto arrow_data_type = garrow_data_type_get_raw(data_type); - auto arrow_map_data_type = - std::static_pointer_cast(arrow_data_type); + auto arrow_map_data_type = std::static_pointer_cast(arrow_data_type); auto arrow_item_type = arrow_map_data_type->item_type(); return garrow_data_type_new_raw(&arrow_item_type); } - -G_DEFINE_ABSTRACT_TYPE(GArrowUnionDataType, - garrow_union_data_type, - GARROW_TYPE_DATA_TYPE) +G_DEFINE_ABSTRACT_TYPE(GArrowUnionDataType, garrow_union_data_type, GARROW_TYPE_DATA_TYPE) static void garrow_union_data_type_init(GArrowUnionDataType *object) @@ -476,8 +449,7 @@ garrow_union_data_type_get_fields(GArrowUnionDataType *union_data_type) * Since: 0.12.0 */ GArrowField * -garrow_union_data_type_get_field(GArrowUnionDataType *union_data_type, - gint i) +garrow_union_data_type_get_field(GArrowUnionDataType *union_data_type, gint i) { auto data_type = GARROW_DATA_TYPE(union_data_type); auto arrow_data_type = garrow_data_type_get_raw(data_type); @@ -530,7 +502,6 @@ garrow_union_data_type_get_type_codes(GArrowUnionDataType *union_data_type, return type_codes; } - G_DEFINE_TYPE(GArrowSparseUnionDataType, garrow_sparse_union_data_type, GARROW_TYPE_UNION_DATA_TYPE) @@ -554,9 +525,7 @@ garrow_sparse_union_data_type_class_init(GArrowSparseUnionDataTypeClass *klass) * Returns: The newly created sparse union data type. */ GArrowSparseUnionDataType * -garrow_sparse_union_data_type_new(GList *fields, - gint8 *type_codes, - gsize n_type_codes) +garrow_sparse_union_data_type_new(GList *fields, gint8 *type_codes, gsize n_type_codes) { std::vector> arrow_fields; for (auto node = fields; node; node = g_list_next(node)) { @@ -571,15 +540,12 @@ garrow_sparse_union_data_type_new(GList *fields, } auto arrow_data_type = - std::make_shared(arrow_fields, - arrow_type_codes); - auto data_type = g_object_new(GARROW_TYPE_SPARSE_UNION_DATA_TYPE, - "data-type", &arrow_data_type, - NULL); + std::make_shared(arrow_fields, arrow_type_codes); + auto data_type = + g_object_new(GARROW_TYPE_SPARSE_UNION_DATA_TYPE, "data-type", &arrow_data_type, NULL); return GARROW_SPARSE_UNION_DATA_TYPE(data_type); } - G_DEFINE_TYPE(GArrowDenseUnionDataType, garrow_dense_union_data_type, GARROW_TYPE_UNION_DATA_TYPE) @@ -603,9 +569,7 @@ garrow_dense_union_data_type_class_init(GArrowDenseUnionDataTypeClass *klass) * Returns: The newly created dense union data type. */ GArrowDenseUnionDataType * -garrow_dense_union_data_type_new(GList *fields, - gint8 *type_codes, - gsize n_type_codes) +garrow_dense_union_data_type_new(GList *fields, gint8 *type_codes, gsize n_type_codes) { std::vector> arrow_fields; for (auto node = fields; node; node = g_list_next(node)) { @@ -620,15 +584,12 @@ garrow_dense_union_data_type_new(GList *fields, } auto arrow_data_type = - std::make_shared(arrow_fields, - arrow_type_codes); - auto data_type = g_object_new(GARROW_TYPE_DENSE_UNION_DATA_TYPE, - "data-type", &arrow_data_type, - NULL); + std::make_shared(arrow_fields, arrow_type_codes); + auto data_type = + g_object_new(GARROW_TYPE_DENSE_UNION_DATA_TYPE, "data-type", &arrow_data_type, NULL); return GARROW_DENSE_UNION_DATA_TYPE(data_type); } - G_DEFINE_TYPE(GArrowDictionaryDataType, garrow_dictionary_data_type, GARROW_TYPE_FIXED_WIDTH_DATA_TYPE) @@ -660,9 +621,8 @@ garrow_dictionary_data_type_new(GArrowDataType *index_data_type, { auto arrow_index_data_type = garrow_data_type_get_raw(index_data_type); auto arrow_value_data_type = garrow_data_type_get_raw(value_data_type); - auto arrow_data_type = arrow::dictionary(arrow_index_data_type, - arrow_value_data_type, - ordered); + auto arrow_data_type = + arrow::dictionary(arrow_index_data_type, arrow_value_data_type, ordered); return GARROW_DICTIONARY_DATA_TYPE(garrow_data_type_new_raw(&arrow_data_type)); } @@ -675,7 +635,8 @@ garrow_dictionary_data_type_new(GArrowDataType *index_data_type, * Since: 0.8.0 */ GArrowDataType * -garrow_dictionary_data_type_get_index_data_type(GArrowDictionaryDataType *dictionary_data_type) +garrow_dictionary_data_type_get_index_data_type( + GArrowDictionaryDataType *dictionary_data_type) { auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(dictionary_data_type)); auto arrow_dictionary_data_type = @@ -693,7 +654,8 @@ garrow_dictionary_data_type_get_index_data_type(GArrowDictionaryDataType *dictio * Since: 0.14.0 */ GArrowDataType * -garrow_dictionary_data_type_get_value_data_type(GArrowDictionaryDataType *dictionary_data_type) +garrow_dictionary_data_type_get_value_data_type( + GArrowDictionaryDataType *dictionary_data_type) { auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(dictionary_data_type)); auto arrow_dictionary_data_type = @@ -719,7 +681,6 @@ garrow_dictionary_data_type_is_ordered(GArrowDictionaryDataType *dictionary_data return arrow_dictionary_data_type->ordered(); } - G_DEFINE_TYPE(GArrowRunEndEncodedDataType, garrow_run_end_encoded_data_type, GARROW_TYPE_FIXED_WIDTH_DATA_TYPE) @@ -730,8 +691,7 @@ garrow_run_end_encoded_data_type_init(GArrowRunEndEncodedDataType *object) } static void -garrow_run_end_encoded_data_type_class_init( - GArrowRunEndEncodedDataTypeClass *klass) +garrow_run_end_encoded_data_type_class_init(GArrowRunEndEncodedDataTypeClass *klass) { } @@ -750,10 +710,9 @@ garrow_run_end_encoded_data_type_new(GArrowDataType *run_end_data_type, { auto arrow_run_end_data_type = garrow_data_type_get_raw(run_end_data_type); auto arrow_value_data_type = garrow_data_type_get_raw(value_data_type); - auto arrow_data_type = arrow::run_end_encoded(arrow_run_end_data_type, - arrow_value_data_type); - return GARROW_RUN_END_ENCODED_DATA_TYPE( - garrow_data_type_new_raw(&arrow_data_type)); + auto arrow_data_type = + arrow::run_end_encoded(arrow_run_end_data_type, arrow_value_data_type); + return GARROW_RUN_END_ENCODED_DATA_TYPE(garrow_data_type_new_raw(&arrow_data_type)); } /** @@ -794,5 +753,4 @@ garrow_run_end_encoded_data_type_get_value_data_type( return garrow_data_type_new_raw(&arrow_value_data_type); } - G_END_DECLS diff --git a/c_glib/arrow-glib/composite-data-type.h b/c_glib/arrow-glib/composite-data-type.h index 0113b556e8e82..e71d277a305c6 100644 --- a/c_glib/arrow-glib/composite-data-type.h +++ b/c_glib/arrow-glib/composite-data-type.h @@ -27,24 +27,23 @@ G_BEGIN_DECLS #define GARROW_TYPE_LIST_DATA_TYPE (garrow_list_data_type_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowListDataType, - garrow_list_data_type, - GARROW, - LIST_DATA_TYPE, - GArrowDataType) +G_DECLARE_DERIVABLE_TYPE( + GArrowListDataType, garrow_list_data_type, GARROW, LIST_DATA_TYPE, GArrowDataType) struct _GArrowListDataTypeClass { GArrowDataTypeClass parent_class; }; -GArrowListDataType *garrow_list_data_type_new (GArrowField *field); +GArrowListDataType * +garrow_list_data_type_new(GArrowField *field); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_13_FOR(garrow_list_data_type_get_field) -GArrowField *garrow_list_data_type_get_value_field (GArrowListDataType *list_data_type); +GArrowField * +garrow_list_data_type_get_value_field(GArrowListDataType *list_data_type); #endif GARROW_AVAILABLE_IN_0_13 -GArrowField *garrow_list_data_type_get_field (GArrowListDataType *list_data_type); - +GArrowField * +garrow_list_data_type_get_field(GArrowListDataType *list_data_type); #define GARROW_TYPE_LARGE_LIST_DATA_TYPE (garrow_large_list_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowLargeListDataType, @@ -58,30 +57,28 @@ struct _GArrowLargeListDataTypeClass }; GARROW_AVAILABLE_IN_0_16 -GArrowLargeListDataType *garrow_large_list_data_type_new(GArrowField *field); +GArrowLargeListDataType * +garrow_large_list_data_type_new(GArrowField *field); GARROW_AVAILABLE_IN_0_16 -GArrowField *garrow_large_list_data_type_get_field(GArrowLargeListDataType *large_list_data_type); - +GArrowField * +garrow_large_list_data_type_get_field(GArrowLargeListDataType *large_list_data_type); #define GARROW_TYPE_STRUCT_DATA_TYPE (garrow_struct_data_type_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowStructDataType, - garrow_struct_data_type, - GARROW, - STRUCT_DATA_TYPE, - GArrowDataType) +G_DECLARE_DERIVABLE_TYPE( + GArrowStructDataType, garrow_struct_data_type, GARROW, STRUCT_DATA_TYPE, GArrowDataType) struct _GArrowStructDataTypeClass { GArrowDataTypeClass parent_class; }; -GArrowStructDataType *garrow_struct_data_type_new (GList *fields); +GArrowStructDataType * +garrow_struct_data_type_new(GList *fields); gint garrow_struct_data_type_get_n_fields(GArrowStructDataType *struct_data_type); GList * garrow_struct_data_type_get_fields(GArrowStructDataType *struct_data_type); GArrowField * -garrow_struct_data_type_get_field(GArrowStructDataType *struct_data_type, - gint i); +garrow_struct_data_type_get_field(GArrowStructDataType *struct_data_type, gint i); GArrowField * garrow_struct_data_type_get_field_by_name(GArrowStructDataType *struct_data_type, const gchar *name); @@ -89,13 +86,9 @@ gint garrow_struct_data_type_get_field_index(GArrowStructDataType *struct_data_type, const gchar *name); - #define GARROW_TYPE_MAP_DATA_TYPE (garrow_map_data_type_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowMapDataType, - garrow_map_data_type, - GARROW, - MAP_DATA_TYPE, - GArrowListDataType) +G_DECLARE_DERIVABLE_TYPE( + GArrowMapDataType, garrow_map_data_type, GARROW, MAP_DATA_TYPE, GArrowListDataType) struct _GArrowMapDataTypeClass { GArrowListDataTypeClass parent_class; @@ -103,8 +96,7 @@ struct _GArrowMapDataTypeClass GARROW_AVAILABLE_IN_0_17 GArrowMapDataType * -garrow_map_data_type_new(GArrowDataType *key_type, - GArrowDataType *item_type); +garrow_map_data_type_new(GArrowDataType *key_type, GArrowDataType *item_type); GARROW_AVAILABLE_IN_0_17 GArrowDataType * garrow_map_data_type_get_key_type(GArrowMapDataType *map_data_type); @@ -112,13 +104,9 @@ GARROW_AVAILABLE_IN_0_17 GArrowDataType * garrow_map_data_type_get_item_type(GArrowMapDataType *map_data_type); - #define GARROW_TYPE_UNION_DATA_TYPE (garrow_union_data_type_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowUnionDataType, - garrow_union_data_type, - GARROW, - UNION_DATA_TYPE, - GArrowDataType) +G_DECLARE_DERIVABLE_TYPE( + GArrowUnionDataType, garrow_union_data_type, GARROW, UNION_DATA_TYPE, GArrowDataType) struct _GArrowUnionDataTypeClass { GArrowDataTypeClass parent_class; @@ -129,15 +117,12 @@ garrow_union_data_type_get_n_fields(GArrowUnionDataType *union_data_type); GList * garrow_union_data_type_get_fields(GArrowUnionDataType *union_data_type); GArrowField * -garrow_union_data_type_get_field(GArrowUnionDataType *union_data_type, - gint i); +garrow_union_data_type_get_field(GArrowUnionDataType *union_data_type, gint i); gint8 * garrow_union_data_type_get_type_codes(GArrowUnionDataType *union_data_type, gsize *n_type_codes); - -#define GARROW_TYPE_SPARSE_UNION_DATA_TYPE \ - (garrow_sparse_union_data_type_get_type()) +#define GARROW_TYPE_SPARSE_UNION_DATA_TYPE (garrow_sparse_union_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowSparseUnionDataType, garrow_sparse_union_data_type, GARROW, @@ -149,13 +134,9 @@ struct _GArrowSparseUnionDataTypeClass }; GArrowSparseUnionDataType * -garrow_sparse_union_data_type_new(GList *fields, - gint8 *type_codes, - gsize n_type_codes); +garrow_sparse_union_data_type_new(GList *fields, gint8 *type_codes, gsize n_type_codes); - -#define GARROW_TYPE_DENSE_UNION_DATA_TYPE \ - (garrow_dense_union_data_type_get_type()) +#define GARROW_TYPE_DENSE_UNION_DATA_TYPE (garrow_dense_union_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDenseUnionDataType, garrow_dense_union_data_type, GARROW, @@ -167,10 +148,7 @@ struct _GArrowDenseUnionDataTypeClass }; GArrowDenseUnionDataType * -garrow_dense_union_data_type_new(GList *fields, - gint8 *type_codes, - gsize n_type_codes); - +garrow_dense_union_data_type_new(GList *fields, gint8 *type_codes, gsize n_type_codes); #define GARROW_TYPE_DICTIONARY_DATA_TYPE (garrow_dictionary_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDictionaryDataType, @@ -188,15 +166,16 @@ garrow_dictionary_data_type_new(GArrowDataType *index_data_type, GArrowDataType *value_data_type, gboolean ordered); GArrowDataType * -garrow_dictionary_data_type_get_index_data_type(GArrowDictionaryDataType *dictionary_data_type); +garrow_dictionary_data_type_get_index_data_type( + GArrowDictionaryDataType *dictionary_data_type); GARROW_AVAILABLE_IN_0_14 GArrowDataType * -garrow_dictionary_data_type_get_value_data_type(GArrowDictionaryDataType *dictionary_data_type); +garrow_dictionary_data_type_get_value_data_type( + GArrowDictionaryDataType *dictionary_data_type); gboolean garrow_dictionary_data_type_is_ordered(GArrowDictionaryDataType *dictionary_data_type); - -#define GARROW_TYPE_RUN_END_ENCODED_DATA_TYPE \ +#define GARROW_TYPE_RUN_END_ENCODED_DATA_TYPE \ (garrow_run_end_encoded_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowRunEndEncodedDataType, garrow_run_end_encoded_data_type, @@ -221,5 +200,4 @@ GArrowDataType * garrow_run_end_encoded_data_type_get_value_data_type( GArrowRunEndEncodedDataType *data_type); - G_END_DECLS diff --git a/c_glib/arrow-glib/compute-definition.h b/c_glib/arrow-glib/compute-definition.h index e27bc4bd5c5be..40b4e8ec9ae63 100644 --- a/c_glib/arrow-glib/compute-definition.h +++ b/c_glib/arrow-glib/compute-definition.h @@ -24,38 +24,26 @@ G_BEGIN_DECLS #define GARROW_TYPE_FUNCTION_OPTIONS (garrow_function_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowFunctionOptions, - garrow_function_options, - GARROW, - FUNCTION_OPTIONS, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowFunctionOptions, garrow_function_options, GARROW, FUNCTION_OPTIONS, GObject) struct _GArrowFunctionOptionsClass { GObjectClass parent_class; }; - #define GARROW_TYPE_CAST_OPTIONS (garrow_cast_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowCastOptions, - garrow_cast_options, - GARROW, - CAST_OPTIONS, - GArrowFunctionOptions) +G_DECLARE_DERIVABLE_TYPE( + GArrowCastOptions, garrow_cast_options, GARROW, CAST_OPTIONS, GArrowFunctionOptions) struct _GArrowCastOptionsClass { GArrowFunctionOptionsClass parent_class; }; #define GARROW_TYPE_EXPRESSION (garrow_expression_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowExpression, - garrow_expression, - GARROW, - EXPRESSION, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowExpression, garrow_expression, GARROW, EXPRESSION, GObject) struct _GArrowExpressionClass { GObjectClass parent_class; }; - G_END_DECLS diff --git a/c_glib/arrow-glib/compute.cpp b/c_glib/arrow-glib/compute.cpp index 1415d953a584d..9b9faeb44952d 100644 --- a/c_glib/arrow-glib/compute.cpp +++ b/c_glib/arrow-glib/compute.cpp @@ -72,12 +72,9 @@ garrow_take(arrow::Datum arrow_values, arrow::Result arrow_taken_datum; if (options) { auto arrow_options = garrow_take_options_get_raw(options); - arrow_taken_datum = arrow::compute::Take(arrow_values, - arrow_indices, - *arrow_options); + arrow_taken_datum = arrow::compute::Take(arrow_values, arrow_indices, *arrow_options); } else { - arrow_taken_datum = arrow::compute::Take(arrow_values, - arrow_indices); + arrow_taken_datum = arrow::compute::Take(arrow_values, arrow_indices); } if (garrow::check(error, arrow_taken_datum, tag)) { return garrow_type_new_raw(*arrow_taken_datum); @@ -117,9 +114,8 @@ namespace { } gboolean - garrow_raw_sort_keys_equal( - std::vector &arrow_sort_keys, - std::vector &arrow_other_sort_keys) + garrow_raw_sort_keys_equal(std::vector &arrow_sort_keys, + std::vector &arrow_other_sort_keys) { if (arrow_sort_keys.size() != arrow_other_sort_keys.size()) { return FALSE; @@ -154,7 +150,7 @@ namespace { auto arrow_sort_key = garrow_sort_key_get_raw(sort_key); arrow_sort_keys.push_back(*arrow_sort_key); } -} +} // namespace G_BEGIN_DECLS @@ -254,18 +250,16 @@ G_BEGIN_DECLS * There are many functions to compute data on an array. */ -typedef struct GArrowExecuteContextPrivate_ { +typedef struct GArrowExecuteContextPrivate_ +{ arrow::compute::ExecContext context; } GArrowExecuteContextPrivate; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowExecuteContext, - garrow_execute_context, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowExecuteContext, garrow_execute_context, G_TYPE_OBJECT) -#define GARROW_EXECUTE_CONTEXT_GET_PRIVATE(object) \ - static_cast( \ - garrow_execute_context_get_instance_private( \ - GARROW_EXECUTE_CONTEXT(object))) +#define GARROW_EXECUTE_CONTEXT_GET_PRIVATE(object) \ + static_cast( \ + garrow_execute_context_get_instance_private(GARROW_EXECUTE_CONTEXT(object))) static void garrow_execute_context_finalize(GObject *object) @@ -279,8 +273,7 @@ static void garrow_execute_context_init(GArrowExecuteContext *object) { auto priv = GARROW_EXECUTE_CONTEXT_GET_PRIVATE(object); - new(&priv->context) arrow::compute::ExecContext(arrow::default_memory_pool(), - nullptr); + new (&priv->context) arrow::compute::ExecContext(arrow::default_memory_pool(), nullptr); } static void @@ -305,19 +298,16 @@ garrow_execute_context_new(void) return GARROW_EXECUTE_CONTEXT(execute_context); } - -typedef struct GArrowFunctionOptionsPrivate_ { +typedef struct GArrowFunctionOptionsPrivate_ +{ arrow::compute::FunctionOptions *options; } GArrowFunctionOptionsPrivate; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowFunctionOptions, - garrow_function_options, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowFunctionOptions, garrow_function_options, G_TYPE_OBJECT) -#define GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_function_options_get_instance_private( \ - GARROW_FUNCTION_OPTIONS(object))) +#define GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_function_options_get_instance_private(GARROW_FUNCTION_OPTIONS(object))) static void garrow_function_options_finalize(GObject *object) @@ -379,8 +369,8 @@ garrow_function_options_to_string(GArrowFunctionOptions *options) return g_strndup(string.data(), string.size()); } - -typedef struct GArrowFunctionDocPrivate_ { +typedef struct GArrowFunctionDocPrivate_ +{ arrow::compute::FunctionDoc *doc; } GArrowFunctionDocPrivate; @@ -388,14 +378,11 @@ enum { PROP_DOC = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowFunctionDoc, - garrow_function_doc, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowFunctionDoc, garrow_function_doc, G_TYPE_OBJECT) -#define GARROW_FUNCTION_DOC_GET_PRIVATE(object) \ - static_cast( \ - garrow_function_doc_get_instance_private( \ - GARROW_FUNCTION_DOC(object))) +#define GARROW_FUNCTION_DOC_GET_PRIVATE(object) \ + static_cast( \ + garrow_function_doc_get_instance_private(GARROW_FUNCTION_DOC(object))) static void garrow_function_doc_set_property(GObject *object, @@ -407,8 +394,7 @@ garrow_function_doc_set_property(GObject *object, switch (prop_id) { case PROP_DOC: - priv->doc = - static_cast(g_value_get_pointer(value)); + priv->doc = static_cast(g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -428,11 +414,11 @@ garrow_function_doc_class_init(GArrowFunctionDocClass *klass) gobject_class->set_property = garrow_function_doc_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("doc", - "Doc", - "The raw arrow::compute::FunctionDoc *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "doc", + "Doc", + "The raw arrow::compute::FunctionDoc *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_DOC, spec); } @@ -450,8 +436,7 @@ gchar * garrow_function_doc_get_summary(GArrowFunctionDoc *doc) { auto arrow_doc = garrow_function_doc_get_raw(doc); - return g_strndup(arrow_doc->summary.data(), - arrow_doc->summary.size()); + return g_strndup(arrow_doc->summary.data(), arrow_doc->summary.size()); } /** @@ -469,8 +454,7 @@ gchar * garrow_function_doc_get_description(GArrowFunctionDoc *doc) { auto arrow_doc = garrow_function_doc_get_raw(doc); - return g_strndup(arrow_doc->description.data(), - arrow_doc->description.size()); + return g_strndup(arrow_doc->description.data(), arrow_doc->description.size()); } /** @@ -493,8 +477,7 @@ garrow_function_doc_get_arg_names(GArrowFunctionDoc *doc) auto n = arrow_arg_names.size(); auto arg_names = g_new(gchar *, n + 1); for (size_t i = 0; i < n; ++i) { - arg_names[i] = g_strndup(arrow_arg_names[i].data(), - arrow_arg_names[i].size()); + arg_names[i] = g_strndup(arrow_arg_names[i].data(), arrow_arg_names[i].size()); } arg_names[n] = NULL; return arg_names; @@ -514,12 +497,11 @@ gchar * garrow_function_doc_get_options_class_name(GArrowFunctionDoc *doc) { auto arrow_doc = garrow_function_doc_get_raw(doc); - return g_strndup(arrow_doc->options_class.data(), - arrow_doc->options_class.size()); + return g_strndup(arrow_doc->options_class.data(), arrow_doc->options_class.size()); } - -typedef struct GArrowFunctionPrivate_ { +typedef struct GArrowFunctionPrivate_ +{ std::shared_ptr function; gchar *name; } GArrowFunctionPrivate; @@ -528,14 +510,11 @@ enum { PROP_FUNCTION = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowFunction, - garrow_function, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowFunction, garrow_function, G_TYPE_OBJECT) -#define GARROW_FUNCTION_GET_PRIVATE(object) \ - static_cast( \ - garrow_function_get_instance_private( \ - GARROW_FUNCTION(object))) +#define GARROW_FUNCTION_GET_PRIVATE(object) \ + static_cast( \ + garrow_function_get_instance_private(GARROW_FUNCTION(object))) static void garrow_function_finalize(GObject *object) @@ -558,9 +537,8 @@ garrow_function_set_property(GObject *object, switch (prop_id) { case PROP_FUNCTION: - priv->function = - *static_cast *>( - g_value_get_pointer(value)); + priv->function = *static_cast *>( + g_value_get_pointer(value)); { const auto &arrow_name = priv->function->name(); priv->name = g_strndup(arrow_name.data(), arrow_name.length()); @@ -576,7 +554,7 @@ static void garrow_function_init(GArrowFunction *object) { auto priv = GARROW_FUNCTION_GET_PRIVATE(object); - new(&priv->function) std::shared_ptr; + new (&priv->function) std::shared_ptr; } static void @@ -584,15 +562,15 @@ garrow_function_class_init(GArrowFunctionClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_function_finalize; + gobject_class->finalize = garrow_function_finalize; gobject_class->set_property = garrow_function_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("function", - "Function", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "function", + "Function", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_FUNCTION, spec); } @@ -639,8 +617,7 @@ garrow_function_all(void) continue; } auto arrow_function = *arrow_function_result; - functions = g_list_prepend(functions, - garrow_function_new_raw(&arrow_function)); + functions = g_list_prepend(functions, garrow_function_new_raw(&arrow_function)); } return g_list_reverse(functions); } @@ -681,14 +658,12 @@ garrow_function_execute(GArrowFunction *function, arrow::Result arrow_result_result; if (context) { auto arrow_context = garrow_execute_context_get_raw(context); - arrow_result_result = arrow_function->Execute(arrow_args, - arrow_options, - arrow_context); + arrow_result_result = + arrow_function->Execute(arrow_args, arrow_options, arrow_context); } else { arrow::compute::ExecContext arrow_context; - arrow_result_result = arrow_function->Execute(arrow_args, - arrow_options, - &arrow_context); + arrow_result_result = + arrow_function->Execute(arrow_args, arrow_options, &arrow_context); } if (garrow::check(error, arrow_result_result, "[function][execute]")) { auto arrow_result = *arrow_result_result; @@ -783,8 +758,7 @@ garrow_function_get_options_type(GArrowFunction *function) * Since: 7.0.0 */ gboolean -garrow_function_equal(GArrowFunction *function, - GArrowFunction *other_function) +garrow_function_equal(GArrowFunction *function, GArrowFunction *other_function) { auto priv = GARROW_FUNCTION_GET_PRIVATE(function); auto other_priv = GARROW_FUNCTION_GET_PRIVATE(other_function); @@ -829,8 +803,8 @@ garrow_function_to_string(GArrowFunction *function) return g_string_free(string, FALSE); } - -typedef struct GArrowExecuteNodeOptionsPrivate_ { +typedef struct GArrowExecuteNodeOptionsPrivate_ +{ arrow::acero::ExecNodeOptions *options; } GArrowExecuteNodeOptionsPrivate; @@ -842,9 +816,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowExecuteNodeOptions, garrow_execute_node_options, G_TYPE_OBJECT) -#define GARROW_EXECUTE_NODE_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_execute_node_options_get_instance_private( \ +#define GARROW_EXECUTE_NODE_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_execute_node_options_get_instance_private( \ GARROW_EXECUTE_NODE_OPTIONS(object))) static void @@ -889,18 +863,16 @@ garrow_execute_node_options_class_init(GArrowExecuteNodeOptionsClass *klass) gobject_class->set_property = garrow_execute_node_options_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("options", - "Options", - "The raw arrow::acero::ExecNodeOptions *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property(gobject_class, - PROP_EXECUTE_NODE_OPTIONS, - spec); + spec = g_param_spec_pointer( + "options", + "Options", + "The raw arrow::acero::ExecNodeOptions *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property(gobject_class, PROP_EXECUTE_NODE_OPTIONS, spec); } - -typedef struct GArrowSourceNodeOptionsPrivate_ { +typedef struct GArrowSourceNodeOptionsPrivate_ +{ GArrowRecordBatchReader *reader; GArrowRecordBatch *record_batch; } GArrowSourceNodeOptionsPrivate; @@ -914,10 +886,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowSourceNodeOptions, garrow_source_node_options, GARROW_TYPE_EXECUTE_NODE_OPTIONS) -#define GARROW_SOURCE_NODE_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_source_node_options_get_instance_private( \ - GARROW_SOURCE_NODE_OPTIONS(object))) +#define GARROW_SOURCE_NODE_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_source_node_options_get_instance_private(GARROW_SOURCE_NODE_OPTIONS(object))) static void garrow_source_node_options_dispose(GObject *object) @@ -993,21 +964,21 @@ garrow_source_node_options_class_init(GArrowSourceNodeOptionsClass *klass) 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(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "reader", + "Reader", + "The GArrowRecordBatchReader that produces " + "record batches", + GARROW_TYPE_RECORD_BATCH_READER, + static_cast(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(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "record-batch", + "Record batch", + "The GArrowRecordBatch to be produced", + GARROW_TYPE_RECORD_BATCH, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_RECORD_BATCH, spec); } @@ -1020,13 +991,11 @@ garrow_source_node_options_class_init(GArrowSourceNodeOptionsClass *klass) * Since: 6.0.0 */ GArrowSourceNodeOptions * -garrow_source_node_options_new_record_batch_reader( - GArrowRecordBatchReader *reader) +garrow_source_node_options_new_record_batch_reader(GArrowRecordBatchReader *reader) { auto arrow_reader = garrow_record_batch_reader_get_raw(reader); - auto arrow_options = new arrow::acero::SourceNodeOptions( - arrow_reader->schema(), - [arrow_reader]() { + auto arrow_options = + new arrow::acero::SourceNodeOptions(arrow_reader->schema(), [arrow_reader]() { using ExecBatch = arrow::compute::ExecBatch; using ExecBatchOptional = std::optional; auto arrow_record_batch_result = arrow_reader->Next(); @@ -1041,8 +1010,10 @@ garrow_source_node_options_new_record_batch_reader( ExecBatch(*arrow_record_batch)); }); auto options = g_object_new(GARROW_TYPE_SOURCE_NODE_OPTIONS, - "options", arrow_options, - "reader", reader, + "options", + arrow_options, + "reader", + reader, NULL); return GARROW_SOURCE_NODE_OPTIONS(options); } @@ -1058,16 +1029,16 @@ garrow_source_node_options_new_record_batch_reader( GArrowSourceNodeOptions * garrow_source_node_options_new_record_batch(GArrowRecordBatch *record_batch) { - struct State { + struct State + { std::shared_ptr record_batch; bool generated; }; auto state = std::make_shared(); state->record_batch = garrow_record_batch_get_raw(record_batch); state->generated = false; - auto arrow_options = new arrow::acero::SourceNodeOptions( - state->record_batch->schema(), - [state]() { + auto arrow_options = + new arrow::acero::SourceNodeOptions(state->record_batch->schema(), [state]() { using ExecBatch = arrow::compute::ExecBatch; using ExecBatchOptional = std::optional; if (!state->generated) { @@ -1079,8 +1050,10 @@ garrow_source_node_options_new_record_batch(GArrowRecordBatch *record_batch) } }); auto options = g_object_new(GARROW_TYPE_SOURCE_NODE_OPTIONS, - "options", arrow_options, - "record-batch", record_batch, + "options", + arrow_options, + "record-batch", + record_batch, NULL); return GARROW_SOURCE_NODE_OPTIONS(options); } @@ -1103,7 +1076,6 @@ garrow_source_node_options_new_table(GArrowTable *table) return options; } - G_DEFINE_TYPE(GArrowFilterNodeOptions, garrow_filter_node_options, GARROW_TYPE_EXECUTE_NODE_OPTIONS) @@ -1130,15 +1102,12 @@ GArrowFilterNodeOptions * garrow_filter_node_options_new(GArrowExpression *expression) { auto arrow_expression = garrow_expression_get_raw(expression); - auto arrow_options = - new arrow::acero::FilterNodeOptions(*arrow_expression); - auto options = g_object_new(GARROW_TYPE_FILTER_NODE_OPTIONS, - "options", arrow_options, - NULL); + auto arrow_options = new arrow::acero::FilterNodeOptions(*arrow_expression); + auto options = + g_object_new(GARROW_TYPE_FILTER_NODE_OPTIONS, "options", arrow_options, NULL); return GARROW_FILTER_NODE_OPTIONS(options); } - G_DEFINE_TYPE(GArrowProjectNodeOptions, garrow_project_node_options, GARROW_TYPE_EXECUTE_NODE_OPTIONS) @@ -1167,9 +1136,7 @@ garrow_project_node_options_class_init(GArrowProjectNodeOptionsClass *klass) * Since: 11.0.0 */ GArrowProjectNodeOptions * -garrow_project_node_options_new(GList *expressions, - gchar **names, - gsize n_names) +garrow_project_node_options_new(GList *expressions, gchar **names, gsize n_names) { std::vector arrow_expressions; std::vector arrow_names; @@ -1187,14 +1154,13 @@ garrow_project_node_options_new(GList *expressions, } auto arrow_options = new arrow::acero::ProjectNodeOptions(arrow_expressions, arrow_names); - auto options = g_object_new(GARROW_TYPE_PROJECT_NODE_OPTIONS, - "options", arrow_options, - NULL); + auto options = + g_object_new(GARROW_TYPE_PROJECT_NODE_OPTIONS, "options", arrow_options, NULL); return GARROW_PROJECT_NODE_OPTIONS(options); } - -typedef struct GArrowAggregationPrivate_ { +typedef struct GArrowAggregationPrivate_ +{ gchar *function; GArrowFunctionOptions *options; gchar *input; @@ -1208,14 +1174,11 @@ enum { PROP_AGGREGATION_OUTPUT, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowAggregation, - garrow_aggregation, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowAggregation, garrow_aggregation, G_TYPE_OBJECT) -#define GARROW_AGGREGATION_GET_PRIVATE(object) \ - static_cast( \ - garrow_aggregation_get_instance_private( \ - GARROW_AGGREGATION(object))) +#define GARROW_AGGREGATION_GET_PRIVATE(object) \ + static_cast( \ + garrow_aggregation_get_instance_private(GARROW_AGGREGATION(object))) static void garrow_aggregation_dispose(GObject *object) @@ -1314,15 +1277,13 @@ garrow_aggregation_class_init(GArrowAggregationClass *klass) * * Since: 6.0.0 */ - spec = g_param_spec_string("function", - "Function", - "The function name to aggregate", - NULL, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property(gobject_class, - PROP_AGGREGATION_FUNCTION, - spec); + spec = g_param_spec_string( + "function", + "Function", + "The function name to aggregate", + NULL, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property(gobject_class, PROP_AGGREGATION_FUNCTION, spec); /** * GArrowAggregation:options: @@ -1331,15 +1292,13 @@ garrow_aggregation_class_init(GArrowAggregationClass *klass) * * Since: 6.0.0 */ - spec = g_param_spec_object("options", - "Options", - "The options of aggregate function", - GARROW_TYPE_FUNCTION_OPTIONS, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property(gobject_class, - PROP_AGGREGATION_OPTIONS, - spec); + spec = g_param_spec_object( + "options", + "Options", + "The options of aggregate function", + GARROW_TYPE_FUNCTION_OPTIONS, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property(gobject_class, PROP_AGGREGATION_OPTIONS, spec); /** * GArrowAggregation:input: @@ -1348,15 +1307,13 @@ garrow_aggregation_class_init(GArrowAggregationClass *klass) * * Since: 6.0.0 */ - spec = g_param_spec_string("input", - "Input", - "The input field name of aggregate function", - NULL, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property(gobject_class, - PROP_AGGREGATION_INPUT, - spec); + spec = g_param_spec_string( + "input", + "Input", + "The input field name of aggregate function", + NULL, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property(gobject_class, PROP_AGGREGATION_INPUT, spec); /** * GArrowAggregation:output: @@ -1365,15 +1322,13 @@ garrow_aggregation_class_init(GArrowAggregationClass *klass) * * Since: 6.0.0 */ - spec = g_param_spec_string("output", - "Output", - "The output field name of aggregate function", - NULL, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property(gobject_class, - PROP_AGGREGATION_OUTPUT, - spec); + spec = g_param_spec_string( + "output", + "Output", + "The output field name of aggregate function", + NULL, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property(gobject_class, PROP_AGGREGATION_OUTPUT, spec); } /** @@ -1394,14 +1349,17 @@ garrow_aggregation_new(const gchar *function, const gchar *output) { return GARROW_AGGREGATION(g_object_new(GARROW_TYPE_AGGREGATION, - "function", function, - "options", options, - "input", input, - "output", output, + "function", + function, + "options", + options, + "input", + input, + "output", + output, NULL)); } - G_DEFINE_TYPE(GArrowAggregateNodeOptions, garrow_aggregate_node_options, GARROW_TYPE_EXECUTE_NODE_OPTIONS) @@ -1440,8 +1398,7 @@ garrow_aggregate_node_options_new(GList *aggregations, auto aggregation_priv = GARROW_AGGREGATION_GET_PRIVATE(node->data); arrow::compute::FunctionOptions *function_options = nullptr; if (aggregation_priv->options) { - function_options = - garrow_function_options_get_raw(aggregation_priv->options); + function_options = garrow_function_options_get_raw(aggregation_priv->options); }; std::vector arrow_targets; if (!garrow_field_refs_add(arrow_targets, @@ -1465,17 +1422,15 @@ garrow_aggregate_node_options_new(GList *aggregations, return NULL; } } - auto arrow_options = - new arrow::acero::AggregateNodeOptions(std::move(arrow_aggregates), - std::move(arrow_keys)); - auto options = g_object_new(GARROW_TYPE_AGGREGATE_NODE_OPTIONS, - "options", arrow_options, - NULL); + auto arrow_options = new arrow::acero::AggregateNodeOptions(std::move(arrow_aggregates), + std::move(arrow_keys)); + auto options = + g_object_new(GARROW_TYPE_AGGREGATE_NODE_OPTIONS, "options", arrow_options, NULL); return GARROW_AGGREGATE_NODE_OPTIONS(options); } - -typedef struct GArrowSinkNodeOptionsPrivate_ { +typedef struct GArrowSinkNodeOptionsPrivate_ +{ arrow::AsyncGenerator> generator; GArrowRecordBatchReader *reader; } GArrowSinkNodeOptionsPrivate; @@ -1484,10 +1439,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowSinkNodeOptions, garrow_sink_node_options, GARROW_TYPE_EXECUTE_NODE_OPTIONS) -#define GARROW_SINK_NODE_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_sink_node_options_get_instance_private( \ - GARROW_SINK_NODE_OPTIONS(object))) +#define GARROW_SINK_NODE_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_sink_node_options_get_instance_private(GARROW_SINK_NODE_OPTIONS(object))) static void garrow_sink_node_options_dispose(GObject *object) @@ -1512,7 +1466,7 @@ static void garrow_sink_node_options_init(GArrowSinkNodeOptions *object) { auto priv = GARROW_SINK_NODE_OPTIONS_GET_PRIVATE(object); - new(&(priv->generator)) + new (&(priv->generator)) arrow::AsyncGenerator>(); } @@ -1552,23 +1506,20 @@ garrow_sink_node_options_new(void) * Since: 6.0.0 */ GArrowRecordBatchReader * -garrow_sink_node_options_get_reader(GArrowSinkNodeOptions *options, - GArrowSchema *schema) +garrow_sink_node_options_get_reader(GArrowSinkNodeOptions *options, GArrowSchema *schema) { auto arrow_schema = garrow_schema_get_raw(schema); auto priv = GARROW_SINK_NODE_OPTIONS_GET_PRIVATE(options); if (!priv->reader) { - auto arrow_reader = - arrow::acero::MakeGeneratorReader(arrow_schema, - std::move(priv->generator), - arrow::default_memory_pool()); + 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, nullptr); } g_object_ref(priv->reader); return priv->reader; } - G_DEFINE_TYPE(GArrowHashJoinNodeOptions, garrow_hash_join_node_options, GARROW_TYPE_EXECUTE_NODE_OPTIONS) @@ -1625,13 +1576,11 @@ garrow_hash_join_node_options_new(GArrowJoinType type, return NULL; } } - auto arrow_options = - new arrow::acero::HashJoinNodeOptions(arrow_type, - std::move(arrow_left_keys), - std::move(arrow_right_keys)); - auto options = g_object_new(GARROW_TYPE_HASH_JOIN_NODE_OPTIONS, - "options", arrow_options, - NULL); + auto arrow_options = new arrow::acero::HashJoinNodeOptions(arrow_type, + std::move(arrow_left_keys), + std::move(arrow_right_keys)); + auto options = + g_object_new(GARROW_TYPE_HASH_JOIN_NODE_OPTIONS, "options", arrow_options, NULL); return GARROW_HASH_JOIN_NODE_OPTIONS(options); } @@ -1647,16 +1596,13 @@ garrow_hash_join_node_options_new(GArrowJoinType type, * Since: 7.0.0 */ gboolean -garrow_hash_join_node_options_set_left_outputs( - GArrowHashJoinNodeOptions *options, - const gchar **outputs, - gsize n_outputs, - GError **error) +garrow_hash_join_node_options_set_left_outputs(GArrowHashJoinNodeOptions *options, + const gchar **outputs, + gsize n_outputs, + GError **error) { - auto arrow_options = - static_cast( - garrow_execute_node_options_get_raw( - GARROW_EXECUTE_NODE_OPTIONS(options))); + auto arrow_options = static_cast( + garrow_execute_node_options_get_raw(GARROW_EXECUTE_NODE_OPTIONS(options))); arrow_options->output_all = false; arrow_options->left_output.clear(); for (gsize i = 0; i < n_outputs; ++i) { @@ -1682,16 +1628,13 @@ garrow_hash_join_node_options_set_left_outputs( * Since: 7.0.0 */ gboolean -garrow_hash_join_node_options_set_right_outputs( - GArrowHashJoinNodeOptions *options, - const gchar **outputs, - gsize n_outputs, - GError **error) +garrow_hash_join_node_options_set_right_outputs(GArrowHashJoinNodeOptions *options, + const gchar **outputs, + gsize n_outputs, + GError **error) { - auto arrow_options = - static_cast( - garrow_execute_node_options_get_raw( - GARROW_EXECUTE_NODE_OPTIONS(options))); + auto arrow_options = static_cast( + garrow_execute_node_options_get_raw(GARROW_EXECUTE_NODE_OPTIONS(options))); arrow_options->output_all = false; arrow_options->right_output.clear(); for (gsize i = 0; i < n_outputs; ++i) { @@ -1705,8 +1648,8 @@ garrow_hash_join_node_options_set_right_outputs( return TRUE; } - -struct GArrowExecuteNodePrivate { +struct GArrowExecuteNodePrivate +{ arrow::acero::ExecNode *node; GArrowExecuteNodeOptions *options; }; @@ -1716,14 +1659,11 @@ enum { PROP_OPTIONS, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowExecuteNode, - garrow_execute_node, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowExecuteNode, garrow_execute_node, G_TYPE_OBJECT) -#define GARROW_EXECUTE_NODE_GET_PRIVATE(object) \ - static_cast( \ - garrow_execute_node_get_instance_private( \ - GARROW_EXECUTE_NODE(object))) +#define GARROW_EXECUTE_NODE_GET_PRIVATE(object) \ + static_cast( \ + garrow_execute_node_get_instance_private(GARROW_EXECUTE_NODE(object))) static void garrow_execute_node_dispose(GObject *object) @@ -1746,12 +1686,10 @@ garrow_execute_node_set_property(GObject *object, switch (prop_id) { case PROP_NODE: - priv->node = - static_cast(g_value_get_pointer(value)); + priv->node = static_cast(g_value_get_pointer(value)); break; case PROP_OPTIONS: - priv->options = - static_cast(g_value_dup_object(value)); + priv->options = static_cast(g_value_dup_object(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -1791,19 +1729,19 @@ garrow_execute_node_class_init(GArrowExecuteNodeClass *klass) gobject_class->get_property = garrow_execute_node_get_property; GParamSpec *spec; - spec = g_param_spec_pointer("node", - "Node", - "The raw arrow::acero::ExecNode *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "node", + "Node", + "The raw arrow::acero::ExecNode *", + static_cast(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(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "options", + "Options", + "The options of this node", + GARROW_TYPE_EXECUTE_NODE_OPTIONS, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_OPTIONS, spec); } @@ -1838,8 +1776,8 @@ garrow_execute_node_get_output_schema(GArrowExecuteNode *node) return garrow_schema_new_raw(&arrow_schema); } - -struct GArrowExecutePlanPrivate { +struct GArrowExecutePlanPrivate +{ std::shared_ptr plan; GList *nodes; }; @@ -1848,14 +1786,11 @@ enum { PROP_PLAN = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowExecutePlan, - garrow_execute_plan, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowExecutePlan, garrow_execute_plan, G_TYPE_OBJECT) -#define GARROW_EXECUTE_PLAN_GET_PRIVATE(object) \ - static_cast( \ - garrow_execute_plan_get_instance_private( \ - GARROW_EXECUTE_PLAN(object))) +#define GARROW_EXECUTE_PLAN_GET_PRIVATE(object) \ + static_cast( \ + garrow_execute_plan_get_instance_private(GARROW_EXECUTE_PLAN(object))) static void garrow_execute_plan_finalize(GObject *object) @@ -1885,8 +1820,7 @@ garrow_execute_plan_set_property(GObject *object, switch (prop_id) { case PROP_PLAN: priv->plan = - *static_cast *>( - g_value_get_pointer(value)); + *static_cast *>(g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -1898,7 +1832,7 @@ static void garrow_execute_plan_init(GArrowExecutePlan *object) { auto priv = GARROW_EXECUTE_PLAN_GET_PRIVATE(object); - new(&(priv->plan)) std::shared_ptr; + new (&(priv->plan)) std::shared_ptr; } static void @@ -1910,11 +1844,11 @@ garrow_execute_plan_class_init(GArrowExecutePlanClass *klass) gobject_class->set_property = garrow_execute_plan_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("plan", - "Plan", - "The raw std::shared_ptr", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "plan", + "Plan", + "The raw std::shared_ptr", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_PLAN, spec); } @@ -1932,9 +1866,8 @@ garrow_execute_plan_new(GError **error) { auto arrow_plan_result = arrow::acero::ExecPlan::Make(); if (garrow::check(error, arrow_plan_result, "[execute-plan][new]")) { - return GARROW_EXECUTE_PLAN(g_object_new(GARROW_TYPE_EXECUTE_PLAN, - "plan", &(*arrow_plan_result), - NULL)); + return GARROW_EXECUTE_PLAN( + g_object_new(GARROW_TYPE_EXECUTE_PLAN, "plan", &(*arrow_plan_result), NULL)); } else { return NULL; } @@ -1963,8 +1896,7 @@ garrow_execute_plan_build_node(GArrowExecutePlan *plan, auto arrow_plan = garrow_execute_plan_get_raw(plan); std::vector arrow_inputs; for (auto node = inputs; node; node = node->next) { - auto arrow_node = - garrow_execute_node_get_raw(GARROW_EXECUTE_NODE(node->data)); + auto arrow_node = garrow_execute_node_get_raw(GARROW_EXECUTE_NODE(node->data)); arrow_inputs.push_back(arrow_node); } auto arrow_options = garrow_execute_node_options_get_raw(options); @@ -2034,12 +1966,11 @@ garrow_execute_plan_build_filter_node(GArrowExecutePlan *plan, { GList *inputs = nullptr; inputs = g_list_prepend(inputs, input); - auto node = - garrow_execute_plan_build_node(plan, - "filter", - inputs, - GARROW_EXECUTE_NODE_OPTIONS(options), - error); + auto node = garrow_execute_plan_build_node(plan, + "filter", + inputs, + GARROW_EXECUTE_NODE_OPTIONS(options), + error); g_list_free(inputs); return node; } @@ -2067,12 +1998,11 @@ garrow_execute_plan_build_project_node(GArrowExecutePlan *plan, { GList *inputs = nullptr; inputs = g_list_prepend(inputs, input); - auto node = - garrow_execute_plan_build_node(plan, - "project", - inputs, - GARROW_EXECUTE_NODE_OPTIONS(options), - error); + auto node = garrow_execute_plan_build_node(plan, + "project", + inputs, + GARROW_EXECUTE_NODE_OPTIONS(options), + error); g_list_free(inputs); return node; } @@ -2100,12 +2030,11 @@ garrow_execute_plan_build_aggregate_node(GArrowExecutePlan *plan, { GList *inputs = NULL; inputs = g_list_prepend(inputs, input); - auto node = - garrow_execute_plan_build_node(plan, - "aggregate", - inputs, - GARROW_EXECUTE_NODE_OPTIONS(options), - error); + auto node = garrow_execute_plan_build_node(plan, + "aggregate", + inputs, + GARROW_EXECUTE_NODE_OPTIONS(options), + error); g_list_free(inputs); return node; } @@ -2133,12 +2062,11 @@ garrow_execute_plan_build_sink_node(GArrowExecutePlan *plan, { GList *inputs = NULL; inputs = g_list_prepend(inputs, input); - auto node = - garrow_execute_plan_build_node(plan, - "sink", - inputs, - GARROW_EXECUTE_NODE_OPTIONS(options), - error); + auto node = garrow_execute_plan_build_node(plan, + "sink", + inputs, + GARROW_EXECUTE_NODE_OPTIONS(options), + error); g_list_free(inputs); return node; } @@ -2169,12 +2097,11 @@ garrow_execute_plan_build_hash_join_node(GArrowExecutePlan *plan, GList *inputs = NULL; inputs = g_list_append(inputs, left); inputs = g_list_append(inputs, right); - auto node = - garrow_execute_plan_build_node(plan, - "hashjoin", - inputs, - GARROW_EXECUTE_NODE_OPTIONS(options), - error); + auto node = garrow_execute_plan_build_node(plan, + "hashjoin", + inputs, + GARROW_EXECUTE_NODE_OPTIONS(options), + error); g_list_free(inputs); return node; } @@ -2205,13 +2132,10 @@ garrow_execute_plan_get_nodes(GArrowExecutePlan *plan) * Since: 6.0.0 */ gboolean -garrow_execute_plan_validate(GArrowExecutePlan *plan, - GError **error) +garrow_execute_plan_validate(GArrowExecutePlan *plan, GError **error) { auto arrow_plan = garrow_execute_plan_get_raw(plan); - return garrow::check(error, - arrow_plan->Validate(), - "[execute-plan][validate]"); + return garrow::check(error, arrow_plan->Validate(), "[execute-plan][validate]"); } /** @@ -2260,12 +2184,11 @@ garrow_execute_plan_wait(GArrowExecutePlan *plan, GError **error) { auto arrow_plan = garrow_execute_plan_get_raw(plan); arrow_plan->finished().Wait(); - return garrow::check(error, arrow_plan->finished().status(), - "[execute-plan][wait]"); + return garrow::check(error, arrow_plan->finished().status(), "[execute-plan][wait]"); } - -typedef struct GArrowCastOptionsPrivate_ { +typedef struct GArrowCastOptionsPrivate_ +{ GArrowDataType *to_data_type; } GArrowCastOptionsPrivate; @@ -2283,10 +2206,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowCastOptions, garrow_cast_options, GARROW_TYPE_FUNCTION_OPTIONS) -#define GARROW_CAST_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_cast_options_get_instance_private( \ - GARROW_CAST_OPTIONS(object))) +#define GARROW_CAST_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_cast_options_get_instance_private(GARROW_CAST_OPTIONS(object))) static void garrow_cast_options_dispose(GObject *object) @@ -2391,8 +2313,8 @@ static void garrow_cast_options_init(GArrowCastOptions *object) { auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object); - priv->options = static_cast( - new arrow::compute::CastOptions()); + priv->options = + static_cast(new arrow::compute::CastOptions()); } static void @@ -2400,7 +2322,7 @@ garrow_cast_options_class_init(GArrowCastOptionsClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_cast_options_dispose; + gobject_class->dispose = garrow_cast_options_dispose; gobject_class->set_property = garrow_cast_options_set_property; gobject_class->get_property = garrow_cast_options_get_property; @@ -2519,7 +2441,6 @@ garrow_cast_options_new(void) return GARROW_CAST_OPTIONS(cast_options); } - enum { PROP_SKIP_NULLS = 1, PROP_MIN_COUNT, @@ -2536,8 +2457,7 @@ garrow_scalar_aggregate_options_set_property(GObject *object, GParamSpec *pspec) { auto options = - garrow_scalar_aggregate_options_get_raw( - GARROW_SCALAR_AGGREGATE_OPTIONS(object)); + garrow_scalar_aggregate_options_get_raw(GARROW_SCALAR_AGGREGATE_OPTIONS(object)); switch (prop_id) { case PROP_SKIP_NULLS: @@ -2559,8 +2479,7 @@ garrow_scalar_aggregate_options_get_property(GObject *object, GParamSpec *pspec) { auto options = - garrow_scalar_aggregate_options_get_raw( - GARROW_SCALAR_AGGREGATE_OPTIONS(object)); + garrow_scalar_aggregate_options_get_raw(GARROW_SCALAR_AGGREGATE_OPTIONS(object)); switch (prop_id) { case PROP_SKIP_NULLS: @@ -2584,8 +2503,7 @@ garrow_scalar_aggregate_options_init(GArrowScalarAggregateOptions *object) } static void -garrow_scalar_aggregate_options_class_init( - GArrowScalarAggregateOptionsClass *klass) +garrow_scalar_aggregate_options_class_init(GArrowScalarAggregateOptionsClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); @@ -2641,14 +2559,11 @@ garrow_scalar_aggregate_options_new(void) return GARROW_SCALAR_AGGREGATE_OPTIONS(scalar_aggregate_options); } - enum { PROP_MODE = 1, }; -G_DEFINE_TYPE(GArrowCountOptions, - garrow_count_options, - GARROW_TYPE_FUNCTION_OPTIONS) +G_DEFINE_TYPE(GArrowCountOptions, garrow_count_options, GARROW_TYPE_FUNCTION_OPTIONS) static void garrow_count_options_set_property(GObject *object, @@ -2661,8 +2576,7 @@ garrow_count_options_set_property(GObject *object, switch (prop_id) { case PROP_MODE: options->mode = - static_cast( - g_value_get_enum(value)); + static_cast(g_value_get_enum(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -2692,8 +2606,8 @@ static void garrow_count_options_init(GArrowCountOptions *object) { auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object); - priv->options = static_cast( - new arrow::compute::CountOptions()); + priv->options = + static_cast(new arrow::compute::CountOptions()); } static void @@ -2737,14 +2651,11 @@ garrow_count_options_new(void) return GARROW_COUNT_OPTIONS(count_options); } - enum { PROP_NULL_SELECTION_BEHAVIOR = 1, }; -G_DEFINE_TYPE(GArrowFilterOptions, - garrow_filter_options, - GARROW_TYPE_FUNCTION_OPTIONS) +G_DEFINE_TYPE(GArrowFilterOptions, garrow_filter_options, GARROW_TYPE_FUNCTION_OPTIONS) static void garrow_filter_options_set_property(GObject *object, @@ -2788,8 +2699,8 @@ static void garrow_filter_options_init(GArrowFilterOptions *object) { auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object); - priv->options = static_cast( - new arrow::compute::FilterOptions()); + priv->options = + static_cast(new arrow::compute::FilterOptions()); } static void @@ -2810,16 +2721,14 @@ garrow_filter_options_class_init(GArrowFilterOptionsClass *klass) * * Since: 0.17.0 */ - spec = g_param_spec_enum("null-selection-behavior", - "NULL selection behavior", - "How to handle filtered values", - GARROW_TYPE_FILTER_NULL_SELECTION_BEHAVIOR, - static_cast( - options.null_selection_behavior), - static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_NULL_SELECTION_BEHAVIOR, - spec); + spec = g_param_spec_enum( + "null-selection-behavior", + "NULL selection behavior", + "How to handle filtered values", + GARROW_TYPE_FILTER_NULL_SELECTION_BEHAVIOR, + static_cast(options.null_selection_behavior), + static_cast(G_PARAM_READWRITE)); + g_object_class_install_property(gobject_class, PROP_NULL_SELECTION_BEHAVIOR, spec); } /** @@ -2836,17 +2745,14 @@ garrow_filter_options_new(void) return GARROW_FILTER_OPTIONS(filter_options); } - -G_DEFINE_TYPE(GArrowTakeOptions, - garrow_take_options, - GARROW_TYPE_FUNCTION_OPTIONS) +G_DEFINE_TYPE(GArrowTakeOptions, garrow_take_options, GARROW_TYPE_FUNCTION_OPTIONS) static void garrow_take_options_init(GArrowTakeOptions *object) { auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object); - priv->options = static_cast( - new arrow::compute::TakeOptions()); + priv->options = + static_cast(new arrow::compute::TakeOptions()); } static void @@ -2868,7 +2774,6 @@ garrow_take_options_new(void) return GARROW_TAKE_OPTIONS(take_options); } - enum { PROP_ARRAY_SORT_OPTIONS_ORDER = 1, }; @@ -2883,13 +2788,11 @@ garrow_array_sort_options_set_property(GObject *object, const GValue *value, GParamSpec *pspec) { - auto options = - garrow_array_sort_options_get_raw(GARROW_ARRAY_SORT_OPTIONS(object)); + auto options = garrow_array_sort_options_get_raw(GARROW_ARRAY_SORT_OPTIONS(object)); switch (prop_id) { case PROP_ARRAY_SORT_OPTIONS_ORDER: - options->order = - static_cast(g_value_get_enum(value)); + options->order = static_cast(g_value_get_enum(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -2903,8 +2806,7 @@ garrow_array_sort_options_get_property(GObject *object, GValue *value, GParamSpec *pspec) { - auto options = - garrow_array_sort_options_get_raw(GARROW_ARRAY_SORT_OPTIONS(object)); + auto options = garrow_array_sort_options_get_raw(GARROW_ARRAY_SORT_OPTIONS(object)); switch (prop_id) { case PROP_ARRAY_SORT_OPTIONS_ORDER: @@ -2948,9 +2850,7 @@ garrow_array_sort_options_class_init(GArrowArraySortOptionsClass *klass) GARROW_TYPE_SORT_ORDER, static_cast(options.order), static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_ARRAY_SORT_OPTIONS_ORDER, - spec); + g_object_class_install_property(gobject_class, PROP_ARRAY_SORT_OPTIONS_ORDER, spec); } /** @@ -2965,9 +2865,7 @@ GArrowArraySortOptions * garrow_array_sort_options_new(GArrowSortOrder order) { auto array_sort_options = - g_object_new(GARROW_TYPE_ARRAY_SORT_OPTIONS, - "order", order, - NULL); + g_object_new(GARROW_TYPE_ARRAY_SORT_OPTIONS, "order", order, NULL); return GARROW_ARRAY_SORT_OPTIONS(array_sort_options); } @@ -2990,8 +2888,8 @@ garrow_array_sort_options_equal(GArrowArraySortOptions *options, return arrow_options->order == arrow_other_options->order; } - -typedef struct GArrowSortKeyPrivate_ { +typedef struct GArrowSortKeyPrivate_ +{ arrow::compute::SortKey sort_key; } GArrowSortKeyPrivate; @@ -3000,14 +2898,11 @@ enum { PROP_SORT_KEY_ORDER, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowSortKey, - garrow_sort_key, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowSortKey, garrow_sort_key, G_TYPE_OBJECT) -#define GARROW_SORT_KEY_GET_PRIVATE(object) \ - static_cast( \ - garrow_sort_key_get_instance_private( \ - GARROW_SORT_KEY(object))) +#define GARROW_SORT_KEY_GET_PRIVATE(object) \ + static_cast( \ + garrow_sort_key_get_instance_private(GARROW_SORT_KEY(object))) static void garrow_sort_key_finalize(GObject *object) @@ -3068,7 +2963,7 @@ static void garrow_sort_key_init(GArrowSortKey *object) { auto priv = GARROW_SORT_KEY_GET_PRIVATE(object); - new(&priv->sort_key) arrow::compute::SortKey(""); + new (&priv->sort_key) arrow::compute::SortKey(""); } static void @@ -3076,7 +2971,7 @@ garrow_sort_key_class_init(GArrowSortKeyClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_sort_key_finalize; + gobject_class->finalize = garrow_sort_key_finalize; gobject_class->set_property = garrow_sort_key_set_property; gobject_class->get_property = garrow_sort_key_get_property; @@ -3106,13 +3001,13 @@ garrow_sort_key_class_init(GArrowSortKeyClass *klass) * * Since: 3.0.0 */ - spec = g_param_spec_enum("order", - "Order", - "How to order values", - GARROW_TYPE_SORT_ORDER, - 0, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_enum( + "order", + "Order", + "How to order values", + GARROW_TYPE_SORT_ORDER, + 0, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_SORT_KEY_ORDER, spec); } @@ -3126,19 +3021,13 @@ garrow_sort_key_class_init(GArrowSortKeyClass *klass) * Since: 3.0.0 */ GArrowSortKey * -garrow_sort_key_new(const gchar *target, - GArrowSortOrder order, - GError **error) +garrow_sort_key_new(const gchar *target, GArrowSortOrder order, GError **error) { auto arrow_reference_result = garrow_field_reference_resolve_raw(target); - if (!garrow::check(error, - arrow_reference_result, - "[sort-key][new]")) { + if (!garrow::check(error, arrow_reference_result, "[sort-key][new]")) { return NULL; } - auto sort_key = g_object_new(GARROW_TYPE_SORT_KEY, - "order", order, - NULL); + auto sort_key = g_object_new(GARROW_TYPE_SORT_KEY, "order", order, NULL); auto priv = GARROW_SORT_KEY_GET_PRIVATE(sort_key); priv->sort_key.target = *arrow_reference_result; return GARROW_SORT_KEY(sort_key); @@ -3155,25 +3044,21 @@ garrow_sort_key_new(const gchar *target, * Since: 3.0.0 */ gboolean -garrow_sort_key_equal(GArrowSortKey *sort_key, - GArrowSortKey *other_sort_key) +garrow_sort_key_equal(GArrowSortKey *sort_key, GArrowSortKey *other_sort_key) { auto arrow_sort_key = garrow_sort_key_get_raw(sort_key); auto arrow_other_sort_key = garrow_sort_key_get_raw(other_sort_key); return arrow_sort_key->Equals(*arrow_other_sort_key); } - -G_DEFINE_TYPE(GArrowSortOptions, - garrow_sort_options, - GARROW_TYPE_FUNCTION_OPTIONS) +G_DEFINE_TYPE(GArrowSortOptions, garrow_sort_options, GARROW_TYPE_FUNCTION_OPTIONS) static void garrow_sort_options_init(GArrowSortOptions *object) { auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object); - priv->options = static_cast( - new arrow::compute::SortOptions()); + priv->options = + static_cast(new arrow::compute::SortOptions()); } static void @@ -3192,8 +3077,7 @@ garrow_sort_options_class_init(GArrowSortOptionsClass *klass) GArrowSortOptions * garrow_sort_options_new(GList *sort_keys) { - auto sort_options = - GARROW_SORT_OPTIONS(g_object_new(GARROW_TYPE_SORT_OPTIONS, NULL)); + auto sort_options = GARROW_SORT_OPTIONS(g_object_new(GARROW_TYPE_SORT_OPTIONS, NULL)); if (sort_keys) { garrow_sort_options_set_sort_keys(sort_options, sort_keys); } @@ -3211,8 +3095,7 @@ garrow_sort_options_new(GList *sort_keys) * Since: 3.0.0 */ gboolean -garrow_sort_options_equal(GArrowSortOptions *options, - GArrowSortOptions *other_options) +garrow_sort_options_equal(GArrowSortOptions *options, GArrowSortOptions *other_options) { auto arrow_options = garrow_sort_options_get_raw(options); auto arrow_other_options = garrow_sort_options_get_raw(other_options); @@ -3249,8 +3132,7 @@ garrow_sort_options_get_sort_keys(GArrowSortOptions *options) * Since: 3.0.0 */ void -garrow_sort_options_set_sort_keys(GArrowSortOptions *options, - GList *sort_keys) +garrow_sort_options_set_sort_keys(GArrowSortOptions *options, GList *sort_keys) { auto arrow_options = garrow_sort_options_get_raw(options); garrow_raw_sort_keys_set(arrow_options->sort_keys, sort_keys); @@ -3266,15 +3148,14 @@ garrow_sort_options_set_sort_keys(GArrowSortOptions *options, * Since: 3.0.0 */ void -garrow_sort_options_add_sort_key(GArrowSortOptions *options, - GArrowSortKey *sort_key) +garrow_sort_options_add_sort_key(GArrowSortOptions *options, GArrowSortKey *sort_key) { auto arrow_options = garrow_sort_options_get_raw(options); garrow_raw_sort_keys_add(arrow_options->sort_keys, sort_key); } - -typedef struct GArrowSetLookupOptionsPrivate_ { +typedef struct GArrowSetLookupOptionsPrivate_ +{ GArrowDatum *value_set; } GArrowSetLookupOptionsPrivate; @@ -3287,10 +3168,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowSetLookupOptions, garrow_set_lookup_options, GARROW_TYPE_FUNCTION_OPTIONS) -#define GARROW_SET_LOOKUP_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_set_lookup_options_get_instance_private( \ - GARROW_SET_LOOKUP_OPTIONS(object))) +#define GARROW_SET_LOOKUP_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_set_lookup_options_get_instance_private(GARROW_SET_LOOKUP_OPTIONS(object))) static void garrow_set_lookup_options_dispose(GObject *object) @@ -3312,8 +3192,7 @@ garrow_set_lookup_options_set_property(GObject *object, GParamSpec *pspec) { auto priv = GARROW_SET_LOOKUP_OPTIONS_GET_PRIVATE(object); - auto options = - garrow_set_lookup_options_get_raw(GARROW_SET_LOOKUP_OPTIONS(object)); + auto options = garrow_set_lookup_options_get_raw(GARROW_SET_LOOKUP_OPTIONS(object)); switch (prop_id) { case PROP_SET_LOOKUP_OPTIONS_VALUE_SET: @@ -3349,15 +3228,15 @@ garrow_set_lookup_options_get_property(GObject *object, GParamSpec *pspec) { auto priv = GARROW_SET_LOOKUP_OPTIONS_GET_PRIVATE(object); - auto options = - garrow_set_lookup_options_get_raw(GARROW_SET_LOOKUP_OPTIONS(object)); + auto options = garrow_set_lookup_options_get_raw(GARROW_SET_LOOKUP_OPTIONS(object)); switch (prop_id) { case PROP_SET_LOOKUP_OPTIONS_VALUE_SET: g_value_set_object(value, priv->value_set); break; case PROP_SET_LOOKUP_OPTIONS_SKIP_NULLS: - g_value_set_boolean(value, options->skip_nulls.has_value() && options->skip_nulls.value()); + g_value_set_boolean(value, + options->skip_nulls.has_value() && options->skip_nulls.value()); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -3382,7 +3261,6 @@ garrow_set_lookup_options_class_init(GArrowSetLookupOptionsClass *klass) gobject_class->set_property = garrow_set_lookup_options_set_property; gobject_class->get_property = garrow_set_lookup_options_get_property; - arrow::compute::SetLookupOptions options; GParamSpec *spec; @@ -3398,9 +3276,7 @@ garrow_set_lookup_options_class_init(GArrowSetLookupOptionsClass *klass) "The set of values to look up input values into", GARROW_TYPE_DATUM, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_SET_LOOKUP_OPTIONS_VALUE_SET, - spec); + g_object_class_install_property(gobject_class, PROP_SET_LOOKUP_OPTIONS_VALUE_SET, spec); /** * GArrowSetLookupOptions:skip-nulls: @@ -3410,10 +3286,13 @@ garrow_set_lookup_options_class_init(GArrowSetLookupOptionsClass *klass) * Since: 6.0.0 */ auto skip_nulls = (options.skip_nulls.has_value() && options.skip_nulls.value()); - spec = - g_param_spec_boolean("skip-nulls", "Skip NULLs", "Whether NULLs are skipped or not", - skip_nulls, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, PROP_SET_LOOKUP_OPTIONS_SKIP_NULLS, + spec = g_param_spec_boolean("skip-nulls", + "Skip NULLs", + "Whether NULLs are skipped or not", + skip_nulls, + static_cast(G_PARAM_READWRITE)); + g_object_class_install_property(gobject_class, + PROP_SET_LOOKUP_OPTIONS_SKIP_NULLS, spec); } @@ -3430,12 +3309,9 @@ GArrowSetLookupOptions * garrow_set_lookup_options_new(GArrowDatum *value_set) { return GARROW_SET_LOOKUP_OPTIONS( - g_object_new(GARROW_TYPE_SET_LOOKUP_OPTIONS, - "value-set", value_set, - NULL)); + g_object_new(GARROW_TYPE_SET_LOOKUP_OPTIONS, "value-set", value_set, NULL)); } - enum { PROP_VARIANCE_OPTIONS_DDOF = 1, PROP_VARIANCE_OPTIONS_SKIP_NULLS, @@ -3446,10 +3322,9 @@ G_DEFINE_TYPE(GArrowVarianceOptions, garrow_variance_options, GARROW_TYPE_FUNCTION_OPTIONS) -#define GARROW_VARIANCE_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_variance_options_get_instance_private( \ - GARROW_VARIANCE_OPTIONS(object))) +#define GARROW_VARIANCE_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_variance_options_get_instance_private(GARROW_VARIANCE_OPTIONS(object))) static void garrow_variance_options_set_property(GObject *object, @@ -3457,8 +3332,7 @@ garrow_variance_options_set_property(GObject *object, const GValue *value, GParamSpec *pspec) { - auto options = - garrow_variance_options_get_raw(GARROW_VARIANCE_OPTIONS(object)); + auto options = garrow_variance_options_get_raw(GARROW_VARIANCE_OPTIONS(object)); switch (prop_id) { case PROP_VARIANCE_OPTIONS_DDOF: @@ -3482,8 +3356,7 @@ garrow_variance_options_get_property(GObject *object, GValue *value, GParamSpec *pspec) { - auto options = - garrow_variance_options_get_raw(GARROW_VARIANCE_OPTIONS(object)); + auto options = garrow_variance_options_get_raw(GARROW_VARIANCE_OPTIONS(object)); switch (prop_id) { case PROP_VARIANCE_OPTIONS_DDOF: @@ -3505,8 +3378,8 @@ static void garrow_variance_options_init(GArrowVarianceOptions *object) { auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object); - priv->options = static_cast( - new arrow::compute::VarianceOptions()); + priv->options = + static_cast(new arrow::compute::VarianceOptions()); } static void @@ -3517,7 +3390,6 @@ garrow_variance_options_class_init(GArrowVarianceOptionsClass *klass) gobject_class->set_property = garrow_variance_options_set_property; gobject_class->get_property = garrow_variance_options_get_property; - arrow::compute::VarianceOptions options; GParamSpec *spec; @@ -3535,9 +3407,7 @@ garrow_variance_options_class_init(GArrowVarianceOptionsClass *klass) G_MAXINT, options.ddof, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_VARIANCE_OPTIONS_DDOF, - spec); + g_object_class_install_property(gobject_class, PROP_VARIANCE_OPTIONS_DDOF, spec); /** * GArrowVarianceOptions:skip-nulls: @@ -3551,9 +3421,7 @@ garrow_variance_options_class_init(GArrowVarianceOptionsClass *klass) "Whether NULLs are skipped or not", options.skip_nulls, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_VARIANCE_OPTIONS_SKIP_NULLS, - spec); + g_object_class_install_property(gobject_class, PROP_VARIANCE_OPTIONS_SKIP_NULLS, spec); /** * GArrowVarianceOptions:min-count: @@ -3570,10 +3438,7 @@ garrow_variance_options_class_init(GArrowVarianceOptionsClass *klass) G_MAXUINT, options.min_count, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_VARIANCE_OPTIONS_MIN_COUNT, - spec); - + g_object_class_install_property(gobject_class, PROP_VARIANCE_OPTIONS_MIN_COUNT, spec); } /** @@ -3586,24 +3451,19 @@ garrow_variance_options_class_init(GArrowVarianceOptionsClass *klass) GArrowVarianceOptions * garrow_variance_options_new(void) { - return GARROW_VARIANCE_OPTIONS( - g_object_new(GARROW_TYPE_VARIANCE_OPTIONS, NULL)); + return GARROW_VARIANCE_OPTIONS(g_object_new(GARROW_TYPE_VARIANCE_OPTIONS, NULL)); } - enum { PROP_ROUND_OPTIONS_N_DIGITS = 1, PROP_ROUND_OPTIONS_MODE, }; -G_DEFINE_TYPE(GArrowRoundOptions, - garrow_round_options, - GARROW_TYPE_FUNCTION_OPTIONS) +G_DEFINE_TYPE(GArrowRoundOptions, garrow_round_options, GARROW_TYPE_FUNCTION_OPTIONS) -#define GARROW_ROUND_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_round_options_get_instance_private( \ - GARROW_ROUND_OPTIONS(object))) +#define GARROW_ROUND_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_round_options_get_instance_private(GARROW_ROUND_OPTIONS(object))) static void garrow_round_options_set_property(GObject *object, @@ -3618,8 +3478,7 @@ garrow_round_options_set_property(GObject *object, options->ndigits = g_value_get_int64(value); break; case PROP_ROUND_OPTIONS_MODE: - options->round_mode = - static_cast(g_value_get_enum(value)); + options->round_mode = static_cast(g_value_get_enum(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -3652,8 +3511,8 @@ static void garrow_round_options_init(GArrowRoundOptions *object) { auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object); - priv->options = static_cast( - new arrow::compute::RoundOptions()); + priv->options = + static_cast(new arrow::compute::RoundOptions()); } static void @@ -3664,7 +3523,6 @@ garrow_round_options_class_init(GArrowRoundOptionsClass *klass) gobject_class->set_property = garrow_round_options_set_property; gobject_class->get_property = garrow_round_options_get_property; - arrow::compute::RoundOptions options; GParamSpec *spec; @@ -3682,9 +3540,7 @@ garrow_round_options_class_init(GArrowRoundOptionsClass *klass) G_MAXINT64, options.ndigits, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_ROUND_OPTIONS_N_DIGITS, - spec); + g_object_class_install_property(gobject_class, PROP_ROUND_OPTIONS_N_DIGITS, spec); /** * GArrowRoundOptions:mode: @@ -3699,9 +3555,7 @@ garrow_round_options_class_init(GArrowRoundOptionsClass *klass) GARROW_TYPE_ROUND_MODE, static_cast(options.round_mode), static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_ROUND_OPTIONS_MODE, - spec); + g_object_class_install_property(gobject_class, PROP_ROUND_OPTIONS_MODE, spec); } /** @@ -3717,8 +3571,8 @@ garrow_round_options_new(void) return GARROW_ROUND_OPTIONS(g_object_new(GARROW_TYPE_ROUND_OPTIONS, NULL)); } - -typedef struct GArrowRoundToMultipleOptionsPrivate_ { +typedef struct GArrowRoundToMultipleOptionsPrivate_ +{ GArrowScalar *multiple; } GArrowRoundToMultipleOptionsPrivate; @@ -3731,9 +3585,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowRoundToMultipleOptions, garrow_round_to_multiple_options, GARROW_TYPE_FUNCTION_OPTIONS) -#define GARROW_ROUND_TO_MULTIPLE_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_round_to_multiple_options_get_instance_private( \ +#define GARROW_ROUND_TO_MULTIPLE_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_round_to_multiple_options_get_instance_private( \ GARROW_ROUND_TO_MULTIPLE_OPTIONS(object))) static void @@ -3757,8 +3611,7 @@ garrow_round_to_multiple_options_set_property(GObject *object, { auto priv = GARROW_ROUND_TO_MULTIPLE_OPTIONS_GET_PRIVATE(object); auto options = - garrow_round_to_multiple_options_get_raw( - GARROW_ROUND_TO_MULTIPLE_OPTIONS(object)); + garrow_round_to_multiple_options_get_raw(GARROW_ROUND_TO_MULTIPLE_OPTIONS(object)); switch (prop_id) { case PROP_ROUND_TO_MULTIPLE_OPTIONS_MULTIPLE: @@ -3780,8 +3633,7 @@ garrow_round_to_multiple_options_set_property(GObject *object, } break; case PROP_ROUND_TO_MULTIPLE_OPTIONS_MODE: - options->round_mode = - static_cast(g_value_get_enum(value)); + options->round_mode = static_cast(g_value_get_enum(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -3797,8 +3649,7 @@ garrow_round_to_multiple_options_get_property(GObject *object, { auto priv = GARROW_ROUND_TO_MULTIPLE_OPTIONS_GET_PRIVATE(object); auto options = - garrow_round_to_multiple_options_get_raw( - GARROW_ROUND_TO_MULTIPLE_OPTIONS(object)); + garrow_round_to_multiple_options_get_raw(GARROW_ROUND_TO_MULTIPLE_OPTIONS(object)); switch (prop_id) { case PROP_ROUND_TO_MULTIPLE_OPTIONS_MULTIPLE: @@ -3825,15 +3676,13 @@ garrow_round_to_multiple_options_init(GArrowRoundToMultipleOptions *object) } static void -garrow_round_to_multiple_options_class_init( - GArrowRoundToMultipleOptionsClass *klass) +garrow_round_to_multiple_options_class_init(GArrowRoundToMultipleOptionsClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); gobject_class->dispose = garrow_round_to_multiple_options_dispose; gobject_class->set_property = garrow_round_to_multiple_options_set_property; gobject_class->get_property = garrow_round_to_multiple_options_get_property; - arrow::compute::RoundToMultipleOptions options; GParamSpec *spec; @@ -3890,7 +3739,6 @@ garrow_round_to_multiple_options_new(void) g_object_new(GARROW_TYPE_ROUND_TO_MULTIPLE_OPTIONS, NULL)); } - enum { PROP_MATCH_SUBSTRING_OPTIONS_PATTERN = 1, PROP_MATCH_SUBSTRING_OPTIONS_IGNORE_CASE, @@ -3907,8 +3755,7 @@ garrow_match_substring_options_set_property(GObject *object, GParamSpec *pspec) { auto options = - garrow_match_substring_options_get_raw( - GARROW_MATCH_SUBSTRING_OPTIONS(object)); + garrow_match_substring_options_get_raw(GARROW_MATCH_SUBSTRING_OPTIONS(object)); switch (prop_id) { case PROP_MATCH_SUBSTRING_OPTIONS_PATTERN: @@ -3930,8 +3777,7 @@ garrow_match_substring_options_get_property(GObject *object, GParamSpec *pspec) { auto options = - garrow_match_substring_options_get_raw( - GARROW_MATCH_SUBSTRING_OPTIONS(object)); + garrow_match_substring_options_get_raw(GARROW_MATCH_SUBSTRING_OPTIONS(object)); switch (prop_id) { case PROP_MATCH_SUBSTRING_OPTIONS_PATTERN: @@ -3950,20 +3796,17 @@ static void garrow_match_substring_options_init(GArrowMatchSubstringOptions *object) { auto function_options_priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object); - function_options_priv->options = - static_cast( - new arrow::compute::MatchSubstringOptions()); + function_options_priv->options = static_cast( + new arrow::compute::MatchSubstringOptions()); } static void -garrow_match_substring_options_class_init( - GArrowMatchSubstringOptionsClass *klass) +garrow_match_substring_options_class_init(GArrowMatchSubstringOptionsClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); gobject_class->set_property = garrow_match_substring_options_set_property; gobject_class->get_property = garrow_match_substring_options_get_property; - arrow::compute::MatchSubstringOptions options; GParamSpec *spec; @@ -4015,7 +3858,6 @@ garrow_match_substring_options_new(void) g_object_new(GARROW_TYPE_MATCH_SUBSTRING_OPTIONS, NULL)); } - enum { PROP_UTF8_NORMALIZE_OPTIONS_FORM = 1, }; @@ -4024,9 +3866,9 @@ G_DEFINE_TYPE(GArrowUTF8NormalizeOptions, garrow_utf8_normalize_options, GARROW_TYPE_FUNCTION_OPTIONS) -#define GARROW_UTF8_NORMARIZE_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_utf8_normalize_options_get_instance_private( \ +#define GARROW_UTF8_NORMARIZE_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_utf8_normalize_options_get_instance_private( \ GARROW_UTF8_NORMALIZE_OPTIONS(object))) static void @@ -4035,14 +3877,13 @@ garrow_utf8_normalize_options_set_property(GObject *object, const GValue *value, GParamSpec *pspec) { - auto options = garrow_utf8_normalize_options_get_raw( - GARROW_UTF8_NORMALIZE_OPTIONS(object)); + auto options = + garrow_utf8_normalize_options_get_raw(GARROW_UTF8_NORMALIZE_OPTIONS(object)); switch (prop_id) { case PROP_UTF8_NORMALIZE_OPTIONS_FORM: options->form = - static_cast( - g_value_get_enum(value)); + static_cast(g_value_get_enum(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -4056,8 +3897,8 @@ garrow_utf8_normalize_options_get_property(GObject *object, GValue *value, GParamSpec *pspec) { - auto options = garrow_utf8_normalize_options_get_raw( - GARROW_UTF8_NORMALIZE_OPTIONS(object)); + auto options = + garrow_utf8_normalize_options_get_raw(GARROW_UTF8_NORMALIZE_OPTIONS(object)); switch (prop_id) { case PROP_UTF8_NORMALIZE_OPTIONS_FORM: @@ -4085,7 +3926,6 @@ garrow_utf8_normalize_options_class_init(GArrowUTF8NormalizeOptionsClass *klass) gobject_class->set_property = garrow_utf8_normalize_options_set_property; gobject_class->get_property = garrow_utf8_normalize_options_get_property; - arrow::compute::Utf8NormalizeOptions options; GParamSpec *spec; @@ -4102,9 +3942,7 @@ garrow_utf8_normalize_options_class_init(GArrowUTF8NormalizeOptionsClass *klass) GARROW_TYPE_UTF8_NORMALIZE_FORM, static_cast(options.form), static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_UTF8_NORMALIZE_OPTIONS_FORM, - spec); + g_object_class_install_property(gobject_class, PROP_UTF8_NORMALIZE_OPTIONS_FORM, spec); } /** @@ -4121,7 +3959,6 @@ garrow_utf8_normalize_options_new(void) g_object_new(GARROW_TYPE_UTF8_NORMALIZE_OPTIONS, NULL)); } - enum { PROP_QUANTILE_OPTIONS_INTERPOLATION = 1, PROP_QUANTILE_OPTIONS_SKIP_NULLS, @@ -4138,15 +3975,12 @@ garrow_quantile_options_set_property(GObject *object, const GValue *value, GParamSpec *pspec) { - auto options = - garrow_quantile_options_get_raw( - GARROW_QUANTILE_OPTIONS(object)); + auto options = garrow_quantile_options_get_raw(GARROW_QUANTILE_OPTIONS(object)); switch (prop_id) { case PROP_QUANTILE_OPTIONS_INTERPOLATION: - options->interpolation = - static_cast( - g_value_get_enum(value)); + options->interpolation = static_cast( + g_value_get_enum(value)); break; case PROP_QUANTILE_OPTIONS_SKIP_NULLS: options->skip_nulls = g_value_get_boolean(value); @@ -4166,14 +4000,12 @@ garrow_quantile_options_get_property(GObject *object, GValue *value, GParamSpec *pspec) { - auto options = garrow_quantile_options_get_raw( - GARROW_QUANTILE_OPTIONS(object)); + auto options = garrow_quantile_options_get_raw(GARROW_QUANTILE_OPTIONS(object)); switch (prop_id) { case PROP_QUANTILE_OPTIONS_INTERPOLATION: - g_value_set_enum( - value, - static_cast(options->interpolation)); + g_value_set_enum(value, + static_cast(options->interpolation)); break; case PROP_QUANTILE_OPTIONS_SKIP_NULLS: g_value_set_boolean(value, options->skip_nulls); @@ -4191,8 +4023,8 @@ static void garrow_quantile_options_init(GArrowQuantileOptions *object) { auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object); - priv->options = static_cast( - new arrow::compute::QuantileOptions()); + priv->options = + static_cast(new arrow::compute::QuantileOptions()); } static void @@ -4203,7 +4035,6 @@ garrow_quantile_options_class_init(GArrowQuantileOptionsClass *klass) gobject_class->set_property = garrow_quantile_options_set_property; gobject_class->get_property = garrow_quantile_options_get_property; - auto options = arrow::compute::QuantileOptions::Defaults(); GParamSpec *spec; @@ -4215,14 +4046,14 @@ garrow_quantile_options_class_init(GArrowQuantileOptionsClass *klass) * * Since: 9.0.0 */ - spec = g_param_spec_enum("interpolation", - "Interpolation", - "Interpolation method to use when " - "quantile lies between two data points.", - GARROW_TYPE_QUANTILE_INTERPOLATION, - static_cast( - options.interpolation), - static_cast(G_PARAM_READWRITE)); + spec = + g_param_spec_enum("interpolation", + "Interpolation", + "Interpolation method to use when " + "quantile lies between two data points.", + GARROW_TYPE_QUANTILE_INTERPOLATION, + static_cast(options.interpolation), + static_cast(G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_QUANTILE_OPTIONS_INTERPOLATION, spec); @@ -4243,9 +4074,7 @@ garrow_quantile_options_class_init(GArrowQuantileOptionsClass *klass) "emit null.", options.skip_nulls, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_QUANTILE_OPTIONS_SKIP_NULLS, - spec); + g_object_class_install_property(gobject_class, PROP_QUANTILE_OPTIONS_SKIP_NULLS, spec); /** * GArrowQuantileOptions:min-count: @@ -4262,9 +4091,7 @@ garrow_quantile_options_class_init(GArrowQuantileOptionsClass *klass) G_MAXUINT32, options.min_count, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_QUANTILE_OPTIONS_MIN_COUNT, - spec); + g_object_class_install_property(gobject_class, PROP_QUANTILE_OPTIONS_MIN_COUNT, spec); } /** @@ -4277,8 +4104,7 @@ garrow_quantile_options_class_init(GArrowQuantileOptionsClass *klass) GArrowQuantileOptions * garrow_quantile_options_new(void) { - return GARROW_QUANTILE_OPTIONS( - g_object_new(GARROW_TYPE_QUANTILE_OPTIONS, NULL)); + return GARROW_QUANTILE_OPTIONS(g_object_new(GARROW_TYPE_QUANTILE_OPTIONS, NULL)); } /** @@ -4308,8 +4134,7 @@ garrow_quantile_options_get_qs(GArrowQuantileOptions *options, gsize *n) * Since: 9.0.0 */ void -garrow_quantile_options_set_q(GArrowQuantileOptions *options, - gdouble q) +garrow_quantile_options_set_q(GArrowQuantileOptions *options, gdouble q) { auto priv = garrow_quantile_options_get_raw(options); priv->q.clear(); @@ -4325,9 +4150,7 @@ garrow_quantile_options_set_q(GArrowQuantileOptions *options, * Since: 9.0.0 */ void -garrow_quantile_options_set_qs(GArrowQuantileOptions *options, - const gdouble *qs, - gsize n) +garrow_quantile_options_set_qs(GArrowQuantileOptions *options, const gdouble *qs, gsize n) { auto priv = garrow_quantile_options_get_raw(options); priv->q.clear(); @@ -4336,8 +4159,8 @@ garrow_quantile_options_set_qs(GArrowQuantileOptions *options, } } - -struct GArrowIndexOptionsPrivate { +struct GArrowIndexOptionsPrivate +{ GArrowScalar *value; }; @@ -4349,10 +4172,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowIndexOptions, garrow_index_options, GARROW_TYPE_FUNCTION_OPTIONS) -#define GARROW_INDEX_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_index_options_get_instance_private( \ - GARROW_INDEX_OPTIONS(object))) +#define GARROW_INDEX_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_index_options_get_instance_private(GARROW_INDEX_OPTIONS(object))) static void garrow_index_options_dispose(GObject *object) @@ -4378,23 +4200,23 @@ garrow_index_options_set_property(GObject *object, switch (prop_id) { case PROP_INDEX_OPTIONS_VALUE: - { - auto scalar = GARROW_SCALAR(g_value_get_object(value)); - if (priv->value == scalar) { - return; - } - if (priv->value) { - g_object_unref(priv->value); - } - priv->value = scalar; - if (priv->value) { - g_object_ref(priv->value); - options->value = garrow_scalar_get_raw(scalar); - } else { - options->value = nullptr; + { + auto scalar = GARROW_SCALAR(g_value_get_object(value)); + if (priv->value == scalar) { + return; + } + if (priv->value) { + g_object_unref(priv->value); + } + priv->value = scalar; + if (priv->value) { + g_object_ref(priv->value); + options->value = garrow_scalar_get_raw(scalar); + } else { + options->value = nullptr; + } + break; } - break; - } default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -4439,7 +4261,6 @@ garrow_index_options_class_init(GArrowIndexOptionsClass *klass) gobject_class->set_property = garrow_index_options_set_property; gobject_class->get_property = garrow_index_options_get_property; - GParamSpec *spec; /** * GArrowIndexOptions:value: @@ -4466,24 +4287,19 @@ garrow_index_options_class_init(GArrowIndexOptionsClass *klass) GArrowIndexOptions * garrow_index_options_new(void) { - return GARROW_INDEX_OPTIONS(g_object_new(GARROW_TYPE_INDEX_OPTIONS, - NULL)); + return GARROW_INDEX_OPTIONS(g_object_new(GARROW_TYPE_INDEX_OPTIONS, NULL)); } - enum { PROP_RANK_OPTIONS_NULL_PLACEMENT = 1, PROP_RANK_OPTIONS_TIEBREAKER, }; -G_DEFINE_TYPE(GArrowRankOptions, - garrow_rank_options, - GARROW_TYPE_FUNCTION_OPTIONS) +G_DEFINE_TYPE(GArrowRankOptions, garrow_rank_options, GARROW_TYPE_FUNCTION_OPTIONS) -#define GARROW_RANK_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_rank_options_get_instance_private( \ - GARROW_RANK_OPTIONS(object))) +#define GARROW_RANK_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_rank_options_get_instance_private(GARROW_RANK_OPTIONS(object))) static void garrow_rank_options_set_property(GObject *object, @@ -4500,8 +4316,7 @@ garrow_rank_options_set_property(GObject *object, break; case PROP_RANK_OPTIONS_TIEBREAKER: options->tiebreaker = - static_cast( - g_value_get_enum(value)); + static_cast(g_value_get_enum(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -4519,14 +4334,10 @@ garrow_rank_options_get_property(GObject *object, switch (prop_id) { case PROP_RANK_OPTIONS_NULL_PLACEMENT: - g_value_set_enum( - value, - static_cast(options->null_placement)); + g_value_set_enum(value, static_cast(options->null_placement)); break; case PROP_RANK_OPTIONS_TIEBREAKER: - g_value_set_enum( - value, - static_cast(options->tiebreaker)); + g_value_set_enum(value, static_cast(options->tiebreaker)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -4538,8 +4349,8 @@ static void garrow_rank_options_init(GArrowRankOptions *object) { auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object); - priv->options = static_cast( - new arrow::compute::RankOptions()); + priv->options = + static_cast(new arrow::compute::RankOptions()); } static void @@ -4550,7 +4361,6 @@ garrow_rank_options_class_init(GArrowRankOptionsClass *klass) gobject_class->set_property = garrow_rank_options_set_property; gobject_class->get_property = garrow_rank_options_get_property; - auto options = arrow::compute::RankOptions::Defaults(); GParamSpec *spec; @@ -4566,12 +4376,9 @@ garrow_rank_options_class_init(GArrowRankOptionsClass *klass) "Whether nulls and NaNs are placed " "at the start or at the end.", GARROW_TYPE_NULL_PLACEMENT, - static_cast( - options.null_placement), + static_cast(options.null_placement), static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_RANK_OPTIONS_NULL_PLACEMENT, - spec); + g_object_class_install_property(gobject_class, PROP_RANK_OPTIONS_NULL_PLACEMENT, spec); /** * GArrowRankOptions:tiebreaker: @@ -4584,12 +4391,9 @@ garrow_rank_options_class_init(GArrowRankOptionsClass *klass) "Tiebreaker", "Tiebreaker for dealing with equal values in ranks.", GARROW_TYPE_RANK_TIEBREAKER, - static_cast( - options.tiebreaker), + static_cast(options.tiebreaker), static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_RANK_OPTIONS_TIEBREAKER, - spec); + g_object_class_install_property(gobject_class, PROP_RANK_OPTIONS_TIEBREAKER, spec); } /** @@ -4616,8 +4420,7 @@ garrow_rank_options_new(void) * Since: 12.0.0 */ gboolean -garrow_rank_options_equal(GArrowRankOptions *options, - GArrowRankOptions *other_options) +garrow_rank_options_equal(GArrowRankOptions *options, GArrowRankOptions *other_options) { auto arrow_options = garrow_rank_options_get_raw(options); auto arrow_other_options = garrow_rank_options_get_raw(other_options); @@ -4660,8 +4463,7 @@ garrow_rank_options_get_sort_keys(GArrowRankOptions *options) * Since: 12.0.0 */ void -garrow_rank_options_set_sort_keys(GArrowRankOptions *options, - GList *sort_keys) +garrow_rank_options_set_sort_keys(GArrowRankOptions *options, GList *sort_keys) { auto arrow_options = garrow_rank_options_get_raw(options); garrow_raw_sort_keys_set(arrow_options->sort_keys, sort_keys); @@ -4677,14 +4479,12 @@ garrow_rank_options_set_sort_keys(GArrowRankOptions *options, * Since: 12.0.0 */ void -garrow_rank_options_add_sort_key(GArrowRankOptions *options, - GArrowSortKey *sort_key) +garrow_rank_options_add_sort_key(GArrowRankOptions *options, GArrowSortKey *sort_key) { auto arrow_options = garrow_rank_options_get_raw(options); garrow_raw_sort_keys_add(arrow_options->sort_keys, sort_key); } - /** * garrow_array_cast: * @array: A #GArrowArray. @@ -4709,24 +4509,20 @@ garrow_array_cast(GArrowArray *array, arrow::Result> arrow_casted_array; if (options) { auto arrow_options = garrow_cast_options_get_raw(options); - arrow_casted_array = arrow::compute::Cast(*arrow_array_raw, - arrow_target_data_type, - *arrow_options); + arrow_casted_array = + arrow::compute::Cast(*arrow_array_raw, arrow_target_data_type, *arrow_options); } else { - arrow_casted_array = arrow::compute::Cast(*arrow_array_raw, - arrow_target_data_type); - } - if (garrow::check(error, - arrow_casted_array, - [&]() { - std::stringstream message; - message << "[array][cast] <"; - message << arrow_array->type()->ToString(); - message << "> -> <"; - message << arrow_target_data_type->ToString(); - message << ">"; - return message.str(); - })) { + arrow_casted_array = arrow::compute::Cast(*arrow_array_raw, arrow_target_data_type); + } + if (garrow::check(error, arrow_casted_array, [&]() { + std::stringstream message; + message << "[array][cast] <"; + message << arrow_array->type()->ToString(); + message << "> -> <"; + message << arrow_target_data_type->ToString(); + message << ">"; + return message.str(); + })) { return garrow_array_new_raw(&(*arrow_casted_array)); } else { return NULL; @@ -4744,20 +4540,17 @@ garrow_array_cast(GArrowArray *array, * Since: 0.8.0 */ GArrowArray * -garrow_array_unique(GArrowArray *array, - GError **error) +garrow_array_unique(GArrowArray *array, GError **error) { auto arrow_array = garrow_array_get_raw(array); auto arrow_unique_array = arrow::compute::Unique(arrow_array); - if (garrow::check(error, - arrow_unique_array, - [&]() { - std::stringstream message; - message << "[array][unique] <"; - message << arrow_array->type()->ToString(); - message << ">"; - return message.str(); - })) { + if (garrow::check(error, arrow_unique_array, [&]() { + std::stringstream message; + message << "[array][unique] <"; + message << arrow_array->type()->ToString(); + message << ">"; + return message.str(); + })) { return garrow_array_new_raw(&(*arrow_unique_array)); } else { return NULL; @@ -4776,25 +4569,19 @@ garrow_array_unique(GArrowArray *array, * Since: 0.8.0 */ GArrowDictionaryArray * -garrow_array_dictionary_encode(GArrowArray *array, - GError **error) +garrow_array_dictionary_encode(GArrowArray *array, GError **error) { auto arrow_array = garrow_array_get_raw(array); - auto arrow_dictionary_encoded_datum = - arrow::compute::DictionaryEncode(arrow_array); - if (garrow::check(error, - arrow_dictionary_encoded_datum, - [&]() { - std::stringstream message; - message << "[array][dictionary-encode] <"; - message << arrow_array->type()->ToString(); - message << ">"; - return message.str(); - })) { - auto arrow_dictionary_encoded_array = - (*arrow_dictionary_encoded_datum).make_array(); - auto dictionary_encoded_array = - garrow_array_new_raw(&arrow_dictionary_encoded_array); + auto arrow_dictionary_encoded_datum = arrow::compute::DictionaryEncode(arrow_array); + if (garrow::check(error, arrow_dictionary_encoded_datum, [&]() { + std::stringstream message; + message << "[array][dictionary-encode] <"; + message << arrow_array->type()->ToString(); + message << ">"; + return message.str(); + })) { + auto arrow_dictionary_encoded_array = (*arrow_dictionary_encoded_datum).make_array(); + auto dictionary_encoded_array = garrow_array_new_raw(&arrow_dictionary_encoded_array); return GARROW_DICTIONARY_ARRAY(dictionary_encoded_array); } else { return NULL; @@ -4813,17 +4600,14 @@ garrow_array_dictionary_encode(GArrowArray *array, * Since: 0.13.0 */ gint64 -garrow_array_count(GArrowArray *array, - GArrowCountOptions *options, - GError **error) +garrow_array_count(GArrowArray *array, GArrowCountOptions *options, GError **error) { auto arrow_array = garrow_array_get_raw(array); auto arrow_array_raw = arrow_array.get(); arrow::Result arrow_counted_datum; if (options) { auto arrow_options = garrow_count_options_get_raw(options); - arrow_counted_datum = - arrow::compute::Count(*arrow_array_raw, *arrow_options); + arrow_counted_datum = arrow::compute::Count(*arrow_array_raw, *arrow_options); } else { arrow_counted_datum = arrow::compute::Count(*arrow_array_raw); } @@ -4849,8 +4633,7 @@ garrow_array_count(GArrowArray *array, * Since: 0.13.0 */ GArrowStructArray * -garrow_array_count_values(GArrowArray *array, - GError **error) +garrow_array_count_values(GArrowArray *array, GError **error) { auto arrow_array = garrow_array_get_raw(array); auto arrow_counted_values = arrow::compute::ValueCounts(arrow_array); @@ -4862,7 +4645,6 @@ garrow_array_count_values(GArrowArray *array, } } - /** * garrow_boolean_array_invert: * @array: A #GArrowBooleanArray. @@ -4875,8 +4657,7 @@ garrow_array_count_values(GArrowArray *array, * Since: 0.13.0 */ GArrowBooleanArray * -garrow_boolean_array_invert(GArrowBooleanArray *array, - GError **error) +garrow_boolean_array_invert(GArrowBooleanArray *array, GError **error) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); auto arrow_inverted_datum = arrow::compute::Invert(arrow_array); @@ -4972,7 +4753,6 @@ garrow_boolean_array_xor(GArrowBooleanArray *left, } } - /** * garrow_numeric_array_mean: * @array: A #GArrowNumericArray. @@ -4983,8 +4763,7 @@ garrow_boolean_array_xor(GArrowBooleanArray *left, * Since: 0.13.0 */ gdouble -garrow_numeric_array_mean(GArrowNumericArray *array, - GError **error) +garrow_numeric_array_mean(GArrowNumericArray *array, GError **error) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); auto arrow_mean_datum = arrow::compute::Mean(arrow_array); @@ -5002,7 +4781,6 @@ garrow_numeric_array_mean(GArrowNumericArray *array, } } - /** * garrow_int8_array_sum: * @array: A #GArrowInt8Array. @@ -5014,13 +4792,9 @@ garrow_numeric_array_mean(GArrowNumericArray *array, * Since: 0.13.0 */ gint64 -garrow_int8_array_sum(GArrowInt8Array *array, - GError **error) +garrow_int8_array_sum(GArrowInt8Array *array, GError **error) { - return garrow_numeric_array_sum(array, - error, - "[int8-array][sum]", - 0); + return garrow_numeric_array_sum(array, error, "[int8-array][sum]", 0); } /** @@ -5034,8 +4808,7 @@ garrow_int8_array_sum(GArrowInt8Array *array, * Since: 0.13.0 */ guint64 -garrow_uint8_array_sum(GArrowUInt8Array *array, - GError **error) +garrow_uint8_array_sum(GArrowUInt8Array *array, GError **error) { return garrow_numeric_array_sum(array, error, @@ -5054,8 +4827,7 @@ garrow_uint8_array_sum(GArrowUInt8Array *array, * Since: 0.13.0 */ gint64 -garrow_int16_array_sum(GArrowInt16Array *array, - GError **error) +garrow_int16_array_sum(GArrowInt16Array *array, GError **error) { return garrow_numeric_array_sum(array, error, @@ -5074,8 +4846,7 @@ garrow_int16_array_sum(GArrowInt16Array *array, * Since: 0.13.0 */ guint64 -garrow_uint16_array_sum(GArrowUInt16Array *array, - GError **error) +garrow_uint16_array_sum(GArrowUInt16Array *array, GError **error) { return garrow_numeric_array_sum(array, error, @@ -5094,8 +4865,7 @@ garrow_uint16_array_sum(GArrowUInt16Array *array, * Since: 0.13.0 */ gint64 -garrow_int32_array_sum(GArrowInt32Array *array, - GError **error) +garrow_int32_array_sum(GArrowInt32Array *array, GError **error) { return garrow_numeric_array_sum(array, error, @@ -5114,13 +4884,12 @@ garrow_int32_array_sum(GArrowInt32Array *array, * Since: 0.13.0 */ guint64 -garrow_uint32_array_sum(GArrowUInt32Array *array, - GError **error) +garrow_uint32_array_sum(GArrowUInt32Array *array, GError **error) { return garrow_numeric_array_sum(array, - error, - "[uint32-array][sum]", - 0); + error, + "[uint32-array][sum]", + 0); } /** @@ -5134,8 +4903,7 @@ garrow_uint32_array_sum(GArrowUInt32Array *array, * Since: 0.13.0 */ gint64 -garrow_int64_array_sum(GArrowInt64Array *array, - GError **error) +garrow_int64_array_sum(GArrowInt64Array *array, GError **error) { return garrow_numeric_array_sum(array, error, @@ -5154,13 +4922,12 @@ garrow_int64_array_sum(GArrowInt64Array *array, * Since: 0.13.0 */ guint64 -garrow_uint64_array_sum(GArrowUInt64Array *array, - GError **error) +garrow_uint64_array_sum(GArrowUInt64Array *array, GError **error) { return garrow_numeric_array_sum(array, - error, - "[uint64-array][sum]", - 0); + error, + "[uint64-array][sum]", + 0); } /** @@ -5174,8 +4941,7 @@ garrow_uint64_array_sum(GArrowUInt64Array *array, * Since: 0.13.0 */ gdouble -garrow_float_array_sum(GArrowFloatArray *array, - GError **error) +garrow_float_array_sum(GArrowFloatArray *array, GError **error) { return garrow_numeric_array_sum(array, error, @@ -5194,8 +4960,7 @@ garrow_float_array_sum(GArrowFloatArray *array, * Since: 0.13.0 */ gdouble -garrow_double_array_sum(GArrowDoubleArray *array, - GError **error) +garrow_double_array_sum(GArrowDoubleArray *array, GError **error) { return garrow_numeric_array_sum(array, error, @@ -5451,12 +5216,10 @@ garrow_array_filter(GArrowArray *array, arrow::Result arrow_filtered_datum; if (options) { auto arrow_options = garrow_filter_options_get_raw(options); - arrow_filtered_datum = arrow::compute::Filter(arrow_array, - arrow_filter, - *arrow_options); + arrow_filtered_datum = + arrow::compute::Filter(arrow_array, arrow_filter, *arrow_options); } else { - arrow_filtered_datum = arrow::compute::Filter(arrow_array, - arrow_filter); + arrow_filtered_datum = arrow::compute::Filter(arrow_array, arrow_filter); } if (garrow::check(error, arrow_filtered_datum, "[array][filter]")) { auto arrow_filtered_array = (*arrow_filtered_datum).make_array(); @@ -5479,9 +5242,7 @@ garrow_array_filter(GArrowArray *array, * Since: 0.15.0 */ GArrowBooleanArray * -garrow_array_is_in(GArrowArray *left, - GArrowArray *right, - GError **error) +garrow_array_is_in(GArrowArray *left, GArrowArray *right, GError **error) { auto arrow_left = garrow_array_get_raw(left); auto arrow_right = garrow_array_get_raw(right); @@ -5514,9 +5275,7 @@ garrow_array_is_in_chunked_array(GArrowArray *left, auto arrow_left = garrow_array_get_raw(left); auto arrow_right = garrow_chunked_array_get_raw(right); auto arrow_is_in_datum = arrow::compute::IsIn(arrow_left, arrow_right); - if (garrow::check(error, - arrow_is_in_datum, - "[array][is-in][chunked-array]")) { + if (garrow::check(error, arrow_is_in_datum, "[array][is-in][chunked-array]")) { auto arrow_is_in_array = (*arrow_is_in_datum).make_array(); return GARROW_BOOLEAN_ARRAY(garrow_array_new_raw(&arrow_is_in_array)); } else { @@ -5536,15 +5295,12 @@ garrow_array_is_in_chunked_array(GArrowArray *left, * Since: 3.0.0 */ GArrowUInt64Array * -garrow_array_sort_indices(GArrowArray *array, - GArrowSortOrder order, - GError **error) +garrow_array_sort_indices(GArrowArray *array, GArrowSortOrder order, GError **error) { auto arrow_array = garrow_array_get_raw(array); auto arrow_array_raw = arrow_array.get(); auto arrow_order = static_cast(order); - auto arrow_indices_array = - arrow::compute::SortIndices(*arrow_array_raw, arrow_order); + auto arrow_indices_array = arrow::compute::SortIndices(*arrow_array_raw, arrow_order); if (garrow::check(error, arrow_indices_array, "[array][sort-indices]")) { return GARROW_UINT64_ARRAY(garrow_array_new_raw(&(*arrow_indices_array))); } else { @@ -5565,8 +5321,7 @@ garrow_array_sort_indices(GArrowArray *array, * Deprecated: 3.0.0: Use garrow_array_sort_indices() instead. */ GArrowUInt64Array * -garrow_array_sort_to_indices(GArrowArray *array, - GError **error) +garrow_array_sort_to_indices(GArrowArray *array, GError **error) { return garrow_array_sort_indices(array, GARROW_SORT_ORDER_ASCENDING, error); } @@ -5592,9 +5347,7 @@ garrow_chunked_array_sort_indices(GArrowChunkedArray *chunked_array, auto arrow_order = static_cast(order); auto arrow_indices_array = arrow::compute::SortIndices(*arrow_chunked_array_raw, arrow_order); - if (garrow::check(error, - arrow_indices_array, - "[chunked-array][sort-indices]")) { + if (garrow::check(error, arrow_indices_array, "[chunked-array][sort-indices]")) { return GARROW_UINT64_ARRAY(garrow_array_new_raw(&(*arrow_indices_array))); } else { return NULL; @@ -5621,11 +5374,8 @@ garrow_record_batch_sort_indices(GArrowRecordBatch *record_batch, auto arrow_record_batch_raw = arrow_record_batch.get(); auto arrow_options = garrow_sort_options_get_raw(options); auto arrow_indices_array = - arrow::compute::SortIndices(::arrow::Datum(*arrow_record_batch_raw), - *arrow_options); - if (garrow::check(error, - arrow_indices_array, - "[record-batch][sort-indices]")) { + arrow::compute::SortIndices(::arrow::Datum(*arrow_record_batch_raw), *arrow_options); + if (garrow::check(error, arrow_indices_array, "[record-batch][sort-indices]")) { return GARROW_UINT64_ARRAY(garrow_array_new_raw(&(*arrow_indices_array))); } else { return NULL; @@ -5644,19 +5394,14 @@ garrow_record_batch_sort_indices(GArrowRecordBatch *record_batch, * Since: 3.0.0 */ GArrowUInt64Array * -garrow_table_sort_indices(GArrowTable *table, - GArrowSortOptions *options, - GError **error) +garrow_table_sort_indices(GArrowTable *table, GArrowSortOptions *options, GError **error) { auto arrow_table = garrow_table_get_raw(table); auto arrow_table_raw = arrow_table.get(); auto arrow_options = garrow_sort_options_get_raw(options); auto arrow_indices_array = - arrow::compute::SortIndices(::arrow::Datum(*arrow_table_raw), - *arrow_options); - if (garrow::check(error, - arrow_indices_array, - "[table][sort-indices]")) { + arrow::compute::SortIndices(::arrow::Datum(*arrow_table_raw), *arrow_options); + if (garrow::check(error, arrow_indices_array, "[table][sort-indices]")) { return GARROW_UINT64_ARRAY(garrow_array_new_raw(&(*arrow_indices_array))); } else { return NULL; @@ -5687,12 +5432,10 @@ garrow_table_filter(GArrowTable *table, arrow::Result arrow_filtered_datum; if (options) { auto arrow_options = garrow_filter_options_get_raw(options); - arrow_filtered_datum = arrow::compute::Filter(arrow_table, - arrow_filter, - *arrow_options); + arrow_filtered_datum = + arrow::compute::Filter(arrow_table, arrow_filter, *arrow_options); } else { - arrow_filtered_datum = arrow::compute::Filter(arrow_table, - arrow_filter); + arrow_filtered_datum = arrow::compute::Filter(arrow_table, arrow_filter); } if (garrow::check(error, arrow_filtered_datum, "[table][filter]")) { auto arrow_filtered_table = (*arrow_filtered_datum).table(); @@ -5726,16 +5469,12 @@ garrow_table_filter_chunked_array(GArrowTable *table, arrow::Result arrow_filtered_datum; if (options) { auto arrow_options = garrow_filter_options_get_raw(options); - arrow_filtered_datum = arrow::compute::Filter(arrow_table, - arrow_filter, - *arrow_options); + arrow_filtered_datum = + arrow::compute::Filter(arrow_table, arrow_filter, *arrow_options); } else { - arrow_filtered_datum = arrow::compute::Filter(arrow_table, - arrow_filter); + arrow_filtered_datum = arrow::compute::Filter(arrow_table, arrow_filter); } - if (garrow::check(error, - arrow_filtered_datum, - "[table][filter][chunked-array]")) { + if (garrow::check(error, arrow_filtered_datum, "[table][filter][chunked-array]")) { auto arrow_filtered_table = (*arrow_filtered_datum).table(); return garrow_table_new_raw(&arrow_filtered_table); } else { @@ -5767,12 +5506,10 @@ garrow_chunked_array_filter(GArrowChunkedArray *chunked_array, arrow::Result arrow_filtered_datum; if (options) { auto arrow_options = garrow_filter_options_get_raw(options); - arrow_filtered_datum = arrow::compute::Filter(arrow_chunked_array, - arrow_filter, - *arrow_options); + arrow_filtered_datum = + arrow::compute::Filter(arrow_chunked_array, arrow_filter, *arrow_options); } else { - arrow_filtered_datum = arrow::compute::Filter(arrow_chunked_array, - arrow_filter); + arrow_filtered_datum = arrow::compute::Filter(arrow_chunked_array, arrow_filter); } if (garrow::check(error, arrow_filtered_datum, "[chunked-array][filter]")) { auto arrow_filtered_chunked_array = (*arrow_filtered_datum).chunked_array(); @@ -5806,12 +5543,10 @@ garrow_chunked_array_filter_chunked_array(GArrowChunkedArray *chunked_array, arrow::Result arrow_filtered_datum; if (options) { auto arrow_options = garrow_filter_options_get_raw(options); - arrow_filtered_datum = arrow::compute::Filter(arrow_chunked_array, - arrow_filter, - *arrow_options); + arrow_filtered_datum = + arrow::compute::Filter(arrow_chunked_array, arrow_filter, *arrow_options); } else { - arrow_filtered_datum = arrow::compute::Filter(arrow_chunked_array, - arrow_filter); + arrow_filtered_datum = arrow::compute::Filter(arrow_chunked_array, arrow_filter); } if (garrow::check(error, arrow_filtered_datum, @@ -5847,12 +5582,10 @@ garrow_record_batch_filter(GArrowRecordBatch *record_batch, arrow::Result arrow_filtered_datum; if (options) { auto arrow_options = garrow_filter_options_get_raw(options); - arrow_filtered_datum = arrow::compute::Filter(arrow_record_batch, - arrow_filter, - *arrow_options); + arrow_filtered_datum = + arrow::compute::Filter(arrow_record_batch, arrow_filter, *arrow_options); } else { - arrow_filtered_datum = arrow::compute::Filter(arrow_record_batch, - arrow_filter); + arrow_filtered_datum = arrow::compute::Filter(arrow_record_batch, arrow_filter); } if (garrow::check(error, arrow_filtered_datum, "[record-batch][filter]")) { auto arrow_filtered_record_batch = (*arrow_filtered_datum).record_batch(); @@ -5862,7 +5595,8 @@ garrow_record_batch_filter(GArrowRecordBatch *record_batch, } } -struct GArrowRunEndEncodeOptionsPrivate { +struct GArrowRunEndEncodeOptionsPrivate +{ GArrowDataType *run_end_data_type; }; @@ -5874,9 +5608,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowRunEndEncodeOptions, garrow_run_end_encode_options, GARROW_TYPE_FUNCTION_OPTIONS) -#define GARROW_RUN_END_ENCODE_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_run_end_encode_options_get_instance_private( \ +#define GARROW_RUN_END_ENCODE_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_run_end_encode_options_get_instance_private( \ GARROW_RUN_END_ENCODE_OPTIONS(object))) static void @@ -5959,7 +5693,6 @@ garrow_run_end_encode_options_class_init(GArrowRunEndEncodeOptionsClass *klass) gobject_class->set_property = garrow_run_end_encode_options_set_property; gobject_class->get_property = garrow_run_end_encode_options_get_property; - GParamSpec *spec; /** * GArrowRunEndEncodeOptions:run-end-data-type: @@ -5996,7 +5729,8 @@ garrow_run_end_encode_options_new(GArrowDataType *run_end_data_type) need_run_end_data_type_unref = true; } auto options = g_object_new(GARROW_TYPE_RUN_END_ENCODE_OPTIONS, - "run-end-data-type", run_end_data_type, + "run-end-data-type", + run_end_data_type, NULL); if (need_run_end_data_type_unref) { g_object_unref(run_end_data_type); @@ -6028,22 +5762,17 @@ garrow_array_run_end_encode(GArrowArray *array, arrow_run_end_encoded_datum_result = arrow::compute::RunEndEncode(arrow_array, *arrow_options); } else { - arrow_run_end_encoded_datum_result = - arrow::compute::RunEndEncode(arrow_array); - } - if (garrow::check(error, - arrow_run_end_encoded_datum_result, - [&]() { - std::stringstream message; - message << "[array][run-end-encode] <"; - message << arrow_array->type()->ToString(); - message << ">"; - return message.str(); - })) { - auto arrow_run_end_encoded_array = - (*arrow_run_end_encoded_datum_result).make_array(); - auto run_end_encoded_array = - garrow_array_new_raw(&arrow_run_end_encoded_array); + arrow_run_end_encoded_datum_result = arrow::compute::RunEndEncode(arrow_array); + } + if (garrow::check(error, arrow_run_end_encoded_datum_result, [&]() { + std::stringstream message; + message << "[array][run-end-encode] <"; + message << arrow_array->type()->ToString(); + message << ">"; + return message.str(); + })) { + auto arrow_run_end_encoded_array = (*arrow_run_end_encoded_datum_result).make_array(); + auto run_end_encoded_array = garrow_array_new_raw(&arrow_run_end_encoded_array); return GARROW_RUN_END_ENCODED_ARRAY(run_end_encoded_array); } else { return nullptr; @@ -6062,21 +5791,17 @@ garrow_array_run_end_encode(GArrowArray *array, * Since: 13.0.0 */ GArrowArray * -garrow_run_end_encoded_array_decode(GArrowRunEndEncodedArray *array, - GError **error) +garrow_run_end_encoded_array_decode(GArrowRunEndEncodedArray *array, GError **error) { auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); - auto arrow_decoded_datum_result = - arrow::compute::RunEndDecode(arrow_array); - if (garrow::check(error, - arrow_decoded_datum_result, - [&]() { - std::stringstream message; - message << "[run-end-encoded-array][decode] <"; - message << arrow_array->type()->ToString(); - message << ">"; - return message.str(); - })) { + auto arrow_decoded_datum_result = arrow::compute::RunEndDecode(arrow_array); + if (garrow::check(error, arrow_decoded_datum_result, [&]() { + std::stringstream message; + message << "[run-end-encoded-array][decode] <"; + message << arrow_array->type()->ToString(); + message << ">"; + return message.str(); + })) { auto arrow_decoded_array = (*arrow_decoded_datum_result).make_array(); return garrow_array_new_raw(&arrow_decoded_array); } else { @@ -6100,16 +5825,15 @@ garrow_strptime_options_set_property(GObject *object, const GValue *value, GParamSpec *pspec) { - auto options = - garrow_strptime_options_get_raw(GARROW_STRPTIME_OPTIONS(object)); + auto options = garrow_strptime_options_get_raw(GARROW_STRPTIME_OPTIONS(object)); switch (prop_id) { case PROP_STRPTIME_OPTIONS_FORMAT: options->format = g_value_get_string(value); break; case PROP_STRPTIME_OPTIONS_UNIT: - options->unit = garrow_time_unit_to_raw( - static_cast(g_value_get_enum(value))); + options->unit = + garrow_time_unit_to_raw(static_cast(g_value_get_enum(value))); break; case PROP_STRPTIME_OPTIONS_ERROR_IS_NULL: options->error_is_null = g_value_get_boolean(value); @@ -6126,8 +5850,7 @@ garrow_strptime_options_get_property(GObject *object, GValue *value, GParamSpec *pspec) { - auto options = - garrow_strptime_options_get_raw(GARROW_STRPTIME_OPTIONS(object)); + auto options = garrow_strptime_options_get_raw(GARROW_STRPTIME_OPTIONS(object)); switch (prop_id) { case PROP_STRPTIME_OPTIONS_FORMAT: @@ -6149,8 +5872,8 @@ static void garrow_strptime_options_init(GArrowStrptimeOptions *object) { auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object); - priv->options = static_cast( - new arrow::compute::StrptimeOptions()); + priv->options = + static_cast(new arrow::compute::StrptimeOptions()); } static void @@ -6176,9 +5899,7 @@ garrow_strptime_options_class_init(GArrowStrptimeOptionsClass *klass) "The desired format string", options.format.c_str(), static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_STRPTIME_OPTIONS_FORMAT, - spec); + g_object_class_install_property(gobject_class, PROP_STRPTIME_OPTIONS_FORMAT, spec); /** * GArrowStrptimeOptions:unit: @@ -6193,9 +5914,7 @@ garrow_strptime_options_class_init(GArrowStrptimeOptionsClass *klass) GARROW_TYPE_TIME_UNIT, garrow_time_unit_from_raw(options.unit), static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_STRPTIME_OPTIONS_UNIT, - spec); + g_object_class_install_property(gobject_class, PROP_STRPTIME_OPTIONS_UNIT, spec); /** * GArrowStrptimeOptions:error-is-null: @@ -6243,8 +5962,7 @@ garrow_strftime_options_set_property(GObject *object, const GValue *value, GParamSpec *pspec) { - auto options = - garrow_strftime_options_get_raw(GARROW_STRFTIME_OPTIONS(object)); + auto options = garrow_strftime_options_get_raw(GARROW_STRFTIME_OPTIONS(object)); switch (prop_id) { case PROP_STRFTIME_OPTIONS_FORMAT: @@ -6265,8 +5983,7 @@ garrow_strftime_options_get_property(GObject *object, GValue *value, GParamSpec *pspec) { - auto options = - garrow_strftime_options_get_raw(GARROW_STRFTIME_OPTIONS(object)); + auto options = garrow_strftime_options_get_raw(GARROW_STRFTIME_OPTIONS(object)); switch (prop_id) { case PROP_STRFTIME_OPTIONS_FORMAT: @@ -6285,8 +6002,8 @@ static void garrow_strftime_options_init(GArrowStrftimeOptions *object) { auto priv = GARROW_FUNCTION_OPTIONS_GET_PRIVATE(object); - priv->options = static_cast( - new arrow::compute::StrftimeOptions()); + priv->options = + static_cast(new arrow::compute::StrftimeOptions()); } static void @@ -6312,9 +6029,7 @@ garrow_strftime_options_class_init(GArrowStrftimeOptionsClass *klass) "The desired format string", options.format.c_str(), static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_STRFTIME_OPTIONS_FORMAT, - spec); + g_object_class_install_property(gobject_class, PROP_STRFTIME_OPTIONS_FORMAT, spec); /** * GArrowStrftimeOptions:locale: @@ -6328,9 +6043,7 @@ garrow_strftime_options_class_init(GArrowStrftimeOptionsClass *klass) "The desired output locale string", options.locale.c_str(), static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_STRFTIME_OPTIONS_LOCALE, - spec); + g_object_class_install_property(gobject_class, PROP_STRFTIME_OPTIONS_LOCALE, spec); } /** @@ -6363,8 +6076,8 @@ garrow_split_pattern_options_set_property(GObject *object, const GValue *value, GParamSpec *pspec) { - auto options = garrow_split_pattern_options_get_raw( - GARROW_SPLIT_PATTERN_OPTIONS(object)); + auto options = + garrow_split_pattern_options_get_raw(GARROW_SPLIT_PATTERN_OPTIONS(object)); switch (prop_id) { case PROP_SPLIT_PATTERN_OPTIONS_PATTERN: @@ -6388,8 +6101,8 @@ garrow_split_pattern_options_get_property(GObject *object, GValue *value, GParamSpec *pspec) { - auto options = garrow_split_pattern_options_get_raw( - GARROW_SPLIT_PATTERN_OPTIONS(object)); + auto options = + garrow_split_pattern_options_get_raw(GARROW_SPLIT_PATTERN_OPTIONS(object)); switch (prop_id) { case PROP_SPLIT_PATTERN_OPTIONS_PATTERN: @@ -6468,11 +6181,12 @@ garrow_split_pattern_options_class_init(GArrowSplitPatternOptionsClass *klass) * * Since: 16.0.0 */ - spec = g_param_spec_boolean("reverse", - "Reverse", - "Start splitting from the end of the string (only relevant when max_splits != -1)", - options.reverse, - static_cast(G_PARAM_READWRITE)); + spec = g_param_spec_boolean( + "reverse", + "Reverse", + "Start splitting from the end of the string (only relevant when max_splits != -1)", + options.reverse, + static_cast(G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_SPLIT_PATTERN_OPTIONS_REVERSE, spec); @@ -6512,8 +6226,8 @@ garrow_struct_field_options_set_field_ref(GArrowStructFieldOptions *options, const gchar *field_ref, GError **error) { - auto arrow_options = garrow_struct_field_options_get_raw( - GARROW_STRUCT_FIELD_OPTIONS(options)); + auto arrow_options = + garrow_struct_field_options_get_raw(GARROW_STRUCT_FIELD_OPTIONS(options)); auto arrow_reference_result = garrow_field_reference_resolve_raw(field_ref); if (!garrow::check(error, @@ -6526,12 +6240,11 @@ garrow_struct_field_options_set_field_ref(GArrowStructFieldOptions *options, static void garrow_struct_field_options_get_property(GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) + guint prop_id, + GValue *value, + GParamSpec *pspec) { - auto options = garrow_struct_field_options_get_raw( - GARROW_STRUCT_FIELD_OPTIONS(object)); + auto options = garrow_struct_field_options_get_raw(GARROW_STRUCT_FIELD_OPTIONS(object)); switch (prop_id) { case PROP_STRUCT_FIELD_OPTIONS_FIELD_REF: @@ -6577,11 +6290,12 @@ garrow_struct_field_options_class_init(GArrowStructFieldOptionsClass *klass) * * Since: 16.0.0 */ - spec = g_param_spec_string("field_ref", - "Field ref", - "The name or dot path specifying what to extract from struct or union.", - "", - static_cast(G_PARAM_READABLE)); + spec = g_param_spec_string( + "field_ref", + "Field ref", + "The name or dot path specifying what to extract from struct or union.", + "", + static_cast(G_PARAM_READABLE)); g_object_class_install_property(gobject_class, PROP_STRUCT_FIELD_OPTIONS_FIELD_REF, spec); @@ -6603,7 +6317,6 @@ garrow_struct_field_options_new(void) G_END_DECLS - arrow::Result garrow_field_reference_resolve_raw(const gchar *reference) { @@ -6615,7 +6328,6 @@ garrow_field_reference_resolve_raw(const gchar *reference) } } - arrow::compute::ExecContext * garrow_execute_context_get_raw(GArrowExecuteContext *context) { @@ -6623,10 +6335,8 @@ garrow_execute_context_get_raw(GArrowExecuteContext *context) return &priv->context; } - GArrowFunctionOptions * -garrow_function_options_new_raw( - const arrow::compute::FunctionOptions *arrow_options) +garrow_function_options_new_raw(const arrow::compute::FunctionOptions *arrow_options) { std::string_view arrow_type_name(arrow_options->type_name()); if (arrow_type_name == "CastOptions") { @@ -6689,14 +6399,12 @@ garrow_function_options_new_raw( } else if (arrow_type_name == "MatchSubstringOptions") { const auto arrow_match_substring_options = static_cast(arrow_options); - auto options = - garrow_match_substring_options_new_raw(arrow_match_substring_options); + auto options = garrow_match_substring_options_new_raw(arrow_match_substring_options); return GARROW_FUNCTION_OPTIONS(options); } else if (arrow_type_name == "UTF8NormalizedOptions") { const auto arrow_utf8_normalize_options = static_cast(arrow_options); - auto options = garrow_utf8_normalize_options_new_raw( - arrow_utf8_normalize_options); + auto options = garrow_utf8_normalize_options_new_raw(arrow_utf8_normalize_options); return GARROW_FUNCTION_OPTIONS(options); } else if (arrow_type_name == "QuantileOptions") { const auto arrow_quantile_options = @@ -6716,8 +6424,7 @@ garrow_function_options_new_raw( } else if (arrow_type_name == "RunEndEncodeOptions") { const auto arrow_run_end_encode_options = static_cast(arrow_options); - auto options = - garrow_run_end_encode_options_new_raw(arrow_run_end_encode_options); + auto options = garrow_run_end_encode_options_new_raw(arrow_run_end_encode_options); return GARROW_FUNCTION_OPTIONS(options); } else if (arrow_type_name == "StrptimeOptions") { const auto arrow_strptime_options = @@ -6740,8 +6447,7 @@ garrow_function_options_new_raw( auto options = garrow_struct_field_options_new_raw(arrow_struct_field_options); return GARROW_FUNCTION_OPTIONS(options); } else { - auto options = g_object_new(GARROW_TYPE_FUNCTION_OPTIONS, - NULL); + auto options = g_object_new(GARROW_TYPE_FUNCTION_OPTIONS, NULL); return GARROW_FUNCTION_OPTIONS(options); } } @@ -6753,13 +6459,11 @@ garrow_function_options_get_raw(GArrowFunctionOptions *options) return priv->options; } - GArrowFunctionDoc * garrow_function_doc_new_raw(const arrow::compute::FunctionDoc *arrow_doc) { - return GARROW_FUNCTION_DOC(g_object_new(GARROW_TYPE_FUNCTION_DOC, - "doc", arrow_doc, - NULL)); + return GARROW_FUNCTION_DOC( + g_object_new(GARROW_TYPE_FUNCTION_DOC, "doc", arrow_doc, NULL)); } arrow::compute::FunctionDoc * @@ -6769,14 +6473,11 @@ garrow_function_doc_get_raw(GArrowFunctionDoc *doc) return priv->doc; } - GArrowFunction * -garrow_function_new_raw( - std::shared_ptr *arrow_function) +garrow_function_new_raw(std::shared_ptr *arrow_function) { - return GARROW_FUNCTION(g_object_new(GARROW_TYPE_FUNCTION, - "function", arrow_function, - NULL)); + return GARROW_FUNCTION( + g_object_new(GARROW_TYPE_FUNCTION, "function", arrow_function, NULL)); } std::shared_ptr @@ -6786,15 +6487,11 @@ garrow_function_get_raw(GArrowFunction *function) return priv->function; } - GArrowExecuteNodeOptions * -garrow_execute_node_options_new_raw( - arrow::acero::ExecNodeOptions *arrow_options) +garrow_execute_node_options_new_raw(arrow::acero::ExecNodeOptions *arrow_options) { return GARROW_EXECUTE_NODE_OPTIONS( - g_object_new(GARROW_TYPE_EXECUTE_NODE_OPTIONS, - "options", arrow_options, - NULL)); + g_object_new(GARROW_TYPE_EXECUTE_NODE_OPTIONS, "options", arrow_options, NULL)); } arrow::acero::ExecNodeOptions * @@ -6804,15 +6501,12 @@ garrow_execute_node_options_get_raw(GArrowExecuteNodeOptions *options) return priv->options; } - GArrowExecuteNode * 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)); + return GARROW_EXECUTE_NODE( + g_object_new(GARROW_TYPE_EXECUTE_NODE, "node", arrow_node, "options", options, NULL)); } arrow::acero::ExecNode * @@ -6822,7 +6516,6 @@ garrow_execute_node_get_raw(GArrowExecuteNode *node) return priv->node; } - std::shared_ptr garrow_execute_plan_get_raw(GArrowExecutePlan *plan) { @@ -6830,7 +6523,6 @@ garrow_execute_plan_get_raw(GArrowExecutePlan *plan) return priv->plan; } - GArrowCastOptions * garrow_cast_options_new_raw(const arrow::compute::CastOptions *arrow_options) { @@ -6839,16 +6531,22 @@ garrow_cast_options_new_raw(const arrow::compute::CastOptions *arrow_options) auto arrow_to_data_type = arrow_options->to_type.GetSharedPtr(); to_data_type = garrow_data_type_new_raw(&arrow_to_data_type); } - auto options = - g_object_new(GARROW_TYPE_CAST_OPTIONS, - "to-data-type", to_data_type, - "allow-int-overflow", arrow_options->allow_int_overflow, - "allow-time-truncate", arrow_options->allow_time_truncate, - "allow-time-overflow", arrow_options->allow_time_overflow, - "allow-decimal-truncate", arrow_options->allow_decimal_truncate, - "allow-float-truncate", arrow_options->allow_float_truncate, - "allow-invalid-utf8", arrow_options->allow_invalid_utf8, - NULL); + auto options = g_object_new(GARROW_TYPE_CAST_OPTIONS, + "to-data-type", + to_data_type, + "allow-int-overflow", + arrow_options->allow_int_overflow, + "allow-time-truncate", + arrow_options->allow_time_truncate, + "allow-time-overflow", + arrow_options->allow_time_overflow, + "allow-decimal-truncate", + arrow_options->allow_decimal_truncate, + "allow-float-truncate", + arrow_options->allow_float_truncate, + "allow-invalid-utf8", + arrow_options->allow_invalid_utf8, + NULL); return GARROW_CAST_OPTIONS(options); } @@ -6859,16 +6557,16 @@ garrow_cast_options_get_raw(GArrowCastOptions *options) garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options))); } - GArrowScalarAggregateOptions * garrow_scalar_aggregate_options_new_raw( const arrow::compute::ScalarAggregateOptions *arrow_options) { - auto options = - g_object_new(GARROW_TYPE_SCALAR_AGGREGATE_OPTIONS, - "skip-nulls", arrow_options->skip_nulls, - "min-count", arrow_options->min_count, - NULL); + auto options = g_object_new(GARROW_TYPE_SCALAR_AGGREGATE_OPTIONS, + "skip-nulls", + arrow_options->skip_nulls, + "min-count", + arrow_options->min_count, + NULL); return GARROW_SCALAR_AGGREGATE_OPTIONS(options); } @@ -6879,14 +6577,11 @@ garrow_scalar_aggregate_options_get_raw(GArrowScalarAggregateOptions *options) garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options))); } - GArrowCountOptions * -garrow_count_options_new_raw( - const arrow::compute::CountOptions *arrow_options) +garrow_count_options_new_raw(const arrow::compute::CountOptions *arrow_options) { - auto options = g_object_new(GARROW_TYPE_COUNT_OPTIONS, - "mode", arrow_options->mode, - NULL); + auto options = + g_object_new(GARROW_TYPE_COUNT_OPTIONS, "mode", arrow_options->mode, NULL); return GARROW_COUNT_OPTIONS(options); } @@ -6897,16 +6592,13 @@ garrow_count_options_get_raw(GArrowCountOptions *options) garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options))); } - GArrowFilterOptions * -garrow_filter_options_new_raw( - const arrow::compute::FilterOptions *arrow_options) +garrow_filter_options_new_raw(const arrow::compute::FilterOptions *arrow_options) { - auto options = - g_object_new(GARROW_TYPE_FILTER_OPTIONS, - "null-selection-behavior", - arrow_options->null_selection_behavior, - NULL); + auto options = g_object_new(GARROW_TYPE_FILTER_OPTIONS, + "null-selection-behavior", + arrow_options->null_selection_behavior, + NULL); return GARROW_FILTER_OPTIONS(options); } @@ -6917,13 +6609,10 @@ garrow_filter_options_get_raw(GArrowFilterOptions *options) garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options))); } - GArrowTakeOptions * -garrow_take_options_new_raw( - const arrow::compute::TakeOptions *arrow_options) +garrow_take_options_new_raw(const arrow::compute::TakeOptions *arrow_options) { - auto options = - GARROW_TAKE_OPTIONS(g_object_new(GARROW_TYPE_TAKE_OPTIONS, NULL)); + auto options = GARROW_TAKE_OPTIONS(g_object_new(GARROW_TYPE_TAKE_OPTIONS, NULL)); /* TODO: Use property when we add support for boundscheck. */ auto arrow_new_options = garrow_take_options_get_raw(options); arrow_new_options->boundscheck = arrow_options->boundscheck; @@ -6937,14 +6626,11 @@ garrow_take_options_get_raw(GArrowTakeOptions *options) garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options))); } - GArrowArraySortOptions * -garrow_array_sort_options_new_raw( - const arrow::compute::ArraySortOptions *arrow_options) +garrow_array_sort_options_new_raw(const arrow::compute::ArraySortOptions *arrow_options) { - auto options = g_object_new(GARROW_TYPE_ARRAY_SORT_OPTIONS, - "order", arrow_options->order, - NULL); + auto options = + g_object_new(GARROW_TYPE_ARRAY_SORT_OPTIONS, "order", arrow_options->order, NULL); return GARROW_ARRAY_SORT_OPTIONS(options); } @@ -6955,7 +6641,6 @@ garrow_array_sort_options_get_raw(GArrowArraySortOptions *options) garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options))); } - GArrowSortKey * garrow_sort_key_new_raw(const arrow::compute::SortKey &arrow_sort_key) { @@ -6972,14 +6657,10 @@ garrow_sort_key_get_raw(GArrowSortKey *sort_key) return &(priv->sort_key); } - GArrowSortOptions * -garrow_sort_options_new_raw( - const arrow::compute::SortOptions *arrow_options) +garrow_sort_options_new_raw(const arrow::compute::SortOptions *arrow_options) { - auto options = - GARROW_SORT_OPTIONS(g_object_new(GARROW_TYPE_SORT_OPTIONS, - NULL)); + auto options = GARROW_SORT_OPTIONS(g_object_new(GARROW_TYPE_SORT_OPTIONS, NULL)); auto arrow_new_options = garrow_sort_options_get_raw(options); arrow_new_options->sort_keys = arrow_options->sort_keys; /* TODO: Use property when we add support for null_placement. */ @@ -6995,19 +6676,19 @@ garrow_sort_options_get_raw(GArrowSortOptions *options) } GArrowSetLookupOptions * -garrow_set_lookup_options_new_raw( - const arrow::compute::SetLookupOptions *arrow_options) +garrow_set_lookup_options_new_raw(const arrow::compute::SetLookupOptions *arrow_options) { auto arrow_copied_options = arrow_options->Copy(); auto arrow_copied_set_lookup_options = - static_cast( - arrow_copied_options.get()); - auto value_set = - garrow_datum_new_raw(&(arrow_copied_set_lookup_options->value_set)); - auto skip_nulls = (arrow_options->skip_nulls.has_value() && arrow_options->skip_nulls.value()); + static_cast(arrow_copied_options.get()); + auto value_set = garrow_datum_new_raw(&(arrow_copied_set_lookup_options->value_set)); + auto skip_nulls = + (arrow_options->skip_nulls.has_value() && arrow_options->skip_nulls.value()); auto options = g_object_new(GARROW_TYPE_SET_LOOKUP_OPTIONS, - "value-set", value_set, - "skip-nulls", skip_nulls, + "value-set", + value_set, + "skip-nulls", + skip_nulls, NULL); return GARROW_SET_LOOKUP_OPTIONS(options); } @@ -7019,15 +6700,16 @@ garrow_set_lookup_options_get_raw(GArrowSetLookupOptions *options) garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options))); } - GArrowVarianceOptions * -garrow_variance_options_new_raw( - const arrow::compute::VarianceOptions *arrow_options) +garrow_variance_options_new_raw(const arrow::compute::VarianceOptions *arrow_options) { auto options = g_object_new(GARROW_TYPE_VARIANCE_OPTIONS, - "ddof", arrow_options->ddof, - "skip-nulls", arrow_options->skip_nulls, - "min-count", arrow_options->min_count, + "ddof", + arrow_options->ddof, + "skip-nulls", + arrow_options->skip_nulls, + "min-count", + arrow_options->min_count, NULL); return GARROW_VARIANCE_OPTIONS(options); } @@ -7039,16 +6721,15 @@ garrow_variance_options_get_raw(GArrowVarianceOptions *options) garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options))); } - GArrowRoundOptions * -garrow_round_options_new_raw( - const arrow::compute::RoundOptions *arrow_options) -{ - auto options = g_object_new( - GARROW_TYPE_ROUND_OPTIONS, - "n-digits", arrow_options->ndigits, - "mode", static_cast(arrow_options->round_mode), - NULL); +garrow_round_options_new_raw(const arrow::compute::RoundOptions *arrow_options) +{ + auto options = g_object_new(GARROW_TYPE_ROUND_OPTIONS, + "n-digits", + arrow_options->ndigits, + "mode", + static_cast(arrow_options->round_mode), + NULL); return GARROW_ROUND_OPTIONS(options); } @@ -7059,22 +6740,21 @@ garrow_round_options_get_raw(GArrowRoundOptions *options) garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options))); } - GArrowRoundToMultipleOptions * garrow_round_to_multiple_options_new_raw( const arrow::compute::RoundToMultipleOptions *arrow_options) { auto arrow_copied_options = arrow_options->Copy(); auto arrow_copied_round_to_multiple_options = - static_cast( - arrow_copied_options.get()); + static_cast(arrow_copied_options.get()); auto multiple = garrow_scalar_new_raw(&(arrow_copied_round_to_multiple_options->multiple)); - auto options = - g_object_new(GARROW_TYPE_ROUND_TO_MULTIPLE_OPTIONS, - "multiple", multiple, - "mode", static_cast(arrow_options->round_mode), - NULL); + auto options = g_object_new(GARROW_TYPE_ROUND_TO_MULTIPLE_OPTIONS, + "multiple", + multiple, + "mode", + static_cast(arrow_options->round_mode), + NULL); g_object_unref(multiple); return GARROW_ROUND_TO_MULTIPLE_OPTIONS(options); } @@ -7086,16 +6766,16 @@ garrow_round_to_multiple_options_get_raw(GArrowRoundToMultipleOptions *options) garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options))); } - GArrowMatchSubstringOptions * garrow_match_substring_options_new_raw( const arrow::compute::MatchSubstringOptions *arrow_options) { - return GARROW_MATCH_SUBSTRING_OPTIONS( - g_object_new(GARROW_TYPE_MATCH_SUBSTRING_OPTIONS, - "pattern", arrow_options->pattern.c_str(), - "ignore-case", arrow_options->ignore_case, - NULL)); + return GARROW_MATCH_SUBSTRING_OPTIONS(g_object_new(GARROW_TYPE_MATCH_SUBSTRING_OPTIONS, + "pattern", + arrow_options->pattern.c_str(), + "ignore-case", + arrow_options->ignore_case, + NULL)); } arrow::compute::MatchSubstringOptions * @@ -7105,14 +6785,12 @@ garrow_match_substring_options_get_raw(GArrowMatchSubstringOptions *options) garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options))); } - GArrowUTF8NormalizeOptions * garrow_utf8_normalize_options_new_raw( const arrow::compute::Utf8NormalizeOptions *arrow_options) { - auto options = g_object_new(GARROW_TYPE_UTF8_NORMALIZE_FORM, - "form", arrow_options->form, - NULL); + auto options = + g_object_new(GARROW_TYPE_UTF8_NORMALIZE_FORM, "form", arrow_options->form, NULL); return GARROW_UTF8_NORMALIZE_OPTIONS(options); } @@ -7123,18 +6801,17 @@ garrow_utf8_normalize_options_get_raw(GArrowUTF8NormalizeOptions *options) garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options))); } - GArrowQuantileOptions * -garrow_quantile_options_new_raw( - const arrow::compute::QuantileOptions *arrow_options) -{ - auto options = - GARROW_QUANTILE_OPTIONS( - g_object_new(GARROW_TYPE_QUANTILE_OPTIONS, - "interpolation", arrow_options->interpolation, - "skip-nulls", arrow_options->skip_nulls, - "min-count", arrow_options->min_count, - NULL)); +garrow_quantile_options_new_raw(const arrow::compute::QuantileOptions *arrow_options) +{ + auto options = GARROW_QUANTILE_OPTIONS(g_object_new(GARROW_TYPE_QUANTILE_OPTIONS, + "interpolation", + arrow_options->interpolation, + "skip-nulls", + arrow_options->skip_nulls, + "min-count", + arrow_options->min_count, + NULL)); garrow_quantile_options_set_qs(options, arrow_options->q.data(), arrow_options->q.size()); @@ -7148,7 +6825,6 @@ garrow_quantile_options_get_raw(GArrowQuantileOptions *options) garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options))); } - GArrowIndexOptions * garrow_index_options_new_raw(const arrow::compute::IndexOptions *arrow_options) { @@ -7158,10 +6834,7 @@ garrow_index_options_new_raw(const arrow::compute::IndexOptions *arrow_options) value = garrow_scalar_new_raw(&arrow_value); } auto options = - GARROW_INDEX_OPTIONS( - g_object_new(GARROW_TYPE_INDEX_OPTIONS, - "value", value, - NULL)); + GARROW_INDEX_OPTIONS(g_object_new(GARROW_TYPE_INDEX_OPTIONS, "value", value, NULL)); if (value) { g_object_unref(value); } @@ -7175,15 +6848,15 @@ garrow_index_options_get_raw(GArrowIndexOptions *options) garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options))); } - GArrowRankOptions * garrow_rank_options_new_raw(const arrow::compute::RankOptions *arrow_options) { - auto options = GARROW_RANK_OPTIONS( - g_object_new(GARROW_TYPE_RANK_OPTIONS, - "null-placement", arrow_options->null_placement, - "tiebreaker", arrow_options->tiebreaker, - nullptr)); + auto options = GARROW_RANK_OPTIONS(g_object_new(GARROW_TYPE_RANK_OPTIONS, + "null-placement", + arrow_options->null_placement, + "tiebreaker", + arrow_options->tiebreaker, + nullptr)); auto arrow_new_options = garrow_rank_options_get_raw(options); arrow_new_options->sort_keys = arrow_options->sort_keys; return options; @@ -7196,7 +6869,6 @@ garrow_rank_options_get_raw(GArrowRankOptions *options) garrow_function_options_get_raw(GARROW_FUNCTION_OPTIONS(options))); } - GArrowRunEndEncodeOptions * garrow_run_end_encode_options_new_raw( const arrow::compute::RunEndEncodeOptions *arrow_options) @@ -7217,15 +6889,16 @@ garrow_run_end_encode_options_get_raw(GArrowRunEndEncodeOptions *options) } GArrowStrptimeOptions * -garrow_strptime_options_new_raw( - const arrow::compute::StrptimeOptions *arrow_options) +garrow_strptime_options_new_raw(const arrow::compute::StrptimeOptions *arrow_options) { - return GARROW_STRPTIME_OPTIONS( - g_object_new(GARROW_TYPE_STRPTIME_OPTIONS, - "format", arrow_options->format.c_str(), - "unit", arrow_options->unit, - "error_is_null", arrow_options->error_is_null, - NULL)); + return GARROW_STRPTIME_OPTIONS(g_object_new(GARROW_TYPE_STRPTIME_OPTIONS, + "format", + arrow_options->format.c_str(), + "unit", + arrow_options->unit, + "error_is_null", + arrow_options->error_is_null, + NULL)); } arrow::compute::StrptimeOptions * @@ -7236,14 +6909,14 @@ garrow_strptime_options_get_raw(GArrowStrptimeOptions *options) } GArrowStrftimeOptions * -garrow_strftime_options_new_raw( - const arrow::compute::StrftimeOptions *arrow_options) +garrow_strftime_options_new_raw(const arrow::compute::StrftimeOptions *arrow_options) { - return GARROW_STRFTIME_OPTIONS( - g_object_new(GARROW_TYPE_STRFTIME_OPTIONS, - "format", arrow_options->format.c_str(), - "locale", arrow_options->locale.c_str(), - NULL)); + return GARROW_STRFTIME_OPTIONS(g_object_new(GARROW_TYPE_STRFTIME_OPTIONS, + "format", + arrow_options->format.c_str(), + "locale", + arrow_options->locale.c_str(), + NULL)); } arrow::compute::StrftimeOptions * @@ -7257,12 +6930,14 @@ GArrowSplitPatternOptions * garrow_split_pattern_options_new_raw( const arrow::compute::SplitPatternOptions *arrow_options) { - return GARROW_SPLIT_PATTERN_OPTIONS( - g_object_new(GARROW_TYPE_SPLIT_PATTERN_OPTIONS, - "pattern", arrow_options->pattern.c_str(), - "max_splits", arrow_options->max_splits, - "reverse", arrow_options->reverse, - NULL)); + return GARROW_SPLIT_PATTERN_OPTIONS(g_object_new(GARROW_TYPE_SPLIT_PATTERN_OPTIONS, + "pattern", + arrow_options->pattern.c_str(), + "max_splits", + arrow_options->max_splits, + "reverse", + arrow_options->reverse, + NULL)); } arrow::compute::SplitPatternOptions * @@ -7276,8 +6951,8 @@ GArrowStructFieldOptions * garrow_struct_field_options_new_raw( const arrow::compute::StructFieldOptions *arrow_options) { - auto options = GARROW_STRUCT_FIELD_OPTIONS( - g_object_new(GARROW_TYPE_STRUCT_FIELD_OPTIONS, NULL)); + auto options = + GARROW_STRUCT_FIELD_OPTIONS(g_object_new(GARROW_TYPE_STRUCT_FIELD_OPTIONS, NULL)); auto arrow_new_options = garrow_struct_field_options_get_raw(options); arrow_new_options->field_ref = arrow_options->field_ref; return options; diff --git a/c_glib/arrow-glib/compute.h b/c_glib/arrow-glib/compute.h index 9509e6d977aca..029cab136ad8f 100644 --- a/c_glib/arrow-glib/compute.h +++ b/c_glib/arrow-glib/compute.h @@ -26,19 +26,16 @@ G_BEGIN_DECLS #define GARROW_TYPE_EXECUTE_CONTEXT (garrow_execute_context_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowExecuteContext, - garrow_execute_context, - GARROW, - EXECUTE_CONTEXT, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowExecuteContext, garrow_execute_context, GARROW, EXECUTE_CONTEXT, GObject) struct _GArrowExecuteContextClass { GObjectClass parent_class; }; GARROW_AVAILABLE_IN_1_0 -GArrowExecuteContext *garrow_execute_context_new(void); - +GArrowExecuteContext * +garrow_execute_context_new(void); GARROW_AVAILABLE_IN_7_0 gboolean @@ -48,13 +45,9 @@ GARROW_AVAILABLE_IN_7_0 gchar * garrow_function_options_to_string(GArrowFunctionOptions *options); - #define GARROW_TYPE_FUNCTION_DOC (garrow_function_doc_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowFunctionDoc, - garrow_function_doc, - GARROW, - FUNCTION_DOC, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowFunctionDoc, garrow_function_doc, GARROW, FUNCTION_DOC, GObject) struct _GArrowFunctionDocClass { GObjectClass parent_class; @@ -73,31 +66,28 @@ GARROW_AVAILABLE_IN_6_0 gchar * garrow_function_doc_get_options_class_name(GArrowFunctionDoc *doc); - #define GARROW_TYPE_FUNCTION (garrow_function_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowFunction, - garrow_function, - GARROW, - FUNCTION, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowFunction, garrow_function, GARROW, FUNCTION, GObject) struct _GArrowFunctionClass { GObjectClass parent_class; }; - GARROW_AVAILABLE_IN_1_0 -GArrowFunction *garrow_function_find(const gchar *name); +GArrowFunction * +garrow_function_find(const gchar *name); GARROW_AVAILABLE_IN_7_0 -GList *garrow_function_all(void); +GList * +garrow_function_all(void); GARROW_AVAILABLE_IN_1_0 -GArrowDatum *garrow_function_execute(GArrowFunction *function, - GList *args, - GArrowFunctionOptions *options, - GArrowExecuteContext *context, - GError **error); +GArrowDatum * +garrow_function_execute(GArrowFunction *function, + GList *args, + GArrowFunctionOptions *options, + GArrowExecuteContext *context, + GError **error); GARROW_AVAILABLE_IN_7_0 const gchar * @@ -114,13 +104,11 @@ garrow_function_get_options_type(GArrowFunction *function); GARROW_AVAILABLE_IN_7_0 gboolean -garrow_function_equal(GArrowFunction *function, - GArrowFunction *other_function); +garrow_function_equal(GArrowFunction *function, GArrowFunction *other_function); GARROW_AVAILABLE_IN_7_0 gchar * garrow_function_to_string(GArrowFunction *function); - #define GARROW_TYPE_EXECUTE_NODE_OPTIONS (garrow_execute_node_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowExecuteNodeOptions, garrow_execute_node_options, @@ -132,7 +120,6 @@ struct _GArrowExecuteNodeOptionsClass GObjectClass parent_class; }; - #define GARROW_TYPE_SOURCE_NODE_OPTIONS (garrow_source_node_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowSourceNodeOptions, garrow_source_node_options, @@ -146,8 +133,7 @@ struct _GArrowSourceNodeOptionsClass GARROW_AVAILABLE_IN_6_0 GArrowSourceNodeOptions * -garrow_source_node_options_new_record_batch_reader( - GArrowRecordBatchReader *reader); +garrow_source_node_options_new_record_batch_reader(GArrowRecordBatchReader *reader); GARROW_AVAILABLE_IN_6_0 GArrowSourceNodeOptions * garrow_source_node_options_new_record_batch(GArrowRecordBatch *record_batch); @@ -155,7 +141,6 @@ GARROW_AVAILABLE_IN_6_0 GArrowSourceNodeOptions * garrow_source_node_options_new_table(GArrowTable *table); - #define GARROW_TYPE_FILTER_NODE_OPTIONS (garrow_filter_node_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowFilterNodeOptions, garrow_filter_node_options, @@ -171,7 +156,6 @@ GARROW_AVAILABLE_IN_12_0 GArrowFilterNodeOptions * garrow_filter_node_options_new(GArrowExpression *expression); - #define GARROW_TYPE_PROJECT_NODE_OPTIONS (garrow_project_node_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowProjectNodeOptions, garrow_project_node_options, @@ -185,17 +169,11 @@ struct _GArrowProjectNodeOptionsClass GARROW_AVAILABLE_IN_11_0 GArrowProjectNodeOptions * -garrow_project_node_options_new(GList *expressions, - gchar **names, - gsize n_names); - +garrow_project_node_options_new(GList *expressions, gchar **names, gsize n_names); #define GARROW_TYPE_AGGREGATION (garrow_aggregation_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowAggregation, - garrow_aggregation, - GARROW, - AGGREGATION, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowAggregation, garrow_aggregation, GARROW, AGGREGATION, GObject) struct _GArrowAggregationClass { GObjectClass parent_class; @@ -208,8 +186,7 @@ garrow_aggregation_new(const gchar *function, const gchar *input, const gchar *output); -#define GARROW_TYPE_AGGREGATE_NODE_OPTIONS \ - (garrow_aggregate_node_options_get_type()) +#define GARROW_TYPE_AGGREGATE_NODE_OPTIONS (garrow_aggregate_node_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowAggregateNodeOptions, garrow_aggregate_node_options, GARROW, @@ -227,7 +204,6 @@ garrow_aggregate_node_options_new(GList *aggregations, gsize n_keys, GError **error); - #define GARROW_TYPE_SINK_NODE_OPTIONS (garrow_sink_node_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowSinkNodeOptions, garrow_sink_node_options, @@ -244,9 +220,7 @@ GArrowSinkNodeOptions * garrow_sink_node_options_new(void); GARROW_AVAILABLE_IN_6_0 GArrowRecordBatchReader * -garrow_sink_node_options_get_reader(GArrowSinkNodeOptions *options, - GArrowSchema *schema); - +garrow_sink_node_options_get_reader(GArrowSinkNodeOptions *options, GArrowSchema *schema); /** * GArrowJoinType: @@ -274,8 +248,7 @@ typedef enum { GARROW_JOIN_TYPE_FULL_OUTER, } GArrowJoinType; -#define GARROW_TYPE_HASH_JOIN_NODE_OPTIONS \ - (garrow_hash_join_node_options_get_type()) +#define GARROW_TYPE_HASH_JOIN_NODE_OPTIONS (garrow_hash_join_node_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowHashJoinNodeOptions, garrow_hash_join_node_options, GARROW, @@ -296,26 +269,20 @@ garrow_hash_join_node_options_new(GArrowJoinType type, GError **error); GARROW_AVAILABLE_IN_7_0 gboolean -garrow_hash_join_node_options_set_left_outputs( - GArrowHashJoinNodeOptions *options, - const gchar **outputs, - gsize n_outputs, - GError **error); +garrow_hash_join_node_options_set_left_outputs(GArrowHashJoinNodeOptions *options, + const gchar **outputs, + gsize n_outputs, + GError **error); GARROW_AVAILABLE_IN_7_0 gboolean -garrow_hash_join_node_options_set_right_outputs( - GArrowHashJoinNodeOptions *options, - const gchar **outputs, - gsize n_outputs, - GError **error); - +garrow_hash_join_node_options_set_right_outputs(GArrowHashJoinNodeOptions *options, + const gchar **outputs, + gsize n_outputs, + GError **error); #define GARROW_TYPE_EXECUTE_NODE (garrow_execute_node_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowExecuteNode, - garrow_execute_node, - GARROW, - EXECUTE_NODE, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowExecuteNode, garrow_execute_node, GARROW, EXECUTE_NODE, GObject) struct _GArrowExecuteNodeClass { GObjectClass parent_class; @@ -328,13 +295,9 @@ GARROW_AVAILABLE_IN_6_0 GArrowSchema * garrow_execute_node_get_output_schema(GArrowExecuteNode *node); - #define GARROW_TYPE_EXECUTE_PLAN (garrow_execute_plan_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowExecutePlan, - garrow_execute_plan, - GARROW, - EXECUTE_PLAN, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowExecutePlan, garrow_execute_plan, GARROW, EXECUTE_PLAN, GObject) struct _GArrowExecutePlanClass { GObjectClass parent_class; @@ -391,8 +354,7 @@ GList * garrow_execute_plan_get_nodes(GArrowExecutePlan *plan); GARROW_AVAILABLE_IN_6_0 gboolean -garrow_execute_plan_validate(GArrowExecutePlan *plan, - GError **error); +garrow_execute_plan_validate(GArrowExecutePlan *plan, GError **error); GARROW_AVAILABLE_IN_6_0 void garrow_execute_plan_start(GArrowExecutePlan *plan); @@ -401,15 +363,12 @@ void garrow_execute_plan_stop(GArrowExecutePlan *plan); GARROW_AVAILABLE_IN_6_0 gboolean -garrow_execute_plan_wait(GArrowExecutePlan *plan, - GError **error); - - -GArrowCastOptions *garrow_cast_options_new(void); +garrow_execute_plan_wait(GArrowExecutePlan *plan, GError **error); +GArrowCastOptions * +garrow_cast_options_new(void); -#define GARROW_TYPE_SCALAR_AGGREGATE_OPTIONS \ - (garrow_scalar_aggregate_options_get_type()) +#define GARROW_TYPE_SCALAR_AGGREGATE_OPTIONS (garrow_scalar_aggregate_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowScalarAggregateOptions, garrow_scalar_aggregate_options, GARROW, @@ -442,11 +401,8 @@ typedef enum { } GArrowCountMode; #define GARROW_TYPE_COUNT_OPTIONS (garrow_count_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowCountOptions, - garrow_count_options, - GARROW, - COUNT_OPTIONS, - GArrowFunctionOptions) +G_DECLARE_DERIVABLE_TYPE( + GArrowCountOptions, garrow_count_options, GARROW, COUNT_OPTIONS, GArrowFunctionOptions) struct _GArrowCountOptionsClass { GArrowFunctionOptionsClass parent_class; @@ -456,7 +412,6 @@ GARROW_AVAILABLE_IN_6_0 GArrowCountOptions * garrow_count_options_new(void); - /** * GArrowFilterNullSelectionBehavior: * @GARROW_FILTER_NULL_SELECTION_DROP: @@ -487,13 +442,9 @@ GARROW_AVAILABLE_IN_0_17 GArrowFilterOptions * garrow_filter_options_new(void); - #define GARROW_TYPE_TAKE_OPTIONS (garrow_take_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowTakeOptions, - garrow_take_options, - GARROW, - TAKE_OPTIONS, - GArrowFunctionOptions) +G_DECLARE_DERIVABLE_TYPE( + GArrowTakeOptions, garrow_take_options, GARROW, TAKE_OPTIONS, GArrowFunctionOptions) struct _GArrowTakeOptionsClass { GArrowFunctionOptionsClass parent_class; @@ -503,7 +454,6 @@ GARROW_AVAILABLE_IN_0_14 GArrowTakeOptions * garrow_take_options_new(void); - /** * GArrowSortOrder: * @GARROW_SORT_ORDER_ASCENDING: Sort in ascending order. @@ -555,13 +505,8 @@ gboolean garrow_array_sort_options_equal(GArrowArraySortOptions *options, GArrowArraySortOptions *other_options); - #define GARROW_TYPE_SORT_KEY (garrow_sort_key_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowSortKey, - garrow_sort_key, - GARROW, - SORT_KEY, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowSortKey, garrow_sort_key, GARROW, SORT_KEY, GObject) struct _GArrowSortKeyClass { GObjectClass parent_class; @@ -569,22 +514,15 @@ struct _GArrowSortKeyClass GARROW_AVAILABLE_IN_3_0 GArrowSortKey * -garrow_sort_key_new(const gchar *target, - GArrowSortOrder order, - GError **error); +garrow_sort_key_new(const gchar *target, GArrowSortOrder order, GError **error); GARROW_AVAILABLE_IN_3_0 gboolean -garrow_sort_key_equal(GArrowSortKey *sort_key, - GArrowSortKey *other_sort_key); - +garrow_sort_key_equal(GArrowSortKey *sort_key, GArrowSortKey *other_sort_key); #define GARROW_TYPE_SORT_OPTIONS (garrow_sort_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowSortOptions, - garrow_sort_options, - GARROW, - SORT_OPTIONS, - GArrowFunctionOptions) +G_DECLARE_DERIVABLE_TYPE( + GArrowSortOptions, garrow_sort_options, GARROW, SORT_OPTIONS, GArrowFunctionOptions) struct _GArrowSortOptionsClass { GArrowFunctionOptionsClass parent_class; @@ -595,20 +533,16 @@ GArrowSortOptions * garrow_sort_options_new(GList *sort_keys); GARROW_AVAILABLE_IN_3_0 gboolean -garrow_sort_options_equal(GArrowSortOptions *options, - GArrowSortOptions *other_options); +garrow_sort_options_equal(GArrowSortOptions *options, GArrowSortOptions *other_options); GARROW_AVAILABLE_IN_3_0 GList * garrow_sort_options_get_sort_keys(GArrowSortOptions *options); GARROW_AVAILABLE_IN_3_0 void -garrow_sort_options_set_sort_keys(GArrowSortOptions *options, - GList *sort_keys); +garrow_sort_options_set_sort_keys(GArrowSortOptions *options, GList *sort_keys); GARROW_AVAILABLE_IN_3_0 void -garrow_sort_options_add_sort_key(GArrowSortOptions *options, - GArrowSortKey *sort_key); - +garrow_sort_options_add_sort_key(GArrowSortOptions *options, GArrowSortKey *sort_key); #define GARROW_TYPE_SET_LOOKUP_OPTIONS (garrow_set_lookup_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowSetLookupOptions, @@ -625,7 +559,6 @@ GARROW_AVAILABLE_IN_6_0 GArrowSetLookupOptions * garrow_set_lookup_options_new(GArrowDatum *value_set); - #define GARROW_TYPE_VARIANCE_OPTIONS (garrow_variance_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowVarianceOptions, garrow_variance_options, @@ -641,7 +574,6 @@ GARROW_AVAILABLE_IN_6_0 GArrowVarianceOptions * garrow_variance_options_new(void); - /** * GArrowRoundMode: * @GARROW_ROUND_MODE_DOWN: @@ -687,13 +619,9 @@ typedef enum { GARROW_ROUND_HALF_TO_ODD, } GArrowRoundMode; - #define GARROW_TYPE_ROUND_OPTIONS (garrow_round_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowRoundOptions, - garrow_round_options, - GARROW, - ROUND_OPTIONS, - GArrowFunctionOptions) +G_DECLARE_DERIVABLE_TYPE( + GArrowRoundOptions, garrow_round_options, GARROW, ROUND_OPTIONS, GArrowFunctionOptions) struct _GArrowRoundOptionsClass { GArrowFunctionOptionsClass parent_class; @@ -703,8 +631,7 @@ GARROW_AVAILABLE_IN_7_0 GArrowRoundOptions * garrow_round_options_new(void); - -#define GARROW_TYPE_ROUND_TO_MULTIPLE_OPTIONS \ +#define GARROW_TYPE_ROUND_TO_MULTIPLE_OPTIONS \ (garrow_round_to_multiple_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowRoundToMultipleOptions, garrow_round_to_multiple_options, @@ -720,9 +647,7 @@ GARROW_AVAILABLE_IN_7_0 GArrowRoundToMultipleOptions * garrow_round_to_multiple_options_new(void); - -#define GARROW_TYPE_MATCH_SUBSTRING_OPTIONS \ - (garrow_match_substring_options_get_type()) +#define GARROW_TYPE_MATCH_SUBSTRING_OPTIONS (garrow_match_substring_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowMatchSubstringOptions, garrow_match_substring_options, GARROW, @@ -737,7 +662,6 @@ GARROW_AVAILABLE_IN_12_0 GArrowMatchSubstringOptions * garrow_match_substring_options_new(void); - /** * GArrowUTF8NormalizeForm: * @GARROW_UTF8_NORMALIZE_FORM_NFC: Normalization Form Canonical Composition. @@ -758,8 +682,7 @@ typedef enum /*< underscore_name=garrow_utf8_normalize_form >*/ { GARROW_UTF8_NORMALIZE_FORM_NFKD, } GArrowUTF8NormalizeForm; -#define GARROW_TYPE_UTF8_NORMALIZE_OPTIONS \ - (garrow_utf8_normalize_options_get_type()) +#define GARROW_TYPE_UTF8_NORMALIZE_OPTIONS (garrow_utf8_normalize_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowUTF8NormalizeOptions, garrow_utf8_normalize_options, GARROW, @@ -774,7 +697,6 @@ GARROW_AVAILABLE_IN_8_0 GArrowUTF8NormalizeOptions * garrow_utf8_normalize_options_new(void); - /** * GArrowQuantileInterpolation: * @GARROW_QUANTILE_INTERPOLATION_LINEAR: Linear. @@ -796,8 +718,7 @@ typedef enum { GARROW_QUANTILE_INTERPOLATION_MIDPOINT, } GArrowQuantileInterpolation; -#define GARROW_TYPE_QUANTILE_OPTIONS \ - (garrow_quantile_options_get_type()) +#define GARROW_TYPE_QUANTILE_OPTIONS (garrow_quantile_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowQuantileOptions, garrow_quantile_options, GARROW, @@ -813,25 +734,19 @@ GArrowQuantileOptions * garrow_quantile_options_new(void); GARROW_AVAILABLE_IN_9_0 const gdouble * -garrow_quantile_options_get_qs(GArrowQuantileOptions *options, - gsize *n); +garrow_quantile_options_get_qs(GArrowQuantileOptions *options, gsize *n); GARROW_AVAILABLE_IN_9_0 void -garrow_quantile_options_set_q(GArrowQuantileOptions *options, - gdouble q); +garrow_quantile_options_set_q(GArrowQuantileOptions *options, gdouble q); GARROW_AVAILABLE_IN_9_0 void garrow_quantile_options_set_qs(GArrowQuantileOptions *options, const gdouble *qs, gsize n); - #define GARROW_TYPE_INDEX_OPTIONS (garrow_index_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowIndexOptions, - garrow_index_options, - GARROW, - INDEX_OPTIONS, - GArrowFunctionOptions) +G_DECLARE_DERIVABLE_TYPE( + GArrowIndexOptions, garrow_index_options, GARROW, INDEX_OPTIONS, GArrowFunctionOptions) struct _GArrowIndexOptionsClass { GArrowFunctionOptionsClass parent_class; @@ -841,7 +756,6 @@ GARROW_AVAILABLE_IN_12_0 GArrowIndexOptions * garrow_index_options_new(void); - /** * GArrowRankTiebreader: * @GARROW_RANK_TIEBREAKER_MIN: @@ -867,13 +781,9 @@ typedef enum { GARROW_RANK_TIEBREAKER_DENSE, } GArrowRankTiebreaker; -#define GARROW_TYPE_RANK_OPTIONS \ - (garrow_rank_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowRankOptions, - garrow_rank_options, - GARROW, - RANK_OPTIONS, - GArrowFunctionOptions) +#define GARROW_TYPE_RANK_OPTIONS (garrow_rank_options_get_type()) +G_DECLARE_DERIVABLE_TYPE( + GArrowRankOptions, garrow_rank_options, GARROW, RANK_OPTIONS, GArrowFunctionOptions) struct _GArrowRankOptionsClass { GArrowFunctionOptionsClass parent_class; @@ -884,92 +794,92 @@ GArrowRankOptions * garrow_rank_options_new(void); GARROW_AVAILABLE_IN_12_0 gboolean -garrow_rank_options_equal(GArrowRankOptions *options, - GArrowRankOptions *other_options); +garrow_rank_options_equal(GArrowRankOptions *options, GArrowRankOptions *other_options); GARROW_AVAILABLE_IN_12_0 GList * garrow_rank_options_get_sort_keys(GArrowRankOptions *options); GARROW_AVAILABLE_IN_12_0 void -garrow_rank_options_set_sort_keys(GArrowRankOptions *options, - GList *sort_keys); +garrow_rank_options_set_sort_keys(GArrowRankOptions *options, GList *sort_keys); GARROW_AVAILABLE_IN_12_0 void -garrow_rank_options_add_sort_key(GArrowRankOptions *options, - GArrowSortKey *sort_key); - +garrow_rank_options_add_sort_key(GArrowRankOptions *options, GArrowSortKey *sort_key); -GArrowArray *garrow_array_cast(GArrowArray *array, - GArrowDataType *target_data_type, - GArrowCastOptions *options, - GError **error); -GArrowArray *garrow_array_unique(GArrowArray *array, - GError **error); -GArrowDictionaryArray *garrow_array_dictionary_encode(GArrowArray *array, - GError **error); +GArrowArray * +garrow_array_cast(GArrowArray *array, + GArrowDataType *target_data_type, + GArrowCastOptions *options, + GError **error); +GArrowArray * +garrow_array_unique(GArrowArray *array, GError **error); +GArrowDictionaryArray * +garrow_array_dictionary_encode(GArrowArray *array, GError **error); GARROW_AVAILABLE_IN_0_13 -gint64 garrow_array_count(GArrowArray *array, - GArrowCountOptions *options, - GError **error); +gint64 +garrow_array_count(GArrowArray *array, GArrowCountOptions *options, GError **error); GARROW_AVAILABLE_IN_0_13 -GArrowStructArray *garrow_array_count_values(GArrowArray *array, - GError **error); +GArrowStructArray * +garrow_array_count_values(GArrowArray *array, GError **error); GARROW_AVAILABLE_IN_0_13 -GArrowBooleanArray *garrow_boolean_array_invert(GArrowBooleanArray *array, - GError **error); +GArrowBooleanArray * +garrow_boolean_array_invert(GArrowBooleanArray *array, GError **error); GARROW_AVAILABLE_IN_0_13 -GArrowBooleanArray *garrow_boolean_array_and(GArrowBooleanArray *left, - GArrowBooleanArray *right, - GError **error); +GArrowBooleanArray * +garrow_boolean_array_and(GArrowBooleanArray *left, + GArrowBooleanArray *right, + GError **error); GARROW_AVAILABLE_IN_0_13 -GArrowBooleanArray *garrow_boolean_array_or(GArrowBooleanArray *left, - GArrowBooleanArray *right, - GError **error); +GArrowBooleanArray * +garrow_boolean_array_or(GArrowBooleanArray *left, + GArrowBooleanArray *right, + GError **error); GARROW_AVAILABLE_IN_0_13 -GArrowBooleanArray *garrow_boolean_array_xor(GArrowBooleanArray *left, - GArrowBooleanArray *right, - GError **error); +GArrowBooleanArray * +garrow_boolean_array_xor(GArrowBooleanArray *left, + GArrowBooleanArray *right, + GError **error); GARROW_AVAILABLE_IN_0_13 -gdouble garrow_numeric_array_mean(GArrowNumericArray *array, - GError **error); +gdouble +garrow_numeric_array_mean(GArrowNumericArray *array, GError **error); GARROW_AVAILABLE_IN_0_13 -gint64 garrow_int8_array_sum(GArrowInt8Array *array, - GError **error); +gint64 +garrow_int8_array_sum(GArrowInt8Array *array, GError **error); GARROW_AVAILABLE_IN_0_13 -guint64 garrow_uint8_array_sum(GArrowUInt8Array *array, - GError **error); +guint64 +garrow_uint8_array_sum(GArrowUInt8Array *array, GError **error); GARROW_AVAILABLE_IN_0_13 -gint64 garrow_int16_array_sum(GArrowInt16Array *array, - GError **error); +gint64 +garrow_int16_array_sum(GArrowInt16Array *array, GError **error); GARROW_AVAILABLE_IN_0_13 -guint64 garrow_uint16_array_sum(GArrowUInt16Array *array, - GError **error); +guint64 +garrow_uint16_array_sum(GArrowUInt16Array *array, GError **error); GARROW_AVAILABLE_IN_0_13 -gint64 garrow_int32_array_sum(GArrowInt32Array *array, - GError **error); +gint64 +garrow_int32_array_sum(GArrowInt32Array *array, GError **error); GARROW_AVAILABLE_IN_0_13 -guint64 garrow_uint32_array_sum(GArrowUInt32Array *array, - GError **error); +guint64 +garrow_uint32_array_sum(GArrowUInt32Array *array, GError **error); GARROW_AVAILABLE_IN_0_13 -gint64 garrow_int64_array_sum(GArrowInt64Array *array, - GError **error); +gint64 +garrow_int64_array_sum(GArrowInt64Array *array, GError **error); GARROW_AVAILABLE_IN_0_13 -guint64 garrow_uint64_array_sum(GArrowUInt64Array *array, - GError **error); +guint64 +garrow_uint64_array_sum(GArrowUInt64Array *array, GError **error); GARROW_AVAILABLE_IN_0_13 -gdouble garrow_float_array_sum(GArrowFloatArray *array, - GError **error); +gdouble +garrow_float_array_sum(GArrowFloatArray *array, GError **error); GARROW_AVAILABLE_IN_0_13 -gdouble garrow_double_array_sum(GArrowDoubleArray *array, - GError **error); +gdouble +garrow_double_array_sum(GArrowDoubleArray *array, GError **error); GARROW_AVAILABLE_IN_0_14 -GArrowArray *garrow_array_take(GArrowArray *array, - GArrowArray *indices, - GArrowTakeOptions *options, - GError **error); +GArrowArray * +garrow_array_take(GArrowArray *array, + GArrowArray *indices, + GArrowTakeOptions *options, + GError **error); GARROW_AVAILABLE_IN_0_16 GArrowChunkedArray * garrow_array_take_chunked_array(GArrowArray *array, @@ -1014,26 +924,20 @@ garrow_array_filter(GArrowArray *array, GError **error); GARROW_AVAILABLE_IN_0_15 GArrowBooleanArray * -garrow_array_is_in(GArrowArray *left, - GArrowArray *right, - GError **error); +garrow_array_is_in(GArrowArray *left, GArrowArray *right, GError **error); GARROW_AVAILABLE_IN_0_15 GArrowBooleanArray * garrow_array_is_in_chunked_array(GArrowArray *left, GArrowChunkedArray *right, GError **error); - GARROW_AVAILABLE_IN_3_0 GArrowUInt64Array * -garrow_array_sort_indices(GArrowArray *array, - GArrowSortOrder order, - GError **error); +garrow_array_sort_indices(GArrowArray *array, GArrowSortOrder order, GError **error); GARROW_DEPRECATED_IN_3_0_FOR(garrow_array_sort_indices) GARROW_AVAILABLE_IN_0_15 GArrowUInt64Array * -garrow_array_sort_to_indices(GArrowArray *array, - GError **error); +garrow_array_sort_to_indices(GArrowArray *array, GError **error); GARROW_AVAILABLE_IN_3_0 GArrowUInt64Array * @@ -1041,7 +945,6 @@ garrow_chunked_array_sort_indices(GArrowChunkedArray *chunked_array, GArrowSortOrder order, GError **error); - GARROW_AVAILABLE_IN_3_0 GArrowUInt64Array * garrow_record_batch_sort_indices(GArrowRecordBatch *record_batch, @@ -1050,10 +953,7 @@ garrow_record_batch_sort_indices(GArrowRecordBatch *record_batch, GARROW_AVAILABLE_IN_3_0 GArrowUInt64Array * -garrow_table_sort_indices(GArrowTable *table, - GArrowSortOptions *options, - GError **error); - +garrow_table_sort_indices(GArrowTable *table, GArrowSortOptions *options, GError **error); GARROW_AVAILABLE_IN_0_16 GArrowTable * @@ -1086,8 +986,7 @@ garrow_record_batch_filter(GArrowRecordBatch *record_batch, GArrowFilterOptions *options, GError **error); -#define GARROW_TYPE_RUN_END_ENCODE_OPTIONS \ - (garrow_run_end_encode_options_get_type()) +#define GARROW_TYPE_RUN_END_ENCODE_OPTIONS (garrow_run_end_encode_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowRunEndEncodeOptions, garrow_run_end_encode_options, GARROW, @@ -1102,7 +1001,6 @@ GARROW_AVAILABLE_IN_13_0 GArrowRunEndEncodeOptions * garrow_run_end_encode_options_new(GArrowDataType *run_end_data_type); - GARROW_AVAILABLE_IN_13_0 GArrowRunEndEncodedArray * garrow_array_run_end_encode(GArrowArray *array, @@ -1110,11 +1008,9 @@ garrow_array_run_end_encode(GArrowArray *array, GError **error); GARROW_AVAILABLE_IN_13_0 GArrowArray * -garrow_run_end_encoded_array_decode(GArrowRunEndEncodedArray *array, - GError **error); +garrow_run_end_encoded_array_decode(GArrowRunEndEncodedArray *array, GError **error); -#define GARROW_TYPE_STRPTIME_OPTIONS \ - (garrow_strptime_options_get_type()) +#define GARROW_TYPE_STRPTIME_OPTIONS (garrow_strptime_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowStrptimeOptions, garrow_strptime_options, GARROW, @@ -1129,8 +1025,7 @@ GARROW_AVAILABLE_IN_16_0 GArrowStrptimeOptions * garrow_strptime_options_new(void); -#define GARROW_TYPE_STRFTIME_OPTIONS \ - (garrow_strftime_options_get_type()) +#define GARROW_TYPE_STRFTIME_OPTIONS (garrow_strftime_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowStrftimeOptions, garrow_strftime_options, GARROW, @@ -1145,8 +1040,7 @@ GARROW_AVAILABLE_IN_16_0 GArrowStrftimeOptions * garrow_strftime_options_new(void); -#define GARROW_TYPE_SPLIT_PATTERN_OPTIONS \ - (garrow_split_pattern_options_get_type()) +#define GARROW_TYPE_SPLIT_PATTERN_OPTIONS (garrow_split_pattern_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowSplitPatternOptions, garrow_split_pattern_options, GARROW, @@ -1161,8 +1055,7 @@ GARROW_AVAILABLE_IN_16_0 GArrowSplitPatternOptions * garrow_split_pattern_options_new(void); -#define GARROW_TYPE_STRUCT_FIELD_OPTIONS \ - (garrow_struct_field_options_get_type()) +#define GARROW_TYPE_STRUCT_FIELD_OPTIONS (garrow_struct_field_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowStructFieldOptions, garrow_struct_field_options, GARROW, diff --git a/c_glib/arrow-glib/compute.hpp b/c_glib/arrow-glib/compute.hpp index 4179a9ee733fd..0abf62f7d2efc 100644 --- a/c_glib/arrow-glib/compute.hpp +++ b/c_glib/arrow-glib/compute.hpp @@ -24,22 +24,17 @@ #include - arrow::Result garrow_field_reference_resolve_raw(const gchar *reference); - arrow::compute::ExecContext * garrow_execute_context_get_raw(GArrowExecuteContext *context); - GArrowFunctionOptions * -garrow_function_options_new_raw( - const arrow::compute::FunctionOptions *arrow_options); +garrow_function_options_new_raw(const arrow::compute::FunctionOptions *arrow_options); arrow::compute::FunctionOptions * garrow_function_options_get_raw(GArrowFunctionOptions *options); - GArrowFunctionDoc * garrow_function_doc_new_raw(const arrow::compute::FunctionDoc *arrow_doc); arrow::compute::FunctionDoc * @@ -50,143 +45,109 @@ garrow_function_new_raw(std::shared_ptr *arrow_functio std::shared_ptr garrow_function_get_raw(GArrowFunction *function); - GArrowExecuteNodeOptions * -garrow_execute_node_options_new_raw( - arrow::acero::ExecNodeOptions *arrow_options); +garrow_execute_node_options_new_raw(arrow::acero::ExecNodeOptions *arrow_options); arrow::acero::ExecNodeOptions * garrow_execute_node_options_get_raw(GArrowExecuteNodeOptions *options); - GArrowExecuteNode * -garrow_execute_node_new_raw( - arrow::acero::ExecNode* arrow_node, - GArrowExecuteNodeOptions *options); +garrow_execute_node_new_raw(arrow::acero::ExecNode *arrow_node, + GArrowExecuteNodeOptions *options); arrow::acero::ExecNode * garrow_execute_node_get_raw(GArrowExecuteNode *node); - std::shared_ptr garrow_execute_plan_get_raw(GArrowExecutePlan *plan); - GArrowCastOptions * garrow_cast_options_new_raw(const arrow::compute::CastOptions *arrow_options); arrow::compute::CastOptions * garrow_cast_options_get_raw(GArrowCastOptions *options); - GArrowScalarAggregateOptions * garrow_scalar_aggregate_options_new_raw( const arrow::compute::ScalarAggregateOptions *arrow_options); arrow::compute::ScalarAggregateOptions * -garrow_scalar_aggregate_options_get_raw( - GArrowScalarAggregateOptions *options); - +garrow_scalar_aggregate_options_get_raw(GArrowScalarAggregateOptions *options); GArrowCountOptions * -garrow_count_options_new_raw( - const arrow::compute::CountOptions *arrow_options); +garrow_count_options_new_raw(const arrow::compute::CountOptions *arrow_options); arrow::compute::CountOptions * garrow_count_options_get_raw(GArrowCountOptions *options); - GArrowFilterOptions * -garrow_filter_options_new_raw( - const arrow::compute::FilterOptions *arrow_options); +garrow_filter_options_new_raw(const arrow::compute::FilterOptions *arrow_options); arrow::compute::FilterOptions * garrow_filter_options_get_raw(GArrowFilterOptions *options); - GArrowTakeOptions * -garrow_take_options_new_raw( - const arrow::compute::TakeOptions *arrow_options); +garrow_take_options_new_raw(const arrow::compute::TakeOptions *arrow_options); arrow::compute::TakeOptions * garrow_take_options_get_raw(GArrowTakeOptions *options); - GArrowArraySortOptions * -garrow_array_sort_options_new_raw( - const arrow::compute::ArraySortOptions *arrow_options); +garrow_array_sort_options_new_raw(const arrow::compute::ArraySortOptions *arrow_options); arrow::compute::ArraySortOptions * garrow_array_sort_options_get_raw(GArrowArraySortOptions *options); - GArrowSortKey * garrow_sort_key_new_raw(const arrow::compute::SortKey &arrow_sort_key); arrow::compute::SortKey * garrow_sort_key_get_raw(GArrowSortKey *sort_key); - GArrowSortOptions * -garrow_sort_options_new_raw( - const arrow::compute::SortOptions *arrow_options); +garrow_sort_options_new_raw(const arrow::compute::SortOptions *arrow_options); arrow::compute::SortOptions * garrow_sort_options_get_raw(GArrowSortOptions *options); - GArrowSetLookupOptions * -garrow_set_lookup_options_new_raw( - const arrow::compute::SetLookupOptions *arrow_options); +garrow_set_lookup_options_new_raw(const arrow::compute::SetLookupOptions *arrow_options); arrow::compute::SetLookupOptions * garrow_set_lookup_options_get_raw(GArrowSetLookupOptions *options); - GArrowVarianceOptions * -garrow_variance_options_new_raw( - const arrow::compute::VarianceOptions *arrow_options); +garrow_variance_options_new_raw(const arrow::compute::VarianceOptions *arrow_options); arrow::compute::VarianceOptions * garrow_variance_options_get_raw(GArrowVarianceOptions *options); - GArrowRoundOptions * -garrow_round_options_new_raw( - const arrow::compute::RoundOptions *arrow_options); +garrow_round_options_new_raw(const arrow::compute::RoundOptions *arrow_options); arrow::compute::RoundOptions * garrow_round_options_get_raw(GArrowRoundOptions *options); - GArrowRoundToMultipleOptions * garrow_round_to_multiple_options_new_raw( const arrow::compute::RoundToMultipleOptions *arrow_options); arrow::compute::RoundToMultipleOptions * garrow_round_to_multiple_options_get_raw(GArrowRoundToMultipleOptions *options); - GArrowMatchSubstringOptions * garrow_match_substring_options_new_raw( const arrow::compute::MatchSubstringOptions *arrow_options); arrow::compute::MatchSubstringOptions * garrow_match_substring_options_get_raw(GArrowMatchSubstringOptions *options); - GArrowUTF8NormalizeOptions * garrow_utf8_normalize_options_new_raw( const arrow::compute::Utf8NormalizeOptions *arrow_options); arrow::compute::Utf8NormalizeOptions * garrow_utf8_normalize_options_get_raw(GArrowUTF8NormalizeOptions *options); - GArrowQuantileOptions * -garrow_quantile_options_new_raw( - const arrow::compute::QuantileOptions *arrow_options); +garrow_quantile_options_new_raw(const arrow::compute::QuantileOptions *arrow_options); arrow::compute::QuantileOptions * garrow_quantile_options_get_raw(GArrowQuantileOptions *options); - GArrowIndexOptions * -garrow_index_options_new_raw( - const arrow::compute::IndexOptions *arrow_options); +garrow_index_options_new_raw(const arrow::compute::IndexOptions *arrow_options); arrow::compute::IndexOptions * garrow_index_options_get_raw(GArrowIndexOptions *options); - GArrowRankOptions * garrow_rank_options_new_raw(const arrow::compute::RankOptions *arrow_options); arrow::compute::RankOptions * garrow_rank_options_get_raw(GArrowRankOptions *options); - GArrowRunEndEncodeOptions * garrow_run_end_encode_options_new_raw( const arrow::compute::RunEndEncodeOptions *arrow_options); @@ -194,14 +155,12 @@ arrow::compute::RunEndEncodeOptions * garrow_run_end_encode_options_get_raw(GArrowRunEndEncodeOptions *options); GArrowStrptimeOptions * -garrow_strptime_options_new_raw( - const arrow::compute::StrptimeOptions *arrow_options); +garrow_strptime_options_new_raw(const arrow::compute::StrptimeOptions *arrow_options); arrow::compute::StrptimeOptions * garrow_strptime_options_get_raw(GArrowStrptimeOptions *options); GArrowStrftimeOptions * -garrow_strftime_options_new_raw( - const arrow::compute::StrftimeOptions *arrow_options); +garrow_strftime_options_new_raw(const arrow::compute::StrftimeOptions *arrow_options); arrow::compute::StrftimeOptions * garrow_strftime_options_get_raw(GArrowStrftimeOptions *options); diff --git a/c_glib/arrow-glib/datum.cpp b/c_glib/arrow-glib/datum.cpp index 705eb3144d604..a77f44e8dabcb 100644 --- a/c_glib/arrow-glib/datum.cpp +++ b/c_glib/arrow-glib/datum.cpp @@ -45,7 +45,8 @@ G_BEGIN_DECLS * #GArrowTableDatum is a class to hold an #GArrowTable. */ -typedef struct GArrowDatumPrivate_ { +typedef struct GArrowDatumPrivate_ +{ arrow::Datum datum; } GArrowDatumPrivate; @@ -55,10 +56,8 @@ enum { G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowDatum, garrow_datum, G_TYPE_OBJECT) -#define GARROW_DATUM_GET_PRIVATE(obj) \ - static_cast( \ - garrow_datum_get_instance_private( \ - GARROW_DATUM(obj))) +#define GARROW_DATUM_GET_PRIVATE(obj) \ + static_cast(garrow_datum_get_instance_private(GARROW_DATUM(obj))) static void garrow_datum_finalize(GObject *object) @@ -92,7 +91,7 @@ static void garrow_datum_init(GArrowDatum *object) { auto priv = GARROW_DATUM_GET_PRIVATE(object); - new(&priv->datum) arrow::Datum; + new (&priv->datum) arrow::Datum; } static void @@ -100,15 +99,15 @@ garrow_datum_class_init(GArrowDatumClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_datum_finalize; + gobject_class->finalize = garrow_datum_finalize; gobject_class->set_property = garrow_datum_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("datum", - "Datum", - "The raw arrow::Datum *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "datum", + "Datum", + "The raw arrow::Datum *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_DATUM, spec); } @@ -211,8 +210,8 @@ garrow_datum_to_string(GArrowDatum *datum) return g_strdup(string.c_str()); } - -typedef struct GArrowArrayDatumPrivate_ { +typedef struct GArrowArrayDatumPrivate_ +{ GArrowArray *value; } GArrowArrayDatumPrivate; @@ -220,14 +219,11 @@ enum { PROP_VALUE = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowArrayDatum, - garrow_array_datum, - GARROW_TYPE_DATUM) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowArrayDatum, garrow_array_datum, GARROW_TYPE_DATUM) -#define GARROW_ARRAY_DATUM_GET_PRIVATE(obj) \ - static_cast( \ - garrow_array_datum_get_instance_private( \ - GARROW_ARRAY_DATUM(obj))) +#define GARROW_ARRAY_DATUM_GET_PRIVATE(obj) \ + static_cast( \ + garrow_array_datum_get_instance_private(GARROW_ARRAY_DATUM(obj))) static void garrow_array_datum_dispose(GObject *object) @@ -288,17 +284,17 @@ garrow_array_datum_class_init(GArrowArrayDatumClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_array_datum_dispose; + gobject_class->dispose = garrow_array_datum_dispose; gobject_class->set_property = garrow_array_datum_set_property; gobject_class->get_property = garrow_array_datum_get_property; GParamSpec *spec; - spec = g_param_spec_object("value", - "Value", - "The array held by this datum", - GARROW_TYPE_ARRAY, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "value", + "Value", + "The array held by this datum", + GARROW_TYPE_ARRAY, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_VALUE, spec); } @@ -318,19 +314,16 @@ garrow_array_datum_new(GArrowArray *value) return garrow_array_datum_new_raw(&arrow_datum, value); } - -typedef struct GArrowScalarDatumPrivate_ { +typedef struct GArrowScalarDatumPrivate_ +{ GArrowScalar *value; } GArrowScalarDatumPrivate; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowScalarDatum, - garrow_scalar_datum, - GARROW_TYPE_DATUM) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowScalarDatum, garrow_scalar_datum, GARROW_TYPE_DATUM) -#define GARROW_SCALAR_DATUM_GET_PRIVATE(obj) \ - static_cast( \ - garrow_scalar_datum_get_instance_private( \ - GARROW_SCALAR_DATUM(obj))) +#define GARROW_SCALAR_DATUM_GET_PRIVATE(obj) \ + static_cast( \ + garrow_scalar_datum_get_instance_private(GARROW_SCALAR_DATUM(obj))) static void garrow_scalar_datum_dispose(GObject *object) @@ -391,17 +384,17 @@ garrow_scalar_datum_class_init(GArrowScalarDatumClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_scalar_datum_dispose; + gobject_class->dispose = garrow_scalar_datum_dispose; gobject_class->set_property = garrow_scalar_datum_set_property; gobject_class->get_property = garrow_scalar_datum_get_property; GParamSpec *spec; - spec = g_param_spec_object("value", - "Value", - "The scalar held by this datum", - GARROW_TYPE_SCALAR, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "value", + "Value", + "The scalar held by this datum", + GARROW_TYPE_SCALAR, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_VALUE, spec); } @@ -421,8 +414,8 @@ garrow_scalar_datum_new(GArrowScalar *value) return garrow_scalar_datum_new_raw(&arrow_datum, value); } - -typedef struct GArrowChunkedArrayDatumPrivate_ { +typedef struct GArrowChunkedArrayDatumPrivate_ +{ GArrowChunkedArray *value; } GArrowChunkedArrayDatumPrivate; @@ -430,10 +423,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowChunkedArrayDatum, garrow_chunked_array_datum, GARROW_TYPE_DATUM) -#define GARROW_CHUNKED_ARRAY_DATUM_GET_PRIVATE(obj) \ - static_cast( \ - garrow_chunked_array_datum_get_instance_private( \ - GARROW_CHUNKED_ARRAY_DATUM(obj))) +#define GARROW_CHUNKED_ARRAY_DATUM_GET_PRIVATE(obj) \ + static_cast( \ + garrow_chunked_array_datum_get_instance_private(GARROW_CHUNKED_ARRAY_DATUM(obj))) static void garrow_chunked_array_datum_dispose(GObject *object) @@ -494,17 +486,17 @@ garrow_chunked_array_datum_class_init(GArrowChunkedArrayDatumClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_chunked_array_datum_dispose; + gobject_class->dispose = garrow_chunked_array_datum_dispose; gobject_class->set_property = garrow_chunked_array_datum_set_property; gobject_class->get_property = garrow_chunked_array_datum_get_property; GParamSpec *spec; - spec = g_param_spec_object("value", - "Value", - "The chunked array held by this datum", - GARROW_TYPE_CHUNKED_ARRAY, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "value", + "Value", + "The chunked array held by this datum", + GARROW_TYPE_CHUNKED_ARRAY, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_VALUE, spec); } @@ -524,8 +516,8 @@ garrow_chunked_array_datum_new(GArrowChunkedArray *value) return garrow_chunked_array_datum_new_raw(&arrow_datum, value); } - -typedef struct GArrowRecordBatchDatumPrivate_ { +typedef struct GArrowRecordBatchDatumPrivate_ +{ GArrowRecordBatch *value; } GArrowRecordBatchDatumPrivate; @@ -533,10 +525,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowRecordBatchDatum, garrow_record_batch_datum, GARROW_TYPE_DATUM) -#define GARROW_RECORD_BATCH_DATUM_GET_PRIVATE(obj) \ - static_cast( \ - garrow_record_batch_datum_get_instance_private( \ - GARROW_RECORD_BATCH_DATUM(obj))) +#define GARROW_RECORD_BATCH_DATUM_GET_PRIVATE(obj) \ + static_cast( \ + garrow_record_batch_datum_get_instance_private(GARROW_RECORD_BATCH_DATUM(obj))) static void garrow_record_batch_datum_dispose(GObject *object) @@ -597,17 +588,17 @@ garrow_record_batch_datum_class_init(GArrowRecordBatchDatumClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_record_batch_datum_dispose; + gobject_class->dispose = garrow_record_batch_datum_dispose; gobject_class->set_property = garrow_record_batch_datum_set_property; gobject_class->get_property = garrow_record_batch_datum_get_property; GParamSpec *spec; - spec = g_param_spec_object("value", - "Value", - "The chunked array held by this datum", - GARROW_TYPE_RECORD_BATCH, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "value", + "Value", + "The chunked array held by this datum", + GARROW_TYPE_RECORD_BATCH, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_VALUE, spec); } @@ -627,19 +618,16 @@ garrow_record_batch_datum_new(GArrowRecordBatch *value) return garrow_record_batch_datum_new_raw(&arrow_datum, value); } - -typedef struct GArrowTableDatumPrivate_ { +typedef struct GArrowTableDatumPrivate_ +{ GArrowTable *value; } GArrowTableDatumPrivate; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowTableDatum, - garrow_table_datum, - GARROW_TYPE_DATUM) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowTableDatum, garrow_table_datum, GARROW_TYPE_DATUM) -#define GARROW_TABLE_DATUM_GET_PRIVATE(obj) \ - static_cast( \ - garrow_table_datum_get_instance_private( \ - GARROW_TABLE_DATUM(obj))) +#define GARROW_TABLE_DATUM_GET_PRIVATE(obj) \ + static_cast( \ + garrow_table_datum_get_instance_private(GARROW_TABLE_DATUM(obj))) static void garrow_table_datum_dispose(GObject *object) @@ -700,17 +688,17 @@ garrow_table_datum_class_init(GArrowTableDatumClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_table_datum_dispose; + gobject_class->dispose = garrow_table_datum_dispose; gobject_class->set_property = garrow_table_datum_set_property; gobject_class->get_property = garrow_table_datum_get_property; GParamSpec *spec; - spec = g_param_spec_object("value", - "Value", - "The table held by this datum", - GARROW_TYPE_TABLE, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "value", + "Value", + "The table held by this datum", + GARROW_TYPE_TABLE, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_VALUE, spec); } @@ -730,7 +718,6 @@ garrow_table_datum_new(GArrowTable *value) return garrow_table_datum_new_raw(&arrow_datum, value); } - G_END_DECLS arrow::Datum @@ -793,51 +780,44 @@ garrow_datum_new_raw(arrow::Datum *arrow_datum) } GArrowScalarDatum * -garrow_scalar_datum_new_raw(arrow::Datum *arrow_datum, - GArrowScalar *value) +garrow_scalar_datum_new_raw(arrow::Datum *arrow_datum, GArrowScalar *value) { - return GARROW_SCALAR_DATUM(g_object_new(GARROW_TYPE_SCALAR_DATUM, - "datum", arrow_datum, - "value", value, - NULL)); + return GARROW_SCALAR_DATUM( + g_object_new(GARROW_TYPE_SCALAR_DATUM, "datum", arrow_datum, "value", value, NULL)); } GArrowArrayDatum * -garrow_array_datum_new_raw(arrow::Datum *arrow_datum, - GArrowArray *value) +garrow_array_datum_new_raw(arrow::Datum *arrow_datum, GArrowArray *value) { - return GARROW_ARRAY_DATUM(g_object_new(GARROW_TYPE_ARRAY_DATUM, - "datum", arrow_datum, - "value", value, - NULL)); + return GARROW_ARRAY_DATUM( + g_object_new(GARROW_TYPE_ARRAY_DATUM, "datum", arrow_datum, "value", value, NULL)); } GArrowChunkedArrayDatum * -garrow_chunked_array_datum_new_raw(arrow::Datum *arrow_datum, - GArrowChunkedArray *value) +garrow_chunked_array_datum_new_raw(arrow::Datum *arrow_datum, GArrowChunkedArray *value) { return GARROW_CHUNKED_ARRAY_DATUM(g_object_new(GARROW_TYPE_CHUNKED_ARRAY_DATUM, - "datum", arrow_datum, - "value", value, + "datum", + arrow_datum, + "value", + value, NULL)); } GArrowRecordBatchDatum * -garrow_record_batch_datum_new_raw(arrow::Datum *arrow_datum, - GArrowRecordBatch *value) +garrow_record_batch_datum_new_raw(arrow::Datum *arrow_datum, GArrowRecordBatch *value) { return GARROW_RECORD_BATCH_DATUM(g_object_new(GARROW_TYPE_RECORD_BATCH_DATUM, - "datum", arrow_datum, - "value", value, + "datum", + arrow_datum, + "value", + value, NULL)); } GArrowTableDatum * -garrow_table_datum_new_raw(arrow::Datum *arrow_datum, - GArrowTable *value) +garrow_table_datum_new_raw(arrow::Datum *arrow_datum, GArrowTable *value) { - return GARROW_TABLE_DATUM(g_object_new(GARROW_TYPE_TABLE_DATUM, - "datum", arrow_datum, - "value", value, - NULL)); + return GARROW_TABLE_DATUM( + g_object_new(GARROW_TYPE_TABLE_DATUM, "datum", arrow_datum, "value", value, NULL)); } diff --git a/c_glib/arrow-glib/datum.h b/c_glib/arrow-glib/datum.h index bc7dda369117c..df5e9a1c2cf4f 100644 --- a/c_glib/arrow-glib/datum.h +++ b/c_glib/arrow-glib/datum.h @@ -28,63 +28,60 @@ G_BEGIN_DECLS #define GARROW_TYPE_DATUM (garrow_datum_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowDatum, - garrow_datum, - GARROW, - DATUM, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowDatum, garrow_datum, GARROW, DATUM, GObject) struct _GArrowDatumClass { GObjectClass parent_class; }; GARROW_AVAILABLE_IN_1_0 -gboolean garrow_datum_is_array(GArrowDatum *datum); +gboolean +garrow_datum_is_array(GArrowDatum *datum); GARROW_AVAILABLE_IN_1_0 -gboolean garrow_datum_is_array_like(GArrowDatum *datum); +gboolean +garrow_datum_is_array_like(GArrowDatum *datum); GARROW_AVAILABLE_IN_5_0 -gboolean garrow_datum_is_scalar(GArrowDatum *datum); +gboolean +garrow_datum_is_scalar(GArrowDatum *datum); GARROW_AVAILABLE_IN_5_0 -gboolean garrow_datum_is_value(GArrowDatum *datum); +gboolean +garrow_datum_is_value(GArrowDatum *datum); /* GARROW_AVAILABLE_IN_5_0 gboolean garrow_datum_is_collection(GArrowDatum *datum); */ GARROW_AVAILABLE_IN_1_0 -gboolean garrow_datum_equal(GArrowDatum *datum, - GArrowDatum *other_datum); +gboolean +garrow_datum_equal(GArrowDatum *datum, GArrowDatum *other_datum); GARROW_AVAILABLE_IN_1_0 -gchar *garrow_datum_to_string(GArrowDatum *datum); +gchar * +garrow_datum_to_string(GArrowDatum *datum); /* GARROW_TYPE_NONE_DATUM */ #define GARROW_TYPE_SCALAR_DATUM (garrow_scalar_datum_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowScalarDatum, - garrow_scalar_datum, - GARROW, - SCALAR_DATUM, - GArrowDatum) +G_DECLARE_DERIVABLE_TYPE( + GArrowScalarDatum, garrow_scalar_datum, GARROW, SCALAR_DATUM, GArrowDatum) struct _GArrowScalarDatumClass { GArrowDatumClass parent_class; }; GARROW_AVAILABLE_IN_5_0 -GArrowScalarDatum *garrow_scalar_datum_new(GArrowScalar *value); +GArrowScalarDatum * +garrow_scalar_datum_new(GArrowScalar *value); #define GARROW_TYPE_ARRAY_DATUM (garrow_array_datum_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowArrayDatum, - garrow_array_datum, - GARROW, - ARRAY_DATUM, - GArrowDatum) +G_DECLARE_DERIVABLE_TYPE( + GArrowArrayDatum, garrow_array_datum, GARROW, ARRAY_DATUM, GArrowDatum) struct _GArrowArrayDatumClass { GArrowDatumClass parent_class; }; GARROW_AVAILABLE_IN_1_0 -GArrowArrayDatum *garrow_array_datum_new(GArrowArray *value); +GArrowArrayDatum * +garrow_array_datum_new(GArrowArray *value); #define GARROW_TYPE_CHUNKED_ARRAY_DATUM (garrow_chunked_array_datum_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowChunkedArrayDatum, @@ -117,18 +114,16 @@ GArrowRecordBatchDatum * garrow_record_batch_datum_new(GArrowRecordBatch *value); #define GARROW_TYPE_TABLE_DATUM (garrow_table_datum_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowTableDatum, - garrow_table_datum, - GARROW, - TABLE_DATUM, - GArrowDatum) +G_DECLARE_DERIVABLE_TYPE( + GArrowTableDatum, garrow_table_datum, GARROW, TABLE_DATUM, GArrowDatum) struct _GArrowTableDatumClass { GArrowDatumClass parent_class; }; GARROW_AVAILABLE_IN_1_0 -GArrowTableDatum *garrow_table_datum_new(GArrowTable *value); +GArrowTableDatum * +garrow_table_datum_new(GArrowTable *value); /* GARROW_TYPE_COLLECTION_DATUM */ diff --git a/c_glib/arrow-glib/datum.hpp b/c_glib/arrow-glib/datum.hpp index d1acfc58c93b2..dc985f956f8b9 100644 --- a/c_glib/arrow-glib/datum.hpp +++ b/c_glib/arrow-glib/datum.hpp @@ -29,17 +29,12 @@ GArrowDatum * garrow_datum_new_raw(arrow::Datum *arrow_datum); GArrowScalarDatum * -garrow_scalar_datum_new_raw(arrow::Datum *arrow_datum, - GArrowScalar *value); +garrow_scalar_datum_new_raw(arrow::Datum *arrow_datum, GArrowScalar *value); GArrowArrayDatum * -garrow_array_datum_new_raw(arrow::Datum *arrow_datum, - GArrowArray *value); +garrow_array_datum_new_raw(arrow::Datum *arrow_datum, GArrowArray *value); GArrowChunkedArrayDatum * -garrow_chunked_array_datum_new_raw(arrow::Datum *arrow_datum, - GArrowChunkedArray *value); +garrow_chunked_array_datum_new_raw(arrow::Datum *arrow_datum, GArrowChunkedArray *value); GArrowRecordBatchDatum * -garrow_record_batch_datum_new_raw(arrow::Datum *arrow_datum, - GArrowRecordBatch *value); +garrow_record_batch_datum_new_raw(arrow::Datum *arrow_datum, GArrowRecordBatch *value); GArrowTableDatum * -garrow_table_datum_new_raw(arrow::Datum *arrow_datum, - GArrowTable *value); +garrow_table_datum_new_raw(arrow::Datum *arrow_datum, GArrowTable *value); diff --git a/c_glib/arrow-glib/decimal.cpp b/c_glib/arrow-glib/decimal.cpp index 51560f3360103..5947868edd3bc 100644 --- a/c_glib/arrow-glib/decimal.cpp +++ b/c_glib/arrow-glib/decimal.cpp @@ -20,12 +20,12 @@ #include #include -template -struct DecimalConverter { +template struct DecimalConverter +{ }; -template <> -struct DecimalConverter { +template <> struct DecimalConverter +{ using ArrowType = arrow::Decimal128; using GArrowType = GArrowDecimal128; @@ -42,27 +42,27 @@ struct DecimalConverter { } }; -template <> -struct DecimalConverter { +template <> struct DecimalConverter +{ using ArrowType = arrow::Decimal256; using GArrowType = GArrowDecimal256; GArrowType * - new_raw(std::shared_ptr *arrow_decimal256) { + new_raw(std::shared_ptr *arrow_decimal256) + { return garrow_decimal256_new_raw(arrow_decimal256); } std::shared_ptr - get_raw(GArrowType *decimal256) { + get_raw(GArrowType *decimal256) + { return garrow_decimal256_get_raw(decimal256); } }; template typename DecimalConverter::GArrowType * -garrow_decimal_new_string(const gchar *data, - GError **error, - const gchar *tag) +garrow_decimal_new_string(const gchar *data, GError **error, const gchar *tag) { auto arrow_decimal_result = Decimal::FromString(data); if (garrow::check(error, arrow_decimal_result, tag)) { @@ -128,8 +128,9 @@ garrow_decimal_less_than(typename DecimalConverter::GArrowType *decimal template gboolean -garrow_decimal_less_than_or_equal(typename DecimalConverter::GArrowType *decimal, - typename DecimalConverter::GArrowType *other_decimal) +garrow_decimal_less_than_or_equal( + typename DecimalConverter::GArrowType *decimal, + typename DecimalConverter::GArrowType *other_decimal) { DecimalConverter converter; const auto arrow_decimal = converter.get_raw(decimal); @@ -150,8 +151,9 @@ garrow_decimal_greater_than(typename DecimalConverter::GArrowType *deci template gboolean -garrow_decimal_greater_than_or_equal(typename DecimalConverter::GArrowType *decimal, - typename DecimalConverter::GArrowType *other_decimal) +garrow_decimal_greater_than_or_equal( + typename DecimalConverter::GArrowType *decimal, + typename DecimalConverter::GArrowType *other_decimal) { DecimalConverter converter; const auto arrow_decimal = converter.get_raw(decimal); @@ -294,7 +296,6 @@ garrow_decimal_rescale(typename DecimalConverter::GArrowType *decimal, } } - G_BEGIN_DECLS /** @@ -310,7 +311,8 @@ G_BEGIN_DECLS * Since: 0.10.0 */ -typedef struct GArrowDecimal128Private_ { +typedef struct GArrowDecimal128Private_ +{ std::shared_ptr decimal128; } GArrowDecimal128Private; @@ -318,14 +320,11 @@ enum { PROP_DECIMAL128 = 1 }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowDecimal128, - garrow_decimal128, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowDecimal128, garrow_decimal128, G_TYPE_OBJECT) -#define GARROW_DECIMAL128_GET_PRIVATE(obj) \ - static_cast( \ - garrow_decimal128_get_instance_private( \ - GARROW_DECIMAL128(obj))) +#define GARROW_DECIMAL128_GET_PRIVATE(obj) \ + static_cast( \ + garrow_decimal128_get_instance_private(GARROW_DECIMAL128(obj))) static void garrow_decimal128_finalize(GObject *object) @@ -360,7 +359,7 @@ static void garrow_decimal128_init(GArrowDecimal128 *object) { auto priv = GARROW_DECIMAL128_GET_PRIVATE(object); - new(&priv->decimal128) std::shared_ptr; + new (&priv->decimal128) std::shared_ptr; } static void @@ -370,14 +369,14 @@ garrow_decimal128_class_init(GArrowDecimal128Class *klass) auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_decimal128_finalize; + gobject_class->finalize = garrow_decimal128_finalize; gobject_class->set_property = garrow_decimal128_set_property; - spec = g_param_spec_pointer("decimal128", - "Decimal128", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "decimal128", + "Decimal128", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_DECIMAL128, spec); } @@ -394,8 +393,9 @@ garrow_decimal128_class_init(GArrowDecimal128Class *klass) GArrowDecimal128 * garrow_decimal128_new_string(const gchar *data, GError **error) { - return garrow_decimal_new_string( - data, error, "[decimal128][new][string]"); + return garrow_decimal_new_string(data, + error, + "[decimal128][new][string]"); } /** @@ -437,8 +437,7 @@ garrow_decimal128_copy(GArrowDecimal128 *decimal) * Since: 0.12.0 */ gboolean -garrow_decimal128_equal(GArrowDecimal128 *decimal, - GArrowDecimal128 *other_decimal) +garrow_decimal128_equal(GArrowDecimal128 *decimal, GArrowDecimal128 *other_decimal) { return garrow_decimal_equal(decimal, other_decimal); } @@ -454,8 +453,7 @@ garrow_decimal128_equal(GArrowDecimal128 *decimal, * Since: 0.12.0 */ gboolean -garrow_decimal128_not_equal(GArrowDecimal128 *decimal, - GArrowDecimal128 *other_decimal) +garrow_decimal128_not_equal(GArrowDecimal128 *decimal, GArrowDecimal128 *other_decimal) { return garrow_decimal_not_equal(decimal, other_decimal); } @@ -471,8 +469,7 @@ garrow_decimal128_not_equal(GArrowDecimal128 *decimal, * Since: 0.12.0 */ gboolean -garrow_decimal128_less_than(GArrowDecimal128 *decimal, - GArrowDecimal128 *other_decimal) +garrow_decimal128_less_than(GArrowDecimal128 *decimal, GArrowDecimal128 *other_decimal) { return garrow_decimal_less_than(decimal, other_decimal); } @@ -505,8 +502,7 @@ garrow_decimal128_less_than_or_equal(GArrowDecimal128 *decimal, * Since: 0.12.0 */ gboolean -garrow_decimal128_greater_than(GArrowDecimal128 *decimal, - GArrowDecimal128 *other_decimal) +garrow_decimal128_greater_than(GArrowDecimal128 *decimal, GArrowDecimal128 *other_decimal) { return garrow_decimal_greater_than(decimal, other_decimal); } @@ -628,8 +624,7 @@ garrow_decimal128_to_integer(GArrowDecimal128 *decimal) * Since: 0.11.0 */ GArrowDecimal128 * -garrow_decimal128_plus(GArrowDecimal128 *left, - GArrowDecimal128 *right) +garrow_decimal128_plus(GArrowDecimal128 *left, GArrowDecimal128 *right) { return garrow_decimal_plus(left, right); } @@ -644,8 +639,7 @@ garrow_decimal128_plus(GArrowDecimal128 *left, * Since: 0.11.0 */ GArrowDecimal128 * -garrow_decimal128_minus(GArrowDecimal128 *left, - GArrowDecimal128 *right) +garrow_decimal128_minus(GArrowDecimal128 *left, GArrowDecimal128 *right) { return garrow_decimal_minus(left, right); } @@ -660,8 +654,7 @@ garrow_decimal128_minus(GArrowDecimal128 *left, * Since: 0.11.0 */ GArrowDecimal128 * -garrow_decimal128_multiply(GArrowDecimal128 *left, - GArrowDecimal128 *right) +garrow_decimal128_multiply(GArrowDecimal128 *left, GArrowDecimal128 *right) { return garrow_decimal_multiply(left, right); } @@ -717,8 +710,8 @@ garrow_decimal128_rescale(GArrowDecimal128 *decimal, "[decimal128][rescale]"); } - -typedef struct GArrowDecimal256Private_ { +typedef struct GArrowDecimal256Private_ +{ std::shared_ptr decimal256; } GArrowDecimal256Private; @@ -726,14 +719,11 @@ enum { PROP_DECIMAL256 = 1 }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowDecimal256, - garrow_decimal256, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowDecimal256, garrow_decimal256, G_TYPE_OBJECT) -#define GARROW_DECIMAL256_GET_PRIVATE(obj) \ - static_cast( \ - garrow_decimal256_get_instance_private( \ - GARROW_DECIMAL256(obj))) +#define GARROW_DECIMAL256_GET_PRIVATE(obj) \ + static_cast( \ + garrow_decimal256_get_instance_private(GARROW_DECIMAL256(obj))) static void garrow_decimal256_finalize(GObject *object) @@ -768,7 +758,7 @@ static void garrow_decimal256_init(GArrowDecimal256 *object) { auto priv = GARROW_DECIMAL256_GET_PRIVATE(object); - new(&priv->decimal256) std::shared_ptr; + new (&priv->decimal256) std::shared_ptr; } static void @@ -778,14 +768,14 @@ garrow_decimal256_class_init(GArrowDecimal256Class *klass) auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_decimal256_finalize; + gobject_class->finalize = garrow_decimal256_finalize; gobject_class->set_property = garrow_decimal256_set_property; - spec = g_param_spec_pointer("decimal256", - "Decimal256", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "decimal256", + "Decimal256", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_DECIMAL256, spec); } @@ -802,8 +792,9 @@ garrow_decimal256_class_init(GArrowDecimal256Class *klass) GArrowDecimal256 * garrow_decimal256_new_string(const gchar *data, GError **error) { - return garrow_decimal_new_string( - data, error, "[decimal256][new][string]"); + return garrow_decimal_new_string(data, + error, + "[decimal256][new][string]"); } /** @@ -845,8 +836,7 @@ garrow_decimal256_copy(GArrowDecimal256 *decimal) * Since: 3.0.0 */ gboolean -garrow_decimal256_equal(GArrowDecimal256 *decimal, - GArrowDecimal256 *other_decimal) +garrow_decimal256_equal(GArrowDecimal256 *decimal, GArrowDecimal256 *other_decimal) { return garrow_decimal_equal(decimal, other_decimal); } @@ -862,8 +852,7 @@ garrow_decimal256_equal(GArrowDecimal256 *decimal, * Since: 3.0.0 */ gboolean -garrow_decimal256_not_equal(GArrowDecimal256 *decimal, - GArrowDecimal256 *other_decimal) +garrow_decimal256_not_equal(GArrowDecimal256 *decimal, GArrowDecimal256 *other_decimal) { return garrow_decimal_not_equal(decimal, other_decimal); } @@ -879,8 +868,7 @@ garrow_decimal256_not_equal(GArrowDecimal256 *decimal, * Since: 3.0.0 */ gboolean -garrow_decimal256_less_than(GArrowDecimal256 *decimal, - GArrowDecimal256 *other_decimal) +garrow_decimal256_less_than(GArrowDecimal256 *decimal, GArrowDecimal256 *other_decimal) { return garrow_decimal_less_than(decimal, other_decimal); } @@ -913,8 +901,7 @@ garrow_decimal256_less_than_or_equal(GArrowDecimal256 *decimal, * Since: 3.0.0 */ gboolean -garrow_decimal256_greater_than(GArrowDecimal256 *decimal, - GArrowDecimal256 *other_decimal) +garrow_decimal256_greater_than(GArrowDecimal256 *decimal, GArrowDecimal256 *other_decimal) { return garrow_decimal_greater_than(decimal, other_decimal); } @@ -1021,8 +1008,7 @@ garrow_decimal256_negate(GArrowDecimal256 *decimal) * Since: 3.0.0 */ GArrowDecimal256 * -garrow_decimal256_plus(GArrowDecimal256 *left, - GArrowDecimal256 *right) +garrow_decimal256_plus(GArrowDecimal256 *left, GArrowDecimal256 *right) { return garrow_decimal_plus(left, right); } @@ -1037,8 +1023,7 @@ garrow_decimal256_plus(GArrowDecimal256 *left, * Since: 3.0.0 */ GArrowDecimal256 * -garrow_decimal256_multiply(GArrowDecimal256 *left, - GArrowDecimal256 *right) +garrow_decimal256_multiply(GArrowDecimal256 *left, GArrowDecimal256 *right) { return garrow_decimal_multiply(left, right); } @@ -1094,15 +1079,13 @@ garrow_decimal256_rescale(GArrowDecimal256 *decimal, "[decimal256][rescale]"); } - G_END_DECLS GArrowDecimal128 * garrow_decimal128_new_raw(std::shared_ptr *arrow_decimal128) { - auto decimal128 = g_object_new(garrow_decimal128_get_type(), - "decimal128", arrow_decimal128, - NULL); + auto decimal128 = + g_object_new(garrow_decimal128_get_type(), "decimal128", arrow_decimal128, NULL); return GARROW_DECIMAL128(decimal128); } @@ -1116,9 +1099,8 @@ garrow_decimal128_get_raw(GArrowDecimal128 *decimal128) GArrowDecimal256 * garrow_decimal256_new_raw(std::shared_ptr *arrow_decimal256) { - auto decimal256 = g_object_new(garrow_decimal256_get_type(), - "decimal256", arrow_decimal256, - NULL); + auto decimal256 = + g_object_new(garrow_decimal256_get_type(), "decimal256", arrow_decimal256, NULL); return GARROW_DECIMAL256(decimal256); } diff --git a/c_glib/arrow-glib/decimal.h b/c_glib/arrow-glib/decimal.h index 97b521f3fbe94..9c605d4456e2d 100644 --- a/c_glib/arrow-glib/decimal.h +++ b/c_glib/arrow-glib/decimal.h @@ -26,11 +26,7 @@ G_BEGIN_DECLS /* Disabled because it conflicts with GARROW_TYPE_DECIMAL128 in GArrowType. */ /* #define GARROW_TYPE_DECIMAL128 (garrow_decimal128_get_type()) */ -G_DECLARE_DERIVABLE_TYPE(GArrowDecimal128, - garrow_decimal128, - GARROW, - DECIMAL128, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowDecimal128, garrow_decimal128, GARROW, DECIMAL128, GObject) struct _GArrowDecimal128Class { @@ -38,47 +34,57 @@ struct _GArrowDecimal128Class }; GArrowDecimal128 * -garrow_decimal128_new_string(const gchar *data, - GError **error); -GArrowDecimal128 *garrow_decimal128_new_integer(const gint64 data); +garrow_decimal128_new_string(const gchar *data, GError **error); +GArrowDecimal128 * +garrow_decimal128_new_integer(const gint64 data); GARROW_AVAILABLE_IN_3_0 -GArrowDecimal128 *garrow_decimal128_copy(GArrowDecimal128 *decimal); +GArrowDecimal128 * +garrow_decimal128_copy(GArrowDecimal128 *decimal); GARROW_AVAILABLE_IN_0_12 -gboolean garrow_decimal128_equal(GArrowDecimal128 *decimal, - GArrowDecimal128 *other_decimal); +gboolean +garrow_decimal128_equal(GArrowDecimal128 *decimal, GArrowDecimal128 *other_decimal); GARROW_AVAILABLE_IN_0_12 -gboolean garrow_decimal128_not_equal(GArrowDecimal128 *decimal, - GArrowDecimal128 *other_decimal); +gboolean +garrow_decimal128_not_equal(GArrowDecimal128 *decimal, GArrowDecimal128 *other_decimal); GARROW_AVAILABLE_IN_0_12 -gboolean garrow_decimal128_less_than(GArrowDecimal128 *decimal, +gboolean +garrow_decimal128_less_than(GArrowDecimal128 *decimal, GArrowDecimal128 *other_decimal); +GARROW_AVAILABLE_IN_0_12 +gboolean +garrow_decimal128_less_than_or_equal(GArrowDecimal128 *decimal, GArrowDecimal128 *other_decimal); GARROW_AVAILABLE_IN_0_12 -gboolean garrow_decimal128_less_than_or_equal(GArrowDecimal128 *decimal, - GArrowDecimal128 *other_decimal); +gboolean +garrow_decimal128_greater_than(GArrowDecimal128 *decimal, + GArrowDecimal128 *other_decimal); GARROW_AVAILABLE_IN_0_12 -gboolean garrow_decimal128_greater_than(GArrowDecimal128 *decimal, +gboolean +garrow_decimal128_greater_than_or_equal(GArrowDecimal128 *decimal, GArrowDecimal128 *other_decimal); -GARROW_AVAILABLE_IN_0_12 -gboolean garrow_decimal128_greater_than_or_equal(GArrowDecimal128 *decimal, - GArrowDecimal128 *other_decimal); -gchar *garrow_decimal128_to_string_scale(GArrowDecimal128 *decimal, - gint32 scale); -gchar *garrow_decimal128_to_string(GArrowDecimal128 *decimal); -GARROW_AVAILABLE_IN_3_0 -GBytes *garrow_decimal128_to_bytes(GArrowDecimal128 *decimal); -void garrow_decimal128_abs(GArrowDecimal128 *decimal); -void garrow_decimal128_negate(GArrowDecimal128 *decimal); -gint64 garrow_decimal128_to_integer(GArrowDecimal128 *decimal); -GArrowDecimal128 *garrow_decimal128_plus(GArrowDecimal128 *left, - GArrowDecimal128 *right); -GArrowDecimal128 *garrow_decimal128_minus(GArrowDecimal128 *left, - GArrowDecimal128 *right); -GArrowDecimal128 *garrow_decimal128_multiply(GArrowDecimal128 *left, - GArrowDecimal128 *right); -GArrowDecimal128 *garrow_decimal128_divide(GArrowDecimal128 *left, - GArrowDecimal128 *right, - GArrowDecimal128 **remainder, - GError **error); +gchar * +garrow_decimal128_to_string_scale(GArrowDecimal128 *decimal, gint32 scale); +gchar * +garrow_decimal128_to_string(GArrowDecimal128 *decimal); +GARROW_AVAILABLE_IN_3_0 +GBytes * +garrow_decimal128_to_bytes(GArrowDecimal128 *decimal); +void +garrow_decimal128_abs(GArrowDecimal128 *decimal); +void +garrow_decimal128_negate(GArrowDecimal128 *decimal); +gint64 +garrow_decimal128_to_integer(GArrowDecimal128 *decimal); +GArrowDecimal128 * +garrow_decimal128_plus(GArrowDecimal128 *left, GArrowDecimal128 *right); +GArrowDecimal128 * +garrow_decimal128_minus(GArrowDecimal128 *left, GArrowDecimal128 *right); +GArrowDecimal128 * +garrow_decimal128_multiply(GArrowDecimal128 *left, GArrowDecimal128 *right); +GArrowDecimal128 * +garrow_decimal128_divide(GArrowDecimal128 *left, + GArrowDecimal128 *right, + GArrowDecimal128 **remainder, + GError **error); GARROW_AVAILABLE_IN_0_15 GArrowDecimal128 * garrow_decimal128_rescale(GArrowDecimal128 *decimal, @@ -86,14 +92,9 @@ garrow_decimal128_rescale(GArrowDecimal128 *decimal, gint32 new_scale, GError **error); - /* Disabled because it conflicts with GARROW_TYPE_DECIMAL256 in GArrowType. */ /* #define GARROW_TYPE_DECIMAL256 (garrow_decimal256_get_type()) */ -G_DECLARE_DERIVABLE_TYPE(GArrowDecimal256, - garrow_decimal256, - GARROW, - DECIMAL256, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowDecimal256, garrow_decimal256, GARROW, DECIMAL256, GObject) struct _GArrowDecimal256Class { @@ -102,52 +103,61 @@ struct _GArrowDecimal256Class GARROW_AVAILABLE_IN_3_0 GArrowDecimal256 * -garrow_decimal256_new_string(const gchar *data, - GError **error); +garrow_decimal256_new_string(const gchar *data, GError **error); GARROW_AVAILABLE_IN_3_0 -GArrowDecimal256 *garrow_decimal256_new_integer(const gint64 data); +GArrowDecimal256 * +garrow_decimal256_new_integer(const gint64 data); GARROW_AVAILABLE_IN_3_0 -GArrowDecimal256 *garrow_decimal256_copy(GArrowDecimal256 *decimal); +GArrowDecimal256 * +garrow_decimal256_copy(GArrowDecimal256 *decimal); GARROW_AVAILABLE_IN_3_0 -gboolean garrow_decimal256_equal(GArrowDecimal256 *decimal, - GArrowDecimal256 *other_decimal); +gboolean +garrow_decimal256_equal(GArrowDecimal256 *decimal, GArrowDecimal256 *other_decimal); GARROW_AVAILABLE_IN_3_0 -gboolean garrow_decimal256_not_equal(GArrowDecimal256 *decimal, - GArrowDecimal256 *other_decimal); +gboolean +garrow_decimal256_not_equal(GArrowDecimal256 *decimal, GArrowDecimal256 *other_decimal); +GARROW_AVAILABLE_IN_3_0 +gboolean +garrow_decimal256_less_than(GArrowDecimal256 *decimal, GArrowDecimal256 *other_decimal); GARROW_AVAILABLE_IN_3_0 -gboolean garrow_decimal256_less_than(GArrowDecimal256 *decimal, +gboolean +garrow_decimal256_less_than_or_equal(GArrowDecimal256 *decimal, GArrowDecimal256 *other_decimal); GARROW_AVAILABLE_IN_3_0 -gboolean garrow_decimal256_less_than_or_equal(GArrowDecimal256 *decimal, - GArrowDecimal256 *other_decimal); +gboolean +garrow_decimal256_greater_than(GArrowDecimal256 *decimal, + GArrowDecimal256 *other_decimal); GARROW_AVAILABLE_IN_3_0 -gboolean garrow_decimal256_greater_than(GArrowDecimal256 *decimal, +gboolean +garrow_decimal256_greater_than_or_equal(GArrowDecimal256 *decimal, GArrowDecimal256 *other_decimal); GARROW_AVAILABLE_IN_3_0 -gboolean garrow_decimal256_greater_than_or_equal(GArrowDecimal256 *decimal, - GArrowDecimal256 *other_decimal); +gchar * +garrow_decimal256_to_string_scale(GArrowDecimal256 *decimal, gint32 scale); GARROW_AVAILABLE_IN_3_0 -gchar *garrow_decimal256_to_string_scale(GArrowDecimal256 *decimal, - gint32 scale); +gchar * +garrow_decimal256_to_string(GArrowDecimal256 *decimal); GARROW_AVAILABLE_IN_3_0 -gchar *garrow_decimal256_to_string(GArrowDecimal256 *decimal); +GBytes * +garrow_decimal256_to_bytes(GArrowDecimal256 *decimal); GARROW_AVAILABLE_IN_3_0 -GBytes *garrow_decimal256_to_bytes(GArrowDecimal256 *decimal); +void +garrow_decimal256_abs(GArrowDecimal256 *decimal); GARROW_AVAILABLE_IN_3_0 -void garrow_decimal256_abs(GArrowDecimal256 *decimal); +void +garrow_decimal256_negate(GArrowDecimal256 *decimal); GARROW_AVAILABLE_IN_3_0 -void garrow_decimal256_negate(GArrowDecimal256 *decimal); -GARROW_AVAILABLE_IN_3_0 -GArrowDecimal256 *garrow_decimal256_plus(GArrowDecimal256 *left, - GArrowDecimal256 *right); +GArrowDecimal256 * +garrow_decimal256_plus(GArrowDecimal256 *left, GArrowDecimal256 *right); GARROW_AVAILABLE_IN_3_0 -GArrowDecimal256 *garrow_decimal256_multiply(GArrowDecimal256 *left, - GArrowDecimal256 *right); +GArrowDecimal256 * +garrow_decimal256_multiply(GArrowDecimal256 *left, GArrowDecimal256 *right); GARROW_AVAILABLE_IN_3_0 -GArrowDecimal256 *garrow_decimal256_divide(GArrowDecimal256 *left, - GArrowDecimal256 *right, - GArrowDecimal256 **remainder, - GError **error); +GArrowDecimal256 * +garrow_decimal256_divide(GArrowDecimal256 *left, + GArrowDecimal256 *right, + GArrowDecimal256 **remainder, + GError **error); GARROW_AVAILABLE_IN_3_0 GArrowDecimal256 * garrow_decimal256_rescale(GArrowDecimal256 *decimal, diff --git a/c_glib/arrow-glib/error.cpp b/c_glib/arrow-glib/error.cpp index ac61ddc499a78..84a1f69d937f6 100644 --- a/c_glib/arrow-glib/error.cpp +++ b/c_glib/arrow-glib/error.cpp @@ -33,14 +33,12 @@ G_BEGIN_DECLS * values. */ -G_DEFINE_QUARK(garrow-error-quark, garrow_error) +G_DEFINE_QUARK(garrow - error - quark, garrow_error) G_END_DECLS gboolean -garrow_error_check(GError **error, - const arrow::Status &status, - const char *context) +garrow_error_check(GError **error, const arrow::Status &status, const char *context) { return garrow::check(error, status, context); } @@ -85,8 +83,7 @@ garrow_error_from_status(const arrow::Status &status) } arrow::StatusCode -garrow_error_to_status_code(GError *error, - arrow::StatusCode default_code) +garrow_error_to_status_code(GError *error, arrow::StatusCode default_code) { if (error->domain != GARROW_ERROR) { return default_code; @@ -127,9 +124,7 @@ garrow_error_to_status_code(GError *error, } arrow::Status -garrow_error_to_status(GError *error, - arrow::StatusCode default_code, - const char *context) +garrow_error_to_status(GError *error, arrow::StatusCode default_code, const char *context) { std::stringstream message; message << context << ": " << g_quark_to_string(error->domain); @@ -141,9 +136,9 @@ garrow_error_to_status(GError *error, } namespace garrow { - gboolean check(GError **error, - const arrow::Status &status, - const char *context) { + gboolean + check(GError **error, const arrow::Status &status, const char *context) + { if (status.ok()) { return TRUE; } else { @@ -156,4 +151,4 @@ namespace garrow { return FALSE; } } -} +} // namespace garrow diff --git a/c_glib/arrow-glib/error.h b/c_glib/arrow-glib/error.h index d600663592f11..4414417a1a25b 100644 --- a/c_glib/arrow-glib/error.h +++ b/c_glib/arrow-glib/error.h @@ -37,8 +37,10 @@ G_BEGIN_DECLS * @GARROW_ERROR_SERIALIZATION: Serialization error. * @GARROW_ERROR_CODE_GENERATION: Error generating code for expression evaluation * in Gandiva. - * @GARROW_ERROR_EXPRESSION_VALIDATION: Validation errors in expression given for code generation. - * @GARROW_ERROR_EXECUTION: Execution error while evaluating the expression against a record batch. + * @GARROW_ERROR_EXPRESSION_VALIDATION: Validation errors in expression given for code + * generation. + * @GARROW_ERROR_EXECUTION: Execution error while evaluating the expression against a + * record batch. * @GARROW_ERROR_ALREADY_EXISTS: Item already exists error. * * The error codes are used by all arrow-glib functions. @@ -64,6 +66,7 @@ typedef enum { #define GARROW_ERROR garrow_error_quark() -GQuark garrow_error_quark(void); +GQuark +garrow_error_quark(void); G_END_DECLS diff --git a/c_glib/arrow-glib/error.hpp b/c_glib/arrow-glib/error.hpp index 8a8d346f44060..90a0f3161878e 100644 --- a/c_glib/arrow-glib/error.hpp +++ b/c_glib/arrow-glib/error.hpp @@ -23,26 +23,25 @@ #include -gboolean garrow_error_check(GError **error, - const arrow::Status &status, - const char *context); -GArrowError garrow_error_from_status(const arrow::Status &status); +gboolean +garrow_error_check(GError **error, const arrow::Status &status, const char *context); +GArrowError +garrow_error_from_status(const arrow::Status &status); arrow::StatusCode -garrow_error_to_status_code(GError *error, - arrow::StatusCode default_code); -arrow::Status garrow_error_to_status(GError *error, - arrow::StatusCode default_code, - const char *context); +garrow_error_to_status_code(GError *error, arrow::StatusCode default_code); +arrow::Status +garrow_error_to_status(GError *error, + arrow::StatusCode default_code, + const char *context); namespace garrow { - gboolean check(GError **error, - const arrow::Status &status, - const char *context); + gboolean + check(GError **error, const arrow::Status &status, const char *context); template - gboolean check(GError **error, - const arrow::Status &status, - CONTEXT_FUNC &&context_func) { + gboolean + check(GError **error, const arrow::Status &status, CONTEXT_FUNC &&context_func) + { if (status.ok()) { return TRUE; } else { @@ -58,16 +57,16 @@ namespace garrow { } template - gboolean check(GError **error, - const arrow::Result &result, - const char *context) { + gboolean + check(GError **error, const arrow::Result &result, const char *context) + { return check(error, result.status(), context); } template - gboolean check(GError **error, - const arrow::Result &result, - CONTEXT_FUNC &&context_func) { + gboolean + check(GError **error, const arrow::Result &result, CONTEXT_FUNC &&context_func) + { return check(error, result.status(), context_func); } -} +} // namespace garrow diff --git a/c_glib/arrow-glib/expression.cpp b/c_glib/arrow-glib/expression.cpp index 48b5fd055e4d0..9be8e1f68bc1b 100644 --- a/c_glib/arrow-glib/expression.cpp +++ b/c_glib/arrow-glib/expression.cpp @@ -42,18 +42,16 @@ G_BEGIN_DECLS * Since: 6.0.0 */ -typedef struct GArrowExpressionPrivate_ { +typedef struct GArrowExpressionPrivate_ +{ arrow::compute::Expression expression; } GArrowExpressionPrivate; -G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowExpression, - garrow_expression, - G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowExpression, garrow_expression, G_TYPE_OBJECT) -#define GARROW_EXPRESSION_GET_PRIVATE(object) \ - static_cast( \ - garrow_expression_get_instance_private( \ - GARROW_EXPRESSION(object))) +#define GARROW_EXPRESSION_GET_PRIVATE(object) \ + static_cast( \ + garrow_expression_get_instance_private(GARROW_EXPRESSION(object))) static void garrow_expression_finalize(GObject *object) @@ -67,7 +65,7 @@ static void garrow_expression_init(GArrowExpression *object) { auto priv = GARROW_EXPRESSION_GET_PRIVATE(object); - new(&priv->expression) arrow::compute::Expression(); + new (&priv->expression) arrow::compute::Expression(); } static void @@ -107,18 +105,14 @@ garrow_expression_to_string(GArrowExpression *expression) * Since: 6.0.0 */ gboolean -garrow_expression_equal(GArrowExpression *expression, - GArrowExpression *other_expression) +garrow_expression_equal(GArrowExpression *expression, GArrowExpression *other_expression) { auto priv = GARROW_EXPRESSION_GET_PRIVATE(expression); auto other_priv = GARROW_EXPRESSION_GET_PRIVATE(other_expression); return priv->expression.Equals(other_priv->expression); } - -G_DEFINE_TYPE(GArrowLiteralExpression, - garrow_literal_expression, - GARROW_TYPE_EXPRESSION) +G_DEFINE_TYPE(GArrowLiteralExpression, garrow_literal_expression, GARROW_TYPE_EXPRESSION) static void garrow_literal_expression_init(GArrowLiteralExpression *object) @@ -146,10 +140,7 @@ garrow_literal_expression_new(GArrowDatum *datum) return GARROW_LITERAL_EXPRESSION(garrow_expression_new_raw(arrow_expression)); } - -G_DEFINE_TYPE(GArrowFieldExpression, - garrow_field_expression, - GARROW_TYPE_EXPRESSION) +G_DEFINE_TYPE(GArrowFieldExpression, garrow_field_expression, GARROW_TYPE_EXPRESSION) static void garrow_field_expression_init(GArrowFieldExpression *object) @@ -172,23 +163,17 @@ garrow_field_expression_class_init(GArrowFieldExpressionClass *klass) * Since: 6.0.0 */ GArrowFieldExpression * -garrow_field_expression_new(const gchar *reference, - GError **error) +garrow_field_expression_new(const gchar *reference, GError **error) { auto arrow_reference_result = garrow_field_reference_resolve_raw(reference); - if (!garrow::check(error, - arrow_reference_result, - "[field-expression][new]")) { + if (!garrow::check(error, arrow_reference_result, "[field-expression][new]")) { return NULL; } auto arrow_expression = arrow::compute::field_ref(*arrow_reference_result); return GARROW_FIELD_EXPRESSION(garrow_expression_new_raw(arrow_expression)); } - -G_DEFINE_TYPE(GArrowCallExpression, - garrow_call_expression, - GARROW_TYPE_EXPRESSION) +G_DEFINE_TYPE(GArrowCallExpression, garrow_call_expression, GARROW_TYPE_EXPRESSION) static void garrow_call_expression_init(GArrowCallExpression *object) @@ -225,13 +210,10 @@ garrow_call_expression_new(const gchar *function, if (options) { arrow_options.reset(garrow_function_options_get_raw(options)->Copy().release()); } - auto arrow_expression = arrow::compute::call(function, - arrow_arguments, - arrow_options); + auto arrow_expression = arrow::compute::call(function, arrow_arguments, arrow_options); return GARROW_CALL_EXPRESSION(garrow_expression_new_raw(arrow_expression)); } - G_END_DECLS GArrowExpression * diff --git a/c_glib/arrow-glib/expression.h b/c_glib/arrow-glib/expression.h index a161b8306be5c..3141ed4df18b7 100644 --- a/c_glib/arrow-glib/expression.h +++ b/c_glib/arrow-glib/expression.h @@ -28,9 +28,7 @@ gchar * garrow_expression_to_string(GArrowExpression *expression); GARROW_AVAILABLE_IN_6_0 gboolean -garrow_expression_equal(GArrowExpression *expression, - GArrowExpression *other_expression); - +garrow_expression_equal(GArrowExpression *expression, GArrowExpression *other_expression); #define GARROW_TYPE_LITERAL_EXPRESSION (garrow_literal_expression_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowLiteralExpression, @@ -47,7 +45,6 @@ GARROW_AVAILABLE_IN_6_0 GArrowLiteralExpression * garrow_literal_expression_new(GArrowDatum *datum); - #define GARROW_TYPE_FIELD_EXPRESSION (garrow_field_expression_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowFieldExpression, garrow_field_expression, @@ -61,16 +58,11 @@ struct _GArrowFieldExpressionClass GARROW_AVAILABLE_IN_6_0 GArrowFieldExpression * -garrow_field_expression_new(const gchar *reference, - GError **error); - +garrow_field_expression_new(const gchar *reference, GError **error); #define GARROW_TYPE_CALL_EXPRESSION (garrow_call_expression_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowCallExpression, - garrow_call_expression, - GARROW, - CALL_EXPRESSION, - GArrowExpression) +G_DECLARE_DERIVABLE_TYPE( + GArrowCallExpression, garrow_call_expression, GARROW, CALL_EXPRESSION, GArrowExpression) struct _GArrowCallExpressionClass { GArrowExpressionClass parent_class; diff --git a/c_glib/arrow-glib/expression.hpp b/c_glib/arrow-glib/expression.hpp index 8d6e2f8d117a8..60d5c9fe2f1bd 100644 --- a/c_glib/arrow-glib/expression.hpp +++ b/c_glib/arrow-glib/expression.hpp @@ -23,7 +23,6 @@ #include - GArrowExpression * garrow_expression_new_raw(const arrow::compute::Expression &arrow_expression); arrow::compute::Expression * diff --git a/c_glib/arrow-glib/field.cpp b/c_glib/arrow-glib/field.cpp index 135a4a5d771ae..7df92d3ad4016 100644 --- a/c_glib/arrow-glib/field.cpp +++ b/c_glib/arrow-glib/field.cpp @@ -35,7 +35,8 @@ G_BEGIN_DECLS * information of the column. */ -typedef struct GArrowFieldPrivate_ { +typedef struct GArrowFieldPrivate_ +{ std::shared_ptr field; GArrowDataType *data_type; } GArrowFieldPrivate; @@ -45,14 +46,10 @@ enum { PROP_DATA_TYPE }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowField, - garrow_field, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowField, garrow_field, G_TYPE_OBJECT) -#define GARROW_FIELD_GET_PRIVATE(obj) \ - static_cast( \ - garrow_field_get_instance_private( \ - GARROW_FIELD(obj))) +#define GARROW_FIELD_GET_PRIVATE(obj) \ + static_cast(garrow_field_get_instance_private(GARROW_FIELD(obj))) static void garrow_field_dispose(GObject *object) @@ -103,7 +100,7 @@ static void garrow_field_init(GArrowField *object) { auto priv = GARROW_FIELD_GET_PRIVATE(object); - new(&priv->field) std::shared_ptr; + new (&priv->field) std::shared_ptr; } static void @@ -111,24 +108,24 @@ garrow_field_class_init(GArrowFieldClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_field_dispose; - gobject_class->finalize = garrow_field_finalize; + gobject_class->dispose = garrow_field_dispose; + gobject_class->finalize = garrow_field_finalize; gobject_class->set_property = garrow_field_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("field", - "Field", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "field", + "Field", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_FIELD, spec); - spec = g_param_spec_object("data-type", - "Data type", - "The data type", - GARROW_TYPE_DATA_TYPE, - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "data-type", + "Data type", + "The data type", + GARROW_TYPE_DATA_TYPE, + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_DATA_TYPE, spec); } @@ -148,8 +145,7 @@ garrow_field_class_init(GArrowFieldClass *klass) GArrowField * garrow_field_import(gpointer c_abi_schema, GError **error) { - auto arrow_field_result = - arrow::ImportField(static_cast(c_abi_schema)); + auto arrow_field_result = arrow::ImportField(static_cast(c_abi_schema)); if (garrow::check(error, arrow_field_result, "[field][import]")) { return garrow_field_new_raw(&(*arrow_field_result), nullptr); } else { @@ -165,8 +161,7 @@ garrow_field_import(gpointer c_abi_schema, GError **error) * Returns: A newly created #GArrowField. */ GArrowField * -garrow_field_new(const gchar *name, - GArrowDataType *data_type) +garrow_field_new(const gchar *name, GArrowDataType *data_type) { auto arrow_data_type = garrow_data_type_get_raw(data_type); auto arrow_field = std::make_shared(name, arrow_data_type); @@ -182,14 +177,10 @@ garrow_field_new(const gchar *name, * Returns: A newly created #GArrowField. */ GArrowField * -garrow_field_new_full(const gchar *name, - GArrowDataType *data_type, - gboolean nullable) +garrow_field_new_full(const gchar *name, GArrowDataType *data_type, gboolean nullable) { auto arrow_field = - std::make_shared(name, - garrow_data_type_get_raw(data_type), - nullable); + std::make_shared(name, garrow_data_type_get_raw(data_type), nullable); return garrow_field_new_raw(&arrow_field, data_type); } @@ -268,8 +259,7 @@ garrow_field_is_nullable(GArrowField *field) * otherwise. */ gboolean -garrow_field_equal(GArrowField *field, - GArrowField *other_field) +garrow_field_equal(GArrowField *field, GArrowField *other_field) { const auto arrow_field = garrow_field_get_raw(field); const auto arrow_other_field = garrow_field_get_raw(other_field); @@ -364,14 +354,12 @@ garrow_field_get_metadata(GArrowField *field) * Since: 3.0.0 */ GArrowField * -garrow_field_with_metadata(GArrowField *field, - GHashTable *metadata) +garrow_field_with_metadata(GArrowField *field, GHashTable *metadata) { const auto arrow_field = garrow_field_get_raw(field); auto arrow_metadata = garrow_internal_hash_table_to_metadata(metadata); auto arrow_new_field = arrow_field->WithMetadata(arrow_metadata); - return garrow_field_new_raw(&arrow_new_field, - garrow_field_get_data_type(field)); + return garrow_field_new_raw(&arrow_new_field, garrow_field_get_data_type(field)); } /** @@ -386,14 +374,12 @@ garrow_field_with_metadata(GArrowField *field, * Since: 3.0.0 */ GArrowField * -garrow_field_with_merged_metadata(GArrowField *field, - GHashTable *metadata) +garrow_field_with_merged_metadata(GArrowField *field, GHashTable *metadata) { const auto arrow_field = garrow_field_get_raw(field); auto arrow_metadata = garrow_internal_hash_table_to_metadata(metadata); auto arrow_new_field = arrow_field->WithMergedMetadata(arrow_metadata); - return garrow_field_new_raw(&arrow_new_field, - garrow_field_get_data_type(field)); + return garrow_field_new_raw(&arrow_new_field, garrow_field_get_data_type(field)); } /** @@ -409,8 +395,7 @@ garrow_field_remove_metadata(GArrowField *field) { const auto arrow_field = garrow_field_get_raw(field); auto arrow_new_field = arrow_field->RemoveMetadata(); - return garrow_field_new_raw(&arrow_new_field, - garrow_field_get_data_type(field)); + return garrow_field_new_raw(&arrow_new_field, garrow_field_get_data_type(field)); } G_END_DECLS @@ -425,10 +410,8 @@ garrow_field_new_raw(std::shared_ptr *arrow_field, data_type = garrow_data_type_new_raw(&arrow_data_type); data_type_need_unref = true; } - auto field = GARROW_FIELD(g_object_new(GARROW_TYPE_FIELD, - "field", arrow_field, - "data-type", data_type, - NULL)); + auto field = GARROW_FIELD( + g_object_new(GARROW_TYPE_FIELD, "field", arrow_field, "data-type", data_type, NULL)); if (data_type_need_unref) { g_object_unref(data_type); } diff --git a/c_glib/arrow-glib/field.h b/c_glib/arrow-glib/field.h index 60689c36e76fe..8de63757878c9 100644 --- a/c_glib/arrow-glib/field.h +++ b/c_glib/arrow-glib/field.h @@ -24,11 +24,7 @@ G_BEGIN_DECLS #define GARROW_TYPE_FIELD (garrow_field_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowField, - garrow_field, - GARROW, - FIELD, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowField, garrow_field, GARROW, FIELD, GObject) struct _GArrowFieldClass { GObjectClass parent_class; @@ -36,33 +32,32 @@ struct _GArrowFieldClass GARROW_AVAILABLE_IN_6_0 GArrowField * -garrow_field_import(gpointer c_abi_schema, - GError **error); +garrow_field_import(gpointer c_abi_schema, GError **error); -GArrowField *garrow_field_new (const gchar *name, - GArrowDataType *data_type); -GArrowField *garrow_field_new_full (const gchar *name, - GArrowDataType *data_type, - gboolean nullable); +GArrowField * +garrow_field_new(const gchar *name, GArrowDataType *data_type); +GArrowField * +garrow_field_new_full(const gchar *name, GArrowDataType *data_type, gboolean nullable); GARROW_AVAILABLE_IN_6_0 gpointer -garrow_field_export(GArrowField *field, - GError **error); +garrow_field_export(GArrowField *field, GError **error); -const gchar *garrow_field_get_name (GArrowField *field); -GArrowDataType *garrow_field_get_data_type (GArrowField *field); -gboolean garrow_field_is_nullable (GArrowField *field); +const gchar * +garrow_field_get_name(GArrowField *field); +GArrowDataType * +garrow_field_get_data_type(GArrowField *field); +gboolean +garrow_field_is_nullable(GArrowField *field); -gboolean garrow_field_equal (GArrowField *field, - GArrowField *other_field); +gboolean +garrow_field_equal(GArrowField *field, GArrowField *other_field); gchar * garrow_field_to_string(GArrowField *field); GARROW_AVAILABLE_IN_3_0 gchar * -garrow_field_to_string_metadata(GArrowField *field, - gboolean show_metadata); +garrow_field_to_string_metadata(GArrowField *field, gboolean show_metadata); GARROW_AVAILABLE_IN_3_0 gboolean @@ -72,12 +67,10 @@ GHashTable * garrow_field_get_metadata(GArrowField *field); GARROW_AVAILABLE_IN_3_0 GArrowField * -garrow_field_with_metadata(GArrowField *field, - GHashTable *metadata); +garrow_field_with_metadata(GArrowField *field, GHashTable *metadata); GARROW_AVAILABLE_IN_3_0 GArrowField * -garrow_field_with_merged_metadata(GArrowField *field, - GHashTable *metadata); +garrow_field_with_merged_metadata(GArrowField *field, GHashTable *metadata); GARROW_AVAILABLE_IN_3_0 GArrowField * garrow_field_remove_metadata(GArrowField *field); diff --git a/c_glib/arrow-glib/field.hpp b/c_glib/arrow-glib/field.hpp index f8d0d46c97ab4..67dd9e1b8fd32 100644 --- a/c_glib/arrow-glib/field.hpp +++ b/c_glib/arrow-glib/field.hpp @@ -23,6 +23,8 @@ #include -GArrowField *garrow_field_new_raw(std::shared_ptr *arrow_field, - GArrowDataType *data_type); -std::shared_ptr garrow_field_get_raw(GArrowField *field); +GArrowField * +garrow_field_new_raw(std::shared_ptr *arrow_field, + GArrowDataType *data_type); +std::shared_ptr +garrow_field_get_raw(GArrowField *field); diff --git a/c_glib/arrow-glib/file-mode.hpp b/c_glib/arrow-glib/file-mode.hpp index 2b67379421d5a..c860d0d50b698 100644 --- a/c_glib/arrow-glib/file-mode.hpp +++ b/c_glib/arrow-glib/file-mode.hpp @@ -23,5 +23,7 @@ #include -GArrowFileMode garrow_file_mode_from_raw(arrow::io::FileMode::type mode); -arrow::io::FileMode::type garrow_file_mode_to_raw(GArrowFileMode mode); +GArrowFileMode +garrow_file_mode_from_raw(arrow::io::FileMode::type mode); +arrow::io::FileMode::type +garrow_file_mode_to_raw(GArrowFileMode mode); diff --git a/c_glib/arrow-glib/file-system.cpp b/c_glib/arrow-glib/file-system.cpp index a81db683d348c..b6efa2b872635 100644 --- a/c_glib/arrow-glib/file-system.cpp +++ b/c_glib/arrow-glib/file-system.cpp @@ -60,7 +60,8 @@ G_BEGIN_DECLS /* arrow::fs::FileInfo */ -typedef struct GArrowFileInfoPrivate_ { +typedef struct GArrowFileInfoPrivate_ +{ arrow::fs::FileInfo file_info; } GArrowFileInfoPrivate; @@ -76,10 +77,9 @@ enum { G_DEFINE_TYPE_WITH_PRIVATE(GArrowFileInfo, garrow_file_info, G_TYPE_OBJECT) -#define GARROW_FILE_INFO_GET_PRIVATE(object) \ - static_cast( \ - garrow_file_info_get_instance_private( \ - GARROW_FILE_INFO(object))) +#define GARROW_FILE_INFO_GET_PRIVATE(object) \ + static_cast( \ + garrow_file_info_get_instance_private(GARROW_FILE_INFO(object))) static void garrow_file_info_finalize(GObject *object) @@ -102,8 +102,7 @@ garrow_file_info_set_property(GObject *object, switch (prop_id) { case PROP_FILE_INFO_TYPE: { - auto arrow_file_type = - static_cast(g_value_get_enum(value)); + auto arrow_file_type = static_cast(g_value_get_enum(value)); arrow_file_info->set_type(arrow_file_type); } break; @@ -132,8 +131,7 @@ garrow_file_info_get_property(GObject *object, GValue *value, GParamSpec *pspec) { - const auto arrow_file_info = - garrow_file_info_get_raw(GARROW_FILE_INFO(object)); + const auto arrow_file_info = garrow_file_info_get_raw(GARROW_FILE_INFO(object)); switch (prop_id) { case PROP_FILE_INFO_TYPE: @@ -175,7 +173,7 @@ static void garrow_file_info_init(GArrowFileInfo *object) { auto priv = GARROW_FILE_INFO_GET_PRIVATE(object); - new(&priv->file_info) arrow::fs::FileInfo; + new (&priv->file_info) arrow::fs::FileInfo; } static void @@ -185,7 +183,7 @@ garrow_file_info_class_init(GArrowFileInfoClass *klass) auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_file_info_finalize; + gobject_class->finalize = garrow_file_info_finalize; gobject_class->set_property = garrow_file_info_set_property; gobject_class->get_property = garrow_file_info_get_property; @@ -232,9 +230,7 @@ garrow_file_info_class_init(GArrowFileInfoClass *klass) "The file base name", info.base_name().c_str(), static_cast(G_PARAM_READABLE)); - g_object_class_install_property(gobject_class, - PROP_FILE_INFO_BASE_NAME, - spec); + g_object_class_install_property(gobject_class, PROP_FILE_INFO_BASE_NAME, spec); /** * GArrowFileInfo:dir-name: @@ -248,9 +244,7 @@ garrow_file_info_class_init(GArrowFileInfoClass *klass) "The directory base name", info.dir_name().c_str(), static_cast(G_PARAM_READABLE)); - g_object_class_install_property(gobject_class, - PROP_FILE_INFO_DIR_NAME, - spec); + g_object_class_install_property(gobject_class, PROP_FILE_INFO_DIR_NAME, spec); /** * GArrowFileInfo:extension: @@ -264,9 +258,7 @@ garrow_file_info_class_init(GArrowFileInfoClass *klass) "The file extension", info.extension().c_str(), static_cast(G_PARAM_READABLE)); - g_object_class_install_property(gobject_class, - PROP_FILE_INFO_EXTENSION, - spec); + g_object_class_install_property(gobject_class, PROP_FILE_INFO_EXTENSION, spec); /** * GArrowFileInfo:size: @@ -326,8 +318,7 @@ garrow_file_info_new(void) * Since: 0.17.0 */ gboolean -garrow_file_info_equal(GArrowFileInfo *file_info, - GArrowFileInfo *other_file_info) +garrow_file_info_equal(GArrowFileInfo *file_info, GArrowFileInfo *other_file_info) { const auto arrow_file_info = garrow_file_info_get_raw(file_info); const auto arrow_other_file_info = garrow_file_info_get_raw(other_file_info); @@ -384,7 +375,8 @@ garrow_file_info_to_string(GArrowFileInfo *file_info) /* arrow::fs::FileSelector */ -typedef struct GArrowFileSelectorPrivate_ { +typedef struct GArrowFileSelectorPrivate_ +{ arrow::fs::FileSelector file_selector; } GArrowFileSelectorPrivate; @@ -397,10 +389,9 @@ enum { G_DEFINE_TYPE_WITH_PRIVATE(GArrowFileSelector, garrow_file_selector, G_TYPE_OBJECT) -#define GARROW_FILE_SELECTOR_GET_PRIVATE(obj) \ - static_cast( \ - garrow_file_selector_get_instance_private( \ - GARROW_FILE_SELECTOR(obj))) +#define GARROW_FILE_SELECTOR_GET_PRIVATE(obj) \ + static_cast( \ + garrow_file_selector_get_instance_private(GARROW_FILE_SELECTOR(obj))) static void garrow_file_selector_finalize(GObject *object) @@ -470,7 +461,7 @@ static void garrow_file_selector_init(GArrowFileSelector *object) { auto priv = GARROW_FILE_SELECTOR_GET_PRIVATE(object); - new(&priv->file_selector) arrow::fs::FileSelector; + new (&priv->file_selector) arrow::fs::FileSelector; } static void @@ -500,9 +491,7 @@ garrow_file_selector_class_init(GArrowFileSelectorClass *klass) "The directory in which to select files", file_selector.base_dir.c_str(), static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_FILE_SELECTOR_BASE_DIR, - spec); + g_object_class_install_property(gobject_class, PROP_FILE_SELECTOR_BASE_DIR, spec); /** * GArrowFileSelector:allow-not-found: @@ -533,9 +522,7 @@ garrow_file_selector_class_init(GArrowFileSelectorClass *klass) "Whether to recurse into subdirectories", file_selector.recursive, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_FILE_SELECTOR_RECURSIVE, - spec); + g_object_class_install_property(gobject_class, PROP_FILE_SELECTOR_RECURSIVE, spec); /** * GArrowFileSelector:max-recursion: @@ -551,14 +538,13 @@ garrow_file_selector_class_init(GArrowFileSelectorClass *klass) INT32_MAX, file_selector.max_recursion, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_FILE_SELECTOR_MAX_RECURSION, - spec); + g_object_class_install_property(gobject_class, PROP_FILE_SELECTOR_MAX_RECURSION, spec); } /* arrow::fs::FileSystem */ -typedef struct GArrowFileSystemPrivate_ { +typedef struct GArrowFileSystemPrivate_ +{ std::shared_ptr file_system; } GArrowFileSystemPrivate; @@ -566,14 +552,11 @@ enum { PROP_FILE_SYSTEM = 1 }; -G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowFileSystem, - garrow_file_system, - G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowFileSystem, garrow_file_system, G_TYPE_OBJECT) -#define GARROW_FILE_SYSTEM_GET_PRIVATE(obj) \ - static_cast( \ - garrow_file_system_get_instance_private( \ - GARROW_FILE_SYSTEM(obj))) +#define GARROW_FILE_SYSTEM_GET_PRIVATE(obj) \ + static_cast( \ + garrow_file_system_get_instance_private(GARROW_FILE_SYSTEM(obj))) static void garrow_file_system_finalize(GObject *object) @@ -608,7 +591,7 @@ static void garrow_file_system_init(GArrowFileSystem *object) { auto priv = GARROW_FILE_SYSTEM_GET_PRIVATE(object); - new(&priv->file_system) std::shared_ptr; + new (&priv->file_system) std::shared_ptr; } static void @@ -618,14 +601,14 @@ garrow_file_system_class_init(GArrowFileSystemClass *klass) auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_file_system_finalize; + gobject_class->finalize = garrow_file_system_finalize; gobject_class->set_property = garrow_file_system_set_property; - spec = g_param_spec_pointer("file-system", - "FileSystem", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "file-system", + "FileSystem", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_FILE_SYSTEM, spec); } @@ -647,9 +630,7 @@ GArrowFileSystem * garrow_file_system_create(const gchar *uri, GError **error) { auto arrow_file_system_result = arrow::fs::FileSystemFromUri(uri); - if (garrow::check(error, - arrow_file_system_result, - "[file-system][create]")) { + if (garrow::check(error, arrow_file_system_result, "[file-system][create]")) { auto arrow_file_system = *arrow_file_system_result; return garrow_file_system_new_raw(&arrow_file_system); } else { @@ -709,7 +690,7 @@ garrow_file_system_get_file_info(GArrowFileSystem *file_system, } static inline GList * -garrow_file_infos_new(arrow::Result>&& arrow_result, +garrow_file_infos_new(arrow::Result> &&arrow_result, GError **error, const gchar *context) { @@ -985,9 +966,7 @@ garrow_file_system_open_input_stream(GArrowFileSystem *file_system, { auto arrow_file_system = garrow_file_system_get_raw(file_system); auto arrow_input_stream = arrow_file_system->OpenInputStream(path); - if (garrow::check(error, - arrow_input_stream, - "[file-system][open-input-stream]")) { + if (garrow::check(error, arrow_input_stream, "[file-system][open-input-stream]")) { return garrow_input_stream_new_raw(&(*arrow_input_stream)); } else { return NULL; @@ -1014,9 +993,7 @@ garrow_file_system_open_input_file(GArrowFileSystem *file_system, { auto arrow_file_system = garrow_file_system_get_raw(file_system); auto arrow_random_access_file = arrow_file_system->OpenInputFile(path); - if (garrow::check(error, - arrow_random_access_file, - "[file-system][open-input-file]")) { + if (garrow::check(error, arrow_random_access_file, "[file-system][open-input-file]")) { return garrow_seekable_input_stream_new_raw(&(*arrow_random_access_file)); } else { return NULL; @@ -1044,9 +1021,7 @@ garrow_file_system_open_output_stream(GArrowFileSystem *file_system, { auto arrow_file_system = garrow_file_system_get_raw(file_system); auto arrow_output_stream = arrow_file_system->OpenOutputStream(path); - if (garrow::check(error, - arrow_output_stream, - "[file-system][open-output-stream]")) { + if (garrow::check(error, arrow_output_stream, "[file-system][open-output-stream]")) { return garrow_output_stream_new_raw(&(*arrow_output_stream)); } else { return NULL; @@ -1074,9 +1049,7 @@ garrow_file_system_open_append_stream(GArrowFileSystem *file_system, { auto arrow_file_system = garrow_file_system_get_raw(file_system); auto arrow_output_stream = arrow_file_system->OpenAppendStream(path); - if (garrow::check(error, - arrow_output_stream, - "[file-system][open-append-stream]")) { + if (garrow::check(error, arrow_output_stream, "[file-system][open-append-stream]")) { return garrow_output_stream_new_raw(&(*arrow_output_stream)); } else { return NULL; @@ -1085,7 +1058,8 @@ garrow_file_system_open_append_stream(GArrowFileSystem *file_system, /* arrow::fs::SubTreeFileSystem */ -typedef struct GArrowSubTreeFileSystemPrivate_ { +typedef struct GArrowSubTreeFileSystemPrivate_ +{ GArrowFileSystem *base_file_system; } GArrowSubTreeFileSystemPrivate; @@ -1097,9 +1071,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowSubTreeFileSystem, garrow_sub_tree_file_system, GARROW_TYPE_FILE_SYSTEM) -#define GARROW_SUB_TREE_FILE_SYSTEM_GET_PRIVATE(object) \ - static_cast( \ - garrow_sub_tree_file_system_get_instance_private( \ +#define GARROW_SUB_TREE_FILE_SYSTEM_GET_PRIVATE(object) \ + static_cast( \ + garrow_sub_tree_file_system_get_instance_private( \ GARROW_SUB_TREE_FILE_SYSTEM(object))) static void @@ -1160,17 +1134,17 @@ static void garrow_sub_tree_file_system_class_init(GArrowSubTreeFileSystemClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_sub_tree_file_system_dispose; + gobject_class->dispose = garrow_sub_tree_file_system_dispose; gobject_class->set_property = garrow_sub_tree_file_system_set_property; gobject_class->get_property = garrow_sub_tree_file_system_get_property; GParamSpec *spec; - spec = g_param_spec_object("base-file-system", - "Base file system", - "The base GArrowFileSystem", - GARROW_TYPE_FILE_SYSTEM, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "base-file-system", + "Base file system", + "The base GArrowFileSystem", + GARROW_TYPE_FILE_SYSTEM, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_BASE_FILE_SYSTEM, spec); } @@ -1188,17 +1162,16 @@ garrow_sub_tree_file_system_new(const gchar *base_path, GArrowFileSystem *base_file_system) { auto arrow_base_file_system = garrow_file_system_get_raw(base_file_system); - auto arrow_sub_tree_file_system = - std::static_pointer_cast( - std::make_shared(base_path, - arrow_base_file_system)); + auto arrow_sub_tree_file_system = std::static_pointer_cast( + std::make_shared(base_path, arrow_base_file_system)); return garrow_sub_tree_file_system_new_raw(&arrow_sub_tree_file_system, base_file_system); } /* arrow::fs::SlowFileSystem */ -typedef struct GArrowSlowFileSystemPrivate_ { +typedef struct GArrowSlowFileSystemPrivate_ +{ GArrowFileSystem *base_file_system; } GArrowSlowFileSystemPrivate; @@ -1206,10 +1179,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowSlowFileSystem, garrow_slow_file_system, GARROW_TYPE_FILE_SYSTEM) -#define GARROW_SLOW_FILE_SYSTEM_GET_PRIVATE(object) \ - static_cast( \ - garrow_slow_file_system_get_instance_private( \ - GARROW_SLOW_FILE_SYSTEM(object))) +#define GARROW_SLOW_FILE_SYSTEM_GET_PRIVATE(object) \ + static_cast( \ + garrow_slow_file_system_get_instance_private(GARROW_SLOW_FILE_SYSTEM(object))) static void garrow_slow_file_system_dispose(GObject *object) @@ -1269,17 +1241,17 @@ static void garrow_slow_file_system_class_init(GArrowSlowFileSystemClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_slow_file_system_dispose; + gobject_class->dispose = garrow_slow_file_system_dispose; gobject_class->set_property = garrow_slow_file_system_set_property; gobject_class->get_property = garrow_slow_file_system_get_property; GParamSpec *spec; - spec = g_param_spec_object("base-file-system", - "Base file system", - "The base GArrowFileSystem", - GARROW_TYPE_FILE_SYSTEM, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "base-file-system", + "Base file system", + "The base GArrowFileSystem", + GARROW_TYPE_FILE_SYSTEM, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_BASE_FILE_SYSTEM, spec); } @@ -1302,12 +1274,9 @@ garrow_slow_file_system_new_average_latency(GArrowFileSystem *base_file_system, gdouble average_latency) { auto arrow_base_file_system = garrow_file_system_get_raw(base_file_system); - auto arrow_slow_file_system = - std::static_pointer_cast( - std::make_shared(arrow_base_file_system, - average_latency)); - return garrow_slow_file_system_new_raw(&arrow_slow_file_system, - base_file_system); + auto arrow_slow_file_system = std::static_pointer_cast( + std::make_shared(arrow_base_file_system, average_latency)); + return garrow_slow_file_system_new_raw(&arrow_slow_file_system, base_file_system); } /** @@ -1329,19 +1298,14 @@ garrow_slow_file_system_new_average_latency_and_seed(GArrowFileSystem *base_file gint32 seed) { auto arrow_base_file_system = garrow_file_system_get_raw(base_file_system); - auto arrow_slow_file_system = - std::static_pointer_cast( - std::make_shared(arrow_base_file_system, - average_latency, - seed)); - return garrow_slow_file_system_new_raw(&arrow_slow_file_system, - base_file_system); + auto arrow_slow_file_system = std::static_pointer_cast( + std::make_shared(arrow_base_file_system, + average_latency, + seed)); + return garrow_slow_file_system_new_raw(&arrow_slow_file_system, base_file_system); } - -G_DEFINE_TYPE(GArrowMockFileSystem, - garrow_mock_file_system, - GARROW_TYPE_FILE_SYSTEM) +G_DEFINE_TYPE(GArrowMockFileSystem, garrow_mock_file_system, GARROW_TYPE_FILE_SYSTEM) static void garrow_mock_file_system_init(GArrowMockFileSystem *file_system) @@ -1353,10 +1317,7 @@ garrow_mock_file_system_class_init(GArrowMockFileSystemClass *klass) { } - -G_DEFINE_TYPE(GArrowHDFSFileSystem, - garrow_hdfs_file_system, - GARROW_TYPE_FILE_SYSTEM) +G_DEFINE_TYPE(GArrowHDFSFileSystem, garrow_hdfs_file_system, GARROW_TYPE_FILE_SYSTEM) static void garrow_hdfs_file_system_init(GArrowHDFSFileSystem *file_system) @@ -1368,20 +1329,29 @@ garrow_hdfs_file_system_class_init(GArrowHDFSFileSystemClass *klass) { } - #ifndef ARROW_S3 namespace arrow { namespace fs { - enum class S3LogLevel : int8_t { Off, Fatal, Error, Warn, Info, Debug, Trace }; + enum class S3LogLevel : int8_t { + Off, + Fatal, + Error, + Warn, + Info, + Debug, + Trace + }; - struct ARROW_EXPORT S3GlobalOptions { + struct ARROW_EXPORT S3GlobalOptions + { S3LogLevel log_level; }; - } -} + } // namespace fs +} // namespace arrow #endif -typedef struct GArrowS3GlobalOptionsPrivate_ { +typedef struct GArrowS3GlobalOptionsPrivate_ +{ arrow::fs::S3GlobalOptions options; } GArrowS3GlobalOptionsPrivate; @@ -1389,14 +1359,11 @@ enum { PROP_S3_GLOBAL_OPTIONS_LOG_LEVEL = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowS3GlobalOptions, - garrow_s3_global_options, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowS3GlobalOptions, garrow_s3_global_options, G_TYPE_OBJECT) -#define GARROW_S3_GLOBAL_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_s3_global_options_get_instance_private( \ - GARROW_S3_GLOBAL_OPTIONS(object))) +#define GARROW_S3_GLOBAL_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_s3_global_options_get_instance_private(GARROW_S3_GLOBAL_OPTIONS(object))) static void garrow_s3_global_options_finalize(GObject *object) @@ -1413,8 +1380,7 @@ garrow_s3_global_options_set_property(GObject *object, GParamSpec *pspec) { #ifdef ARROW_S3 - auto arrow_options = - garrow_s3_global_options_get_raw(GARROW_S3_GLOBAL_OPTIONS(object)); + auto arrow_options = garrow_s3_global_options_get_raw(GARROW_S3_GLOBAL_OPTIONS(object)); switch (prop_id) { case PROP_S3_GLOBAL_OPTIONS_LOG_LEVEL: @@ -1437,13 +1403,11 @@ garrow_s3_global_options_get_property(GObject *object, GParamSpec *pspec) { #ifdef ARROW_S3 - auto arrow_options = - garrow_s3_global_options_get_raw(GARROW_S3_GLOBAL_OPTIONS(object)); + auto arrow_options = garrow_s3_global_options_get_raw(GARROW_S3_GLOBAL_OPTIONS(object)); switch (prop_id) { case PROP_S3_GLOBAL_OPTIONS_LOG_LEVEL: - g_value_set_enum(value, - static_cast(arrow_options->log_level)); + g_value_set_enum(value, static_cast(arrow_options->log_level)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -1458,7 +1422,7 @@ static void garrow_s3_global_options_init(GArrowS3GlobalOptions *object) { auto priv = GARROW_S3_GLOBAL_OPTIONS_GET_PRIVATE(object); - new(&priv->options) arrow::fs::S3GlobalOptions; + new (&priv->options) arrow::fs::S3GlobalOptions; } static void @@ -1468,7 +1432,7 @@ garrow_s3_global_options_class_init(GArrowS3GlobalOptionsClass *klass) auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_s3_global_options_finalize; + gobject_class->finalize = garrow_s3_global_options_finalize; gobject_class->set_property = garrow_s3_global_options_set_property; gobject_class->get_property = garrow_s3_global_options_get_property; @@ -1479,16 +1443,14 @@ garrow_s3_global_options_class_init(GArrowS3GlobalOptionsClass *klass) * * Since: 7.0.0 */ - spec = g_param_spec_enum("log-level", - "Log level", - "The log level of S3 APIs", - GARROW_TYPE_S3_LOG_LEVEL, - GARROW_S3_LOG_LEVEL_FATAL, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT)); - g_object_class_install_property(gobject_class, - PROP_S3_GLOBAL_OPTIONS_LOG_LEVEL, - spec); + spec = + g_param_spec_enum("log-level", + "Log level", + "The log level of S3 APIs", + GARROW_TYPE_S3_LOG_LEVEL, + GARROW_S3_LOG_LEVEL_FATAL, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + g_object_class_install_property(gobject_class, PROP_S3_GLOBAL_OPTIONS_LOG_LEVEL, spec); } /** @@ -1501,11 +1463,9 @@ garrow_s3_global_options_class_init(GArrowS3GlobalOptionsClass *klass) GArrowS3GlobalOptions * garrow_s3_global_options_new(void) { - return GARROW_S3_GLOBAL_OPTIONS( - g_object_new(GARROW_TYPE_S3_GLOBAL_OPTIONS, NULL)); + return GARROW_S3_GLOBAL_OPTIONS(g_object_new(GARROW_TYPE_S3_GLOBAL_OPTIONS, NULL)); } - /** * garrow_s3_is_enabled: * @@ -1539,8 +1499,7 @@ garrow_s3_is_enabled(void) * Since: 7.0.0 */ gboolean -garrow_s3_initialize(GArrowS3GlobalOptions *options, - GError **error) +garrow_s3_initialize(GArrowS3GlobalOptions *options, GError **error) { #ifdef ARROW_S3 auto arrow_options = garrow_s3_global_options_get_raw(options); @@ -1548,10 +1507,10 @@ garrow_s3_initialize(GArrowS3GlobalOptions *options, arrow::fs::InitializeS3(*arrow_options), "[s3][initialize]"); #else - return garrow::check(error, - arrow::Status::NotImplemented( - "Apache Arrow C++ isn't built with S3 support"), - "[s3][initialize]"); + return garrow::check( + error, + arrow::Status::NotImplemented("Apache Arrow C++ isn't built with S3 support"), + "[s3][initialize]"); #endif } @@ -1569,21 +1528,16 @@ gboolean garrow_s3_finalize(GError **error) { #ifdef ARROW_S3 - return garrow::check(error, - arrow::fs::FinalizeS3(), - "[s3][finalize]"); + return garrow::check(error, arrow::fs::FinalizeS3(), "[s3][finalize]"); #else - return garrow::check(error, - arrow::Status::NotImplemented( - "Apache Arrow C++ isn't built with S3 support"), - "[s3][initialize]"); + return garrow::check( + error, + arrow::Status::NotImplemented("Apache Arrow C++ isn't built with S3 support"), + "[s3][initialize]"); #endif } - -G_DEFINE_TYPE(GArrowS3FileSystem, - garrow_s3_file_system, - GARROW_TYPE_FILE_SYSTEM) +G_DEFINE_TYPE(GArrowS3FileSystem, garrow_s3_file_system, GARROW_TYPE_FILE_SYSTEM) static void garrow_s3_file_system_init(GArrowS3FileSystem *file_system) @@ -1595,10 +1549,7 @@ garrow_s3_file_system_class_init(GArrowS3FileSystemClass *klass) { } - -G_DEFINE_TYPE(GArrowGCSFileSystem, - garrow_gcs_file_system, - GARROW_TYPE_FILE_SYSTEM) +G_DEFINE_TYPE(GArrowGCSFileSystem, garrow_gcs_file_system, GARROW_TYPE_FILE_SYSTEM) static void garrow_gcs_file_system_init(GArrowGCSFileSystem *file_system) @@ -1610,7 +1561,6 @@ garrow_gcs_file_system_class_init(GArrowGCSFileSystemClass *klass) { } - G_END_DECLS GArrowFileInfo * @@ -1629,8 +1579,7 @@ garrow_file_info_get_raw(GArrowFileInfo *file_info) } GArrowFileSystem * -garrow_file_system_new_raw( - std::shared_ptr *arrow_file_system) +garrow_file_system_new_raw(std::shared_ptr *arrow_file_system) { const auto &type_name = (*arrow_file_system)->type_name(); @@ -1647,9 +1596,8 @@ garrow_file_system_new_raw( file_system_type = GARROW_TYPE_MOCK_FILE_SYSTEM; } - return GARROW_FILE_SYSTEM(g_object_new(file_system_type, - "file-system", arrow_file_system, - NULL)); + return GARROW_FILE_SYSTEM( + g_object_new(file_system_type, "file-system", arrow_file_system, NULL)); } std::shared_ptr @@ -1664,23 +1612,24 @@ garrow_sub_tree_file_system_new_raw( std::shared_ptr *arrow_file_system, GArrowFileSystem *base_file_system) { - return GARROW_SUB_TREE_FILE_SYSTEM( - g_object_new(GARROW_TYPE_SUB_TREE_FILE_SYSTEM, - "file-system", arrow_file_system, - "base-file-system", base_file_system, - NULL)); + return GARROW_SUB_TREE_FILE_SYSTEM(g_object_new(GARROW_TYPE_SUB_TREE_FILE_SYSTEM, + "file-system", + arrow_file_system, + "base-file-system", + base_file_system, + NULL)); } GArrowSlowFileSystem * -garrow_slow_file_system_new_raw( - std::shared_ptr *arrow_file_system, - GArrowFileSystem *base_file_system) +garrow_slow_file_system_new_raw(std::shared_ptr *arrow_file_system, + GArrowFileSystem *base_file_system) { - return GARROW_SLOW_FILE_SYSTEM( - g_object_new(GARROW_TYPE_SLOW_FILE_SYSTEM, - "file-system", arrow_file_system, - "base-file-system", base_file_system, - NULL)); + return GARROW_SLOW_FILE_SYSTEM(g_object_new(GARROW_TYPE_SLOW_FILE_SYSTEM, + "file-system", + arrow_file_system, + "base-file-system", + base_file_system, + NULL)); } #ifdef ARROW_S3 diff --git a/c_glib/arrow-glib/file-system.h b/c_glib/arrow-glib/file-system.h index 687404734a2d9..d3d5fde73fe23 100644 --- a/c_glib/arrow-glib/file-system.h +++ b/c_glib/arrow-glib/file-system.h @@ -50,42 +50,38 @@ typedef enum { GARROW_FILE_TYPE_DIR } GArrowFileType; - /* arrow::fs::FileInfo */ #define GARROW_TYPE_FILE_INFO (garrow_file_info_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowFileInfo, - garrow_file_info, - GARROW, - FILE_INFO, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowFileInfo, garrow_file_info, GARROW, FILE_INFO, GObject) struct _GArrowFileInfoClass { GObjectClass parent_class; }; GARROW_AVAILABLE_IN_0_17 -GArrowFileInfo *garrow_file_info_new(void); +GArrowFileInfo * +garrow_file_info_new(void); GARROW_AVAILABLE_IN_0_17 -gboolean garrow_file_info_equal(GArrowFileInfo *file_info, - GArrowFileInfo *other_file_info); +gboolean +garrow_file_info_equal(GArrowFileInfo *file_info, GArrowFileInfo *other_file_info); GARROW_AVAILABLE_IN_0_17 -gboolean garrow_file_info_is_file(GArrowFileInfo *file_info); +gboolean +garrow_file_info_is_file(GArrowFileInfo *file_info); GARROW_AVAILABLE_IN_0_17 -gboolean garrow_file_info_is_dir(GArrowFileInfo *file_info); +gboolean +garrow_file_info_is_dir(GArrowFileInfo *file_info); GARROW_AVAILABLE_IN_0_17 -gchar *garrow_file_info_to_string(GArrowFileInfo *file_info); +gchar * +garrow_file_info_to_string(GArrowFileInfo *file_info); /* arrow::fs::FileSelector */ #define GARROW_TYPE_FILE_SELECTOR (garrow_file_selector_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowFileSelector, - garrow_file_selector, - GARROW, - FILE_SELECTOR, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowFileSelector, garrow_file_selector, GARROW, FILE_SELECTOR, GObject) struct _GArrowFileSelectorClass { GObjectClass parent_class; @@ -94,11 +90,8 @@ struct _GArrowFileSelectorClass /* arrow::fs::FileSystem */ #define GARROW_TYPE_FILE_SYSTEM (garrow_file_system_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowFileSystem, - garrow_file_system, - GARROW, - FILE_SYSTEM, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowFileSystem, garrow_file_system, GARROW, FILE_SYSTEM, GObject) struct _GArrowFileSystemClass { GObjectClass parent_class; @@ -106,11 +99,11 @@ struct _GArrowFileSystemClass GARROW_AVAILABLE_IN_3_0 GArrowFileSystem * -garrow_file_system_create(const gchar *uri, - GError **error); +garrow_file_system_create(const gchar *uri, GError **error); GARROW_AVAILABLE_IN_0_17 -gchar *garrow_file_system_get_type_name(GArrowFileSystem *file_system); +gchar * +garrow_file_system_get_type_name(GArrowFileSystem *file_system); GARROW_AVAILABLE_IN_0_17 GArrowFileInfo * @@ -119,10 +112,11 @@ garrow_file_system_get_file_info(GArrowFileSystem *file_system, GError **error); GARROW_AVAILABLE_IN_0_17 -GList *garrow_file_system_get_file_infos_paths(GArrowFileSystem *file_system, - const gchar **paths, - gsize n_paths, - GError **error); +GList * +garrow_file_system_get_file_infos_paths(GArrowFileSystem *file_system, + const gchar **paths, + gsize n_paths, + GError **error); GARROW_AVAILABLE_IN_0_17 GList * @@ -131,43 +125,50 @@ garrow_file_system_get_file_infos_selector(GArrowFileSystem *file_system, GError **error); GARROW_AVAILABLE_IN_0_17 -gboolean garrow_file_system_create_dir(GArrowFileSystem *file_system, - const gchar *path, - gboolean recursive, - GError **error); +gboolean +garrow_file_system_create_dir(GArrowFileSystem *file_system, + const gchar *path, + gboolean recursive, + GError **error); GARROW_AVAILABLE_IN_0_17 -gboolean garrow_file_system_delete_dir(GArrowFileSystem *file_system, - const gchar *path, - GError **error); +gboolean +garrow_file_system_delete_dir(GArrowFileSystem *file_system, + const gchar *path, + GError **error); GARROW_AVAILABLE_IN_0_17 -gboolean garrow_file_system_delete_dir_contents(GArrowFileSystem *file_system, - const gchar *path, - GError **error); +gboolean +garrow_file_system_delete_dir_contents(GArrowFileSystem *file_system, + const gchar *path, + GError **error); GARROW_AVAILABLE_IN_0_17 -gboolean garrow_file_system_delete_file(GArrowFileSystem *file_system, - const gchar *path, - GError **error); +gboolean +garrow_file_system_delete_file(GArrowFileSystem *file_system, + const gchar *path, + GError **error); GARROW_AVAILABLE_IN_0_17 -gboolean garrow_file_system_delete_files(GArrowFileSystem *file_system, - const gchar **paths, - gsize n_paths, - GError **error); +gboolean +garrow_file_system_delete_files(GArrowFileSystem *file_system, + const gchar **paths, + gsize n_paths, + GError **error); GARROW_AVAILABLE_IN_0_17 -gboolean garrow_file_system_move(GArrowFileSystem *file_system, - const gchar *src, - const gchar *dest, - GError **error); +gboolean +garrow_file_system_move(GArrowFileSystem *file_system, + const gchar *src, + const gchar *dest, + GError **error); GARROW_AVAILABLE_IN_0_17 -gboolean garrow_file_system_copy_file(GArrowFileSystem *file_system, - const gchar *src, - const gchar *dest, - GError **error); +gboolean +garrow_file_system_copy_file(GArrowFileSystem *file_system, + const gchar *src, + const gchar *dest, + GError **error); GARROW_AVAILABLE_IN_0_17 GArrowInputStream * @@ -242,8 +243,6 @@ garrow_slow_file_system_new_average_latency_and_seed(GArrowFileSystem *base_file gdouble average_latency, gint32 seed); - - #define GARROW_TYPE_MOCK_FILE_SYSTEM (garrow_mock_file_system_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowMockFileSystem, garrow_mock_file_system, @@ -255,7 +254,6 @@ struct _GArrowMockFileSystemClass GArrowFileSystemClass parent_class; }; - #define GARROW_TYPE_HDFS_FILE_SYSTEM (garrow_hdfs_file_system_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowHDFSFileSystem, garrow_hdfs_file_system, @@ -267,7 +265,6 @@ struct _GArrowHDFSFileSystemClass GArrowFileSystemClass parent_class; }; - /** * GArrowS3LogLevel: * @GARROW_S3_LOG_LEVEL_OFF: Off. @@ -292,13 +289,9 @@ typedef enum { GARROW_S3_LOG_LEVEL_TRACE, } GArrowS3LogLevel; - #define GARROW_TYPE_S3_GLOBAL_OPTIONS (garrow_s3_global_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowS3GlobalOptions, - garrow_s3_global_options, - GARROW, - S3_GLOBAL_OPTIONS, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowS3GlobalOptions, garrow_s3_global_options, GARROW, S3_GLOBAL_OPTIONS, GObject) struct _GArrowS3GlobalOptionsClass { GObjectClass parent_class; @@ -308,41 +301,30 @@ GARROW_AVAILABLE_IN_7_0 GArrowS3GlobalOptions * garrow_s3_global_options_new(void); - GARROW_AVAILABLE_IN_7_0 gboolean garrow_s3_is_enabled(void); GARROW_AVAILABLE_IN_7_0 gboolean -garrow_s3_initialize(GArrowS3GlobalOptions *options, - GError **error); +garrow_s3_initialize(GArrowS3GlobalOptions *options, GError **error); GARROW_AVAILABLE_IN_7_0 gboolean garrow_s3_finalize(GError **error); - #define GARROW_TYPE_S3_FILE_SYSTEM (garrow_s3_file_system_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowS3FileSystem, - garrow_s3_file_system, - GARROW, - S3_FILE_SYSTEM, - GArrowFileSystem) +G_DECLARE_DERIVABLE_TYPE( + GArrowS3FileSystem, garrow_s3_file_system, GARROW, S3_FILE_SYSTEM, GArrowFileSystem) struct _GArrowS3FileSystemClass { GArrowFileSystemClass parent_class; }; - #define GARROW_TYPE_GCS_FILE_SYSTEM (garrow_gcs_file_system_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowGCSFileSystem, - garrow_gcs_file_system, - GARROW, - GCS_FILE_SYSTEM, - GArrowFileSystem) +G_DECLARE_DERIVABLE_TYPE( + GArrowGCSFileSystem, garrow_gcs_file_system, GARROW, GCS_FILE_SYSTEM, GArrowFileSystem) struct _GArrowGCSFileSystemClass { GArrowFileSystemClass parent_class; }; - G_END_DECLS diff --git a/c_glib/arrow-glib/file-system.hpp b/c_glib/arrow-glib/file-system.hpp index 6d33ba74fb199..f41fc6e9c75b0 100644 --- a/c_glib/arrow-glib/file-system.hpp +++ b/c_glib/arrow-glib/file-system.hpp @@ -30,8 +30,7 @@ arrow::fs::FileInfo * garrow_file_info_get_raw(GArrowFileInfo *file_info); GArrowFileSystem * -garrow_file_system_new_raw( - std::shared_ptr *arrow_file_system); +garrow_file_system_new_raw(std::shared_ptr *arrow_file_system); std::shared_ptr garrow_file_system_get_raw(GArrowFileSystem *file_system); @@ -42,10 +41,8 @@ garrow_sub_tree_file_system_new_raw( GArrowFileSystem *base_file_system); GArrowSlowFileSystem * -garrow_slow_file_system_new_raw( - std::shared_ptr *arrow_file_system, - GArrowFileSystem *base_file_system); - +garrow_slow_file_system_new_raw(std::shared_ptr *arrow_file_system, + GArrowFileSystem *base_file_system); #ifdef ARROW_S3 arrow::fs::S3GlobalOptions * diff --git a/c_glib/arrow-glib/file.cpp b/c_glib/arrow-glib/file.cpp index 422336b908f2d..5ab77154ab126 100644 --- a/c_glib/arrow-glib/file.cpp +++ b/c_glib/arrow-glib/file.cpp @@ -33,9 +33,7 @@ G_BEGIN_DECLS * #GArrowFile is an interface for file. */ -G_DEFINE_INTERFACE(GArrowFile, - garrow_file, - G_TYPE_OBJECT) +G_DEFINE_INTERFACE(GArrowFile, garrow_file, G_TYPE_OBJECT) static void garrow_file_default_init(GArrowFileInterface *iface) @@ -50,8 +48,7 @@ garrow_file_default_init(GArrowFileInterface *iface) * Returns: %TRUE on success, %FALSE if there was an error. */ gboolean -garrow_file_close(GArrowFile *file, - GError **error) +garrow_file_close(GArrowFile *file, GError **error) { auto arrow_file = garrow_file_get_raw(file); @@ -82,8 +79,7 @@ garrow_file_is_closed(GArrowFile *file) * Returns: The current offset on success, -1 if there was an error. */ gint64 -garrow_file_tell(GArrowFile *file, - GError **error) +garrow_file_tell(GArrowFile *file, GError **error) { auto arrow_file = garrow_file_get_raw(file); diff --git a/c_glib/arrow-glib/file.h b/c_glib/arrow-glib/file.h index 45319b85c9652..cbb2b9afd38ba 100644 --- a/c_glib/arrow-glib/file.h +++ b/c_glib/arrow-glib/file.h @@ -26,18 +26,16 @@ G_BEGIN_DECLS #define GARROW_TYPE_FILE (garrow_file_get_type()) -G_DECLARE_INTERFACE(GArrowFile, - garrow_file, - GARROW, - FILE, - GObject) +G_DECLARE_INTERFACE(GArrowFile, garrow_file, GARROW, FILE, GObject) -gboolean garrow_file_close(GArrowFile *file, - GError **error); +gboolean +garrow_file_close(GArrowFile *file, GError **error); GARROW_AVAILABLE_IN_0_13 -gboolean garrow_file_is_closed(GArrowFile *file); -gint64 garrow_file_tell(GArrowFile *file, - GError **error); -GArrowFileMode garrow_file_get_mode(GArrowFile *file); +gboolean +garrow_file_is_closed(GArrowFile *file); +gint64 +garrow_file_tell(GArrowFile *file, GError **error); +GArrowFileMode +garrow_file_get_mode(GArrowFile *file); G_END_DECLS diff --git a/c_glib/arrow-glib/file.hpp b/c_glib/arrow-glib/file.hpp index c4cc78747cf6a..298d308ef2f5f 100644 --- a/c_glib/arrow-glib/file.hpp +++ b/c_glib/arrow-glib/file.hpp @@ -35,4 +35,5 @@ struct _GArrowFileInterface std::shared_ptr (*get_raw)(GArrowFile *file); }; -std::shared_ptr garrow_file_get_raw(GArrowFile *file); +std::shared_ptr +garrow_file_get_raw(GArrowFile *file); diff --git a/c_glib/arrow-glib/gobject-type.h b/c_glib/arrow-glib/gobject-type.h index c9ac9ea8175af..617f8d7802569 100644 --- a/c_glib/arrow-glib/gobject-type.h +++ b/c_glib/arrow-glib/gobject-type.h @@ -22,95 +22,80 @@ #include #ifndef G_DECLARE_DERIVABLE_TYPE -# define G_DECLARE_DERIVABLE_TYPE(ObjectName, \ - object_name, \ - MODULE_NAME, \ - OBJECT_NAME, \ - ParentName) \ - typedef struct _ ## ObjectName ObjectName; \ - typedef struct _ ## ObjectName ## Class ObjectName ## Class; \ - \ - struct _ ## ObjectName \ - { \ - ParentName parent_instance; \ - }; \ - \ - GType object_name ## _get_type(void) G_GNUC_CONST; \ - \ - static inline ObjectName * \ - MODULE_NAME ## _ ## OBJECT_NAME(gpointer object) \ - { \ - return G_TYPE_CHECK_INSTANCE_CAST(object, \ - object_name ## _get_type(), \ - ObjectName); \ - } \ - \ - static inline ObjectName ## Class * \ - MODULE_NAME ## _ ## OBJECT_NAME ## _CLASS(gpointer klass) \ - { \ - return G_TYPE_CHECK_CLASS_CAST(klass, \ - object_name ## _get_type(), \ - ObjectName ## Class); \ - } \ - \ - static inline gboolean \ - MODULE_NAME ## _IS_ ## OBJECT_NAME(gpointer object) \ - { \ - return G_TYPE_CHECK_INSTANCE_TYPE(object, \ - object_name ## _get_type()); \ - } \ - \ - static inline gboolean \ - MODULE_NAME ## _IS_ ## OBJECT_NAME ## _CLASS(gpointer klass) \ - { \ - return G_TYPE_CHECK_CLASS_TYPE(klass, \ - object_name ## _get_type()); \ - } \ - \ - static inline ObjectName ## Class * \ - MODULE_NAME ## _ ## ObjectName ## _GET_CLASS(gpointer object) \ - { \ - return G_TYPE_INSTANCE_GET_CLASS(object, \ - object_name ## _get_type(), \ - ObjectName ## Class); \ - } +# define G_DECLARE_DERIVABLE_TYPE(ObjectName, \ + object_name, \ + MODULE_NAME, \ + OBJECT_NAME, \ + ParentName) \ + typedef struct _##ObjectName ObjectName; \ + typedef struct _##ObjectName##Class ObjectName##Class; \ + \ + struct _##ObjectName \ + { \ + ParentName parent_instance; \ + }; \ + \ + GType object_name##_get_type(void) G_GNUC_CONST; \ + \ + static inline ObjectName *MODULE_NAME##_##OBJECT_NAME(gpointer object) \ + { \ + return G_TYPE_CHECK_INSTANCE_CAST(object, object_name##_get_type(), ObjectName); \ + } \ + \ + static inline ObjectName##Class *MODULE_NAME##_##OBJECT_NAME##_CLASS(gpointer klass) \ + { \ + return G_TYPE_CHECK_CLASS_CAST(klass, \ + object_name##_get_type(), \ + ObjectName##Class); \ + } \ + \ + static inline gboolean MODULE_NAME##_IS_##OBJECT_NAME(gpointer object) \ + { \ + return G_TYPE_CHECK_INSTANCE_TYPE(object, object_name##_get_type()); \ + } \ + \ + static inline gboolean MODULE_NAME##_IS_##OBJECT_NAME##_CLASS(gpointer klass) \ + { \ + return G_TYPE_CHECK_CLASS_TYPE(klass, object_name##_get_type()); \ + } \ + \ + static inline ObjectName##Class *MODULE_NAME##_##ObjectName##_GET_CLASS( \ + gpointer object) \ + { \ + return G_TYPE_INSTANCE_GET_CLASS(object, \ + object_name##_get_type(), \ + ObjectName##Class); \ + } #endif #ifndef G_DECLARE_INTERFACE -# define G_DECLARE_INTERFACE(ModuleObjectName, \ - module_object_name, \ - MODULE_NAME, \ - OBJECT_NAME, \ - PrerequisiteName) \ - typedef struct \ - _ ## ModuleObjectName \ - ModuleObjectName; \ - typedef struct \ - _ ## ModuleObjectName ## Interface \ - ModuleObjectName ## Interface; \ - \ - GType module_object_name ## _get_type(void); \ - \ - static inline ModuleObjectName * \ - MODULE_NAME ## _ ## OBJECT_NAME(gpointer object) \ - { \ - return G_TYPE_CHECK_INSTANCE_CAST(object, \ - module_object_name ## _get_type(), \ - ModuleObjectName); \ - } \ - \ - static inline gboolean \ - MODULE_NAME ## _IS_ ## OBJECT_NAME(gpointer object) \ - { \ - return G_TYPE_CHECK_INSTANCE_TYPE( \ - object, module_object_name ## _get_type()); \ - } \ - \ - static inline ModuleObjectName ## Interface * \ - MODULE_NAME ## _ ## OBJECT_NAME ## _GET_IFACE(gpointer object) \ - { \ - return G_TYPE_INSTANCE_GET_INTERFACE(object, \ - module_object_name ## _get_type(), \ - ModuleObjectName ## Interface); \ - } +# define G_DECLARE_INTERFACE(ModuleObjectName, \ + module_object_name, \ + MODULE_NAME, \ + OBJECT_NAME, \ + PrerequisiteName) \ + typedef struct _##ModuleObjectName ModuleObjectName; \ + typedef struct _##ModuleObjectName##Interface ModuleObjectName##Interface; \ + \ + GType module_object_name##_get_type(void); \ + \ + static inline ModuleObjectName *MODULE_NAME##_##OBJECT_NAME(gpointer object) \ + { \ + return G_TYPE_CHECK_INSTANCE_CAST(object, \ + module_object_name##_get_type(), \ + ModuleObjectName); \ + } \ + \ + static inline gboolean MODULE_NAME##_IS_##OBJECT_NAME(gpointer object) \ + { \ + return G_TYPE_CHECK_INSTANCE_TYPE(object, module_object_name##_get_type()); \ + } \ + \ + static inline ModuleObjectName##Interface *MODULE_NAME##_##OBJECT_NAME##_GET_IFACE( \ + gpointer object) \ + { \ + return G_TYPE_INSTANCE_GET_INTERFACE(object, \ + module_object_name##_get_type(), \ + ModuleObjectName##Interface); \ + } #endif diff --git a/c_glib/arrow-glib/input-stream.cpp b/c_glib/arrow-glib/input-stream.cpp index b65e89845480c..03a3f03fff7ce 100644 --- a/c_glib/arrow-glib/input-stream.cpp +++ b/c_glib/arrow-glib/input-stream.cpp @@ -62,7 +62,8 @@ G_BEGIN_DECLS * compressed input stream. */ -typedef struct GArrowInputStreamPrivate_ { +typedef struct GArrowInputStreamPrivate_ +{ std::shared_ptr input_stream; } GArrowInputStreamPrivate; @@ -74,8 +75,7 @@ static std::shared_ptr garrow_input_stream_get_raw_file_interface(GArrowFile *file) { auto input_stream = GARROW_INPUT_STREAM(file); - auto arrow_input_stream = - garrow_input_stream_get_raw(input_stream); + auto arrow_input_stream = garrow_input_stream_get_raw(input_stream); return arrow_input_stream; } @@ -99,19 +99,18 @@ garrow_input_stream_readable_interface_init(GArrowReadableInterface *iface) iface->get_raw = garrow_input_stream_get_raw_readable_interface; } -G_DEFINE_TYPE_WITH_CODE(GArrowInputStream, - garrow_input_stream, - G_TYPE_INPUT_STREAM, - G_ADD_PRIVATE(GArrowInputStream) - G_IMPLEMENT_INTERFACE(GARROW_TYPE_FILE, - garrow_input_stream_file_interface_init) - G_IMPLEMENT_INTERFACE(GARROW_TYPE_READABLE, - garrow_input_stream_readable_interface_init)) +G_DEFINE_TYPE_WITH_CODE( + GArrowInputStream, + garrow_input_stream, + G_TYPE_INPUT_STREAM, + G_ADD_PRIVATE(GArrowInputStream) + G_IMPLEMENT_INTERFACE(GARROW_TYPE_FILE, garrow_input_stream_file_interface_init) + G_IMPLEMENT_INTERFACE(GARROW_TYPE_READABLE, + garrow_input_stream_readable_interface_init)) -#define GARROW_INPUT_STREAM_GET_PRIVATE(obj) \ - static_cast( \ - garrow_input_stream_get_instance_private( \ - GARROW_INPUT_STREAM(obj))) +#define GARROW_INPUT_STREAM_GET_PRIVATE(obj) \ + static_cast( \ + garrow_input_stream_get_instance_private(GARROW_INPUT_STREAM(obj))) static void garrow_input_stream_finalize(GObject *object) @@ -165,8 +164,7 @@ garrow_input_stream_read(GInputStream *stream, if (g_cancellable_set_error_if_cancelled(cancellable, error)) { return -1; } - auto arrow_input_stream = - garrow_input_stream_get_raw(GARROW_INPUT_STREAM(stream)); + auto arrow_input_stream = garrow_input_stream_get_raw(GARROW_INPUT_STREAM(stream)); auto n_read_bytes = arrow_input_stream->Read(count, buffer); if (!garrow::check(error, n_read_bytes, "[input-stream][read]")) { return -1; @@ -183,8 +181,7 @@ garrow_input_stream_skip(GInputStream *stream, if (g_cancellable_set_error_if_cancelled(cancellable, error)) { return -1; } - auto arrow_input_stream = - garrow_input_stream_get_raw(GARROW_INPUT_STREAM(stream)); + auto arrow_input_stream = garrow_input_stream_get_raw(GARROW_INPUT_STREAM(stream)); auto status = arrow_input_stream->Advance(count); if (!garrow_error_check(error, status, "[input-stream][skip]")) { return -1; @@ -193,15 +190,12 @@ garrow_input_stream_skip(GInputStream *stream, } static gboolean -garrow_input_stream_close(GInputStream *stream, - GCancellable *cancellable, - GError **error) +garrow_input_stream_close(GInputStream *stream, GCancellable *cancellable, GError **error) { if (g_cancellable_set_error_if_cancelled(cancellable, error)) { return FALSE; } - auto arrow_input_stream = - garrow_input_stream_get_raw(GARROW_INPUT_STREAM(stream)); + auto arrow_input_stream = garrow_input_stream_get_raw(GARROW_INPUT_STREAM(stream)); auto status = arrow_input_stream->Close(); return garrow_error_check(error, status, "[input-stream][close]"); } @@ -210,14 +204,14 @@ static void garrow_input_stream_init(GArrowInputStream *object) { auto priv = GARROW_INPUT_STREAM_GET_PRIVATE(object); - new(&priv->input_stream) std::shared_ptr; + new (&priv->input_stream) std::shared_ptr; } static void garrow_input_stream_class_init(GArrowInputStreamClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_input_stream_finalize; + gobject_class->finalize = garrow_input_stream_finalize; gobject_class->set_property = garrow_input_stream_set_property; gobject_class->get_property = garrow_input_stream_get_property; @@ -227,11 +221,11 @@ garrow_input_stream_class_init(GArrowInputStreamClass *klass) input_stream_class->close_fn = garrow_input_stream_close; GParamSpec *spec; - spec = g_param_spec_pointer("input-stream", - "Input stream", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "input-stream", + "Input stream", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_INPUT_STREAM, spec); } @@ -272,8 +266,7 @@ garrow_input_stream_align(GArrowInputStream *input_stream, GError **error) { auto arrow_input_stream = garrow_input_stream_get_raw(input_stream); - auto status = arrow::ipc::AlignStream(arrow_input_stream.get(), - alignment); + auto status = arrow::ipc::AlignStream(arrow_input_stream.get(), alignment); return garrow_error_check(error, status, "[input-stream][align]"); } @@ -288,8 +281,7 @@ garrow_input_stream_align(GArrowInputStream *input_stream, * Since: 0.11.0 */ GArrowTensor * -garrow_input_stream_read_tensor(GArrowInputStream *input_stream, - GError **error) +garrow_input_stream_read_tensor(GArrowInputStream *input_stream, GError **error) { auto arrow_input_stream = garrow_input_stream_get_raw(input_stream); @@ -324,30 +316,23 @@ garrow_input_stream_read_record_batch(GArrowInputStream *input_stream, if (options) { auto arrow_options = garrow_read_options_get_raw(options); - auto arrow_dictionary_memo = - garrow_read_options_get_dictionary_memo_raw(options); - auto arrow_record_batch = - arrow::ipc::ReadRecordBatch(arrow_schema, - arrow_dictionary_memo, - *arrow_options, - arrow_input_stream.get()); - if (garrow::check(error, - arrow_record_batch, - "[input-stream][read-record-batch]")) { + auto arrow_dictionary_memo = garrow_read_options_get_dictionary_memo_raw(options); + auto arrow_record_batch = arrow::ipc::ReadRecordBatch(arrow_schema, + arrow_dictionary_memo, + *arrow_options, + arrow_input_stream.get()); + if (garrow::check(error, arrow_record_batch, "[input-stream][read-record-batch]")) { return garrow_record_batch_new_raw(&(*arrow_record_batch)); } else { return NULL; } } else { auto arrow_options = arrow::ipc::IpcReadOptions::Defaults(); - auto arrow_record_batch = - arrow::ipc::ReadRecordBatch(arrow_schema, - nullptr, - arrow_options, - arrow_input_stream.get()); - if (garrow::check(error, - arrow_record_batch, - "[input-stream][read-record-batch]")) { + auto arrow_record_batch = arrow::ipc::ReadRecordBatch(arrow_schema, + nullptr, + arrow_options, + arrow_input_stream.get()); + if (garrow::check(error, arrow_record_batch, "[input-stream][read-record-batch]")) { return garrow_record_batch_new_raw(&(*arrow_record_batch)); } else { return NULL; @@ -355,7 +340,6 @@ garrow_input_stream_read_record_batch(GArrowInputStream *input_stream, } } - G_DEFINE_TYPE(GArrowSeekableInputStream, garrow_seekable_input_stream, GARROW_TYPE_INPUT_STREAM); @@ -381,8 +365,7 @@ guint64 garrow_seekable_input_stream_get_size(GArrowSeekableInputStream *input_stream, GError **error) { - auto arrow_random_access_file = - garrow_seekable_input_stream_get_raw(input_stream); + auto arrow_random_access_file = garrow_seekable_input_stream_get_raw(input_stream); auto size = arrow_random_access_file->GetSize(); if (garrow::check(error, size, "[seekable-input-stream][get-size]")) { return size.ValueOrDie(); @@ -398,10 +381,10 @@ garrow_seekable_input_stream_get_size(GArrowSeekableInputStream *input_stream, * Returns: Whether zero copy read is supported or not. */ gboolean -garrow_seekable_input_stream_get_support_zero_copy(GArrowSeekableInputStream *input_stream) +garrow_seekable_input_stream_get_support_zero_copy( + GArrowSeekableInputStream *input_stream) { - auto arrow_random_access_file = - garrow_seekable_input_stream_get_raw(input_stream); + auto arrow_random_access_file = garrow_seekable_input_stream_get_raw(input_stream); return arrow_random_access_file->supports_zero_copy(); } @@ -421,8 +404,7 @@ garrow_seekable_input_stream_read_at(GArrowSeekableInputStream *input_stream, gint64 n_bytes, GError **error) { - auto arrow_random_access_file = - garrow_seekable_input_stream_get_raw(input_stream); + auto arrow_random_access_file = garrow_seekable_input_stream_get_raw(input_stream); auto arrow_buffer = arrow_random_access_file->ReadAt(position, n_bytes); if (garrow::check(error, arrow_buffer, "[seekable-input-stream][read-at]")) { @@ -450,8 +432,7 @@ garrow_seekable_input_stream_read_at_bytes(GArrowSeekableInputStream *input_stre gint64 n_bytes, GError **error) { - auto arrow_random_access_file = - garrow_seekable_input_stream_get_raw(input_stream); + auto arrow_random_access_file = garrow_seekable_input_stream_get_raw(input_stream); auto arrow_buffer_result = arrow_random_access_file->ReadAt(position, n_bytes); if (!garrow::check(error, @@ -461,8 +442,7 @@ garrow_seekable_input_stream_read_at_bytes(GArrowSeekableInputStream *input_stre } auto arrow_cpu_buffer_result = - arrow::Buffer::ViewOrCopy(*arrow_buffer_result, - arrow::default_cpu_memory_manager()); + arrow::Buffer::ViewOrCopy(*arrow_buffer_result, arrow::default_cpu_memory_manager()); if (!garrow::check(error, arrow_cpu_buffer_result, "[seekable-input-stream][read-at][bytes][view-or-copy]")) { @@ -470,11 +450,9 @@ garrow_seekable_input_stream_read_at_bytes(GArrowSeekableInputStream *input_stre } auto arrow_cpu_buffer = *arrow_cpu_buffer_result; - return g_bytes_new(arrow_cpu_buffer->data(), - arrow_cpu_buffer->size()); + return g_bytes_new(arrow_cpu_buffer->data(), arrow_cpu_buffer->size()); } - /** * garrow_seekable_input_stream_peek: * @input_stream: A #GArrowSeekableInputStream. @@ -494,8 +472,7 @@ garrow_seekable_input_stream_peek(GArrowSeekableInputStream *input_stream, gint64 n_bytes, GError **error) { - auto arrow_random_access_file = - garrow_seekable_input_stream_get_raw(input_stream); + auto arrow_random_access_file = garrow_seekable_input_stream_get_raw(input_stream); auto view_result = arrow_random_access_file->Peek(n_bytes); if (garrow::check(error, view_result, "[seekable-input-stream][peek]")) { @@ -506,8 +483,8 @@ garrow_seekable_input_stream_peek(GArrowSeekableInputStream *input_stream, } } - -typedef struct GArrowBufferInputStreamPrivate_ { +typedef struct GArrowBufferInputStreamPrivate_ +{ GArrowBuffer *buffer; } GArrowBufferInputStreamPrivate; @@ -519,10 +496,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowBufferInputStream, garrow_buffer_input_stream, GARROW_TYPE_SEEKABLE_INPUT_STREAM); -#define GARROW_BUFFER_INPUT_STREAM_GET_PRIVATE(obj) \ - static_cast( \ - garrow_buffer_input_stream_get_instance_private( \ - GARROW_BUFFER_INPUT_STREAM(obj))) +#define GARROW_BUFFER_INPUT_STREAM_GET_PRIVATE(obj) \ + static_cast( \ + garrow_buffer_input_stream_get_instance_private(GARROW_BUFFER_INPUT_STREAM(obj))) static void garrow_buffer_input_stream_dispose(GObject *object) @@ -583,17 +559,17 @@ garrow_buffer_input_stream_class_init(GArrowBufferInputStreamClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_buffer_input_stream_dispose; + gobject_class->dispose = garrow_buffer_input_stream_dispose; gobject_class->set_property = garrow_buffer_input_stream_set_property; gobject_class->get_property = garrow_buffer_input_stream_get_property; GParamSpec *spec; - spec = g_param_spec_object("buffer", - "Buffer", - "The data", - GARROW_TYPE_BUFFER, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "buffer", + "Buffer", + "The data", + GARROW_TYPE_BUFFER, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_BUFFER, spec); } @@ -607,8 +583,7 @@ GArrowBufferInputStream * garrow_buffer_input_stream_new(GArrowBuffer *buffer) { auto arrow_buffer = garrow_buffer_get_raw(buffer); - auto arrow_buffer_reader = - std::make_shared(arrow_buffer); + auto arrow_buffer_reader = std::make_shared(arrow_buffer); return garrow_buffer_input_stream_new_raw(&arrow_buffer_reader, buffer); } @@ -632,7 +607,6 @@ garrow_buffer_input_stream_get_buffer(GArrowBufferInputStream *input_stream) return garrow_buffer_new_raw(&arrow_buffer); } - G_DEFINE_TYPE(GArrowFileInputStream, garrow_file_input_stream, GARROW_TYPE_SEEKABLE_INPUT_STREAM); @@ -658,8 +632,7 @@ garrow_file_input_stream_class_init(GArrowFileInputStreamClass *klass) * Since: 6.0.0 */ GArrowFileInputStream * -garrow_file_input_stream_new(const gchar *path, - GError **error) +garrow_file_input_stream_new(const gchar *path, GError **error) { auto arrow_stream_result = arrow::io::ReadableFile::Open(path); if (garrow::check(error, arrow_stream_result, "[file-input-stream][new]")) { @@ -681,8 +654,7 @@ garrow_file_input_stream_new(const gchar *path, * Since: 6.0.0 */ GArrowFileInputStream * -garrow_file_input_stream_new_file_descriptor(gint file_descriptor, - GError **error) +garrow_file_input_stream_new_file_descriptor(gint file_descriptor, GError **error) { auto arrow_stream_result = arrow::io::ReadableFile::Open(file_descriptor); if (garrow::check(error, @@ -706,13 +678,11 @@ garrow_file_input_stream_new_file_descriptor(gint file_descriptor, gint garrow_file_input_stream_get_file_descriptor(GArrowFileInputStream *stream) { - auto arrow_stream = - std::static_pointer_cast( - garrow_input_stream_get_raw(GARROW_INPUT_STREAM(stream))); + auto arrow_stream = std::static_pointer_cast( + garrow_input_stream_get_raw(GARROW_INPUT_STREAM(stream))); return arrow_stream->file_descriptor(); } - G_DEFINE_TYPE(GArrowMemoryMappedInputStream, garrow_memory_mapped_input_stream, GARROW_TYPE_SEEKABLE_INPUT_STREAM); @@ -736,14 +706,11 @@ garrow_memory_mapped_input_stream_class_init(GArrowMemoryMappedInputStreamClass * or %NULL on error. */ GArrowMemoryMappedInputStream * -garrow_memory_mapped_input_stream_new(const gchar *path, - GError **error) +garrow_memory_mapped_input_stream_new(const gchar *path, GError **error) { auto arrow_stream_result = arrow::io::MemoryMappedFile::Open(path, arrow::io::FileMode::READ); - if (garrow::check(error, - arrow_stream_result, - "[memory-mapped-input-stream][new]")) { + if (garrow::check(error, arrow_stream_result, "[memory-mapped-input-stream][new]")) { auto arrow_stream = *arrow_stream_result; return garrow_memory_mapped_input_stream_new_raw(&arrow_stream); } else { @@ -751,31 +718,33 @@ garrow_memory_mapped_input_stream_new(const gchar *path, } } - G_END_DECLS namespace garrow { class GIOInputStream : public arrow::io::RandomAccessFile { public: - GIOInputStream(GInputStream *input_stream) : - input_stream_(input_stream), - lock_() { + GIOInputStream(GInputStream *input_stream) : input_stream_(input_stream), lock_() + { g_object_ref(input_stream_); } - ~GIOInputStream() { - g_object_unref(input_stream_); - } + ~GIOInputStream() { g_object_unref(input_stream_); } - GInputStream *get_input_stream() { + GInputStream * + get_input_stream() + { return input_stream_; } - bool closed() const override { + bool + closed() const override + { return static_cast(g_input_stream_is_closed(input_stream_)); } - arrow::Status Close() override { + arrow::Status + Close() override + { std::lock_guard guard(lock_); GError *error = NULL; if (g_input_stream_close(input_stream_, NULL, &error)) { @@ -787,7 +756,9 @@ namespace garrow { } } - arrow::Result Tell() const override { + arrow::Result + Tell() const override + { if (!(G_IS_SEEKABLE(input_stream_) && g_seekable_can_seek(G_SEEKABLE(input_stream_)))) { std::string message("[gio-input-stream][tell] " @@ -800,16 +771,14 @@ namespace garrow { return g_seekable_tell(G_SEEKABLE(input_stream_)); } - arrow::Result Read(int64_t n_bytes, void *out) override { + arrow::Result + Read(int64_t n_bytes, void *out) override + { std::lock_guard guard(lock_); GError *error = NULL; gsize n_read_bytes = 0; - auto success = g_input_stream_read_all(input_stream_, - out, - n_bytes, - &n_read_bytes, - NULL, - &error); + auto success = + g_input_stream_read_all(input_stream_, out, n_bytes, &n_read_bytes, NULL, &error); if (success) { return n_read_bytes; } else { @@ -819,19 +788,21 @@ namespace garrow { } } - arrow::Result ReadAt(int64_t position, - int64_t n_bytes, - void* out) override { + arrow::Result + ReadAt(int64_t position, int64_t n_bytes, void *out) override + { return arrow::io::RandomAccessFile::ReadAt(position, n_bytes, out); } arrow::Result> - ReadAt(int64_t position, int64_t n_bytes) override { + ReadAt(int64_t position, int64_t n_bytes) override + { return arrow::io::RandomAccessFile::ReadAt(position, n_bytes); } arrow::Result> - Read(int64_t n_bytes) override { + Read(int64_t n_bytes) override + { ARROW_ASSIGN_OR_RAISE(auto buffer, arrow::AllocateResizableBuffer(n_bytes)); std::lock_guard guard(lock_); @@ -855,7 +826,9 @@ namespace garrow { } } - arrow::Result Peek(int64_t nbytes) override { + arrow::Result + Peek(int64_t nbytes) override + { if (!G_IS_BUFFERED_INPUT_STREAM(input_stream_)) { std::string message("[gio-input-stream][peek] " "not peekable input stream: <"); @@ -868,8 +841,7 @@ namespace garrow { auto available_n_bytes = g_buffered_input_stream_get_available(stream); if (available_n_bytes < static_cast(nbytes)) { GError *error = NULL; - auto filled_size = - g_buffered_input_stream_fill(stream, nbytes, NULL, &error); + auto filled_size = g_buffered_input_stream_fill(stream, nbytes, NULL, &error); if (filled_size == -1) { return garrow_error_to_status(error, arrow::StatusCode::IOError, @@ -885,7 +857,9 @@ namespace garrow { return std::string_view(static_cast(data), data_size); } - arrow::Status Seek(int64_t position) override { + arrow::Status + Seek(int64_t position) override + { if (!G_IS_SEEKABLE(input_stream_)) { std::string message("[gio-input-stream][seek] " "not seekable input stream: <"); @@ -909,7 +883,9 @@ namespace garrow { } } - arrow::Result GetSize() override { + arrow::Result + GetSize() override + { if (!G_IS_SEEKABLE(input_stream_)) { std::string message("[gio-input-stream][size] " "not seekable input stream: <"); @@ -921,11 +897,7 @@ namespace garrow { std::lock_guard guard(lock_); auto current_position = g_seekable_tell(G_SEEKABLE(input_stream_)); GError *error = NULL; - if (!g_seekable_seek(G_SEEKABLE(input_stream_), - 0, - G_SEEK_END, - NULL, - &error)) { + if (!g_seekable_seek(G_SEEKABLE(input_stream_), 0, G_SEEK_END, NULL, &error)) { return garrow_error_to_status(error, arrow::StatusCode::IOError, "[gio-input-stream][size][seek]"); @@ -943,7 +915,9 @@ namespace garrow { return size; } - bool supports_zero_copy() const override { + bool + supports_zero_copy() const override + { return false; } @@ -951,12 +925,12 @@ namespace garrow { GInputStream *input_stream_; std::mutex lock_; }; -}; +}; // namespace garrow G_BEGIN_DECLS - -typedef struct GArrowGIOInputStreamPrivate_ { +typedef struct GArrowGIOInputStreamPrivate_ +{ GInputStream *raw; } GArrowGIOInputStreamPrivate; @@ -968,10 +942,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowGIOInputStream, garrow_gio_input_stream, GARROW_TYPE_SEEKABLE_INPUT_STREAM); -#define GARROW_GIO_INPUT_STREAM_GET_PRIVATE(object) \ - static_cast( \ - garrow_gio_input_stream_get_instance_private( \ - GARROW_GIO_INPUT_STREAM(object))) +#define GARROW_GIO_INPUT_STREAM_GET_PRIVATE(object) \ + static_cast( \ + garrow_gio_input_stream_get_instance_private(GARROW_GIO_INPUT_STREAM(object))) static void garrow_gio_input_stream_dispose(GObject *object) @@ -1032,17 +1005,17 @@ garrow_gio_input_stream_class_init(GArrowGIOInputStreamClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_gio_input_stream_dispose; + gobject_class->dispose = garrow_gio_input_stream_dispose; gobject_class->set_property = garrow_gio_input_stream_set_property; gobject_class->get_property = garrow_gio_input_stream_get_property; GParamSpec *spec; - spec = g_param_spec_object("raw", - "Raw", - "The raw GInputStream *", - G_TYPE_INPUT_STREAM, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "raw", + "Raw", + "The raw GInputStream *", + G_TYPE_INPUT_STREAM, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_GIO_RAW, spec); } @@ -1057,11 +1030,12 @@ garrow_gio_input_stream_class_init(GArrowGIOInputStreamClass *klass) GArrowGIOInputStream * garrow_gio_input_stream_new(GInputStream *gio_input_stream) { - auto arrow_input_stream = - std::make_shared(gio_input_stream); + auto arrow_input_stream = std::make_shared(gio_input_stream); auto object = g_object_new(GARROW_TYPE_GIO_INPUT_STREAM, - "input-stream", &arrow_input_stream, - "raw", gio_input_stream, + "input-stream", + &arrow_input_stream, + "raw", + gio_input_stream, NULL); auto input_stream = GARROW_GIO_INPUT_STREAM(object); return input_stream; @@ -1084,7 +1058,8 @@ garrow_gio_input_stream_get_raw(GArrowGIOInputStream *input_stream) return priv->raw; } -typedef struct GArrowCompressedInputStreamPrivate_ { +typedef struct GArrowCompressedInputStreamPrivate_ +{ GArrowCodec *codec; GArrowInputStream *raw; } GArrowCompressedInputStreamPrivate; @@ -1098,9 +1073,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowCompressedInputStream, garrow_compressed_input_stream, GARROW_TYPE_INPUT_STREAM) -#define GARROW_COMPRESSED_INPUT_STREAM_GET_PRIVATE(object) \ - static_cast( \ - garrow_compressed_input_stream_get_instance_private( \ +#define GARROW_COMPRESSED_INPUT_STREAM_GET_PRIVATE(object) \ + static_cast( \ + garrow_compressed_input_stream_get_instance_private( \ GARROW_COMPRESSED_INPUT_STREAM(object))) static void @@ -1173,25 +1148,25 @@ garrow_compressed_input_stream_class_init(GArrowCompressedInputStreamClass *klas { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_compressed_input_stream_dispose; + gobject_class->dispose = garrow_compressed_input_stream_dispose; gobject_class->set_property = garrow_compressed_input_stream_set_property; gobject_class->get_property = garrow_compressed_input_stream_get_property; GParamSpec *spec; - spec = g_param_spec_object("codec", - "Codec", - "The codec for the stream", - GARROW_TYPE_CODEC, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "codec", + "Codec", + "The codec for the stream", + GARROW_TYPE_CODEC, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_CODEC, spec); - spec = g_param_spec_object("raw", - "Raw", - "The underlying raw input stream", - GARROW_TYPE_INPUT_STREAM, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "raw", + "Raw", + "The underlying raw input stream", + GARROW_TYPE_INPUT_STREAM, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_RAW, spec); } @@ -1212,8 +1187,7 @@ garrow_compressed_input_stream_new(GArrowCodec *codec, { auto arrow_codec = garrow_codec_get_raw(codec).get(); auto arrow_raw = garrow_input_stream_get_raw(raw); - auto arrow_stream = - arrow::io::CompressedInputStream::Make(arrow_codec, arrow_raw); + auto arrow_stream = arrow::io::CompressedInputStream::Make(arrow_codec, arrow_raw); if (garrow::check(error, arrow_stream, "[compressed-input-stream][new]")) { return garrow_compressed_input_stream_new_raw(&(arrow_stream.ValueOrDie()), codec, @@ -1228,10 +1202,8 @@ G_END_DECLS GArrowInputStream * garrow_input_stream_new_raw(std::shared_ptr *arrow_input_stream) { - auto input_stream = - GARROW_INPUT_STREAM(g_object_new(GARROW_TYPE_INPUT_STREAM, - "input-stream", arrow_input_stream, - NULL)); + auto input_stream = GARROW_INPUT_STREAM( + g_object_new(GARROW_TYPE_INPUT_STREAM, "input-stream", arrow_input_stream, NULL)); return input_stream; } @@ -1247,14 +1219,14 @@ garrow_seekable_input_stream_new_raw( std::shared_ptr *arrow_random_access_file) { auto object = g_object_new(GARROW_TYPE_SEEKABLE_INPUT_STREAM, - "input-stream", arrow_random_access_file, + "input-stream", + arrow_random_access_file, NULL); return GARROW_SEEKABLE_INPUT_STREAM(object); } std::shared_ptr -garrow_seekable_input_stream_get_raw( - GArrowSeekableInputStream *seekable_input_stream) +garrow_seekable_input_stream_get_raw(GArrowSeekableInputStream *seekable_input_stream) { auto arrow_input_stream = garrow_input_stream_get_raw(GARROW_INPUT_STREAM(seekable_input_stream)); @@ -1264,13 +1236,15 @@ garrow_seekable_input_stream_get_raw( } GArrowBufferInputStream * -garrow_buffer_input_stream_new_raw(std::shared_ptr *arrow_buffer_reader, - GArrowBuffer *buffer) +garrow_buffer_input_stream_new_raw( + std::shared_ptr *arrow_buffer_reader, GArrowBuffer *buffer) { auto buffer_input_stream = GARROW_BUFFER_INPUT_STREAM(g_object_new(GARROW_TYPE_BUFFER_INPUT_STREAM, - "input-stream", arrow_buffer_reader, - "buffer", buffer, + "input-stream", + arrow_buffer_reader, + "buffer", + buffer, NULL)); return buffer_input_stream; } @@ -1285,44 +1259,44 @@ garrow_buffer_input_stream_get_raw(GArrowBufferInputStream *buffer_input_stream) return arrow_buffer_reader; } - GArrowFileInputStream * -garrow_file_input_stream_new_raw( - std::shared_ptr *arrow_stream) +garrow_file_input_stream_new_raw(std::shared_ptr *arrow_stream) { - return GARROW_FILE_INPUT_STREAM(g_object_new(GARROW_TYPE_FILE_INPUT_STREAM, - "input-stream", arrow_stream, - NULL)); + return GARROW_FILE_INPUT_STREAM( + g_object_new(GARROW_TYPE_FILE_INPUT_STREAM, "input-stream", arrow_stream, NULL)); } - GArrowMemoryMappedInputStream * garrow_memory_mapped_input_stream_new_raw( std::shared_ptr *arrow_stream) { return GARROW_MEMORY_MAPPED_INPUT_STREAM( g_object_new(GARROW_TYPE_MEMORY_MAPPED_INPUT_STREAM, - "input-stream", arrow_stream, + "input-stream", + arrow_stream, NULL)); } - GArrowCompressedInputStream * -garrow_compressed_input_stream_new_raw(std::shared_ptr *arrow_raw, - GArrowCodec *codec, - GArrowInputStream *raw) -{ - auto compressed_input_stream = - g_object_new(GARROW_TYPE_COMPRESSED_INPUT_STREAM, - "input-stream", arrow_raw, - "codec", codec, - "raw", raw, - NULL); +garrow_compressed_input_stream_new_raw( + std::shared_ptr *arrow_raw, + GArrowCodec *codec, + GArrowInputStream *raw) +{ + auto compressed_input_stream = g_object_new(GARROW_TYPE_COMPRESSED_INPUT_STREAM, + "input-stream", + arrow_raw, + "codec", + codec, + "raw", + raw, + NULL); return GARROW_COMPRESSED_INPUT_STREAM(compressed_input_stream); } std::shared_ptr -garrow_compressed_input_stream_get_raw(GArrowCompressedInputStream *compressed_input_stream) +garrow_compressed_input_stream_get_raw( + GArrowCompressedInputStream *compressed_input_stream) { auto input_stream = GARROW_INPUT_STREAM(compressed_input_stream); auto arrow_input_stream = garrow_input_stream_get_raw(input_stream); diff --git a/c_glib/arrow-glib/input-stream.h b/c_glib/arrow-glib/input-stream.h index 5f583c80486f4..29f6288b74f08 100644 --- a/c_glib/arrow-glib/input-stream.h +++ b/c_glib/arrow-glib/input-stream.h @@ -30,24 +30,23 @@ G_BEGIN_DECLS #define GARROW_TYPE_INPUT_STREAM (garrow_input_stream_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowInputStream, - garrow_input_stream, - GARROW, - INPUT_STREAM, - GInputStream) +G_DECLARE_DERIVABLE_TYPE( + GArrowInputStream, garrow_input_stream, GARROW, INPUT_STREAM, GInputStream) struct _GArrowInputStreamClass { GInputStreamClass parent_class; }; -gboolean garrow_input_stream_advance(GArrowInputStream *input_stream, - gint64 n_bytes, - GError **error); -gboolean garrow_input_stream_align(GArrowInputStream *input_stream, - gint32 alignment, - GError **error); -GArrowTensor *garrow_input_stream_read_tensor(GArrowInputStream *input_stream, - GError **error); +gboolean +garrow_input_stream_advance(GArrowInputStream *input_stream, + gint64 n_bytes, + GError **error); +gboolean +garrow_input_stream_align(GArrowInputStream *input_stream, + gint32 alignment, + GError **error); +GArrowTensor * +garrow_input_stream_read_tensor(GArrowInputStream *input_stream, GError **error); GARROW_AVAILABLE_IN_1_0 GArrowRecordBatch * garrow_input_stream_read_record_batch(GArrowInputStream *input_stream, @@ -55,8 +54,7 @@ garrow_input_stream_read_record_batch(GArrowInputStream *input_stream, GArrowReadOptions *options, GError **error); -#define GARROW_TYPE_SEEKABLE_INPUT_STREAM \ - (garrow_seekable_input_stream_get_type()) +#define GARROW_TYPE_SEEKABLE_INPUT_STREAM (garrow_seekable_input_stream_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowSeekableInputStream, garrow_seekable_input_stream, GARROW, @@ -67,9 +65,12 @@ struct _GArrowSeekableInputStreamClass GArrowInputStreamClass parent_class; }; -guint64 garrow_seekable_input_stream_get_size(GArrowSeekableInputStream *input_stream, - GError **error); -gboolean garrow_seekable_input_stream_get_support_zero_copy(GArrowSeekableInputStream *input_stream); +guint64 +garrow_seekable_input_stream_get_size(GArrowSeekableInputStream *input_stream, + GError **error); +gboolean +garrow_seekable_input_stream_get_support_zero_copy( + GArrowSeekableInputStream *input_stream); GArrowBuffer * garrow_seekable_input_stream_read_at(GArrowSeekableInputStream *input_stream, gint64 position, @@ -82,13 +83,12 @@ garrow_seekable_input_stream_read_at_bytes(GArrowSeekableInputStream *input_stre gint64 n_bytes, GError **error); GARROW_AVAILABLE_IN_0_12 -GBytes *garrow_seekable_input_stream_peek(GArrowSeekableInputStream *input_stream, - gint64 n_bytes, - GError **error); - +GBytes * +garrow_seekable_input_stream_peek(GArrowSeekableInputStream *input_stream, + gint64 n_bytes, + GError **error); -#define GARROW_TYPE_BUFFER_INPUT_STREAM \ - (garrow_buffer_input_stream_get_type()) +#define GARROW_TYPE_BUFFER_INPUT_STREAM (garrow_buffer_input_stream_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowBufferInputStream, garrow_buffer_input_stream, GARROW, @@ -99,10 +99,11 @@ struct _GArrowBufferInputStreamClass GArrowSeekableInputStreamClass parent_class; }; -GArrowBufferInputStream *garrow_buffer_input_stream_new(GArrowBuffer *buffer); - -GArrowBuffer *garrow_buffer_input_stream_get_buffer(GArrowBufferInputStream *input_stream); +GArrowBufferInputStream * +garrow_buffer_input_stream_new(GArrowBuffer *buffer); +GArrowBuffer * +garrow_buffer_input_stream_get_buffer(GArrowBufferInputStream *input_stream); #define GARROW_TYPE_FILE_INPUT_STREAM (garrow_file_input_stream_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowFileInputStream, @@ -116,16 +117,13 @@ struct _GArrowFileInputStreamClass }; GArrowFileInputStream * -garrow_file_input_stream_new(const gchar *path, - GError **error); +garrow_file_input_stream_new(const gchar *path, GError **error); GArrowFileInputStream * -garrow_file_input_stream_new_file_descriptor(gint file_descriptor, - GError **error); +garrow_file_input_stream_new_file_descriptor(gint file_descriptor, GError **error); gint garrow_file_input_stream_get_file_descriptor(GArrowFileInputStream *stream); - -#define GARROW_TYPE_MEMORY_MAPPED_INPUT_STREAM \ +#define GARROW_TYPE_MEMORY_MAPPED_INPUT_STREAM \ (garrow_memory_mapped_input_stream_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowMemoryMappedInputStream, garrow_memory_mapped_input_stream, @@ -138,34 +136,27 @@ struct _GArrowMemoryMappedInputStreamClass }; GArrowMemoryMappedInputStream * -garrow_memory_mapped_input_stream_new(const gchar *path, - GError **error); - - -#define GARROW_TYPE_GIO_INPUT_STREAM \ - (garrow_gio_input_stream_get_type()) -#define GARROW_GIO_INPUT_STREAM(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_GIO_INPUT_STREAM, \ - GArrowGIOInputStream)) -#define GARROW_GIO_INPUT_STREAM_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_GIO_INPUT_STREAM, \ +garrow_memory_mapped_input_stream_new(const gchar *path, GError **error); + +#define GARROW_TYPE_GIO_INPUT_STREAM (garrow_gio_input_stream_get_type()) +#define GARROW_GIO_INPUT_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), GARROW_TYPE_GIO_INPUT_STREAM, GArrowGIOInputStream)) +#define GARROW_GIO_INPUT_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_GIO_INPUT_STREAM, \ GArrowGIOInputStreamClass)) -#define GARROW_IS_GIO_INPUT_STREAM(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_GIO_INPUT_STREAM)) -#define GARROW_IS_GIO_INPUT_STREAM_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_GIO_INPUT_STREAM)) -#define GARROW_GIO_INPUT_STREAM_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_GIO_INPUT_STREAM, \ +#define GARROW_IS_GIO_INPUT_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), GARROW_TYPE_GIO_INPUT_STREAM)) +#define GARROW_IS_GIO_INPUT_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), GARROW_TYPE_GIO_INPUT_STREAM)) +#define GARROW_GIO_INPUT_STREAM_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_GIO_INPUT_STREAM, \ GArrowGIOInputStreamClass)) -typedef struct _GArrowGIOInputStream GArrowGIOInputStream; +typedef struct _GArrowGIOInputStream GArrowGIOInputStream; #ifndef __GTK_DOC_IGNORE__ -typedef struct _GArrowGIOInputStreamClass GArrowGIOInputStreamClass; +typedef struct _GArrowGIOInputStreamClass GArrowGIOInputStreamClass; #endif /** @@ -186,17 +177,18 @@ struct _GArrowGIOInputStreamClass }; #endif -GType garrow_gio_input_stream_get_type(void) G_GNUC_CONST; +GType +garrow_gio_input_stream_get_type(void) G_GNUC_CONST; -GArrowGIOInputStream *garrow_gio_input_stream_new(GInputStream *gio_input_stream); +GArrowGIOInputStream * +garrow_gio_input_stream_new(GInputStream *gio_input_stream); #ifndef GARROW_DISABLE_DEPRECATED G_GNUC_DEPRECATED GInputStream * garrow_gio_input_stream_get_raw(GArrowGIOInputStream *input_stream); #endif -#define GARROW_TYPE_COMPRESSED_INPUT_STREAM \ - (garrow_compressed_input_stream_get_type()) +#define GARROW_TYPE_COMPRESSED_INPUT_STREAM (garrow_compressed_input_stream_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowCompressedInputStream, garrow_compressed_input_stream, GARROW, diff --git a/c_glib/arrow-glib/input-stream.hpp b/c_glib/arrow-glib/input-stream.hpp index 2a0a3d3ddccad..7ae759370ddbd 100644 --- a/c_glib/arrow-glib/input-stream.hpp +++ b/c_glib/arrow-glib/input-stream.hpp @@ -26,8 +26,10 @@ #include -GArrowInputStream *garrow_input_stream_new_raw(std::shared_ptr *arrow_input_stream); -std::shared_ptr garrow_input_stream_get_raw(GArrowInputStream *input_stream); +GArrowInputStream * +garrow_input_stream_new_raw(std::shared_ptr *arrow_input_stream); +std::shared_ptr +garrow_input_stream_get_raw(GArrowInputStream *input_stream); GArrowSeekableInputStream * garrow_seekable_input_stream_new_raw( @@ -36,24 +38,22 @@ std::shared_ptr garrow_seekable_input_stream_get_raw(GArrowSeekableInputStream *input_stream); GArrowBufferInputStream * -garrow_buffer_input_stream_new_raw(std::shared_ptr *arrow_buffer_reader, - GArrowBuffer *buffer); -std::shared_ptr garrow_buffer_input_stream_get_raw(GArrowBufferInputStream *input_stream); - +garrow_buffer_input_stream_new_raw( + std::shared_ptr *arrow_buffer_reader, GArrowBuffer *buffer); +std::shared_ptr +garrow_buffer_input_stream_get_raw(GArrowBufferInputStream *input_stream); GArrowFileInputStream * -garrow_file_input_stream_new_raw( - std::shared_ptr *arrow_stream); - +garrow_file_input_stream_new_raw(std::shared_ptr *arrow_stream); GArrowMemoryMappedInputStream * garrow_memory_mapped_input_stream_new_raw( std::shared_ptr *arrow_stream); - GArrowCompressedInputStream * -garrow_compressed_input_stream_new_raw(std::shared_ptr *arrow_raw, - GArrowCodec *codec, - GArrowInputStream *raw); +garrow_compressed_input_stream_new_raw( + std::shared_ptr *arrow_raw, + GArrowCodec *codec, + GArrowInputStream *raw); std::shared_ptr garrow_compressed_input_stream_get_raw(GArrowCompressedInputStream *stream); diff --git a/c_glib/arrow-glib/internal-hash-table.hpp b/c_glib/arrow-glib/internal-hash-table.hpp index 3def4606cd653..27ec060994c98 100644 --- a/c_glib/arrow-glib/internal-hash-table.hpp +++ b/c_glib/arrow-glib/internal-hash-table.hpp @@ -27,15 +27,13 @@ static inline std::shared_ptr garrow_internal_hash_table_to_metadata(GHashTable *metadata) { auto arrow_metadata = std::make_shared(); - g_hash_table_foreach(metadata, - [](gpointer key, - gpointer value, - gpointer user_data) { - auto arrow_metadata = - static_cast *>(user_data); - (*arrow_metadata)->Append(static_cast(key), - static_cast(value)); - }, - &arrow_metadata); + g_hash_table_foreach( + metadata, + [](gpointer key, gpointer value, gpointer user_data) { + auto arrow_metadata = + static_cast *>(user_data); + (*arrow_metadata)->Append(static_cast(key), static_cast(value)); + }, + &arrow_metadata); return arrow_metadata; } diff --git a/c_glib/arrow-glib/interval.cpp b/c_glib/arrow-glib/interval.cpp index 3a2a82f66bcc1..0bde364bb789f 100644 --- a/c_glib/arrow-glib/interval.cpp +++ b/c_glib/arrow-glib/interval.cpp @@ -38,18 +38,16 @@ G_BEGIN_DECLS * Since: 8.0.0 */ -typedef struct GArrowDayMillisecondPrivate_ { +typedef struct GArrowDayMillisecondPrivate_ +{ arrow::DayTimeIntervalType::DayMilliseconds day_millisecond; } GArrowDayMillisecondPrivate; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowDayMillisecond, - garrow_day_millisecond, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowDayMillisecond, garrow_day_millisecond, G_TYPE_OBJECT) -#define GARROW_DAY_MILLISECOND_GET_PRIVATE(object) \ - static_cast( \ - garrow_day_millisecond_get_instance_private( \ - GARROW_DAY_MILLISECOND(object))) +#define GARROW_DAY_MILLISECOND_GET_PRIVATE(object) \ + static_cast( \ + garrow_day_millisecond_get_instance_private(GARROW_DAY_MILLISECOND(object))) enum { PROP_DAY_MILLISECOND_DAY = 1, @@ -129,9 +127,7 @@ garrow_day_millisecond_class_init(GArrowDayMillisecondClass *klass) G_MAXINT32, day_millisecond.days, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_DAY_MILLISECOND_DAY, - spec); + g_object_class_install_property(gobject_class, PROP_DAY_MILLISECOND_DAY, spec); /** * GArrowDayMillisecond:millisecond: @@ -147,9 +143,7 @@ garrow_day_millisecond_class_init(GArrowDayMillisecondClass *klass) G_MAXINT32, day_millisecond.milliseconds, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_DAY_MILLISECOND_MILLISECOND, - spec); + g_object_class_install_property(gobject_class, PROP_DAY_MILLISECOND_MILLISECOND, spec); } /** @@ -165,8 +159,7 @@ garrow_day_millisecond_class_init(GArrowDayMillisecondClass *klass) GArrowDayMillisecond * garrow_day_millisecond_new(gint32 day, gint32 millisecond) { - arrow::DayTimeIntervalType::DayMilliseconds - arrow_day_millisecond(day, millisecond); + arrow::DayTimeIntervalType::DayMilliseconds arrow_day_millisecond(day, millisecond); return garrow_day_millisecond_new_raw(&arrow_day_millisecond); } @@ -208,19 +201,16 @@ garrow_day_millisecond_less_than(GArrowDayMillisecond *day_millisecond, return priv->day_millisecond < other_priv->day_millisecond; } - -typedef struct GArrowMonthDayNanoPrivate_ { +typedef struct GArrowMonthDayNanoPrivate_ +{ arrow::MonthDayNanoIntervalType::MonthDayNanos month_day_nano; } GArrowMonthDayNanoPrivate; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowMonthDayNano, - garrow_month_day_nano, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowMonthDayNano, garrow_month_day_nano, G_TYPE_OBJECT) -#define GARROW_MONTH_DAY_NANO_GET_PRIVATE(object) \ - static_cast( \ - garrow_month_day_nano_get_instance_private( \ - GARROW_MONTH_DAY_NANO(object))) +#define GARROW_MONTH_DAY_NANO_GET_PRIVATE(object) \ + static_cast( \ + garrow_month_day_nano_get_instance_private(GARROW_MONTH_DAY_NANO(object))) enum { PROP_MONTH_DAY_NANO_MONTH = 1, @@ -308,9 +298,7 @@ garrow_month_day_nano_class_init(GArrowMonthDayNanoClass *klass) G_MAXINT32, month_day_nano.months, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_MONTH_DAY_NANO_MONTH, - spec); + g_object_class_install_property(gobject_class, PROP_MONTH_DAY_NANO_MONTH, spec); /** * GArrowMonthDayNano:day: @@ -326,9 +314,7 @@ garrow_month_day_nano_class_init(GArrowMonthDayNanoClass *klass) G_MAXINT32, month_day_nano.days, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_MONTH_DAY_NANO_DAY, - spec); + g_object_class_install_property(gobject_class, PROP_MONTH_DAY_NANO_DAY, spec); /** * GArrowMonthDayNano:nanosecond: @@ -344,9 +330,7 @@ garrow_month_day_nano_class_init(GArrowMonthDayNanoClass *klass) G_MAXINT64, month_day_nano.nanoseconds, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_MONTH_DAY_NANO_NANOSECOND, - spec); + g_object_class_install_property(gobject_class, PROP_MONTH_DAY_NANO_NANOSECOND, spec); } /** @@ -389,18 +373,18 @@ garrow_month_day_nano_equal(GArrowMonthDayNano *month_nano_day, return priv->month_day_nano == other_priv->month_day_nano; } - G_END_DECLS GArrowDayMillisecond * garrow_day_millisecond_new_raw( arrow::DayTimeIntervalType::DayMilliseconds *arrow_day_millisecond) { - auto day_millisecond = - g_object_new(garrow_day_millisecond_get_type(), - "day", arrow_day_millisecond->days, - "millisecond", arrow_day_millisecond->milliseconds, - NULL); + auto day_millisecond = g_object_new(garrow_day_millisecond_get_type(), + "day", + arrow_day_millisecond->days, + "millisecond", + arrow_day_millisecond->milliseconds, + NULL); return GARROW_DAY_MILLISECOND(day_millisecond); } @@ -419,17 +403,18 @@ garrow_day_millisecond_get_raw(const GArrowDayMillisecond *day_millisecond) return &priv->day_millisecond; } - GArrowMonthDayNano * garrow_month_day_nano_new_raw( arrow::MonthDayNanoIntervalType::MonthDayNanos *arrow_month_day_nano) { - auto month_day_nano = - g_object_new(garrow_month_day_nano_get_type(), - "month", arrow_month_day_nano->months, - "day", arrow_month_day_nano->days, - "nanosecond", arrow_month_day_nano->nanoseconds, - NULL); + auto month_day_nano = g_object_new(garrow_month_day_nano_get_type(), + "month", + arrow_month_day_nano->months, + "day", + arrow_month_day_nano->days, + "nanosecond", + arrow_month_day_nano->nanoseconds, + NULL); return GARROW_MONTH_DAY_NANO(month_day_nano); } @@ -441,10 +426,9 @@ garrow_month_day_nano_get_raw(GArrowMonthDayNano *month_day_nano) } const arrow::MonthDayNanoIntervalType::MonthDayNanos * -garrow_month_day_nano_get_raw( - const GArrowMonthDayNano *month_day_nano) +garrow_month_day_nano_get_raw(const GArrowMonthDayNano *month_day_nano) { - auto priv = GARROW_MONTH_DAY_NANO_GET_PRIVATE( - const_cast(month_day_nano)); + auto priv = + GARROW_MONTH_DAY_NANO_GET_PRIVATE(const_cast(month_day_nano)); return &priv->month_day_nano; } diff --git a/c_glib/arrow-glib/interval.h b/c_glib/arrow-glib/interval.h index 88d974e1b3eca..3f60db503f6a2 100644 --- a/c_glib/arrow-glib/interval.h +++ b/c_glib/arrow-glib/interval.h @@ -25,11 +25,8 @@ G_BEGIN_DECLS #define GARROW_TYPE_DAY_MILLISECOND (garrow_day_millisecond_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowDayMillisecond, - garrow_day_millisecond, - GARROW, - DAY_MILLISECOND, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowDayMillisecond, garrow_day_millisecond, GARROW, DAY_MILLISECOND, GObject) struct _GArrowDayMillisecondClass { @@ -48,13 +45,9 @@ gboolean garrow_day_millisecond_less_than(GArrowDayMillisecond *day_millisecond, GArrowDayMillisecond *other_day_millisecond); - #define GARROW_TYPE_MONTH_DAY_NANO (garrow_month_day_nano_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowMonthDayNano, - garrow_month_day_nano, - GARROW, - MONTH_DAY_NANO, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowMonthDayNano, garrow_month_day_nano, GARROW, MONTH_DAY_NANO, GObject) struct _GArrowMonthDayNanoClass { @@ -69,5 +62,4 @@ gboolean garrow_month_day_nano_equal(GArrowMonthDayNano *month_nano_day, GArrowMonthDayNano *other_month_nano_day); - G_END_DECLS diff --git a/c_glib/arrow-glib/interval.hpp b/c_glib/arrow-glib/interval.hpp index 3123d920805fe..fb22c3e697d88 100644 --- a/c_glib/arrow-glib/interval.hpp +++ b/c_glib/arrow-glib/interval.hpp @@ -40,4 +40,3 @@ arrow::MonthDayNanoIntervalType::MonthDayNanos * garrow_month_day_nano_get_raw(GArrowMonthDayNano *month_day_nano); const arrow::MonthDayNanoIntervalType::MonthDayNanos * garrow_month_day_nano_get_raw(const GArrowMonthDayNano *month_day_nano); - diff --git a/c_glib/arrow-glib/ipc-options.cpp b/c_glib/arrow-glib/ipc-options.cpp index 86bae4adf4f4d..3e1e3e7eae66d 100644 --- a/c_glib/arrow-glib/ipc-options.cpp +++ b/c_glib/arrow-glib/ipc-options.cpp @@ -34,7 +34,8 @@ G_BEGIN_DECLS * #GArrowWriteOptions provides options for writing data. */ -typedef struct GArrowReadOptionsPrivate_ { +typedef struct GArrowReadOptionsPrivate_ +{ arrow::ipc::IpcReadOptions options; arrow::ipc::DictionaryMemo dictionary_memo; } GArrowReadOptionsPrivate; @@ -44,14 +45,11 @@ enum { PROP_READ_OPTIONS_USE_THREADS, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowReadOptions, - garrow_read_options, - G_TYPE_OBJECT); +G_DEFINE_TYPE_WITH_PRIVATE(GArrowReadOptions, garrow_read_options, G_TYPE_OBJECT); -#define GARROW_READ_OPTIONS_GET_PRIVATE(obj) \ - static_cast( \ - garrow_read_options_get_instance_private( \ - GARROW_READ_OPTIONS(obj))) +#define GARROW_READ_OPTIONS_GET_PRIVATE(obj) \ + static_cast( \ + garrow_read_options_get_instance_private(GARROW_READ_OPTIONS(obj))) static void garrow_read_options_finalize(GObject *object) @@ -110,9 +108,9 @@ static void garrow_read_options_init(GArrowReadOptions *object) { auto priv = GARROW_READ_OPTIONS_GET_PRIVATE(object); - new(&priv->options) arrow::ipc::IpcReadOptions; + new (&priv->options) arrow::ipc::IpcReadOptions; priv->options = arrow::ipc::IpcReadOptions::Defaults(); - new(&priv->dictionary_memo) arrow::ipc::DictionaryMemo; + new (&priv->dictionary_memo) arrow::ipc::DictionaryMemo; } static void @@ -120,7 +118,7 @@ garrow_read_options_class_init(GArrowReadOptionsClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_read_options_finalize; + gobject_class->finalize = garrow_read_options_finalize; gobject_class->set_property = garrow_read_options_set_property; gobject_class->get_property = garrow_read_options_get_property; @@ -158,9 +156,7 @@ garrow_read_options_class_init(GArrowReadOptionsClass *klass) "Whether to use the global CPU thread pool", options.use_threads, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_READ_OPTIONS_USE_THREADS, - spec); + g_object_class_install_property(gobject_class, PROP_READ_OPTIONS_USE_THREADS, spec); } /** @@ -191,8 +187,7 @@ garrow_read_options_new(void) * Since: 1.0.0 */ int * -garrow_read_options_get_included_fields(GArrowReadOptions *options, - gsize *n_fields) +garrow_read_options_get_included_fields(GArrowReadOptions *options, gsize *n_fields) { auto priv = GARROW_READ_OPTIONS_GET_PRIVATE(options); if (priv->options.included_fields.empty()) { @@ -236,8 +231,8 @@ garrow_read_options_set_included_fields(GArrowReadOptions *options, } } - -typedef struct GArrowWriteOptionsPrivate_ { +typedef struct GArrowWriteOptionsPrivate_ +{ arrow::ipc::IpcWriteOptions options; GArrowCodec *codec; } GArrowWriteOptionsPrivate; @@ -251,14 +246,11 @@ enum { PROP_WRITE_OPTIONS_USE_THREADS, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowWriteOptions, - garrow_write_options, - G_TYPE_OBJECT); +G_DEFINE_TYPE_WITH_PRIVATE(GArrowWriteOptions, garrow_write_options, G_TYPE_OBJECT); -#define GARROW_WRITE_OPTIONS_GET_PRIVATE(obj) \ - static_cast( \ - garrow_write_options_get_instance_private( \ - GARROW_WRITE_OPTIONS(obj))) +#define GARROW_WRITE_OPTIONS_GET_PRIVATE(obj) \ + static_cast( \ + garrow_write_options_get_instance_private(GARROW_WRITE_OPTIONS(obj))) static void garrow_write_options_dispose(GObject *object) @@ -357,7 +349,7 @@ static void garrow_write_options_init(GArrowWriteOptions *object) { auto priv = GARROW_WRITE_OPTIONS_GET_PRIVATE(object); - new(&priv->options) arrow::ipc::IpcWriteOptions; + new (&priv->options) arrow::ipc::IpcWriteOptions; priv->options = arrow::ipc::IpcWriteOptions::Defaults(); if (priv->options.codec) { priv->codec = garrow_codec_new_raw(&(priv->options.codec)); @@ -371,8 +363,8 @@ garrow_write_options_class_init(GArrowWriteOptionsClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_write_options_dispose; - gobject_class->finalize = garrow_write_options_finalize; + gobject_class->dispose = garrow_write_options_dispose; + gobject_class->finalize = garrow_write_options_finalize; gobject_class->set_property = garrow_write_options_set_property; gobject_class->get_property = garrow_write_options_get_property; @@ -394,9 +386,7 @@ garrow_write_options_class_init(GArrowWriteOptionsClass *klass) "for field length", options.allow_64bit, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_WRITE_OPTIONS_ALLOW_64BIT, - spec); + g_object_class_install_property(gobject_class, PROP_WRITE_OPTIONS_ALLOW_64BIT, spec); /** * GArrowWriteOptions:max-recursion-depth: @@ -432,9 +422,7 @@ garrow_write_options_class_init(GArrowWriteOptionsClass *klass) G_MAXINT, options.alignment, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_WRITE_OPTIONS_ALIGNMENT, - spec); + g_object_class_install_property(gobject_class, PROP_WRITE_OPTIONS_ALIGNMENT, spec); /** * GArrowWriteOptions:write-legacy-ipc-format: @@ -470,9 +458,7 @@ garrow_write_options_class_init(GArrowWriteOptionsClass *klass) "compressing record batch body buffers.", GARROW_TYPE_CODEC, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_WRITE_OPTIONS_CODEC, - spec); + g_object_class_install_property(gobject_class, PROP_WRITE_OPTIONS_CODEC, spec); /** * GArrowWriteOptions:use-threads: @@ -486,9 +472,7 @@ garrow_write_options_class_init(GArrowWriteOptionsClass *klass) "Whether to use the global CPU thread pool", options.use_threads, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_WRITE_OPTIONS_USE_THREADS, - spec); + g_object_class_install_property(gobject_class, PROP_WRITE_OPTIONS_USE_THREADS, spec); } /** diff --git a/c_glib/arrow-glib/ipc-options.h b/c_glib/arrow-glib/ipc-options.h index 3b1d99e38c8e1..188e451c51325 100644 --- a/c_glib/arrow-glib/ipc-options.h +++ b/c_glib/arrow-glib/ipc-options.h @@ -25,11 +25,8 @@ G_BEGIN_DECLS #define GARROW_TYPE_READ_OPTIONS (garrow_read_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowReadOptions, - garrow_read_options, - GARROW, - READ_OPTIONS, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowReadOptions, garrow_read_options, GARROW, READ_OPTIONS, GObject) struct _GArrowReadOptionsClass { GObjectClass parent_class; @@ -40,8 +37,7 @@ GArrowReadOptions * garrow_read_options_new(void); GARROW_AVAILABLE_IN_1_0 int * -garrow_read_options_get_included_fields(GArrowReadOptions *options, - gsize *n_fields); +garrow_read_options_get_included_fields(GArrowReadOptions *options, gsize *n_fields); GARROW_AVAILABLE_IN_1_0 void garrow_read_options_set_included_fields(GArrowReadOptions *options, @@ -49,11 +45,8 @@ garrow_read_options_set_included_fields(GArrowReadOptions *options, gsize n_fields); #define GARROW_TYPE_WRITE_OPTIONS (garrow_write_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowWriteOptions, - garrow_write_options, - GARROW, - WRITE_OPTIONS, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowWriteOptions, garrow_write_options, GARROW, WRITE_OPTIONS, GObject) struct _GArrowWriteOptionsClass { GObjectClass parent_class; diff --git a/c_glib/arrow-glib/local-file-system.cpp b/c_glib/arrow-glib/local-file-system.cpp index ae503bf73136b..ee16bfe4128ca 100644 --- a/c_glib/arrow-glib/local-file-system.cpp +++ b/c_glib/arrow-glib/local-file-system.cpp @@ -35,7 +35,8 @@ G_BEGIN_DECLS * that accesses files on the local machine. */ -typedef struct GArrowLocalFileSystemOptionsPrivate_ { +typedef struct GArrowLocalFileSystemOptionsPrivate_ +{ arrow::fs::LocalFileSystemOptions local_file_system_options; } GArrowLocalFileSystemOptionsPrivate; @@ -47,10 +48,10 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowLocalFileSystemOptions, garrow_local_file_system_options, G_TYPE_OBJECT) -#define GARROW_LOCAL_FILE_SYSTEM_OPTIONS_GET_PRIVATE(obj) \ - static_cast( \ - garrow_local_file_system_options_get_instance_private( \ - GARROW_LOCAL_FILE_SYSTEM_OPTIONS(obj))) +#define GARROW_LOCAL_FILE_SYSTEM_OPTIONS_GET_PRIVATE(obj) \ + static_cast( \ + garrow_local_file_system_options_get_instance_private( \ + GARROW_LOCAL_FILE_SYSTEM_OPTIONS(obj))) static void garrow_local_file_system_options_finalize(GObject *object) @@ -102,7 +103,7 @@ static void garrow_local_file_system_options_init(GArrowLocalFileSystemOptions *object) { auto priv = GARROW_LOCAL_FILE_SYSTEM_OPTIONS_GET_PRIVATE(object); - new(&priv->local_file_system_options) arrow::fs::LocalFileSystemOptions; + new (&priv->local_file_system_options) arrow::fs::LocalFileSystemOptions; } static void @@ -112,7 +113,7 @@ garrow_local_file_system_options_class_init(GArrowLocalFileSystemOptionsClass *k auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_local_file_system_options_finalize; + gobject_class->finalize = garrow_local_file_system_options_finalize; gobject_class->set_property = garrow_local_file_system_options_set_property; gobject_class->get_property = garrow_local_file_system_options_get_property; @@ -152,9 +153,7 @@ garrow_local_file_system_options_new(void) /* arrow::fs::LocalFileSystem */ -G_DEFINE_TYPE(GArrowLocalFileSystem, - garrow_local_file_system, - GARROW_TYPE_FILE_SYSTEM) +G_DEFINE_TYPE(GArrowLocalFileSystem, garrow_local_file_system, GARROW_TYPE_FILE_SYSTEM) static void garrow_local_file_system_init(GArrowLocalFileSystem *file_system) @@ -178,16 +177,13 @@ GArrowLocalFileSystem * garrow_local_file_system_new(GArrowLocalFileSystemOptions *options) { if (options) { - const auto &arrow_options = - garrow_local_file_system_options_get_raw(options); - auto arrow_local_file_system = - std::static_pointer_cast( - std::make_shared(arrow_options)); + const auto &arrow_options = garrow_local_file_system_options_get_raw(options); + auto arrow_local_file_system = std::static_pointer_cast( + std::make_shared(arrow_options)); return garrow_local_file_system_new_raw(&arrow_local_file_system); } else { - auto arrow_local_file_system = - std::static_pointer_cast( - std::make_shared()); + auto arrow_local_file_system = std::static_pointer_cast( + std::make_shared()); return garrow_local_file_system_new_raw(&arrow_local_file_system); } } @@ -202,10 +198,9 @@ garrow_local_file_system_options_get_raw(GArrowLocalFileSystemOptions *options) } GArrowLocalFileSystem * -garrow_local_file_system_new_raw(std::shared_ptr *arrow_file_system) +garrow_local_file_system_new_raw( + std::shared_ptr *arrow_file_system) { return GARROW_LOCAL_FILE_SYSTEM( - g_object_new(GARROW_TYPE_LOCAL_FILE_SYSTEM, - "file-system", arrow_file_system, - NULL)); + g_object_new(GARROW_TYPE_LOCAL_FILE_SYSTEM, "file-system", arrow_file_system, NULL)); } diff --git a/c_glib/arrow-glib/local-file-system.h b/c_glib/arrow-glib/local-file-system.h index 7741497963476..9af4f8e8b168d 100644 --- a/c_glib/arrow-glib/local-file-system.h +++ b/c_glib/arrow-glib/local-file-system.h @@ -25,7 +25,8 @@ G_BEGIN_DECLS /* arrow::fs::LocalFileSystemOptions */ -#define GARROW_TYPE_LOCAL_FILE_SYSTEM_OPTIONS (garrow_local_file_system_options_get_type()) +#define GARROW_TYPE_LOCAL_FILE_SYSTEM_OPTIONS \ + (garrow_local_file_system_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowLocalFileSystemOptions, garrow_local_file_system_options, GARROW, diff --git a/c_glib/arrow-glib/local-file-system.hpp b/c_glib/arrow-glib/local-file-system.hpp index ac7a9de0a0734..0ef69ca1275ca 100644 --- a/c_glib/arrow-glib/local-file-system.hpp +++ b/c_glib/arrow-glib/local-file-system.hpp @@ -29,4 +29,3 @@ garrow_local_file_system_options_get_raw(GArrowLocalFileSystemOptions *options); GArrowLocalFileSystem * garrow_local_file_system_new_raw( std::shared_ptr *arrow_file_system); - diff --git a/c_glib/arrow-glib/memory-pool.cpp b/c_glib/arrow-glib/memory-pool.cpp index e0d9035f88c64..4fdc5bcc7380f 100644 --- a/c_glib/arrow-glib/memory-pool.cpp +++ b/c_glib/arrow-glib/memory-pool.cpp @@ -30,7 +30,8 @@ G_BEGIN_DECLS * #GArrowMemoryPool is a class for memory allocation. */ -typedef struct GArrowMemoryPoolPrivate_ { +typedef struct GArrowMemoryPoolPrivate_ +{ arrow::MemoryPool *memory_pool; } GArrowMemoryPoolPrivate; @@ -40,10 +41,9 @@ enum { G_DEFINE_TYPE_WITH_PRIVATE(GArrowMemoryPool, garrow_memory_pool, G_TYPE_OBJECT) -#define GARROW_MEMORY_POOL_GET_PRIVATE(obj) \ - static_cast( \ - garrow_memory_pool_get_instance_private( \ - GARROW_MEMORY_POOL(obj))) +#define GARROW_MEMORY_POOL_GET_PRIVATE(obj) \ + static_cast( \ + garrow_memory_pool_get_instance_private(GARROW_MEMORY_POOL(obj))) static void garrow_memory_pool_set_property(GObject *object, @@ -55,8 +55,7 @@ garrow_memory_pool_set_property(GObject *object, switch (prop_id) { case PROP_MEMORY_POOL: - priv->memory_pool = - static_cast(g_value_get_pointer(value)); + priv->memory_pool = static_cast(g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -78,11 +77,11 @@ garrow_memory_pool_class_init(GArrowMemoryPoolClass *klass) gobject_class->set_property = garrow_memory_pool_set_property; - spec = g_param_spec_pointer("memory-pool", - "Memory Pool", - "The raw arrow::MemoryPool *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "memory-pool", + "Memory Pool", + "The raw arrow::MemoryPool *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_MEMORY_POOL, spec); } @@ -158,9 +157,8 @@ G_END_DECLS GArrowMemoryPool * garrow_memory_pool_new_raw(arrow::MemoryPool *memory_pool) { - return GARROW_MEMORY_POOL(g_object_new(GARROW_TYPE_MEMORY_POOL, - "memory-pool", memory_pool, - NULL)); + return GARROW_MEMORY_POOL( + g_object_new(GARROW_TYPE_MEMORY_POOL, "memory-pool", memory_pool, NULL)); } arrow::MemoryPool * diff --git a/c_glib/arrow-glib/memory-pool.h b/c_glib/arrow-glib/memory-pool.h index d6bba176d3def..1d7fdc93e20a2 100644 --- a/c_glib/arrow-glib/memory-pool.h +++ b/c_glib/arrow-glib/memory-pool.h @@ -24,20 +24,20 @@ G_BEGIN_DECLS #define GARROW_TYPE_MEMORY_POOL (garrow_memory_pool_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowMemoryPool, - garrow_memory_pool, - GARROW, - MEMORY_POOL, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowMemoryPool, garrow_memory_pool, GARROW, MEMORY_POOL, GObject) struct _GArrowMemoryPoolClass { GObjectClass parent_class; }; -GArrowMemoryPool *garrow_memory_pool_default(); -gint64 garrow_memory_pool_get_bytes_allocated(GArrowMemoryPool *memory_pool); -gint64 garrow_memory_pool_get_max_memory(GArrowMemoryPool *memory_pool); -gchar *garrow_memory_pool_get_backend_name(GArrowMemoryPool *memory_pool); - +GArrowMemoryPool * +garrow_memory_pool_default(); +gint64 +garrow_memory_pool_get_bytes_allocated(GArrowMemoryPool *memory_pool); +gint64 +garrow_memory_pool_get_max_memory(GArrowMemoryPool *memory_pool); +gchar * +garrow_memory_pool_get_backend_name(GArrowMemoryPool *memory_pool); G_END_DECLS diff --git a/c_glib/arrow-glib/metadata-version.hpp b/c_glib/arrow-glib/metadata-version.hpp index 7b3865e59216b..c5241e0f51f8d 100644 --- a/c_glib/arrow-glib/metadata-version.hpp +++ b/c_glib/arrow-glib/metadata-version.hpp @@ -23,5 +23,7 @@ #include -GArrowMetadataVersion garrow_metadata_version_from_raw(arrow::ipc::MetadataVersion version); -arrow::ipc::MetadataVersion garrow_metadata_version_to_raw(GArrowMetadataVersion version); +GArrowMetadataVersion +garrow_metadata_version_from_raw(arrow::ipc::MetadataVersion version); +arrow::ipc::MetadataVersion +garrow_metadata_version_to_raw(GArrowMetadataVersion version); diff --git a/c_glib/arrow-glib/orc-file-reader.cpp b/c_glib/arrow-glib/orc-file-reader.cpp index 084198a82a5bb..dd51c08651af7 100644 --- a/c_glib/arrow-glib/orc-file-reader.cpp +++ b/c_glib/arrow-glib/orc-file-reader.cpp @@ -36,7 +36,8 @@ G_BEGIN_DECLS * format from input. */ -typedef struct GArrowORCFileReaderPrivate_ { +typedef struct GArrowORCFileReaderPrivate_ +{ GArrowSeekableInputStream *input; arrow::adapters::orc::ORCFileReader *orc_file_reader; GArray *field_indices; @@ -48,14 +49,11 @@ enum { PROP_ORC_FILE_READER }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowORCFileReader, - garrow_orc_file_reader, - G_TYPE_OBJECT); +G_DEFINE_TYPE_WITH_PRIVATE(GArrowORCFileReader, garrow_orc_file_reader, G_TYPE_OBJECT); -#define GARROW_ORC_FILE_READER_GET_PRIVATE(obj) \ - static_cast( \ - garrow_orc_file_reader_get_instance_private( \ - GARROW_ORC_FILE_READER(obj))) +#define GARROW_ORC_FILE_READER_GET_PRIVATE(obj) \ + static_cast( \ + garrow_orc_file_reader_get_instance_private(GARROW_ORC_FILE_READER(obj))) static void garrow_orc_file_reader_dispose(GObject *object) @@ -134,29 +132,28 @@ garrow_orc_file_reader_class_init(GArrowORCFileReaderClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_orc_file_reader_dispose; - gobject_class->finalize = garrow_orc_file_reader_finalize; + gobject_class->dispose = garrow_orc_file_reader_dispose; + gobject_class->finalize = garrow_orc_file_reader_finalize; gobject_class->set_property = garrow_orc_file_reader_set_property; gobject_class->get_property = garrow_orc_file_reader_get_property; GParamSpec *spec; - spec = g_param_spec_object("input", - "Input", - "The input stream", - GARROW_TYPE_SEEKABLE_INPUT_STREAM, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "input", + "Input", + "The input stream", + GARROW_TYPE_SEEKABLE_INPUT_STREAM, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_INPUT, spec); - spec = g_param_spec_pointer("orc-file-reader", - "arrow::adapters::orc::ORCFileReader", - "The raw arrow::adapters::orc::ORCFileReader *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "orc-file-reader", + "arrow::adapters::orc::ORCFileReader", + "The raw arrow::adapters::orc::ORCFileReader *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_ORC_FILE_READER, spec); } - /** * garrow_orc_file_reader_new: * @file: The file to be read. @@ -168,17 +165,14 @@ garrow_orc_file_reader_class_init(GArrowORCFileReaderClass *klass) * Since: 0.10.0 */ GArrowORCFileReader * -garrow_orc_file_reader_new(GArrowSeekableInputStream *input, - GError **error) +garrow_orc_file_reader_new(GArrowSeekableInputStream *input, GError **error) { auto arrow_random_access_file = garrow_seekable_input_stream_get_raw(input); auto pool = arrow::default_memory_pool(); auto arrow_reader_result = - arrow::adapters::orc::ORCFileReader::Open(arrow_random_access_file, - pool); + arrow::adapters::orc::ORCFileReader::Open(arrow_random_access_file, pool); if (garrow::check(error, arrow_reader_result, "[orc-file-reader][new]")) { - return garrow_orc_file_reader_new_raw(input, - (*arrow_reader_result).release()); + return garrow_orc_file_reader_new_raw(input, (*arrow_reader_result).release()); } else { return NULL; } @@ -201,9 +195,7 @@ garrow_orc_file_reader_set_field_indexes(GArrowORCFileReader *reader, const gint *field_indexes, guint n_field_indexes) { - garrow_orc_file_reader_set_field_indices(reader, - field_indexes, - n_field_indexes); + garrow_orc_file_reader_set_field_indices(reader, field_indexes, n_field_indexes); } /** @@ -227,10 +219,7 @@ garrow_orc_file_reader_set_field_indices(GArrowORCFileReader *reader, if (n_field_indices == 0) { priv->field_indices = NULL; } else { - priv->field_indices = g_array_sized_new(FALSE, - FALSE, - sizeof(gint), - n_field_indices); + priv->field_indices = g_array_sized_new(FALSE, FALSE, sizeof(gint), n_field_indices); g_array_append_vals(priv->field_indices, field_indices, n_field_indices); } } @@ -290,14 +279,11 @@ garrow_orc_file_reader_get_field_indices(GArrowORCFileReader *reader, * Since: 0.10.0 */ GArrowSchema * -garrow_orc_file_reader_read_type(GArrowORCFileReader *reader, - GError **error) +garrow_orc_file_reader_read_type(GArrowORCFileReader *reader, GError **error) { auto arrow_reader = garrow_orc_file_reader_get_raw(reader); auto arrow_schema_result = arrow_reader->ReadSchema(); - if (garrow::check(error, - arrow_schema_result, - "[orc-file-reader][read-type]")) { + if (garrow::check(error, arrow_schema_result, "[orc-file-reader][read-type]")) { auto arrow_schema = *arrow_schema_result; return garrow_schema_new_raw(&arrow_schema); } else { @@ -316,8 +302,7 @@ garrow_orc_file_reader_read_type(GArrowORCFileReader *reader, * Since: 0.10.0 */ GArrowTable * -garrow_orc_file_reader_read_stripes(GArrowORCFileReader *reader, - GError **error) +garrow_orc_file_reader_read_stripes(GArrowORCFileReader *reader, GError **error) { auto arrow_reader = garrow_orc_file_reader_get_raw(reader); auto priv = GARROW_ORC_FILE_READER_GET_PRIVATE(reader); @@ -328,9 +313,7 @@ garrow_orc_file_reader_read_stripes(GArrowORCFileReader *reader, arrow_field_indices.push_back(g_array_index(field_indices, gint, i)); } auto arrow_table_result = arrow_reader->Read(arrow_field_indices); - if (garrow::check(error, - arrow_table_result, - "[orc-file-reader][read-stripes]")) { + if (garrow::check(error, arrow_table_result, "[orc-file-reader][read-stripes]")) { auto arrow_table = *arrow_table_result; return garrow_table_new_raw(&arrow_table); } else { @@ -338,9 +321,7 @@ garrow_orc_file_reader_read_stripes(GArrowORCFileReader *reader, } } else { auto arrow_table_result = arrow_reader->Read(); - if (garrow::check(error, - arrow_table_result, - "[orc-file-reader][read-stripes]")) { + if (garrow::check(error, arrow_table_result, "[orc-file-reader][read-stripes]")) { auto arrow_table = *arrow_table_result; return garrow_table_new_raw(&arrow_table); } else { @@ -361,9 +342,7 @@ garrow_orc_file_reader_read_stripes(GArrowORCFileReader *reader, * Since: 0.10.0 */ GArrowRecordBatch * -garrow_orc_file_reader_read_stripe(GArrowORCFileReader *reader, - gint64 i, - GError **error) +garrow_orc_file_reader_read_stripe(GArrowORCFileReader *reader, gint64 i, GError **error) { auto arrow_reader = garrow_orc_file_reader_get_raw(reader); if (i < 0) { @@ -377,8 +356,7 @@ garrow_orc_file_reader_read_stripe(GArrowORCFileReader *reader, arrow_field_indices.push_back(g_array_index(field_indices, gint, j)); } std::shared_ptr arrow_record_batch; - auto arrow_record_batch_result = - arrow_reader->ReadStripe(i, arrow_field_indices); + auto arrow_record_batch_result = arrow_reader->ReadStripe(i, arrow_field_indices); if (garrow::check(error, arrow_record_batch_result, "[orc-file-reader][read-stripe]")) { @@ -430,19 +408,18 @@ garrow_orc_file_reader_get_n_rows(GArrowORCFileReader *reader) return arrow_reader->NumberOfRows(); } - G_END_DECLS - GArrowORCFileReader * garrow_orc_file_reader_new_raw(GArrowSeekableInputStream *input, arrow::adapters::orc::ORCFileReader *arrow_reader) { - auto reader = - GARROW_ORC_FILE_READER(g_object_new(GARROW_TYPE_ORC_FILE_READER, - "input", input, - "orc-file-reader", arrow_reader, - NULL)); + auto reader = GARROW_ORC_FILE_READER(g_object_new(GARROW_TYPE_ORC_FILE_READER, + "input", + input, + "orc-file-reader", + arrow_reader, + NULL)); return reader; } diff --git a/c_glib/arrow-glib/orc-file-reader.h b/c_glib/arrow-glib/orc-file-reader.h index 9551d52e0fd55..20089eb2866c6 100644 --- a/c_glib/arrow-glib/orc-file-reader.h +++ b/c_glib/arrow-glib/orc-file-reader.h @@ -24,19 +24,15 @@ G_BEGIN_DECLS #define GARROW_TYPE_ORC_FILE_READER (garrow_orc_file_reader_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowORCFileReader, - garrow_orc_file_reader, - GARROW, - ORC_FILE_READER, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowORCFileReader, garrow_orc_file_reader, GARROW, ORC_FILE_READER, GObject) struct _GArrowORCFileReaderClass { GObjectClass parent_class; }; GArrowORCFileReader * -garrow_orc_file_reader_new(GArrowSeekableInputStream *file, - GError **error); +garrow_orc_file_reader_new(GArrowSeekableInputStream *file, GError **error); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_12_FOR(garrow_orc_file_reader_set_field_indices) @@ -61,16 +57,14 @@ const gint * garrow_orc_file_reader_get_field_indices(GArrowORCFileReader *reader, guint *n_field_indices); GArrowSchema * -garrow_orc_file_reader_read_type(GArrowORCFileReader *reader, - GError **error); +garrow_orc_file_reader_read_type(GArrowORCFileReader *reader, GError **error); GArrowTable * -garrow_orc_file_reader_read_stripes(GArrowORCFileReader *reader, - GError **error); +garrow_orc_file_reader_read_stripes(GArrowORCFileReader *reader, GError **error); GArrowRecordBatch * -garrow_orc_file_reader_read_stripe(GArrowORCFileReader *reader, - gint64 i, - GError **error); -gint64 garrow_orc_file_reader_get_n_stripes(GArrowORCFileReader *reader); -gint64 garrow_orc_file_reader_get_n_rows(GArrowORCFileReader *reader); +garrow_orc_file_reader_read_stripe(GArrowORCFileReader *reader, gint64 i, GError **error); +gint64 +garrow_orc_file_reader_get_n_stripes(GArrowORCFileReader *reader); +gint64 +garrow_orc_file_reader_get_n_rows(GArrowORCFileReader *reader); G_END_DECLS diff --git a/c_glib/arrow-glib/output-stream.cpp b/c_glib/arrow-glib/output-stream.cpp index a9317e9f28007..83de2eb38a72a 100644 --- a/c_glib/arrow-glib/output-stream.cpp +++ b/c_glib/arrow-glib/output-stream.cpp @@ -55,7 +55,8 @@ G_BEGIN_DECLS * output stream. */ -typedef struct GArrowOutputStreamPrivate_ { +typedef struct GArrowOutputStreamPrivate_ +{ std::shared_ptr output_stream; } GArrowOutputStreamPrivate; @@ -92,19 +93,18 @@ garrow_output_stream_writable_interface_init(GArrowWritableInterface *iface) iface->get_raw = garrow_output_stream_get_raw_writable_interface; } -G_DEFINE_TYPE_WITH_CODE(GArrowOutputStream, - garrow_output_stream, - G_TYPE_OBJECT, - G_ADD_PRIVATE(GArrowOutputStream) - G_IMPLEMENT_INTERFACE(GARROW_TYPE_FILE, - garrow_output_stream_file_interface_init) - G_IMPLEMENT_INTERFACE(GARROW_TYPE_WRITABLE, - garrow_output_stream_writable_interface_init)); +G_DEFINE_TYPE_WITH_CODE( + GArrowOutputStream, + garrow_output_stream, + G_TYPE_OBJECT, + G_ADD_PRIVATE(GArrowOutputStream) + G_IMPLEMENT_INTERFACE(GARROW_TYPE_FILE, garrow_output_stream_file_interface_init) + G_IMPLEMENT_INTERFACE(GARROW_TYPE_WRITABLE, + garrow_output_stream_writable_interface_init)); -#define GARROW_OUTPUT_STREAM_GET_PRIVATE(obj) \ - static_cast( \ - garrow_output_stream_get_instance_private( \ - GARROW_OUTPUT_STREAM(obj))) +#define GARROW_OUTPUT_STREAM_GET_PRIVATE(obj) \ + static_cast( \ + garrow_output_stream_get_instance_private(GARROW_OUTPUT_STREAM(obj))) static void garrow_output_stream_finalize(GObject *object) @@ -118,16 +118,16 @@ garrow_output_stream_finalize(GObject *object) static void garrow_output_stream_set_property(GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) + guint prop_id, + const GValue *value, + GParamSpec *pspec) { auto priv = GARROW_OUTPUT_STREAM_GET_PRIVATE(object); switch (prop_id) { case PROP_OUTPUT_STREAM: - priv->output_stream = - *static_cast *>(g_value_get_pointer(value)); + priv->output_stream = *static_cast *>( + g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -152,7 +152,7 @@ static void garrow_output_stream_init(GArrowOutputStream *object) { auto priv = GARROW_OUTPUT_STREAM_GET_PRIVATE(object); - new(&priv->output_stream) std::shared_ptr; + new (&priv->output_stream) std::shared_ptr; } static void @@ -160,16 +160,16 @@ garrow_output_stream_class_init(GArrowOutputStreamClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_output_stream_finalize; + gobject_class->finalize = garrow_output_stream_finalize; gobject_class->set_property = garrow_output_stream_set_property; gobject_class->get_property = garrow_output_stream_get_property; GParamSpec *spec; - spec = g_param_spec_pointer("output-stream", - "io::OutputStream", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "output-stream", + "io::OutputStream", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_OUTPUT_STREAM, spec); } @@ -185,9 +185,7 @@ garrow_output_stream_class_init(GArrowOutputStreamClass *klass) * Since: 0.11.0 */ gboolean -garrow_output_stream_align(GArrowOutputStream *stream, - gint32 alignment, - GError **error) +garrow_output_stream_align(GArrowOutputStream *stream, gint32 alignment, GError **error) { auto arrow_stream = garrow_output_stream_get_raw(stream); auto status = arrow::ipc::AlignStream(arrow_stream.get(), alignment); @@ -271,7 +269,6 @@ garrow_output_stream_write_record_batch(GArrowOutputStream *stream, } } - G_DEFINE_TYPE(GArrowFileOutputStream, garrow_file_output_stream, GARROW_TYPE_OUTPUT_STREAM); @@ -296,15 +293,12 @@ garrow_file_output_stream_class_init(GArrowFileOutputStreamClass *klass) * %NULL on error. */ GArrowFileOutputStream * -garrow_file_output_stream_new(const gchar *path, - gboolean append, - GError **error) +garrow_file_output_stream_new(const gchar *path, gboolean append, GError **error) { auto arrow_file_output_stream_result = arrow::io::FileOutputStream::Open(std::string(path), append); if (arrow_file_output_stream_result.ok()) { - auto arrow_file_output_stream = - arrow_file_output_stream_result.ValueOrDie(); + auto arrow_file_output_stream = arrow_file_output_stream_result.ValueOrDie(); return garrow_file_output_stream_new_raw(&arrow_file_output_stream); } else { std::string context("[io][file-output-stream][open]: <"); @@ -315,7 +309,6 @@ garrow_file_output_stream_new(const gchar *path, } } - G_DEFINE_TYPE(GArrowBufferOutputStream, garrow_buffer_output_stream, GARROW_TYPE_OUTPUT_STREAM); @@ -349,29 +342,33 @@ garrow_buffer_output_stream_new(GArrowResizableBuffer *buffer) G_END_DECLS - namespace garrow { class GIOOutputStream : public arrow::io::OutputStream { public: - GIOOutputStream(GOutputStream *output_stream) : - output_stream_(output_stream), - position_(0) { + GIOOutputStream(GOutputStream *output_stream) + : output_stream_(output_stream), + position_(0) + { g_object_ref(output_stream_); } - ~GIOOutputStream() { - g_object_unref(output_stream_); - } + ~GIOOutputStream() { g_object_unref(output_stream_); } - GOutputStream *get_output_stream() { + GOutputStream * + get_output_stream() + { return output_stream_; } - bool closed() const override { + bool + closed() const override + { return static_cast(g_output_stream_is_closed(output_stream_)); } - arrow::Status Close() override { + arrow::Status + Close() override + { GError *error = NULL; if (g_output_stream_close(output_stream_, NULL, &error)) { return arrow::Status::OK(); @@ -382,7 +379,9 @@ namespace garrow { } } - arrow::Result Tell() const override { + arrow::Result + Tell() const override + { if (G_IS_SEEKABLE(output_stream_) && g_seekable_can_seek(G_SEEKABLE(output_stream_))) { return g_seekable_tell(G_SEEKABLE(output_stream_)); @@ -391,8 +390,9 @@ namespace garrow { } } - arrow::Status Write(const void *data, - int64_t n_bytes) override { + arrow::Status + Write(const void *data, int64_t n_bytes) override + { GError *error = NULL; gsize n_written_bytes; auto succeeded = g_output_stream_write_all(output_stream_, @@ -413,7 +413,9 @@ namespace garrow { } } - arrow::Status Flush() override { + arrow::Status + Flush() override + { GError *error = NULL; auto succeeded = g_output_stream_flush(output_stream_, NULL, &error); if (succeeded) { @@ -429,11 +431,12 @@ namespace garrow { GOutputStream *output_stream_; int64_t position_; }; -}; +}; // namespace garrow G_BEGIN_DECLS -typedef struct GArrowGIOOutputStreamPrivate_ { +typedef struct GArrowGIOOutputStreamPrivate_ +{ GOutputStream *raw; } GArrowGIOOutputStreamPrivate; @@ -445,10 +448,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowGIOOutputStream, garrow_gio_output_stream, GARROW_TYPE_OUTPUT_STREAM); -#define GARROW_GIO_OUTPUT_STREAM_GET_PRIVATE(object) \ - static_cast( \ - garrow_gio_output_stream_get_instance_private( \ - GARROW_GIO_OUTPUT_STREAM(object))) +#define GARROW_GIO_OUTPUT_STREAM_GET_PRIVATE(object) \ + static_cast( \ + garrow_gio_output_stream_get_instance_private(GARROW_GIO_OUTPUT_STREAM(object))) static void garrow_gio_output_stream_dispose(GObject *object) @@ -509,17 +511,17 @@ garrow_gio_output_stream_class_init(GArrowGIOOutputStreamClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_gio_output_stream_dispose; + gobject_class->dispose = garrow_gio_output_stream_dispose; gobject_class->set_property = garrow_gio_output_stream_set_property; gobject_class->get_property = garrow_gio_output_stream_get_property; GParamSpec *spec; - spec = g_param_spec_object("raw", - "Raw", - "The raw GOutputStream *", - G_TYPE_OUTPUT_STREAM, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "raw", + "Raw", + "The raw GOutputStream *", + G_TYPE_OUTPUT_STREAM, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_GIO_RAW, spec); } @@ -532,11 +534,12 @@ garrow_gio_output_stream_class_init(GArrowGIOOutputStreamClass *klass) GArrowGIOOutputStream * garrow_gio_output_stream_new(GOutputStream *gio_output_stream) { - auto arrow_output_stream = - std::make_shared(gio_output_stream); + auto arrow_output_stream = std::make_shared(gio_output_stream); auto object = g_object_new(GARROW_TYPE_GIO_OUTPUT_STREAM, - "output-stream", &arrow_output_stream, - "raw", gio_output_stream, + "output-stream", + &arrow_output_stream, + "raw", + gio_output_stream, NULL); auto output_stream = GARROW_GIO_OUTPUT_STREAM(object); return output_stream; @@ -559,7 +562,8 @@ garrow_gio_output_stream_get_raw(GArrowGIOOutputStream *output_stream) return priv->raw; } -typedef struct GArrowCompressedOutputStreamPrivate_ { +typedef struct GArrowCompressedOutputStreamPrivate_ +{ GArrowCodec *codec; GArrowOutputStream *raw; } GArrowCompressedOutputStreamPrivate; @@ -573,9 +577,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowCompressedOutputStream, garrow_compressed_output_stream, GARROW_TYPE_OUTPUT_STREAM) -#define GARROW_COMPRESSED_OUTPUT_STREAM_GET_PRIVATE(object) \ - static_cast( \ - garrow_compressed_output_stream_get_instance_private( \ +#define GARROW_COMPRESSED_OUTPUT_STREAM_GET_PRIVATE(object) \ + static_cast( \ + garrow_compressed_output_stream_get_instance_private( \ GARROW_COMPRESSED_OUTPUT_STREAM(object))) static void @@ -648,25 +652,25 @@ garrow_compressed_output_stream_class_init(GArrowCompressedOutputStreamClass *kl { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_compressed_output_stream_dispose; + gobject_class->dispose = garrow_compressed_output_stream_dispose; gobject_class->set_property = garrow_compressed_output_stream_set_property; gobject_class->get_property = garrow_compressed_output_stream_get_property; GParamSpec *spec; - spec = g_param_spec_object("codec", - "Codec", - "The codec for the stream", - GARROW_TYPE_CODEC, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "codec", + "Codec", + "The codec for the stream", + GARROW_TYPE_CODEC, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_CODEC, spec); - spec = g_param_spec_object("raw", - "Raw", - "The underlying raw output stream", - GARROW_TYPE_OUTPUT_STREAM, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "raw", + "Raw", + "The underlying raw output stream", + GARROW_TYPE_OUTPUT_STREAM, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_RAW, spec); } @@ -687,8 +691,7 @@ garrow_compressed_output_stream_new(GArrowCodec *codec, { auto arrow_codec = garrow_codec_get_raw(codec).get(); auto arrow_raw = garrow_output_stream_get_raw(raw); - auto arrow_stream = arrow::io::CompressedOutputStream::Make(arrow_codec, - arrow_raw); + auto arrow_stream = arrow::io::CompressedOutputStream::Make(arrow_codec, arrow_raw); if (garrow::check(error, arrow_stream, "[compressed-output-stream][new]")) { return garrow_compressed_output_stream_new_raw(&(arrow_stream.ValueOrDie()), codec, @@ -700,14 +703,12 @@ garrow_compressed_output_stream_new(GArrowCodec *codec, G_END_DECLS - GArrowOutputStream * -garrow_output_stream_new_raw(std::shared_ptr *arrow_output_stream) +garrow_output_stream_new_raw( + std::shared_ptr *arrow_output_stream) { - auto output_stream = - GARROW_OUTPUT_STREAM(g_object_new(GARROW_TYPE_OUTPUT_STREAM, - "output-stream", arrow_output_stream, - NULL)); + auto output_stream = GARROW_OUTPUT_STREAM( + g_object_new(GARROW_TYPE_OUTPUT_STREAM, "output-stream", arrow_output_stream, NULL)); return output_stream; } @@ -718,43 +719,50 @@ garrow_output_stream_get_raw(GArrowOutputStream *output_stream) return priv->output_stream; } - GArrowFileOutputStream * -garrow_file_output_stream_new_raw(std::shared_ptr *arrow_file_output_stream) +garrow_file_output_stream_new_raw( + std::shared_ptr *arrow_file_output_stream) { auto file_output_stream = GARROW_FILE_OUTPUT_STREAM(g_object_new(GARROW_TYPE_FILE_OUTPUT_STREAM, - "output-stream", arrow_file_output_stream, + "output-stream", + arrow_file_output_stream, NULL)); return file_output_stream; } GArrowBufferOutputStream * -garrow_buffer_output_stream_new_raw(std::shared_ptr *arrow_buffer_output_stream) +garrow_buffer_output_stream_new_raw( + std::shared_ptr *arrow_buffer_output_stream) { auto buffer_output_stream = GARROW_BUFFER_OUTPUT_STREAM(g_object_new(GARROW_TYPE_BUFFER_OUTPUT_STREAM, - "output-stream", arrow_buffer_output_stream, + "output-stream", + arrow_buffer_output_stream, NULL)); return buffer_output_stream; } GArrowCompressedOutputStream * -garrow_compressed_output_stream_new_raw(std::shared_ptr *arrow_raw, - GArrowCodec *codec, - GArrowOutputStream *raw) -{ - auto compressed_output_stream = - g_object_new(GARROW_TYPE_COMPRESSED_OUTPUT_STREAM, - "output-stream", arrow_raw, - "codec", codec, - "raw", raw, - NULL); +garrow_compressed_output_stream_new_raw( + std::shared_ptr *arrow_raw, + GArrowCodec *codec, + GArrowOutputStream *raw) +{ + auto compressed_output_stream = g_object_new(GARROW_TYPE_COMPRESSED_OUTPUT_STREAM, + "output-stream", + arrow_raw, + "codec", + codec, + "raw", + raw, + NULL); return GARROW_COMPRESSED_OUTPUT_STREAM(compressed_output_stream); } std::shared_ptr -garrow_compressed_output_stream_get_raw(GArrowCompressedOutputStream *compressed_output_stream) +garrow_compressed_output_stream_get_raw( + GArrowCompressedOutputStream *compressed_output_stream) { auto output_stream = GARROW_OUTPUT_STREAM(compressed_output_stream); auto arrow_output_stream = garrow_output_stream_get_raw(output_stream); diff --git a/c_glib/arrow-glib/output-stream.h b/c_glib/arrow-glib/output-stream.h index eeef24891792b..cf876897fa63a 100644 --- a/c_glib/arrow-glib/output-stream.h +++ b/c_glib/arrow-glib/output-stream.h @@ -30,22 +30,19 @@ G_BEGIN_DECLS #define GARROW_TYPE_OUTPUT_STREAM (garrow_output_stream_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowOutputStream, - garrow_output_stream, - GARROW, - OUTPUT_STREAM, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowOutputStream, garrow_output_stream, GARROW, OUTPUT_STREAM, GObject) struct _GArrowOutputStreamClass { GObjectClass parent_class; }; -gboolean garrow_output_stream_align(GArrowOutputStream *stream, - gint32 alignment, - GError **error); -gint64 garrow_output_stream_write_tensor(GArrowOutputStream *stream, - GArrowTensor *tensor, - GError **error); +gboolean +garrow_output_stream_align(GArrowOutputStream *stream, gint32 alignment, GError **error); +gint64 +garrow_output_stream_write_tensor(GArrowOutputStream *stream, + GArrowTensor *tensor, + GError **error); GARROW_AVAILABLE_IN_1_0 gint64 garrow_output_stream_write_record_batch(GArrowOutputStream *stream, @@ -53,31 +50,27 @@ garrow_output_stream_write_record_batch(GArrowOutputStream *stream, GArrowWriteOptions *options, GError **error); - -#define GARROW_TYPE_FILE_OUTPUT_STREAM \ - (garrow_file_output_stream_get_type()) -#define GARROW_FILE_OUTPUT_STREAM(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_FILE_OUTPUT_STREAM, \ +#define GARROW_TYPE_FILE_OUTPUT_STREAM (garrow_file_output_stream_get_type()) +#define GARROW_FILE_OUTPUT_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_FILE_OUTPUT_STREAM, \ GArrowFileOutputStream)) -#define GARROW_FILE_OUTPUT_STREAM_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_FILE_OUTPUT_STREAM, \ +#define GARROW_FILE_OUTPUT_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_FILE_OUTPUT_STREAM, \ GArrowFileOutputStreamClass)) -#define GARROW_IS_FILE_OUTPUT_STREAM(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_FILE_OUTPUT_STREAM)) -#define GARROW_IS_FILE_OUTPUT_STREAM_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_FILE_OUTPUT_STREAM)) -#define GARROW_FILE_OUTPUT_STREAM_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_FILE_OUTPUT_STREAM, \ +#define GARROW_IS_FILE_OUTPUT_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), GARROW_TYPE_FILE_OUTPUT_STREAM)) +#define GARROW_IS_FILE_OUTPUT_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), GARROW_TYPE_FILE_OUTPUT_STREAM)) +#define GARROW_FILE_OUTPUT_STREAM_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_FILE_OUTPUT_STREAM, \ GArrowFileOutputStreamClass)) -typedef struct _GArrowFileOutputStream GArrowFileOutputStream; +typedef struct _GArrowFileOutputStream GArrowFileOutputStream; #ifndef __GTK_DOC_IGNORE__ -typedef struct _GArrowFileOutputStreamClass GArrowFileOutputStreamClass; +typedef struct _GArrowFileOutputStreamClass GArrowFileOutputStreamClass; #endif /** @@ -98,37 +91,33 @@ struct _GArrowFileOutputStreamClass }; #endif -GType garrow_file_output_stream_get_type(void) G_GNUC_CONST; - -GArrowFileOutputStream *garrow_file_output_stream_new(const gchar *path, - gboolean append, - GError **error); +GType +garrow_file_output_stream_get_type(void) G_GNUC_CONST; +GArrowFileOutputStream * +garrow_file_output_stream_new(const gchar *path, gboolean append, GError **error); -#define GARROW_TYPE_BUFFER_OUTPUT_STREAM \ - (garrow_buffer_output_stream_get_type()) -#define GARROW_BUFFER_OUTPUT_STREAM(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_BUFFER_OUTPUT_STREAM, \ +#define GARROW_TYPE_BUFFER_OUTPUT_STREAM (garrow_buffer_output_stream_get_type()) +#define GARROW_BUFFER_OUTPUT_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_BUFFER_OUTPUT_STREAM, \ GArrowBufferOutputStream)) -#define GARROW_BUFFER_OUTPUT_STREAM_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_BUFFER_OUTPUT_STREAM, \ +#define GARROW_BUFFER_OUTPUT_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_BUFFER_OUTPUT_STREAM, \ GArrowBufferOutputStreamClass)) -#define GARROW_IS_BUFFER_OUTPUT_STREAM(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_BUFFER_OUTPUT_STREAM)) -#define GARROW_IS_BUFFER_OUTPUT_STREAM_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_BUFFER_OUTPUT_STREAM)) -#define GARROW_BUFFER_OUTPUT_STREAM_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_BUFFER_OUTPUT_STREAM, \ +#define GARROW_IS_BUFFER_OUTPUT_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), GARROW_TYPE_BUFFER_OUTPUT_STREAM)) +#define GARROW_IS_BUFFER_OUTPUT_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), GARROW_TYPE_BUFFER_OUTPUT_STREAM)) +#define GARROW_BUFFER_OUTPUT_STREAM_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_BUFFER_OUTPUT_STREAM, \ GArrowBufferOutputStreamClass)) -typedef struct _GArrowBufferOutputStream GArrowBufferOutputStream; +typedef struct _GArrowBufferOutputStream GArrowBufferOutputStream; #ifndef __GTK_DOC_IGNORE__ -typedef struct _GArrowBufferOutputStreamClass GArrowBufferOutputStreamClass; +typedef struct _GArrowBufferOutputStreamClass GArrowBufferOutputStreamClass; #endif /** @@ -149,35 +138,33 @@ struct _GArrowBufferOutputStreamClass }; #endif -GType garrow_buffer_output_stream_get_type(void) G_GNUC_CONST; - -GArrowBufferOutputStream *garrow_buffer_output_stream_new(GArrowResizableBuffer *buffer); +GType +garrow_buffer_output_stream_get_type(void) G_GNUC_CONST; +GArrowBufferOutputStream * +garrow_buffer_output_stream_new(GArrowResizableBuffer *buffer); -#define GARROW_TYPE_GIO_OUTPUT_STREAM \ - (garrow_gio_output_stream_get_type()) -#define GARROW_GIO_OUTPUT_STREAM(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_GIO_OUTPUT_STREAM, \ +#define GARROW_TYPE_GIO_OUTPUT_STREAM (garrow_gio_output_stream_get_type()) +#define GARROW_GIO_OUTPUT_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_GIO_OUTPUT_STREAM, \ GArrowGIOOutputStream)) -#define GARROW_GIO_OUTPUT_STREAM_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_GIO_OUTPUT_STREAM, \ +#define GARROW_GIO_OUTPUT_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_GIO_OUTPUT_STREAM, \ GArrowGIOOutputStreamClass)) -#define GARROW_IS_GIO_OUTPUT_STREAM(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_GIO_OUTPUT_STREAM)) -#define GARROW_IS_GIO_OUTPUT_STREAM_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_GIO_OUTPUT_STREAM)) -#define GARROW_GIO_OUTPUT_STREAM_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_GIO_OUTPUT_STREAM, \ +#define GARROW_IS_GIO_OUTPUT_STREAM(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), GARROW_TYPE_GIO_OUTPUT_STREAM)) +#define GARROW_IS_GIO_OUTPUT_STREAM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), GARROW_TYPE_GIO_OUTPUT_STREAM)) +#define GARROW_GIO_OUTPUT_STREAM_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_GIO_OUTPUT_STREAM, \ GArrowGIOOutputStreamClass)) -typedef struct _GArrowGIOOutputStream GArrowGIOOutputStream; +typedef struct _GArrowGIOOutputStream GArrowGIOOutputStream; #ifndef __GTK_DOC_IGNORE__ -typedef struct _GArrowGIOOutputStreamClass GArrowGIOOutputStreamClass; +typedef struct _GArrowGIOOutputStreamClass GArrowGIOOutputStreamClass; #endif /** @@ -198,17 +185,18 @@ struct _GArrowGIOOutputStreamClass }; #endif -GType garrow_gio_output_stream_get_type(void) G_GNUC_CONST; +GType +garrow_gio_output_stream_get_type(void) G_GNUC_CONST; -GArrowGIOOutputStream *garrow_gio_output_stream_new(GOutputStream *gio_output_stream); +GArrowGIOOutputStream * +garrow_gio_output_stream_new(GOutputStream *gio_output_stream); #ifndef GARROW_DISABLE_DEPRECATED G_GNUC_DEPRECATED GOutputStream * garrow_gio_output_stream_get_raw(GArrowGIOOutputStream *output_stream); #endif -#define GARROW_TYPE_COMPRESSED_OUTPUT_STREAM \ - (garrow_compressed_output_stream_get_type()) +#define GARROW_TYPE_COMPRESSED_OUTPUT_STREAM (garrow_compressed_output_stream_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowCompressedOutputStream, garrow_compressed_output_stream, GARROW, diff --git a/c_glib/arrow-glib/output-stream.hpp b/c_glib/arrow-glib/output-stream.hpp index b39b3bdfcfb78..e41c65da88d82 100644 --- a/c_glib/arrow-glib/output-stream.hpp +++ b/c_glib/arrow-glib/output-stream.hpp @@ -25,16 +25,23 @@ #include -GArrowOutputStream *garrow_output_stream_new_raw(std::shared_ptr *arrow_output_stream); -std::shared_ptr garrow_output_stream_get_raw(GArrowOutputStream *output_stream); - +GArrowOutputStream * +garrow_output_stream_new_raw( + std::shared_ptr *arrow_output_stream); +std::shared_ptr +garrow_output_stream_get_raw(GArrowOutputStream *output_stream); -GArrowFileOutputStream *garrow_file_output_stream_new_raw(std::shared_ptr *arrow_file_output_stream); -GArrowBufferOutputStream *garrow_buffer_output_stream_new_raw(std::shared_ptr *arrow_buffer_output_stream); +GArrowFileOutputStream * +garrow_file_output_stream_new_raw( + std::shared_ptr *arrow_file_output_stream); +GArrowBufferOutputStream * +garrow_buffer_output_stream_new_raw( + std::shared_ptr *arrow_buffer_output_stream); GArrowCompressedOutputStream * -garrow_compressed_output_stream_new_raw(std::shared_ptr *arrow_raw, - GArrowCodec *codec, - GArrowOutputStream *raw); +garrow_compressed_output_stream_new_raw( + std::shared_ptr *arrow_raw, + GArrowCodec *codec, + GArrowOutputStream *raw); std::shared_ptr garrow_compressed_output_stream_get_raw(GArrowCompressedOutputStream *stream); diff --git a/c_glib/arrow-glib/readable.cpp b/c_glib/arrow-glib/readable.cpp index fbe5270c7491f..e7bd603f25fea 100644 --- a/c_glib/arrow-glib/readable.cpp +++ b/c_glib/arrow-glib/readable.cpp @@ -34,12 +34,10 @@ G_BEGIN_DECLS * readable. */ -G_DEFINE_INTERFACE(GArrowReadable, - garrow_readable, - G_TYPE_OBJECT) +G_DEFINE_INTERFACE(GArrowReadable, garrow_readable, G_TYPE_OBJECT) static void -garrow_readable_default_init (GArrowReadableInterface *iface) +garrow_readable_default_init(GArrowReadableInterface *iface) { iface->buffer_new_raw = garrow_buffer_new_raw; } @@ -54,9 +52,7 @@ garrow_readable_default_init (GArrowReadableInterface *iface) * data on success, %NULL if there was an error. */ GArrowBuffer * -garrow_readable_read(GArrowReadable *readable, - gint64 n_bytes, - GError **error) +garrow_readable_read(GArrowReadable *readable, gint64 n_bytes, GError **error) { const auto arrow_readable = garrow_readable_get_raw(readable); @@ -81,9 +77,7 @@ garrow_readable_read(GArrowReadable *readable, * Since: 0.17.0 */ GBytes * -garrow_readable_read_bytes(GArrowReadable *readable, - gint64 n_bytes, - GError **error) +garrow_readable_read_bytes(GArrowReadable *readable, gint64 n_bytes, GError **error) { const auto arrow_readable = garrow_readable_get_raw(readable); @@ -92,16 +86,14 @@ garrow_readable_read_bytes(GArrowReadable *readable, return NULL; } auto arrow_cpu_buffer_result = - arrow::Buffer::ViewOrCopy(*arrow_buffer_result, - arrow::default_cpu_memory_manager()); + arrow::Buffer::ViewOrCopy(*arrow_buffer_result, arrow::default_cpu_memory_manager()); if (!garrow::check(error, arrow_cpu_buffer_result, "[readable][read-bytes][view-or-copy]")) { return NULL; } auto arrow_cpu_buffer = *arrow_cpu_buffer_result; - return g_bytes_new(arrow_cpu_buffer->data(), - arrow_cpu_buffer->size()); + return g_bytes_new(arrow_cpu_buffer->data(), arrow_cpu_buffer->size()); } G_END_DECLS diff --git a/c_glib/arrow-glib/readable.h b/c_glib/arrow-glib/readable.h index bb70f4b54ead4..0481bde7ab074 100644 --- a/c_glib/arrow-glib/readable.h +++ b/c_glib/arrow-glib/readable.h @@ -26,18 +26,12 @@ G_BEGIN_DECLS #define GARROW_TYPE_READABLE (garrow_readable_get_type()) -G_DECLARE_INTERFACE(GArrowReadable, - garrow_readable, - GARROW, - READABLE, - GObject) +G_DECLARE_INTERFACE(GArrowReadable, garrow_readable, GARROW, READABLE, GObject) -GArrowBuffer *garrow_readable_read(GArrowReadable *readable, - gint64 n_bytes, - GError **error); +GArrowBuffer * +garrow_readable_read(GArrowReadable *readable, gint64 n_bytes, GError **error); GARROW_AVAILABLE_IN_0_17 -GBytes *garrow_readable_read_bytes(GArrowReadable *readable, - gint64 n_bytes, - GError **error); +GBytes * +garrow_readable_read_bytes(GArrowReadable *readable, gint64 n_bytes, GError **error); G_END_DECLS diff --git a/c_glib/arrow-glib/readable.hpp b/c_glib/arrow-glib/readable.hpp index b002de40d1ae9..0439dee624aed 100644 --- a/c_glib/arrow-glib/readable.hpp +++ b/c_glib/arrow-glib/readable.hpp @@ -36,4 +36,5 @@ struct _GArrowReadableInterface std::shared_ptr (*get_raw)(GArrowReadable *file); }; -std::shared_ptr garrow_readable_get_raw(GArrowReadable *readable); +std::shared_ptr +garrow_readable_get_raw(GArrowReadable *readable); diff --git a/c_glib/arrow-glib/reader.cpp b/c_glib/arrow-glib/reader.cpp index 997b865a64515..4bde9ee32d5c6 100644 --- a/c_glib/arrow-glib/reader.cpp +++ b/c_glib/arrow-glib/reader.cpp @@ -59,7 +59,8 @@ G_BEGIN_DECLS * input. */ -struct GArrowRecordBatchReaderPrivate { +struct GArrowRecordBatchReaderPrivate +{ std::shared_ptr record_batch_reader; GList *sources; }; @@ -73,10 +74,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowRecordBatchReader, garrow_record_batch_reader, G_TYPE_OBJECT); -#define GARROW_RECORD_BATCH_READER_GET_PRIVATE(obj) \ - static_cast( \ - garrow_record_batch_reader_get_instance_private( \ - GARROW_RECORD_BATCH_READER(obj))) +#define GARROW_RECORD_BATCH_READER_GET_PRIVATE(obj) \ + static_cast( \ + garrow_record_batch_reader_get_instance_private(GARROW_RECORD_BATCH_READER(obj))) static void garrow_record_batch_reader_finalize(GObject *object) @@ -110,7 +110,8 @@ garrow_record_batch_reader_set_property(GObject *object, switch (prop_id) { case PROP_RECORD_BATCH_READER: priv->record_batch_reader = - *static_cast *>(g_value_get_pointer(value)); + *static_cast *>( + g_value_get_pointer(value)); break; case PROP_SOURCES: priv->sources = g_list_copy_deep(static_cast(g_value_get_pointer(value)), @@ -127,30 +128,30 @@ static void garrow_record_batch_reader_init(GArrowRecordBatchReader *object) { auto priv = GARROW_RECORD_BATCH_READER_GET_PRIVATE(object); - new(&priv->record_batch_reader) std::shared_ptr; + new (&priv->record_batch_reader) std::shared_ptr; } static void garrow_record_batch_reader_class_init(GArrowRecordBatchReaderClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_record_batch_reader_finalize; - gobject_class->finalize = garrow_record_batch_reader_dispose; + gobject_class->finalize = garrow_record_batch_reader_finalize; + gobject_class->finalize = garrow_record_batch_reader_dispose; gobject_class->set_property = garrow_record_batch_reader_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("record-batch-reader", - "arrow::ipc::RecordBatchReader", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "record-batch-reader", + "arrow::ipc::RecordBatchReader", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_RECORD_BATCH_READER, spec); - spec = g_param_spec_pointer("sources", - "Sources", - "The sources of this reader", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "sources", + "Sources", + "The sources of this reader", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_SOURCES, spec); } @@ -171,11 +172,8 @@ GArrowRecordBatchReader * garrow_record_batch_reader_import(gpointer c_abi_array_stream, GError **error) { auto arrow_reader_result = - arrow::ImportRecordBatchReader( - static_cast(c_abi_array_stream)); - if (garrow::check(error, - arrow_reader_result, - "[record-batch-reader][import]")) { + arrow::ImportRecordBatchReader(static_cast(c_abi_array_stream)); + if (garrow::check(error, arrow_reader_result, "[record-batch-reader][import]")) { return garrow_record_batch_reader_new_raw(&(*arrow_reader_result), nullptr); } else { return NULL; @@ -209,11 +207,8 @@ garrow_record_batch_reader_new(GList *record_batches, } auto arrow_reader_result = arrow::RecordBatchReader::Make(arrow_record_batches, arrow_schema); - if (garrow::check(error, - arrow_reader_result, - "[record-batch-stream-reader][new]")) { - return garrow_record_batch_reader_new_raw(&*arrow_reader_result, - record_batches); + if (garrow::check(error, arrow_reader_result, "[record-batch-stream-reader][new]")) { + return garrow_record_batch_reader_new_raw(&*arrow_reader_result, record_batches); } else { return NULL; } @@ -234,13 +229,11 @@ garrow_record_batch_reader_new(GList *record_batches, * Since: 6.0.0 */ gpointer -garrow_record_batch_reader_export(GArrowRecordBatchReader *reader, - GError **error) +garrow_record_batch_reader_export(GArrowRecordBatchReader *reader, GError **error) { auto arrow_reader = garrow_record_batch_reader_get_raw(reader); auto c_abi_array_stream = g_new(ArrowArrayStream, 1); - auto status = arrow::ExportRecordBatchReader(arrow_reader, - c_abi_array_stream); + auto status = arrow::ExportRecordBatchReader(arrow_reader, c_abi_array_stream); if (garrow::check(error, status, "[record-batch-reader][export]")) { return c_abi_array_stream; } else { @@ -316,16 +309,13 @@ garrow_record_batch_reader_read_next_record_batch(GArrowRecordBatchReader *reade * Since: 0.8.0 */ GArrowRecordBatch * -garrow_record_batch_reader_read_next(GArrowRecordBatchReader *reader, - GError **error) +garrow_record_batch_reader_read_next(GArrowRecordBatchReader *reader, GError **error) { auto arrow_reader = garrow_record_batch_reader_get_raw(reader); std::shared_ptr arrow_record_batch; auto status = arrow_reader->ReadNext(&arrow_record_batch); - if (garrow_error_check(error, - status, - "[record-batch-reader][read-next]")) { + if (garrow_error_check(error, status, "[record-batch-reader][read-next]")) { if (arrow_record_batch == nullptr) { return NULL; } else { @@ -347,16 +337,13 @@ garrow_record_batch_reader_read_next(GArrowRecordBatchReader *reader, * Since: 6.0.0 */ GArrowTable * -garrow_record_batch_reader_read_all(GArrowRecordBatchReader *reader, - GError **error) +garrow_record_batch_reader_read_all(GArrowRecordBatchReader *reader, GError **error) { auto arrow_reader = garrow_record_batch_reader_get_raw(reader); std::shared_ptr arrow_table; auto status = arrow_reader->ToTable().Value(&arrow_table); - if (garrow::check(error, - status, - "[record-batch-reader][read-all]")) { + if (garrow::check(error, status, "[record-batch-reader][read-all]")) { return garrow_table_new_raw(&arrow_table); } else { return NULL; @@ -379,7 +366,6 @@ garrow_record_batch_reader_get_sources(GArrowRecordBatchReader *reader) return priv->sources; } - G_DEFINE_TYPE(GArrowTableBatchReader, garrow_table_batch_reader, GARROW_TYPE_RECORD_BATCH_READER); @@ -406,8 +392,7 @@ GArrowTableBatchReader * garrow_table_batch_reader_new(GArrowTable *table) { auto arrow_table = garrow_table_get_raw(table); - auto arrow_table_batch_reader = - std::make_shared(*arrow_table); + auto arrow_table_batch_reader = std::make_shared(*arrow_table); return garrow_table_batch_reader_new_raw(&arrow_table_batch_reader, table); } @@ -431,7 +416,6 @@ garrow_table_batch_reader_set_max_chunk_size(GArrowTableBatchReader *reader, arrow_reader->set_chunksize(max_chunk_size); } - G_DEFINE_TYPE(GArrowRecordBatchStreamReader, garrow_record_batch_stream_reader, GARROW_TYPE_RECORD_BATCH_READER); @@ -457,8 +441,7 @@ garrow_record_batch_stream_reader_class_init(GArrowRecordBatchStreamReaderClass * Since: 0.4.0 */ GArrowRecordBatchStreamReader * -garrow_record_batch_stream_reader_new(GArrowInputStream *stream, - GError **error) +garrow_record_batch_stream_reader_new(GArrowInputStream *stream, GError **error) { using ReaderType = arrow::ipc::RecordBatchStreamReader; @@ -472,8 +455,8 @@ garrow_record_batch_stream_reader_new(GArrowInputStream *stream, } } - -typedef struct GArrowRecordBatchFileReaderPrivate_ { +typedef struct GArrowRecordBatchFileReaderPrivate_ +{ std::shared_ptr record_batch_file_reader; } GArrowRecordBatchFileReaderPrivate; @@ -486,10 +469,10 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowRecordBatchFileReader, garrow_record_batch_file_reader, G_TYPE_OBJECT); -#define GARROW_RECORD_BATCH_FILE_READER_GET_PRIVATE(obj) \ - static_cast( \ - garrow_record_batch_file_reader_get_instance_private( \ - GARROW_RECORD_BATCH_FILE_READER(obj))) +#define GARROW_RECORD_BATCH_FILE_READER_GET_PRIVATE(obj) \ + static_cast( \ + garrow_record_batch_file_reader_get_instance_private( \ + GARROW_RECORD_BATCH_FILE_READER(obj))) static void garrow_record_batch_file_reader_finalize(GObject *object) @@ -512,7 +495,8 @@ garrow_record_batch_file_reader_set_property(GObject *object, switch (prop_id) { case PROP_RECORD_BATCH_FILE_READER: priv->record_batch_file_reader = - *static_cast *>(g_value_get_pointer(value)); + *static_cast *>( + g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -537,7 +521,7 @@ static void garrow_record_batch_file_reader_init(GArrowRecordBatchFileReader *object) { auto priv = GARROW_RECORD_BATCH_FILE_READER_GET_PRIVATE(object); - new(&priv->record_batch_file_reader) + new (&priv->record_batch_file_reader) std::shared_ptr; } @@ -549,19 +533,18 @@ garrow_record_batch_file_reader_class_init(GArrowRecordBatchFileReaderClass *kla gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_record_batch_file_reader_finalize; + gobject_class->finalize = garrow_record_batch_file_reader_finalize; gobject_class->set_property = garrow_record_batch_file_reader_set_property; gobject_class->get_property = garrow_record_batch_file_reader_get_property; - spec = g_param_spec_pointer("record-batch-file-reader", - "arrow::ipc::RecordBatchFileReader", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "record-batch-file-reader", + "arrow::ipc::RecordBatchFileReader", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_RECORD_BATCH_FILE_READER, spec); } - /** * garrow_record_batch_file_reader_new: * @file: The file to be read. @@ -573,8 +556,7 @@ garrow_record_batch_file_reader_class_init(GArrowRecordBatchFileReaderClass *kla * Since: 0.4.0 */ GArrowRecordBatchFileReader * -garrow_record_batch_file_reader_new(GArrowSeekableInputStream *file, - GError **error) +garrow_record_batch_file_reader_new(GArrowSeekableInputStream *file, GError **error) { using ReaderType = arrow::ipc::RecordBatchFileReader; @@ -676,7 +658,8 @@ garrow_record_batch_file_reader_read_record_batch(GArrowRecordBatchFileReader *r auto arrow_reader = garrow_record_batch_file_reader_get_raw(reader); auto arrow_record_batch = arrow_reader->ReadRecordBatch(i); - if (garrow::check(error, arrow_record_batch, + if (garrow::check(error, + arrow_record_batch, "[record-batch-file-reader][read-record-batch]")) { return garrow_record_batch_new_raw(&(*arrow_record_batch)); } else { @@ -684,8 +667,8 @@ garrow_record_batch_file_reader_read_record_batch(GArrowRecordBatchFileReader *r } } - -typedef struct GArrowFeatherFileReaderPrivate_ { +typedef struct GArrowFeatherFileReaderPrivate_ +{ std::shared_ptr feather_reader; } GArrowFeatherFileReaderPrivate; @@ -697,10 +680,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowFeatherFileReader, garrow_feather_file_reader, G_TYPE_OBJECT); -#define GARROW_FEATHER_FILE_READER_GET_PRIVATE(obj) \ - static_cast( \ - garrow_feather_file_reader_get_instance_private( \ - GARROW_FEATHER_FILE_READER(obj))) +#define GARROW_FEATHER_FILE_READER_GET_PRIVATE(obj) \ + static_cast( \ + garrow_feather_file_reader_get_instance_private(GARROW_FEATHER_FILE_READER(obj))) static void garrow_feather_file_reader_finalize(GObject *object) @@ -722,8 +704,8 @@ garrow_feather_file_reader_set_property(GObject *object, switch (prop_id) { case PROP_FEATHER_READER: - priv->feather_reader = - *static_cast *>(g_value_get_pointer(value)); + priv->feather_reader = *static_cast *>( + g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -754,20 +736,19 @@ garrow_feather_file_reader_class_init(GArrowFeatherFileReaderClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_feather_file_reader_finalize; + gobject_class->finalize = garrow_feather_file_reader_finalize; gobject_class->set_property = garrow_feather_file_reader_set_property; gobject_class->get_property = garrow_feather_file_reader_get_property; GParamSpec *spec; - spec = g_param_spec_pointer("feather-reader", - "arrow::ipc::feather::Reader", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "feather-reader", + "arrow::ipc::feather::Reader", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_FEATHER_READER, spec); } - /** * garrow_feather_file_reader_new: * @file: The file to be read. @@ -779,8 +760,7 @@ garrow_feather_file_reader_class_init(GArrowFeatherFileReaderClass *klass) * Since: 0.4.0 */ GArrowFeatherFileReader * -garrow_feather_file_reader_new(GArrowSeekableInputStream *file, - GError **error) +garrow_feather_file_reader_new(GArrowSeekableInputStream *file, GError **error) { auto arrow_random_access_file = garrow_seekable_input_stream_get_raw(file); auto reader = arrow::ipc::feather::Reader::Open(arrow_random_access_file); @@ -816,8 +796,7 @@ garrow_feather_file_reader_get_version(GArrowFeatherFileReader *reader) * Since: 0.12.0 */ GArrowTable * -garrow_feather_file_reader_read(GArrowFeatherFileReader *reader, - GError **error) +garrow_feather_file_reader_read(GArrowFeatherFileReader *reader, GError **error) { auto arrow_reader = garrow_feather_file_reader_get_raw(reader); std::shared_ptr arrow_table; @@ -893,8 +872,8 @@ garrow_feather_file_reader_read_names(GArrowFeatherFileReader *reader, } } - -typedef struct GArrowCSVReadOptionsPrivate_ { +typedef struct GArrowCSVReadOptionsPrivate_ +{ arrow::csv::ReadOptions read_options; arrow::csv::ParseOptions parse_options; arrow::csv::ConvertOptions convert_options; @@ -917,14 +896,11 @@ enum { PROP_GENERATE_COLUMN_NAMES }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowCSVReadOptions, - garrow_csv_read_options, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowCSVReadOptions, garrow_csv_read_options, G_TYPE_OBJECT) -#define GARROW_CSV_READ_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_csv_read_options_get_instance_private( \ - GARROW_CSV_READ_OPTIONS(object))) +#define GARROW_CSV_READ_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_csv_read_options_get_instance_private(GARROW_CSV_READ_OPTIONS(object))) static void garrow_csv_read_options_set_property(GObject *object, @@ -1122,17 +1098,17 @@ garrow_csv_read_options_class_init(GArrowCSVReadOptionsClass *klass) * * Since: 0.15.0 */ - spec = g_param_spec_boolean("generate-column-names", - "Generate column names", - "Whether to autogenerate column names if column-names is empty. " - "If TRUE, column names will be of the form 'f0', 'f1'... " - "If FALSE, column names will be read from the first CSV row " - "after n-skip-rows", - read_options.autogenerate_column_names, - static_cast(G_PARAM_READWRITE)); + spec = + g_param_spec_boolean("generate-column-names", + "Generate column names", + "Whether to autogenerate column names if column-names is empty. " + "If TRUE, column names will be of the form 'f0', 'f1'... " + "If FALSE, column names will be read from the first CSV row " + "after n-skip-rows", + read_options.autogenerate_column_names, + static_cast(G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_GENERATE_COLUMN_NAMES, spec); - auto parse_options = arrow::csv::ParseOptions::Defaults(); /** @@ -1240,9 +1216,7 @@ garrow_csv_read_options_class_init(GArrowCSVReadOptionsClass *klass) "CR (0x0d) and LF (0x0a) characters.", parse_options.newlines_in_values, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_ALLOW_NEWLINES_IN_VALUES, - spec); + g_object_class_install_property(gobject_class, PROP_ALLOW_NEWLINES_IN_VALUES, spec); /** * GArrowCSVReadOptions:ignore-empty-lines: @@ -1260,9 +1234,7 @@ garrow_csv_read_options_class_init(GArrowCSVReadOptionsClass *klass) "(assuming a one-column CSV file).", parse_options.ignore_empty_lines, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_IGNORE_EMPTY_LINES, - spec); + g_object_class_install_property(gobject_class, PROP_IGNORE_EMPTY_LINES, spec); auto convert_options = arrow::csv::ConvertOptions::Defaults(); @@ -1289,13 +1261,14 @@ garrow_csv_read_options_class_init(GArrowCSVReadOptionsClass *klass) * * Since: 0.14.0 */ - spec = g_param_spec_boolean("allow-null-strings", - "Allow null strings", - "Whether string / binary columns can have null values. " - "If TRUE, then strings in null_values are considered null for string columns. " - "If FALSE, then all strings are valid string values.", - convert_options.strings_can_be_null, - static_cast(G_PARAM_READWRITE)); + spec = g_param_spec_boolean( + "allow-null-strings", + "Allow null strings", + "Whether string / binary columns can have null values. " + "If TRUE, then strings in null_values are considered null for string columns. " + "If FALSE, then all strings are valid string values.", + convert_options.strings_can_be_null, + static_cast(G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, PROP_ALLOW_NULL_STRINGS, spec); } @@ -1343,8 +1316,7 @@ garrow_csv_read_options_add_column_type(GArrowCSVReadOptions *options, * Since: 0.12.0 */ void -garrow_csv_read_options_add_schema(GArrowCSVReadOptions *options, - GArrowSchema *schema) +garrow_csv_read_options_add_schema(GArrowCSVReadOptions *options, GArrowSchema *schema) { auto priv = GARROW_CSV_READ_OPTIONS_GET_PRIVATE(options); auto arrow_schema = garrow_schema_get_raw(schema); @@ -1366,10 +1338,8 @@ GHashTable * garrow_csv_read_options_get_column_types(GArrowCSVReadOptions *options) { auto priv = GARROW_CSV_READ_OPTIONS_GET_PRIVATE(options); - GHashTable *types = g_hash_table_new_full(g_str_hash, - g_str_equal, - g_free, - g_object_unref); + GHashTable *types = + g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref); for (const auto &iter : priv->convert_options.column_types) { auto arrow_name = iter.first; auto arrow_data_type = iter.second; @@ -1653,7 +1623,8 @@ garrow_csv_read_options_add_column_name(GArrowCSVReadOptions *options, priv->read_options.column_names.push_back(column_name); } -typedef struct GArrowCSVReaderPrivate_ { +typedef struct GArrowCSVReaderPrivate_ +{ std::shared_ptr reader; GArrowInputStream *input; } GArrowCSVReaderPrivate; @@ -1663,14 +1634,11 @@ enum { PROP_CSV_READER_INPUT, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowCSVReader, - garrow_csv_reader, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowCSVReader, garrow_csv_reader, G_TYPE_OBJECT) -#define GARROW_CSV_READER_GET_PRIVATE(object) \ - static_cast( \ - garrow_csv_reader_get_instance_private( \ - GARROW_CSV_READER(object))) +#define GARROW_CSV_READER_GET_PRIVATE(object) \ + static_cast( \ + garrow_csv_reader_get_instance_private(GARROW_CSV_READER(object))) static void garrow_csv_reader_dispose(GObject *object) @@ -1705,8 +1673,8 @@ garrow_csv_reader_set_property(GObject *object, switch (prop_id) { case PROP_CSV_TABLE_READER: - priv->reader = - *static_cast *>(g_value_get_pointer(value)); + priv->reader = *static_cast *>( + g_value_get_pointer(value)); break; case PROP_CSV_READER_INPUT: priv->input = GARROW_INPUT_STREAM(g_value_dup_object(value)); @@ -1739,7 +1707,7 @@ static void garrow_csv_reader_init(GArrowCSVReader *object) { auto priv = GARROW_CSV_READER_GET_PRIVATE(object); - new(&priv->reader) std::shared_ptr; + new (&priv->reader) std::shared_ptr; } static void @@ -1747,28 +1715,26 @@ garrow_csv_reader_class_init(GArrowCSVReaderClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_csv_reader_dispose; - gobject_class->finalize = garrow_csv_reader_finalize; + gobject_class->dispose = garrow_csv_reader_dispose; + gobject_class->finalize = garrow_csv_reader_finalize; gobject_class->set_property = garrow_csv_reader_set_property; gobject_class->get_property = garrow_csv_reader_get_property; GParamSpec *spec; - spec = g_param_spec_pointer("csv-table-reader", - "CSV table reader", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "csv-table-reader", + "CSV table reader", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_CSV_TABLE_READER, spec); - spec = g_param_spec_object("input", - "Input", - "The input stream to be read", - GARROW_TYPE_INPUT_STREAM, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property(gobject_class, - PROP_CSV_READER_INPUT, - spec); + spec = g_param_spec_object( + "input", + "Input", + "The input stream to be read", + GARROW_TYPE_INPUT_STREAM, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property(gobject_class, PROP_CSV_READER_INPUT, spec); } /** @@ -1801,12 +1767,11 @@ garrow_csv_reader_new(GArrowInputStream *input, convert_options = arrow::csv::ConvertOptions::Defaults(); } - auto arrow_reader = - arrow::csv::TableReader::Make(arrow::io::default_io_context(), - arrow_input, - read_options, - parse_options, - convert_options); + auto arrow_reader = arrow::csv::TableReader::Make(arrow::io::default_io_context(), + arrow_input, + read_options, + parse_options, + convert_options); if (garrow::check(error, arrow_reader, "[csv-reader][new]")) { return garrow_csv_reader_new_raw(&(*arrow_reader), input); } else { @@ -1824,8 +1789,7 @@ garrow_csv_reader_new(GArrowInputStream *input, * Since: 0.12.0 */ GArrowTable * -garrow_csv_reader_read(GArrowCSVReader *reader, - GError **error) +garrow_csv_reader_read(GArrowCSVReader *reader, GError **error) { auto arrow_reader = garrow_csv_reader_get_raw(reader); auto arrow_table = arrow_reader->Read(); @@ -1836,8 +1800,8 @@ garrow_csv_reader_read(GArrowCSVReader *reader, } } - -typedef struct GArrowJSONReadOptionsPrivate_ { +typedef struct GArrowJSONReadOptionsPrivate_ +{ arrow::json::ReadOptions read_options; arrow::json::ParseOptions parse_options; GArrowSchema *schema; @@ -1851,14 +1815,11 @@ enum { PROP_JSON_READ_OPTIONS_SCHEMA, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowJSONReadOptions, - garrow_json_read_options, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowJSONReadOptions, garrow_json_read_options, G_TYPE_OBJECT) -#define GARROW_JSON_READ_OPTIONS_GET_PRIVATE(object) \ - static_cast( \ - garrow_json_read_options_get_instance_private( \ - GARROW_JSON_READ_OPTIONS(object))) +#define GARROW_JSON_READ_OPTIONS_GET_PRIVATE(object) \ + static_cast( \ + garrow_json_read_options_get_instance_private(GARROW_JSON_READ_OPTIONS(object))) static void garrow_json_read_options_dispose(GObject *object) @@ -1935,7 +1896,8 @@ garrow_json_read_options_get_property(GObject *object, g_value_set_boolean(value, priv->parse_options.newlines_in_values); break; case PROP_JSON_READ_OPTIONS_UNEXPECTED_FIELD_BEHAVIOR: - g_value_set_enum(value, static_cast(priv->parse_options.unexpected_field_behavior)); + g_value_set_enum(value, + static_cast(priv->parse_options.unexpected_field_behavior)); break; case PROP_JSON_READ_OPTIONS_SCHEMA: g_value_set_object(value, priv->schema); @@ -1961,7 +1923,7 @@ garrow_json_read_options_class_init(GArrowJSONReadOptionsClass *klass) auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_json_read_options_dispose; + gobject_class->dispose = garrow_json_read_options_dispose; gobject_class->set_property = garrow_json_read_options_set_property; gobject_class->get_property = garrow_json_read_options_get_property; @@ -2000,10 +1962,7 @@ garrow_json_read_options_class_init(GArrowJSONReadOptionsClass *klass) G_MAXINT, read_options.block_size, static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_JSON_READ_OPTIONS_BLOCK_SIZE, - spec); - + g_object_class_install_property(gobject_class, PROP_JSON_READ_OPTIONS_BLOCK_SIZE, spec); auto parse_options = arrow::json::ParseOptions::Defaults(); @@ -2053,11 +2012,9 @@ garrow_json_read_options_class_init(GArrowJSONReadOptionsClass *klass) spec = g_param_spec_object("schema", "Schema", "Schema for passing custom conversion rules.", - GARROW_TYPE_SCHEMA, - static_cast(G_PARAM_READWRITE)); - g_object_class_install_property(gobject_class, - PROP_JSON_READ_OPTIONS_SCHEMA, - spec); + GARROW_TYPE_SCHEMA, + static_cast(G_PARAM_READWRITE)); + g_object_class_install_property(gobject_class, PROP_JSON_READ_OPTIONS_SCHEMA, spec); } /** @@ -2074,8 +2031,8 @@ garrow_json_read_options_new(void) return GARROW_JSON_READ_OPTIONS(json_read_options); } - -typedef struct GArrowJSONReaderPrivate_ { +typedef struct GArrowJSONReaderPrivate_ +{ std::shared_ptr reader; GArrowInputStream *input; } GArrowJSONReaderPrivate; @@ -2085,14 +2042,11 @@ enum { PROP_JSON_READER_INPUT, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowJSONReader, - garrow_json_reader, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowJSONReader, garrow_json_reader, G_TYPE_OBJECT) -#define GARROW_JSON_READER_GET_PRIVATE(object) \ - static_cast( \ - garrow_json_reader_get_instance_private( \ - GARROW_JSON_READER(object))) +#define GARROW_JSON_READER_GET_PRIVATE(object) \ + static_cast( \ + garrow_json_reader_get_instance_private(GARROW_JSON_READER(object))) static void garrow_json_reader_dispose(GObject *object) @@ -2127,8 +2081,8 @@ garrow_json_reader_set_property(GObject *object, switch (prop_id) { case PROP_JSON_TABLE_READER: - priv->reader = - *static_cast *>(g_value_get_pointer(value)); + priv->reader = *static_cast *>( + g_value_get_pointer(value)); break; case PROP_JSON_READER_INPUT: priv->input = GARROW_INPUT_STREAM(g_value_dup_object(value)); @@ -2161,7 +2115,7 @@ static void garrow_json_reader_init(GArrowJSONReader *object) { auto priv = GARROW_JSON_READER_GET_PRIVATE(object); - new(&priv->reader) std::shared_ptr; + new (&priv->reader) std::shared_ptr; } static void @@ -2169,28 +2123,26 @@ garrow_json_reader_class_init(GArrowJSONReaderClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_json_reader_dispose; - gobject_class->finalize = garrow_json_reader_finalize; + gobject_class->dispose = garrow_json_reader_dispose; + gobject_class->finalize = garrow_json_reader_finalize; gobject_class->set_property = garrow_json_reader_set_property; gobject_class->get_property = garrow_json_reader_get_property; GParamSpec *spec; - spec = g_param_spec_pointer("json-table-reader", - "JSON table reader", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "json-table-reader", + "JSON table reader", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_JSON_TABLE_READER, spec); - spec = g_param_spec_object("input", - "Input", - "The input stream to be read", - GARROW_TYPE_INPUT_STREAM, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property(gobject_class, - PROP_JSON_READER_INPUT, - spec); + spec = g_param_spec_object( + "input", + "Input", + "The input stream to be read", + GARROW_TYPE_INPUT_STREAM, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property(gobject_class, PROP_JSON_READER_INPUT, spec); } /** @@ -2242,8 +2194,7 @@ garrow_json_reader_new(GArrowInputStream *input, * Since: 0.14.0 */ GArrowTable * -garrow_json_reader_read(GArrowJSONReader *reader, - GError **error) +garrow_json_reader_read(GArrowJSONReader *reader, GError **error) { auto arrow_reader = garrow_json_reader_get_raw(reader); auto arrow_table = arrow_reader->Read(); @@ -2258,14 +2209,14 @@ G_END_DECLS GArrowRecordBatchReader * garrow_record_batch_reader_new_raw( - std::shared_ptr *arrow_reader, - GList *sources) + std::shared_ptr *arrow_reader, GList *sources) { - return GARROW_RECORD_BATCH_READER( - g_object_new(GARROW_TYPE_RECORD_BATCH_READER, - "record-batch-reader", arrow_reader, - "sources", sources, - NULL)); + return GARROW_RECORD_BATCH_READER(g_object_new(GARROW_TYPE_RECORD_BATCH_READER, + "record-batch-reader", + arrow_reader, + "sources", + sources, + NULL)); } std::shared_ptr @@ -2276,16 +2227,16 @@ garrow_record_batch_reader_get_raw(GArrowRecordBatchReader *reader) } GArrowTableBatchReader * -garrow_table_batch_reader_new_raw( - std::shared_ptr *arrow_reader, - GArrowTable *table) +garrow_table_batch_reader_new_raw(std::shared_ptr *arrow_reader, + GArrowTable *table) { auto sources = g_list_prepend(nullptr, table); - auto reader = - GARROW_TABLE_BATCH_READER(g_object_new(GARROW_TYPE_TABLE_BATCH_READER, - "record-batch-reader", arrow_reader, - "sources", sources, - NULL)); + auto reader = GARROW_TABLE_BATCH_READER(g_object_new(GARROW_TYPE_TABLE_BATCH_READER, + "record-batch-reader", + arrow_reader, + "sources", + sources, + NULL)); g_list_free(sources); return reader; } @@ -2298,24 +2249,26 @@ garrow_table_batch_reader_get_raw(GArrowTableBatchReader *reader) } GArrowRecordBatchStreamReader * -garrow_record_batch_stream_reader_new_raw(std::shared_ptr *arrow_reader) +garrow_record_batch_stream_reader_new_raw( + std::shared_ptr *arrow_reader) { auto reader = - GARROW_RECORD_BATCH_STREAM_READER( - g_object_new(GARROW_TYPE_RECORD_BATCH_STREAM_READER, - "record-batch-reader", arrow_reader, - NULL)); + GARROW_RECORD_BATCH_STREAM_READER(g_object_new(GARROW_TYPE_RECORD_BATCH_STREAM_READER, + "record-batch-reader", + arrow_reader, + NULL)); return reader; } GArrowRecordBatchFileReader * -garrow_record_batch_file_reader_new_raw(std::shared_ptr *arrow_reader) +garrow_record_batch_file_reader_new_raw( + std::shared_ptr *arrow_reader) { auto reader = - GARROW_RECORD_BATCH_FILE_READER( - g_object_new(GARROW_TYPE_RECORD_BATCH_FILE_READER, - "record-batch-file-reader", arrow_reader, - NULL)); + GARROW_RECORD_BATCH_FILE_READER(g_object_new(GARROW_TYPE_RECORD_BATCH_FILE_READER, + "record-batch-file-reader", + arrow_reader, + NULL)); return reader; } @@ -2327,13 +2280,11 @@ garrow_record_batch_file_reader_get_raw(GArrowRecordBatchFileReader *reader) } GArrowFeatherFileReader * -garrow_feather_file_reader_new_raw(std::shared_ptr *arrow_reader) +garrow_feather_file_reader_new_raw( + std::shared_ptr *arrow_reader) { - auto reader = - GARROW_FEATHER_FILE_READER( - g_object_new(GARROW_TYPE_FEATHER_FILE_READER, - "feather-reader", arrow_reader, - NULL)); + auto reader = GARROW_FEATHER_FILE_READER( + g_object_new(GARROW_TYPE_FEATHER_FILE_READER, "feather-reader", arrow_reader, NULL)); return reader; } @@ -2349,8 +2300,10 @@ garrow_csv_reader_new_raw(std::shared_ptr *arrow_reader GArrowInputStream *input) { auto reader = GARROW_CSV_READER(g_object_new(GARROW_TYPE_CSV_READER, - "csv-table-reader", arrow_reader, - "input", input, + "csv-table-reader", + arrow_reader, + "input", + input, NULL)); return reader; } @@ -2367,8 +2320,10 @@ garrow_json_reader_new_raw(std::shared_ptr *arrow_read GArrowInputStream *input) { auto reader = GARROW_JSON_READER(g_object_new(GARROW_TYPE_JSON_READER, - "json-table-reader", arrow_reader, - "input", input, + "json-table-reader", + arrow_reader, + "input", + input, NULL)); return reader; } diff --git a/c_glib/arrow-glib/reader.h b/c_glib/arrow-glib/reader.h index 1ae26478cbefc..adc6c67e3d90b 100644 --- a/c_glib/arrow-glib/reader.h +++ b/c_glib/arrow-glib/reader.h @@ -43,8 +43,7 @@ struct _GArrowRecordBatchReaderClass GARROW_AVAILABLE_IN_6_0 GArrowRecordBatchReader * -garrow_record_batch_reader_import(gpointer c_abi_array_stream, - GError **error); +garrow_record_batch_reader_import(gpointer c_abi_array_stream, GError **error); GARROW_AVAILABLE_IN_6_0 GArrowRecordBatchReader * @@ -54,30 +53,27 @@ garrow_record_batch_reader_new(GList *record_batches, GARROW_AVAILABLE_IN_6_0 gpointer -garrow_record_batch_reader_export(GArrowRecordBatchReader *reader, - GError **error); +garrow_record_batch_reader_export(GArrowRecordBatchReader *reader, GError **error); -GArrowSchema *garrow_record_batch_reader_get_schema( - GArrowRecordBatchReader *reader); +GArrowSchema * +garrow_record_batch_reader_get_schema(GArrowRecordBatchReader *reader); #ifndef GARROW_DISABLE_DEPRECATED G_GNUC_DEPRECATED_FOR(garrow_record_batch_reader_read_next) -GArrowRecordBatch *garrow_record_batch_reader_get_next_record_batch( - GArrowRecordBatchReader *reader, - GError **error); +GArrowRecordBatch * +garrow_record_batch_reader_get_next_record_batch(GArrowRecordBatchReader *reader, + GError **error); #endif #ifndef GARROW_DISABLE_DEPRECATED G_GNUC_DEPRECATED_FOR(garrow_record_batch_reader_read_next) -GArrowRecordBatch *garrow_record_batch_reader_read_next_record_batch( - GArrowRecordBatchReader *reader, - GError **error); +GArrowRecordBatch * +garrow_record_batch_reader_read_next_record_batch(GArrowRecordBatchReader *reader, + GError **error); #endif -GArrowRecordBatch *garrow_record_batch_reader_read_next( - GArrowRecordBatchReader *reader, - GError **error); +GArrowRecordBatch * +garrow_record_batch_reader_read_next(GArrowRecordBatchReader *reader, GError **error); GARROW_AVAILABLE_IN_6_0 GArrowTable * -garrow_record_batch_reader_read_all(GArrowRecordBatchReader *reader, - GError **error); +garrow_record_batch_reader_read_all(GArrowRecordBatchReader *reader, GError **error); GARROW_AVAILABLE_IN_13_0 GList * @@ -94,36 +90,34 @@ struct _GArrowTableBatchReaderClass GArrowRecordBatchReaderClass parent_class; }; -GArrowTableBatchReader *garrow_table_batch_reader_new(GArrowTable *table); +GArrowTableBatchReader * +garrow_table_batch_reader_new(GArrowTable *table); GARROW_AVAILABLE_IN_12_0 void garrow_table_batch_reader_set_max_chunk_size(GArrowTableBatchReader *reader, gint64 max_chunk_size); - -#define GARROW_TYPE_RECORD_BATCH_STREAM_READER \ +#define GARROW_TYPE_RECORD_BATCH_STREAM_READER \ (garrow_record_batch_stream_reader_get_type()) -#define GARROW_RECORD_BATCH_STREAM_READER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_RECORD_BATCH_STREAM_READER, \ +#define GARROW_RECORD_BATCH_STREAM_READER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_RECORD_BATCH_STREAM_READER, \ GArrowRecordBatchStreamReader)) -#define GARROW_RECORD_BATCH_STREAM_READER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_RECORD_BATCH_STREAM_READER, \ +#define GARROW_RECORD_BATCH_STREAM_READER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_RECORD_BATCH_STREAM_READER, \ GArrowRecordBatchStreamReaderClass)) -#define GARROW_IS_RECORD_BATCH_STREAM_READER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_RECORD_BATCH_STREAM_READER)) -#define GARROW_IS_RECORD_BATCH_STREAM_READER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_RECORD_BATCH_STREAM_READER)) -#define GARROW_RECORD_BATCH_STREAM_READER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_RECORD_BATCH_STREAM_READER, \ +#define GARROW_IS_RECORD_BATCH_STREAM_READER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), GARROW_TYPE_RECORD_BATCH_STREAM_READER)) +#define GARROW_IS_RECORD_BATCH_STREAM_READER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), GARROW_TYPE_RECORD_BATCH_STREAM_READER)) +#define GARROW_RECORD_BATCH_STREAM_READER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_RECORD_BATCH_STREAM_READER, \ GArrowRecordBatchStreamReaderClass)) -typedef struct _GArrowRecordBatchStreamReader GArrowRecordBatchStreamReader; +typedef struct _GArrowRecordBatchStreamReader GArrowRecordBatchStreamReader; #ifndef __GTK_DOC_IGNORE__ typedef struct _GArrowRecordBatchStreamReaderClass GArrowRecordBatchStreamReaderClass; #endif @@ -146,35 +140,31 @@ struct _GArrowRecordBatchStreamReaderClass }; #endif -GType garrow_record_batch_stream_reader_get_type(void) G_GNUC_CONST; - -GArrowRecordBatchStreamReader *garrow_record_batch_stream_reader_new( - GArrowInputStream *stream, - GError **error); +GType +garrow_record_batch_stream_reader_get_type(void) G_GNUC_CONST; +GArrowRecordBatchStreamReader * +garrow_record_batch_stream_reader_new(GArrowInputStream *stream, GError **error); -#define GARROW_TYPE_RECORD_BATCH_FILE_READER \ - (garrow_record_batch_file_reader_get_type()) -#define GARROW_RECORD_BATCH_FILE_READER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_RECORD_BATCH_FILE_READER, \ +#define GARROW_TYPE_RECORD_BATCH_FILE_READER (garrow_record_batch_file_reader_get_type()) +#define GARROW_RECORD_BATCH_FILE_READER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_RECORD_BATCH_FILE_READER, \ GArrowRecordBatchFileReader)) -#define GARROW_RECORD_BATCH_FILE_READER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_RECORD_BATCH_FILE_READER, \ +#define GARROW_RECORD_BATCH_FILE_READER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_RECORD_BATCH_FILE_READER, \ GArrowRecordBatchFileReaderClass)) -#define GARROW_IS_RECORD_BATCH_FILE_READER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_RECORD_BATCH_FILE_READER)) -#define GARROW_IS_RECORD_BATCH_FILE_READER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_RECORD_BATCH_FILE_READER)) -#define GARROW_RECORD_BATCH_FILE_READER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_RECORD_BATCH_FILE_READER, \ +#define GARROW_IS_RECORD_BATCH_FILE_READER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), GARROW_TYPE_RECORD_BATCH_FILE_READER)) +#define GARROW_IS_RECORD_BATCH_FILE_READER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), GARROW_TYPE_RECORD_BATCH_FILE_READER)) +#define GARROW_RECORD_BATCH_FILE_READER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_RECORD_BATCH_FILE_READER, \ GArrowRecordBatchFileReaderClass)) -typedef struct _GArrowRecordBatchFileReader GArrowRecordBatchFileReader; +typedef struct _GArrowRecordBatchFileReader GArrowRecordBatchFileReader; #ifndef __GTK_DOC_IGNORE__ typedef struct _GArrowRecordBatchFileReaderClass GArrowRecordBatchFileReaderClass; #endif @@ -197,30 +187,29 @@ struct _GArrowRecordBatchFileReaderClass }; #endif -GType garrow_record_batch_file_reader_get_type(void) G_GNUC_CONST; +GType +garrow_record_batch_file_reader_get_type(void) G_GNUC_CONST; -GArrowRecordBatchFileReader *garrow_record_batch_file_reader_new( - GArrowSeekableInputStream *file, - GError **error); +GArrowRecordBatchFileReader * +garrow_record_batch_file_reader_new(GArrowSeekableInputStream *file, GError **error); -GArrowSchema *garrow_record_batch_file_reader_get_schema( - GArrowRecordBatchFileReader *reader); -guint garrow_record_batch_file_reader_get_n_record_batches( - GArrowRecordBatchFileReader *reader); -GArrowMetadataVersion garrow_record_batch_file_reader_get_version( - GArrowRecordBatchFileReader *reader); +GArrowSchema * +garrow_record_batch_file_reader_get_schema(GArrowRecordBatchFileReader *reader); +guint +garrow_record_batch_file_reader_get_n_record_batches(GArrowRecordBatchFileReader *reader); +GArrowMetadataVersion +garrow_record_batch_file_reader_get_version(GArrowRecordBatchFileReader *reader); #ifndef GARROW_DISABLE_DEPRECATED G_GNUC_DEPRECATED_FOR(garrow_record_batch_file_reader_read_record_batch) -GArrowRecordBatch *garrow_record_batch_file_reader_get_record_batch( - GArrowRecordBatchFileReader *reader, - guint i, - GError **error); +GArrowRecordBatch * +garrow_record_batch_file_reader_get_record_batch(GArrowRecordBatchFileReader *reader, + guint i, + GError **error); #endif -GArrowRecordBatch *garrow_record_batch_file_reader_read_record_batch( - GArrowRecordBatchFileReader *reader, - guint i, - GError **error); - +GArrowRecordBatch * +garrow_record_batch_file_reader_read_record_batch(GArrowRecordBatchFileReader *reader, + guint i, + GError **error); #define GARROW_TYPE_FEATHER_FILE_READER (garrow_feather_file_reader_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowFeatherFileReader, @@ -233,15 +222,13 @@ struct _GArrowFeatherFileReaderClass GObjectClass parent_class; }; -GArrowFeatherFileReader *garrow_feather_file_reader_new( - GArrowSeekableInputStream *file, - GError **error); +GArrowFeatherFileReader * +garrow_feather_file_reader_new(GArrowSeekableInputStream *file, GError **error); -gint garrow_feather_file_reader_get_version( - GArrowFeatherFileReader *reader); +gint +garrow_feather_file_reader_get_version(GArrowFeatherFileReader *reader); GArrowTable * -garrow_feather_file_reader_read(GArrowFeatherFileReader *reader, - GError **error); +garrow_feather_file_reader_read(GArrowFeatherFileReader *reader, GError **error); GArrowTable * garrow_feather_file_reader_read_indices(GArrowFeatherFileReader *reader, const gint *indices, @@ -254,24 +241,21 @@ garrow_feather_file_reader_read_names(GArrowFeatherFileReader *reader, GError **error); #define GARROW_TYPE_CSV_READ_OPTIONS (garrow_csv_read_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowCSVReadOptions, - garrow_csv_read_options, - GARROW, - CSV_READ_OPTIONS, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowCSVReadOptions, garrow_csv_read_options, GARROW, CSV_READ_OPTIONS, GObject) struct _GArrowCSVReadOptionsClass { GObjectClass parent_class; }; -GArrowCSVReadOptions *garrow_csv_read_options_new(void); +GArrowCSVReadOptions * +garrow_csv_read_options_new(void); void garrow_csv_read_options_add_column_type(GArrowCSVReadOptions *options, const gchar *name, GArrowDataType *data_type); void -garrow_csv_read_options_add_schema(GArrowCSVReadOptions *options, - GArrowSchema *schema); +garrow_csv_read_options_add_schema(GArrowCSVReadOptions *options, GArrowSchema *schema); GHashTable * garrow_csv_read_options_get_column_types(GArrowCSVReadOptions *options); GARROW_AVAILABLE_IN_0_14 @@ -324,22 +308,18 @@ garrow_csv_read_options_add_column_name(GArrowCSVReadOptions *options, const gchar *column_name); #define GARROW_TYPE_CSV_READER (garrow_csv_reader_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowCSVReader, - garrow_csv_reader, - GARROW, - CSV_READER, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowCSVReader, garrow_csv_reader, GARROW, CSV_READER, GObject) struct _GArrowCSVReaderClass { GObjectClass parent_class; }; -GArrowCSVReader *garrow_csv_reader_new(GArrowInputStream *input, - GArrowCSVReadOptions *options, - GError **error); -GArrowTable *garrow_csv_reader_read(GArrowCSVReader *reader, - GError **error); - +GArrowCSVReader * +garrow_csv_reader_new(GArrowInputStream *input, + GArrowCSVReadOptions *options, + GError **error); +GArrowTable * +garrow_csv_reader_read(GArrowCSVReader *reader, GError **error); /** * GArrowJSONReadUnexpectedFieldBehavior: @@ -356,36 +336,32 @@ typedef enum { } GArrowJSONReadUnexpectedFieldBehavior; #define GARROW_TYPE_JSON_READ_OPTIONS (garrow_json_read_options_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowJSONReadOptions, - garrow_json_read_options, - GARROW, - JSON_READ_OPTIONS, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowJSONReadOptions, garrow_json_read_options, GARROW, JSON_READ_OPTIONS, GObject) struct _GArrowJSONReadOptionsClass { GObjectClass parent_class; }; GARROW_AVAILABLE_IN_0_14 -GArrowJSONReadOptions *garrow_json_read_options_new(void); +GArrowJSONReadOptions * +garrow_json_read_options_new(void); #define GARROW_TYPE_JSON_READER (garrow_json_reader_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowJSONReader, - garrow_json_reader, - GARROW, - JSON_READER, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowJSONReader, garrow_json_reader, GARROW, JSON_READER, GObject) struct _GArrowJSONReaderClass { GObjectClass parent_class; }; GARROW_AVAILABLE_IN_0_14 -GArrowJSONReader *garrow_json_reader_new(GArrowInputStream *input, - GArrowJSONReadOptions *options, - GError **error); +GArrowJSONReader * +garrow_json_reader_new(GArrowInputStream *input, + GArrowJSONReadOptions *options, + GError **error); GARROW_AVAILABLE_IN_0_14 -GArrowTable *garrow_json_reader_read(GArrowJSONReader *reader, - GError **error); +GArrowTable * +garrow_json_reader_read(GArrowJSONReader *reader, GError **error); G_END_DECLS diff --git a/c_glib/arrow-glib/reader.hpp b/c_glib/arrow-glib/reader.hpp index 3efb9f9e07587..192497ef52e31 100644 --- a/c_glib/arrow-glib/reader.hpp +++ b/c_glib/arrow-glib/reader.hpp @@ -29,26 +29,29 @@ GArrowRecordBatchReader * garrow_record_batch_reader_new_raw( - std::shared_ptr *arrow_reader, - GList *sources); + std::shared_ptr *arrow_reader, GList *sources); std::shared_ptr garrow_record_batch_reader_get_raw(GArrowRecordBatchReader *reader); GArrowTableBatchReader * -garrow_table_batch_reader_new_raw( - std::shared_ptr *arrow_reader, - GArrowTable *table); +garrow_table_batch_reader_new_raw(std::shared_ptr *arrow_reader, + GArrowTable *table); std::shared_ptr garrow_table_batch_reader_get_raw(GArrowTableBatchReader *reader); -GArrowRecordBatchStreamReader *garrow_record_batch_stream_reader_new_raw(std::shared_ptr *arrow_reader); +GArrowRecordBatchStreamReader * +garrow_record_batch_stream_reader_new_raw( + std::shared_ptr *arrow_reader); GArrowRecordBatchFileReader * -garrow_record_batch_file_reader_new_raw(std::shared_ptr *arrow_reader); -std::shared_ptr garrow_record_batch_file_reader_get_raw(GArrowRecordBatchFileReader *reader); +garrow_record_batch_file_reader_new_raw( + std::shared_ptr *arrow_reader); +std::shared_ptr +garrow_record_batch_file_reader_get_raw(GArrowRecordBatchFileReader *reader); GArrowFeatherFileReader * -garrow_feather_file_reader_new_raw(std::shared_ptr *arrow_reader); +garrow_feather_file_reader_new_raw( + std::shared_ptr *arrow_reader); std::shared_ptr garrow_feather_file_reader_get_raw(GArrowFeatherFileReader *reader); diff --git a/c_glib/arrow-glib/record-batch.cpp b/c_glib/arrow-glib/record-batch.cpp index 9cc987b4565b4..be9b361ae0397 100644 --- a/c_glib/arrow-glib/record-batch.cpp +++ b/c_glib/arrow-glib/record-batch.cpp @@ -49,7 +49,8 @@ G_BEGIN_DECLS * batches. */ -typedef struct GArrowRecordBatchPrivate_ { +typedef struct GArrowRecordBatchPrivate_ +{ std::shared_ptr record_batch; } GArrowRecordBatchPrivate; @@ -57,14 +58,11 @@ enum { PROP_RECORD_BATCH = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowRecordBatch, - garrow_record_batch, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowRecordBatch, garrow_record_batch, G_TYPE_OBJECT) -#define GARROW_RECORD_BATCH_GET_PRIVATE(obj) \ - static_cast( \ - garrow_record_batch_get_instance_private( \ - GARROW_RECORD_BATCH(obj))) +#define GARROW_RECORD_BATCH_GET_PRIVATE(obj) \ + static_cast( \ + garrow_record_batch_get_instance_private(GARROW_RECORD_BATCH(obj))) static void garrow_record_batch_finalize(GObject *object) @@ -112,7 +110,7 @@ static void garrow_record_batch_init(GArrowRecordBatch *object) { auto priv = GARROW_RECORD_BATCH_GET_PRIVATE(object); - new(&priv->record_batch) std::shared_ptr; + new (&priv->record_batch) std::shared_ptr; } static void @@ -123,15 +121,15 @@ garrow_record_batch_class_init(GArrowRecordBatchClass *klass) gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_record_batch_finalize; + gobject_class->finalize = garrow_record_batch_finalize; gobject_class->set_property = garrow_record_batch_set_property; gobject_class->get_property = garrow_record_batch_get_property; - spec = g_param_spec_pointer("record-batch", - "RecordBatch", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "record-batch", + "RecordBatch", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_RECORD_BATCH, spec); } @@ -150,17 +148,12 @@ garrow_record_batch_class_init(GArrowRecordBatchClass *klass) * Since: 6.0.0 */ GArrowRecordBatch * -garrow_record_batch_import(gpointer c_abi_array, - GArrowSchema *schema, - GError **error) +garrow_record_batch_import(gpointer c_abi_array, GArrowSchema *schema, GError **error) { auto arrow_schema = garrow_schema_get_raw(schema); auto arrow_record_batch_result = - arrow::ImportRecordBatch(static_cast(c_abi_array), - arrow_schema); - if (garrow::check(error, - arrow_record_batch_result, - "[record-batch][import]")) { + arrow::ImportRecordBatch(static_cast(c_abi_array), arrow_schema); + if (garrow::check(error, arrow_record_batch_result, "[record-batch][import]")) { return garrow_record_batch_new_raw(&(*arrow_record_batch_result)); } else { return NULL; @@ -192,14 +185,12 @@ garrow_record_batch_new(GArrowSchema *schema, const auto &arrow_schema = garrow_schema_get_raw(schema); if (arrow_schema->num_fields() != static_cast(arrow_columns.size())) { - auto status = - arrow::Status::Invalid("Number of columns did not match schema"); + auto status = arrow::Status::Invalid("Number of columns did not match schema"); garrow_error_check(error, status, tag); return NULL; } - auto arrow_record_batch = - arrow::RecordBatch::Make(arrow_schema, n_rows, arrow_columns); + auto arrow_record_batch = arrow::RecordBatch::Make(arrow_schema, n_rows, arrow_columns); auto status = arrow_record_batch->Validate(); if (garrow_error_check(error, status, tag)) { return garrow_record_batch_new_raw(&arrow_record_batch); @@ -270,8 +261,7 @@ garrow_record_batch_equal(GArrowRecordBatch *record_batch, GArrowRecordBatch *other_record_batch) { const auto arrow_record_batch = garrow_record_batch_get_raw(record_batch); - const auto arrow_other_record_batch = - garrow_record_batch_get_raw(other_record_batch); + const auto arrow_other_record_batch = garrow_record_batch_get_raw(other_record_batch); return arrow_record_batch->Equals(*arrow_other_record_batch); } @@ -323,8 +313,7 @@ garrow_record_batch_get_schema(GArrowRecordBatch *record_batch) * Since: 0.15.0 */ GArrowArray * -garrow_record_batch_get_column_data(GArrowRecordBatch *record_batch, - gint i) +garrow_record_batch_get_column_data(GArrowRecordBatch *record_batch, gint i) { const auto &arrow_record_batch = garrow_record_batch_get_raw(record_batch); if (!garrow_internal_index_adjust(i, arrow_record_batch->num_columns())) { @@ -345,8 +334,7 @@ garrow_record_batch_get_column_data(GArrowRecordBatch *record_batch, * on success, %NULL on out of index */ const gchar * -garrow_record_batch_get_column_name(GArrowRecordBatch *record_batch, - gint i) +garrow_record_batch_get_column_name(GArrowRecordBatch *record_batch, gint i) { const auto &arrow_record_batch = garrow_record_batch_get_raw(record_batch); if (!garrow_internal_index_adjust(i, arrow_record_batch->num_columns())) { @@ -393,9 +381,7 @@ garrow_record_batch_get_n_rows(GArrowRecordBatch *record_batch) * #GArrowRecordBatch. */ GArrowRecordBatch * -garrow_record_batch_slice(GArrowRecordBatch *record_batch, - gint64 offset, - gint64 length) +garrow_record_batch_slice(GArrowRecordBatch *record_batch, gint64 offset, gint64 length) { const auto arrow_record_batch = garrow_record_batch_get_raw(record_batch); auto arrow_sub_record_batch = arrow_record_batch->Slice(offset, length); @@ -447,9 +433,7 @@ garrow_record_batch_add_column(GArrowRecordBatch *record_batch, const auto arrow_column = garrow_array_get_raw(column); auto arrow_new_record_batch = arrow_record_batch->AddColumn(i, arrow_field, arrow_column); - if (garrow::check(error, - arrow_new_record_batch, - "[record-batch][add-column]")) { + if (garrow::check(error, arrow_new_record_batch, "[record-batch][add-column]")) { return garrow_record_batch_new_raw(&(*arrow_new_record_batch)); } else { return NULL; @@ -474,9 +458,7 @@ garrow_record_batch_remove_column(GArrowRecordBatch *record_batch, { const auto arrow_record_batch = garrow_record_batch_get_raw(record_batch); auto arrow_new_record_batch = arrow_record_batch->RemoveColumn(i); - if (garrow::check(error, - arrow_new_record_batch, - "[record-batch][remove-column]")) { + if (garrow::check(error, arrow_new_record_batch, "[record-batch][remove-column]")) { return garrow_record_batch_new_raw(&(*arrow_new_record_batch)); } else { return NULL; @@ -504,8 +486,8 @@ garrow_record_batch_serialize(GArrowRecordBatch *record_batch, arrow::Result> arrow_buffer; if (options) { auto arrow_options = garrow_write_options_get_raw(options); - auto arrow_buffer = arrow::ipc::SerializeRecordBatch(*arrow_record_batch, - *arrow_options); + auto arrow_buffer = + arrow::ipc::SerializeRecordBatch(*arrow_record_batch, *arrow_options); if (garrow::check(error, arrow_buffer, "[record-batch][serialize]")) { return garrow_buffer_new_raw(&(*arrow_buffer)); } else { @@ -513,8 +495,8 @@ garrow_record_batch_serialize(GArrowRecordBatch *record_batch, } } else { const auto arrow_options = arrow::ipc::IpcWriteOptions::Defaults(); - auto arrow_buffer = arrow::ipc::SerializeRecordBatch(*arrow_record_batch, - arrow_options); + auto arrow_buffer = + arrow::ipc::SerializeRecordBatch(*arrow_record_batch, arrow_options); if (garrow::check(error, arrow_buffer, "[record-batch][serialize]")) { return garrow_buffer_new_raw(&(*arrow_buffer)); } else { @@ -523,8 +505,8 @@ garrow_record_batch_serialize(GArrowRecordBatch *record_batch, } } - -typedef struct GArrowRecordBatchIteratorPrivate_ { +typedef struct GArrowRecordBatchIteratorPrivate_ +{ arrow::RecordBatchIterator iterator; } GArrowRecordBatchIteratorPrivate; @@ -536,10 +518,10 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowRecordBatchIterator, garrow_record_batch_iterator, G_TYPE_OBJECT) -#define GARROW_RECORD_BATCH_ITERATOR_GET_PRIVATE(obj) \ - static_cast( \ - garrow_record_batch_iterator_get_instance_private( \ - GARROW_RECORD_BATCH_ITERATOR(obj))) +#define GARROW_RECORD_BATCH_ITERATOR_GET_PRIVATE(obj) \ + static_cast( \ + garrow_record_batch_iterator_get_instance_private( \ + GARROW_RECORD_BATCH_ITERATOR(obj))) static void garrow_record_batch_iterator_finalize(GObject *object) @@ -574,7 +556,7 @@ static void garrow_record_batch_iterator_init(GArrowRecordBatchIterator *object) { auto priv = GARROW_RECORD_BATCH_ITERATOR_GET_PRIVATE(object); - new(&priv->iterator) arrow::RecordBatchIterator; + new (&priv->iterator) arrow::RecordBatchIterator; } static void @@ -582,16 +564,16 @@ garrow_record_batch_iterator_class_init(GArrowRecordBatchIteratorClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_record_batch_iterator_finalize; + gobject_class->finalize = garrow_record_batch_iterator_finalize; gobject_class->set_property = garrow_record_batch_iterator_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("iterator", - "Iterator", - "The raw arrow::RecordBatchIterator", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "iterator", + "Iterator", + "The raw arrow::RecordBatchIterator", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_ITERATOR, spec); } @@ -628,8 +610,7 @@ garrow_record_batch_iterator_new(GList *record_batches) * Since: 0.17.0 */ GArrowRecordBatch * -garrow_record_batch_iterator_next(GArrowRecordBatchIterator *iterator, - GError **error) +garrow_record_batch_iterator_next(GArrowRecordBatchIterator *iterator, GError **error) { auto priv = GARROW_RECORD_BATCH_ITERATOR_GET_PRIVATE(iterator); @@ -671,9 +652,8 @@ garrow_record_batch_iterator_equal(GArrowRecordBatchIterator *iterator, * * Since: 0.17.0 */ -GList* -garrow_record_batch_iterator_to_list(GArrowRecordBatchIterator *iterator, - GError **error) +GList * +garrow_record_batch_iterator_to_list(GArrowRecordBatchIterator *iterator, GError **error) { auto priv = GARROW_RECORD_BATCH_ITERATOR_GET_PRIVATE(iterator); GList *record_batches = NULL; @@ -696,10 +676,8 @@ G_END_DECLS GArrowRecordBatch * garrow_record_batch_new_raw(std::shared_ptr *arrow_record_batch) { - auto record_batch = - GARROW_RECORD_BATCH(g_object_new(GARROW_TYPE_RECORD_BATCH, - "record-batch", arrow_record_batch, - NULL)); + auto record_batch = GARROW_RECORD_BATCH( + g_object_new(GARROW_TYPE_RECORD_BATCH, "record-batch", arrow_record_batch, NULL)); return record_batch; } @@ -713,9 +691,8 @@ garrow_record_batch_get_raw(GArrowRecordBatch *record_batch) GArrowRecordBatchIterator * garrow_record_batch_iterator_new_raw(arrow::RecordBatchIterator *arrow_iterator) { - auto iterator = g_object_new(GARROW_TYPE_RECORD_BATCH_ITERATOR, - "iterator", arrow_iterator, - NULL); + auto iterator = + g_object_new(GARROW_TYPE_RECORD_BATCH_ITERATOR, "iterator", arrow_iterator, NULL); return GARROW_RECORD_BATCH_ITERATOR(iterator); } diff --git a/c_glib/arrow-glib/record-batch.h b/c_glib/arrow-glib/record-batch.h index deca3c21b0e62..3c995658224cb 100644 --- a/c_glib/arrow-glib/record-batch.h +++ b/c_glib/arrow-glib/record-batch.h @@ -26,11 +26,8 @@ G_BEGIN_DECLS #define GARROW_TYPE_RECORD_BATCH (garrow_record_batch_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowRecordBatch, - garrow_record_batch, - GARROW, - RECORD_BATCH, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GArrowRecordBatch, garrow_record_batch, GARROW, RECORD_BATCH, GObject) struct _GArrowRecordBatchClass { GObjectClass parent_class; @@ -38,14 +35,13 @@ struct _GArrowRecordBatchClass GARROW_AVAILABLE_IN_6_0 GArrowRecordBatch * -garrow_record_batch_import(gpointer c_abi_array, - GArrowSchema *schema, - GError **error); +garrow_record_batch_import(gpointer c_abi_array, GArrowSchema *schema, GError **error); -GArrowRecordBatch *garrow_record_batch_new(GArrowSchema *schema, - guint32 n_rows, - GList *columns, - GError **error); +GArrowRecordBatch * +garrow_record_batch_new(GArrowSchema *schema, + guint32 n_rows, + GList *columns, + GError **error); GARROW_AVAILABLE_IN_6_0 gboolean @@ -54,45 +50,48 @@ garrow_record_batch_export(GArrowRecordBatch *record_batch, gpointer *c_abi_schema, GError **error); -gboolean garrow_record_batch_equal(GArrowRecordBatch *record_batch, - GArrowRecordBatch *other_record_batch); +gboolean +garrow_record_batch_equal(GArrowRecordBatch *record_batch, + GArrowRecordBatch *other_record_batch); GARROW_AVAILABLE_IN_0_17 gboolean garrow_record_batch_equal_metadata(GArrowRecordBatch *record_batch, GArrowRecordBatch *other_record_batch, gboolean check_metadata); -GArrowSchema *garrow_record_batch_get_schema (GArrowRecordBatch *record_batch); +GArrowSchema * +garrow_record_batch_get_schema(GArrowRecordBatch *record_batch); GARROW_AVAILABLE_IN_0_15 -GArrowArray *garrow_record_batch_get_column_data(GArrowRecordBatch *record_batch, - gint i); -const gchar *garrow_record_batch_get_column_name(GArrowRecordBatch *record_batch, - gint i); -guint garrow_record_batch_get_n_columns (GArrowRecordBatch *record_batch); -gint64 garrow_record_batch_get_n_rows (GArrowRecordBatch *record_batch); -GArrowRecordBatch *garrow_record_batch_slice (GArrowRecordBatch *record_batch, - gint64 offset, - gint64 length); - -gchar *garrow_record_batch_to_string (GArrowRecordBatch *record_batch, - GError **error); -GArrowRecordBatch *garrow_record_batch_add_column(GArrowRecordBatch *record_batch, - guint i, - GArrowField *field, - GArrowArray *column, - GError **error); -GArrowRecordBatch *garrow_record_batch_remove_column(GArrowRecordBatch *record_batch, - guint i, - GError **error); +GArrowArray * +garrow_record_batch_get_column_data(GArrowRecordBatch *record_batch, gint i); +const gchar * +garrow_record_batch_get_column_name(GArrowRecordBatch *record_batch, gint i); +guint +garrow_record_batch_get_n_columns(GArrowRecordBatch *record_batch); +gint64 +garrow_record_batch_get_n_rows(GArrowRecordBatch *record_batch); +GArrowRecordBatch * +garrow_record_batch_slice(GArrowRecordBatch *record_batch, gint64 offset, gint64 length); + +gchar * +garrow_record_batch_to_string(GArrowRecordBatch *record_batch, GError **error); +GArrowRecordBatch * +garrow_record_batch_add_column(GArrowRecordBatch *record_batch, + guint i, + GArrowField *field, + GArrowArray *column, + GError **error); +GArrowRecordBatch * +garrow_record_batch_remove_column(GArrowRecordBatch *record_batch, + guint i, + GError **error); GARROW_AVAILABLE_IN_1_0 GArrowBuffer * garrow_record_batch_serialize(GArrowRecordBatch *record_batch, GArrowWriteOptions *options, GError **error); - -#define GARROW_TYPE_RECORD_BATCH_ITERATOR \ - (garrow_record_batch_iterator_get_type()) +#define GARROW_TYPE_RECORD_BATCH_ITERATOR (garrow_record_batch_iterator_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowRecordBatchIterator, garrow_record_batch_iterator, GARROW, @@ -109,8 +108,7 @@ garrow_record_batch_iterator_new(GList *record_batches); GARROW_AVAILABLE_IN_0_17 GArrowRecordBatch * -garrow_record_batch_iterator_next(GArrowRecordBatchIterator *iterator, - GError **error); +garrow_record_batch_iterator_next(GArrowRecordBatchIterator *iterator, GError **error); GARROW_AVAILABLE_IN_0_17 gboolean @@ -119,7 +117,6 @@ garrow_record_batch_iterator_equal(GArrowRecordBatchIterator *iterator, GARROW_AVAILABLE_IN_0_17 GList * -garrow_record_batch_iterator_to_list(GArrowRecordBatchIterator *iterator, - GError **error); +garrow_record_batch_iterator_to_list(GArrowRecordBatchIterator *iterator, GError **error); G_END_DECLS diff --git a/c_glib/arrow-glib/record-batch.hpp b/c_glib/arrow-glib/record-batch.hpp index 50681100088f0..4c3e5e8a78231 100644 --- a/c_glib/arrow-glib/record-batch.hpp +++ b/c_glib/arrow-glib/record-batch.hpp @@ -23,8 +23,10 @@ #include -GArrowRecordBatch *garrow_record_batch_new_raw(std::shared_ptr *arrow_record_batch); -std::shared_ptr garrow_record_batch_get_raw(GArrowRecordBatch *record_batch); +GArrowRecordBatch * +garrow_record_batch_new_raw(std::shared_ptr *arrow_record_batch); +std::shared_ptr +garrow_record_batch_get_raw(GArrowRecordBatch *record_batch); GArrowRecordBatchIterator * garrow_record_batch_iterator_new_raw(arrow::RecordBatchIterator *arrow_iterator); diff --git a/c_glib/arrow-glib/scalar.cpp b/c_glib/arrow-glib/scalar.cpp index c45fca81c0f13..def6b15148355 100644 --- a/c_glib/arrow-glib/scalar.cpp +++ b/c_glib/arrow-glib/scalar.cpp @@ -130,7 +130,8 @@ G_BEGIN_DECLS * scalar. */ -typedef struct GArrowScalarPrivate_ { +typedef struct GArrowScalarPrivate_ +{ std::shared_ptr scalar; GArrowDataType *data_type; } GArrowScalarPrivate; @@ -140,14 +141,11 @@ enum { PROP_DATA_TYPE, }; -G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowScalar, - garrow_scalar, - G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowScalar, garrow_scalar, G_TYPE_OBJECT) -#define GARROW_SCALAR_GET_PRIVATE(obj) \ - static_cast( \ - garrow_scalar_get_instance_private( \ - GARROW_SCALAR(obj))) +#define GARROW_SCALAR_GET_PRIVATE(obj) \ + static_cast( \ + garrow_scalar_get_instance_private(GARROW_SCALAR(obj))) static void garrow_scalar_dispose(GObject *object) @@ -198,7 +196,7 @@ static void garrow_scalar_init(GArrowScalar *object) { auto priv = GARROW_SCALAR_GET_PRIVATE(object); - new(&priv->scalar) std::shared_ptr; + new (&priv->scalar) std::shared_ptr; } static void @@ -206,16 +204,16 @@ garrow_scalar_class_init(GArrowScalarClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_scalar_dispose; - gobject_class->finalize = garrow_scalar_finalize; + gobject_class->dispose = garrow_scalar_dispose; + gobject_class->finalize = garrow_scalar_finalize; gobject_class->set_property = garrow_scalar_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("scalar", - "Scalar", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "scalar", + "Scalar", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_SCALAR, spec); /** @@ -225,12 +223,12 @@ garrow_scalar_class_init(GArrowScalarClass *klass) * * Since: 5.0.0 */ - spec = g_param_spec_object("data-type", - "Data type", - "The data type of the scalar", - GARROW_TYPE_DATA_TYPE, - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "data-type", + "Data type", + "The data type of the scalar", + GARROW_TYPE_DATA_TYPE, + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_DATA_TYPE, spec); } @@ -254,14 +252,15 @@ garrow_scalar_parse(GArrowDataType *data_type, GError **error) { const auto arrow_data_type = garrow_data_type_get_raw(data_type); - auto arrow_data = std::string_view(reinterpret_cast(data), - size); + auto arrow_data = std::string_view(reinterpret_cast(data), size); auto arrow_scalar_result = arrow::Scalar::Parse(arrow_data_type, arrow_data); if (garrow::check(error, arrow_scalar_result, "[scalar][parse]")) { auto arrow_scalar = *arrow_scalar_result; return garrow_scalar_new_raw(&arrow_scalar, - "scalar", &arrow_scalar, - "data-type", data_type, + "scalar", + &arrow_scalar, + "data-type", + data_type, NULL); } else { return NULL; @@ -312,8 +311,7 @@ garrow_scalar_is_valid(GArrowScalar *scalar) * Since: 5.0.0 */ gboolean -garrow_scalar_equal(GArrowScalar *scalar, - GArrowScalar *other_scalar) +garrow_scalar_equal(GArrowScalar *scalar, GArrowScalar *other_scalar) { return garrow_scalar_equal_options(scalar, other_scalar, NULL); } @@ -391,18 +389,17 @@ garrow_scalar_cast(GArrowScalar *scalar, if (garrow::check(error, arrow_casted_scalar_result, "[scalar][cast]")) { auto arrow_casted_scalar = (*arrow_casted_scalar_result).scalar(); return garrow_scalar_new_raw(&arrow_casted_scalar, - "scalar", &arrow_casted_scalar, - "data-type", data_type, + "scalar", + &arrow_casted_scalar, + "data-type", + data_type, NULL); } else { return NULL; } } - -G_DEFINE_TYPE(GArrowNullScalar, - garrow_null_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowNullScalar, garrow_null_scalar, GARROW_TYPE_SCALAR) static void garrow_null_scalar_init(GArrowNullScalar *object) @@ -425,15 +422,11 @@ GArrowNullScalar * garrow_null_scalar_new(void) { auto arrow_scalar = - std::static_pointer_cast( - std::make_shared()); + std::static_pointer_cast(std::make_shared()); return GARROW_NULL_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } - -G_DEFINE_TYPE(GArrowBooleanScalar, - garrow_boolean_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowBooleanScalar, garrow_boolean_scalar, GARROW_TYPE_SCALAR) static void garrow_boolean_scalar_init(GArrowBooleanScalar *object) @@ -456,9 +449,8 @@ garrow_boolean_scalar_class_init(GArrowBooleanScalarClass *klass) GArrowBooleanScalar * garrow_boolean_scalar_new(gboolean value) { - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(value)); return GARROW_BOOLEAN_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } @@ -473,16 +465,12 @@ garrow_boolean_scalar_new(gboolean value) gboolean garrow_boolean_scalar_get_value(GArrowBooleanScalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -G_DEFINE_TYPE(GArrowInt8Scalar, - garrow_int8_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowInt8Scalar, garrow_int8_scalar, GARROW_TYPE_SCALAR) static void garrow_int8_scalar_init(GArrowInt8Scalar *object) @@ -506,8 +494,7 @@ GArrowInt8Scalar * garrow_int8_scalar_new(gint8 value) { auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value)); + std::static_pointer_cast(std::make_shared(value)); return GARROW_INT8_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } @@ -522,16 +509,12 @@ garrow_int8_scalar_new(gint8 value) gint8 garrow_int8_scalar_get_value(GArrowInt8Scalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -G_DEFINE_TYPE(GArrowInt16Scalar, - garrow_int16_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowInt16Scalar, garrow_int16_scalar, GARROW_TYPE_SCALAR) static void garrow_int16_scalar_init(GArrowInt16Scalar *object) @@ -555,8 +538,7 @@ GArrowInt16Scalar * garrow_int16_scalar_new(gint16 value) { auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value)); + std::static_pointer_cast(std::make_shared(value)); return GARROW_INT16_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } @@ -571,16 +553,12 @@ garrow_int16_scalar_new(gint16 value) gint16 garrow_int16_scalar_get_value(GArrowInt16Scalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -G_DEFINE_TYPE(GArrowInt32Scalar, - garrow_int32_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowInt32Scalar, garrow_int32_scalar, GARROW_TYPE_SCALAR) static void garrow_int32_scalar_init(GArrowInt32Scalar *object) @@ -604,8 +582,7 @@ GArrowInt32Scalar * garrow_int32_scalar_new(gint32 value) { auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value)); + std::static_pointer_cast(std::make_shared(value)); return GARROW_INT32_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } @@ -620,16 +597,12 @@ garrow_int32_scalar_new(gint32 value) gint32 garrow_int32_scalar_get_value(GArrowInt32Scalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -G_DEFINE_TYPE(GArrowInt64Scalar, - garrow_int64_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowInt64Scalar, garrow_int64_scalar, GARROW_TYPE_SCALAR) static void garrow_int64_scalar_init(GArrowInt64Scalar *object) @@ -653,8 +626,7 @@ GArrowInt64Scalar * garrow_int64_scalar_new(gint64 value) { auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value)); + std::static_pointer_cast(std::make_shared(value)); return GARROW_INT64_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } @@ -669,16 +641,12 @@ garrow_int64_scalar_new(gint64 value) gint64 garrow_int64_scalar_get_value(GArrowInt64Scalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -G_DEFINE_TYPE(GArrowUInt8Scalar, - garrow_uint8_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowUInt8Scalar, garrow_uint8_scalar, GARROW_TYPE_SCALAR) static void garrow_uint8_scalar_init(GArrowUInt8Scalar *object) @@ -702,8 +670,7 @@ GArrowUInt8Scalar * garrow_uint8_scalar_new(guint8 value) { auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value)); + std::static_pointer_cast(std::make_shared(value)); return GARROW_UINT8_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } @@ -718,16 +685,12 @@ garrow_uint8_scalar_new(guint8 value) guint8 garrow_uint8_scalar_get_value(GArrowUInt8Scalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -G_DEFINE_TYPE(GArrowUInt16Scalar, - garrow_uint16_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowUInt16Scalar, garrow_uint16_scalar, GARROW_TYPE_SCALAR) static void garrow_uint16_scalar_init(GArrowUInt16Scalar *object) @@ -751,8 +714,7 @@ GArrowUInt16Scalar * garrow_uint16_scalar_new(guint16 value) { auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value)); + std::static_pointer_cast(std::make_shared(value)); return GARROW_UINT16_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } @@ -767,16 +729,12 @@ garrow_uint16_scalar_new(guint16 value) guint16 garrow_uint16_scalar_get_value(GArrowUInt16Scalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -G_DEFINE_TYPE(GArrowUInt32Scalar, - garrow_uint32_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowUInt32Scalar, garrow_uint32_scalar, GARROW_TYPE_SCALAR) static void garrow_uint32_scalar_init(GArrowUInt32Scalar *object) @@ -800,8 +758,7 @@ GArrowUInt32Scalar * garrow_uint32_scalar_new(guint32 value) { auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value)); + std::static_pointer_cast(std::make_shared(value)); return GARROW_UINT32_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } @@ -816,16 +773,12 @@ garrow_uint32_scalar_new(guint32 value) guint32 garrow_uint32_scalar_get_value(GArrowUInt32Scalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -G_DEFINE_TYPE(GArrowUInt64Scalar, - garrow_uint64_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowUInt64Scalar, garrow_uint64_scalar, GARROW_TYPE_SCALAR) static void garrow_uint64_scalar_init(GArrowUInt64Scalar *object) @@ -849,8 +802,7 @@ GArrowUInt64Scalar * garrow_uint64_scalar_new(guint64 value) { auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value)); + std::static_pointer_cast(std::make_shared(value)); return GARROW_UINT64_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } @@ -865,16 +817,12 @@ garrow_uint64_scalar_new(guint64 value) guint64 garrow_uint64_scalar_get_value(GArrowUInt64Scalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -G_DEFINE_TYPE(GArrowHalfFloatScalar, - garrow_half_float_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowHalfFloatScalar, garrow_half_float_scalar, GARROW_TYPE_SCALAR) static void garrow_half_float_scalar_init(GArrowHalfFloatScalar *object) @@ -897,9 +845,8 @@ garrow_half_float_scalar_class_init(GArrowHalfFloatScalarClass *klass) GArrowHalfFloatScalar * garrow_half_float_scalar_new(guint16 value) { - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(value)); return GARROW_HALF_FLOAT_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } @@ -914,16 +861,12 @@ garrow_half_float_scalar_new(guint16 value) guint16 garrow_half_float_scalar_get_value(GArrowHalfFloatScalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -G_DEFINE_TYPE(GArrowFloatScalar, - garrow_float_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowFloatScalar, garrow_float_scalar, GARROW_TYPE_SCALAR) static void garrow_float_scalar_init(GArrowFloatScalar *object) @@ -947,8 +890,7 @@ GArrowFloatScalar * garrow_float_scalar_new(gfloat value) { auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value)); + std::static_pointer_cast(std::make_shared(value)); return GARROW_FLOAT_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } @@ -963,16 +905,12 @@ garrow_float_scalar_new(gfloat value) gfloat garrow_float_scalar_get_value(GArrowFloatScalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -G_DEFINE_TYPE(GArrowDoubleScalar, - garrow_double_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowDoubleScalar, garrow_double_scalar, GARROW_TYPE_SCALAR) static void garrow_double_scalar_init(GArrowDoubleScalar *object) @@ -996,8 +934,7 @@ GArrowDoubleScalar * garrow_double_scalar_new(gdouble value) { auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value)); + std::static_pointer_cast(std::make_shared(value)); return GARROW_DOUBLE_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } @@ -1012,14 +949,13 @@ garrow_double_scalar_new(gdouble value) gdouble garrow_double_scalar_get_value(GArrowDoubleScalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -typedef struct GArrowBaseBinaryScalarPrivate_ { +typedef struct GArrowBaseBinaryScalarPrivate_ +{ GArrowBuffer *value; } GArrowBaseBinaryScalarPrivate; @@ -1031,10 +967,9 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowBaseBinaryScalar, garrow_base_binary_scalar, GARROW_TYPE_SCALAR) -#define GARROW_BASE_BINARY_SCALAR_GET_PRIVATE(obj) \ - static_cast( \ - garrow_base_binary_scalar_get_instance_private( \ - GARROW_BASE_BINARY_SCALAR(obj))) +#define GARROW_BASE_BINARY_SCALAR_GET_PRIVATE(obj) \ + static_cast( \ + garrow_base_binary_scalar_get_instance_private(GARROW_BASE_BINARY_SCALAR(obj))) static void garrow_base_binary_scalar_dispose(GObject *object) @@ -1076,7 +1011,7 @@ static void garrow_base_binary_scalar_class_init(GArrowBaseBinaryScalarClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_base_binary_scalar_dispose; + gobject_class->dispose = garrow_base_binary_scalar_dispose; gobject_class->set_property = garrow_base_binary_scalar_set_property; GParamSpec *spec; @@ -1087,27 +1022,28 @@ garrow_base_binary_scalar_class_init(GArrowBaseBinaryScalarClass *klass) * * Since: 5.0.0 */ - spec = g_param_spec_object("value", - "Value", - "The value of the scalar", - GARROW_TYPE_BUFFER, - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "value", + "Value", + "The value of the scalar", + GARROW_TYPE_BUFFER, + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_VALUE, spec); } G_END_DECLS -template +template GArrowScalar * garrow_base_binary_scalar_new(GArrowBuffer *value) { auto arrow_value = garrow_buffer_get_raw(value); - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(arrow_value)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(arrow_value)); return garrow_scalar_new_raw(&arrow_scalar, - "scalar", &arrow_scalar, - "value", value, + "scalar", + &arrow_scalar, + "value", + value, NULL); } G_BEGIN_DECLS @@ -1125,18 +1061,14 @@ garrow_base_binary_scalar_get_value(GArrowBaseBinaryScalar *scalar) { auto priv = GARROW_BASE_BINARY_SCALAR_GET_PRIVATE(scalar); if (!priv->value) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); priv->value = garrow_buffer_new_raw(&(arrow_scalar->value)); } return priv->value; } - -G_DEFINE_TYPE(GArrowBinaryScalar, - garrow_binary_scalar, - GARROW_TYPE_BASE_BINARY_SCALAR) +G_DEFINE_TYPE(GArrowBinaryScalar, garrow_binary_scalar, GARROW_TYPE_BASE_BINARY_SCALAR) static void garrow_binary_scalar_init(GArrowBinaryScalar *object) @@ -1159,14 +1091,10 @@ garrow_binary_scalar_class_init(GArrowBinaryScalarClass *klass) GArrowBinaryScalar * garrow_binary_scalar_new(GArrowBuffer *value) { - return GARROW_BINARY_SCALAR( - garrow_base_binary_scalar_new(value)); + return GARROW_BINARY_SCALAR(garrow_base_binary_scalar_new(value)); } - -G_DEFINE_TYPE(GArrowStringScalar, - garrow_string_scalar, - GARROW_TYPE_BASE_BINARY_SCALAR) +G_DEFINE_TYPE(GArrowStringScalar, garrow_string_scalar, GARROW_TYPE_BASE_BINARY_SCALAR) static void garrow_string_scalar_init(GArrowStringScalar *object) @@ -1189,11 +1117,9 @@ garrow_string_scalar_class_init(GArrowStringScalarClass *klass) GArrowStringScalar * garrow_string_scalar_new(GArrowBuffer *value) { - return GARROW_STRING_SCALAR( - garrow_base_binary_scalar_new(value)); + return GARROW_STRING_SCALAR(garrow_base_binary_scalar_new(value)); } - G_DEFINE_TYPE(GArrowLargeBinaryScalar, garrow_large_binary_scalar, GARROW_TYPE_BASE_BINARY_SCALAR) @@ -1223,7 +1149,6 @@ garrow_large_binary_scalar_new(GArrowBuffer *value) garrow_base_binary_scalar_new(value)); } - G_DEFINE_TYPE(GArrowLargeStringScalar, garrow_large_string_scalar, GARROW_TYPE_BASE_BINARY_SCALAR) @@ -1253,7 +1178,6 @@ garrow_large_string_scalar_new(GArrowBuffer *value) garrow_base_binary_scalar_new(value)); } - G_DEFINE_TYPE(GArrowFixedSizeBinaryScalar, garrow_fixed_size_binary_scalar, GARROW_TYPE_BASE_BINARY_SCALAR) @@ -1264,8 +1188,7 @@ garrow_fixed_size_binary_scalar_init(GArrowFixedSizeBinaryScalar *object) } static void -garrow_fixed_size_binary_scalar_class_init( - GArrowFixedSizeBinaryScalarClass *klass) +garrow_fixed_size_binary_scalar_class_init(GArrowFixedSizeBinaryScalarClass *klass) { } @@ -1284,22 +1207,19 @@ garrow_fixed_size_binary_scalar_new(GArrowFixedSizeBinaryDataType *data_type, { auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); auto arrow_value = garrow_buffer_get_raw(value); - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared( - arrow_value, arrow_data_type)); - return GARROW_FIXED_SIZE_BINARY_SCALAR( - garrow_scalar_new_raw(&arrow_scalar, - "scalar", &arrow_scalar, - "data-type", data_type, - "value", value, - NULL)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(arrow_value, arrow_data_type)); + return GARROW_FIXED_SIZE_BINARY_SCALAR(garrow_scalar_new_raw(&arrow_scalar, + "scalar", + &arrow_scalar, + "data-type", + data_type, + "value", + value, + NULL)); } - -G_DEFINE_TYPE(GArrowDate32Scalar, - garrow_date32_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowDate32Scalar, garrow_date32_scalar, GARROW_TYPE_SCALAR) static void garrow_date32_scalar_init(GArrowDate32Scalar *object) @@ -1323,8 +1243,7 @@ GArrowDate32Scalar * garrow_date32_scalar_new(gint32 value) { auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value)); + std::static_pointer_cast(std::make_shared(value)); return GARROW_DATE32_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } @@ -1339,16 +1258,12 @@ garrow_date32_scalar_new(gint32 value) gint32 garrow_date32_scalar_get_value(GArrowDate32Scalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -G_DEFINE_TYPE(GArrowDate64Scalar, - garrow_date64_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowDate64Scalar, garrow_date64_scalar, GARROW_TYPE_SCALAR) static void garrow_date64_scalar_init(GArrowDate64Scalar *object) @@ -1372,8 +1287,7 @@ GArrowDate64Scalar * garrow_date64_scalar_new(gint64 value) { auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value)); + std::static_pointer_cast(std::make_shared(value)); return GARROW_DATE64_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } @@ -1388,16 +1302,12 @@ garrow_date64_scalar_new(gint64 value) gint64 garrow_date64_scalar_get_value(GArrowDate64Scalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -G_DEFINE_TYPE(GArrowTime32Scalar, - garrow_time32_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowTime32Scalar, garrow_time32_scalar, GARROW_TYPE_SCALAR) static void garrow_time32_scalar_init(GArrowTime32Scalar *object) @@ -1419,18 +1329,17 @@ garrow_time32_scalar_class_init(GArrowTime32ScalarClass *klass) * Since: 5.0.0 */ GArrowTime32Scalar * -garrow_time32_scalar_new(GArrowTime32DataType *data_type, - gint32 value) +garrow_time32_scalar_new(GArrowTime32DataType *data_type, gint32 value) { auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value, arrow_data_type)); - return GARROW_TIME32_SCALAR( - garrow_scalar_new_raw(&arrow_scalar, - "scalar", &arrow_scalar, - "data-type", data_type, - NULL)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(value, arrow_data_type)); + return GARROW_TIME32_SCALAR(garrow_scalar_new_raw(&arrow_scalar, + "scalar", + &arrow_scalar, + "data-type", + data_type, + NULL)); } /** @@ -1444,16 +1353,12 @@ garrow_time32_scalar_new(GArrowTime32DataType *data_type, gint32 garrow_time32_scalar_get_value(GArrowTime32Scalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -G_DEFINE_TYPE(GArrowTime64Scalar, - garrow_time64_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowTime64Scalar, garrow_time64_scalar, GARROW_TYPE_SCALAR) static void garrow_time64_scalar_init(GArrowTime64Scalar *object) @@ -1475,18 +1380,17 @@ garrow_time64_scalar_class_init(GArrowTime64ScalarClass *klass) * Since: 5.0.0 */ GArrowTime64Scalar * -garrow_time64_scalar_new(GArrowTime64DataType *data_type, - gint64 value) +garrow_time64_scalar_new(GArrowTime64DataType *data_type, gint64 value) { auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value, arrow_data_type)); - return GARROW_TIME64_SCALAR( - garrow_scalar_new_raw(&arrow_scalar, - "scalar", &arrow_scalar, - "data-type", data_type, - NULL)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(value, arrow_data_type)); + return GARROW_TIME64_SCALAR(garrow_scalar_new_raw(&arrow_scalar, + "scalar", + &arrow_scalar, + "data-type", + data_type, + NULL)); } /** @@ -1500,16 +1404,12 @@ garrow_time64_scalar_new(GArrowTime64DataType *data_type, gint64 garrow_time64_scalar_get_value(GArrowTime64Scalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -G_DEFINE_TYPE(GArrowTimestampScalar, - garrow_timestamp_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowTimestampScalar, garrow_timestamp_scalar, GARROW_TYPE_SCALAR) static void garrow_timestamp_scalar_init(GArrowTimestampScalar *object) @@ -1531,18 +1431,17 @@ garrow_timestamp_scalar_class_init(GArrowTimestampScalarClass *klass) * Since: 5.0.0 */ GArrowTimestampScalar * -garrow_timestamp_scalar_new(GArrowTimestampDataType *data_type, - gint64 value) +garrow_timestamp_scalar_new(GArrowTimestampDataType *data_type, gint64 value) { auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value, arrow_data_type)); - return GARROW_TIMESTAMP_SCALAR( - garrow_scalar_new_raw(&arrow_scalar, - "scalar", &arrow_scalar, - "data-type", data_type, - NULL)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(value, arrow_data_type)); + return GARROW_TIMESTAMP_SCALAR(garrow_scalar_new_raw(&arrow_scalar, + "scalar", + &arrow_scalar, + "data-type", + data_type, + NULL)); } /** @@ -1556,16 +1455,12 @@ garrow_timestamp_scalar_new(GArrowTimestampDataType *data_type, gint64 garrow_timestamp_scalar_get_value(GArrowTimestampScalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -G_DEFINE_TYPE(GArrowMonthIntervalScalar, - garrow_month_interval_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowMonthIntervalScalar, garrow_month_interval_scalar, GARROW_TYPE_SCALAR) static void garrow_month_interval_scalar_init(GArrowMonthIntervalScalar *object) @@ -1588,9 +1483,8 @@ garrow_month_interval_scalar_class_init(GArrowMonthIntervalScalarClass *klass) GArrowMonthIntervalScalar * garrow_month_interval_scalar_new(gint32 value) { - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(value)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(value)); return GARROW_MONTH_INTERVAL_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } @@ -1605,14 +1499,13 @@ garrow_month_interval_scalar_new(gint32 value) gint32 garrow_month_interval_scalar_get_value(GArrowMonthIntervalScalar *scalar) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->value; } - -typedef struct GArrowDayTimeIntervalScalarPrivate_ { +typedef struct GArrowDayTimeIntervalScalarPrivate_ +{ GArrowDayMillisecond *value; } GArrowDayTimeIntervalScalarPrivate; @@ -1620,9 +1513,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowDayTimeIntervalScalar, garrow_day_time_interval_scalar, GARROW_TYPE_SCALAR) -#define GARROW_DAY_TIME_INTERVAL_SCALAR_GET_PRIVATE(obj) \ - static_cast( \ - garrow_day_time_interval_scalar_get_instance_private( \ +#define GARROW_DAY_TIME_INTERVAL_SCALAR_GET_PRIVATE(obj) \ + static_cast( \ + garrow_day_time_interval_scalar_get_instance_private( \ GARROW_DAY_TIME_INTERVAL_SCALAR(obj))) static void @@ -1631,8 +1524,7 @@ garrow_day_time_interval_scalar_init(GArrowDayTimeIntervalScalar *object) } static void -garrow_day_time_interval_scalar_class_init( - GArrowDayTimeIntervalScalarClass *klass) +garrow_day_time_interval_scalar_class_init(GArrowDayTimeIntervalScalarClass *klass) { } @@ -1648,9 +1540,8 @@ GArrowDayTimeIntervalScalar * garrow_day_time_interval_scalar_new(GArrowDayMillisecond *value) { auto arrow_value = garrow_day_millisecond_get_raw(value); - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(*arrow_value)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(*arrow_value)); return GARROW_DAY_TIME_INTERVAL_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } @@ -1667,9 +1558,8 @@ garrow_day_time_interval_scalar_get_value(GArrowDayTimeIntervalScalar *scalar) { auto priv = GARROW_DAY_TIME_INTERVAL_SCALAR_GET_PRIVATE(scalar); if (!priv->value) { - auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); auto arrow_value = arrow_scalar->value; priv->value = garrow_day_millisecond_new_raw(&arrow_value); } @@ -1677,8 +1567,8 @@ garrow_day_time_interval_scalar_get_value(GArrowDayTimeIntervalScalar *scalar) return priv->value; } - -typedef struct GArrowMonthDayNanoIntervalScalarPrivate_ { +typedef struct GArrowMonthDayNanoIntervalScalarPrivate_ +{ GArrowMonthDayNano *value; } GArrowMonthDayNanoIntervalScalarPrivate; @@ -1686,14 +1576,13 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowMonthDayNanoIntervalScalar, garrow_month_day_nano_interval_scalar, GARROW_TYPE_SCALAR) -#define GARROW_MONTH_DAY_NANO_INTERVAL_SCALAR_GET_PRIVATE(obj) \ - static_cast( \ - garrow_month_day_nano_interval_scalar_get_instance_private( \ +#define GARROW_MONTH_DAY_NANO_INTERVAL_SCALAR_GET_PRIVATE(obj) \ + static_cast( \ + garrow_month_day_nano_interval_scalar_get_instance_private( \ GARROW_MONTH_DAY_NANO_INTERVAL_SCALAR(obj))) static void -garrow_month_day_nano_interval_scalar_init( - GArrowMonthDayNanoIntervalScalar *object) +garrow_month_day_nano_interval_scalar_init(GArrowMonthDayNanoIntervalScalar *object) { } @@ -1715,11 +1604,9 @@ GArrowMonthDayNanoIntervalScalar * garrow_month_day_nano_interval_scalar_new(GArrowMonthDayNano *value) { auto arrow_value = garrow_month_day_nano_get_raw(value); - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(*arrow_value)); - return GARROW_MONTH_DAY_NANO_INTERVAL_SCALAR( - garrow_scalar_new_raw(&arrow_scalar)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(*arrow_value)); + return GARROW_MONTH_DAY_NANO_INTERVAL_SCALAR(garrow_scalar_new_raw(&arrow_scalar)); } /** @@ -1735,17 +1622,16 @@ garrow_month_day_nano_interval_scalar_get_value(GArrowMonthDayNanoIntervalScalar { auto priv = GARROW_MONTH_DAY_NANO_INTERVAL_SCALAR_GET_PRIVATE(scalar); if (!priv->value) { - auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); priv->value = garrow_month_day_nano_new_raw(&arrow_scalar->value); } return priv->value; } - -typedef struct GArrowDecimal128ScalarPrivate_ { +typedef struct GArrowDecimal128ScalarPrivate_ +{ GArrowDecimal128 *value; } GArrowDecimal128ScalarPrivate; @@ -1753,10 +1639,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowDecimal128Scalar, garrow_decimal128_scalar, GARROW_TYPE_SCALAR) -#define GARROW_DECIMAL128_SCALAR_GET_PRIVATE(obj) \ - static_cast( \ - garrow_decimal128_scalar_get_instance_private( \ - GARROW_DECIMAL128_SCALAR(obj))) +#define GARROW_DECIMAL128_SCALAR_GET_PRIVATE(obj) \ + static_cast( \ + garrow_decimal128_scalar_get_instance_private(GARROW_DECIMAL128_SCALAR(obj))) static void garrow_decimal128_scalar_dispose(GObject *object) @@ -1799,7 +1684,7 @@ garrow_decimal128_scalar_class_init(GArrowDecimal128ScalarClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_decimal128_scalar_dispose; + gobject_class->dispose = garrow_decimal128_scalar_dispose; gobject_class->set_property = garrow_decimal128_scalar_set_property; GParamSpec *spec; @@ -1810,12 +1695,12 @@ garrow_decimal128_scalar_class_init(GArrowDecimal128ScalarClass *klass) * * Since: 5.0.0 */ - spec = g_param_spec_object("value", - "Value", - "The value of the scalar", - garrow_decimal128_get_type(), - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "value", + "Value", + "The value of the scalar", + garrow_decimal128_get_type(), + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_VALUE, spec); } @@ -1829,20 +1714,20 @@ garrow_decimal128_scalar_class_init(GArrowDecimal128ScalarClass *klass) * Since: 5.0.0 */ GArrowDecimal128Scalar * -garrow_decimal128_scalar_new(GArrowDecimal128DataType *data_type, - GArrowDecimal128 *value) +garrow_decimal128_scalar_new(GArrowDecimal128DataType *data_type, GArrowDecimal128 *value) { auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); auto arrow_value = garrow_decimal128_get_raw(value); - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(*arrow_value, arrow_data_type)); - return GARROW_DECIMAL128_SCALAR( - garrow_scalar_new_raw(&arrow_scalar, - "scalar", &arrow_scalar, - "data-type", data_type, - "value", value, - NULL)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(*arrow_value, arrow_data_type)); + return GARROW_DECIMAL128_SCALAR(garrow_scalar_new_raw(&arrow_scalar, + "scalar", + &arrow_scalar, + "data-type", + data_type, + "value", + value, + NULL)); } /** @@ -1858,17 +1743,16 @@ garrow_decimal128_scalar_get_value(GArrowDecimal128Scalar *scalar) { auto priv = GARROW_DECIMAL128_SCALAR_GET_PRIVATE(scalar); if (!priv->value) { - auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); auto arrow_value = std::make_shared(arrow_scalar->value); priv->value = garrow_decimal128_new_raw(&arrow_value); } return priv->value; } - -typedef struct GArrowDecimal256ScalarPrivate_ { +typedef struct GArrowDecimal256ScalarPrivate_ +{ GArrowDecimal256 *value; } GArrowDecimal256ScalarPrivate; @@ -1876,10 +1760,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowDecimal256Scalar, garrow_decimal256_scalar, GARROW_TYPE_SCALAR) -#define GARROW_DECIMAL256_SCALAR_GET_PRIVATE(obj) \ - static_cast( \ - garrow_decimal256_scalar_get_instance_private( \ - GARROW_DECIMAL256_SCALAR(obj))) +#define GARROW_DECIMAL256_SCALAR_GET_PRIVATE(obj) \ + static_cast( \ + garrow_decimal256_scalar_get_instance_private(GARROW_DECIMAL256_SCALAR(obj))) static void garrow_decimal256_scalar_dispose(GObject *object) @@ -1922,7 +1805,7 @@ garrow_decimal256_scalar_class_init(GArrowDecimal256ScalarClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_decimal256_scalar_dispose; + gobject_class->dispose = garrow_decimal256_scalar_dispose; gobject_class->set_property = garrow_decimal256_scalar_set_property; GParamSpec *spec; @@ -1933,12 +1816,12 @@ garrow_decimal256_scalar_class_init(GArrowDecimal256ScalarClass *klass) * * Since: 5.0.0 */ - spec = g_param_spec_object("value", - "Value", - "The value of the scalar", - garrow_decimal256_get_type(), - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "value", + "Value", + "The value of the scalar", + garrow_decimal256_get_type(), + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_VALUE, spec); } @@ -1952,18 +1835,19 @@ garrow_decimal256_scalar_class_init(GArrowDecimal256ScalarClass *klass) * Since: 5.0.0 */ GArrowDecimal256Scalar * -garrow_decimal256_scalar_new(GArrowDecimal256DataType *data_type, - GArrowDecimal256 *value) +garrow_decimal256_scalar_new(GArrowDecimal256DataType *data_type, GArrowDecimal256 *value) { auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); auto arrow_value = garrow_decimal256_get_raw(value); - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(*arrow_value, arrow_data_type)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(*arrow_value, arrow_data_type)); return GARROW_DECIMAL256_SCALAR(garrow_scalar_new_raw(&arrow_scalar, - "scalar", &arrow_scalar, - "data-type", data_type, - "value", value, + "scalar", + &arrow_scalar, + "data-type", + data_type, + "value", + value, NULL)); } @@ -1980,17 +1864,16 @@ garrow_decimal256_scalar_get_value(GArrowDecimal256Scalar *scalar) { auto priv = GARROW_DECIMAL256_SCALAR_GET_PRIVATE(scalar); if (!priv->value) { - auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); auto arrow_value = std::make_shared(arrow_scalar->value); priv->value = garrow_decimal256_new_raw(&arrow_value); } return priv->value; } - -typedef struct GArrowBaseListScalarPrivate_ { +typedef struct GArrowBaseListScalarPrivate_ +{ GArrowArray *value; } GArrowBaseListScalarPrivate; @@ -1998,10 +1881,9 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowBaseListScalar, garrow_base_list_scalar, GARROW_TYPE_SCALAR) -#define GARROW_BASE_LIST_SCALAR_GET_PRIVATE(obj) \ - static_cast( \ - garrow_base_list_scalar_get_instance_private( \ - GARROW_BASE_LIST_SCALAR(obj))) +#define GARROW_BASE_LIST_SCALAR_GET_PRIVATE(obj) \ + static_cast( \ + garrow_base_list_scalar_get_instance_private(GARROW_BASE_LIST_SCALAR(obj))) static void garrow_base_list_scalar_dispose(GObject *object) @@ -2044,7 +1926,7 @@ garrow_base_list_scalar_class_init(GArrowBaseListScalarClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_base_list_scalar_dispose; + gobject_class->dispose = garrow_base_list_scalar_dispose; gobject_class->set_property = garrow_base_list_scalar_set_property; GParamSpec *spec; @@ -2055,29 +1937,31 @@ garrow_base_list_scalar_class_init(GArrowBaseListScalarClass *klass) * * Since: 5.0.0 */ - spec = g_param_spec_object("value", - "Value", - "The value of the scalar", - GARROW_TYPE_ARRAY, - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "value", + "Value", + "The value of the scalar", + GARROW_TYPE_ARRAY, + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_VALUE, spec); } G_END_DECLS -template +template GArrowScalar * garrow_base_list_scalar_new(GArrowArray *value) { auto arrow_value = garrow_array_get_raw(value); - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(arrow_value)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(arrow_value)); auto data_type = garrow_array_get_value_data_type(value); auto scalar = garrow_scalar_new_raw(&arrow_scalar, - "scalar", &arrow_scalar, - "data-type", data_type, - "value", value, + "scalar", + &arrow_scalar, + "data-type", + data_type, + "value", + value, NULL); g_object_unref(data_type); return scalar; @@ -2097,18 +1981,14 @@ garrow_base_list_scalar_get_value(GArrowBaseListScalar *scalar) { auto priv = GARROW_BASE_LIST_SCALAR_GET_PRIVATE(scalar); if (!priv->value) { - const auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); priv->value = garrow_array_new_raw(&(arrow_scalar->value)); } return priv->value; } - -G_DEFINE_TYPE(GArrowListScalar, - garrow_list_scalar, - GARROW_TYPE_BASE_LIST_SCALAR) +G_DEFINE_TYPE(GArrowListScalar, garrow_list_scalar, GARROW_TYPE_BASE_LIST_SCALAR) static void garrow_list_scalar_init(GArrowListScalar *object) @@ -2135,7 +2015,6 @@ garrow_list_scalar_new(GArrowListArray *value) garrow_base_list_scalar_new(GARROW_ARRAY(value))); } - G_DEFINE_TYPE(GArrowLargeListScalar, garrow_large_list_scalar, GARROW_TYPE_BASE_LIST_SCALAR) @@ -2165,10 +2044,7 @@ garrow_large_list_scalar_new(GArrowLargeListArray *value) garrow_base_list_scalar_new(GARROW_ARRAY(value))); } - -G_DEFINE_TYPE(GArrowMapScalar, - garrow_map_scalar, - GARROW_TYPE_BASE_LIST_SCALAR) +G_DEFINE_TYPE(GArrowMapScalar, garrow_map_scalar, GARROW_TYPE_BASE_LIST_SCALAR) static void garrow_map_scalar_init(GArrowMapScalar *object) @@ -2195,19 +2071,16 @@ garrow_map_scalar_new(GArrowStructArray *value) garrow_base_list_scalar_new(GARROW_ARRAY(value))); } - -typedef struct GArrowStructScalarPrivate_ { +typedef struct GArrowStructScalarPrivate_ +{ GList *value; } GArrowStructScalarPrivate; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowStructScalar, - garrow_struct_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowStructScalar, garrow_struct_scalar, GARROW_TYPE_SCALAR) -#define GARROW_STRUCT_SCALAR_GET_PRIVATE(obj) \ - static_cast( \ - garrow_struct_scalar_get_instance_private( \ - GARROW_STRUCT_SCALAR(obj))) +#define GARROW_STRUCT_SCALAR_GET_PRIVATE(obj) \ + static_cast( \ + garrow_struct_scalar_get_instance_private(GARROW_STRUCT_SCALAR(obj))) static void garrow_struct_scalar_dispose(GObject *object) @@ -2244,8 +2117,7 @@ garrow_struct_scalar_class_init(GArrowStructScalarClass *klass) * Since: 5.0.0 */ GArrowStructScalar * -garrow_struct_scalar_new(GArrowStructDataType *data_type, - GList *value) +garrow_struct_scalar_new(GArrowStructDataType *data_type, GList *value) { auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); std::vector> arrow_value; @@ -2254,19 +2126,16 @@ garrow_struct_scalar_new(GArrowStructDataType *data_type, auto arrow_field = garrow_scalar_get_raw(field); arrow_value.push_back(arrow_field); } - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(arrow_value, arrow_data_type)); - auto scalar = - GARROW_STRUCT_SCALAR( - garrow_scalar_new_raw(&arrow_scalar, - "scalar", &arrow_scalar, - "data-type", data_type, - NULL)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(arrow_value, arrow_data_type)); + auto scalar = GARROW_STRUCT_SCALAR(garrow_scalar_new_raw(&arrow_scalar, + "scalar", + &arrow_scalar, + "data-type", + data_type, + NULL)); auto priv = GARROW_STRUCT_SCALAR_GET_PRIVATE(scalar); - priv->value = g_list_copy_deep(value, - reinterpret_cast(g_object_ref), - NULL); + priv->value = g_list_copy_deep(value, reinterpret_cast(g_object_ref), NULL); return scalar; } @@ -2284,20 +2153,18 @@ garrow_struct_scalar_get_value(GArrowStructScalar *scalar) { auto priv = GARROW_STRUCT_SCALAR_GET_PRIVATE(scalar); if (!priv->value) { - auto arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + auto arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); for (auto arrow_element : arrow_scalar->value) { - priv->value = g_list_prepend(priv->value, - garrow_scalar_new_raw(&arrow_element)); + priv->value = g_list_prepend(priv->value, garrow_scalar_new_raw(&arrow_element)); } priv->value = g_list_reverse(priv->value); } return priv->value; } - -typedef struct GArrowUnionScalarPrivate_ { +typedef struct GArrowUnionScalarPrivate_ +{ GArrowScalar *value; } GArrowUnionScalarPrivate; @@ -2305,10 +2172,9 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowUnionScalar, garrow_union_scalar, GARROW_TYPE_SCALAR) -#define GARROW_UNION_SCALAR_GET_PRIVATE(obj) \ - static_cast( \ - garrow_union_scalar_get_instance_private( \ - GARROW_UNION_SCALAR(obj))) +#define GARROW_UNION_SCALAR_GET_PRIVATE(obj) \ + static_cast( \ + garrow_union_scalar_get_instance_private(GARROW_UNION_SCALAR(obj))) static void garrow_union_scalar_dispose(GObject *object) @@ -2350,7 +2216,7 @@ static void garrow_union_scalar_class_init(GArrowUnionScalarClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_union_scalar_dispose; + gobject_class->dispose = garrow_union_scalar_dispose; gobject_class->set_property = garrow_union_scalar_set_property; GParamSpec *spec; @@ -2361,32 +2227,31 @@ garrow_union_scalar_class_init(GArrowUnionScalarClass *klass) * * Since: 5.0.0 */ - spec = g_param_spec_object("value", - "Value", - "The value of the scalar", - GARROW_TYPE_SCALAR, - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "value", + "Value", + "The value of the scalar", + GARROW_TYPE_SCALAR, + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_VALUE, spec); } G_END_DECLS -template +template GArrowScalar * -garrow_union_scalar_new(GArrowDataType *data_type, - gint8 type_code, - GArrowScalar *value) +garrow_union_scalar_new(GArrowDataType *data_type, gint8 type_code, GArrowScalar *value) { auto arrow_data_type = garrow_data_type_get_raw(data_type); auto arrow_value = garrow_scalar_get_raw(value); - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(arrow_value, type_code, - arrow_data_type)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(arrow_value, type_code, arrow_data_type)); auto scalar = garrow_scalar_new_raw(&arrow_scalar, - "scalar", &arrow_scalar, - "data-type", data_type, - "value", value, + "scalar", + &arrow_scalar, + "data-type", + data_type, + "value", + value, NULL); return scalar; } @@ -2403,9 +2268,8 @@ G_BEGIN_DECLS gint8 garrow_union_scalar_get_type_code(GArrowUnionScalar *scalar) { - const auto &arrow_scalar = - std::static_pointer_cast( - garrow_scalar_get_raw(GARROW_SCALAR(scalar))); + const auto &arrow_scalar = std::static_pointer_cast( + garrow_scalar_get_raw(GARROW_SCALAR(scalar))); return arrow_scalar->type_code; } @@ -2424,7 +2288,6 @@ garrow_union_scalar_get_value(GArrowUnionScalar *scalar) return priv->value; } - G_DEFINE_TYPE(GArrowSparseUnionScalar, garrow_sparse_union_scalar, GARROW_TYPE_UNION_SCALAR) @@ -2456,8 +2319,7 @@ garrow_sparse_union_scalar_new(GArrowSparseUnionDataType *data_type, { auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); const auto &arrow_type_codes = - std::dynamic_pointer_cast( - arrow_data_type)->type_codes(); + std::dynamic_pointer_cast(arrow_data_type)->type_codes(); auto arrow_value = garrow_scalar_get_raw(value); arrow::SparseUnionScalar::ValueType arrow_field_values; for (int i = 0; i < arrow_data_type->num_fields(); ++i) { @@ -2468,23 +2330,22 @@ garrow_sparse_union_scalar_new(GArrowSparseUnionDataType *data_type, arrow::MakeNullScalar(arrow_data_type->field(i)->type())); } } - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(arrow_field_values, - type_code, - arrow_data_type)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(arrow_field_values, + type_code, + arrow_data_type)); auto scalar = garrow_scalar_new_raw(&arrow_scalar, - "scalar", &arrow_scalar, - "data-type", data_type, - "value", value, + "scalar", + &arrow_scalar, + "data-type", + data_type, + "value", + value, NULL); return GARROW_SPARSE_UNION_SCALAR(scalar); } - -G_DEFINE_TYPE(GArrowDenseUnionScalar, - garrow_dense_union_scalar, - GARROW_TYPE_UNION_SCALAR) +G_DEFINE_TYPE(GArrowDenseUnionScalar, garrow_dense_union_scalar, GARROW_TYPE_UNION_SCALAR) static void garrow_dense_union_scalar_init(GArrowDenseUnionScalar *object) @@ -2513,23 +2374,20 @@ garrow_dense_union_scalar_new(GArrowDenseUnionDataType *data_type, { auto arrow_data_type = garrow_data_type_get_raw(GARROW_DATA_TYPE(data_type)); auto arrow_value = garrow_scalar_get_raw(value); - auto arrow_scalar = - std::static_pointer_cast( - std::make_shared(arrow_value, - type_code, - arrow_data_type)); + auto arrow_scalar = std::static_pointer_cast( + std::make_shared(arrow_value, type_code, arrow_data_type)); auto scalar = garrow_scalar_new_raw(&arrow_scalar, - "scalar", &arrow_scalar, - "data-type", data_type, - "value", value, + "scalar", + &arrow_scalar, + "data-type", + data_type, + "value", + value, NULL); return GARROW_DENSE_UNION_SCALAR(scalar); } - -G_DEFINE_TYPE(GArrowExtensionScalar, - garrow_extension_scalar, - GARROW_TYPE_SCALAR) +G_DEFINE_TYPE(GArrowExtensionScalar, garrow_extension_scalar, GARROW_TYPE_SCALAR) static void garrow_extension_scalar_init(GArrowExtensionScalar *object) @@ -2541,15 +2399,12 @@ garrow_extension_scalar_class_init(GArrowExtensionScalarClass *klass) { } - G_END_DECLS GArrowScalar * garrow_scalar_new_raw(std::shared_ptr *arrow_scalar) { - return garrow_scalar_new_raw(arrow_scalar, - "scalar", arrow_scalar, - NULL); + return garrow_scalar_new_raw(arrow_scalar, "scalar", arrow_scalar, NULL); } GArrowScalar * @@ -2559,9 +2414,7 @@ garrow_scalar_new_raw(std::shared_ptr *arrow_scalar, { va_list args; va_start(args, first_property_name); - auto array = garrow_scalar_new_raw_valist(arrow_scalar, - first_property_name, - args); + auto array = garrow_scalar_new_raw_valist(arrow_scalar, first_property_name, args); va_end(args); return array; } @@ -2665,11 +2518,11 @@ garrow_scalar_new_raw_valist(std::shared_ptr *arrow_scalar, case arrow::Type::type::LARGE_LIST: type = GARROW_TYPE_LARGE_LIST_SCALAR; break; -/* - case arrow::Type::type::FIXED_SIZE_LIST: - type = GARROW_TYPE_FIXED_SIZE_LIST_SCALAR; - break; -*/ + /* + case arrow::Type::type::FIXED_SIZE_LIST: + type = GARROW_TYPE_FIXED_SIZE_LIST_SCALAR; + break; + */ case arrow::Type::type::MAP: type = GARROW_TYPE_MAP_SCALAR; break; @@ -2689,9 +2542,7 @@ garrow_scalar_new_raw_valist(std::shared_ptr *arrow_scalar, type = GARROW_TYPE_SCALAR; break; } - scalar = GARROW_SCALAR(g_object_new_valist(type, - first_property_name, - args)); + scalar = GARROW_SCALAR(g_object_new_valist(type, first_property_name, args)); return scalar; } diff --git a/c_glib/arrow-glib/scalar.h b/c_glib/arrow-glib/scalar.h index f90160e35e0b3..b4a6229c62fd1 100644 --- a/c_glib/arrow-glib/scalar.h +++ b/c_glib/arrow-glib/scalar.h @@ -25,11 +25,7 @@ G_BEGIN_DECLS #define GARROW_TYPE_SCALAR (garrow_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowScalar, - garrow_scalar, - GARROW, - SCALAR, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowScalar, garrow_scalar, GARROW, SCALAR, GObject) struct _GArrowScalarClass { GObjectClass parent_class; @@ -50,8 +46,7 @@ gboolean garrow_scalar_is_valid(GArrowScalar *scalar); GARROW_AVAILABLE_IN_5_0 gboolean -garrow_scalar_equal(GArrowScalar *scalar, - GArrowScalar *other_scalar); +garrow_scalar_equal(GArrowScalar *scalar, GArrowScalar *other_scalar); GARROW_AVAILABLE_IN_5_0 gboolean garrow_scalar_equal_options(GArrowScalar *scalar, @@ -68,13 +63,9 @@ garrow_scalar_cast(GArrowScalar *scalar, GArrowCastOptions *options, GError **error); - #define GARROW_TYPE_NULL_SCALAR (garrow_null_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowNullScalar, - garrow_null_scalar, - GARROW, - NULL_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowNullScalar, garrow_null_scalar, GARROW, NULL_SCALAR, GArrowScalar) struct _GArrowNullScalarClass { GArrowScalarClass parent_class; @@ -84,13 +75,9 @@ GARROW_AVAILABLE_IN_5_0 GArrowNullScalar * garrow_null_scalar_new(void); - #define GARROW_TYPE_BOOLEAN_SCALAR (garrow_boolean_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowBooleanScalar, - garrow_boolean_scalar, - GARROW, - BOOLEAN_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowBooleanScalar, garrow_boolean_scalar, GARROW, BOOLEAN_SCALAR, GArrowScalar) struct _GArrowBooleanScalarClass { GArrowScalarClass parent_class; @@ -103,13 +90,9 @@ GARROW_AVAILABLE_IN_5_0 gboolean garrow_boolean_scalar_get_value(GArrowBooleanScalar *scalar); - #define GARROW_TYPE_INT8_SCALAR (garrow_int8_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowInt8Scalar, - garrow_int8_scalar, - GARROW, - INT8_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowInt8Scalar, garrow_int8_scalar, GARROW, INT8_SCALAR, GArrowScalar) struct _GArrowInt8ScalarClass { GArrowScalarClass parent_class; @@ -122,13 +105,9 @@ GARROW_AVAILABLE_IN_5_0 gint8 garrow_int8_scalar_get_value(GArrowInt8Scalar *scalar); - #define GARROW_TYPE_INT16_SCALAR (garrow_int16_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowInt16Scalar, - garrow_int16_scalar, - GARROW, - INT16_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowInt16Scalar, garrow_int16_scalar, GARROW, INT16_SCALAR, GArrowScalar) struct _GArrowInt16ScalarClass { GArrowScalarClass parent_class; @@ -141,13 +120,9 @@ GARROW_AVAILABLE_IN_5_0 gint16 garrow_int16_scalar_get_value(GArrowInt16Scalar *scalar); - #define GARROW_TYPE_INT32_SCALAR (garrow_int32_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowInt32Scalar, - garrow_int32_scalar, - GARROW, - INT32_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowInt32Scalar, garrow_int32_scalar, GARROW, INT32_SCALAR, GArrowScalar) struct _GArrowInt32ScalarClass { GArrowScalarClass parent_class; @@ -160,13 +135,9 @@ GARROW_AVAILABLE_IN_5_0 gint32 garrow_int32_scalar_get_value(GArrowInt32Scalar *scalar); - #define GARROW_TYPE_INT64_SCALAR (garrow_int64_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowInt64Scalar, - garrow_int64_scalar, - GARROW, - INT64_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowInt64Scalar, garrow_int64_scalar, GARROW, INT64_SCALAR, GArrowScalar) struct _GArrowInt64ScalarClass { GArrowScalarClass parent_class; @@ -179,13 +150,9 @@ GARROW_AVAILABLE_IN_5_0 gint64 garrow_int64_scalar_get_value(GArrowInt64Scalar *scalar); - #define GARROW_TYPE_UINT8_SCALAR (garrow_uint8_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowUInt8Scalar, - garrow_uint8_scalar, - GARROW, - UINT8_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowUInt8Scalar, garrow_uint8_scalar, GARROW, UINT8_SCALAR, GArrowScalar) struct _GArrowUInt8ScalarClass { GArrowScalarClass parent_class; @@ -198,13 +165,9 @@ GARROW_AVAILABLE_IN_5_0 guint8 garrow_uint8_scalar_get_value(GArrowUInt8Scalar *scalar); - #define GARROW_TYPE_UINT16_SCALAR (garrow_uint16_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowUInt16Scalar, - garrow_uint16_scalar, - GARROW, - UINT16_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowUInt16Scalar, garrow_uint16_scalar, GARROW, UINT16_SCALAR, GArrowScalar) struct _GArrowUInt16ScalarClass { GArrowScalarClass parent_class; @@ -217,13 +180,9 @@ GARROW_AVAILABLE_IN_5_0 guint16 garrow_uint16_scalar_get_value(GArrowUInt16Scalar *scalar); - #define GARROW_TYPE_UINT32_SCALAR (garrow_uint32_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowUInt32Scalar, - garrow_uint32_scalar, - GARROW, - UINT32_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowUInt32Scalar, garrow_uint32_scalar, GARROW, UINT32_SCALAR, GArrowScalar) struct _GArrowUInt32ScalarClass { GArrowScalarClass parent_class; @@ -236,13 +195,9 @@ GARROW_AVAILABLE_IN_5_0 guint32 garrow_uint32_scalar_get_value(GArrowUInt32Scalar *scalar); - #define GARROW_TYPE_UINT64_SCALAR (garrow_uint64_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowUInt64Scalar, - garrow_uint64_scalar, - GARROW, - UINT64_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowUInt64Scalar, garrow_uint64_scalar, GARROW, UINT64_SCALAR, GArrowScalar) struct _GArrowUInt64ScalarClass { GArrowScalarClass parent_class; @@ -255,7 +210,6 @@ GARROW_AVAILABLE_IN_5_0 guint64 garrow_uint64_scalar_get_value(GArrowUInt64Scalar *scalar); - #define GARROW_TYPE_HALF_FLOAT_SCALAR (garrow_half_float_scalar_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowHalfFloatScalar, garrow_half_float_scalar, @@ -274,13 +228,9 @@ GARROW_AVAILABLE_IN_11_0 guint16 garrow_half_float_scalar_get_value(GArrowHalfFloatScalar *scalar); - #define GARROW_TYPE_FLOAT_SCALAR (garrow_float_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowFloatScalar, - garrow_float_scalar, - GARROW, - FLOAT_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowFloatScalar, garrow_float_scalar, GARROW, FLOAT_SCALAR, GArrowScalar) struct _GArrowFloatScalarClass { GArrowScalarClass parent_class; @@ -293,13 +243,9 @@ GARROW_AVAILABLE_IN_5_0 gfloat garrow_float_scalar_get_value(GArrowFloatScalar *scalar); - #define GARROW_TYPE_DOUBLE_SCALAR (garrow_double_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowDoubleScalar, - garrow_double_scalar, - GARROW, - DOUBLE_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowDoubleScalar, garrow_double_scalar, GARROW, DOUBLE_SCALAR, GArrowScalar) struct _GArrowDoubleScalarClass { GArrowScalarClass parent_class; @@ -312,7 +258,6 @@ GARROW_AVAILABLE_IN_5_0 gdouble garrow_double_scalar_get_value(GArrowDoubleScalar *scalar); - #define GARROW_TYPE_BASE_BINARY_SCALAR (garrow_base_binary_scalar_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowBaseBinaryScalar, garrow_base_binary_scalar, @@ -328,13 +273,9 @@ GARROW_AVAILABLE_IN_5_0 GArrowBuffer * garrow_base_binary_scalar_get_value(GArrowBaseBinaryScalar *scalar); - #define GARROW_TYPE_BINARY_SCALAR (garrow_binary_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowBinaryScalar, - garrow_binary_scalar, - GARROW, - BINARY_SCALAR, - GArrowBaseBinaryScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowBinaryScalar, garrow_binary_scalar, GARROW, BINARY_SCALAR, GArrowBaseBinaryScalar) struct _GArrowBinaryScalarClass { GArrowBaseBinaryScalarClass parent_class; @@ -344,13 +285,9 @@ GARROW_AVAILABLE_IN_5_0 GArrowBinaryScalar * garrow_binary_scalar_new(GArrowBuffer *value); - #define GARROW_TYPE_STRING_SCALAR (garrow_string_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowStringScalar, - garrow_string_scalar, - GARROW, - STRING_SCALAR, - GArrowBaseBinaryScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowStringScalar, garrow_string_scalar, GARROW, STRING_SCALAR, GArrowBaseBinaryScalar) struct _GArrowStringScalarClass { GArrowBaseBinaryScalarClass parent_class; @@ -360,7 +297,6 @@ GARROW_AVAILABLE_IN_5_0 GArrowStringScalar * garrow_string_scalar_new(GArrowBuffer *value); - #define GARROW_TYPE_LARGE_BINARY_SCALAR (garrow_large_binary_scalar_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowLargeBinaryScalar, garrow_large_binary_scalar, @@ -376,7 +312,6 @@ GARROW_AVAILABLE_IN_5_0 GArrowLargeBinaryScalar * garrow_large_binary_scalar_new(GArrowBuffer *value); - #define GARROW_TYPE_LARGE_STRING_SCALAR (garrow_large_string_scalar_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowLargeStringScalar, garrow_large_string_scalar, @@ -392,9 +327,7 @@ GARROW_AVAILABLE_IN_5_0 GArrowLargeStringScalar * garrow_large_string_scalar_new(GArrowBuffer *value); - -#define GARROW_TYPE_FIXED_SIZE_BINARY_SCALAR \ - (garrow_fixed_size_binary_scalar_get_type()) +#define GARROW_TYPE_FIXED_SIZE_BINARY_SCALAR (garrow_fixed_size_binary_scalar_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowFixedSizeBinaryScalar, garrow_fixed_size_binary_scalar, GARROW, @@ -410,13 +343,9 @@ GArrowFixedSizeBinaryScalar * garrow_fixed_size_binary_scalar_new(GArrowFixedSizeBinaryDataType *data_type, GArrowBuffer *value); - #define GARROW_TYPE_DATE32_SCALAR (garrow_date32_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowDate32Scalar, - garrow_date32_scalar, - GARROW, - DATE32_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowDate32Scalar, garrow_date32_scalar, GARROW, DATE32_SCALAR, GArrowScalar) struct _GArrowDate32ScalarClass { GArrowScalarClass parent_class; @@ -429,13 +358,9 @@ GARROW_AVAILABLE_IN_5_0 gint32 garrow_date32_scalar_get_value(GArrowDate32Scalar *scalar); - #define GARROW_TYPE_DATE64_SCALAR (garrow_date64_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowDate64Scalar, - garrow_date64_scalar, - GARROW, - DATE64_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowDate64Scalar, garrow_date64_scalar, GARROW, DATE64_SCALAR, GArrowScalar) struct _GArrowDate64ScalarClass { GArrowScalarClass parent_class; @@ -448,13 +373,9 @@ GARROW_AVAILABLE_IN_5_0 gint64 garrow_date64_scalar_get_value(GArrowDate64Scalar *scalar); - #define GARROW_TYPE_TIME32_SCALAR (garrow_time32_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowTime32Scalar, - garrow_time32_scalar, - GARROW, - TIME32_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowTime32Scalar, garrow_time32_scalar, GARROW, TIME32_SCALAR, GArrowScalar) struct _GArrowTime32ScalarClass { GArrowScalarClass parent_class; @@ -462,19 +383,14 @@ struct _GArrowTime32ScalarClass GARROW_AVAILABLE_IN_5_0 GArrowTime32Scalar * -garrow_time32_scalar_new(GArrowTime32DataType *data_type, - gint32 value); +garrow_time32_scalar_new(GArrowTime32DataType *data_type, gint32 value); GARROW_AVAILABLE_IN_5_0 gint32 garrow_time32_scalar_get_value(GArrowTime32Scalar *scalar); - #define GARROW_TYPE_TIME64_SCALAR (garrow_time64_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowTime64Scalar, - garrow_time64_scalar, - GARROW, - TIME64_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowTime64Scalar, garrow_time64_scalar, GARROW, TIME64_SCALAR, GArrowScalar) struct _GArrowTime64ScalarClass { GArrowScalarClass parent_class; @@ -482,19 +398,14 @@ struct _GArrowTime64ScalarClass GARROW_AVAILABLE_IN_5_0 GArrowTime64Scalar * -garrow_time64_scalar_new(GArrowTime64DataType *data_type, - gint64 value); +garrow_time64_scalar_new(GArrowTime64DataType *data_type, gint64 value); GARROW_AVAILABLE_IN_5_0 gint64 garrow_time64_scalar_get_value(GArrowTime64Scalar *scalar); - #define GARROW_TYPE_TIMESTAMP_SCALAR (garrow_timestamp_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowTimestampScalar, - garrow_timestamp_scalar, - GARROW, - TIMESTAMP_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowTimestampScalar, garrow_timestamp_scalar, GARROW, TIMESTAMP_SCALAR, GArrowScalar) struct _GArrowTimestampScalarClass { GArrowScalarClass parent_class; @@ -502,15 +413,12 @@ struct _GArrowTimestampScalarClass GARROW_AVAILABLE_IN_5_0 GArrowTimestampScalar * -garrow_timestamp_scalar_new(GArrowTimestampDataType *data_type, - gint64 value); +garrow_timestamp_scalar_new(GArrowTimestampDataType *data_type, gint64 value); GARROW_AVAILABLE_IN_5_0 gint64 garrow_timestamp_scalar_get_value(GArrowTimestampScalar *scalar); - -#define GARROW_TYPE_MONTH_INTERVAL_SCALAR \ - (garrow_month_interval_scalar_get_type()) +#define GARROW_TYPE_MONTH_INTERVAL_SCALAR (garrow_month_interval_scalar_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowMonthIntervalScalar, garrow_month_interval_scalar, GARROW, @@ -528,9 +436,7 @@ GARROW_AVAILABLE_IN_8_0 gint32 garrow_month_interval_scalar_get_value(GArrowMonthIntervalScalar *scalar); - -#define GARROW_TYPE_DAY_TIME_INTERVAL_SCALAR \ - (garrow_day_time_interval_scalar_get_type()) +#define GARROW_TYPE_DAY_TIME_INTERVAL_SCALAR (garrow_day_time_interval_scalar_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDayTimeIntervalScalar, garrow_day_time_interval_scalar, GARROW, @@ -548,8 +454,7 @@ GARROW_AVAILABLE_IN_8_0 GArrowDayMillisecond * garrow_day_time_interval_scalar_get_value(GArrowDayTimeIntervalScalar *scalar); - -#define GARROW_TYPE_MONTH_DAY_NANO_INTERVAL_SCALAR \ +#define GARROW_TYPE_MONTH_DAY_NANO_INTERVAL_SCALAR \ (garrow_month_day_nano_interval_scalar_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowMonthDayNanoIntervalScalar, garrow_month_day_nano_interval_scalar, @@ -566,9 +471,7 @@ GArrowMonthDayNanoIntervalScalar * garrow_month_day_nano_interval_scalar_new(GArrowMonthDayNano *value); GARROW_AVAILABLE_IN_8_0 GArrowMonthDayNano * -garrow_month_day_nano_interval_scalar_get_value( - GArrowMonthDayNanoIntervalScalar *scalar); - +garrow_month_day_nano_interval_scalar_get_value(GArrowMonthDayNanoIntervalScalar *scalar); #define GARROW_TYPE_DECIMAL128_SCALAR (garrow_decimal128_scalar_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDecimal128Scalar, @@ -589,7 +492,6 @@ GARROW_AVAILABLE_IN_5_0 GArrowDecimal128 * garrow_decimal128_scalar_get_value(GArrowDecimal128Scalar *scalar); - #define GARROW_TYPE_DECIMAL256_SCALAR (garrow_decimal256_scalar_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDecimal256Scalar, garrow_decimal256_scalar, @@ -609,13 +511,9 @@ GARROW_AVAILABLE_IN_5_0 GArrowDecimal256 * garrow_decimal256_scalar_get_value(GArrowDecimal256Scalar *scalar); - #define GARROW_TYPE_BASE_LIST_SCALAR (garrow_base_list_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowBaseListScalar, - garrow_base_list_scalar, - GARROW, - BASE_LIST_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowBaseListScalar, garrow_base_list_scalar, GARROW, BASE_LIST_SCALAR, GArrowScalar) struct _GArrowBaseListScalarClass { GArrowScalarClass parent_class; @@ -626,11 +524,8 @@ GArrowArray * garrow_base_list_scalar_get_value(GArrowBaseListScalar *scalar); #define GARROW_TYPE_LIST_SCALAR (garrow_list_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowListScalar, - garrow_list_scalar, - GARROW, - LIST_SCALAR, - GArrowBaseListScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowListScalar, garrow_list_scalar, GARROW, LIST_SCALAR, GArrowBaseListScalar) struct _GArrowListScalarClass { GArrowBaseListScalarClass parent_class; @@ -640,7 +535,6 @@ GARROW_AVAILABLE_IN_5_0 GArrowListScalar * garrow_list_scalar_new(GArrowListArray *value); - #define GARROW_TYPE_LARGE_LIST_SCALAR (garrow_large_list_scalar_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowLargeListScalar, garrow_large_list_scalar, @@ -656,13 +550,9 @@ GARROW_AVAILABLE_IN_5_0 GArrowLargeListScalar * garrow_large_list_scalar_new(GArrowLargeListArray *value); - #define GARROW_TYPE_MAP_SCALAR (garrow_map_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowMapScalar, - garrow_map_scalar, - GARROW, - MAP_SCALAR, - GArrowBaseListScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowMapScalar, garrow_map_scalar, GARROW, MAP_SCALAR, GArrowBaseListScalar) struct _GArrowMapScalarClass { GArrowBaseListScalarClass parent_class; @@ -672,13 +562,9 @@ GARROW_AVAILABLE_IN_5_0 GArrowMapScalar * garrow_map_scalar_new(GArrowStructArray *value); - #define GARROW_TYPE_STRUCT_SCALAR (garrow_struct_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowStructScalar, - garrow_struct_scalar, - GARROW, - STRUCT_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowStructScalar, garrow_struct_scalar, GARROW, STRUCT_SCALAR, GArrowScalar) struct _GArrowStructScalarClass { GArrowScalarClass parent_class; @@ -686,19 +572,14 @@ struct _GArrowStructScalarClass GARROW_AVAILABLE_IN_5_0 GArrowStructScalar * -garrow_struct_scalar_new(GArrowStructDataType *data_type, - GList *value); +garrow_struct_scalar_new(GArrowStructDataType *data_type, GList *value); GARROW_AVAILABLE_IN_5_0 GList * garrow_struct_scalar_get_value(GArrowStructScalar *scalar); - #define GARROW_TYPE_UNION_SCALAR (garrow_union_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowUnionScalar, - garrow_union_scalar, - GARROW, - UNION_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowUnionScalar, garrow_union_scalar, GARROW, UNION_SCALAR, GArrowScalar) struct _GArrowUnionScalarClass { GArrowScalarClass parent_class; @@ -711,7 +592,6 @@ GARROW_AVAILABLE_IN_5_0 GArrowScalar * garrow_union_scalar_get_value(GArrowUnionScalar *scalar); - #define GARROW_TYPE_SPARSE_UNION_SCALAR (garrow_sparse_union_scalar_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowSparseUnionScalar, garrow_sparse_union_scalar, @@ -729,7 +609,6 @@ garrow_sparse_union_scalar_new(GArrowSparseUnionDataType *data_type, gint8 type_code, GArrowScalar *value); - #define GARROW_TYPE_DENSE_UNION_SCALAR (garrow_dense_union_scalar_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowDenseUnionScalar, garrow_dense_union_scalar, @@ -747,13 +626,9 @@ garrow_dense_union_scalar_new(GArrowDenseUnionDataType *data_type, gint8 type_code, GArrowScalar *value); - #define GARROW_TYPE_EXTENSION_SCALAR (garrow_extension_scalar_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowExtensionScalar, - garrow_extension_scalar, - GARROW, - EXTENSION_SCALAR, - GArrowScalar) +G_DECLARE_DERIVABLE_TYPE( + GArrowExtensionScalar, garrow_extension_scalar, GARROW, EXTENSION_SCALAR, GArrowScalar) struct _GArrowExtensionScalarClass { GArrowScalarClass parent_class; diff --git a/c_glib/arrow-glib/schema.cpp b/c_glib/arrow-glib/schema.cpp index 666e74e69f033..994753c322363 100644 --- a/c_glib/arrow-glib/schema.cpp +++ b/c_glib/arrow-glib/schema.cpp @@ -35,7 +35,8 @@ G_BEGIN_DECLS * table. It has zero or more #GArrowFields. */ -typedef struct GArrowSchemaPrivate_ { +typedef struct GArrowSchemaPrivate_ +{ std::shared_ptr schema; } GArrowSchemaPrivate; @@ -44,14 +45,11 @@ enum { PROP_SCHEMA }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowSchema, - garrow_schema, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowSchema, garrow_schema, G_TYPE_OBJECT) -#define GARROW_SCHEMA_GET_PRIVATE(obj) \ - static_cast( \ - garrow_schema_get_instance_private( \ - GARROW_SCHEMA(obj))) +#define GARROW_SCHEMA_GET_PRIVATE(obj) \ + static_cast( \ + garrow_schema_get_instance_private(GARROW_SCHEMA(obj))) static void garrow_schema_finalize(GObject *object) @@ -99,7 +97,7 @@ static void garrow_schema_init(GArrowSchema *object) { auto priv = GARROW_SCHEMA_GET_PRIVATE(object); - new(&priv->schema) std::shared_ptr; + new (&priv->schema) std::shared_ptr; } static void @@ -110,15 +108,15 @@ garrow_schema_class_init(GArrowSchemaClass *klass) gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_schema_finalize; + gobject_class->finalize = garrow_schema_finalize; gobject_class->set_property = garrow_schema_set_property; gobject_class->get_property = garrow_schema_get_property; - spec = g_param_spec_pointer("schema", - "Schema", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "schema", + "Schema", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_SCHEMA, spec); } @@ -234,8 +232,7 @@ garrow_schema_get_field(GArrowSchema *schema, guint i) * Returns: (transfer full): The found field or %NULL. */ GArrowField * -garrow_schema_get_field_by_name(GArrowSchema *schema, - const gchar *name) +garrow_schema_get_field_by_name(GArrowSchema *schema, const gchar *name) { const auto arrow_schema = garrow_schema_get_raw(schema); auto arrow_field = arrow_schema->GetFieldByName(std::string(name)); @@ -257,8 +254,7 @@ garrow_schema_get_field_by_name(GArrowSchema *schema, * Since: 0.15.0 */ gint -garrow_schema_get_field_index(GArrowSchema *schema, - const gchar *name) +garrow_schema_get_field_index(GArrowSchema *schema, const gchar *name) { const auto &arrow_schema = garrow_schema_get_raw(schema); return arrow_schema->GetFieldIndex(std::string(name)); @@ -344,10 +340,7 @@ garrow_schema_to_string_metadata(GArrowSchema *schema, gboolean show_metadata) * Since: 0.10.0 */ GArrowSchema * -garrow_schema_add_field(GArrowSchema *schema, - guint i, - GArrowField *field, - GError **error) +garrow_schema_add_field(GArrowSchema *schema, guint i, GArrowField *field, GError **error) { const auto arrow_schema = garrow_schema_get_raw(schema); const auto arrow_field = garrow_field_get_raw(field); @@ -371,9 +364,7 @@ garrow_schema_add_field(GArrowSchema *schema, * Since: 0.10.0 */ GArrowSchema * -garrow_schema_remove_field(GArrowSchema *schema, - guint i, - GError **error) +garrow_schema_remove_field(GArrowSchema *schema, guint i, GError **error) { const auto arrow_schema = garrow_schema_get_raw(schema); auto maybe_new_schema = arrow_schema->RemoveField(i); @@ -467,8 +458,7 @@ garrow_schema_get_metadata(GArrowSchema *schema) * Since: 0.17.0 */ GArrowSchema * -garrow_schema_with_metadata(GArrowSchema *schema, - GHashTable *metadata) +garrow_schema_with_metadata(GArrowSchema *schema, GHashTable *metadata) { const auto arrow_schema = garrow_schema_get_raw(schema); auto arrow_metadata = garrow_internal_hash_table_to_metadata(metadata); @@ -476,15 +466,13 @@ garrow_schema_with_metadata(GArrowSchema *schema, return garrow_schema_new_raw(&arrow_new_schema); } - G_END_DECLS GArrowSchema * garrow_schema_new_raw(std::shared_ptr *arrow_schema) { - auto schema = GARROW_SCHEMA(g_object_new(GARROW_TYPE_SCHEMA, - "schema", arrow_schema, - NULL)); + auto schema = + GARROW_SCHEMA(g_object_new(GARROW_TYPE_SCHEMA, "schema", arrow_schema, NULL)); return schema; } diff --git a/c_glib/arrow-glib/schema.h b/c_glib/arrow-glib/schema.h index 25519000bb0fa..93cd5bd542cf8 100644 --- a/c_glib/arrow-glib/schema.h +++ b/c_glib/arrow-glib/schema.h @@ -24,11 +24,7 @@ G_BEGIN_DECLS #define GARROW_TYPE_SCHEMA (garrow_schema_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowSchema, - garrow_schema, - GARROW, - SCHEMA, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowSchema, garrow_schema, GARROW, SCHEMA, GObject) struct _GArrowSchemaClass { GObjectClass parent_class; @@ -36,45 +32,48 @@ struct _GArrowSchemaClass GARROW_AVAILABLE_IN_6_0 GArrowSchema * -garrow_schema_import(gpointer c_abi_schema, - GError **error); +garrow_schema_import(gpointer c_abi_schema, GError **error); -GArrowSchema *garrow_schema_new (GList *fields); +GArrowSchema * +garrow_schema_new(GList *fields); GARROW_AVAILABLE_IN_6_0 gpointer -garrow_schema_export(GArrowSchema *schema, - GError **error); +garrow_schema_export(GArrowSchema *schema, GError **error); -gboolean garrow_schema_equal (GArrowSchema *schema, - GArrowSchema *other_schema); -GArrowField *garrow_schema_get_field (GArrowSchema *schema, - guint i); -GArrowField *garrow_schema_get_field_by_name(GArrowSchema *schema, - const gchar *name); +gboolean +garrow_schema_equal(GArrowSchema *schema, GArrowSchema *other_schema); +GArrowField * +garrow_schema_get_field(GArrowSchema *schema, guint i); +GArrowField * +garrow_schema_get_field_by_name(GArrowSchema *schema, const gchar *name); GARROW_AVAILABLE_IN_0_15 -gint garrow_schema_get_field_index (GArrowSchema *schema, - const gchar *name); +gint +garrow_schema_get_field_index(GArrowSchema *schema, const gchar *name); -guint garrow_schema_n_fields (GArrowSchema *schema); -GList *garrow_schema_get_fields (GArrowSchema *schema); +guint +garrow_schema_n_fields(GArrowSchema *schema); +GList * +garrow_schema_get_fields(GArrowSchema *schema); -gchar *garrow_schema_to_string(GArrowSchema *schema); +gchar * +garrow_schema_to_string(GArrowSchema *schema); GARROW_AVAILABLE_IN_0_17 -gchar *garrow_schema_to_string_metadata(GArrowSchema *schema, - gboolean show_metadata); +gchar * +garrow_schema_to_string_metadata(GArrowSchema *schema, gboolean show_metadata); -GArrowSchema *garrow_schema_add_field (GArrowSchema *schema, - guint i, - GArrowField *field, - GError **error); -GArrowSchema *garrow_schema_remove_field (GArrowSchema *schema, - guint i, - GError **error); -GArrowSchema *garrow_schema_replace_field (GArrowSchema *schema, - guint i, - GArrowField *field, - GError **error); +GArrowSchema * +garrow_schema_add_field(GArrowSchema *schema, + guint i, + GArrowField *field, + GError **error); +GArrowSchema * +garrow_schema_remove_field(GArrowSchema *schema, guint i, GError **error); +GArrowSchema * +garrow_schema_replace_field(GArrowSchema *schema, + guint i, + GArrowField *field, + GError **error); GARROW_AVAILABLE_IN_3_0 gboolean @@ -84,7 +83,6 @@ GHashTable * garrow_schema_get_metadata(GArrowSchema *schema); GARROW_AVAILABLE_IN_0_17 GArrowSchema * -garrow_schema_with_metadata(GArrowSchema *schema, - GHashTable *metadata); +garrow_schema_with_metadata(GArrowSchema *schema, GHashTable *metadata); G_END_DECLS diff --git a/c_glib/arrow-glib/schema.hpp b/c_glib/arrow-glib/schema.hpp index 0d025340844d3..333f73391c900 100644 --- a/c_glib/arrow-glib/schema.hpp +++ b/c_glib/arrow-glib/schema.hpp @@ -23,5 +23,7 @@ #include -GArrowSchema *garrow_schema_new_raw(std::shared_ptr *arrow_schema); -std::shared_ptr garrow_schema_get_raw(GArrowSchema *schema); +GArrowSchema * +garrow_schema_new_raw(std::shared_ptr *arrow_schema); +std::shared_ptr +garrow_schema_get_raw(GArrowSchema *schema); diff --git a/c_glib/arrow-glib/table-builder.cpp b/c_glib/arrow-glib/table-builder.cpp index 5b423f8e491a4..04b17e44c7083 100644 --- a/c_glib/arrow-glib/table-builder.cpp +++ b/c_glib/arrow-glib/table-builder.cpp @@ -35,7 +35,8 @@ G_BEGIN_DECLS * new #GArrowRecordBatch. */ -typedef struct GArrowRecordBatchBuilderPrivate_ { +typedef struct GArrowRecordBatchBuilderPrivate_ +{ arrow::RecordBatchBuilder *record_batch_builder; GPtrArray *column_builders; } GArrowRecordBatchBuilderPrivate; @@ -49,9 +50,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowRecordBatchBuilder, garrow_record_batch_builder, G_TYPE_OBJECT) -#define GARROW_RECORD_BATCH_BUILDER_GET_PRIVATE(object) \ - static_cast( \ - garrow_record_batch_builder_get_instance_private( \ +#define GARROW_RECORD_BATCH_BUILDER_GET_PRIVATE(object) \ + static_cast( \ + garrow_record_batch_builder_get_instance_private( \ GARROW_RECORD_BATCH_BUILDER(object))) static void @@ -123,20 +124,18 @@ garrow_record_batch_builder_class_init(GArrowRecordBatchBuilderClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->constructed = garrow_record_batch_builder_constructed; - gobject_class->finalize = garrow_record_batch_builder_finalize; + gobject_class->constructed = garrow_record_batch_builder_constructed; + gobject_class->finalize = garrow_record_batch_builder_finalize; gobject_class->set_property = garrow_record_batch_builder_set_property; gobject_class->get_property = garrow_record_batch_builder_get_property; GParamSpec *spec; - spec = g_param_spec_pointer("record-batch-builder", - "RecordBatch builder", - "The raw arrow::RecordBatchBuilder *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); - g_object_class_install_property(gobject_class, - PROP_RECORD_BATCH_BUILDER, - spec); + spec = g_param_spec_pointer( + "record-batch-builder", + "RecordBatch builder", + "The raw arrow::RecordBatchBuilder *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property(gobject_class, PROP_RECORD_BATCH_BUILDER, spec); } /** @@ -157,7 +156,8 @@ garrow_record_batch_builder_new(GArrowSchema *schema, GError **error) auto builder_result = arrow::RecordBatchBuilder::Make(arrow_schema, memory_pool); if (garrow::check(error, builder_result, "[record-batch-builder][new]")) { - std::unique_ptr arrow_builder = std::move(builder_result).ValueOrDie(); + std::unique_ptr arrow_builder = + std::move(builder_result).ValueOrDie(); return garrow_record_batch_builder_new_raw(arrow_builder.release()); } else { return NULL; @@ -257,8 +257,7 @@ garrow_record_batch_builder_get_n_columns(GArrowRecordBatchBuilder *builder) * Use garrow_record_batch_builder_get_column_builder() instead. */ GArrowArrayBuilder * -garrow_record_batch_builder_get_field(GArrowRecordBatchBuilder *builder, - gint i) +garrow_record_batch_builder_get_field(GArrowRecordBatchBuilder *builder, gint i) { return garrow_record_batch_builder_get_column_builder(builder, i); } @@ -275,8 +274,7 @@ garrow_record_batch_builder_get_field(GArrowRecordBatchBuilder *builder, * Since: 0.13.0 */ GArrowArrayBuilder * -garrow_record_batch_builder_get_column_builder(GArrowRecordBatchBuilder *builder, - gint i) +garrow_record_batch_builder_get_column_builder(GArrowRecordBatchBuilder *builder, gint i) { auto priv = GARROW_RECORD_BATCH_BUILDER_GET_PRIVATE(builder); if (i < 0) { @@ -303,8 +301,7 @@ garrow_record_batch_builder_get_column_builder(GArrowRecordBatchBuilder *builder * Since: 0.8.0 */ GArrowRecordBatch * -garrow_record_batch_builder_flush(GArrowRecordBatchBuilder *builder, - GError **error) +garrow_record_batch_builder_flush(GArrowRecordBatchBuilder *builder, GError **error) { auto arrow_builder = garrow_record_batch_builder_get_raw(builder); auto batch_result = arrow_builder->Flush(); @@ -323,7 +320,8 @@ GArrowRecordBatchBuilder * garrow_record_batch_builder_new_raw(arrow::RecordBatchBuilder *arrow_builder) { auto builder = g_object_new(GARROW_TYPE_RECORD_BATCH_BUILDER, - "record-batch-builder", arrow_builder, + "record-batch-builder", + arrow_builder, NULL); return GARROW_RECORD_BATCH_BUILDER(builder); } diff --git a/c_glib/arrow-glib/table-builder.h b/c_glib/arrow-glib/table-builder.h index a76793953c55d..fff58654b2a94 100644 --- a/c_glib/arrow-glib/table-builder.h +++ b/c_glib/arrow-glib/table-builder.h @@ -37,33 +37,35 @@ struct _GArrowRecordBatchBuilderClass GObjectClass parent_class; }; -GArrowRecordBatchBuilder *garrow_record_batch_builder_new(GArrowSchema *schema, - GError **error); +GArrowRecordBatchBuilder * +garrow_record_batch_builder_new(GArrowSchema *schema, GError **error); -gint64 garrow_record_batch_builder_get_initial_capacity(GArrowRecordBatchBuilder *builder); -void garrow_record_batch_builder_set_initial_capacity(GArrowRecordBatchBuilder *builder, - gint64 capacity); -GArrowSchema *garrow_record_batch_builder_get_schema(GArrowRecordBatchBuilder *builder); +gint64 +garrow_record_batch_builder_get_initial_capacity(GArrowRecordBatchBuilder *builder); +void +garrow_record_batch_builder_set_initial_capacity(GArrowRecordBatchBuilder *builder, + gint64 capacity); +GArrowSchema * +garrow_record_batch_builder_get_schema(GArrowRecordBatchBuilder *builder); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_13_FOR(garrow_record_batch_builder_get_n_columns) -gint garrow_record_batch_builder_get_n_fields(GArrowRecordBatchBuilder *builder); +gint +garrow_record_batch_builder_get_n_fields(GArrowRecordBatchBuilder *builder); #endif GARROW_AVAILABLE_IN_0_13 gint garrow_record_batch_builder_get_n_columns(GArrowRecordBatchBuilder *builder); #ifndef GARROW_DISABLE_DEPRECATED GARROW_DEPRECATED_IN_0_13_FOR(garrow_record_batch_builder_get_column_builder) -GArrowArrayBuilder *garrow_record_batch_builder_get_field(GArrowRecordBatchBuilder *builder, - gint i); +GArrowArrayBuilder * +garrow_record_batch_builder_get_field(GArrowRecordBatchBuilder *builder, gint i); #endif GARROW_AVAILABLE_IN_0_13 GArrowArrayBuilder * -garrow_record_batch_builder_get_column_builder(GArrowRecordBatchBuilder *builder, - gint i); - -GArrowRecordBatch *garrow_record_batch_builder_flush(GArrowRecordBatchBuilder *builder, - GError **error); +garrow_record_batch_builder_get_column_builder(GArrowRecordBatchBuilder *builder, gint i); +GArrowRecordBatch * +garrow_record_batch_builder_flush(GArrowRecordBatchBuilder *builder, GError **error); G_END_DECLS diff --git a/c_glib/arrow-glib/table-builder.hpp b/c_glib/arrow-glib/table-builder.hpp index cf93ded9b4b65..4f4e69b1472cb 100644 --- a/c_glib/arrow-glib/table-builder.hpp +++ b/c_glib/arrow-glib/table-builder.hpp @@ -23,5 +23,7 @@ #include -GArrowRecordBatchBuilder *garrow_record_batch_builder_new_raw(arrow::RecordBatchBuilder *arrow_builder); -arrow::RecordBatchBuilder *garrow_record_batch_builder_get_raw(GArrowRecordBatchBuilder *builder); +GArrowRecordBatchBuilder * +garrow_record_batch_builder_new_raw(arrow::RecordBatchBuilder *arrow_builder); +arrow::RecordBatchBuilder * +garrow_record_batch_builder_get_raw(GArrowRecordBatchBuilder *builder); diff --git a/c_glib/arrow-glib/table.cpp b/c_glib/arrow-glib/table.cpp index 5367f26732580..f8569366685a2 100644 --- a/c_glib/arrow-glib/table.cpp +++ b/c_glib/arrow-glib/table.cpp @@ -49,7 +49,8 @@ G_BEGIN_DECLS * Feather data. */ -typedef struct GArrowTableConcatenateOptionsPrivate_ { +typedef struct GArrowTableConcatenateOptionsPrivate_ +{ arrow::ConcatenateTablesOptions options; } GArrowTableConcatenateOptionsPrivate; @@ -62,9 +63,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowTableConcatenateOptions, garrow_table_concatenate_options, G_TYPE_OBJECT) -#define GARROW_TABLE_CONCATENATE_OPTIONS_GET_PRIVATE(obj) \ - static_cast( \ - garrow_table_concatenate_options_get_instance_private( \ +#define GARROW_TABLE_CONCATENATE_OPTIONS_GET_PRIVATE(obj) \ + static_cast( \ + garrow_table_concatenate_options_get_instance_private( \ GARROW_TABLE_CONCATENATE_OPTIONS(obj))) static void @@ -88,8 +89,7 @@ garrow_table_concatenate_options_set_property(GObject *object, priv->options.unify_schemas = g_value_get_boolean(value); break; case PROP_PROMOTE_NULLABILITY: - priv->options.field_merge_options.promote_nullability = - g_value_get_boolean(value); + priv->options.field_merge_options.promote_nullability = g_value_get_boolean(value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -110,8 +110,7 @@ garrow_table_concatenate_options_get_property(GObject *object, g_value_set_boolean(value, priv->options.unify_schemas); break; case PROP_PROMOTE_NULLABILITY: - g_value_set_boolean(value, - priv->options.field_merge_options.promote_nullability); + g_value_set_boolean(value, priv->options.field_merge_options.promote_nullability); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -123,15 +122,14 @@ static void garrow_table_concatenate_options_init(GArrowTableConcatenateOptions *object) { auto priv = GARROW_TABLE_CONCATENATE_OPTIONS_GET_PRIVATE(object); - new(&(priv->options)) arrow::ConcatenateTablesOptions; + new (&(priv->options)) arrow::ConcatenateTablesOptions; } static void -garrow_table_concatenate_options_class_init( - GArrowTableConcatenateOptionsClass *klass) +garrow_table_concatenate_options_class_init(GArrowTableConcatenateOptionsClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_table_concatenate_options_finalize; + gobject_class->finalize = garrow_table_concatenate_options_finalize; gobject_class->set_property = garrow_table_concatenate_options_set_property; gobject_class->get_property = garrow_table_concatenate_options_get_property; @@ -190,12 +188,11 @@ GArrowTableConcatenateOptions * garrow_table_concatenate_options_new(void) { return GARROW_TABLE_CONCATENATE_OPTIONS( - g_object_new(GARROW_TYPE_TABLE_CONCATENATE_OPTIONS, - NULL)); + g_object_new(GARROW_TYPE_TABLE_CONCATENATE_OPTIONS, NULL)); } - -typedef struct GArrowTablePrivate_ { +typedef struct GArrowTablePrivate_ +{ std::shared_ptr table; } GArrowTablePrivate; @@ -203,14 +200,10 @@ enum { PROP_TABLE = 1, }; -G_DEFINE_TYPE_WITH_PRIVATE(GArrowTable, - garrow_table, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GArrowTable, garrow_table, G_TYPE_OBJECT) -#define GARROW_TABLE_GET_PRIVATE(obj) \ - static_cast( \ - garrow_table_get_instance_private( \ - GARROW_TABLE(obj))) +#define GARROW_TABLE_GET_PRIVATE(obj) \ + static_cast(garrow_table_get_instance_private(GARROW_TABLE(obj))) static void garrow_table_finalize(GObject *object) @@ -258,7 +251,7 @@ static void garrow_table_init(GArrowTable *object) { auto priv = GARROW_TABLE_GET_PRIVATE(object); - new(&priv->table) std::shared_ptr; + new (&priv->table) std::shared_ptr; } static void @@ -269,15 +262,15 @@ garrow_table_class_init(GArrowTableClass *klass) gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_table_finalize; + gobject_class->finalize = garrow_table_finalize; gobject_class->set_property = garrow_table_set_property; gobject_class->get_property = garrow_table_get_property; - spec = g_param_spec_pointer("table", - "Table", - "The raw std::shared_ptr *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "table", + "Table", + "The raw std::shared_ptr *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_TABLE, spec); } @@ -294,9 +287,7 @@ garrow_table_class_init(GArrowTableClass *klass) * Since: 0.12.0 */ GArrowTable * -garrow_table_new_values(GArrowSchema *schema, - GList *values, - GError **error) +garrow_table_new_values(GArrowSchema *schema, GList *values, GError **error) { const auto context = "[table][new][values]"; auto arrow_schema = garrow_schema_get_raw(schema); @@ -347,8 +338,7 @@ garrow_table_new_values(GArrowSchema *schema, } if (!arrow_chunked_arrays.empty()) { - auto arrow_table = arrow::Table::Make(arrow_schema, - std::move(arrow_chunked_arrays)); + auto arrow_table = arrow::Table::Make(arrow_schema, std::move(arrow_chunked_arrays)); auto status = arrow_table->Validate(); if (garrow_error_check(error, status, context)) { return garrow_table_new_raw(&arrow_table); @@ -364,8 +354,8 @@ garrow_table_new_values(GArrowSchema *schema, return NULL; } } else { - auto maybe_table = arrow::Table::FromRecordBatches( - arrow_schema, std::move(arrow_record_batches)); + auto maybe_table = + arrow::Table::FromRecordBatches(arrow_schema, std::move(arrow_record_batches)); if (garrow::check(error, maybe_table, context)) { return garrow_table_new_raw(&(*maybe_table)); } else { @@ -465,8 +455,7 @@ garrow_table_new_record_batches(GArrowSchema *schema, arrow_record_batches.push_back(arrow_record_batch); } - auto maybe_table = arrow::Table::FromRecordBatches(arrow_schema, - arrow_record_batches); + auto maybe_table = arrow::Table::FromRecordBatches(arrow_schema, arrow_record_batches); if (garrow::check(error, maybe_table, "[table][new][record-batches]")) { return garrow_table_new_raw(&(*maybe_table)); } else { @@ -539,8 +528,7 @@ garrow_table_get_schema(GArrowTable *table) * Since: 0.15.0 */ GArrowChunkedArray * -garrow_table_get_column_data(GArrowTable *table, - gint i) +garrow_table_get_column_data(GArrowTable *table, gint i) { const auto &arrow_table = garrow_table_get_raw(table); if (!garrow_internal_index_adjust(i, arrow_table->num_columns())) { @@ -599,9 +587,7 @@ garrow_table_add_column(GArrowTable *table, const auto arrow_table = garrow_table_get_raw(table); const auto arrow_field = garrow_field_get_raw(field); const auto arrow_chunked_array = garrow_chunked_array_get_raw(chunked_array); - auto maybe_new_table = arrow_table->AddColumn(i, - arrow_field, - arrow_chunked_array); + auto maybe_new_table = arrow_table->AddColumn(i, arrow_field, arrow_chunked_array); if (garrow::check(error, maybe_new_table, "[table][add-column]")) { return garrow_table_new_raw(&(*maybe_new_table)); } else { @@ -621,9 +607,7 @@ garrow_table_add_column(GArrowTable *table, * Since: 0.3.0 */ GArrowTable * -garrow_table_remove_column(GArrowTable *table, - guint i, - GError **error) +garrow_table_remove_column(GArrowTable *table, guint i, GError **error) { const auto arrow_table = garrow_table_get_raw(table); auto maybe_new_table = arrow_table->RemoveColumn(i); @@ -658,9 +642,7 @@ garrow_table_replace_column(GArrowTable *table, const auto arrow_table = garrow_table_get_raw(table); const auto arrow_field = garrow_field_get_raw(field); const auto arrow_chunked_array = garrow_chunked_array_get_raw(chunked_array); - auto maybe_new_table = arrow_table->SetColumn(i, - arrow_field, - arrow_chunked_array); + auto maybe_new_table = arrow_table->SetColumn(i, arrow_field, arrow_chunked_array); if (garrow::check(error, maybe_new_table, "[table][replace-column]")) { return garrow_table_new_raw(&(*maybe_new_table)); } else { @@ -706,7 +688,7 @@ garrow_table_concatenate(GArrowTable *table, GError **error) { auto arrow_table = garrow_table_get_raw(table); - std::vector> arrow_tables = { arrow_table }; + std::vector> arrow_tables = {arrow_table}; for (auto node = other_tables; node; node = g_list_next(node)) { auto arrow_other_table = garrow_table_get_raw(GARROW_TABLE(node->data)); arrow_tables.push_back(arrow_other_table); @@ -718,9 +700,7 @@ garrow_table_concatenate(GArrowTable *table, } auto arrow_concatenated_table_result = arrow::ConcatenateTables(arrow_tables, arrow_options); - if (garrow::check(error, - arrow_concatenated_table_result, - "[table][concatenate]")) { + if (garrow::check(error, arrow_concatenated_table_result, "[table][concatenate]")) { auto arrow_concatenated_table = std::move(*arrow_concatenated_table_result); return garrow_table_new_raw(&arrow_concatenated_table); } else { @@ -743,9 +723,7 @@ garrow_table_concatenate(GArrowTable *table, * Since: 0.14.0 */ GArrowTable * -garrow_table_slice(GArrowTable *table, - gint64 offset, - gint64 length) +garrow_table_slice(GArrowTable *table, gint64 offset, gint64 length) { const auto arrow_table = garrow_table_get_raw(table); if (offset < 0) { @@ -766,8 +744,7 @@ garrow_table_slice(GArrowTable *table, * Since: 0.16.0 */ GArrowTable * -garrow_table_combine_chunks(GArrowTable *table, - GError **error) +garrow_table_combine_chunks(GArrowTable *table, GError **error) { const auto arrow_table = garrow_table_get_raw(table); @@ -779,8 +756,8 @@ garrow_table_combine_chunks(GArrowTable *table, } } - -typedef struct GArrowFeatherWritePropertiesPrivate_ { +typedef struct GArrowFeatherWritePropertiesPrivate_ +{ arrow::ipc::feather::WriteProperties properties; } GArrowFeatherWritePropertiesPrivate; @@ -795,9 +772,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowFeatherWriteProperties, garrow_feather_write_properties, G_TYPE_OBJECT) -#define GARROW_FEATHER_WRITE_PROPERTIES_GET_PRIVATE(obj) \ - static_cast( \ - garrow_feather_write_properties_get_instance_private( \ +#define GARROW_FEATHER_WRITE_PROPERTIES_GET_PRIVATE(obj) \ + static_cast( \ + garrow_feather_write_properties_get_instance_private( \ GARROW_FEATHER_WRITE_PROPERTIES(obj))) static void @@ -851,7 +828,7 @@ static void garrow_feather_write_properties_init(GArrowFeatherWriteProperties *object) { auto priv = GARROW_FEATHER_WRITE_PROPERTIES_GET_PRIVATE(object); - new(&priv->properties) arrow::ipc::feather::WriteProperties; + new (&priv->properties) arrow::ipc::feather::WriteProperties; priv->properties = arrow::ipc::feather::WriteProperties::Defaults(); } @@ -931,9 +908,8 @@ garrow_table_write_as_feather(GArrowTable *table, arrow::Status status; if (properties) { auto arrow_properties = garrow_feather_write_properties_get_raw(properties); - status = arrow::ipc::feather::WriteTable(*arrow_table, - arrow_sink.get(), - *arrow_properties); + status = + arrow::ipc::feather::WriteTable(*arrow_table, arrow_sink.get(), *arrow_properties); } else { status = arrow::ipc::feather::WriteTable(*arrow_table, arrow_sink.get()); } @@ -945,9 +921,7 @@ G_END_DECLS GArrowTable * garrow_table_new_raw(std::shared_ptr *arrow_table) { - auto table = GARROW_TABLE(g_object_new(GARROW_TYPE_TABLE, - "table", arrow_table, - NULL)); + auto table = GARROW_TABLE(g_object_new(GARROW_TYPE_TABLE, "table", arrow_table, NULL)); return table; } diff --git a/c_glib/arrow-glib/table.h b/c_glib/arrow-glib/table.h index 05a95e91ac4e1..1bf64d25a4f3f 100644 --- a/c_glib/arrow-glib/table.h +++ b/c_glib/arrow-glib/table.h @@ -27,7 +27,7 @@ G_BEGIN_DECLS -#define GARROW_TYPE_TABLE_CONCATENATE_OPTIONS \ +#define GARROW_TYPE_TABLE_CONCATENATE_OPTIONS \ (garrow_table_concatenate_options_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowTableConcatenateOptions, garrow_table_concatenate_options, @@ -43,13 +43,8 @@ GARROW_AVAILABLE_IN_6_0 GArrowTableConcatenateOptions * garrow_table_concatenate_options_new(void); - #define GARROW_TYPE_TABLE (garrow_table_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowTable, - garrow_table, - GARROW, - TABLE, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowTable, garrow_table, GARROW, TABLE, GObject) struct _GArrowTableClass { GObjectClass parent_class; @@ -57,9 +52,7 @@ struct _GArrowTableClass GARROW_AVAILABLE_IN_0_12 GArrowTable * -garrow_table_new_values(GArrowSchema *schema, - GList *values, - GError **error); +garrow_table_new_values(GArrowSchema *schema, GList *values, GError **error); GARROW_AVAILABLE_IN_0_15 GArrowTable * garrow_table_new_chunked_arrays(GArrowSchema *schema, @@ -79,40 +72,43 @@ garrow_table_new_record_batches(GArrowSchema *schema, gsize n_record_batches, GError **error); -gboolean garrow_table_equal (GArrowTable *table, - GArrowTable *other_table); +gboolean +garrow_table_equal(GArrowTable *table, GArrowTable *other_table); GARROW_AVAILABLE_IN_0_17 gboolean garrow_table_equal_metadata(GArrowTable *table, GArrowTable *other_table, gboolean check_metadata); -GArrowSchema *garrow_table_get_schema (GArrowTable *table); +GArrowSchema * +garrow_table_get_schema(GArrowTable *table); GARROW_AVAILABLE_IN_0_15 GArrowChunkedArray * -garrow_table_get_column_data(GArrowTable *table, - gint i); +garrow_table_get_column_data(GArrowTable *table, gint i); -guint garrow_table_get_n_columns (GArrowTable *table); -guint64 garrow_table_get_n_rows (GArrowTable *table); +guint +garrow_table_get_n_columns(GArrowTable *table); +guint64 +garrow_table_get_n_rows(GArrowTable *table); GARROW_AVAILABLE_IN_0_15 -GArrowTable *garrow_table_add_column (GArrowTable *table, - guint i, - GArrowField *field, - GArrowChunkedArray *chunked_array, - GError **error); -GArrowTable *garrow_table_remove_column (GArrowTable *table, - guint i, - GError **error); +GArrowTable * +garrow_table_add_column(GArrowTable *table, + guint i, + GArrowField *field, + GArrowChunkedArray *chunked_array, + GError **error); +GArrowTable * +garrow_table_remove_column(GArrowTable *table, guint i, GError **error); GARROW_AVAILABLE_IN_0_15 -GArrowTable *garrow_table_replace_column(GArrowTable *table, - guint i, - GArrowField *field, - GArrowChunkedArray *chunked_array, - GError **error); -gchar *garrow_table_to_string (GArrowTable *table, - GError **error); +GArrowTable * +garrow_table_replace_column(GArrowTable *table, + guint i, + GArrowField *field, + GArrowChunkedArray *chunked_array, + GError **error); +gchar * +garrow_table_to_string(GArrowTable *table, GError **error); GARROW_AVAILABLE_IN_0_14 GArrowTable * garrow_table_concatenate(GArrowTable *table, @@ -121,17 +117,12 @@ garrow_table_concatenate(GArrowTable *table, GError **error); GARROW_AVAILABLE_IN_0_14 GArrowTable * -garrow_table_slice(GArrowTable *table, - gint64 offset, - gint64 length); +garrow_table_slice(GArrowTable *table, gint64 offset, gint64 length); GARROW_AVAILABLE_IN_0_16 GArrowTable * -garrow_table_combine_chunks(GArrowTable *table, - GError **error); - +garrow_table_combine_chunks(GArrowTable *table, GError **error); -#define GARROW_TYPE_FEATHER_WRITE_PROPERTIES \ - (garrow_feather_write_properties_get_type()) +#define GARROW_TYPE_FEATHER_WRITE_PROPERTIES (garrow_feather_write_properties_get_type()) G_DECLARE_DERIVABLE_TYPE(GArrowFeatherWriteProperties, garrow_feather_write_properties, GARROW, diff --git a/c_glib/arrow-glib/table.hpp b/c_glib/arrow-glib/table.hpp index dc972d80cff73..3077c2ece9b37 100644 --- a/c_glib/arrow-glib/table.hpp +++ b/c_glib/arrow-glib/table.hpp @@ -24,8 +24,10 @@ #include -GArrowTable *garrow_table_new_raw(std::shared_ptr *arrow_table); -std::shared_ptr garrow_table_get_raw(GArrowTable *table); +GArrowTable * +garrow_table_new_raw(std::shared_ptr *arrow_table); +std::shared_ptr +garrow_table_get_raw(GArrowTable *table); arrow::ipc::feather::WriteProperties * garrow_feather_write_properties_get_raw(GArrowFeatherWriteProperties *properties); diff --git a/c_glib/arrow-glib/tensor.cpp b/c_glib/arrow-glib/tensor.cpp index ddbf1189b9123..0cee235de3728 100644 --- a/c_glib/arrow-glib/tensor.cpp +++ b/c_glib/arrow-glib/tensor.cpp @@ -34,7 +34,8 @@ G_BEGIN_DECLS * Since: 0.3.0 */ -typedef struct GArrowTensorPrivate_ { +typedef struct GArrowTensorPrivate_ +{ std::shared_ptr tensor; GArrowBuffer *buffer; } GArrowTensorPrivate; @@ -47,10 +48,9 @@ enum { G_DEFINE_TYPE_WITH_PRIVATE(GArrowTensor, garrow_tensor, G_TYPE_OBJECT) -#define GARROW_TENSOR_GET_PRIVATE(obj) \ - static_cast( \ - garrow_tensor_get_instance_private( \ - GARROW_TENSOR(obj))) +#define GARROW_TENSOR_GET_PRIVATE(obj) \ + static_cast( \ + garrow_tensor_get_instance_private(GARROW_TENSOR(obj))) static void garrow_tensor_dispose(GObject *object) @@ -119,7 +119,7 @@ static void garrow_tensor_init(GArrowTensor *object) { auto priv = GARROW_TENSOR_GET_PRIVATE(object); - new(&priv->tensor) std::shared_ptr; + new (&priv->tensor) std::shared_ptr; } static void @@ -129,24 +129,24 @@ garrow_tensor_class_init(GArrowTensorClass *klass) auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = garrow_tensor_dispose; - gobject_class->finalize = garrow_tensor_finalize; + gobject_class->dispose = garrow_tensor_dispose; + gobject_class->finalize = garrow_tensor_finalize; gobject_class->set_property = garrow_tensor_set_property; gobject_class->get_property = garrow_tensor_get_property; - spec = g_param_spec_pointer("tensor", - "Tensor", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "tensor", + "Tensor", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_TENSOR, spec); - spec = g_param_spec_object("buffer", - "Buffer", - "The data", - GARROW_TYPE_BUFFER, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "buffer", + "Buffer", + "The data", + GARROW_TYPE_BUFFER, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_BUFFER, spec); } @@ -192,12 +192,11 @@ garrow_tensor_new(GArrowDataType *data_type, for (gsize i = 0; i < n_dimension_names; ++i) { arrow_dimension_names.push_back(dimension_names[i]); } - auto arrow_tensor = - std::make_shared(arrow_data_type, - arrow_data, - arrow_shape, - arrow_strides, - arrow_dimension_names); + auto arrow_tensor = std::make_shared(arrow_data_type, + arrow_data, + arrow_shape, + arrow_strides, + arrow_dimension_names); auto tensor = garrow_tensor_new_raw_buffer(&arrow_tensor, data); return tensor; } @@ -292,8 +291,7 @@ garrow_tensor_get_shape(GArrowTensor *tensor, gint *n_dimensions) auto arrow_tensor = garrow_tensor_get_raw(tensor); auto arrow_shape = arrow_tensor->shape(); auto n_dimensions_raw = arrow_shape.size(); - auto shape = - static_cast(g_malloc_n(sizeof(gint64), n_dimensions_raw)); + auto shape = static_cast(g_malloc_n(sizeof(gint64), n_dimensions_raw)); for (gsize i = 0; i < n_dimensions_raw; ++i) { shape[i] = arrow_shape[i]; } @@ -319,8 +317,7 @@ garrow_tensor_get_strides(GArrowTensor *tensor, gint *n_strides) auto arrow_tensor = garrow_tensor_get_raw(tensor); auto arrow_strides = arrow_tensor->strides(); auto n_strides_raw = arrow_strides.size(); - auto strides = - static_cast(g_malloc_n(sizeof(gint64), n_strides_raw)); + auto strides = static_cast(g_malloc_n(sizeof(gint64), n_strides_raw)); for (gsize i = 0; i < n_strides_raw; ++i) { strides[i] = arrow_strides[i]; } @@ -449,10 +446,8 @@ GArrowTensor * garrow_tensor_new_raw_buffer(std::shared_ptr *arrow_tensor, GArrowBuffer *buffer) { - auto tensor = GARROW_TENSOR(g_object_new(GARROW_TYPE_TENSOR, - "tensor", arrow_tensor, - "buffer", buffer, - NULL)); + auto tensor = GARROW_TENSOR( + g_object_new(GARROW_TYPE_TENSOR, "tensor", arrow_tensor, "buffer", buffer, NULL)); return tensor; } diff --git a/c_glib/arrow-glib/tensor.h b/c_glib/arrow-glib/tensor.h index daa3a89054125..a6d11b248110e 100644 --- a/c_glib/arrow-glib/tensor.h +++ b/c_glib/arrow-glib/tensor.h @@ -25,40 +25,46 @@ G_BEGIN_DECLS #define GARROW_TYPE_TENSOR (garrow_tensor_get_type()) -G_DECLARE_DERIVABLE_TYPE(GArrowTensor, - garrow_tensor, - GARROW, - TENSOR, - GObject) +G_DECLARE_DERIVABLE_TYPE(GArrowTensor, garrow_tensor, GARROW, TENSOR, GObject) struct _GArrowTensorClass { GObjectClass parent_class; }; -GArrowTensor *garrow_tensor_new (GArrowDataType *data_type, - GArrowBuffer *data, - gint64 *shape, - gsize n_dimensions, - gint64 *strides, - gsize n_strides, - gchar **dimension_names, - gsize n_dimension_names); -gboolean garrow_tensor_equal (GArrowTensor *tensor, - GArrowTensor *other_tensor); -GArrowDataType *garrow_tensor_get_value_data_type(GArrowTensor *tensor); -GArrowType garrow_tensor_get_value_type (GArrowTensor *tensor); -GArrowBuffer *garrow_tensor_get_buffer (GArrowTensor *tensor); -gint64 *garrow_tensor_get_shape (GArrowTensor *tensor, - gint *n_dimensions); -gint64 *garrow_tensor_get_strides (GArrowTensor *tensor, - gint *n_strides); -gint garrow_tensor_get_n_dimensions (GArrowTensor *tensor); -const gchar *garrow_tensor_get_dimension_name (GArrowTensor *tensor, - gint i); -gint64 garrow_tensor_get_size (GArrowTensor *tensor); -gboolean garrow_tensor_is_mutable (GArrowTensor *tensor); -gboolean garrow_tensor_is_contiguous (GArrowTensor *tensor); -gboolean garrow_tensor_is_row_major (GArrowTensor *tensor); -gboolean garrow_tensor_is_column_major (GArrowTensor *tensor); +GArrowTensor * +garrow_tensor_new(GArrowDataType *data_type, + GArrowBuffer *data, + gint64 *shape, + gsize n_dimensions, + gint64 *strides, + gsize n_strides, + gchar **dimension_names, + gsize n_dimension_names); +gboolean +garrow_tensor_equal(GArrowTensor *tensor, GArrowTensor *other_tensor); +GArrowDataType * +garrow_tensor_get_value_data_type(GArrowTensor *tensor); +GArrowType +garrow_tensor_get_value_type(GArrowTensor *tensor); +GArrowBuffer * +garrow_tensor_get_buffer(GArrowTensor *tensor); +gint64 * +garrow_tensor_get_shape(GArrowTensor *tensor, gint *n_dimensions); +gint64 * +garrow_tensor_get_strides(GArrowTensor *tensor, gint *n_strides); +gint +garrow_tensor_get_n_dimensions(GArrowTensor *tensor); +const gchar * +garrow_tensor_get_dimension_name(GArrowTensor *tensor, gint i); +gint64 +garrow_tensor_get_size(GArrowTensor *tensor); +gboolean +garrow_tensor_is_mutable(GArrowTensor *tensor); +gboolean +garrow_tensor_is_contiguous(GArrowTensor *tensor); +gboolean +garrow_tensor_is_row_major(GArrowTensor *tensor); +gboolean +garrow_tensor_is_column_major(GArrowTensor *tensor); G_END_DECLS diff --git a/c_glib/arrow-glib/tensor.hpp b/c_glib/arrow-glib/tensor.hpp index c90dc6d4d970f..a4395c64db800 100644 --- a/c_glib/arrow-glib/tensor.hpp +++ b/c_glib/arrow-glib/tensor.hpp @@ -23,7 +23,10 @@ #include -GArrowTensor *garrow_tensor_new_raw(std::shared_ptr *arrow_tensor); -GArrowTensor *garrow_tensor_new_raw_buffer(std::shared_ptr *arrow_tensor, - GArrowBuffer *buffer); -std::shared_ptr garrow_tensor_get_raw(GArrowTensor *tensor); +GArrowTensor * +garrow_tensor_new_raw(std::shared_ptr *arrow_tensor); +GArrowTensor * +garrow_tensor_new_raw_buffer(std::shared_ptr *arrow_tensor, + GArrowBuffer *buffer); +std::shared_ptr +garrow_tensor_get_raw(GArrowTensor *tensor); diff --git a/c_glib/arrow-glib/type.h b/c_glib/arrow-glib/type.h index f513c7a36a0dc..6f33ad64ef55c 100644 --- a/c_glib/arrow-glib/type.h +++ b/c_glib/arrow-glib/type.h @@ -65,7 +65,8 @@ G_BEGIN_DECLS * @GARROW_TYPE_DURATION: Measure of elapsed time in either seconds, * milliseconds, microseconds or nanoseconds. * @GARROW_TYPE_LARGE_STRING: 64bit offsets UTF-8 variable-length string. - * @GARROW_TYPE_LARGE_BINARY: 64bit offsets Variable-length bytes (no guarantee of UTF-8-ness). + * @GARROW_TYPE_LARGE_BINARY: 64bit offsets Variable-length bytes (no guarantee of + * UTF-8-ness). * @GARROW_TYPE_LARGE_LIST: A list of some logical data type with 64-bit offsets. * @GARROW_TYPE_MONTH_DAY_NANO_INTERVAL: MONTH_DAY_NANO interval in SQL style. * @GARROW_TYPE_RUN_END_ENCODED: Run-end encoded data. diff --git a/c_glib/arrow-glib/type.hpp b/c_glib/arrow-glib/type.hpp index 097097530bbfe..9ae815dda15b6 100644 --- a/c_glib/arrow-glib/type.hpp +++ b/c_glib/arrow-glib/type.hpp @@ -23,7 +23,11 @@ #include -GArrowType garrow_type_from_raw(arrow::Type::type type); -GArrowTimeUnit garrow_time_unit_from_raw(arrow::TimeUnit::type unit); -arrow::TimeUnit::type garrow_time_unit_to_raw(GArrowTimeUnit unit); -GArrowIntervalType garrow_interval_type_from_raw(arrow::IntervalType::type type); +GArrowType +garrow_type_from_raw(arrow::Type::type type); +GArrowTimeUnit +garrow_time_unit_from_raw(arrow::TimeUnit::type unit); +arrow::TimeUnit::type +garrow_time_unit_to_raw(GArrowTimeUnit unit); +GArrowIntervalType +garrow_interval_type_from_raw(arrow::IntervalType::type type); diff --git a/c_glib/arrow-glib/writable-file.cpp b/c_glib/arrow-glib/writable-file.cpp index 74850ec2089b1..85ddea9ac2f93 100644 --- a/c_glib/arrow-glib/writable-file.cpp +++ b/c_glib/arrow-glib/writable-file.cpp @@ -32,9 +32,7 @@ G_BEGIN_DECLS * #GArrowWritableFile is an interface for file output. */ -G_DEFINE_INTERFACE(GArrowWritableFile, - garrow_writable_file, - G_TYPE_OBJECT) +G_DEFINE_INTERFACE(GArrowWritableFile, garrow_writable_file, G_TYPE_OBJECT) static void garrow_writable_file_default_init(GArrowWritableFileInterface *iface) @@ -58,8 +56,7 @@ garrow_writable_file_write_at(GArrowWritableFile *writable_file, gint64 n_bytes, GError **error) { - const auto arrow_writable_file = - garrow_writable_file_get_raw(writable_file); + const auto arrow_writable_file = garrow_writable_file_get_raw(writable_file); auto status = arrow_writable_file->WriteAt(position, data, n_bytes); return garrow_error_check(error, status, "[io][writable-file][write-at]"); diff --git a/c_glib/arrow-glib/writable-file.h b/c_glib/arrow-glib/writable-file.h index 78359f6afa951..cf17b7f6ad03a 100644 --- a/c_glib/arrow-glib/writable-file.h +++ b/c_glib/arrow-glib/writable-file.h @@ -24,16 +24,14 @@ G_BEGIN_DECLS #define GARROW_TYPE_WRITABLE_FILE (garrow_writable_file_get_type()) -G_DECLARE_INTERFACE(GArrowWritableFile, - garrow_writable_file, - GARROW, - WRITABLE_FILE, - GObject) +G_DECLARE_INTERFACE( + GArrowWritableFile, garrow_writable_file, GARROW, WRITABLE_FILE, GObject) -gboolean garrow_writable_file_write_at(GArrowWritableFile *writable_file, - gint64 position, - const guint8 *data, - gint64 n_bytes, - GError **error); +gboolean +garrow_writable_file_write_at(GArrowWritableFile *writable_file, + gint64 position, + const guint8 *data, + gint64 n_bytes, + GError **error); G_END_DECLS diff --git a/c_glib/arrow-glib/writable.cpp b/c_glib/arrow-glib/writable.cpp index 47c1f3303b72e..0a61ba72823f2 100644 --- a/c_glib/arrow-glib/writable.cpp +++ b/c_glib/arrow-glib/writable.cpp @@ -33,9 +33,7 @@ G_BEGIN_DECLS * writable. */ -G_DEFINE_INTERFACE(GArrowWritable, - garrow_writable, - G_TYPE_OBJECT) +G_DEFINE_INTERFACE(GArrowWritable, garrow_writable, G_TYPE_OBJECT) static void garrow_writable_default_init(GArrowWritableInterface *iface) @@ -73,8 +71,7 @@ garrow_writable_write(GArrowWritable *writable, * Returns: %TRUE on success, %FALSE if there was an error. */ gboolean -garrow_writable_flush(GArrowWritable *writable, - GError **error) +garrow_writable_flush(GArrowWritable *writable, GError **error) { const auto arrow_writable = garrow_writable_get_raw(writable); diff --git a/c_glib/arrow-glib/writable.h b/c_glib/arrow-glib/writable.h index 151e85d98af23..6e550deb32003 100644 --- a/c_glib/arrow-glib/writable.h +++ b/c_glib/arrow-glib/writable.h @@ -24,17 +24,14 @@ G_BEGIN_DECLS #define GARROW_TYPE_WRITABLE (garrow_writable_get_type()) -G_DECLARE_INTERFACE(GArrowWritable, - garrow_writable, - GARROW, - WRITABLE, - GObject) +G_DECLARE_INTERFACE(GArrowWritable, garrow_writable, GARROW, WRITABLE, GObject) -gboolean garrow_writable_write(GArrowWritable *writable, - const guint8 *data, - gint64 n_bytes, - GError **error); -gboolean garrow_writable_flush(GArrowWritable *writable, - GError **error); +gboolean +garrow_writable_write(GArrowWritable *writable, + const guint8 *data, + gint64 n_bytes, + GError **error); +gboolean +garrow_writable_flush(GArrowWritable *writable, GError **error); G_END_DECLS diff --git a/c_glib/arrow-glib/writer.cpp b/c_glib/arrow-glib/writer.cpp index 3808150179af2..b0321d51b3ba4 100644 --- a/c_glib/arrow-glib/writer.cpp +++ b/c_glib/arrow-glib/writer.cpp @@ -45,7 +45,8 @@ G_BEGIN_DECLS * batches in file format into output. */ -typedef struct GArrowRecordBatchWriterPrivate_ { +typedef struct GArrowRecordBatchWriterPrivate_ +{ std::shared_ptr record_batch_writer; } GArrowRecordBatchWriterPrivate; @@ -58,10 +59,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GArrowRecordBatchWriter, garrow_record_batch_writer, G_TYPE_OBJECT); -#define GARROW_RECORD_BATCH_WRITER_GET_PRIVATE(obj) \ - static_cast( \ - garrow_record_batch_writer_get_instance_private( \ - GARROW_RECORD_BATCH_WRITER(obj))) +#define GARROW_RECORD_BATCH_WRITER_GET_PRIVATE(obj) \ + static_cast( \ + garrow_record_batch_writer_get_instance_private(GARROW_RECORD_BATCH_WRITER(obj))) static void garrow_record_batch_writer_finalize(GObject *object) @@ -84,7 +84,8 @@ garrow_record_batch_writer_set_property(GObject *object, switch (prop_id) { case PROP_RECORD_BATCH_WRITER: priv->record_batch_writer = - *static_cast *>(g_value_get_pointer(value)); + *static_cast *>( + g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -109,7 +110,7 @@ static void garrow_record_batch_writer_init(GArrowRecordBatchWriter *object) { auto priv = GARROW_RECORD_BATCH_WRITER_GET_PRIVATE(object); - new(&priv->record_batch_writer) std::shared_ptr; + new (&priv->record_batch_writer) std::shared_ptr; } static void @@ -120,15 +121,15 @@ garrow_record_batch_writer_class_init(GArrowRecordBatchWriterClass *klass) gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = garrow_record_batch_writer_finalize; + gobject_class->finalize = garrow_record_batch_writer_finalize; gobject_class->set_property = garrow_record_batch_writer_set_property; gobject_class->get_property = garrow_record_batch_writer_get_property; - spec = g_param_spec_pointer("record-batch-writer", - "arrow::ipc::RecordBatchWriter", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "record-batch-writer", + "arrow::ipc::RecordBatchWriter", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_RECORD_BATCH_WRITER, spec); } @@ -152,9 +153,7 @@ garrow_record_batch_writer_write_record_batch(GArrowRecordBatchWriter *writer, auto arrow_record_batch_raw = arrow_record_batch.get(); auto status = arrow_writer->WriteRecordBatch(*arrow_record_batch_raw); - return garrow_error_check(error, - status, - "[record-batch-writer][write-record-batch]"); + return garrow_error_check(error, status, "[record-batch-writer][write-record-batch]"); } /** @@ -176,9 +175,7 @@ garrow_record_batch_writer_write_table(GArrowRecordBatchWriter *writer, auto arrow_table = garrow_table_get_raw(table); auto status = arrow_writer->WriteTable(*arrow_table); - return garrow_error_check(error, - status, - "[record-batch-writer][write-table]"); + return garrow_error_check(error, status, "[record-batch-writer][write-table]"); } /** @@ -191,8 +188,7 @@ garrow_record_batch_writer_write_table(GArrowRecordBatchWriter *writer, * Since: 0.4.0 */ gboolean -garrow_record_batch_writer_close(GArrowRecordBatchWriter *writer, - GError **error) +garrow_record_batch_writer_close(GArrowRecordBatchWriter *writer, GError **error) { auto arrow_writer = garrow_record_batch_writer_get_raw(writer); @@ -200,7 +196,6 @@ garrow_record_batch_writer_close(GArrowRecordBatchWriter *writer, return garrow_error_check(error, status, "[record-batch-writer][close]"); } - G_DEFINE_TYPE(GArrowRecordBatchStreamWriter, garrow_record_batch_stream_writer, GARROW_TYPE_RECORD_BATCH_WRITER); @@ -233,11 +228,8 @@ garrow_record_batch_stream_writer_new(GArrowOutputStream *sink, { auto arrow_sink = garrow_output_stream_get_raw(sink); auto arrow_schema = garrow_schema_get_raw(schema); - auto arrow_writer_result = - arrow::ipc::MakeStreamWriter(arrow_sink, arrow_schema); - if (garrow::check(error, - arrow_writer_result, - "[record-batch-stream-writer][open]")) { + auto arrow_writer_result = arrow::ipc::MakeStreamWriter(arrow_sink, arrow_schema); + if (garrow::check(error, arrow_writer_result, "[record-batch-stream-writer][open]")) { auto arrow_writer = *arrow_writer_result; return garrow_record_batch_stream_writer_new_raw(&arrow_writer); } else { @@ -245,7 +237,6 @@ garrow_record_batch_stream_writer_new(GArrowOutputStream *sink, } } - G_DEFINE_TYPE(GArrowRecordBatchFileWriter, garrow_record_batch_file_writer, GARROW_TYPE_RECORD_BATCH_STREAM_WRITER); @@ -273,17 +264,14 @@ garrow_record_batch_file_writer_class_init(GArrowRecordBatchFileWriterClass *kla */ GArrowRecordBatchFileWriter * garrow_record_batch_file_writer_new(GArrowOutputStream *sink, - GArrowSchema *schema, - GError **error) + GArrowSchema *schema, + GError **error) { auto arrow_sink = garrow_output_stream_get_raw(sink); auto arrow_schema = garrow_schema_get_raw(schema); std::shared_ptr arrow_writer; - auto arrow_writer_result = - arrow::ipc::MakeFileWriter(arrow_sink, arrow_schema); - if (garrow::check(error, - arrow_writer_result, - "[record-batch-file-writer][open]")) { + auto arrow_writer_result = arrow::ipc::MakeFileWriter(arrow_sink, arrow_schema); + if (garrow::check(error, arrow_writer_result, "[record-batch-file-writer][open]")) { auto arrow_writer = *arrow_writer_result; return garrow_record_batch_file_writer_new_raw(&arrow_writer); } else { @@ -294,13 +282,13 @@ garrow_record_batch_file_writer_new(GArrowOutputStream *sink, G_END_DECLS GArrowRecordBatchWriter * -garrow_record_batch_writer_new_raw(std::shared_ptr *arrow_writer) +garrow_record_batch_writer_new_raw( + std::shared_ptr *arrow_writer) { - auto writer = - GARROW_RECORD_BATCH_WRITER( - g_object_new(GARROW_TYPE_RECORD_BATCH_WRITER, - "record-batch-writer", arrow_writer, - NULL)); + auto writer = GARROW_RECORD_BATCH_WRITER(g_object_new(GARROW_TYPE_RECORD_BATCH_WRITER, + "record-batch-writer", + arrow_writer, + NULL)); return writer; } @@ -312,23 +300,25 @@ garrow_record_batch_writer_get_raw(GArrowRecordBatchWriter *writer) } GArrowRecordBatchStreamWriter * -garrow_record_batch_stream_writer_new_raw(std::shared_ptr *arrow_writer) +garrow_record_batch_stream_writer_new_raw( + std::shared_ptr *arrow_writer) { auto writer = - GARROW_RECORD_BATCH_STREAM_WRITER( - g_object_new(GARROW_TYPE_RECORD_BATCH_STREAM_WRITER, - "record-batch-writer", arrow_writer, - NULL)); + GARROW_RECORD_BATCH_STREAM_WRITER(g_object_new(GARROW_TYPE_RECORD_BATCH_STREAM_WRITER, + "record-batch-writer", + arrow_writer, + NULL)); return writer; } GArrowRecordBatchFileWriter * -garrow_record_batch_file_writer_new_raw(std::shared_ptr *arrow_writer) +garrow_record_batch_file_writer_new_raw( + std::shared_ptr *arrow_writer) { auto writer = - GARROW_RECORD_BATCH_FILE_WRITER( - g_object_new(GARROW_TYPE_RECORD_BATCH_FILE_WRITER, - "record-batch-writer", arrow_writer, - NULL)); + GARROW_RECORD_BATCH_FILE_WRITER(g_object_new(GARROW_TYPE_RECORD_BATCH_FILE_WRITER, + "record-batch-writer", + arrow_writer, + NULL)); return writer; } diff --git a/c_glib/arrow-glib/writer.h b/c_glib/arrow-glib/writer.h index a0d22fe626c0b..b547172a5f384 100644 --- a/c_glib/arrow-glib/writer.h +++ b/c_glib/arrow-glib/writer.h @@ -27,30 +27,27 @@ G_BEGIN_DECLS -#define GARROW_TYPE_RECORD_BATCH_WRITER \ - (garrow_record_batch_writer_get_type()) -#define GARROW_RECORD_BATCH_WRITER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_RECORD_BATCH_WRITER, \ +#define GARROW_TYPE_RECORD_BATCH_WRITER (garrow_record_batch_writer_get_type()) +#define GARROW_RECORD_BATCH_WRITER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_RECORD_BATCH_WRITER, \ GArrowRecordBatchWriter)) -#define GARROW_RECORD_BATCH_WRITER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_RECORD_BATCH_WRITER, \ +#define GARROW_RECORD_BATCH_WRITER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_RECORD_BATCH_WRITER, \ GArrowRecordBatchWriterClass)) -#define GARROW_IS_RECORD_BATCH_WRITER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_RECORD_BATCH_WRITER)) -#define GARROW_IS_RECORD_BATCH_WRITER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_RECORD_BATCH_WRITER)) -#define GARROW_RECORD_BATCH_WRITER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_RECORD_BATCH_WRITER, \ +#define GARROW_IS_RECORD_BATCH_WRITER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), GARROW_TYPE_RECORD_BATCH_WRITER)) +#define GARROW_IS_RECORD_BATCH_WRITER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), GARROW_TYPE_RECORD_BATCH_WRITER)) +#define GARROW_RECORD_BATCH_WRITER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_RECORD_BATCH_WRITER, \ GArrowRecordBatchWriterClass)) -typedef struct _GArrowRecordBatchWriter GArrowRecordBatchWriter; +typedef struct _GArrowRecordBatchWriter GArrowRecordBatchWriter; #ifndef __GTK_DOC_IGNORE__ -typedef struct _GArrowRecordBatchWriterClass GArrowRecordBatchWriterClass; +typedef struct _GArrowRecordBatchWriterClass GArrowRecordBatchWriterClass; #endif /** @@ -71,43 +68,40 @@ struct _GArrowRecordBatchWriterClass }; #endif -GType garrow_record_batch_writer_get_type(void) G_GNUC_CONST; - -gboolean garrow_record_batch_writer_write_record_batch( - GArrowRecordBatchWriter *writer, - GArrowRecordBatch *record_batch, - GError **error); -gboolean garrow_record_batch_writer_write_table( - GArrowRecordBatchWriter *writer, - GArrowTable *table, - GError **error); -gboolean garrow_record_batch_writer_close( - GArrowRecordBatchWriter *writer, - GError **error); - - -#define GARROW_TYPE_RECORD_BATCH_STREAM_WRITER \ +GType +garrow_record_batch_writer_get_type(void) G_GNUC_CONST; + +gboolean +garrow_record_batch_writer_write_record_batch(GArrowRecordBatchWriter *writer, + GArrowRecordBatch *record_batch, + GError **error); +gboolean +garrow_record_batch_writer_write_table(GArrowRecordBatchWriter *writer, + GArrowTable *table, + GError **error); +gboolean +garrow_record_batch_writer_close(GArrowRecordBatchWriter *writer, GError **error); + +#define GARROW_TYPE_RECORD_BATCH_STREAM_WRITER \ (garrow_record_batch_stream_writer_get_type()) -#define GARROW_RECORD_BATCH_STREAM_WRITER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_RECORD_BATCH_STREAM_WRITER, \ +#define GARROW_RECORD_BATCH_STREAM_WRITER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_RECORD_BATCH_STREAM_WRITER, \ GArrowRecordBatchStreamWriter)) -#define GARROW_RECORD_BATCH_STREAM_WRITER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_RECORD_BATCH_STREAM_WRITER, \ +#define GARROW_RECORD_BATCH_STREAM_WRITER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_RECORD_BATCH_STREAM_WRITER, \ GArrowRecordBatchStreamWriterClass)) -#define GARROW_IS_RECORD_BATCH_STREAM_WRITER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_RECORD_BATCH_STREAM_WRITER)) -#define GARROW_IS_RECORD_BATCH_STREAM_WRITER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_RECORD_BATCH_STREAM_WRITER)) -#define GARROW_RECORD_BATCH_STREAM_WRITER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_RECORD_BATCH_STREAM_WRITER, \ +#define GARROW_IS_RECORD_BATCH_STREAM_WRITER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), GARROW_TYPE_RECORD_BATCH_STREAM_WRITER)) +#define GARROW_IS_RECORD_BATCH_STREAM_WRITER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), GARROW_TYPE_RECORD_BATCH_STREAM_WRITER)) +#define GARROW_RECORD_BATCH_STREAM_WRITER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_RECORD_BATCH_STREAM_WRITER, \ GArrowRecordBatchStreamWriterClass)) -typedef struct _GArrowRecordBatchStreamWriter GArrowRecordBatchStreamWriter; +typedef struct _GArrowRecordBatchStreamWriter GArrowRecordBatchStreamWriter; #ifndef __GTK_DOC_IGNORE__ typedef struct _GArrowRecordBatchStreamWriterClass GArrowRecordBatchStreamWriterClass; #endif @@ -130,36 +124,33 @@ struct _GArrowRecordBatchStreamWriterClass }; #endif -GType garrow_record_batch_stream_writer_get_type(void) G_GNUC_CONST; - -GArrowRecordBatchStreamWriter *garrow_record_batch_stream_writer_new( - GArrowOutputStream *sink, - GArrowSchema *schema, - GError **error); +GType +garrow_record_batch_stream_writer_get_type(void) G_GNUC_CONST; +GArrowRecordBatchStreamWriter * +garrow_record_batch_stream_writer_new(GArrowOutputStream *sink, + GArrowSchema *schema, + GError **error); -#define GARROW_TYPE_RECORD_BATCH_FILE_WRITER \ - (garrow_record_batch_file_writer_get_type()) -#define GARROW_RECORD_BATCH_FILE_WRITER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GARROW_TYPE_RECORD_BATCH_FILE_WRITER, \ +#define GARROW_TYPE_RECORD_BATCH_FILE_WRITER (garrow_record_batch_file_writer_get_type()) +#define GARROW_RECORD_BATCH_FILE_WRITER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + GARROW_TYPE_RECORD_BATCH_FILE_WRITER, \ GArrowRecordBatchFileWriter)) -#define GARROW_RECORD_BATCH_FILE_WRITER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GARROW_TYPE_RECORD_BATCH_FILE_WRITER, \ +#define GARROW_RECORD_BATCH_FILE_WRITER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + GARROW_TYPE_RECORD_BATCH_FILE_WRITER, \ GArrowRecordBatchFileWriterClass)) -#define GARROW_IS_RECORD_BATCH_FILE_WRITER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - GARROW_TYPE_RECORD_BATCH_FILE_WRITER)) -#define GARROW_IS_RECORD_BATCH_FILE_WRITER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - GARROW_TYPE_RECORD_BATCH_FILE_WRITER)) -#define GARROW_RECORD_BATCH_FILE_WRITER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GARROW_TYPE_RECORD_BATCH_FILE_WRITER, \ +#define GARROW_IS_RECORD_BATCH_FILE_WRITER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), GARROW_TYPE_RECORD_BATCH_FILE_WRITER)) +#define GARROW_IS_RECORD_BATCH_FILE_WRITER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), GARROW_TYPE_RECORD_BATCH_FILE_WRITER)) +#define GARROW_RECORD_BATCH_FILE_WRITER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), \ + GARROW_TYPE_RECORD_BATCH_FILE_WRITER, \ GArrowRecordBatchFileWriterClass)) -typedef struct _GArrowRecordBatchFileWriter GArrowRecordBatchFileWriter; +typedef struct _GArrowRecordBatchFileWriter GArrowRecordBatchFileWriter; #ifndef __GTK_DOC_IGNORE__ typedef struct _GArrowRecordBatchFileWriterClass GArrowRecordBatchFileWriterClass; #endif @@ -182,11 +173,12 @@ struct _GArrowRecordBatchFileWriterClass }; #endif -GType garrow_record_batch_file_writer_get_type(void) G_GNUC_CONST; +GType +garrow_record_batch_file_writer_get_type(void) G_GNUC_CONST; -GArrowRecordBatchFileWriter *garrow_record_batch_file_writer_new( - GArrowOutputStream *sink, - GArrowSchema *schema, - GError **error); +GArrowRecordBatchFileWriter * +garrow_record_batch_file_writer_new(GArrowOutputStream *sink, + GArrowSchema *schema, + GError **error); G_END_DECLS diff --git a/c_glib/arrow-glib/writer.hpp b/c_glib/arrow-glib/writer.hpp index 1e188bd3c6886..aa87ffe77d79b 100644 --- a/c_glib/arrow-glib/writer.hpp +++ b/c_glib/arrow-glib/writer.hpp @@ -25,9 +25,16 @@ #include -GArrowRecordBatchWriter *garrow_record_batch_writer_new_raw(std::shared_ptr *arrow_writer); -std::shared_ptr garrow_record_batch_writer_get_raw(GArrowRecordBatchWriter *writer); +GArrowRecordBatchWriter * +garrow_record_batch_writer_new_raw( + std::shared_ptr *arrow_writer); +std::shared_ptr +garrow_record_batch_writer_get_raw(GArrowRecordBatchWriter *writer); -GArrowRecordBatchStreamWriter *garrow_record_batch_stream_writer_new_raw(std::shared_ptr *arrow_writer); +GArrowRecordBatchStreamWriter * +garrow_record_batch_stream_writer_new_raw( + std::shared_ptr *arrow_writer); -GArrowRecordBatchFileWriter *garrow_record_batch_file_writer_new_raw(std::shared_ptr *arrow_writer); +GArrowRecordBatchFileWriter * +garrow_record_batch_file_writer_new_raw( + std::shared_ptr *arrow_writer); diff --git a/c_glib/example/build.c b/c_glib/example/build.c index 9b2d58d2b2bba..2ccea8415450f 100644 --- a/c_glib/example/build.c +++ b/c_glib/example/build.c @@ -66,8 +66,7 @@ main(int argc, char **argv) gint32 value; value = garrow_int32_array_get_value(GARROW_INT32_ARRAY(array), i); - g_print("array[%" G_GINT64_FORMAT "] = %d\n", - i, value); + g_print("array[%" G_GINT64_FORMAT "] = %d\n", i, value); } } diff --git a/c_glib/example/extension-type.c b/c_glib/example/extension-type.c index a23fa427dc2a9..1861943d7e598 100644 --- a/c_glib/example/extension-type.c +++ b/c_glib/example/extension-type.c @@ -22,19 +22,14 @@ #include #define EXAMPLE_TYPE_UUID_ARRAY (example_uuid_array_get_type()) -G_DECLARE_DERIVABLE_TYPE(ExampleUUIDArray, - example_uuid_array, - EXAMPLE, - UUID_ARRAY, - GArrowExtensionArray) +G_DECLARE_DERIVABLE_TYPE( + ExampleUUIDArray, example_uuid_array, EXAMPLE, UUID_ARRAY, GArrowExtensionArray) struct _ExampleUUIDArrayClass { GArrowExtensionArrayClass parent_class; }; -G_DEFINE_TYPE(ExampleUUIDArray, - example_uuid_array, - GARROW_TYPE_EXTENSION_ARRAY) +G_DEFINE_TYPE(ExampleUUIDArray, example_uuid_array, GARROW_TYPE_EXTENSION_ARRAY) static void example_uuid_array_init(ExampleUUIDArray *object) @@ -46,7 +41,6 @@ example_uuid_array_class_init(ExampleUUIDArrayClass *klass) { } - #define EXAMPLE_TYPE_UUID_DATA_TYPE (example_uuid_data_type_get_type()) G_DECLARE_DERIVABLE_TYPE(ExampleUUIDDataType, example_uuid_data_type, @@ -58,7 +52,6 @@ struct _ExampleUUIDDataTypeClass GArrowExtensionDataTypeClass parent_class; }; - G_DEFINE_TYPE(ExampleUUIDDataType, example_uuid_data_type, GARROW_TYPE_EXTENSION_DATA_TYPE) @@ -78,7 +71,8 @@ example_uuid_data_type_equal(GArrowExtensionDataType *data_type, } static const gchar *example_uuid_data_type_serialize_id = "uuid-serialized"; -static ExampleUUIDDataType *example_uuid_data_type_new(void); +static ExampleUUIDDataType * +example_uuid_data_type_new(void); static GArrowDataType * example_uuid_data_type_deserialize(GArrowExtensionDataType *data_type, @@ -89,9 +83,7 @@ example_uuid_data_type_deserialize(GArrowExtensionDataType *data_type, gsize raw_data_size; gconstpointer raw_data = g_bytes_get_data(serialized_data, &raw_data_size); if (!(raw_data_size == strlen(example_uuid_data_type_serialize_id) && - strncmp(raw_data, - example_uuid_data_type_serialize_id, - raw_data_size) == 0)) { + strncmp(raw_data, example_uuid_data_type_serialize_id, raw_data_size) == 0)) { g_set_error(error, GARROW_ERROR, GARROW_ERROR_INVALID, @@ -104,11 +96,8 @@ example_uuid_data_type_deserialize(GArrowExtensionDataType *data_type, } GArrowDataType *expected_storage_data_type; - g_object_get(data_type, - "storage-data-type", &expected_storage_data_type, - NULL); - if (!garrow_data_type_equal(storage_data_type, - expected_storage_data_type)) { + g_object_get(data_type, "storage-data-type", &expected_storage_data_type, NULL); + if (!garrow_data_type_equal(storage_data_type, expected_storage_data_type)) { gchar *expected = garrow_data_type_to_string(expected_storage_data_type); gchar *actual = garrow_data_type_to_string(storage_data_type); g_set_error(error, @@ -147,13 +136,11 @@ example_uuid_data_type_init(ExampleUUIDDataType *object) static void example_uuid_data_type_class_init(ExampleUUIDDataTypeClass *klass) { - GArrowExtensionDataTypeClass *extension_klass = - GARROW_EXTENSION_DATA_TYPE_CLASS(klass); - extension_klass->get_extension_name = - example_uuid_data_type_get_extension_name; - extension_klass->equal = example_uuid_data_type_equal; - extension_klass->deserialize = example_uuid_data_type_deserialize; - extension_klass->serialize = example_uuid_data_type_serialize; + GArrowExtensionDataTypeClass *extension_klass = GARROW_EXTENSION_DATA_TYPE_CLASS(klass); + extension_klass->get_extension_name = example_uuid_data_type_get_extension_name; + extension_klass->equal = example_uuid_data_type_equal; + extension_klass->deserialize = example_uuid_data_type_deserialize; + extension_klass->serialize = example_uuid_data_type_serialize; extension_klass->get_array_gtype = example_uuid_data_type_get_array_gtype; } @@ -163,11 +150,11 @@ example_uuid_data_type_new(void) GArrowFixedSizeBinaryDataType *storage_data_type = garrow_fixed_size_binary_data_type_new(16); return g_object_new(EXAMPLE_TYPE_UUID_DATA_TYPE, - "storage-data-type", storage_data_type, + "storage-data-type", + storage_data_type, NULL); } - int main(int argc, char **argv) { @@ -192,9 +179,7 @@ main(int argc, char **argv) { /* Build storage data for the created UUID extension data type. */ GArrowFixedSizeBinaryDataType *storage_data_type; - g_object_get(extension_data_type, - "storage-data-type", &storage_data_type, - NULL); + g_object_get(extension_data_type, "storage-data-type", &storage_data_type, NULL); GArrowFixedSizeBinaryArrayBuilder *builder = garrow_fixed_size_binary_array_builder_new(storage_data_type); g_object_unref(storage_data_type); @@ -230,16 +215,14 @@ main(int argc, char **argv) /* Wrap the created storage data as the created UUID extension array. */ GArrowExtensionArray *extension_array = - garrow_extension_data_type_wrap_array(extension_data_type, - storage); + garrow_extension_data_type_wrap_array(extension_data_type, storage); g_object_unref(storage); gint64 n_rows = garrow_array_get_length(GARROW_ARRAY(extension_array)); /* Create a record batch to serialize the created UUID extension array. */ GList *fields = NULL; - fields = g_list_append(fields, - garrow_field_new("uuid", - GARROW_DATA_TYPE(uuid_data_type))); + fields = + g_list_append(fields, garrow_field_new("uuid", GARROW_DATA_TYPE(uuid_data_type))); GArrowSchema *schema = garrow_schema_new(fields); g_list_free_full(fields, g_object_unref); GList *columns = NULL; @@ -264,8 +247,7 @@ main(int argc, char **argv) goto exit; } { - GArrowBufferOutputStream *output = - garrow_buffer_output_stream_new(buffer); + GArrowBufferOutputStream *output = garrow_buffer_output_stream_new(buffer); GArrowRecordBatchStreamWriter *writer = garrow_record_batch_stream_writer_new(GARROW_OUTPUT_STREAM(output), schema, @@ -279,10 +261,9 @@ main(int argc, char **argv) g_object_unref(record_batch); goto exit; } - garrow_record_batch_writer_write_record_batch( - GARROW_RECORD_BATCH_WRITER(writer), - record_batch, - &error); + garrow_record_batch_writer_write_record_batch(GARROW_RECORD_BATCH_WRITER(writer), + record_batch, + &error); if (error) { g_print("failed to write record batch: %s\n", error->message); g_error_free(error); @@ -295,8 +276,7 @@ main(int argc, char **argv) } g_object_unref(schema); g_object_unref(record_batch); - garrow_record_batch_writer_close(GARROW_RECORD_BATCH_WRITER(writer), - &error); + garrow_record_batch_writer_close(GARROW_RECORD_BATCH_WRITER(writer), &error); g_object_unref(writer); g_object_unref(output); if (error) { @@ -312,8 +292,7 @@ main(int argc, char **argv) GArrowBufferInputStream *input = garrow_buffer_input_stream_new(GARROW_BUFFER(buffer)); GArrowRecordBatchStreamReader *reader = - garrow_record_batch_stream_reader_new(GARROW_INPUT_STREAM(input), - &error); + garrow_record_batch_stream_reader_new(GARROW_INPUT_STREAM(input), &error); if (error) { g_print("failed to create reader: %s\n", error->message); g_error_free(error); @@ -322,8 +301,7 @@ main(int argc, char **argv) goto exit; } record_batch = - garrow_record_batch_reader_read_next(GARROW_RECORD_BATCH_READER(reader), - &error); + garrow_record_batch_reader_read_next(GARROW_RECORD_BATCH_READER(reader), &error); if (error) { g_print("failed to read record batch: %s\n", error->message); g_error_free(error); @@ -333,9 +311,7 @@ main(int argc, char **argv) goto exit; } /* Show the deserialize record batch. */ - gchar *record_batch_content = - garrow_record_batch_to_string(record_batch, - &error); + gchar *record_batch_content = garrow_record_batch_to_string(record_batch, &error); if (error) { g_print("failed to dump record batch content: %s\n", error->message); g_error_free(error); @@ -363,9 +339,7 @@ main(int argc, char **argv) gchar *data_type_name = garrow_extension_data_type_get_extension_name(extension_data_type); gboolean success = - garrow_extension_data_type_registry_unregister(registry, - data_type_name, - &error); + garrow_extension_data_type_registry_unregister(registry, data_type_name, &error); g_free(data_type_name); if (!success) { g_print("failed to unregister: %s\n", error->message); diff --git a/c_glib/example/read-file.c b/c_glib/example/read-file.c index 8dae4290ecb28..f29def1abdd6e 100644 --- a/c_glib/example/read-file.c +++ b/c_glib/example/read-file.c @@ -32,31 +32,30 @@ print_array(GArrowArray *array) g_print("["); n = garrow_array_get_length(array); -#define ARRAY_CASE(type, Type, TYPE, format) \ - case GARROW_TYPE_ ## TYPE: \ - { \ - GArrow ## Type ## Array *real_array; \ - real_array = GARROW_ ## TYPE ## _ARRAY(array); \ - for (i = 0; i < n; i++) { \ - if (i > 0) { \ - g_print(", "); \ - } \ - g_print(format, \ - garrow_ ## type ## _array_get_value(real_array, i)); \ - } \ - } \ +#define ARRAY_CASE(type, Type, TYPE, format) \ + case GARROW_TYPE_##TYPE: \ + { \ + GArrow##Type##Array *real_array; \ + real_array = GARROW_##TYPE##_ARRAY(array); \ + for (i = 0; i < n; i++) { \ + if (i > 0) { \ + g_print(", "); \ + } \ + g_print(format, garrow_##type##_array_get_value(real_array, i)); \ + } \ + } \ break switch (value_type) { - ARRAY_CASE(uint8, UInt8, UINT8, "%hhu"); + ARRAY_CASE(uint8, UInt8, UINT8, "%hhu"); ARRAY_CASE(uint16, UInt16, UINT16, "%" G_GUINT16_FORMAT); ARRAY_CASE(uint32, UInt32, UINT32, "%" G_GUINT32_FORMAT); ARRAY_CASE(uint64, UInt64, UINT64, "%" G_GUINT64_FORMAT); - ARRAY_CASE( int8, Int8, INT8, "%hhd"); - ARRAY_CASE( int16, Int16, INT16, "%" G_GINT16_FORMAT); - ARRAY_CASE( int32, Int32, INT32, "%" G_GINT32_FORMAT); - ARRAY_CASE( int64, Int64, INT64, "%" G_GINT64_FORMAT); - ARRAY_CASE( float, Float, FLOAT, "%g"); + ARRAY_CASE(int8, Int8, INT8, "%hhd"); + ARRAY_CASE(int16, Int16, INT16, "%" G_GINT16_FORMAT); + ARRAY_CASE(int32, Int32, INT32, "%" G_GINT32_FORMAT); + ARRAY_CASE(int64, Int64, INT64, "%" G_GINT64_FORMAT); + ARRAY_CASE(float, Float, FLOAT, "%g"); ARRAY_CASE(double, Double, DOUBLE, "%g"); default: break; @@ -93,8 +92,7 @@ main(int argc, char **argv) if (argc > 1) input_path = argv[1]; - input = garrow_memory_mapped_input_stream_new(input_path, - &error); + input = garrow_memory_mapped_input_stream_new(input_path, &error); if (!input) { g_print("failed to open file: %s\n", error->message); g_error_free(error); @@ -105,8 +103,7 @@ main(int argc, char **argv) GArrowRecordBatchFileReader *reader; reader = - garrow_record_batch_file_reader_new(GARROW_SEEKABLE_INPUT_STREAM(input), - &error); + garrow_record_batch_file_reader_new(GARROW_SEEKABLE_INPUT_STREAM(input), &error); if (!reader) { g_print("failed to open file reader: %s\n", error->message); g_error_free(error); diff --git a/c_glib/example/read-stream.c b/c_glib/example/read-stream.c index 133418faa900f..183994c832ac7 100644 --- a/c_glib/example/read-stream.c +++ b/c_glib/example/read-stream.c @@ -32,31 +32,30 @@ print_array(GArrowArray *array) g_print("["); n = garrow_array_get_length(array); -#define ARRAY_CASE(type, Type, TYPE, format) \ - case GARROW_TYPE_ ## TYPE: \ - { \ - GArrow ## Type ## Array *real_array; \ - real_array = GARROW_ ## TYPE ## _ARRAY(array); \ - for (i = 0; i < n; i++) { \ - if (i > 0) { \ - g_print(", "); \ - } \ - g_print(format, \ - garrow_ ## type ## _array_get_value(real_array, i)); \ - } \ - } \ +#define ARRAY_CASE(type, Type, TYPE, format) \ + case GARROW_TYPE_##TYPE: \ + { \ + GArrow##Type##Array *real_array; \ + real_array = GARROW_##TYPE##_ARRAY(array); \ + for (i = 0; i < n; i++) { \ + if (i > 0) { \ + g_print(", "); \ + } \ + g_print(format, garrow_##type##_array_get_value(real_array, i)); \ + } \ + } \ break switch (value_type) { - ARRAY_CASE(uint8, UInt8, UINT8, "%hhu"); + ARRAY_CASE(uint8, UInt8, UINT8, "%hhu"); ARRAY_CASE(uint16, UInt16, UINT16, "%" G_GUINT16_FORMAT); ARRAY_CASE(uint32, UInt32, UINT32, "%" G_GUINT32_FORMAT); ARRAY_CASE(uint64, UInt64, UINT64, "%" G_GUINT64_FORMAT); - ARRAY_CASE( int8, Int8, INT8, "%hhd"); - ARRAY_CASE( int16, Int16, INT16, "%" G_GINT16_FORMAT); - ARRAY_CASE( int32, Int32, INT32, "%" G_GINT32_FORMAT); - ARRAY_CASE( int64, Int64, INT64, "%" G_GINT64_FORMAT); - ARRAY_CASE( float, Float, FLOAT, "%g"); + ARRAY_CASE(int8, Int8, INT8, "%hhd"); + ARRAY_CASE(int16, Int16, INT16, "%" G_GINT16_FORMAT); + ARRAY_CASE(int32, Int32, INT32, "%" G_GINT32_FORMAT); + ARRAY_CASE(int64, Int64, INT64, "%" G_GINT64_FORMAT); + ARRAY_CASE(float, Float, FLOAT, "%g"); ARRAY_CASE(double, Double, DOUBLE, "%g"); default: break; @@ -105,8 +104,7 @@ main(int argc, char **argv) GArrowRecordBatchStreamReader *stream_reader; stream_reader = - garrow_record_batch_stream_reader_new(GARROW_INPUT_STREAM(input), - &error); + garrow_record_batch_stream_reader_new(GARROW_INPUT_STREAM(input), &error); if (!stream_reader) { g_print("failed to open stream reader: %s\n", error->message); g_error_free(error); diff --git a/c_glib/example/receive-network.c b/c_glib/example/receive-network.c index aa7aaa0140375..a2172455eabcf 100644 --- a/c_glib/example/receive-network.c +++ b/c_glib/example/receive-network.c @@ -37,7 +37,7 @@ service_event(GSocketListener *listener, } GError *error = NULL; - GSocketAddress* local_address = g_socket_get_local_address(socket, &error); + GSocketAddress *local_address = g_socket_get_local_address(socket, &error); if (!local_address) { g_print("failed to get local address: %s\n", error->message); g_error_free(error); @@ -62,31 +62,30 @@ print_array(GArrowArray *array) g_print("["); n = garrow_array_get_length(array); -#define ARRAY_CASE(type, Type, TYPE, format) \ - case GARROW_TYPE_ ## TYPE: \ - { \ - GArrow ## Type ## Array *real_array; \ - real_array = GARROW_ ## TYPE ## _ARRAY(array); \ - for (i = 0; i < n; i++) { \ - if (i > 0) { \ - g_print(", "); \ - } \ - g_print(format, \ - garrow_ ## type ## _array_get_value(real_array, i)); \ - } \ - } \ +#define ARRAY_CASE(type, Type, TYPE, format) \ + case GARROW_TYPE_##TYPE: \ + { \ + GArrow##Type##Array *real_array; \ + real_array = GARROW_##TYPE##_ARRAY(array); \ + for (i = 0; i < n; i++) { \ + if (i > 0) { \ + g_print(", "); \ + } \ + g_print(format, garrow_##type##_array_get_value(real_array, i)); \ + } \ + } \ break switch (value_type) { - ARRAY_CASE(uint8, UInt8, UINT8, "%hhu"); + ARRAY_CASE(uint8, UInt8, UINT8, "%hhu"); ARRAY_CASE(uint16, UInt16, UINT16, "%" G_GUINT16_FORMAT); ARRAY_CASE(uint32, UInt32, UINT32, "%" G_GUINT32_FORMAT); ARRAY_CASE(uint64, UInt64, UINT64, "%" G_GUINT64_FORMAT); - ARRAY_CASE( int8, Int8, INT8, "%hhd"); - ARRAY_CASE( int16, Int16, INT16, "%" G_GINT16_FORMAT); - ARRAY_CASE( int32, Int32, INT32, "%" G_GINT32_FORMAT); - ARRAY_CASE( int64, Int64, INT64, "%" G_GINT64_FORMAT); - ARRAY_CASE( float, Float, FLOAT, "%g"); + ARRAY_CASE(int8, Int8, INT8, "%hhd"); + ARRAY_CASE(int16, Int16, INT16, "%" G_GINT16_FORMAT); + ARRAY_CASE(int32, Int32, INT32, "%" G_GINT32_FORMAT); + ARRAY_CASE(int64, Int64, INT64, "%" G_GINT64_FORMAT); + ARRAY_CASE(float, Float, FLOAT, "%g"); ARRAY_CASE(double, Double, DOUBLE, "%g"); default: break; @@ -121,8 +120,7 @@ service_incoming(GSocketService *service, gpointer user_data) { GArrowGIOInputStream *input = - garrow_gio_input_stream_new( - g_io_stream_get_input_stream(G_IO_STREAM(connection))); + garrow_gio_input_stream_new(g_io_stream_get_input_stream(G_IO_STREAM(connection))); GError *error = NULL; GArrowRecordBatchStreamReader *reader = garrow_record_batch_stream_reader_new(GARROW_INPUT_STREAM(input), &error); @@ -135,8 +133,7 @@ service_incoming(GSocketService *service, while (TRUE) { GArrowRecordBatch *record_batch = - garrow_record_batch_reader_read_next(GARROW_RECORD_BATCH_READER(reader), - &error); + garrow_record_batch_reader_read_next(GARROW_RECORD_BATCH_READER(reader), &error); if (error) { g_print("failed to read the next record batch: %s\n", error->message); g_error_free(error); @@ -160,7 +157,8 @@ service_incoming(GSocketService *service, } #ifdef G_OS_UNIX -typedef struct { +typedef struct +{ GSocketService *service; GMainLoop *loop; } StopData; @@ -168,7 +166,7 @@ typedef struct { static gboolean stop(gpointer user_data) { - StopData* data = user_data; + StopData *data = user_data; g_object_unref(data->service); g_main_loop_quit(data->loop); return G_SOURCE_REMOVE; @@ -184,9 +182,7 @@ main(int argc, char **argv) GError *error = NULL; gboolean success = - g_socket_listener_add_any_inet_port(G_SOCKET_LISTENER(service), - NULL, - &error); + g_socket_listener_add_any_inet_port(G_SOCKET_LISTENER(service), NULL, &error); if (!success) { g_print("failed to add a listen IP address: %s\n", error->message); g_error_free(error); diff --git a/c_glib/example/send-network.c b/c_glib/example/send-network.c index d298c5a173d21..40d9772e51460 100644 --- a/c_glib/example/send-network.c +++ b/c_glib/example/send-network.c @@ -26,13 +26,12 @@ build_schema(void) { GList *fields = NULL; GArrowBooleanDataType *boolean_data_type = garrow_boolean_data_type_new(); - fields = g_list_append(fields, - garrow_field_new("boolean", - GARROW_DATA_TYPE(boolean_data_type))); + fields = + g_list_append(fields, + garrow_field_new("boolean", GARROW_DATA_TYPE(boolean_data_type))); GArrowInt32DataType *int32_data_type = garrow_int32_data_type_new(); - fields = g_list_append(fields, - garrow_field_new("int32", - GARROW_DATA_TYPE(int32_data_type))); + fields = + g_list_append(fields, garrow_field_new("int32", GARROW_DATA_TYPE(int32_data_type))); GArrowSchema *schema = garrow_schema_new(fields); g_list_free_full(fields, g_object_unref); @@ -47,8 +46,7 @@ build_record_batch(void) return NULL; } GError *error = NULL; - GArrowRecordBatchBuilder *builder = - garrow_record_batch_builder_new(schema, &error); + GArrowRecordBatchBuilder *builder = garrow_record_batch_builder_new(schema, &error); g_object_unref(schema); if (!builder) { g_print("failed to build record batch builder: %s\n", error->message); @@ -57,9 +55,8 @@ build_record_batch(void) } const gint64 n_records = 3; - GArrowBooleanArrayBuilder *boolean_builder = - GARROW_BOOLEAN_ARRAY_BUILDER( - garrow_record_batch_builder_get_column_builder(builder, 0)); + GArrowBooleanArrayBuilder *boolean_builder = GARROW_BOOLEAN_ARRAY_BUILDER( + garrow_record_batch_builder_get_column_builder(builder, 0)); gboolean boolean_values[] = {TRUE, TRUE, FALSE}; gboolean boolean_is_valids[] = {TRUE, FALSE, TRUE}; if (!garrow_boolean_array_builder_append_values(boolean_builder, @@ -75,9 +72,8 @@ build_record_batch(void) return NULL; } - GArrowInt32ArrayBuilder *int32_builder = - GARROW_INT32_ARRAY_BUILDER( - garrow_record_batch_builder_get_column_builder(builder, 1)); + GArrowInt32ArrayBuilder *int32_builder = GARROW_INT32_ARRAY_BUILDER( + garrow_record_batch_builder_get_column_builder(builder, 1)); gint32 int32_values[] = {1, 11, 111}; gint32 int32_is_valids[] = {FALSE, TRUE, TRUE}; if (!garrow_int32_array_builder_append_values(int32_builder, @@ -93,8 +89,7 @@ build_record_batch(void) return NULL; } - GArrowRecordBatch *record_batch = - garrow_record_batch_builder_flush(builder, &error); + GArrowRecordBatch *record_batch = garrow_record_batch_builder_flush(builder, &error); if (!record_batch) { g_print("failed to build record batch: %s\n", error->message); g_error_free(error); @@ -119,8 +114,7 @@ main(int argc, char **argv) guint port = atoi(argv[1]); GSocketClient *client = g_socket_client_new(); - GSocketAddress *address = g_inet_socket_address_new_from_string("127.0.0.1", - port); + GSocketAddress *address = g_inet_socket_address_new_from_string("127.0.0.1", port); GError *error = NULL; GSocketConnection *connection = g_socket_client_connect(client, G_SOCKET_CONNECTABLE(address), NULL, &error); @@ -135,12 +129,9 @@ main(int argc, char **argv) return EXIT_FAILURE; } GArrowGIOOutputStream *output = - garrow_gio_output_stream_new( - g_io_stream_get_output_stream(G_IO_STREAM(connection))); + garrow_gio_output_stream_new(g_io_stream_get_output_stream(G_IO_STREAM(connection))); GArrowRecordBatchStreamWriter *writer = - garrow_record_batch_stream_writer_new(GARROW_OUTPUT_STREAM(output), - schema, - &error); + garrow_record_batch_stream_writer_new(GARROW_OUTPUT_STREAM(output), schema, &error); g_object_unref(schema); if (!writer) { g_print("failed to create writer: %s\n", error->message); @@ -163,10 +154,9 @@ main(int argc, char **argv) return EXIT_FAILURE; } gboolean success = - garrow_record_batch_writer_write_record_batch( - GARROW_RECORD_BATCH_WRITER(writer), - record_batch, - &error); + garrow_record_batch_writer_write_record_batch(GARROW_RECORD_BATCH_WRITER(writer), + record_batch, + &error); g_object_unref(record_batch); if (!success) { g_print("failed to write record batch: %s\n", error->message); diff --git a/c_glib/gandiva-glib/expression.cpp b/c_glib/gandiva-glib/expression.cpp index e4368f84da0cf..f45cf6c79d0f4 100644 --- a/c_glib/gandiva-glib/expression.cpp +++ b/c_glib/gandiva-glib/expression.cpp @@ -37,7 +37,8 @@ G_BEGIN_DECLS * Since: 0.12.0 */ -typedef struct GGandivaExpressionPrivate_ { +typedef struct GGandivaExpressionPrivate_ +{ std::shared_ptr expression; GGandivaNode *root_node; GArrowField *result_field; @@ -49,14 +50,11 @@ enum { PROP_RESULT_FIELD }; -G_DEFINE_TYPE_WITH_PRIVATE(GGandivaExpression, - ggandiva_expression, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GGandivaExpression, ggandiva_expression, G_TYPE_OBJECT) -#define GGANDIVA_EXPRESSION_GET_PRIVATE(object) \ - static_cast( \ - ggandiva_expression_get_instance_private( \ - GGANDIVA_EXPRESSION(object))) +#define GGANDIVA_EXPRESSION_GET_PRIVATE(object) \ + static_cast( \ + ggandiva_expression_get_instance_private(GGANDIVA_EXPRESSION(object))) static void ggandiva_expression_dispose(GObject *object) @@ -136,7 +134,7 @@ static void ggandiva_expression_init(GGandivaExpression *object) { auto priv = GGANDIVA_EXPRESSION_GET_PRIVATE(object); - new(&priv->expression) std::shared_ptr; + new (&priv->expression) std::shared_ptr; } static void @@ -144,33 +142,33 @@ ggandiva_expression_class_init(GGandivaExpressionClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = ggandiva_expression_dispose; - gobject_class->finalize = ggandiva_expression_finalize; + gobject_class->dispose = ggandiva_expression_dispose; + gobject_class->finalize = ggandiva_expression_finalize; gobject_class->set_property = ggandiva_expression_set_property; gobject_class->get_property = ggandiva_expression_get_property; GParamSpec *spec; - spec = g_param_spec_pointer("expression", - "Expression", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "expression", + "Expression", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_EXPRESSION, spec); - spec = g_param_spec_object("root-node", - "Root Node", - "The root node for the expression", - GGANDIVA_TYPE_NODE, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "root-node", + "Root Node", + "The root node for the expression", + GGANDIVA_TYPE_NODE, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_ROOT_NODE, spec); - spec = g_param_spec_object("result-field", - "Result Field", - "The name and type of returned value as #GArrowField", - GARROW_TYPE_FIELD, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "result-field", + "Result Field", + "The name and type of returned value as #GArrowField", + GARROW_TYPE_FIELD, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_RESULT_FIELD, spec); } @@ -184,17 +182,13 @@ ggandiva_expression_class_init(GGandivaExpressionClass *klass) * Since: 0.12.0 */ GGandivaExpression * -ggandiva_expression_new(GGandivaNode *root_node, - GArrowField *result_field) +ggandiva_expression_new(GGandivaNode *root_node, GArrowField *result_field) { auto gandiva_root_node = ggandiva_node_get_raw(root_node); auto arrow_result_field = garrow_field_get_raw(result_field); auto gandiva_expression = - gandiva::TreeExprBuilder::MakeExpression(gandiva_root_node, - arrow_result_field); - return ggandiva_expression_new_raw(&gandiva_expression, - root_node, - result_field); + gandiva::TreeExprBuilder::MakeExpression(gandiva_root_node, arrow_result_field); + return ggandiva_expression_new_raw(&gandiva_expression, root_node, result_field); } /** @@ -215,10 +209,7 @@ ggandiva_expression_to_string(GGandivaExpression *expression) return g_strndup(string.data(), string.size()); } - -G_DEFINE_TYPE(GGandivaCondition, - ggandiva_condition, - GGANDIVA_TYPE_EXPRESSION) +G_DEFINE_TYPE(GGandivaCondition, ggandiva_condition, GGANDIVA_TYPE_EXPRESSION) static void ggandiva_condition_init(GGandivaCondition *object) @@ -242,13 +233,10 @@ GGandivaCondition * ggandiva_condition_new(GGandivaNode *root_node) { auto gandiva_root_node = ggandiva_node_get_raw(root_node); - auto gandiva_condition = - gandiva::TreeExprBuilder::MakeCondition(gandiva_root_node); - return ggandiva_condition_new_raw(&gandiva_condition, - root_node); + auto gandiva_condition = gandiva::TreeExprBuilder::MakeCondition(gandiva_root_node); + return ggandiva_condition_new_raw(&gandiva_condition, root_node); } - G_END_DECLS GGandivaExpression * @@ -257,9 +245,12 @@ ggandiva_expression_new_raw(std::shared_ptr *gandiva_expres GArrowField *result_field) { auto expression = g_object_new(GGANDIVA_TYPE_EXPRESSION, - "expression", gandiva_expression, - "root-node", root_node, - "result-field", result_field, + "expression", + gandiva_expression, + "root-node", + root_node, + "result-field", + result_field, NULL); return GGANDIVA_EXPRESSION(expression); } @@ -271,7 +262,6 @@ ggandiva_expression_get_raw(GGandivaExpression *expression) return priv->expression; } - GGandivaCondition * ggandiva_condition_new_raw(std::shared_ptr *gandiva_condition, GGandivaNode *root_node) @@ -279,9 +269,12 @@ ggandiva_condition_new_raw(std::shared_ptr *gandiva_conditio auto arrow_result_field = (*gandiva_condition)->result(); auto result_field = garrow_field_new_raw(&arrow_result_field, nullptr); auto condition = g_object_new(GGANDIVA_TYPE_CONDITION, - "expression", gandiva_condition, - "root-node", root_node, - "result-field", result_field, + "expression", + gandiva_condition, + "root-node", + root_node, + "result-field", + result_field, NULL); return GGANDIVA_CONDITION(condition); } diff --git a/c_glib/gandiva-glib/expression.h b/c_glib/gandiva-glib/expression.h index 0a720d9afbdc8..f8f061ceb08fa 100644 --- a/c_glib/gandiva-glib/expression.h +++ b/c_glib/gandiva-glib/expression.h @@ -26,11 +26,8 @@ G_BEGIN_DECLS #define GGANDIVA_TYPE_EXPRESSION (ggandiva_expression_get_type()) -G_DECLARE_DERIVABLE_TYPE(GGandivaExpression, - ggandiva_expression, - GGANDIVA, - EXPRESSION, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GGandivaExpression, ggandiva_expression, GGANDIVA, EXPRESSION, GObject) struct _GGandivaExpressionClass { @@ -38,17 +35,13 @@ struct _GGandivaExpressionClass }; GGandivaExpression * -ggandiva_expression_new(GGandivaNode *root_node, - GArrowField *result_field); -gchar *ggandiva_expression_to_string(GGandivaExpression *expression); - +ggandiva_expression_new(GGandivaNode *root_node, GArrowField *result_field); +gchar * +ggandiva_expression_to_string(GGandivaExpression *expression); #define GGANDIVA_TYPE_CONDITION (ggandiva_condition_get_type()) -G_DECLARE_DERIVABLE_TYPE(GGandivaCondition, - ggandiva_condition, - GGANDIVA, - CONDITION, - GGandivaExpression) +G_DECLARE_DERIVABLE_TYPE( + GGandivaCondition, ggandiva_condition, GGANDIVA, CONDITION, GGandivaExpression) struct _GGandivaConditionClass { @@ -59,5 +52,4 @@ GGANDIVA_AVAILABLE_IN_4_0 GGandivaCondition * ggandiva_condition_new(GGandivaNode *root_node); - G_END_DECLS diff --git a/c_glib/gandiva-glib/expression.hpp b/c_glib/gandiva-glib/expression.hpp index 45b6593937fc7..cba71c178b25b 100644 --- a/c_glib/gandiva-glib/expression.hpp +++ b/c_glib/gandiva-glib/expression.hpp @@ -30,10 +30,11 @@ GGandivaExpression * ggandiva_expression_new_raw(std::shared_ptr *gandiva_expression, GGandivaNode *root_node, GArrowField *result_field); -std::shared_ptr ggandiva_expression_get_raw(GGandivaExpression *expression); +std::shared_ptr +ggandiva_expression_get_raw(GGandivaExpression *expression); -GGandivaCondition -*ggandiva_condition_new_raw(std::shared_ptr *gandiva_expression, - GGandivaNode *root_node); +GGandivaCondition * +ggandiva_condition_new_raw(std::shared_ptr *gandiva_expression, + GGandivaNode *root_node); std::shared_ptr ggandiva_condition_get_raw(GGandivaCondition *condition); diff --git a/c_glib/gandiva-glib/filter.cpp b/c_glib/gandiva-glib/filter.cpp index baed699469713..2b1109c108e08 100644 --- a/c_glib/gandiva-glib/filter.cpp +++ b/c_glib/gandiva-glib/filter.cpp @@ -41,7 +41,8 @@ G_BEGIN_DECLS * Since: 4.0.0 */ -typedef struct GGandivaFilterPrivate_ { +typedef struct GGandivaFilterPrivate_ +{ std::shared_ptr filter; GArrowSchema *schema; GGandivaCondition *condition; @@ -53,14 +54,11 @@ enum { PROP_CONDITION, }; -G_DEFINE_TYPE_WITH_PRIVATE(GGandivaFilter, - ggandiva_filter, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GGandivaFilter, ggandiva_filter, G_TYPE_OBJECT) -#define GGANDIVA_FILTER_GET_PRIVATE(obj) \ - static_cast( \ - ggandiva_filter_get_instance_private( \ - GGANDIVA_FILTER(obj))) +#define GGANDIVA_FILTER_GET_PRIVATE(obj) \ + static_cast( \ + ggandiva_filter_get_instance_private(GGANDIVA_FILTER(obj))) static void ggandiva_filter_dispose(GObject *object) @@ -140,7 +138,7 @@ static void ggandiva_filter_init(GGandivaFilter *object) { auto priv = GGANDIVA_FILTER_GET_PRIVATE(object); - new(&priv->filter) std::shared_ptr; + new (&priv->filter) std::shared_ptr; } static void @@ -148,33 +146,33 @@ ggandiva_filter_class_init(GGandivaFilterClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = ggandiva_filter_dispose; - gobject_class->finalize = ggandiva_filter_finalize; + gobject_class->dispose = ggandiva_filter_dispose; + gobject_class->finalize = ggandiva_filter_finalize; gobject_class->set_property = ggandiva_filter_set_property; gobject_class->get_property = ggandiva_filter_get_property; GParamSpec *spec; - spec = g_param_spec_pointer("filter", - "Filter", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "filter", + "Filter", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_FILTER, spec); - spec = g_param_spec_object("schema", - "Schema", - "The schema for input record batch", - GARROW_TYPE_SCHEMA, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "schema", + "Schema", + "The schema for input record batch", + GARROW_TYPE_SCHEMA, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_SCHEMA, spec); - spec = g_param_spec_object("condition", - "Condition", - "The condition for the filter", - GGANDIVA_TYPE_CONDITION, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "condition", + "Condition", + "The condition for the filter", + GGANDIVA_TYPE_CONDITION, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_CONDITION, spec); } @@ -190,16 +188,12 @@ ggandiva_filter_class_init(GGandivaFilterClass *klass) * Since: 4.0.0 */ GGandivaFilter * -ggandiva_filter_new(GArrowSchema *schema, - GGandivaCondition *condition, - GError **error) +ggandiva_filter_new(GArrowSchema *schema, GGandivaCondition *condition, GError **error) { auto arrow_schema = garrow_schema_get_raw(schema); auto gandiva_condition = ggandiva_condition_get_raw(condition); std::shared_ptr gandiva_filter; - auto status = gandiva::Filter::Make(arrow_schema, - gandiva_condition, - &gandiva_filter); + auto status = gandiva::Filter::Make(arrow_schema, gandiva_condition, &gandiva_filter); if (garrow_error_check(error, status, "[gandiva][filter][new]")) { return ggandiva_filter_new_raw(&gandiva_filter, schema, condition); } else { @@ -227,10 +221,8 @@ ggandiva_filter_evaluate(GGandivaFilter *filter, { auto gandiva_filter = ggandiva_filter_get_raw(filter); auto arrow_record_batch = garrow_record_batch_get_raw(record_batch); - auto gandiva_selection_vector = - ggandiva_selection_vector_get_raw(selection_vector); - auto status = gandiva_filter->Evaluate(*arrow_record_batch, - gandiva_selection_vector); + auto gandiva_selection_vector = ggandiva_selection_vector_get_raw(selection_vector); + auto status = gandiva_filter->Evaluate(*arrow_record_batch, gandiva_selection_vector); return garrow_error_check(error, status, "[gandiva][filter][evaluate]"); } @@ -242,9 +234,12 @@ ggandiva_filter_new_raw(std::shared_ptr *gandiva_filter, GGandivaCondition *condition) { auto filter = g_object_new(GGANDIVA_TYPE_FILTER, - "filter", gandiva_filter, - "schema", schema, - "condition", condition, + "filter", + gandiva_filter, + "schema", + schema, + "condition", + condition, NULL); return GGANDIVA_FILTER(filter); } diff --git a/c_glib/gandiva-glib/filter.h b/c_glib/gandiva-glib/filter.h index 9a0a5dc5d8598..b95981198e0c4 100644 --- a/c_glib/gandiva-glib/filter.h +++ b/c_glib/gandiva-glib/filter.h @@ -25,11 +25,7 @@ G_BEGIN_DECLS #define GGANDIVA_TYPE_FILTER (ggandiva_filter_get_type()) -G_DECLARE_DERIVABLE_TYPE(GGandivaFilter, - ggandiva_filter, - GGANDIVA, - FILTER, - GObject) +G_DECLARE_DERIVABLE_TYPE(GGandivaFilter, ggandiva_filter, GGANDIVA, FILTER, GObject) struct _GGandivaFilterClass { @@ -37,9 +33,7 @@ struct _GGandivaFilterClass }; GGandivaFilter * -ggandiva_filter_new(GArrowSchema *schema, - GGandivaCondition *condition, - GError **error); +ggandiva_filter_new(GArrowSchema *schema, GGandivaCondition *condition, GError **error); gboolean ggandiva_filter_evaluate(GGandivaFilter *filter, GArrowRecordBatch *record_batch, diff --git a/c_glib/gandiva-glib/function-registry.cpp b/c_glib/gandiva-glib/function-registry.cpp index f47262986db82..b0f19906df8e8 100644 --- a/c_glib/gandiva-glib/function-registry.cpp +++ b/c_glib/gandiva-glib/function-registry.cpp @@ -34,7 +34,8 @@ G_BEGIN_DECLS * Since: 0.14.0 */ -struct GGandivaFunctionRegistryPrivate { +struct GGandivaFunctionRegistryPrivate +{ std::shared_ptr function_registry; }; @@ -46,10 +47,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GGandivaFunctionRegistry, ggandiva_function_registry, G_TYPE_OBJECT) -#define GGANDIVA_FUNCTION_REGISTRY_GET_PRIVATE(object) \ - static_cast( \ - ggandiva_function_registry_get_instance_private( \ - GGANDIVA_FUNCTION_REGISTRY(object))) +#define GGANDIVA_FUNCTION_REGISTRY_GET_PRIVATE(object) \ + static_cast( \ + ggandiva_function_registry_get_instance_private(GGANDIVA_FUNCTION_REGISTRY(object))) static void ggandiva_function_registry_finalize(GObject *object) @@ -69,9 +69,8 @@ ggandiva_function_registry_set_property(GObject *object, switch (prop_id) { case PROP_FUNCTION_REGISTRY: - priv->function_registry = - *static_cast *>( - g_value_get_pointer(value)); + priv->function_registry = *static_cast *>( + g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -83,7 +82,7 @@ static void ggandiva_function_registry_init(GGandivaFunctionRegistry *object) { auto priv = GGANDIVA_FUNCTION_REGISTRY_GET_PRIVATE(object); - new(&priv->function_registry) std::shared_ptr; + new (&priv->function_registry) std::shared_ptr; } static void @@ -94,11 +93,11 @@ ggandiva_function_registry_class_init(GGandivaFunctionRegistryClass *klass) gobject_class->set_property = ggandiva_function_registry_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("function-registry", - "Function registry", - "The raw std::shared_ptr *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "function-registry", + "Function registry", + "The raw std::shared_ptr *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_FUNCTION_REGISTRY, spec); } @@ -144,8 +143,7 @@ GGandivaNativeFunction * ggandiva_function_registry_lookup(GGandivaFunctionRegistry *function_registry, GGandivaFunctionSignature *function_signature) { - auto gandiva_function_registry = - ggandiva_function_registry_get_raw(function_registry); + auto gandiva_function_registry = ggandiva_function_registry_get_raw(function_registry); auto gandiva_function_signature = ggandiva_function_signature_get_raw(function_signature); auto gandiva_native_function = @@ -167,10 +165,10 @@ ggandiva_function_registry_lookup(GGandivaFunctionRegistry *function_registry, * Since: 0.14.0 */ GList * -ggandiva_function_registry_get_native_functions(GGandivaFunctionRegistry *function_registry) +ggandiva_function_registry_get_native_functions( + GGandivaFunctionRegistry *function_registry) { - auto gandiva_function_registry = - ggandiva_function_registry_get_raw(function_registry); + auto gandiva_function_registry = ggandiva_function_registry_get_raw(function_registry); GList *native_functions = nullptr; for (const auto &gandiva_native_function : *gandiva_function_registry) { auto native_function = ggandiva_native_function_new_raw(&gandiva_native_function); @@ -183,12 +181,12 @@ G_END_DECLS GGandivaFunctionRegistry * ggandiva_function_registry_new_raw( - std::shared_ptr *gandiva_function_registry) + std::shared_ptr *gandiva_function_registry) { - return GGANDIVA_FUNCTION_REGISTRY( - g_object_new(GGANDIVA_TYPE_FUNCTION_REGISTRY, - "function-registry", gandiva_function_registry, - nullptr)); + return GGANDIVA_FUNCTION_REGISTRY(g_object_new(GGANDIVA_TYPE_FUNCTION_REGISTRY, + "function-registry", + gandiva_function_registry, + nullptr)); } std::shared_ptr @@ -197,4 +195,3 @@ ggandiva_function_registry_get_raw(GGandivaFunctionRegistry *function_registry) auto priv = GGANDIVA_FUNCTION_REGISTRY_GET_PRIVATE(function_registry); return priv->function_registry; } - diff --git a/c_glib/gandiva-glib/function-registry.h b/c_glib/gandiva-glib/function-registry.h index 8ff6027cf1734..ed21e120a2533 100644 --- a/c_glib/gandiva-glib/function-registry.h +++ b/c_glib/gandiva-glib/function-registry.h @@ -36,11 +36,15 @@ struct _GGandivaFunctionRegistryClass }; GARROW_AVAILABLE_IN_15_0 -GGandivaFunctionRegistry *ggandiva_function_registry_default(void); -GGandivaFunctionRegistry *ggandiva_function_registry_new(void); +GGandivaFunctionRegistry * +ggandiva_function_registry_default(void); +GGandivaFunctionRegistry * +ggandiva_function_registry_new(void); GGandivaNativeFunction * ggandiva_function_registry_lookup(GGandivaFunctionRegistry *function_registry, GGandivaFunctionSignature *function_signature); -GList *ggandiva_function_registry_get_native_functions(GGandivaFunctionRegistry *function_registry); +GList * +ggandiva_function_registry_get_native_functions( + GGandivaFunctionRegistry *function_registry); G_END_DECLS diff --git a/c_glib/gandiva-glib/function-signature.cpp b/c_glib/gandiva-glib/function-signature.cpp index be37e8bfd76b0..5306ac6d2644a 100644 --- a/c_glib/gandiva-glib/function-signature.cpp +++ b/c_glib/gandiva-glib/function-signature.cpp @@ -32,7 +32,8 @@ G_BEGIN_DECLS * Since: 0.14.0 */ -typedef struct GGandivaFunctionSignaturePrivate_ { +typedef struct GGandivaFunctionSignaturePrivate_ +{ gandiva::FunctionSignature function_signature; } GGandivaFunctionSignaturePrivate; @@ -44,10 +45,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GGandivaFunctionSignature, ggandiva_function_signature, G_TYPE_OBJECT) -#define GGANDIVA_FUNCTION_SIGNATURE_GET_PRIVATE(obj) \ - static_cast( \ - ggandiva_function_signature_get_instance_private( \ - GGANDIVA_FUNCTION_SIGNATURE(obj))) +#define GGANDIVA_FUNCTION_SIGNATURE_GET_PRIVATE(obj) \ + static_cast( \ + ggandiva_function_signature_get_instance_private(GGANDIVA_FUNCTION_SIGNATURE(obj))) static void ggandiva_function_signature_set_property(GObject *object, @@ -80,11 +80,11 @@ ggandiva_function_signature_class_init(GGandivaFunctionSignatureClass *klass) gobject_class->set_property = ggandiva_function_signature_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("function-signature", - "FunctionSignature", - "The raw gandiva::FunctionSignature *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "function-signature", + "FunctionSignature", + "The raw gandiva::FunctionSignature *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_FUNCTION_SIGNATURE, spec); } @@ -227,7 +227,8 @@ ggandiva_function_signature_get_param_types(GGandivaFunctionSignature *function_ G_END_DECLS GGandivaFunctionSignature * -ggandiva_function_signature_new_raw(const gandiva::FunctionSignature *gandiva_function_signature) +ggandiva_function_signature_new_raw( + const gandiva::FunctionSignature *gandiva_function_signature) { auto function_signature = GGANDIVA_FUNCTION_SIGNATURE(g_object_new(GGANDIVA_TYPE_FUNCTION_SIGNATURE, diff --git a/c_glib/gandiva-glib/function-signature.h b/c_glib/gandiva-glib/function-signature.h index b1099ff99da00..ef6834ea85723 100644 --- a/c_glib/gandiva-glib/function-signature.h +++ b/c_glib/gandiva-glib/function-signature.h @@ -35,14 +35,22 @@ struct _GGandivaFunctionSignatureClass GObjectClass parent_class; }; -GGandivaFunctionSignature *ggandiva_function_signature_new(const gchar *base_name, - GList *parameter_types, - GArrowDataType *return_type); -gboolean ggandiva_function_signature_equal(GGandivaFunctionSignature *function_signature, - GGandivaFunctionSignature *other_function_signature); -gchar *ggandiva_function_signature_to_string(GGandivaFunctionSignature *function_signature); -GArrowDataType *ggandiva_function_signature_get_return_type(GGandivaFunctionSignature *function_signature); -gchar *ggandiva_function_signature_get_base_name(GGandivaFunctionSignature *function_signature); -GList *ggandiva_function_signature_get_param_types(GGandivaFunctionSignature *function_signature); +GGandivaFunctionSignature * +ggandiva_function_signature_new(const gchar *base_name, + GList *parameter_types, + GArrowDataType *return_type); +gboolean +ggandiva_function_signature_equal(GGandivaFunctionSignature *function_signature, + GGandivaFunctionSignature *other_function_signature); +gchar * +ggandiva_function_signature_to_string(GGandivaFunctionSignature *function_signature); +GArrowDataType * +ggandiva_function_signature_get_return_type( + GGandivaFunctionSignature *function_signature); +gchar * +ggandiva_function_signature_get_base_name(GGandivaFunctionSignature *function_signature); +GList * +ggandiva_function_signature_get_param_types( + GGandivaFunctionSignature *function_signature); G_END_DECLS diff --git a/c_glib/gandiva-glib/function-signature.hpp b/c_glib/gandiva-glib/function-signature.hpp index 24f71e6bc9d97..415302b70e541 100644 --- a/c_glib/gandiva-glib/function-signature.hpp +++ b/c_glib/gandiva-glib/function-signature.hpp @@ -23,5 +23,8 @@ #include -GGandivaFunctionSignature *ggandiva_function_signature_new_raw(const gandiva::FunctionSignature *gandiva_function_signature); -const gandiva::FunctionSignature *ggandiva_function_signature_get_raw(GGandivaFunctionSignature *signature); +GGandivaFunctionSignature * +ggandiva_function_signature_new_raw( + const gandiva::FunctionSignature *gandiva_function_signature); +const gandiva::FunctionSignature * +ggandiva_function_signature_get_raw(GGandivaFunctionSignature *signature); diff --git a/c_glib/gandiva-glib/native-function.cpp b/c_glib/gandiva-glib/native-function.cpp index 0755ad1d62cab..e5961f77088a6 100644 --- a/c_glib/gandiva-glib/native-function.cpp +++ b/c_glib/gandiva-glib/native-function.cpp @@ -32,7 +32,8 @@ G_BEGIN_DECLS * Since: 0.14.0 */ -typedef struct GGandivaNativeFunctionPrivate_ { +typedef struct GGandivaNativeFunctionPrivate_ +{ const gandiva::NativeFunction *native_function; } GGandivaNativeFunctionPrivate; @@ -44,10 +45,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GGandivaNativeFunction, ggandiva_native_function, G_TYPE_OBJECT) -#define GGANDIVA_NATIVE_FUNCTION_GET_PRIVATE(obj) \ - static_cast( \ - ggandiva_native_function_get_instance_private( \ - GGANDIVA_NATIVE_FUNCTION(obj))) +#define GGANDIVA_NATIVE_FUNCTION_GET_PRIVATE(obj) \ + static_cast( \ + ggandiva_native_function_get_instance_private(GGANDIVA_NATIVE_FUNCTION(obj))) static void ggandiva_native_function_set_property(GObject *object, @@ -80,11 +80,11 @@ ggandiva_native_function_class_init(GGandivaNativeFunctionClass *klass) gobject_class->set_property = ggandiva_native_function_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("native-function", - "NativeFunction", - "The raw gandiva::NativeFunction *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "native-function", + "NativeFunction", + "The raw gandiva::NativeFunction *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_NATIVE_FUNCTION, spec); } @@ -100,8 +100,7 @@ ggandiva_native_function_class_init(GGandivaNativeFunctionClass *klass) GList * ggandiva_native_function_get_signatures(GGandivaNativeFunction *native_function) { - auto gandiva_native_function = - ggandiva_native_function_get_raw(native_function); + auto gandiva_native_function = ggandiva_native_function_get_raw(native_function); GList *signatures = nullptr; for (auto &gandiva_signature : gandiva_native_function->signatures()) { auto signature = ggandiva_function_signature_new_raw(&gandiva_signature); @@ -123,8 +122,7 @@ gboolean ggandiva_native_function_equal(GGandivaNativeFunction *native_function, GGandivaNativeFunction *other_native_function) { - auto gandiva_native_function = - ggandiva_native_function_get_raw(native_function); + auto gandiva_native_function = ggandiva_native_function_get_raw(native_function); auto gandiva_other_native_function = ggandiva_native_function_get_raw(other_native_function); return gandiva_native_function == gandiva_other_native_function; @@ -143,17 +141,14 @@ ggandiva_native_function_equal(GGandivaNativeFunction *native_function, gchar * ggandiva_native_function_to_string(GGandivaNativeFunction *native_function) { - auto gandiva_native_function = - ggandiva_native_function_get_raw(native_function); + auto gandiva_native_function = ggandiva_native_function_get_raw(native_function); auto string = g_string_new(NULL); for (auto &gandiva_signature : gandiva_native_function->signatures()) { if (string->len > 0) { g_string_append(string, ", "); } const auto &signature_string = gandiva_signature.ToString(); - g_string_append_len(string, - signature_string.data(), - signature_string.length()); + g_string_append_len(string, signature_string.data(), signature_string.length()); } return g_string_free(string, FALSE); } @@ -170,8 +165,7 @@ ggandiva_native_function_to_string(GGandivaNativeFunction *native_function) GGandivaResultNullableType ggandiva_native_function_get_result_nullable_type(GGandivaNativeFunction *native_function) { - auto gandiva_native_function = - ggandiva_native_function_get_raw(native_function); + auto gandiva_native_function = ggandiva_native_function_get_raw(native_function); const auto gandiva_result_nullable_type = gandiva_native_function->result_nullable_type(); return ggandiva_result_nullable_type_from_raw(gandiva_result_nullable_type); @@ -190,8 +184,7 @@ ggandiva_native_function_get_result_nullable_type(GGandivaNativeFunction *native gboolean ggandiva_native_function_need_context(GGandivaNativeFunction *native_function) { - auto gandiva_native_function = - ggandiva_native_function_get_raw(native_function); + auto gandiva_native_function = ggandiva_native_function_get_raw(native_function); return gandiva_native_function->NeedsContext(); } @@ -208,8 +201,7 @@ ggandiva_native_function_need_context(GGandivaNativeFunction *native_function) gboolean ggandiva_native_function_need_function_holder(GGandivaNativeFunction *native_function) { - auto gandiva_native_function = - ggandiva_native_function_get_raw(native_function); + auto gandiva_native_function = ggandiva_native_function_get_raw(native_function); return gandiva_native_function->NeedsFunctionHolder(); } @@ -226,8 +218,7 @@ ggandiva_native_function_need_function_holder(GGandivaNativeFunction *native_fun gboolean ggandiva_native_function_can_return_errors(GGandivaNativeFunction *native_function) { - auto gandiva_native_function = - ggandiva_native_function_get_raw(native_function); + auto gandiva_native_function = ggandiva_native_function_get_raw(native_function); return gandiva_native_function->CanReturnErrors(); } diff --git a/c_glib/gandiva-glib/native-function.h b/c_glib/gandiva-glib/native-function.h index 8b4d6a44c80ce..5ceef396ef40c 100644 --- a/c_glib/gandiva-glib/native-function.h +++ b/c_glib/gandiva-glib/native-function.h @@ -40,11 +40,8 @@ typedef enum { } GGandivaResultNullableType; #define GGANDIVA_TYPE_NATIVE_FUNCTION (ggandiva_native_function_get_type()) -G_DECLARE_DERIVABLE_TYPE(GGandivaNativeFunction, - ggandiva_native_function, - GGANDIVA, - NATIVE_FUNCTION, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GGandivaNativeFunction, ggandiva_native_function, GGANDIVA, NATIVE_FUNCTION, GObject) struct _GGandivaNativeFunctionClass { @@ -56,10 +53,16 @@ ggandiva_native_function_get_signatures(GGandivaNativeFunction *native_function) gboolean ggandiva_native_function_equal(GGandivaNativeFunction *native_function, GGandivaNativeFunction *other_native_function); -gchar *ggandiva_native_function_to_string(GGandivaNativeFunction *native_function); -GGandivaResultNullableType ggandiva_native_function_get_result_nullable_type(GGandivaNativeFunction *native_function); -gboolean ggandiva_native_function_need_context(GGandivaNativeFunction *native_function); -gboolean ggandiva_native_function_need_function_holder(GGandivaNativeFunction *native_function); -gboolean ggandiva_native_function_can_return_errors(GGandivaNativeFunction *native_function); +gchar * +ggandiva_native_function_to_string(GGandivaNativeFunction *native_function); +GGandivaResultNullableType +ggandiva_native_function_get_result_nullable_type( + GGandivaNativeFunction *native_function); +gboolean +ggandiva_native_function_need_context(GGandivaNativeFunction *native_function); +gboolean +ggandiva_native_function_need_function_holder(GGandivaNativeFunction *native_function); +gboolean +ggandiva_native_function_can_return_errors(GGandivaNativeFunction *native_function); G_END_DECLS diff --git a/c_glib/gandiva-glib/native-function.hpp b/c_glib/gandiva-glib/native-function.hpp index 76119ca400f18..2a1ff7a1e3537 100644 --- a/c_glib/gandiva-glib/native-function.hpp +++ b/c_glib/gandiva-glib/native-function.hpp @@ -30,7 +30,9 @@ ggandiva_result_nullable_type_from_raw(gandiva::ResultNullableType gandiva_type) gandiva::ResultNullableType ggandiva_result_nullable_type_to_raw(GGandivaResultNullableType type); -GGandivaNativeFunction *ggandiva_native_function_new_raw(const gandiva::NativeFunction *gandiva_native_function); -const gandiva::NativeFunction *ggandiva_native_function_get_raw(GGandivaNativeFunction *native_function); +GGandivaNativeFunction * +ggandiva_native_function_new_raw(const gandiva::NativeFunction *gandiva_native_function); +const gandiva::NativeFunction * +ggandiva_native_function_get_raw(GGandivaNativeFunction *native_function); G_END_DECLS diff --git a/c_glib/gandiva-glib/node.cpp b/c_glib/gandiva-glib/node.cpp index 1ced7754a707a..e83dc41e9274b 100644 --- a/c_glib/gandiva-glib/node.cpp +++ b/c_glib/gandiva-glib/node.cpp @@ -27,8 +27,8 @@ template const Type & ggandiva_literal_node_get(GGandivaLiteralNode *node) { - auto gandiva_literal_node = - std::static_pointer_cast(ggandiva_node_get_raw(GGANDIVA_NODE(node))); + auto gandiva_literal_node = std::static_pointer_cast( + ggandiva_node_get_raw(GGANDIVA_NODE(node))); return std::get(gandiva_literal_node->holder()); } @@ -42,9 +42,11 @@ G_BEGIN_DECLS * * #GGandivaNode is a base class for a node in the expression tree. * - * #GGandivaFieldNode is a class for a node in the expression tree, representing an Arrow field. + * #GGandivaFieldNode is a class for a node in the expression tree, representing an Arrow + * field. * - * #GGandivaFunctionNode is a class for a node in the expression tree, representing a function. + * #GGandivaFunctionNode is a class for a node in the expression tree, representing a + * function. * * #GGandivaLiteralNode is a base class for a node in the expression tree, * representing a literal. @@ -93,7 +95,8 @@ G_BEGIN_DECLS * * #GGandivaIfNode is a class for a node in the expression tree, representing an if-else. * - * #GGandivaBooleanNode is a class for a node in the expression tree, representing a boolean. + * #GGandivaBooleanNode is a class for a node in the expression tree, representing a + * boolean. * * #GGandivaAndNode is a class for a node in the expression tree, representing an AND. * @@ -102,7 +105,8 @@ G_BEGIN_DECLS * Since: 0.12.0 */ -typedef struct GGandivaNodePrivate_ { +typedef struct GGandivaNodePrivate_ +{ std::shared_ptr node; GArrowDataType *return_type; } GGandivaNodePrivate; @@ -112,14 +116,11 @@ enum { PROP_RETURN_TYPE }; -G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GGandivaNode, - ggandiva_node, - G_TYPE_OBJECT) +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GGandivaNode, ggandiva_node, G_TYPE_OBJECT) -#define GGANDIVA_NODE_GET_PRIVATE(object) \ - static_cast( \ - ggandiva_node_get_instance_private( \ - GGANDIVA_NODE(object))) +#define GGANDIVA_NODE_GET_PRIVATE(object) \ + static_cast( \ + ggandiva_node_get_instance_private(GGANDIVA_NODE(object))) static void ggandiva_node_dispose(GObject *object) @@ -188,7 +189,7 @@ static void ggandiva_node_init(GGandivaNode *object) { auto priv = GGANDIVA_NODE_GET_PRIVATE(object); - new(&priv->node) std::shared_ptr; + new (&priv->node) std::shared_ptr; } static void @@ -196,25 +197,25 @@ ggandiva_node_class_init(GGandivaNodeClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = ggandiva_node_dispose; - gobject_class->finalize = ggandiva_node_finalize; + gobject_class->dispose = ggandiva_node_dispose; + gobject_class->finalize = ggandiva_node_finalize; gobject_class->set_property = ggandiva_node_set_property; gobject_class->get_property = ggandiva_node_get_property; GParamSpec *spec; - spec = g_param_spec_pointer("node", - "Node", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "node", + "Node", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_NODE, spec); - spec = g_param_spec_object("return-type", - "Return type", - "The return type", - GARROW_TYPE_DATA_TYPE, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "return-type", + "Return type", + "The return type", + GARROW_TYPE_DATA_TYPE, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_RETURN_TYPE, spec); } @@ -236,7 +237,8 @@ ggandiva_node_to_string(GGandivaNode *node) return g_strndup(string.data(), string.size()); } -typedef struct GGandivaFieldNodePrivate_ { +typedef struct GGandivaFieldNodePrivate_ +{ GArrowField *field; } GGandivaFieldNodePrivate; @@ -244,14 +246,11 @@ enum { PROP_FIELD = 1 }; -G_DEFINE_TYPE_WITH_PRIVATE(GGandivaFieldNode, - ggandiva_field_node, - GGANDIVA_TYPE_NODE) +G_DEFINE_TYPE_WITH_PRIVATE(GGandivaFieldNode, ggandiva_field_node, GGANDIVA_TYPE_NODE) -#define GGANDIVA_FIELD_NODE_GET_PRIVATE(object) \ - static_cast( \ - ggandiva_field_node_get_instance_private( \ - GGANDIVA_FIELD_NODE(object))) +#define GGANDIVA_FIELD_NODE_GET_PRIVATE(object) \ + static_cast( \ + ggandiva_field_node_get_instance_private(GGANDIVA_FIELD_NODE(object))) static void ggandiva_field_node_dispose(GObject *object) @@ -312,17 +311,17 @@ ggandiva_field_node_class_init(GGandivaFieldNodeClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = ggandiva_field_node_dispose; + gobject_class->dispose = ggandiva_field_node_dispose; gobject_class->set_property = ggandiva_field_node_set_property; gobject_class->get_property = ggandiva_field_node_get_property; GParamSpec *spec; - spec = g_param_spec_object("field", - "Field", - "The field", - GARROW_TYPE_FIELD, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "field", + "Field", + "The field", + GARROW_TYPE_FIELD, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_FIELD, spec); } @@ -342,8 +341,8 @@ ggandiva_field_node_new(GArrowField *field) return ggandiva_field_node_new_raw(&gandiva_node, field); } - -typedef struct GGandivaFunctionNodePrivate_ { +typedef struct GGandivaFunctionNodePrivate_ +{ gchar *name; GList *parameters; } GGandivaFunctionNodePrivate; @@ -356,10 +355,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GGandivaFunctionNode, ggandiva_function_node, GGANDIVA_TYPE_NODE) -#define GGANDIVA_FUNCTION_NODE_GET_PRIVATE(object) \ - static_cast( \ - ggandiva_function_node_get_instance_private( \ - GGANDIVA_FUNCTION_NODE(object))) \ +#define GGANDIVA_FUNCTION_NODE_GET_PRIVATE(object) \ + static_cast( \ + ggandiva_function_node_get_instance_private(GGANDIVA_FUNCTION_NODE(object))) static void ggandiva_function_node_dispose(GObject *object) @@ -436,18 +434,18 @@ ggandiva_function_node_class_init(GGandivaFunctionNodeClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = ggandiva_function_node_dispose; - gobject_class->finalize = ggandiva_function_node_finalize; + gobject_class->dispose = ggandiva_function_node_dispose; + gobject_class->finalize = ggandiva_function_node_finalize; gobject_class->set_property = ggandiva_function_node_set_property; gobject_class->get_property = ggandiva_function_node_get_property; GParamSpec *spec; - spec = g_param_spec_string("name", - "Name", - "The name of the function", - nullptr, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_string( + "name", + "Name", + "The name of the function", + nullptr, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_NAME, spec); } @@ -472,13 +470,9 @@ ggandiva_function_node_new(const gchar *name, gandiva_nodes.push_back(gandiva_node); } auto arrow_return_type = garrow_data_type_get_raw(return_type); - auto gandiva_node = gandiva::TreeExprBuilder::MakeFunction(name, - gandiva_nodes, - arrow_return_type); - return ggandiva_function_node_new_raw(&gandiva_node, - name, - parameters, - return_type); + auto gandiva_node = + gandiva::TreeExprBuilder::MakeFunction(name, gandiva_nodes, arrow_return_type); + return ggandiva_function_node_new_raw(&gandiva_node, name, parameters, return_type); } /** @@ -497,10 +491,7 @@ ggandiva_function_node_get_parameters(GGandivaFunctionNode *node) return priv->parameters; } - -G_DEFINE_TYPE(GGandivaLiteralNode, - ggandiva_literal_node, - GGANDIVA_TYPE_NODE) +G_DEFINE_TYPE(GGandivaLiteralNode, ggandiva_literal_node, GGANDIVA_TYPE_NODE) static void ggandiva_literal_node_init(GGandivaLiteralNode *literal_node) @@ -512,7 +503,6 @@ ggandiva_literal_node_class_init(GGandivaLiteralNodeClass *klass) { } - G_DEFINE_TYPE(GGandivaNullLiteralNode, ggandiva_null_literal_node, GGANDIVA_TYPE_LITERAL_NODE) @@ -538,8 +528,7 @@ ggandiva_null_literal_node_class_init(GGandivaNullLiteralNodeClass *klass) * Since: 0.12.0 */ GGandivaNullLiteralNode * -ggandiva_null_literal_node_new(GArrowDataType *return_type, - GError **error) +ggandiva_null_literal_node_new(GArrowDataType *return_type, GError **error) { auto arrow_return_type = garrow_data_type_get_raw(return_type); auto gandiva_node = gandiva::TreeExprBuilder::MakeNull(arrow_return_type); @@ -552,11 +541,10 @@ ggandiva_null_literal_node_new(GArrowDataType *return_type, arrow_return_type->ToString().c_str()); return NULL; } - return GGANDIVA_NULL_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, - return_type)); + return GGANDIVA_NULL_LITERAL_NODE( + ggandiva_literal_node_new_raw(&gandiva_node, return_type)); } - G_DEFINE_TYPE(GGandivaBooleanLiteralNode, ggandiva_boolean_literal_node, GGANDIVA_TYPE_LITERAL_NODE) @@ -583,8 +571,8 @@ GGandivaBooleanLiteralNode * ggandiva_boolean_literal_node_new(gboolean value) { auto gandiva_node = gandiva::TreeExprBuilder::MakeLiteral(static_cast(value)); - return GGANDIVA_BOOLEAN_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, - NULL)); + return GGANDIVA_BOOLEAN_LITERAL_NODE( + ggandiva_literal_node_new_raw(&gandiva_node, NULL)); } /** @@ -602,7 +590,6 @@ ggandiva_boolean_literal_node_get_value(GGandivaBooleanLiteralNode *node) return static_cast(value); } - G_DEFINE_TYPE(GGandivaInt8LiteralNode, ggandiva_int8_literal_node, GGANDIVA_TYPE_LITERAL_NODE) @@ -629,8 +616,7 @@ GGandivaInt8LiteralNode * ggandiva_int8_literal_node_new(gint8 value) { auto gandiva_node = gandiva::TreeExprBuilder::MakeLiteral(value); - return GGANDIVA_INT8_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, - NULL)); + return GGANDIVA_INT8_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, NULL)); } /** @@ -647,7 +633,6 @@ ggandiva_int8_literal_node_get_value(GGandivaInt8LiteralNode *node) return ggandiva_literal_node_get(GGANDIVA_LITERAL_NODE(node)); } - G_DEFINE_TYPE(GGandivaUInt8LiteralNode, ggandiva_uint8_literal_node, GGANDIVA_TYPE_LITERAL_NODE) @@ -674,8 +659,7 @@ GGandivaUInt8LiteralNode * ggandiva_uint8_literal_node_new(guint8 value) { auto gandiva_node = gandiva::TreeExprBuilder::MakeLiteral(value); - return GGANDIVA_UINT8_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, - NULL)); + return GGANDIVA_UINT8_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, NULL)); } /** @@ -692,7 +676,6 @@ ggandiva_uint8_literal_node_get_value(GGandivaUInt8LiteralNode *node) return ggandiva_literal_node_get(GGANDIVA_LITERAL_NODE(node)); } - G_DEFINE_TYPE(GGandivaInt16LiteralNode, ggandiva_int16_literal_node, GGANDIVA_TYPE_LITERAL_NODE) @@ -719,8 +702,7 @@ GGandivaInt16LiteralNode * ggandiva_int16_literal_node_new(gint16 value) { auto gandiva_node = gandiva::TreeExprBuilder::MakeLiteral(value); - return GGANDIVA_INT16_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, - NULL)); + return GGANDIVA_INT16_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, NULL)); } /** @@ -737,7 +719,6 @@ ggandiva_int16_literal_node_get_value(GGandivaInt16LiteralNode *node) return ggandiva_literal_node_get(GGANDIVA_LITERAL_NODE(node)); } - G_DEFINE_TYPE(GGandivaUInt16LiteralNode, ggandiva_uint16_literal_node, GGANDIVA_TYPE_LITERAL_NODE) @@ -764,8 +745,7 @@ GGandivaUInt16LiteralNode * ggandiva_uint16_literal_node_new(guint16 value) { auto gandiva_node = gandiva::TreeExprBuilder::MakeLiteral(value); - return GGANDIVA_UINT16_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, - NULL)); + return GGANDIVA_UINT16_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, NULL)); } /** @@ -782,7 +762,6 @@ ggandiva_uint16_literal_node_get_value(GGandivaUInt16LiteralNode *node) return ggandiva_literal_node_get(GGANDIVA_LITERAL_NODE(node)); } - G_DEFINE_TYPE(GGandivaInt32LiteralNode, ggandiva_int32_literal_node, GGANDIVA_TYPE_LITERAL_NODE) @@ -809,8 +788,7 @@ GGandivaInt32LiteralNode * ggandiva_int32_literal_node_new(gint32 value) { auto gandiva_node = gandiva::TreeExprBuilder::MakeLiteral(value); - return GGANDIVA_INT32_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, - NULL)); + return GGANDIVA_INT32_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, NULL)); } /** @@ -827,7 +805,6 @@ ggandiva_int32_literal_node_get_value(GGandivaInt32LiteralNode *node) return ggandiva_literal_node_get(GGANDIVA_LITERAL_NODE(node)); } - G_DEFINE_TYPE(GGandivaUInt32LiteralNode, ggandiva_uint32_literal_node, GGANDIVA_TYPE_LITERAL_NODE) @@ -854,8 +831,7 @@ GGandivaUInt32LiteralNode * ggandiva_uint32_literal_node_new(guint32 value) { auto gandiva_node = gandiva::TreeExprBuilder::MakeLiteral(value); - return GGANDIVA_UINT32_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, - NULL)); + return GGANDIVA_UINT32_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, NULL)); } /** @@ -872,7 +848,6 @@ ggandiva_uint32_literal_node_get_value(GGandivaUInt32LiteralNode *node) return ggandiva_literal_node_get(GGANDIVA_LITERAL_NODE(node)); } - G_DEFINE_TYPE(GGandivaInt64LiteralNode, ggandiva_int64_literal_node, GGANDIVA_TYPE_LITERAL_NODE) @@ -899,8 +874,7 @@ GGandivaInt64LiteralNode * ggandiva_int64_literal_node_new(gint64 value) { auto gandiva_node = gandiva::TreeExprBuilder::MakeLiteral(value); - return GGANDIVA_INT64_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, - NULL)); + return GGANDIVA_INT64_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, NULL)); } /** @@ -917,7 +891,6 @@ ggandiva_int64_literal_node_get_value(GGandivaInt64LiteralNode *node) return ggandiva_literal_node_get(GGANDIVA_LITERAL_NODE(node)); } - G_DEFINE_TYPE(GGandivaUInt64LiteralNode, ggandiva_uint64_literal_node, GGANDIVA_TYPE_LITERAL_NODE) @@ -944,8 +917,7 @@ GGandivaUInt64LiteralNode * ggandiva_uint64_literal_node_new(guint64 value) { auto gandiva_node = gandiva::TreeExprBuilder::MakeLiteral(value); - return GGANDIVA_UINT64_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, - NULL)); + return GGANDIVA_UINT64_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, NULL)); } /** @@ -962,7 +934,6 @@ ggandiva_uint64_literal_node_get_value(GGandivaUInt64LiteralNode *node) return ggandiva_literal_node_get(GGANDIVA_LITERAL_NODE(node)); } - G_DEFINE_TYPE(GGandivaFloatLiteralNode, ggandiva_float_literal_node, GGANDIVA_TYPE_LITERAL_NODE) @@ -989,8 +960,7 @@ GGandivaFloatLiteralNode * ggandiva_float_literal_node_new(gfloat value) { auto gandiva_node = gandiva::TreeExprBuilder::MakeLiteral(value); - return GGANDIVA_FLOAT_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, - NULL)); + return GGANDIVA_FLOAT_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, NULL)); } /** @@ -1007,7 +977,6 @@ ggandiva_float_literal_node_get_value(GGandivaFloatLiteralNode *node) return ggandiva_literal_node_get(GGANDIVA_LITERAL_NODE(node)); } - G_DEFINE_TYPE(GGandivaDoubleLiteralNode, ggandiva_double_literal_node, GGANDIVA_TYPE_LITERAL_NODE) @@ -1034,8 +1003,7 @@ GGandivaDoubleLiteralNode * ggandiva_double_literal_node_new(gdouble value) { auto gandiva_node = gandiva::TreeExprBuilder::MakeLiteral(value); - return GGANDIVA_DOUBLE_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, - NULL)); + return GGANDIVA_DOUBLE_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, NULL)); } /** @@ -1052,8 +1020,8 @@ ggandiva_double_literal_node_get_value(GGandivaDoubleLiteralNode *node) return ggandiva_literal_node_get(GGANDIVA_LITERAL_NODE(node)); } - -typedef struct GGandivaBinaryLiteralNodePrivate_ { +typedef struct GGandivaBinaryLiteralNodePrivate_ +{ GBytes *value; } GGandivaBinaryLiteralNodePrivate; @@ -1061,9 +1029,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GGandivaBinaryLiteralNode, ggandiva_binary_literal_node, GGANDIVA_TYPE_LITERAL_NODE) -#define GGANDIVA_BINARY_LITERAL_NODE_GET_PRIVATE(object) \ - static_cast( \ - ggandiva_binary_literal_node_get_instance_private( \ +#define GGANDIVA_BINARY_LITERAL_NODE_GET_PRIVATE(object) \ + static_cast( \ + ggandiva_binary_literal_node_get_instance_private( \ GGANDIVA_BINARY_LITERAL_NODE(object))) static void @@ -1102,14 +1070,11 @@ ggandiva_binary_literal_node_class_init(GGandivaBinaryLiteralNodeClass *klass) * Since: 0.12.0 */ GGandivaBinaryLiteralNode * -ggandiva_binary_literal_node_new(const guint8 *value, - gsize size) +ggandiva_binary_literal_node_new(const guint8 *value, gsize size) { - auto gandiva_node = - gandiva::TreeExprBuilder::MakeBinaryLiteral(std::string(reinterpret_cast(value), - size)); - return GGANDIVA_BINARY_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, - NULL)); + auto gandiva_node = gandiva::TreeExprBuilder::MakeBinaryLiteral( + std::string(reinterpret_cast(value), size)); + return GGANDIVA_BINARY_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, NULL)); } /** @@ -1125,12 +1090,9 @@ ggandiva_binary_literal_node_new_bytes(GBytes *value) { size_t value_size; auto raw_value = g_bytes_get_data(value, &value_size); - auto gandiva_node = - gandiva::TreeExprBuilder::MakeBinaryLiteral( - std::string(reinterpret_cast(raw_value), - value_size)); - auto literal_node = ggandiva_literal_node_new_raw(&gandiva_node, - NULL); + auto gandiva_node = gandiva::TreeExprBuilder::MakeBinaryLiteral( + std::string(reinterpret_cast(raw_value), value_size)); + auto literal_node = ggandiva_literal_node_new_raw(&gandiva_node, NULL); auto priv = GGANDIVA_BINARY_LITERAL_NODE_GET_PRIVATE(literal_node); priv->value = value; g_bytes_ref(priv->value); @@ -1157,7 +1119,6 @@ ggandiva_binary_literal_node_get_value(GGandivaBinaryLiteralNode *node) return priv->value; } - G_DEFINE_TYPE(GGandivaStringLiteralNode, ggandiva_string_literal_node, GGANDIVA_TYPE_LITERAL_NODE) @@ -1184,8 +1145,7 @@ GGandivaStringLiteralNode * ggandiva_string_literal_node_new(const gchar *value) { auto gandiva_node = gandiva::TreeExprBuilder::MakeStringLiteral(value); - return GGANDIVA_STRING_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, - NULL)); + return GGANDIVA_STRING_LITERAL_NODE(ggandiva_literal_node_new_raw(&gandiva_node, NULL)); } /** @@ -1203,8 +1163,8 @@ ggandiva_string_literal_node_get_value(GGandivaStringLiteralNode *node) return value.c_str(); } - -typedef struct GGandivaIfNodePrivate_ { +typedef struct GGandivaIfNodePrivate_ +{ GGandivaNode *condition_node; GGandivaNode *then_node; GGandivaNode *else_node; @@ -1216,14 +1176,11 @@ enum { PROP_ELSE_NODE, }; -G_DEFINE_TYPE_WITH_PRIVATE(GGandivaIfNode, - ggandiva_if_node, - GGANDIVA_TYPE_NODE) +G_DEFINE_TYPE_WITH_PRIVATE(GGandivaIfNode, ggandiva_if_node, GGANDIVA_TYPE_NODE) -#define GGANDIVA_IF_NODE_GET_PRIVATE(object) \ - static_cast( \ - ggandiva_if_node_get_instance_private( \ - GGANDIVA_IF_NODE(object))) +#define GGANDIVA_IF_NODE_GET_PRIVATE(object) \ + static_cast( \ + ggandiva_if_node_get_instance_private(GGANDIVA_IF_NODE(object))) static void ggandiva_if_node_dispose(GObject *object) @@ -1306,33 +1263,33 @@ ggandiva_if_node_class_init(GGandivaIfNodeClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = ggandiva_if_node_dispose; + gobject_class->dispose = ggandiva_if_node_dispose; gobject_class->set_property = ggandiva_if_node_set_property; gobject_class->get_property = ggandiva_if_node_get_property; GParamSpec *spec; - spec = g_param_spec_object("condition-node", - "Condition node", - "The condition node", - GGANDIVA_TYPE_NODE, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "condition-node", + "Condition node", + "The condition node", + GGANDIVA_TYPE_NODE, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_CONDITION_NODE, spec); - spec = g_param_spec_object("then-node", - "Then node", - "The then node", - GGANDIVA_TYPE_NODE, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "then-node", + "Then node", + "The then node", + GGANDIVA_TYPE_NODE, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_THEN_NODE, spec); - spec = g_param_spec_object("else-node", - "Else node", - "The else node", - GGANDIVA_TYPE_NODE, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "else-node", + "Else node", + "The else node", + GGANDIVA_TYPE_NODE, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_ELSE_NODE, spec); } @@ -1391,19 +1348,16 @@ ggandiva_if_node_new(GGandivaNode *condition_node, return_type); } - -typedef struct GGandivaBooleanNodePrivate_ { +typedef struct GGandivaBooleanNodePrivate_ +{ GList *children; } GGandivaBooleanNodePrivate; -G_DEFINE_TYPE_WITH_PRIVATE(GGandivaBooleanNode, - ggandiva_boolean_node, - GGANDIVA_TYPE_NODE) +G_DEFINE_TYPE_WITH_PRIVATE(GGandivaBooleanNode, ggandiva_boolean_node, GGANDIVA_TYPE_NODE) -#define GGANDIVA_BOOLEAN_NODE_GET_PRIVATE(object) \ - static_cast( \ - ggandiva_boolean_node_get_instance_private( \ - GGANDIVA_BOOLEAN_NODE(object))) \ +#define GGANDIVA_BOOLEAN_NODE_GET_PRIVATE(object) \ + static_cast( \ + ggandiva_boolean_node_get_instance_private(GGANDIVA_BOOLEAN_NODE(object))) static void ggandiva_boolean_node_dispose(GObject *object) @@ -1449,10 +1403,7 @@ ggandiva_boolean_node_get_children(GGandivaBooleanNode *node) return priv->children; } - -G_DEFINE_TYPE(GGandivaAndNode, - ggandiva_and_node, - GGANDIVA_TYPE_BOOLEAN_NODE) +G_DEFINE_TYPE(GGandivaAndNode, ggandiva_and_node, GGANDIVA_TYPE_BOOLEAN_NODE) static void ggandiva_and_node_init(GGandivaAndNode *and_node) @@ -1481,14 +1432,10 @@ ggandiva_and_node_new(GList *children) gandiva_nodes.push_back(gandiva_node); } auto gandiva_node = gandiva::TreeExprBuilder::MakeAnd(gandiva_nodes); - return GGANDIVA_AND_NODE(ggandiva_boolean_node_new_raw(&gandiva_node, - children)); + return GGANDIVA_AND_NODE(ggandiva_boolean_node_new_raw(&gandiva_node, children)); } - -G_DEFINE_TYPE(GGandivaOrNode, - ggandiva_or_node, - GGANDIVA_TYPE_BOOLEAN_NODE) +G_DEFINE_TYPE(GGandivaOrNode, ggandiva_or_node, GGANDIVA_TYPE_BOOLEAN_NODE) static void ggandiva_or_node_init(GGandivaOrNode *or_node) @@ -1517,8 +1464,7 @@ ggandiva_or_node_new(GList *children) gandiva_nodes.push_back(gandiva_node); } auto gandiva_node = gandiva::TreeExprBuilder::MakeOr(gandiva_nodes); - return GGANDIVA_OR_NODE(ggandiva_boolean_node_new_raw(&gandiva_node, - children)); + return GGANDIVA_OR_NODE(ggandiva_boolean_node_new_raw(&gandiva_node, children)); } G_END_DECLS @@ -1537,9 +1483,12 @@ ggandiva_field_node_new_raw(std::shared_ptr *gandiva_node, auto arrow_return_type = (*gandiva_node)->return_type(); auto return_type = garrow_field_get_data_type(field); auto field_node = g_object_new(GGANDIVA_TYPE_FIELD_NODE, - "node", gandiva_node, - "field", field, - "return-type", return_type, + "node", + gandiva_node, + "field", + field, + "return-type", + return_type, NULL); return GGANDIVA_FIELD_NODE(field_node); } @@ -1551,9 +1500,12 @@ ggandiva_function_node_new_raw(std::shared_ptr *gandiva_node, GArrowDataType *return_type) { auto function_node = g_object_new(GGANDIVA_TYPE_FUNCTION_NODE, - "node", gandiva_node, - "name", name, - "return-type", return_type, + "node", + gandiva_node, + "name", + name, + "return-type", + return_type, NULL); auto priv = GGANDIVA_FUNCTION_NODE_GET_PRIVATE(function_node); for (auto node = parameters; node; node = g_list_next(node)) { @@ -1573,11 +1525,12 @@ ggandiva_literal_node_new_raw(std::shared_ptr *gandiva_node, GGandivaLiteralNode *literal_node; if (gandiva_literal_node->is_null()) { - literal_node = - GGANDIVA_LITERAL_NODE(g_object_new(GGANDIVA_TYPE_NULL_LITERAL_NODE, - "node", gandiva_node, - "return-type", return_type, - NULL)); + literal_node = GGANDIVA_LITERAL_NODE(g_object_new(GGANDIVA_TYPE_NULL_LITERAL_NODE, + "node", + gandiva_node, + "return-type", + return_type, + NULL)); } else { GType type; @@ -1628,18 +1581,12 @@ ggandiva_literal_node_new_raw(std::shared_ptr *gandiva_node, } if (return_type) { - literal_node = - GGANDIVA_LITERAL_NODE(g_object_new(type, - "node", gandiva_node, - "return-type", return_type, - NULL)); + literal_node = GGANDIVA_LITERAL_NODE( + g_object_new(type, "node", gandiva_node, "return-type", return_type, NULL)); } else { return_type = garrow_data_type_new_raw(&arrow_return_type); - literal_node = - GGANDIVA_LITERAL_NODE(g_object_new(type, - "node", gandiva_node, - "return-type", return_type, - NULL)); + literal_node = GGANDIVA_LITERAL_NODE( + g_object_new(type, "node", gandiva_node, "return-type", return_type, NULL)); g_object_unref(return_type); } } @@ -1655,11 +1602,16 @@ ggandiva_if_node_new_raw(std::shared_ptr *gandiva_node, GArrowDataType *return_type) { auto if_node = g_object_new(GGANDIVA_TYPE_IF_NODE, - "node", gandiva_node, - "condition-node", condition_node, - "then-node", then_node, - "else-node", else_node, - "return-type", return_type, + "node", + gandiva_node, + "condition-node", + condition_node, + "then-node", + then_node, + "else-node", + else_node, + "return-type", + return_type, NULL); return GGANDIVA_IF_NODE(if_node); } @@ -1677,12 +1629,9 @@ ggandiva_boolean_node_new_raw(std::shared_ptr *gandiva_node, } else { type = GGANDIVA_TYPE_OR_NODE; } - auto boolean_node = g_object_new(type, - "node", gandiva_node, - NULL); + auto boolean_node = g_object_new(type, "node", gandiva_node, NULL); auto priv = GGANDIVA_BOOLEAN_NODE_GET_PRIVATE(boolean_node); - priv->children = g_list_copy_deep(children, - reinterpret_cast(g_object_ref), - NULL); + priv->children = + g_list_copy_deep(children, reinterpret_cast(g_object_ref), NULL); return GGANDIVA_BOOLEAN_NODE(boolean_node); } diff --git a/c_glib/gandiva-glib/node.h b/c_glib/gandiva-glib/node.h index a16f26c656cc0..715a3d6ebaf18 100644 --- a/c_glib/gandiva-glib/node.h +++ b/c_glib/gandiva-glib/node.h @@ -26,40 +26,30 @@ G_BEGIN_DECLS #define GGANDIVA_TYPE_NODE (ggandiva_node_get_type()) -G_DECLARE_DERIVABLE_TYPE(GGandivaNode, - ggandiva_node, - GGANDIVA, - NODE, - GObject) +G_DECLARE_DERIVABLE_TYPE(GGandivaNode, ggandiva_node, GGANDIVA, NODE, GObject) struct _GGandivaNodeClass { GObjectClass parent_class; }; -gchar *ggandiva_node_to_string(GGandivaNode *node); - +gchar * +ggandiva_node_to_string(GGandivaNode *node); #define GGANDIVA_TYPE_FIELD_NODE (ggandiva_field_node_get_type()) -G_DECLARE_DERIVABLE_TYPE(GGandivaFieldNode, - ggandiva_field_node, - GGANDIVA, - FIELD_NODE, - GGandivaNode) +G_DECLARE_DERIVABLE_TYPE( + GGandivaFieldNode, ggandiva_field_node, GGANDIVA, FIELD_NODE, GGandivaNode) struct _GGandivaFieldNodeClass { GGandivaNodeClass parent_class; }; -GGandivaFieldNode *ggandiva_field_node_new(GArrowField *field); - +GGandivaFieldNode * +ggandiva_field_node_new(GArrowField *field); #define GGANDIVA_TYPE_FUNCTION_NODE (ggandiva_function_node_get_type()) -G_DECLARE_DERIVABLE_TYPE(GGandivaFunctionNode, - ggandiva_function_node, - GGANDIVA, - FUNCTION_NODE, - GGandivaNode) +G_DECLARE_DERIVABLE_TYPE( + GGandivaFunctionNode, ggandiva_function_node, GGANDIVA, FUNCTION_NODE, GGandivaNode) struct _GGandivaFunctionNodeClass { GGandivaNodeClass parent_class; @@ -72,19 +62,14 @@ ggandiva_function_node_new(const gchar *name, GList * ggandiva_function_node_get_parameters(GGandivaFunctionNode *node); - #define GGANDIVA_TYPE_LITERAL_NODE (ggandiva_literal_node_get_type()) -G_DECLARE_DERIVABLE_TYPE(GGandivaLiteralNode, - ggandiva_literal_node, - GGANDIVA, - LITERAL_NODE, - GGandivaNode) +G_DECLARE_DERIVABLE_TYPE( + GGandivaLiteralNode, ggandiva_literal_node, GGANDIVA, LITERAL_NODE, GGandivaNode) struct _GGandivaLiteralNodeClass { GGandivaNodeClass parent_class; }; - #define GGANDIVA_TYPE_NULL_LITERAL_NODE (ggandiva_null_literal_node_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaNullLiteralNode, ggandiva_null_literal_node, @@ -97,9 +82,7 @@ struct _GGandivaNullLiteralNodeClass }; GGandivaNullLiteralNode * -ggandiva_null_literal_node_new(GArrowDataType *return_type, - GError **error); - +ggandiva_null_literal_node_new(GArrowDataType *return_type, GError **error); #define GGANDIVA_TYPE_BOOLEAN_LITERAL_NODE (ggandiva_boolean_literal_node_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaBooleanLiteralNode, @@ -117,7 +100,6 @@ ggandiva_boolean_literal_node_new(gboolean value); gboolean ggandiva_boolean_literal_node_get_value(GGandivaBooleanLiteralNode *node); - #define GGANDIVA_TYPE_INT8_LITERAL_NODE (ggandiva_int8_literal_node_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaInt8LiteralNode, ggandiva_int8_literal_node, @@ -134,7 +116,6 @@ ggandiva_int8_literal_node_new(gint8 value); gint8 ggandiva_int8_literal_node_get_value(GGandivaInt8LiteralNode *node); - #define GGANDIVA_TYPE_UINT8_LITERAL_NODE (ggandiva_uint8_literal_node_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaUInt8LiteralNode, ggandiva_uint8_literal_node, @@ -151,7 +132,6 @@ ggandiva_uint8_literal_node_new(guint8 value); guint8 ggandiva_uint8_literal_node_get_value(GGandivaUInt8LiteralNode *node); - #define GGANDIVA_TYPE_INT16_LITERAL_NODE (ggandiva_int16_literal_node_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaInt16LiteralNode, ggandiva_int16_literal_node, @@ -168,7 +148,6 @@ ggandiva_int16_literal_node_new(gint16 value); gint16 ggandiva_int16_literal_node_get_value(GGandivaInt16LiteralNode *node); - #define GGANDIVA_TYPE_UINT16_LITERAL_NODE (ggandiva_uint16_literal_node_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaUInt16LiteralNode, ggandiva_uint16_literal_node, @@ -185,7 +164,6 @@ ggandiva_uint16_literal_node_new(guint16 value); guint16 ggandiva_uint16_literal_node_get_value(GGandivaUInt16LiteralNode *node); - #define GGANDIVA_TYPE_INT32_LITERAL_NODE (ggandiva_int32_literal_node_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaInt32LiteralNode, ggandiva_int32_literal_node, @@ -202,7 +180,6 @@ ggandiva_int32_literal_node_new(gint32 value); gint32 ggandiva_int32_literal_node_get_value(GGandivaInt32LiteralNode *node); - #define GGANDIVA_TYPE_UINT32_LITERAL_NODE (ggandiva_uint32_literal_node_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaUInt32LiteralNode, ggandiva_uint32_literal_node, @@ -219,7 +196,6 @@ ggandiva_uint32_literal_node_new(guint32 value); guint32 ggandiva_uint32_literal_node_get_value(GGandivaUInt32LiteralNode *node); - #define GGANDIVA_TYPE_INT64_LITERAL_NODE (ggandiva_int64_literal_node_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaInt64LiteralNode, ggandiva_int64_literal_node, @@ -236,7 +212,6 @@ ggandiva_int64_literal_node_new(gint64 value); gint64 ggandiva_int64_literal_node_get_value(GGandivaInt64LiteralNode *node); - #define GGANDIVA_TYPE_UINT64_LITERAL_NODE (ggandiva_uint64_literal_node_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaUInt64LiteralNode, ggandiva_uint64_literal_node, @@ -253,7 +228,6 @@ ggandiva_uint64_literal_node_new(guint64 value); guint64 ggandiva_uint64_literal_node_get_value(GGandivaUInt64LiteralNode *node); - #define GGANDIVA_TYPE_FLOAT_LITERAL_NODE (ggandiva_float_literal_node_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaFloatLiteralNode, ggandiva_float_literal_node, @@ -270,7 +244,6 @@ ggandiva_float_literal_node_new(gfloat value); gfloat ggandiva_float_literal_node_get_value(GGandivaFloatLiteralNode *node); - #define GGANDIVA_TYPE_DOUBLE_LITERAL_NODE (ggandiva_double_literal_node_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaDoubleLiteralNode, ggandiva_double_literal_node, @@ -287,7 +260,6 @@ ggandiva_double_literal_node_new(gdouble value); gdouble ggandiva_double_literal_node_get_value(GGandivaDoubleLiteralNode *node); - #define GGANDIVA_TYPE_BINARY_LITERAL_NODE (ggandiva_binary_literal_node_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaBinaryLiteralNode, ggandiva_binary_literal_node, @@ -300,14 +272,12 @@ struct _GGandivaBinaryLiteralNodeClass }; GGandivaBinaryLiteralNode * -ggandiva_binary_literal_node_new(const guint8 *value, - gsize size); +ggandiva_binary_literal_node_new(const guint8 *value, gsize size); GGandivaBinaryLiteralNode * ggandiva_binary_literal_node_new_bytes(GBytes *value); GBytes * ggandiva_binary_literal_node_get_value(GGandivaBinaryLiteralNode *node); - #define GGANDIVA_TYPE_STRING_LITERAL_NODE (ggandiva_string_literal_node_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaStringLiteralNode, ggandiva_string_literal_node, @@ -324,13 +294,9 @@ ggandiva_string_literal_node_new(const gchar *value); const gchar * ggandiva_string_literal_node_get_value(GGandivaStringLiteralNode *node); - #define GGANDIVA_TYPE_IF_NODE (ggandiva_if_node_get_type()) -G_DECLARE_DERIVABLE_TYPE(GGandivaIfNode, - ggandiva_if_node, - GGANDIVA, - IF_NODE, - GGandivaNode) +G_DECLARE_DERIVABLE_TYPE( + GGandivaIfNode, ggandiva_if_node, GGANDIVA, IF_NODE, GGandivaNode) struct _GGandivaIfNodeClass { GGandivaNodeClass parent_class; @@ -343,13 +309,9 @@ ggandiva_if_node_new(GGandivaNode *condition_node, GArrowDataType *return_type, GError **error); - #define GGANDIVA_TYPE_BOOLEAN_NODE (ggandiva_boolean_node_get_type()) -G_DECLARE_DERIVABLE_TYPE(GGandivaBooleanNode, - ggandiva_boolean_node, - GGANDIVA, - BOOLEAN_NODE, - GGandivaNode) +G_DECLARE_DERIVABLE_TYPE( + GGandivaBooleanNode, ggandiva_boolean_node, GGANDIVA, BOOLEAN_NODE, GGandivaNode) struct _GGandivaBooleanNodeClass { @@ -360,13 +322,9 @@ GGANDIVA_AVAILABLE_IN_0_17 GList * ggandiva_boolean_node_get_children(GGandivaBooleanNode *node); - #define GGANDIVA_TYPE_AND_NODE (ggandiva_and_node_get_type()) -G_DECLARE_DERIVABLE_TYPE(GGandivaAndNode, - ggandiva_and_node, - GGANDIVA, - AND_NODE, - GGandivaBooleanNode) +G_DECLARE_DERIVABLE_TYPE( + GGandivaAndNode, ggandiva_and_node, GGANDIVA, AND_NODE, GGandivaBooleanNode) struct _GGandivaAndNodeClass { GGandivaBooleanNodeClass parent_class; @@ -376,13 +334,9 @@ GGANDIVA_AVAILABLE_IN_0_17 GGandivaAndNode * ggandiva_and_node_new(GList *children); - #define GGANDIVA_TYPE_OR_NODE (ggandiva_or_node_get_type()) -G_DECLARE_DERIVABLE_TYPE(GGandivaOrNode, - ggandiva_or_node, - GGANDIVA, - OR_NODE, - GGandivaBooleanNode) +G_DECLARE_DERIVABLE_TYPE( + GGandivaOrNode, ggandiva_or_node, GGANDIVA, OR_NODE, GGandivaBooleanNode) struct _GGandivaOrNodeClass { GGandivaBooleanNodeClass parent_class; diff --git a/c_glib/gandiva-glib/node.hpp b/c_glib/gandiva-glib/node.hpp index 51dc2cbbf74ac..5a410db0645ef 100644 --- a/c_glib/gandiva-glib/node.hpp +++ b/c_glib/gandiva-glib/node.hpp @@ -26,7 +26,8 @@ #include -std::shared_ptr ggandiva_node_get_raw(GGandivaNode *node); +std::shared_ptr +ggandiva_node_get_raw(GGandivaNode *node); GGandivaFieldNode * ggandiva_field_node_new_raw(std::shared_ptr *gandiva_node, GArrowField *field); diff --git a/c_glib/gandiva-glib/projector.cpp b/c_glib/gandiva-glib/projector.cpp index c91cde84c5ffe..8d807510fa9c1 100644 --- a/c_glib/gandiva-glib/projector.cpp +++ b/c_glib/gandiva-glib/projector.cpp @@ -42,7 +42,8 @@ G_BEGIN_DECLS * Since: 0.12.0 */ -typedef struct GGandivaProjectorPrivate_ { +typedef struct GGandivaProjectorPrivate_ +{ std::shared_ptr projector; GArrowSchema *schema; GList *expressions; @@ -54,14 +55,11 @@ enum { PROP_EXPRESSIONS, }; -G_DEFINE_TYPE_WITH_PRIVATE(GGandivaProjector, - ggandiva_projector, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GGandivaProjector, ggandiva_projector, G_TYPE_OBJECT) -#define GGANDIVA_PROJECTOR_GET_PRIVATE(obj) \ - static_cast( \ - ggandiva_projector_get_instance_private( \ - GGANDIVA_PROJECTOR(obj))) +#define GGANDIVA_PROJECTOR_GET_PRIVATE(obj) \ + static_cast( \ + ggandiva_projector_get_instance_private(GGANDIVA_PROJECTOR(obj))) static void ggandiva_projector_dispose(GObject *object) @@ -106,10 +104,9 @@ ggandiva_projector_set_property(GObject *object, priv->schema = GARROW_SCHEMA(g_value_dup_object(value)); break; case PROP_EXPRESSIONS: - priv->expressions = - g_list_copy_deep(static_cast(g_value_get_pointer(value)), - reinterpret_cast(g_object_ref), - nullptr); + priv->expressions = g_list_copy_deep(static_cast(g_value_get_pointer(value)), + reinterpret_cast(g_object_ref), + nullptr); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -139,7 +136,7 @@ static void ggandiva_projector_init(GGandivaProjector *object) { auto priv = GGANDIVA_PROJECTOR_GET_PRIVATE(object); - new(&priv->projector) std::shared_ptr; + new (&priv->projector) std::shared_ptr; } static void @@ -147,32 +144,32 @@ ggandiva_projector_class_init(GGandivaProjectorClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->dispose = ggandiva_projector_dispose; - gobject_class->finalize = ggandiva_projector_finalize; + gobject_class->dispose = ggandiva_projector_dispose; + gobject_class->finalize = ggandiva_projector_finalize; gobject_class->set_property = ggandiva_projector_set_property; gobject_class->get_property = ggandiva_projector_get_property; GParamSpec *spec; - spec = g_param_spec_pointer("projector", - "Projector", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "projector", + "Projector", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_PROJECTOR, spec); - spec = g_param_spec_object("schema", - "Schema", - "The schema of the projector", - GARROW_TYPE_SCHEMA, - static_cast(G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "schema", + "Schema", + "The schema of the projector", + GARROW_TYPE_SCHEMA, + static_cast(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_SCHEMA, spec); - spec = g_param_spec_pointer("expressions", - "Expressions", - "The expressions for the projector", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "expressions", + "Expressions", + "The expressions for the projector", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_EXPRESSIONS, spec); } @@ -188,9 +185,7 @@ ggandiva_projector_class_init(GGandivaProjectorClass *klass) * Since: 0.12.0 */ GGandivaProjector * -ggandiva_projector_new(GArrowSchema *schema, - GList *expressions, - GError **error) +ggandiva_projector_new(GArrowSchema *schema, GList *expressions, GError **error) { auto arrow_schema = garrow_schema_get_raw(schema); std::vector> gandiva_expressions; @@ -201,13 +196,9 @@ ggandiva_projector_new(GArrowSchema *schema, } std::shared_ptr gandiva_projector; auto status = - gandiva_projector->Make(arrow_schema, - gandiva_expressions, - &gandiva_projector); + gandiva_projector->Make(arrow_schema, gandiva_expressions, &gandiva_projector); if (garrow_error_check(error, status, "[gandiva][projector][new]")) { - return ggandiva_projector_new_raw(&gandiva_projector, - schema, - expressions); + return ggandiva_projector_new_raw(&gandiva_projector, schema, expressions); } else { return NULL; } @@ -234,9 +225,7 @@ ggandiva_projector_evaluate(GGandivaProjector *projector, auto memory_pool = arrow::default_memory_pool(); arrow::ArrayVector arrow_arrays; auto status = - gandiva_projector->Evaluate(*arrow_record_batch, - memory_pool, - &arrow_arrays); + gandiva_projector->Evaluate(*arrow_record_batch, memory_pool, &arrow_arrays); if (garrow_error_check(error, status, "[gandiva][projector][evaluate]")) { GList *arrays = NULL; for (auto arrow_array : arrow_arrays) { @@ -249,7 +238,6 @@ ggandiva_projector_evaluate(GGandivaProjector *projector, } } - G_DEFINE_TYPE(GGandivaSelectableProjector, ggandiva_selectable_projector, GGANDIVA_TYPE_PROJECTOR) @@ -290,20 +278,15 @@ ggandiva_selectable_projector_new(GArrowSchema *schema, gandiva_expressions.push_back(gandiva_expression); } auto gandiva_mode = static_cast(mode); - auto gandiva_configuration = - gandiva::ConfigurationBuilder::DefaultConfiguration(); + auto gandiva_configuration = gandiva::ConfigurationBuilder::DefaultConfiguration(); std::shared_ptr gandiva_projector; auto status = gandiva_projector->Make(arrow_schema, gandiva_expressions, gandiva_mode, gandiva_configuration, &gandiva_projector); - if (garrow_error_check(error, - status, - "[gandiva][selectable-projector][new]")) { - return ggandiva_selectable_projector_new_raw(&gandiva_projector, - schema, - expressions); + if (garrow_error_check(error, status, "[gandiva][selectable-projector][new]")) { + return ggandiva_selectable_projector_new_raw(&gandiva_projector, schema, expressions); } else { return NULL; } @@ -323,27 +306,22 @@ ggandiva_selectable_projector_new(GArrowSchema *schema, * Since: 4.0.0 */ GList * -ggandiva_selectable_projector_evaluate( - GGandivaSelectableProjector *projector, - GArrowRecordBatch *record_batch, - GGandivaSelectionVector *selection_vector, - GError **error) +ggandiva_selectable_projector_evaluate(GGandivaSelectableProjector *projector, + GArrowRecordBatch *record_batch, + GGandivaSelectionVector *selection_vector, + GError **error) { - auto gandiva_projector = - ggandiva_projector_get_raw(GGANDIVA_PROJECTOR(projector)); + auto gandiva_projector = ggandiva_projector_get_raw(GGANDIVA_PROJECTOR(projector)); auto arrow_record_batch = garrow_record_batch_get_raw(record_batch); auto gandiva_selection_vector = ggandiva_selection_vector_get_raw(selection_vector).get(); auto memory_pool = arrow::default_memory_pool(); arrow::ArrayVector arrow_arrays; - auto status = - gandiva_projector->Evaluate(*arrow_record_batch, - gandiva_selection_vector, - memory_pool, - &arrow_arrays); - if (garrow_error_check(error, - status, - "[gandiva][selectable-projector][evaluate]")) { + auto status = gandiva_projector->Evaluate(*arrow_record_batch, + gandiva_selection_vector, + memory_pool, + &arrow_arrays); + if (garrow_error_check(error, status, "[gandiva][selectable-projector][evaluate]")) { GList *arrays = NULL; for (auto arrow_array : arrow_arrays) { auto array = garrow_array_new_raw(&arrow_array); @@ -358,15 +336,17 @@ ggandiva_selectable_projector_evaluate( G_END_DECLS GGandivaProjector * -ggandiva_projector_new_raw( - std::shared_ptr *gandiva_projector, - GArrowSchema *schema, - GList *expressions) +ggandiva_projector_new_raw(std::shared_ptr *gandiva_projector, + GArrowSchema *schema, + GList *expressions) { auto projector = g_object_new(GGANDIVA_TYPE_PROJECTOR, - "projector", gandiva_projector, - "schema", schema, - "expressions", expressions, + "projector", + gandiva_projector, + "schema", + schema, + "expressions", + expressions, NULL); return GGANDIVA_PROJECTOR(projector); } @@ -378,7 +358,8 @@ ggandiva_selectable_projector_new_raw( GList *expressions) { auto projector = g_object_new(GGANDIVA_TYPE_SELECTABLE_PROJECTOR, - "projector", gandiva_projector, + "projector", + gandiva_projector, NULL); return GGANDIVA_SELECTABLE_PROJECTOR(projector); } diff --git a/c_glib/gandiva-glib/projector.h b/c_glib/gandiva-glib/projector.h index 5dd218b808cea..e0afec5cb1ba1 100644 --- a/c_glib/gandiva-glib/projector.h +++ b/c_glib/gandiva-glib/projector.h @@ -24,11 +24,8 @@ G_BEGIN_DECLS #define GGANDIVA_TYPE_PROJECTOR (ggandiva_projector_get_type()) -G_DECLARE_DERIVABLE_TYPE(GGandivaProjector, - ggandiva_projector, - GGANDIVA, - PROJECTOR, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GGandivaProjector, ggandiva_projector, GGANDIVA, PROJECTOR, GObject) struct _GGandivaProjectorClass { @@ -36,17 +33,13 @@ struct _GGandivaProjectorClass }; GGandivaProjector * -ggandiva_projector_new(GArrowSchema *schema, - GList *expressions, - GError **error); +ggandiva_projector_new(GArrowSchema *schema, GList *expressions, GError **error); GList * ggandiva_projector_evaluate(GGandivaProjector *projector, GArrowRecordBatch *record_batch, GError **error); - -#define GGANDIVA_TYPE_SELECTABLE_PROJECTOR \ - (ggandiva_selectable_projector_get_type()) +#define GGANDIVA_TYPE_SELECTABLE_PROJECTOR (ggandiva_selectable_projector_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaSelectableProjector, ggandiva_selectable_projector, GGANDIVA, @@ -71,5 +64,4 @@ ggandiva_selectable_projector_evaluate(GGandivaSelectableProjector *projector, GGandivaSelectionVector *selection_vector, GError **error); - G_END_DECLS diff --git a/c_glib/gandiva-glib/projector.hpp b/c_glib/gandiva-glib/projector.hpp index b372f32f59856..ca3581b3c9274 100644 --- a/c_glib/gandiva-glib/projector.hpp +++ b/c_glib/gandiva-glib/projector.hpp @@ -26,10 +26,9 @@ #include GGandivaProjector * -ggandiva_projector_new_raw( - std::shared_ptr *gandiva_projector, - GArrowSchema *schema, - GList *expressions); +ggandiva_projector_new_raw(std::shared_ptr *gandiva_projector, + GArrowSchema *schema, + GList *expressions); GGandivaSelectableProjector * ggandiva_selectable_projector_new_raw( std::shared_ptr *gandiva_projector, diff --git a/c_glib/gandiva-glib/selection-vector.cpp b/c_glib/gandiva-glib/selection-vector.cpp index 77c3cf2aa14f6..d6a8333e627a3 100644 --- a/c_glib/gandiva-glib/selection-vector.cpp +++ b/c_glib/gandiva-glib/selection-vector.cpp @@ -22,7 +22,6 @@ #include - G_BEGIN_DECLS /** @@ -45,7 +44,8 @@ G_BEGIN_DECLS * Since: 4.0.0 */ -typedef struct GGandivaSelectionVectorPrivate_ { +typedef struct GGandivaSelectionVectorPrivate_ +{ std::shared_ptr selection_vector; } GGandivaSelectionVectorPrivate; @@ -57,10 +57,9 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GGandivaSelectionVector, ggandiva_selection_vector, G_TYPE_OBJECT) -#define GGANDIVA_SELECTION_VECTOR_GET_PRIVATE(object) \ - static_cast( \ - ggandiva_selection_vector_get_instance_private( \ - GGANDIVA_SELECTION_VECTOR(object))) +#define GGANDIVA_SELECTION_VECTOR_GET_PRIVATE(object) \ + static_cast( \ + ggandiva_selection_vector_get_instance_private(GGANDIVA_SELECTION_VECTOR(object))) static void ggandiva_selection_vector_finalize(GObject *object) @@ -82,9 +81,8 @@ ggandiva_selection_vector_set_property(GObject *object, switch (prop_id) { case PROP_SELECTION_VECTOR: - priv->selection_vector = - *static_cast *>( - g_value_get_pointer(value)); + priv->selection_vector = *static_cast *>( + g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -96,7 +94,7 @@ static void ggandiva_selection_vector_init(GGandivaSelectionVector *object) { auto priv = GGANDIVA_SELECTION_VECTOR_GET_PRIVATE(object); - new(&priv->selection_vector) std::shared_ptr; + new (&priv->selection_vector) std::shared_ptr; } static void @@ -104,15 +102,15 @@ ggandiva_selection_vector_class_init(GGandivaSelectionVectorClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = ggandiva_selection_vector_finalize; + gobject_class->finalize = ggandiva_selection_vector_finalize; gobject_class->set_property = ggandiva_selection_vector_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("selection-vector", - "Selection vector", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "selection-vector", + "Selection vector", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_SELECTION_VECTOR, spec); } @@ -127,8 +125,7 @@ ggandiva_selection_vector_class_init(GGandivaSelectionVectorClass *klass) GGandivaSelectionVectorMode ggandiva_selection_vector_get_mode(GGandivaSelectionVector *selection_vector) { - auto gandiva_selection_vector = - ggandiva_selection_vector_get_raw(selection_vector); + auto gandiva_selection_vector = ggandiva_selection_vector_get_raw(selection_vector); auto gandiva_mode = gandiva_selection_vector->GetMode(); return static_cast(gandiva_mode); } @@ -145,26 +142,22 @@ ggandiva_selection_vector_get_mode(GGandivaSelectionVector *selection_vector) GArrowArray * ggandiva_selection_vector_to_array(GGandivaSelectionVector *selection_vector) { - auto gandiva_selection_vector = - ggandiva_selection_vector_get_raw(selection_vector); + auto gandiva_selection_vector = ggandiva_selection_vector_get_raw(selection_vector); auto arrow_array = gandiva_selection_vector->ToArray(); return garrow_array_new_raw(&arrow_array); } - G_DEFINE_TYPE(GGandivaUInt16SelectionVector, ggandiva_uint16_selection_vector, GGANDIVA_TYPE_SELECTION_VECTOR) static void -ggandiva_uint16_selection_vector_init( - GGandivaUInt16SelectionVector *selection_vector) +ggandiva_uint16_selection_vector_init(GGandivaUInt16SelectionVector *selection_vector) { } static void -ggandiva_uint16_selection_vector_class_init( - GGandivaUInt16SelectionVectorClass *klass) +ggandiva_uint16_selection_vector_class_init(GGandivaUInt16SelectionVectorClass *klass) { } @@ -178,17 +171,14 @@ ggandiva_uint16_selection_vector_class_init( * Since: 4.0.0 */ GGandivaUInt16SelectionVector * -ggandiva_uint16_selection_vector_new(gint64 max_slots, - GError **error) +ggandiva_uint16_selection_vector_new(gint64 max_slots, GError **error) { auto memory_pool = arrow::default_memory_pool(); std::shared_ptr gandiva_selection_vector; auto status = gandiva::SelectionVector::MakeInt16(max_slots, memory_pool, &gandiva_selection_vector); - if (garrow_error_check(error, - status, - "[gandiva][uint16-selection-vector][new]")) { + if (garrow_error_check(error, status, "[gandiva][uint16-selection-vector][new]")) { return GGANDIVA_UINT16_SELECTION_VECTOR( ggandiva_selection_vector_new_raw(&gandiva_selection_vector)); } else { @@ -196,20 +186,17 @@ ggandiva_uint16_selection_vector_new(gint64 max_slots, } } - G_DEFINE_TYPE(GGandivaUInt32SelectionVector, ggandiva_uint32_selection_vector, GGANDIVA_TYPE_SELECTION_VECTOR) static void -ggandiva_uint32_selection_vector_init( - GGandivaUInt32SelectionVector *selection_vector) +ggandiva_uint32_selection_vector_init(GGandivaUInt32SelectionVector *selection_vector) { } static void -ggandiva_uint32_selection_vector_class_init( - GGandivaUInt32SelectionVectorClass *klass) +ggandiva_uint32_selection_vector_class_init(GGandivaUInt32SelectionVectorClass *klass) { } @@ -223,17 +210,14 @@ ggandiva_uint32_selection_vector_class_init( * Since: 4.0.0 */ GGandivaUInt32SelectionVector * -ggandiva_uint32_selection_vector_new(gint64 max_slots, - GError **error) +ggandiva_uint32_selection_vector_new(gint64 max_slots, GError **error) { auto memory_pool = arrow::default_memory_pool(); std::shared_ptr gandiva_selection_vector; auto status = gandiva::SelectionVector::MakeInt32(max_slots, memory_pool, &gandiva_selection_vector); - if (garrow_error_check(error, - status, - "[gandiva][uint32-selection-vector][new]")) { + if (garrow_error_check(error, status, "[gandiva][uint32-selection-vector][new]")) { return GGANDIVA_UINT32_SELECTION_VECTOR( ggandiva_selection_vector_new_raw(&gandiva_selection_vector)); } else { @@ -241,20 +225,17 @@ ggandiva_uint32_selection_vector_new(gint64 max_slots, } } - G_DEFINE_TYPE(GGandivaUInt64SelectionVector, ggandiva_uint64_selection_vector, GGANDIVA_TYPE_SELECTION_VECTOR) static void -ggandiva_uint64_selection_vector_init( - GGandivaUInt64SelectionVector *selection_vector) +ggandiva_uint64_selection_vector_init(GGandivaUInt64SelectionVector *selection_vector) { } static void -ggandiva_uint64_selection_vector_class_init( - GGandivaUInt64SelectionVectorClass *klass) +ggandiva_uint64_selection_vector_class_init(GGandivaUInt64SelectionVectorClass *klass) { } @@ -268,17 +249,14 @@ ggandiva_uint64_selection_vector_class_init( * Since: 4.0.0 */ GGandivaUInt64SelectionVector * -ggandiva_uint64_selection_vector_new(gint64 max_slots, - GError **error) +ggandiva_uint64_selection_vector_new(gint64 max_slots, GError **error) { auto memory_pool = arrow::default_memory_pool(); std::shared_ptr gandiva_selection_vector; auto status = gandiva::SelectionVector::MakeInt64(max_slots, memory_pool, &gandiva_selection_vector); - if (garrow_error_check(error, - status, - "[gandiva][uint64-selection-vector][new]")) { + if (garrow_error_check(error, status, "[gandiva][uint64-selection-vector][new]")) { return GGANDIVA_UINT64_SELECTION_VECTOR( ggandiva_selection_vector_new_raw(&gandiva_selection_vector)); } else { @@ -286,10 +264,8 @@ ggandiva_uint64_selection_vector_new(gint64 max_slots, } } - G_END_DECLS - GGandivaSelectionVector * ggandiva_selection_vector_new_raw( std::shared_ptr *gandiva_selection_vector) @@ -309,9 +285,7 @@ ggandiva_selection_vector_new_raw( break; } auto selection_vector = - g_object_new(type, - "selection-vector", gandiva_selection_vector, - NULL); + g_object_new(type, "selection-vector", gandiva_selection_vector, NULL); return GGANDIVA_SELECTION_VECTOR(selection_vector); } diff --git a/c_glib/gandiva-glib/selection-vector.h b/c_glib/gandiva-glib/selection-vector.h index 029c4cde5caf1..6d78192e35e28 100644 --- a/c_glib/gandiva-glib/selection-vector.h +++ b/c_glib/gandiva-glib/selection-vector.h @@ -46,13 +46,9 @@ typedef enum { GGANDIVA_SELECTION_VECTOR_MODE_UINT64, } GGandivaSelectionVectorMode; - #define GGANDIVA_TYPE_SELECTION_VECTOR (ggandiva_selection_vector_get_type()) -G_DECLARE_DERIVABLE_TYPE(GGandivaSelectionVector, - ggandiva_selection_vector, - GGANDIVA, - SELECTION_VECTOR, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GGandivaSelectionVector, ggandiva_selection_vector, GGANDIVA, SELECTION_VECTOR, GObject) struct _GGandivaSelectionVectorClass { @@ -67,8 +63,7 @@ GGANDIVA_AVAILABLE_IN_4_0 GArrowArray * ggandiva_selection_vector_to_array(GGandivaSelectionVector *selection_vector); - -#define GGANDIVA_TYPE_UINT16_SELECTION_VECTOR \ +#define GGANDIVA_TYPE_UINT16_SELECTION_VECTOR \ (ggandiva_uint16_selection_vector_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaUInt16SelectionVector, ggandiva_uint16_selection_vector, @@ -83,11 +78,9 @@ struct _GGandivaUInt16SelectionVectorClass GGANDIVA_AVAILABLE_IN_4_0 GGandivaUInt16SelectionVector * -ggandiva_uint16_selection_vector_new(gint64 max_slots, - GError **error); +ggandiva_uint16_selection_vector_new(gint64 max_slots, GError **error); - -#define GGANDIVA_TYPE_UINT32_SELECTION_VECTOR \ +#define GGANDIVA_TYPE_UINT32_SELECTION_VECTOR \ (ggandiva_uint32_selection_vector_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaUInt32SelectionVector, ggandiva_uint32_selection_vector, @@ -102,11 +95,9 @@ struct _GGandivaUInt32SelectionVectorClass GGANDIVA_AVAILABLE_IN_4_0 GGandivaUInt32SelectionVector * -ggandiva_uint32_selection_vector_new(gint64 max_slots, - GError **error); - +ggandiva_uint32_selection_vector_new(gint64 max_slots, GError **error); -#define GGANDIVA_TYPE_UINT64_SELECTION_VECTOR \ +#define GGANDIVA_TYPE_UINT64_SELECTION_VECTOR \ (ggandiva_uint64_selection_vector_get_type()) G_DECLARE_DERIVABLE_TYPE(GGandivaUInt64SelectionVector, ggandiva_uint64_selection_vector, @@ -121,8 +112,6 @@ struct _GGandivaUInt64SelectionVectorClass GGANDIVA_AVAILABLE_IN_4_0 GGandivaUInt64SelectionVector * -ggandiva_uint64_selection_vector_new(gint64 max_slots, - GError **error); - +ggandiva_uint64_selection_vector_new(gint64 max_slots, GError **error); G_END_DECLS diff --git a/c_glib/parquet-glib/arrow-file-reader.cpp b/c_glib/parquet-glib/arrow-file-reader.cpp index f7a4b09f814ac..4996d7862713e 100644 --- a/c_glib/parquet-glib/arrow-file-reader.cpp +++ b/c_glib/parquet-glib/arrow-file-reader.cpp @@ -36,7 +36,8 @@ G_BEGIN_DECLS * from file and returns them as Apache Arrow data. */ -typedef struct GParquetArrowFileReaderPrivate_ { +typedef struct GParquetArrowFileReaderPrivate_ +{ parquet::arrow::FileReader *arrow_file_reader; } GParquetArrowFileReaderPrivate; @@ -49,10 +50,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GParquetArrowFileReader, gparquet_arrow_file_reader, G_TYPE_OBJECT) -#define GPARQUET_ARROW_FILE_READER_GET_PRIVATE(obj) \ - static_cast( \ - gparquet_arrow_file_reader_get_instance_private( \ - GPARQUET_ARROW_FILE_READER(obj))) +#define GPARQUET_ARROW_FILE_READER_GET_PRIVATE(obj) \ + static_cast( \ + gparquet_arrow_file_reader_get_instance_private(GPARQUET_ARROW_FILE_READER(obj))) static void gparquet_arrow_file_reader_finalize(GObject *object) @@ -108,15 +108,15 @@ gparquet_arrow_file_reader_class_init(GParquetArrowFileReaderClass *klass) auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = gparquet_arrow_file_reader_finalize; + gobject_class->finalize = gparquet_arrow_file_reader_finalize; gobject_class->set_property = gparquet_arrow_file_reader_set_property; gobject_class->get_property = gparquet_arrow_file_reader_get_property; - spec = g_param_spec_pointer("arrow-file-reader", - "ArrowFileReader", - "The raw parquet::arrow::FileReader *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "arrow-file-reader", + "ArrowFileReader", + "The raw parquet::arrow::FileReader *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_ARROW_FILE_READER, spec); } @@ -130,19 +130,15 @@ gparquet_arrow_file_reader_class_init(GParquetArrowFileReaderClass *klass) * Since: 0.11.0 */ GParquetArrowFileReader * -gparquet_arrow_file_reader_new_arrow(GArrowSeekableInputStream *source, - GError **error) +gparquet_arrow_file_reader_new_arrow(GArrowSeekableInputStream *source, GError **error) { - auto arrow_random_access_file = - garrow_seekable_input_stream_get_raw(source); + auto arrow_random_access_file = garrow_seekable_input_stream_get_raw(source); auto arrow_memory_pool = arrow::default_memory_pool(); std::unique_ptr parquet_arrow_file_reader; auto status = parquet::arrow::OpenFile(arrow_random_access_file, arrow_memory_pool, &parquet_arrow_file_reader); - if (garrow_error_check(error, - status, - "[parquet][arrow][file-reader][new-arrow]")) { + if (garrow_error_check(error, status, "[parquet][arrow][file-reader][new-arrow]")) { return gparquet_arrow_file_reader_new_raw(parquet_arrow_file_reader.release()); } else { return NULL; @@ -159,8 +155,7 @@ gparquet_arrow_file_reader_new_arrow(GArrowSeekableInputStream *source, * Since: 0.11.0 */ GParquetArrowFileReader * -gparquet_arrow_file_reader_new_path(const gchar *path, - GError **error) +gparquet_arrow_file_reader_new_path(const gchar *path, GError **error) { auto arrow_memory_mapped_file = arrow::io::MemoryMappedFile::Open(path, arrow::io::FileMode::READ); @@ -177,9 +172,7 @@ gparquet_arrow_file_reader_new_path(const gchar *path, auto status = parquet::arrow::OpenFile(arrow_random_access_file, arrow_memory_pool, &parquet_arrow_file_reader); - if (garrow::check(error, - status, - "[parquet][arrow][file-reader][new-path]")) { + if (garrow::check(error, status, "[parquet][arrow][file-reader][new-path]")) { return gparquet_arrow_file_reader_new_raw(parquet_arrow_file_reader.release()); } else { return NULL; @@ -196,15 +189,12 @@ gparquet_arrow_file_reader_new_path(const gchar *path, * Since: 0.11.0 */ GArrowTable * -gparquet_arrow_file_reader_read_table(GParquetArrowFileReader *reader, - GError **error) +gparquet_arrow_file_reader_read_table(GParquetArrowFileReader *reader, GError **error) { auto parquet_arrow_file_reader = gparquet_arrow_file_reader_get_raw(reader); std::shared_ptr arrow_table; auto status = parquet_arrow_file_reader->ReadTable(&arrow_table); - if (garrow_error_check(error, - status, - "[parquet][arrow][file-reader][read-table]")) { + if (garrow_error_check(error, status, "[parquet][arrow][file-reader][read-table]")) { return garrow_table_new_raw(&arrow_table); } else { return NULL; @@ -234,7 +224,7 @@ gparquet_arrow_file_reader_read_row_group(GParquetArrowFileReader *reader, GError **error) { const gchar *tag = "[parquet][arrow][file-reader][read-row-group]"; - auto parquet_arrow_file_reader = gparquet_arrow_file_reader_get_raw(reader); + auto parquet_arrow_file_reader = gparquet_arrow_file_reader_get_raw(reader); std::shared_ptr arrow_table; arrow::Status status; if (column_indices) { @@ -246,24 +236,24 @@ gparquet_arrow_file_reader_read_row_group(GParquetArrowFileReader *reader, if (!garrow_internal_index_adjust(column_index, n_columns)) { garrow_error_check(error, arrow::Status::IndexError("Out of index: " - "<0..", n_columns, ">: " - "<", column_index, ">"), + "<0..", + n_columns, + ">: " + "<", + column_index, + ">"), tag); return NULL; } parquet_column_indices.push_back(column_index); } - status = - parquet_arrow_file_reader->ReadRowGroup(row_group_index, - parquet_column_indices, - &arrow_table); + status = parquet_arrow_file_reader->ReadRowGroup(row_group_index, + parquet_column_indices, + &arrow_table); } else { - status = - parquet_arrow_file_reader->ReadRowGroup(row_group_index, &arrow_table); + status = parquet_arrow_file_reader->ReadRowGroup(row_group_index, &arrow_table); } - if (garrow_error_check(error, - status, - tag)) { + if (garrow_error_check(error, status, tag)) { return garrow_table_new_raw(&arrow_table); } else { return NULL; @@ -280,16 +270,13 @@ gparquet_arrow_file_reader_read_row_group(GParquetArrowFileReader *reader, * Since: 0.12.0 */ GArrowSchema * -gparquet_arrow_file_reader_get_schema(GParquetArrowFileReader *reader, - GError **error) +gparquet_arrow_file_reader_get_schema(GParquetArrowFileReader *reader, GError **error) { auto parquet_arrow_file_reader = gparquet_arrow_file_reader_get_raw(reader); std::shared_ptr arrow_schema; auto status = parquet_arrow_file_reader->GetSchema(&arrow_schema); - if (garrow_error_check(error, - status, - "[parquet][arrow][file-reader][get-schema]")) { + if (garrow_error_check(error, status, "[parquet][arrow][file-reader][get-schema]")) { return garrow_schema_new_raw(&arrow_schema); } else { return NULL; @@ -321,15 +308,18 @@ gparquet_arrow_file_reader_read_column_data(GParquetArrowFileReader *reader, if (!garrow_internal_index_adjust(i, n_columns)) { garrow_error_check(error, arrow::Status::IndexError("Out of index: " - "<0..", n_columns, ">: " - "<", i, ">"), + "<0..", + n_columns, + ">: " + "<", + i, + ">"), tag); return NULL; } std::shared_ptr arrow_chunked_array; - auto status = - parquet_arrow_file_reader->ReadColumn(i, &arrow_chunked_array); + auto status = parquet_arrow_file_reader->ReadColumn(i, &arrow_chunked_array); if (!garrow_error_check(error, status, tag)) { return NULL; } @@ -405,7 +395,8 @@ gparquet_arrow_file_reader_new_raw(parquet::arrow::FileReader *parquet_arrow_fil { auto arrow_file_reader = GPARQUET_ARROW_FILE_READER(g_object_new(GPARQUET_TYPE_ARROW_FILE_READER, - "arrow-file-reader", parquet_arrow_file_reader, + "arrow-file-reader", + parquet_arrow_file_reader, NULL)); return arrow_file_reader; } diff --git a/c_glib/parquet-glib/arrow-file-reader.h b/c_glib/parquet-glib/arrow-file-reader.h index da234f47c5daf..63c14ac71da86 100644 --- a/c_glib/parquet-glib/arrow-file-reader.h +++ b/c_glib/parquet-glib/arrow-file-reader.h @@ -35,15 +35,12 @@ struct _GParquetArrowFileReaderClass }; GParquetArrowFileReader * -gparquet_arrow_file_reader_new_arrow(GArrowSeekableInputStream *source, - GError **error); +gparquet_arrow_file_reader_new_arrow(GArrowSeekableInputStream *source, GError **error); GParquetArrowFileReader * -gparquet_arrow_file_reader_new_path(const gchar *path, - GError **error); +gparquet_arrow_file_reader_new_path(const gchar *path, GError **error); GArrowTable * -gparquet_arrow_file_reader_read_table(GParquetArrowFileReader *reader, - GError **error); +gparquet_arrow_file_reader_read_table(GParquetArrowFileReader *reader, GError **error); GARROW_AVAILABLE_IN_1_0 GArrowTable * @@ -54,8 +51,7 @@ gparquet_arrow_file_reader_read_row_group(GParquetArrowFileReader *reader, GError **error); GArrowSchema * -gparquet_arrow_file_reader_get_schema(GParquetArrowFileReader *reader, - GError **error); +gparquet_arrow_file_reader_get_schema(GParquetArrowFileReader *reader, GError **error); GArrowChunkedArray * gparquet_arrow_file_reader_read_column_data(GParquetArrowFileReader *reader, diff --git a/c_glib/parquet-glib/arrow-file-writer.cpp b/c_glib/parquet-glib/arrow-file-writer.cpp index f923edbf5e5c8..b6f019ed27d46 100644 --- a/c_glib/parquet-glib/arrow-file-writer.cpp +++ b/c_glib/parquet-glib/arrow-file-writer.cpp @@ -34,7 +34,8 @@ G_BEGIN_DECLS * file as Apache Parquet format. */ -typedef struct GParquetWriterPropertiesPrivate_ { +typedef struct GParquetWriterPropertiesPrivate_ +{ std::shared_ptr properties; parquet::WriterProperties::Builder *builder; gboolean changed; @@ -44,10 +45,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GParquetWriterProperties, gparquet_writer_properties, G_TYPE_OBJECT) -#define GPARQUET_WRITER_PROPERTIES_GET_PRIVATE(object) \ - static_cast( \ - gparquet_writer_properties_get_instance_private( \ - GPARQUET_WRITER_PROPERTIES(object))) +#define GPARQUET_WRITER_PROPERTIES_GET_PRIVATE(object) \ + static_cast( \ + gparquet_writer_properties_get_instance_private(GPARQUET_WRITER_PROPERTIES(object))) static void gparquet_writer_properties_finalize(GObject *object) @@ -64,7 +64,7 @@ static void gparquet_writer_properties_init(GParquetWriterProperties *object) { auto priv = GPARQUET_WRITER_PROPERTIES_GET_PRIVATE(object); - new(&priv->properties) std::shared_ptr; + new (&priv->properties) std::shared_ptr; priv->builder = new parquet::WriterProperties::Builder(); priv->changed = TRUE; } @@ -74,7 +74,7 @@ gparquet_writer_properties_class_init(GParquetWriterPropertiesClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = gparquet_writer_properties_finalize; + gobject_class->finalize = gparquet_writer_properties_finalize; } /** @@ -87,8 +87,7 @@ gparquet_writer_properties_class_init(GParquetWriterPropertiesClass *klass) GParquetWriterProperties * gparquet_writer_properties_new(void) { - auto writer_properties = g_object_new(GPARQUET_TYPE_WRITER_PROPERTIES, - NULL); + auto writer_properties = g_object_new(GPARQUET_TYPE_WRITER_PROPERTIES, NULL); return GPARQUET_WRITER_PROPERTIES(writer_properties); } @@ -200,8 +199,8 @@ gparquet_writer_properties_is_dictionary_enabled(GParquetWriterProperties *prope * Since: 0.17.0 */ void -gparquet_writer_properties_set_dictionary_page_size_limit(GParquetWriterProperties *properties, - gint64 limit) +gparquet_writer_properties_set_dictionary_page_size_limit( + GParquetWriterProperties *properties, gint64 limit) { auto priv = GPARQUET_WRITER_PROPERTIES_GET_PRIVATE(properties); priv->builder->dictionary_pagesize_limit(limit); @@ -217,7 +216,8 @@ gparquet_writer_properties_set_dictionary_page_size_limit(GParquetWriterProperti * Since: 0.17.0 */ gint64 -gparquet_writer_properties_get_dictionary_page_size_limit(GParquetWriterProperties *properties) +gparquet_writer_properties_get_dictionary_page_size_limit( + GParquetWriterProperties *properties) { auto parquet_properties = gparquet_writer_properties_get_raw(properties); return parquet_properties->dictionary_pagesize_limit(); @@ -316,8 +316,8 @@ gparquet_writer_properties_get_data_page_size(GParquetWriterProperties *properti return parquet_properties->data_pagesize(); } - -typedef struct GParquetArrowFileWriterPrivate_ { +typedef struct GParquetArrowFileWriterPrivate_ +{ parquet::arrow::FileWriter *arrow_file_writer; } GParquetArrowFileWriterPrivate; @@ -330,10 +330,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GParquetArrowFileWriter, gparquet_arrow_file_writer, G_TYPE_OBJECT) -#define GPARQUET_ARROW_FILE_WRITER_GET_PRIVATE(obj) \ - static_cast( \ - gparquet_arrow_file_writer_get_instance_private( \ - GPARQUET_ARROW_FILE_WRITER(obj))) +#define GPARQUET_ARROW_FILE_WRITER_GET_PRIVATE(obj) \ + static_cast( \ + gparquet_arrow_file_writer_get_instance_private(GPARQUET_ARROW_FILE_WRITER(obj))) static void gparquet_arrow_file_writer_finalize(GObject *object) @@ -389,15 +388,15 @@ gparquet_arrow_file_writer_class_init(GParquetArrowFileWriterClass *klass) auto gobject_class = G_OBJECT_CLASS(klass); - gobject_class->finalize = gparquet_arrow_file_writer_finalize; + gobject_class->finalize = gparquet_arrow_file_writer_finalize; gobject_class->set_property = gparquet_arrow_file_writer_set_property; gobject_class->get_property = gparquet_arrow_file_writer_get_property; - spec = g_param_spec_pointer("arrow-file-writer", - "ArrowFileWriter", - "The raw std::shared *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "arrow-file-writer", + "ArrowFileWriter", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_ARROW_FILE_WRITER, spec); } @@ -424,7 +423,8 @@ gparquet_arrow_file_writer_new_arrow(GArrowSchema *schema, std::unique_ptr parquet_arrow_file_writer; arrow::Result> maybe_writer; if (writer_properties) { - auto parquet_writer_properties = gparquet_writer_properties_get_raw(writer_properties); + auto parquet_writer_properties = + gparquet_writer_properties_get_raw(writer_properties); maybe_writer = parquet::arrow::FileWriter::Open(*arrow_schema, arrow_memory_pool, arrow_output_stream, @@ -436,9 +436,7 @@ gparquet_arrow_file_writer_new_arrow(GArrowSchema *schema, arrow_output_stream, parquet_writer_properties); } - if (garrow::check(error, - maybe_writer, - "[parquet][arrow][file-writer][new-arrow]")) { + if (garrow::check(error, maybe_writer, "[parquet][arrow][file-writer][new-arrow]")) { parquet_arrow_file_writer = std::move(*maybe_writer); return gparquet_arrow_file_writer_new_raw(parquet_arrow_file_writer.release()); } else { @@ -463,8 +461,7 @@ gparquet_arrow_file_writer_new_path(GArrowSchema *schema, GParquetWriterProperties *writer_properties, GError **error) { - auto arrow_file_output_stream = - arrow::io::FileOutputStream::Open(path, false); + auto arrow_file_output_stream = arrow::io::FileOutputStream::Open(path, false); if (!garrow::check(error, arrow_file_output_stream, "[parquet][arrow][file-writer][new-path]")) { @@ -478,7 +475,8 @@ gparquet_arrow_file_writer_new_path(GArrowSchema *schema, std::unique_ptr parquet_arrow_file_writer; arrow::Result> maybe_writer; if (writer_properties) { - auto parquet_writer_properties = gparquet_writer_properties_get_raw(writer_properties); + auto parquet_writer_properties = + gparquet_writer_properties_get_raw(writer_properties); maybe_writer = parquet::arrow::FileWriter::Open(*arrow_schema, arrow_memory_pool, arrow_output_stream, @@ -490,9 +488,7 @@ gparquet_arrow_file_writer_new_path(GArrowSchema *schema, arrow_output_stream, parquet_writer_properties); } - if (garrow::check(error, - maybe_writer, - "[parquet][arrow][file-writer][new-path]")) { + if (garrow::check(error, maybe_writer, "[parquet][arrow][file-writer][new-path]")) { parquet_arrow_file_writer = std::move(*maybe_writer); return gparquet_arrow_file_writer_new_raw(parquet_arrow_file_writer.release()); } else { @@ -520,9 +516,7 @@ gparquet_arrow_file_writer_write_table(GParquetArrowFileWriter *writer, auto parquet_arrow_file_writer = gparquet_arrow_file_writer_get_raw(writer); auto arrow_table = garrow_table_get_raw(table).get(); auto status = parquet_arrow_file_writer->WriteTable(*arrow_table, chunk_size); - return garrow_error_check(error, - status, - "[parquet][arrow][file-writer][write-table]"); + return garrow_error_check(error, status, "[parquet][arrow][file-writer][write-table]"); } /** @@ -535,17 +529,13 @@ gparquet_arrow_file_writer_write_table(GParquetArrowFileWriter *writer, * Since: 0.11.0 */ gboolean -gparquet_arrow_file_writer_close(GParquetArrowFileWriter *writer, - GError **error) +gparquet_arrow_file_writer_close(GParquetArrowFileWriter *writer, GError **error) { auto parquet_arrow_file_writer = gparquet_arrow_file_writer_get_raw(writer); auto status = parquet_arrow_file_writer->Close(); - return garrow_error_check(error, - status, - "[parquet][arrow][file-writer][close]"); + return garrow_error_check(error, status, "[parquet][arrow][file-writer][close]"); } - G_END_DECLS GParquetArrowFileWriter * @@ -553,7 +543,8 @@ gparquet_arrow_file_writer_new_raw(parquet::arrow::FileWriter *parquet_arrow_fil { auto arrow_file_writer = GPARQUET_ARROW_FILE_WRITER(g_object_new(GPARQUET_TYPE_ARROW_FILE_WRITER, - "arrow-file-writer", parquet_arrow_file_writer, + "arrow-file-writer", + parquet_arrow_file_writer, NULL)); return arrow_file_writer; } diff --git a/c_glib/parquet-glib/arrow-file-writer.h b/c_glib/parquet-glib/arrow-file-writer.h index 67083a0743e1f..592ea4ae3f1ba 100644 --- a/c_glib/parquet-glib/arrow-file-writer.h +++ b/c_glib/parquet-glib/arrow-file-writer.h @@ -23,8 +23,7 @@ G_BEGIN_DECLS -#define GPARQUET_TYPE_WRITER_PROPERTIES \ - (gparquet_writer_properties_get_type()) +#define GPARQUET_TYPE_WRITER_PROPERTIES (gparquet_writer_properties_get_type()) G_DECLARE_DERIVABLE_TYPE(GParquetWriterProperties, gparquet_writer_properties, GPARQUET, @@ -36,7 +35,8 @@ struct _GParquetWriterPropertiesClass }; GARROW_AVAILABLE_IN_0_17 -GParquetWriterProperties *gparquet_writer_properties_new(void); +GParquetWriterProperties * +gparquet_writer_properties_new(void); GARROW_AVAILABLE_IN_0_17 void gparquet_writer_properties_set_compression(GParquetWriterProperties *properties, @@ -60,11 +60,12 @@ gparquet_writer_properties_is_dictionary_enabled(GParquetWriterProperties *prope const gchar *path); GARROW_AVAILABLE_IN_0_17 void -gparquet_writer_properties_set_dictionary_page_size_limit(GParquetWriterProperties *properties, - gint64 limit); +gparquet_writer_properties_set_dictionary_page_size_limit( + GParquetWriterProperties *properties, gint64 limit); GARROW_AVAILABLE_IN_0_17 gint64 -gparquet_writer_properties_get_dictionary_page_size_limit(GParquetWriterProperties *properties); +gparquet_writer_properties_get_dictionary_page_size_limit( + GParquetWriterProperties *properties); GARROW_AVAILABLE_IN_0_17 void gparquet_writer_properties_set_batch_size(GParquetWriterProperties *properties, @@ -87,7 +88,6 @@ GARROW_AVAILABLE_IN_0_17 gint64 gparquet_writer_properties_get_data_page_size(GParquetWriterProperties *properties); - #define GPARQUET_TYPE_ARROW_FILE_WRITER (gparquet_arrow_file_writer_get_type()) G_DECLARE_DERIVABLE_TYPE(GParquetArrowFileWriter, gparquet_arrow_file_writer, @@ -117,7 +117,6 @@ gparquet_arrow_file_writer_write_table(GParquetArrowFileWriter *writer, GError **error); gboolean -gparquet_arrow_file_writer_close(GParquetArrowFileWriter *writer, - GError **error); +gparquet_arrow_file_writer_close(GParquetArrowFileWriter *writer, GError **error); G_END_DECLS diff --git a/c_glib/parquet-glib/metadata.cpp b/c_glib/parquet-glib/metadata.cpp index 54583340ad91b..9e18decb3fd63 100644 --- a/c_glib/parquet-glib/metadata.cpp +++ b/c_glib/parquet-glib/metadata.cpp @@ -36,7 +36,8 @@ G_BEGIN_DECLS * #GParquetFileMetadata is a class for file level metadata. */ -struct GParquetColumnChunkMetadataPrivate { +struct GParquetColumnChunkMetadataPrivate +{ parquet::ColumnChunkMetaData *metadata; GParquetRowGroupMetadata *owner; }; @@ -50,9 +51,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GParquetColumnChunkMetadata, gparquet_column_chunk_metadata, G_TYPE_OBJECT) -#define GPARQUET_COLUMN_CHUNK_METADATA_GET_PRIVATE(object) \ - static_cast( \ - gparquet_column_chunk_metadata_get_instance_private( \ +#define GPARQUET_COLUMN_CHUNK_METADATA_GET_PRIVATE(object) \ + static_cast( \ + gparquet_column_chunk_metadata_get_instance_private( \ GPARQUET_COLUMN_CHUNK_METADATA(object))) static void @@ -94,27 +95,26 @@ gparquet_column_chunk_metadata_init(GParquetColumnChunkMetadata *object) } static void -gparquet_column_chunk_metadata_class_init( - GParquetColumnChunkMetadataClass *klass) +gparquet_column_chunk_metadata_class_init(GParquetColumnChunkMetadataClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); gobject_class->dispose = gparquet_column_chunk_metadata_dispose; gobject_class->set_property = gparquet_column_chunk_metadata_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("metadata", - "Metadata", - "The raw parquet::ColumnChunkMetaData *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "metadata", + "Metadata", + "The raw parquet::ColumnChunkMetaData *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_METADATA, spec); - spec = g_param_spec_object("owner", - "Owner", - "The row group metadata that owns this metadata", - GPARQUET_TYPE_ROW_GROUP_METADATA, - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "owner", + "Owner", + "The row group metadata that owns this metadata", + GPARQUET_TYPE_ROW_GROUP_METADATA, + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_OWNER, spec); } @@ -133,8 +133,7 @@ gparquet_column_chunk_metadata_equal(GParquetColumnChunkMetadata *metadata, GParquetColumnChunkMetadata *other_metadata) { auto parquet_metadata = gparquet_column_chunk_metadata_get_raw(metadata); - auto parquet_other_metadata = - gparquet_column_chunk_metadata_get_raw(other_metadata); + auto parquet_other_metadata = gparquet_column_chunk_metadata_get_raw(other_metadata); return parquet_metadata->Equals(*parquet_other_metadata); } @@ -181,8 +180,7 @@ gparquet_column_chunk_metadata_get_total_compressed_size( * Since: 8.0.0 */ gint64 -gparquet_column_chunk_metadata_get_file_offset( - GParquetColumnChunkMetadata *metadata) +gparquet_column_chunk_metadata_get_file_offset(GParquetColumnChunkMetadata *metadata) { auto parquet_metadata = gparquet_column_chunk_metadata_get_raw(metadata); return parquet_metadata->file_offset(); @@ -198,8 +196,7 @@ gparquet_column_chunk_metadata_get_file_offset( * Since: 8.0.0 */ gboolean -gparquet_column_chunk_metadata_can_decompress( - GParquetColumnChunkMetadata *metadata) +gparquet_column_chunk_metadata_can_decompress(GParquetColumnChunkMetadata *metadata) { auto parquet_metadata = gparquet_column_chunk_metadata_get_raw(metadata); return parquet_metadata->can_decompress(); @@ -215,8 +212,7 @@ gparquet_column_chunk_metadata_can_decompress( * Since: 8.0.0 */ GParquetStatistics * -gparquet_column_chunk_metadata_get_statistics( - GParquetColumnChunkMetadata *metadata) +gparquet_column_chunk_metadata_get_statistics(GParquetColumnChunkMetadata *metadata) { auto parquet_metadata = gparquet_column_chunk_metadata_get_raw(metadata); auto parquet_statistics = parquet_metadata->statistics(); @@ -227,8 +223,8 @@ gparquet_column_chunk_metadata_get_statistics( } } - -struct GParquetRowGroupMetadataPrivate { +struct GParquetRowGroupMetadataPrivate +{ parquet::RowGroupMetaData *metadata; GParquetFileMetadata *owner; }; @@ -237,9 +233,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GParquetRowGroupMetadata, gparquet_row_group_metadata, G_TYPE_OBJECT) -#define GPARQUET_ROW_GROUP_METADATA_GET_PRIVATE(object) \ - static_cast( \ - gparquet_row_group_metadata_get_instance_private( \ +#define GPARQUET_ROW_GROUP_METADATA_GET_PRIVATE(object) \ + static_cast( \ + gparquet_row_group_metadata_get_instance_private( \ GPARQUET_ROW_GROUP_METADATA(object))) static void @@ -263,8 +259,7 @@ gparquet_row_group_metadata_set_property(GObject *object, switch (prop_id) { case PROP_METADATA: - priv->metadata = - static_cast(g_value_get_pointer(value)); + priv->metadata = static_cast(g_value_get_pointer(value)); break; case PROP_OWNER: priv->owner = GPARQUET_FILE_METADATA(g_value_dup_object(value)); @@ -288,18 +283,19 @@ gparquet_row_group_metadata_class_init(GParquetRowGroupMetadataClass *klass) gobject_class->set_property = gparquet_row_group_metadata_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("metadata", "Metadata", - "The raw parquet::RowGroupMetaData *", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "metadata", + "Metadata", + "The raw parquet::RowGroupMetaData *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_METADATA, spec); - spec = g_param_spec_object("owner", - "Owner", - "The file group metadata that owns this metadata", - GPARQUET_TYPE_FILE_METADATA, - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_object( + "owner", + "Owner", + "The file group metadata that owns this metadata", + GPARQUET_TYPE_FILE_METADATA, + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_OWNER, spec); } @@ -318,8 +314,7 @@ gparquet_row_group_metadata_equal(GParquetRowGroupMetadata *metadata, GParquetRowGroupMetadata *other_metadata) { auto parquet_metadata = gparquet_row_group_metadata_get_raw(metadata); - auto parquet_other_metadata = - gparquet_row_group_metadata_get_raw(other_metadata); + auto parquet_other_metadata = gparquet_row_group_metadata_get_raw(other_metadata); return parquet_metadata->Equals(*parquet_other_metadata); } @@ -363,12 +358,9 @@ gparquet_row_group_metadata_get_column_chunk(GParquetRowGroupMetadata *metadata, return arrow::Status::OK(); END_PARQUET_CATCH_EXCEPTIONS })(); - if (garrow::check(error, - status, - "[parquet][row-group-metadata][get-column-chunk]")) { - return gparquet_column_chunk_metadata_new_raw( - parquet_column_chunk_metadata.release(), - metadata); + if (garrow::check(error, status, "[parquet][row-group-metadata][get-column-chunk]")) { + return gparquet_column_chunk_metadata_new_raw(parquet_column_chunk_metadata.release(), + metadata); } else { return NULL; } @@ -415,8 +407,7 @@ gparquet_row_group_metadata_get_total_size(GParquetRowGroupMetadata *metadata) * Since: 8.0.0 */ gint64 -gparquet_row_group_metadata_get_total_compressed_size( - GParquetRowGroupMetadata *metadata) +gparquet_row_group_metadata_get_total_compressed_size(GParquetRowGroupMetadata *metadata) { auto parquet_metadata = gparquet_row_group_metadata_get_raw(metadata); return parquet_metadata->total_compressed_size(); @@ -458,19 +449,16 @@ gparquet_row_group_metadata_can_decompress(GParquetRowGroupMetadata *metadata) return parquet_metadata->can_decompress(); } - -struct GParquetFileMetadataPrivate { +struct GParquetFileMetadataPrivate +{ std::shared_ptr metadata; }; -G_DEFINE_TYPE_WITH_PRIVATE(GParquetFileMetadata, - gparquet_file_metadata, - G_TYPE_OBJECT) +G_DEFINE_TYPE_WITH_PRIVATE(GParquetFileMetadata, gparquet_file_metadata, G_TYPE_OBJECT) -#define GPARQUET_FILE_METADATA_GET_PRIVATE(object) \ - static_cast( \ - gparquet_file_metadata_get_instance_private( \ - GPARQUET_FILE_METADATA(object))) +#define GPARQUET_FILE_METADATA_GET_PRIVATE(object) \ + static_cast( \ + gparquet_file_metadata_get_instance_private(GPARQUET_FILE_METADATA(object))) static void gparquet_file_metadata_finalize(GObject *object) @@ -491,8 +479,7 @@ gparquet_file_metadata_set_property(GObject *object, switch (prop_id) { case PROP_METADATA: priv->metadata = - *static_cast *>( - g_value_get_pointer(value)); + *static_cast *>(g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -504,7 +491,7 @@ static void gparquet_file_metadata_init(GParquetFileMetadata *object) { auto priv = GPARQUET_FILE_METADATA_GET_PRIVATE(object); - new(&priv->metadata) std::shared_ptr; + new (&priv->metadata) std::shared_ptr; } static void @@ -515,11 +502,11 @@ gparquet_file_metadata_class_init(GParquetFileMetadataClass *klass) gobject_class->set_property = gparquet_file_metadata_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("metadata", - "Metadata", - "The raw std::shared_ptr", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "metadata", + "Metadata", + "The raw std::shared_ptr", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_METADATA, spec); } @@ -692,21 +679,19 @@ gparquet_file_metadata_can_decompress(GParquetFileMetadata *metadata) return parquet_metadata->can_decompress(); } - G_END_DECLS - GParquetColumnChunkMetadata * -gparquet_column_chunk_metadata_new_raw( - parquet::ColumnChunkMetaData *parquet_metadata, - GParquetRowGroupMetadata *owner) +gparquet_column_chunk_metadata_new_raw(parquet::ColumnChunkMetaData *parquet_metadata, + GParquetRowGroupMetadata *owner) { auto metadata = - GPARQUET_COLUMN_CHUNK_METADATA( - g_object_new(GPARQUET_TYPE_COLUMN_CHUNK_METADATA, - "metadata", parquet_metadata, - "owner", owner, - NULL)); + GPARQUET_COLUMN_CHUNK_METADATA(g_object_new(GPARQUET_TYPE_COLUMN_CHUNK_METADATA, + "metadata", + parquet_metadata, + "owner", + owner, + NULL)); return metadata; } @@ -717,15 +702,16 @@ gparquet_column_chunk_metadata_get_raw(GParquetColumnChunkMetadata *metadata) return priv->metadata; } - GParquetRowGroupMetadata * gparquet_row_group_metadata_new_raw(parquet::RowGroupMetaData *parquet_metadata, GParquetFileMetadata *owner) { auto metadata = GPARQUET_ROW_GROUP_METADATA(g_object_new(GPARQUET_TYPE_ROW_GROUP_METADATA, - "metadata", parquet_metadata, - "owner", owner, + "metadata", + parquet_metadata, + "owner", + owner, NULL)); return metadata; } @@ -737,15 +723,11 @@ gparquet_row_group_metadata_get_raw(GParquetRowGroupMetadata *metadata) return priv->metadata; } - GParquetFileMetadata * -gparquet_file_metadata_new_raw( - std::shared_ptr *parquet_metadata) +gparquet_file_metadata_new_raw(std::shared_ptr *parquet_metadata) { - auto metadata = - GPARQUET_FILE_METADATA(g_object_new(GPARQUET_TYPE_FILE_METADATA, - "metadata", parquet_metadata, - NULL)); + auto metadata = GPARQUET_FILE_METADATA( + g_object_new(GPARQUET_TYPE_FILE_METADATA, "metadata", parquet_metadata, NULL)); return metadata; } diff --git a/c_glib/parquet-glib/metadata.h b/c_glib/parquet-glib/metadata.h index 8759bdedf034d..1c9fce7cc778d 100644 --- a/c_glib/parquet-glib/metadata.h +++ b/c_glib/parquet-glib/metadata.h @@ -23,8 +23,7 @@ G_BEGIN_DECLS -#define GPARQUET_TYPE_COLUMN_CHUNK_METADATA \ - (gparquet_column_chunk_metadata_get_type()) +#define GPARQUET_TYPE_COLUMN_CHUNK_METADATA (gparquet_column_chunk_metadata_get_type()) G_DECLARE_DERIVABLE_TYPE(GParquetColumnChunkMetadata, gparquet_column_chunk_metadata, GPARQUET, @@ -37,30 +36,24 @@ struct _GParquetColumnChunkMetadataClass GARROW_AVAILABLE_IN_8_0 gboolean -gparquet_column_chunk_metadata_equal( - GParquetColumnChunkMetadata *metadata, - GParquetColumnChunkMetadata *other_metadata); +gparquet_column_chunk_metadata_equal(GParquetColumnChunkMetadata *metadata, + GParquetColumnChunkMetadata *other_metadata); GARROW_AVAILABLE_IN_8_0 gint64 -gparquet_column_chunk_metadata_get_total_size( - GParquetColumnChunkMetadata *metadata); +gparquet_column_chunk_metadata_get_total_size(GParquetColumnChunkMetadata *metadata); GARROW_AVAILABLE_IN_8_0 gint64 gparquet_column_chunk_metadata_get_total_compressed_size( GParquetColumnChunkMetadata *metadata); GARROW_AVAILABLE_IN_8_0 gint64 -gparquet_column_chunk_metadata_get_file_offset( - GParquetColumnChunkMetadata *metadata); +gparquet_column_chunk_metadata_get_file_offset(GParquetColumnChunkMetadata *metadata); GARROW_AVAILABLE_IN_8_0 gboolean -gparquet_column_chunk_metadata_can_decompress( - GParquetColumnChunkMetadata *metadata); +gparquet_column_chunk_metadata_can_decompress(GParquetColumnChunkMetadata *metadata); GARROW_AVAILABLE_IN_8_0 GParquetStatistics * -gparquet_column_chunk_metadata_get_statistics( - GParquetColumnChunkMetadata *metadata); - +gparquet_column_chunk_metadata_get_statistics(GParquetColumnChunkMetadata *metadata); #define GPARQUET_TYPE_ROW_GROUP_METADATA (gparquet_row_group_metadata_get_type()) G_DECLARE_DERIVABLE_TYPE(GParquetRowGroupMetadata, @@ -90,27 +83,20 @@ gint64 gparquet_row_group_metadata_get_n_rows(GParquetRowGroupMetadata *metadata); GARROW_AVAILABLE_IN_8_0 gint64 -gparquet_row_group_metadata_get_total_size( - GParquetRowGroupMetadata *metadata); +gparquet_row_group_metadata_get_total_size(GParquetRowGroupMetadata *metadata); GARROW_AVAILABLE_IN_8_0 gint64 -gparquet_row_group_metadata_get_total_compressed_size( - GParquetRowGroupMetadata *metadata); +gparquet_row_group_metadata_get_total_compressed_size(GParquetRowGroupMetadata *metadata); GARROW_AVAILABLE_IN_8_0 gint64 -gparquet_row_group_metadata_get_file_offset( - GParquetRowGroupMetadata *metadata); +gparquet_row_group_metadata_get_file_offset(GParquetRowGroupMetadata *metadata); GARROW_AVAILABLE_IN_8_0 gboolean gparquet_row_group_metadata_can_decompress(GParquetRowGroupMetadata *metadata); - #define GPARQUET_TYPE_FILE_METADATA (gparquet_file_metadata_get_type()) -G_DECLARE_DERIVABLE_TYPE(GParquetFileMetadata, - gparquet_file_metadata, - GPARQUET, - FILE_METADATA, - GObject) +G_DECLARE_DERIVABLE_TYPE( + GParquetFileMetadata, gparquet_file_metadata, GPARQUET, FILE_METADATA, GObject) struct _GParquetFileMetadataClass { GObjectClass parent_class; diff --git a/c_glib/parquet-glib/metadata.hpp b/c_glib/parquet-glib/metadata.hpp index 279e60ffe8bec..498512901906e 100644 --- a/c_glib/parquet-glib/metadata.hpp +++ b/c_glib/parquet-glib/metadata.hpp @@ -24,21 +24,18 @@ #include GParquetColumnChunkMetadata * -gparquet_column_chunk_metadata_new_raw( - parquet::ColumnChunkMetaData *parquet_metadata, - GParquetRowGroupMetadata *owner); +gparquet_column_chunk_metadata_new_raw(parquet::ColumnChunkMetaData *parquet_metadata, + GParquetRowGroupMetadata *owner); parquet::ColumnChunkMetaData * gparquet_column_chunk_metadata_get_raw(GParquetColumnChunkMetadata *metadata); GParquetRowGroupMetadata * -gparquet_row_group_metadata_new_raw( - parquet::RowGroupMetaData *parquet_metadata, - GParquetFileMetadata *owner); +gparquet_row_group_metadata_new_raw(parquet::RowGroupMetaData *parquet_metadata, + GParquetFileMetadata *owner); parquet::RowGroupMetaData * gparquet_row_group_metadata_get_raw(GParquetRowGroupMetadata *metadata); GParquetFileMetadata * -gparquet_file_metadata_new_raw( - std::shared_ptr *parquet_metadata); +gparquet_file_metadata_new_raw(std::shared_ptr *parquet_metadata); std::shared_ptr gparquet_file_metadata_get_raw(GParquetFileMetadata *metadata); diff --git a/c_glib/parquet-glib/statistics.cpp b/c_glib/parquet-glib/statistics.cpp index 596768d98007c..9f0074e70e717 100644 --- a/c_glib/parquet-glib/statistics.cpp +++ b/c_glib/parquet-glib/statistics.cpp @@ -51,7 +51,8 @@ G_BEGIN_DECLS * byte array statistics. */ -struct GParquetStatisticsPrivate { +struct GParquetStatisticsPrivate +{ std::shared_ptr statistics; }; @@ -63,10 +64,9 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GParquetStatistics, gparquet_statistics, G_TYPE_OBJECT) -#define GPARQUET_STATISTICS_GET_PRIVATE(object) \ - static_cast( \ - gparquet_statistics_get_instance_private( \ - GPARQUET_STATISTICS(object))) +#define GPARQUET_STATISTICS_GET_PRIVATE(object) \ + static_cast( \ + gparquet_statistics_get_instance_private(GPARQUET_STATISTICS(object))) static void gparquet_statistics_finalize(GObject *object) @@ -87,8 +87,7 @@ gparquet_statistics_set_property(GObject *object, switch (prop_id) { case PROP_STATISTICS: priv->statistics = - *static_cast *>( - g_value_get_pointer(value)); + *static_cast *>(g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -100,7 +99,7 @@ static void gparquet_statistics_init(GParquetStatistics *object) { auto priv = GPARQUET_STATISTICS_GET_PRIVATE(object); - new(&priv->statistics) std::shared_ptr; + new (&priv->statistics) std::shared_ptr; } static void @@ -111,11 +110,11 @@ gparquet_statistics_class_init(GParquetStatisticsClass *klass) gobject_class->set_property = gparquet_statistics_set_property; GParamSpec *spec; - spec = g_param_spec_pointer("statistics", - "Statistics", - "The raw std::shared_ptr", - static_cast(G_PARAM_WRITABLE | - G_PARAM_CONSTRUCT_ONLY)); + spec = g_param_spec_pointer( + "statistics", + "Statistics", + "The raw std::shared_ptr", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(gobject_class, PROP_STATISTICS, spec); } @@ -228,16 +227,14 @@ gparquet_statistics_has_min_max(GParquetStatistics *statistics) return parquet_statistics->HasMinMax(); } - G_END_DECLS namespace { template typename std::shared_ptr gparquet_typed_statistics_get_raw(GParquetStatisticsClass *statistics) { - return - std::static_pointer_cast( - gparquet_statistics_get_raw(GPARQUET_STATISTICS(statistics))); + return std::static_pointer_cast( + gparquet_statistics_get_raw(GPARQUET_STATISTICS(statistics))); } template @@ -257,10 +254,9 @@ namespace { gparquet_typed_statistics_get_raw(statistics); return parquet_statistics->max(); } -} +} // namespace G_BEGIN_DECLS - G_DEFINE_TYPE(GParquetBooleanStatistics, gparquet_boolean_statistics, GPARQUET_TYPE_STATISTICS) @@ -303,7 +299,6 @@ gparquet_boolean_statistics_get_max(GParquetBooleanStatistics *statistics) return gparquet_typed_statistics_get_max(statistics); } - G_DEFINE_TYPE(GParquetInt32Statistics, gparquet_int32_statistics, GPARQUET_TYPE_STATISTICS) @@ -346,7 +341,6 @@ gparquet_int32_statistics_get_max(GParquetInt32Statistics *statistics) return gparquet_typed_statistics_get_max(statistics); } - G_DEFINE_TYPE(GParquetInt64Statistics, gparquet_int64_statistics, GPARQUET_TYPE_STATISTICS) @@ -389,7 +383,6 @@ gparquet_int64_statistics_get_max(GParquetInt64Statistics *statistics) return gparquet_typed_statistics_get_max(statistics); } - G_DEFINE_TYPE(GParquetFloatStatistics, gparquet_float_statistics, GPARQUET_TYPE_STATISTICS) @@ -432,7 +425,6 @@ gparquet_float_statistics_get_max(GParquetFloatStatistics *statistics) return gparquet_typed_statistics_get_max(statistics); } - G_DEFINE_TYPE(GParquetDoubleStatistics, gparquet_double_statistics, GPARQUET_TYPE_STATISTICS) @@ -475,8 +467,8 @@ gparquet_double_statistics_get_max(GParquetDoubleStatistics *statistics) return gparquet_typed_statistics_get_max(statistics); } - -struct GParquetByteArrayStatisticsPrivate { +struct GParquetByteArrayStatisticsPrivate +{ GBytes *min; GBytes *max; }; @@ -485,9 +477,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GParquetByteArrayStatistics, gparquet_byte_array_statistics, GPARQUET_TYPE_STATISTICS) -#define GPARQUET_BYTE_ARRAY_STATISTICS_GET_PRIVATE(object) \ - static_cast( \ - gparquet_byte_array_statistics_get_instance_private( \ +#define GPARQUET_BYTE_ARRAY_STATISTICS_GET_PRIVATE(object) \ + static_cast( \ + gparquet_byte_array_statistics_get_instance_private( \ GPARQUET_BYTE_ARRAY_STATISTICS(object))) static void @@ -514,8 +506,7 @@ gparquet_byte_array_statistics_init(GParquetByteArrayStatistics *object) } static void -gparquet_byte_array_statistics_class_init( - GParquetByteArrayStatisticsClass *klass) +gparquet_byte_array_statistics_class_init(GParquetByteArrayStatisticsClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); gobject_class->dispose = gparquet_byte_array_statistics_dispose; @@ -534,9 +525,8 @@ gparquet_byte_array_statistics_get_min(GParquetByteArrayStatistics *statistics) { auto priv = GPARQUET_BYTE_ARRAY_STATISTICS_GET_PRIVATE(statistics); if (!priv->min) { - const auto& parquet_min = - gparquet_typed_statistics_get_min< - parquet::ByteArrayStatistics>(statistics); + const auto &parquet_min = + gparquet_typed_statistics_get_min(statistics); priv->min = g_bytes_new_static(parquet_min.ptr, parquet_min.len); } return priv->min; @@ -555,16 +545,15 @@ gparquet_byte_array_statistics_get_max(GParquetByteArrayStatistics *statistics) { auto priv = GPARQUET_BYTE_ARRAY_STATISTICS_GET_PRIVATE(statistics); if (!priv->max) { - const auto& parquet_max = - gparquet_typed_statistics_get_max< - parquet::ByteArrayStatistics>(statistics); + const auto &parquet_max = + gparquet_typed_statistics_get_max(statistics); priv->max = g_bytes_new_static(parquet_max.ptr, parquet_max.len); } return priv->max; } - -struct GParquetFixedLengthByteArrayStatisticsPrivate { +struct GParquetFixedLengthByteArrayStatisticsPrivate +{ GBytes *min; GBytes *max; }; @@ -573,9 +562,9 @@ G_DEFINE_TYPE_WITH_PRIVATE(GParquetFixedLengthByteArrayStatistics, gparquet_fixed_length_byte_array_statistics, GPARQUET_TYPE_STATISTICS) -#define GPARQUET_FIXED_LENGTH_BYTE_ARRAY_STATISTICS_GET_PRIVATE(object) \ - static_cast( \ - gparquet_fixed_length_byte_array_statistics_get_instance_private( \ +#define GPARQUET_FIXED_LENGTH_BYTE_ARRAY_STATISTICS_GET_PRIVATE(object) \ + static_cast( \ + gparquet_fixed_length_byte_array_statistics_get_instance_private( \ GPARQUET_FIXED_LENGTH_BYTE_ARRAY_STATISTICS(object))) static void @@ -593,8 +582,8 @@ gparquet_fixed_length_byte_array_statistics_dispose(GObject *object) priv->max = nullptr; } - G_OBJECT_CLASS(gparquet_fixed_length_byte_array_statistics_parent_class)-> - dispose(object); + G_OBJECT_CLASS(gparquet_fixed_length_byte_array_statistics_parent_class) + ->dispose(object); } static void @@ -623,8 +612,7 @@ GBytes * gparquet_fixed_length_byte_array_statistics_get_min( GParquetFixedLengthByteArrayStatistics *statistics) { - auto priv = - GPARQUET_FIXED_LENGTH_BYTE_ARRAY_STATISTICS_GET_PRIVATE(statistics); + auto priv = GPARQUET_FIXED_LENGTH_BYTE_ARRAY_STATISTICS_GET_PRIVATE(statistics); if (!priv->min) { auto parquet_statistics = gparquet_typed_statistics_get_raw(statistics); @@ -646,8 +634,7 @@ GBytes * gparquet_fixed_length_byte_array_statistics_get_max( GParquetFixedLengthByteArrayStatistics *statistics) { - auto priv = - GPARQUET_FIXED_LENGTH_BYTE_ARRAY_STATISTICS_GET_PRIVATE(statistics); + auto priv = GPARQUET_FIXED_LENGTH_BYTE_ARRAY_STATISTICS_GET_PRIVATE(statistics); if (!priv->max) { auto parquet_statistics = gparquet_typed_statistics_get_raw(statistics); @@ -657,44 +644,39 @@ gparquet_fixed_length_byte_array_statistics_get_max( return priv->max; } - G_END_DECLS - GParquetStatistics * -gparquet_statistics_new_raw( - std::shared_ptr *parquet_statistics) +gparquet_statistics_new_raw(std::shared_ptr *parquet_statistics) { GType type = GPARQUET_TYPE_STATISTICS; switch ((*parquet_statistics)->physical_type()) { - case parquet::Type::BOOLEAN: - type = GPARQUET_TYPE_BOOLEAN_STATISTICS; - break; - case parquet::Type::INT32: - type = GPARQUET_TYPE_INT32_STATISTICS; - break; - case parquet::Type::INT64: - type = GPARQUET_TYPE_INT64_STATISTICS; - break; - case parquet::Type::FLOAT: - type = GPARQUET_TYPE_FLOAT_STATISTICS; - break; - case parquet::Type::DOUBLE: - type = GPARQUET_TYPE_DOUBLE_STATISTICS; - break; - case parquet::Type::BYTE_ARRAY: - type = GPARQUET_TYPE_BYTE_ARRAY_STATISTICS; - break; - case parquet::Type::FIXED_LEN_BYTE_ARRAY: - type = GPARQUET_TYPE_FIXED_LENGTH_BYTE_ARRAY_STATISTICS; - break; - default: - break; + case parquet::Type::BOOLEAN: + type = GPARQUET_TYPE_BOOLEAN_STATISTICS; + break; + case parquet::Type::INT32: + type = GPARQUET_TYPE_INT32_STATISTICS; + break; + case parquet::Type::INT64: + type = GPARQUET_TYPE_INT64_STATISTICS; + break; + case parquet::Type::FLOAT: + type = GPARQUET_TYPE_FLOAT_STATISTICS; + break; + case parquet::Type::DOUBLE: + type = GPARQUET_TYPE_DOUBLE_STATISTICS; + break; + case parquet::Type::BYTE_ARRAY: + type = GPARQUET_TYPE_BYTE_ARRAY_STATISTICS; + break; + case parquet::Type::FIXED_LEN_BYTE_ARRAY: + type = GPARQUET_TYPE_FIXED_LENGTH_BYTE_ARRAY_STATISTICS; + break; + default: + break; } auto statistics = - GPARQUET_STATISTICS(g_object_new(type, - "statistics", parquet_statistics, - NULL)); + GPARQUET_STATISTICS(g_object_new(type, "statistics", parquet_statistics, NULL)); return statistics; } diff --git a/c_glib/parquet-glib/statistics.h b/c_glib/parquet-glib/statistics.h index ebc909c59ceec..f28e2a3713638 100644 --- a/c_glib/parquet-glib/statistics.h +++ b/c_glib/parquet-glib/statistics.h @@ -23,14 +23,9 @@ G_BEGIN_DECLS - -#define GPARQUET_TYPE_STATISTICS \ - (gparquet_statistics_get_type()) -G_DECLARE_DERIVABLE_TYPE(GParquetStatistics, - gparquet_statistics, - GPARQUET, - STATISTICS, - GObject) +#define GPARQUET_TYPE_STATISTICS (gparquet_statistics_get_type()) +G_DECLARE_DERIVABLE_TYPE( + GParquetStatistics, gparquet_statistics, GPARQUET, STATISTICS, GObject) struct _GParquetStatisticsClass { GObjectClass parent_class; @@ -59,9 +54,7 @@ GARROW_AVAILABLE_IN_8_0 gboolean gparquet_statistics_has_min_max(GParquetStatistics *statistics); - -#define GPARQUET_TYPE_BOOLEAN_STATISTICS \ - (gparquet_boolean_statistics_get_type()) +#define GPARQUET_TYPE_BOOLEAN_STATISTICS (gparquet_boolean_statistics_get_type()) G_DECLARE_DERIVABLE_TYPE(GParquetBooleanStatistics, gparquet_boolean_statistics, GPARQUET, @@ -79,9 +72,7 @@ GARROW_AVAILABLE_IN_8_0 gboolean gparquet_boolean_statistics_get_max(GParquetBooleanStatistics *statistics); - -#define GPARQUET_TYPE_INT32_STATISTICS \ - (gparquet_int32_statistics_get_type()) +#define GPARQUET_TYPE_INT32_STATISTICS (gparquet_int32_statistics_get_type()) G_DECLARE_DERIVABLE_TYPE(GParquetInt32Statistics, gparquet_int32_statistics, GPARQUET, @@ -99,9 +90,7 @@ GARROW_AVAILABLE_IN_8_0 gint32 gparquet_int32_statistics_get_max(GParquetInt32Statistics *statistics); - -#define GPARQUET_TYPE_INT64_STATISTICS \ - (gparquet_int64_statistics_get_type()) +#define GPARQUET_TYPE_INT64_STATISTICS (gparquet_int64_statistics_get_type()) G_DECLARE_DERIVABLE_TYPE(GParquetInt64Statistics, gparquet_int64_statistics, GPARQUET, @@ -119,9 +108,7 @@ GARROW_AVAILABLE_IN_8_0 gint64 gparquet_int64_statistics_get_max(GParquetInt64Statistics *statistics); - -#define GPARQUET_TYPE_FLOAT_STATISTICS \ - (gparquet_float_statistics_get_type()) +#define GPARQUET_TYPE_FLOAT_STATISTICS (gparquet_float_statistics_get_type()) G_DECLARE_DERIVABLE_TYPE(GParquetFloatStatistics, gparquet_float_statistics, GPARQUET, @@ -139,9 +126,7 @@ GARROW_AVAILABLE_IN_8_0 gfloat gparquet_float_statistics_get_max(GParquetFloatStatistics *statistics); - -#define GPARQUET_TYPE_DOUBLE_STATISTICS \ - (gparquet_double_statistics_get_type()) +#define GPARQUET_TYPE_DOUBLE_STATISTICS (gparquet_double_statistics_get_type()) G_DECLARE_DERIVABLE_TYPE(GParquetDoubleStatistics, gparquet_double_statistics, GPARQUET, @@ -159,9 +144,7 @@ GARROW_AVAILABLE_IN_8_0 gdouble gparquet_double_statistics_get_max(GParquetDoubleStatistics *statistics); - -#define GPARQUET_TYPE_BYTE_ARRAY_STATISTICS \ - (gparquet_byte_array_statistics_get_type()) +#define GPARQUET_TYPE_BYTE_ARRAY_STATISTICS (gparquet_byte_array_statistics_get_type()) G_DECLARE_DERIVABLE_TYPE(GParquetByteArrayStatistics, gparquet_byte_array_statistics, GPARQUET, @@ -179,8 +162,7 @@ GARROW_AVAILABLE_IN_8_0 GBytes * gparquet_byte_array_statistics_get_max(GParquetByteArrayStatistics *statistics); - -#define GPARQUET_TYPE_FIXED_LENGTH_BYTE_ARRAY_STATISTICS \ +#define GPARQUET_TYPE_FIXED_LENGTH_BYTE_ARRAY_STATISTICS \ (gparquet_fixed_length_byte_array_statistics_get_type()) G_DECLARE_DERIVABLE_TYPE(GParquetFixedLengthByteArrayStatistics, gparquet_fixed_length_byte_array_statistics, @@ -201,5 +183,4 @@ GBytes * gparquet_fixed_length_byte_array_statistics_get_max( GParquetFixedLengthByteArrayStatistics *statistics); - G_END_DECLS diff --git a/c_glib/parquet-glib/statistics.hpp b/c_glib/parquet-glib/statistics.hpp index 238b9f173a5f3..48574217d8aad 100644 --- a/c_glib/parquet-glib/statistics.hpp +++ b/c_glib/parquet-glib/statistics.hpp @@ -24,7 +24,6 @@ #include GParquetStatistics * -gparquet_statistics_new_raw( - std::shared_ptr *parquet_statistics); +gparquet_statistics_new_raw(std::shared_ptr *parquet_statistics); std::shared_ptr gparquet_statistics_get_raw(GParquetStatistics *statistics); From b171b2634cd02cb7b248c45ba265495270183eec Mon Sep 17 00:00:00 2001 From: Hyunseok Seo Date: Mon, 11 Mar 2024 17:49:10 +0900 Subject: [PATCH 13/30] GH-40023: [Python] Use Cast() instead of CastTo (#40116) ### Rationale for this change Remove legacy code ### What changes are included in this PR? * Replace the legacy scalar CastTo implementation for Python. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * Closes: #40023 Authored-by: Hyunseok Seo Signed-off-by: AlenkaF --- python/pyarrow/includes/libarrow.pxd | 4 +++- python/pyarrow/tests/pyarrow_cython_example.pyx | 14 ++++++++++---- python/pyarrow/tests/test_cython.py | 5 ++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/python/pyarrow/includes/libarrow.pxd b/python/pyarrow/includes/libarrow.pxd index 5ae0f2e0b55b9..e44c699fc5574 100644 --- a/python/pyarrow/includes/libarrow.pxd +++ b/python/pyarrow/includes/libarrow.pxd @@ -1161,7 +1161,6 @@ cdef extern from "arrow/api.h" namespace "arrow" nogil: c_bool Equals(const CScalar& other) const CStatus Validate() const CStatus ValidateFull() const - CResult[shared_ptr[CScalar]] CastTo(shared_ptr[CDataType] to) const cdef cppclass CScalarHash" arrow::Scalar::Hash": size_t operator()(const shared_ptr[CScalar]& scalar) const @@ -3010,3 +3009,6 @@ cdef extern from "arrow/python/udf.h" namespace "arrow::py" nogil: CResult[shared_ptr[CRecordBatchReader]] CallTabularFunction( const c_string& func_name, const vector[CDatum]& args, CFunctionRegistry* registry) + +cdef extern from "arrow/compute/cast.h" namespace "arrow::compute": + CResult[CDatum] Cast(const CDatum& value, const CCastOptions& options) diff --git a/python/pyarrow/tests/pyarrow_cython_example.pyx b/python/pyarrow/tests/pyarrow_cython_example.pyx index 08f5e17a980eb..9ae59efb8b78c 100644 --- a/python/pyarrow/tests/pyarrow_cython_example.pyx +++ b/python/pyarrow/tests/pyarrow_cython_example.pyx @@ -42,7 +42,9 @@ def cast_scalar(scalar, to_type): cdef: shared_ptr[CScalar] c_scalar shared_ptr[CDataType] c_type - CResult[shared_ptr[CScalar]] c_result + CCastOptions cast_options + CDatum c_datum + CResult[CDatum] c_cast_result c_scalar = pyarrow_unwrap_scalar(scalar) if c_scalar.get() == NULL: @@ -50,6 +52,10 @@ def cast_scalar(scalar, to_type): c_type = pyarrow_unwrap_data_type(to_type) if c_type.get() == NULL: raise TypeError("not a type") - c_result = c_scalar.get().CastTo(c_type) - c_scalar = GetResultValue(c_result) - return pyarrow_wrap_scalar(c_scalar) + + c_datum = CDatum(c_scalar) + cast_options = CCastOptions() + cast_options.to_type = c_type + c_cast_result = Cast(c_datum, cast_options) + c_datum = GetResultValue(c_cast_result) + return pyarrow_wrap_scalar(c_datum.scalar()) diff --git a/python/pyarrow/tests/test_cython.py b/python/pyarrow/tests/test_cython.py index 59875e7b01132..0eeae5d65f7d5 100644 --- a/python/pyarrow/tests/test_cython.py +++ b/python/pyarrow/tests/test_cython.py @@ -25,7 +25,6 @@ import pyarrow as pa import pyarrow.tests.util as test_util - here = os.path.dirname(os.path.abspath(__file__)) test_ld_path = os.environ.get('PYARROW_TEST_LD_PATH', '') if os.name == 'posix': @@ -35,7 +34,6 @@ else: compiler_opts = [] - setup_template = """if 1: from setuptools import setup from Cython.Build import cythonize @@ -77,7 +75,8 @@ def check_cython_example_module(mod): cast_scal = mod.cast_scalar(scal, pa.utf8()) assert cast_scal == pa.scalar("123") with pytest.raises(NotImplementedError, - match="casting scalars of type int64 to type list"): + match="Unsupported cast from int64 to list using function " + "cast_list"): mod.cast_scalar(scal, pa.list_(pa.int64())) From 1eb46f763a73d313466fdc895eae1f35fac37945 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Mon, 11 Mar 2024 17:56:55 +0900 Subject: [PATCH 14/30] GH-40441: [GLib][Docs] Use Sphinx for Apache Arrow GLib front page (#40442) ### Rationale for this change Using both of apache/arrow and apache/arrow-site to maintain https://arrow.apache.org/docs/c_glib/ is difficult to maintain. ### What changes are included in this PR? Use https://github.com/apache/arrow/tree/main/docs/source/c_glib as https://arrow.apache.org/docs/c_glib/ 's source. ### Are these changes tested? Yes. ### Are there any user-facing changes? Yes. * GitHub Issue: #40441 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- ci/conda_env_sphinx.txt | 2 + docs/requirements.txt | 1 + docs/source/c_glib/arrow-cuda-glib/index.md | 23 ++++++++++ .../source/c_glib/arrow-dataset-glib/index.md | 23 ++++++++++ docs/source/c_glib/arrow-flight-glib/index.md | 23 ++++++++++ .../c_glib/arrow-flight-sql-glib/index.md | 23 ++++++++++ docs/source/c_glib/arrow-glib/index.md | 23 ++++++++++ docs/source/c_glib/gandiva-glib/index.md | 23 ++++++++++ docs/source/c_glib/index.md | 42 +++++++++++++++++++ docs/source/c_glib/index.rst | 23 ---------- docs/source/c_glib/parquet-glib/index.md | 23 ++++++++++ docs/source/conf.py | 24 ++++++++++- 12 files changed, 229 insertions(+), 24 deletions(-) create mode 100644 docs/source/c_glib/arrow-cuda-glib/index.md create mode 100644 docs/source/c_glib/arrow-dataset-glib/index.md create mode 100644 docs/source/c_glib/arrow-flight-glib/index.md create mode 100644 docs/source/c_glib/arrow-flight-sql-glib/index.md create mode 100644 docs/source/c_glib/arrow-glib/index.md create mode 100644 docs/source/c_glib/gandiva-glib/index.md create mode 100644 docs/source/c_glib/index.md delete mode 100644 docs/source/c_glib/index.rst create mode 100644 docs/source/c_glib/parquet-glib/index.md diff --git a/ci/conda_env_sphinx.txt b/ci/conda_env_sphinx.txt index 0e50875fc1ef8..6899f9c36a7f6 100644 --- a/ci/conda_env_sphinx.txt +++ b/ci/conda_env_sphinx.txt @@ -19,6 +19,8 @@ breathe doxygen ipython +linkify-it-py +myst-parser numpydoc pydata-sphinx-theme=0.14 sphinx-autobuild diff --git a/docs/requirements.txt b/docs/requirements.txt index 5d6fec7ddf72e..252344a74a58f 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -4,6 +4,7 @@ breathe ipython +myst-parser[linkify] numpydoc pydata-sphinx-theme~=0.14 sphinx-autobuild diff --git a/docs/source/c_glib/arrow-cuda-glib/index.md b/docs/source/c_glib/arrow-cuda-glib/index.md new file mode 100644 index 0000000000000..3ca5470a09b0c --- /dev/null +++ b/docs/source/c_glib/arrow-cuda-glib/index.md @@ -0,0 +1,23 @@ + + +(arrow-cuda-glib)= +# Apache Arrow CUDA GLib + +Stub page for the Apache Arrow CUDA GLib docs; actual source is located in c_glib/ sub-directory. diff --git a/docs/source/c_glib/arrow-dataset-glib/index.md b/docs/source/c_glib/arrow-dataset-glib/index.md new file mode 100644 index 0000000000000..50101b299c1a2 --- /dev/null +++ b/docs/source/c_glib/arrow-dataset-glib/index.md @@ -0,0 +1,23 @@ + + +(arrow-dataset-glib)= +# Apache Arrow Dataset GLib + +Stub page for the Apache Arrow Dataset GLib docs; actual source is located in c_glib/ sub-directory. diff --git a/docs/source/c_glib/arrow-flight-glib/index.md b/docs/source/c_glib/arrow-flight-glib/index.md new file mode 100644 index 0000000000000..0a4e59778c820 --- /dev/null +++ b/docs/source/c_glib/arrow-flight-glib/index.md @@ -0,0 +1,23 @@ + + +(arrow-flight-glib)= +# Apache Arrow Flight GLib + +Stub page for the Apache Arrow Flight GLib docs; actual source is located in c_glib/ sub-directory. diff --git a/docs/source/c_glib/arrow-flight-sql-glib/index.md b/docs/source/c_glib/arrow-flight-sql-glib/index.md new file mode 100644 index 0000000000000..acc4422212418 --- /dev/null +++ b/docs/source/c_glib/arrow-flight-sql-glib/index.md @@ -0,0 +1,23 @@ + + +(arrow-flight-sql-glib)= +# Apache Arrow Flight SQL GLib + +Stub page for the Apache Arrow Flight SQL GLib docs; actual source is located in c_glib/ sub-directory. diff --git a/docs/source/c_glib/arrow-glib/index.md b/docs/source/c_glib/arrow-glib/index.md new file mode 100644 index 0000000000000..4ff5a6629adb5 --- /dev/null +++ b/docs/source/c_glib/arrow-glib/index.md @@ -0,0 +1,23 @@ + + +(arrow-glib)= +# Apache Arrow GLib + +Stub page for the Apache Arrow GLib docs; actual source is located in c_glib/ sub-directory. diff --git a/docs/source/c_glib/gandiva-glib/index.md b/docs/source/c_glib/gandiva-glib/index.md new file mode 100644 index 0000000000000..212a1161bba93 --- /dev/null +++ b/docs/source/c_glib/gandiva-glib/index.md @@ -0,0 +1,23 @@ + + +(gandiva-glib)= +# Gandiva GLib + +Stub page for the Gandiva GLib docs; actual source is located in c_glib/ sub-directory. diff --git a/docs/source/c_glib/index.md b/docs/source/c_glib/index.md new file mode 100644 index 0000000000000..2b663639bf200 --- /dev/null +++ b/docs/source/c_glib/index.md @@ -0,0 +1,42 @@ + + +(c-glib)= +# Apache Arrow GLib (C) + +Apache Arrow GLib is a wrapper library for Apache Arrow C++. Apache Arrow GLib provides C API. + +Apache Arrow GLib supports [GObject Introspection][gobject-introspection]. It means that you can create language bindings at runtime or compile time automatically. + +## API reference manuals + +```{toctree} +:maxdepth: 1 + +Apache Arrow GLib +Apache Arrow CUDA GLib +Apache Arrow Dataset +Apache Arrow Flight GLib +Apache Arrow Flight SQL GLib +Apache Parquet GLib +Gandiva GLib +``` + +[gobject-introspection]: https://gi.readthedocs.io/en/latest/ + diff --git a/docs/source/c_glib/index.rst b/docs/source/c_glib/index.rst deleted file mode 100644 index b10524eb2e8a5..0000000000000 --- a/docs/source/c_glib/index.rst +++ /dev/null @@ -1,23 +0,0 @@ -.. Licensed to the Apache Software Foundation (ASF) under one -.. or more contributor license agreements. See the NOTICE file -.. distributed with this work for additional information -.. regarding copyright ownership. The ASF licenses this file -.. to you under the Apache License, Version 2.0 (the -.. "License"); you may not use this file except in compliance -.. with the License. You may obtain a copy of the License at - -.. http://www.apache.org/licenses/LICENSE-2.0 - -.. Unless required by applicable law or agreed to in writing, -.. software distributed under the License is distributed on an -.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -.. KIND, either express or implied. See the License for the -.. specific language governing permissions and limitations -.. under the License. - -.. _c-glib: - -C/GLib docs -=========== - -Stub page for the C/GLib docs; actual source is located in c_glib/doc/ sub-directory. diff --git a/docs/source/c_glib/parquet-glib/index.md b/docs/source/c_glib/parquet-glib/index.md new file mode 100644 index 0000000000000..5d6fd634d4827 --- /dev/null +++ b/docs/source/c_glib/parquet-glib/index.md @@ -0,0 +1,23 @@ + + +(parquet-glib)= +# Apache Parquet GLib + +Stub page for the Apache Parquet GLib docs; actual source is located in c_glib/ sub-directory. diff --git a/docs/source/conf.py b/docs/source/conf.py index c6be6cb94cfb5..7915e2c2c485a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -114,6 +114,7 @@ 'breathe', 'IPython.sphinxext.ipython_console_highlighting', 'IPython.sphinxext.ipython_directive', + 'myst_parser', 'numpydoc', 'sphinx_design', 'sphinx_copybutton', @@ -150,6 +151,24 @@ # ipython directive options ipython_mplbackend = '' +# MyST-Parser configuration +myst_enable_extensions = [ + 'amsmath', + 'attrs_inline', + # 'colon_fence', + 'deflist', + 'dollarmath', + 'fieldlist', + 'html_admonition', + 'html_image', + 'linkify', + # 'replacements', + # 'smartquotes', + 'strikethrough', + 'substitution', + 'tasklist', +] + # numpydoc configuration numpydoc_xref_param_type = True numpydoc_show_class_members = False @@ -188,7 +207,10 @@ # You can specify multiple suffix as a list of string: # -source_suffix = ['.rst'] +source_suffix = { + '.md': 'markdown', + '.rst': 'restructuredtext', +} autosummary_generate = True From 8ed45601f906a5c1b7ff8b5bff53d4cf193ce526 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 04:35:10 +0900 Subject: [PATCH 15/30] MINOR: [Java] Bump org.apache.commons:commons-dbcp2 from 2.9.0 to 2.12.0 in /java (#40460) Bumps org.apache.commons:commons-dbcp2 from 2.9.0 to 2.12.0. [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.apache.commons:commons-dbcp2&package-manager=maven&previous-version=2.9.0&new-version=2.12.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@ dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@ dependabot rebase` will rebase this PR - `@ dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@ dependabot merge` will merge this PR after your CI passes on it - `@ dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@ dependabot cancel merge` will cancel a previously requested merge and block automerging - `@ dependabot reopen` will reopen this PR if it is closed - `@ dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@ dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@ dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@ dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@ dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Sutou Kouhei --- java/flight/flight-sql/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/flight/flight-sql/pom.xml b/java/flight/flight-sql/pom.xml index a0598f70b9545..1da6ed276011b 100644 --- a/java/flight/flight-sql/pom.xml +++ b/java/flight/flight-sql/pom.xml @@ -86,7 +86,7 @@ org.apache.commons commons-dbcp2 - 2.9.0 + 2.12.0 test From 49b5619eed7556fcb3c7625cafc80e92d9d3f6c5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 04:35:47 +0900 Subject: [PATCH 16/30] MINOR: [Java] Bump org.codehaus.mojo:properties-maven-plugin from 1.1.0 to 1.2.1 in /java (#40461) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [org.codehaus.mojo:properties-maven-plugin](https://github.com/mojohaus/properties-maven-plugin) from 1.1.0 to 1.2.1.
Release notes

Sourced from org.codehaus.mojo:properties-maven-plugin's releases.

1.2.1

🚀 New features and improvements

🐛 Bug Fixes

📦 Dependency updates

👻 Maintenance

1.2.0

🚀 New features and improvements

🐛 Bug Fixes

📦 Dependency updates

... (truncated)

Commits
  • df184c3 [maven-release-plugin] prepare release 1.2.1
  • b3aab51 Add documentation about plugin limitations
  • 62ddbea Avoid NPE on outputFile checking
  • 1ef42e0 Introduce properties manager for easy implements other properties formats
  • 8f4e6be read-project-properties optimization - set all properties in one call
  • c816bf2 Fix unwarranted circular property definition error from CircularDefinitionPre...
  • 182eac3 Bump org.codehaus.mojo:mojo-parent from 76 to 77
  • 0b1a116 Update ReadPropertiesMojo.java
  • d8a48cd [maven-release-plugin] prepare for next development iteration
  • 5105ebc [maven-release-plugin] prepare release 1.2.0
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.codehaus.mojo:properties-maven-plugin&package-manager=maven&previous-version=1.1.0&new-version=1.2.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@ dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@ dependabot rebase` will rebase this PR - `@ dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@ dependabot merge` will merge this PR after your CI passes on it - `@ dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@ dependabot cancel merge` will cancel a previously requested merge and block automerging - `@ dependabot reopen` will reopen this PR if it is closed - `@ dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@ dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@ dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@ dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@ dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Sutou Kouhei --- java/flight/flight-sql-jdbc-core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/flight/flight-sql-jdbc-core/pom.xml b/java/flight/flight-sql-jdbc-core/pom.xml index 020f181f5d107..53cf11cbf6ecd 100644 --- a/java/flight/flight-sql-jdbc-core/pom.xml +++ b/java/flight/flight-sql-jdbc-core/pom.xml @@ -157,7 +157,7 @@ org.codehaus.mojo properties-maven-plugin - 1.1.0 + 1.2.1 write-project-properties-to-file From 8ee9679d401183220a4566681ca7ef9e887ba4d2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 04:36:15 +0900 Subject: [PATCH 17/30] MINOR: [Java] Bump org.apache.maven.plugins:maven-shade-plugin from 3.2.4 to 3.5.2 in /java (#40462) Bumps [org.apache.maven.plugins:maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.2.4 to 3.5.2.
Release notes

Sourced from org.apache.maven.plugins:maven-shade-plugin's releases.

3.5.1

Release Notes - Maven Shade Plugin - Version 3.5.1

Bug

  • [MSHADE-454] - Shade Plugin does not work with JDK 20

Improvement

  • [MSHADE-459] - Prepare to build and pass tests with Java 21

Task

Dependency upgrade

Maven Shade Plugin 3.5.0 release notes https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12317921&version=12352951

Release Notes - Maven Shade Plugin - Version 3.5.0

... (truncated)

Commits
  • 95e22b4 [maven-release-plugin] prepare release maven-shade-plugin-3.5.2
  • d807fea Bump org.vafer:jdependency from 2.9.0 to 2.10
  • 6d60841 Bump org.apache.commons:commons-compress from 1.23.0 to 1.25.0
  • 68457e5 [MSHADE-468] add system requirements history
  • 631371b Add mshade-462 IT
  • cb7b10d [MSHADE-462] 3.5.1 not compatible with 3.4.1: The version cannot be empty.
  • bd982e7 [MSHADE-420] fix time when read from extra field
  • 3692f81 [SHADE-420] create IT: 2 runs with different TZ give different jars
  • a5315de [MSHADE-464] Maven 3.6.3 as minimum requirements
  • e7077c6 [MSHADE-467] Improved concurrency problem fix
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.apache.maven.plugins:maven-shade-plugin&package-manager=maven&previous-version=3.2.4&new-version=3.5.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@ dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@ dependabot rebase` will rebase this PR - `@ dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@ dependabot merge` will merge this PR after your CI passes on it - `@ dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@ dependabot cancel merge` will cancel a previously requested merge and block automerging - `@ dependabot reopen` will reopen this PR if it is closed - `@ dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@ dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@ dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@ dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@ dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Sutou Kouhei --- java/flight/flight-core/pom.xml | 2 +- java/pom.xml | 2 +- java/vector/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/java/flight/flight-core/pom.xml b/java/flight/flight-core/pom.xml index e7b299fdbe850..757558398fea6 100644 --- a/java/flight/flight-core/pom.xml +++ b/java/flight/flight-core/pom.xml @@ -164,7 +164,7 @@ issues in the arrow-tools tests looking up FlatBuffer dependencies. --> - 3.2.4 + 3.5.2 shade-main diff --git a/java/pom.xml b/java/pom.xml index f39e7882153a6..1fd69a12fba56 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -450,7 +450,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.5.1 + 3.5.2 maven-surefire-plugin diff --git a/java/vector/pom.xml b/java/vector/pom.xml index 3638712ea2109..5cd6d0a00fcca 100644 --- a/java/vector/pom.xml +++ b/java/vector/pom.xml @@ -184,7 +184,7 @@ issues in the arrow-tools tests looking up FlatBuffer dependencies. --> - 3.2.4 + 3.5.2 package From 10d141ce586245c319d72766f4e16d8dd0b46845 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 04:36:37 +0900 Subject: [PATCH 18/30] MINOR: [Java] Bump commons-io:commons-io from 2.7 to 2.15.1 in /java (#40463) Bumps commons-io:commons-io from 2.7 to 2.15.1. [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=commons-io:commons-io&package-manager=maven&previous-version=2.7&new-version=2.15.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@ dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@ dependabot rebase` will rebase this PR - `@ dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@ dependabot merge` will merge this PR after your CI passes on it - `@ dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@ dependabot cancel merge` will cancel a previously requested merge and block automerging - `@ dependabot reopen` will reopen this PR if it is closed - `@ dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@ dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@ dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@ dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@ dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Sutou Kouhei --- java/dataset/pom.xml | 2 +- java/flight/flight-sql-jdbc-core/pom.xml | 2 +- java/flight/flight-sql-jdbc-driver/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/java/dataset/pom.xml b/java/dataset/pom.xml index 4c302ea59dbe3..a003fd18068ec 100644 --- a/java/dataset/pom.xml +++ b/java/dataset/pom.xml @@ -150,7 +150,7 @@ commons-io commons-io - 2.7 + 2.15.1 test diff --git a/java/flight/flight-sql-jdbc-core/pom.xml b/java/flight/flight-sql-jdbc-core/pom.xml index 53cf11cbf6ecd..20996d7496c05 100644 --- a/java/flight/flight-sql-jdbc-core/pom.xml +++ b/java/flight/flight-sql-jdbc-core/pom.xml @@ -96,7 +96,7 @@ commons-io commons-io - 2.7 + 2.15.1 test diff --git a/java/flight/flight-sql-jdbc-driver/pom.xml b/java/flight/flight-sql-jdbc-driver/pom.xml index bf053f3f7798a..84ec1ff8c1f95 100644 --- a/java/flight/flight-sql-jdbc-driver/pom.xml +++ b/java/flight/flight-sql-jdbc-driver/pom.xml @@ -140,7 +140,7 @@ commons-io commons-io - 2.7 + 2.15.1 test From cb1e29c0c1fdc691a8a4f3bc7621c6fdcf181dfc Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Tue, 12 Mar 2024 04:39:02 +0900 Subject: [PATCH 19/30] GH-40438: [GLib] Add GArrowTimestampParser (#40457) ### Rationale for this change It's a binding of `arrow::TimestampParser`. ### What changes are included in this PR? Add `GArrowStrptimeTimestampParser` and `GArrowISO8601TimestampParser`. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #40438 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- c_glib/arrow-glib/meson.build | 9 +- c_glib/arrow-glib/reader.cpp | 4 +- c_glib/arrow-glib/timestamp-parser.cpp | 207 +++++++++++++++++++++++++ c_glib/arrow-glib/timestamp-parser.h | 74 +++++++++ c_glib/arrow-glib/timestamp-parser.hpp | 27 ++++ c_glib/test/test-timestamp-parser.rb | 42 +++++ 6 files changed, 358 insertions(+), 5 deletions(-) create mode 100644 c_glib/arrow-glib/timestamp-parser.cpp create mode 100644 c_glib/arrow-glib/timestamp-parser.h create mode 100644 c_glib/arrow-glib/timestamp-parser.hpp create mode 100644 c_glib/test/test-timestamp-parser.rb diff --git a/c_glib/arrow-glib/meson.build b/c_glib/arrow-glib/meson.build index 7efba11bf9417..a914002864341 100644 --- a/c_glib/arrow-glib/meson.build +++ b/c_glib/arrow-glib/meson.build @@ -36,9 +36,10 @@ sources = files( 'record-batch.cpp', 'scalar.cpp', 'schema.cpp', - 'table.cpp', 'table-builder.cpp', + 'table.cpp', 'tensor.cpp', + 'timestamp-parser.cpp', 'type.cpp', ) @@ -99,9 +100,10 @@ c_headers = files( 'record-batch.h', 'scalar.h', 'schema.h', - 'table.h', 'table-builder.h', + 'table.h', 'tensor.h', + 'timestamp-parser.h', 'type.h', ) @@ -160,9 +162,10 @@ cpp_headers = files( 'record-batch.hpp', 'scalar.hpp', 'schema.hpp', - 'table.hpp', 'table-builder.hpp', + 'table.hpp', 'tensor.hpp', + 'timestamp-parser.hpp', 'type.hpp', ) diff --git a/c_glib/arrow-glib/reader.cpp b/c_glib/arrow-glib/reader.cpp index 4bde9ee32d5c6..0b388a4ba3814 100644 --- a/c_glib/arrow-glib/reader.cpp +++ b/c_glib/arrow-glib/reader.cpp @@ -136,7 +136,7 @@ garrow_record_batch_reader_class_init(GArrowRecordBatchReaderClass *klass) { auto gobject_class = G_OBJECT_CLASS(klass); gobject_class->finalize = garrow_record_batch_reader_finalize; - gobject_class->finalize = garrow_record_batch_reader_dispose; + gobject_class->dispose = garrow_record_batch_reader_dispose; gobject_class->set_property = garrow_record_batch_reader_set_property; GParamSpec *spec; @@ -187,7 +187,7 @@ garrow_record_batch_reader_import(gpointer c_abi_array_stream, GError **error) * @schema: (nullable): A #GArrowSchema to confirm to. * @error: (nullable): Return location for a #GError or %NULL. * - * Returns: The schema in the stream on success, %NULL on error. + * Returns: A newly created #GArrowRecordBatchReader. * * Since: 6.0.0 */ diff --git a/c_glib/arrow-glib/timestamp-parser.cpp b/c_glib/arrow-glib/timestamp-parser.cpp new file mode 100644 index 0000000000000..1e41daf082343 --- /dev/null +++ b/c_glib/arrow-glib/timestamp-parser.cpp @@ -0,0 +1,207 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#include + +G_BEGIN_DECLS + +/** + * SECTION: timestamp-parser + * @section_id: timestamp-parser-classes + * @title: TimestamParser classes + * @include: arrow-glib/arrow-glib.h + * + * #GArrowTimestampParser is a base class for parsing timestamp text. + * + * #GArrowStrptimeTimestampParser is a class for parsing timestamp + * text used by the given stprtime(3) format. + * + * #GArrowISO8601TimestampParser is a class for parsing ISO 8601 + * format timestamp text. + */ + +struct GArrowTimestampParserPrivate +{ + std::shared_ptr parser; +}; + +enum { + PROP_PARSER = 1, +}; + +G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GArrowTimestampParser, + garrow_timestamp_parser, + G_TYPE_OBJECT); + +#define GARROW_TIMESTAMP_PARSER_GET_PRIVATE(obj) \ + static_cast( \ + garrow_timestamp_parser_get_instance_private(GARROW_TIMESTAMP_PARSER(obj))) + +static void +garrow_timestamp_parser_finalize(GObject *object) +{ + auto priv = GARROW_TIMESTAMP_PARSER_GET_PRIVATE(object); + + priv->parser.~shared_ptr(); + + G_OBJECT_CLASS(garrow_timestamp_parser_parent_class)->finalize(object); +} + +static void +garrow_timestamp_parser_set_property(GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + auto priv = GARROW_TIMESTAMP_PARSER_GET_PRIVATE(object); + + switch (prop_id) { + case PROP_PARSER: + priv->parser = + *static_cast *>(g_value_get_pointer(value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + +static void +garrow_timestamp_parser_init(GArrowTimestampParser *object) +{ + auto priv = GARROW_TIMESTAMP_PARSER_GET_PRIVATE(object); + new (&priv->parser) std::shared_ptr; +} + +static void +garrow_timestamp_parser_class_init(GArrowTimestampParserClass *klass) +{ + auto gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = garrow_timestamp_parser_finalize; + gobject_class->set_property = garrow_timestamp_parser_set_property; + + GParamSpec *spec; + spec = g_param_spec_pointer( + "parser", + "Parser", + "The raw std::shared *", + static_cast(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property(gobject_class, PROP_PARSER, spec); +} + +/** + * garrow_timestamp_parser_get_kind: + * @parser: A #GArrowTimestampParser. + * + * Returns: The kind of this timestamp parser. + * + * Since: 16.0.0 + */ +const gchar * +garrow_timestamp_parser_get_kind(GArrowTimestampParser *parser) +{ + auto arrow_parser = garrow_timestamp_parser_get_raw(parser); + return arrow_parser->kind(); +} + +G_DEFINE_TYPE(GArrowStrptimeTimestampParser, + garrow_strptime_timestamp_parser, + GARROW_TYPE_TIMESTAMP_PARSER); + +static void +garrow_strptime_timestamp_parser_init(GArrowStrptimeTimestampParser *object) +{ +} + +static void +garrow_strptime_timestamp_parser_class_init(GArrowStrptimeTimestampParserClass *klass) +{ +} + +/** + * garrow_strptime_timestamp_parser_new: + * @format: A format used by strptime(3). + * + * Returns: (transfer full): A newly allocated #GArrowStrptimeTimestampParser. + * + * Since: 16.0.0 + */ +GArrowStrptimeTimestampParser * +garrow_strptime_timestamp_parser_new(const gchar *format) +{ + auto arrow_parser = arrow::TimestampParser::MakeStrptime(format); + return GARROW_STRPTIME_TIMESTAMP_PARSER( + g_object_new(GARROW_TYPE_STRPTIME_TIMESTAMP_PARSER, + "parser", + &arrow_parser, + nullptr)); +} + +/** + * garrow_strptime_timestamp_parser_get_format: + * @parser: A #GArrowStrptimeTimestampParser. + * + * Returns: The format used by this parser. + * + * Since: 16.0.0 + */ +const gchar * +garrow_strptime_timestamp_parser_get_format(GArrowStrptimeTimestampParser *parser) +{ + auto arrow_parser = garrow_timestamp_parser_get_raw(GARROW_TIMESTAMP_PARSER(parser)); + return arrow_parser->format(); +} + +G_DEFINE_TYPE(GArrowISO8601TimestampParser, + garrow_iso8601_timestamp_parser, + GARROW_TYPE_TIMESTAMP_PARSER); + +static void +garrow_iso8601_timestamp_parser_init(GArrowISO8601TimestampParser *object) +{ +} + +static void +garrow_iso8601_timestamp_parser_class_init(GArrowISO8601TimestampParserClass *klass) +{ +} + +/** + * garrow_iso8601_timestamp_parser_new: + * + * Returns: (transfer full): A newly allocated #GArrowISO8601TimestampParser. + * + * Since: 16.0.0 + */ +GArrowISO8601TimestampParser * +garrow_iso8601_timestamp_parser_new(void) +{ + auto arrow_parser = arrow::TimestampParser::MakeISO8601(); + return GARROW_ISO8601_TIMESTAMP_PARSER( + g_object_new(GARROW_TYPE_ISO8601_TIMESTAMP_PARSER, "parser", &arrow_parser, nullptr)); +} + +G_END_DECLS + +std::shared_ptr +garrow_timestamp_parser_get_raw(GArrowTimestampParser *parser) +{ + auto priv = GARROW_TIMESTAMP_PARSER_GET_PRIVATE(parser); + return priv->parser; +} diff --git a/c_glib/arrow-glib/timestamp-parser.h b/c_glib/arrow-glib/timestamp-parser.h new file mode 100644 index 0000000000000..d5b62bb568a21 --- /dev/null +++ b/c_glib/arrow-glib/timestamp-parser.h @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#pragma once + +#include +#include + +G_BEGIN_DECLS + +#define GARROW_TYPE_TIMESTAMP_PARSER (garrow_timestamp_parser_get_type()) +G_DECLARE_DERIVABLE_TYPE( + GArrowTimestampParser, garrow_timestamp_parser, GARROW, TIMESTAMP_PARSER, GObject) +struct _GArrowTimestampParserClass +{ + GObjectClass parent_class; +}; + +GARROW_AVAILABLE_IN_16_0 +const gchar * +garrow_timestamp_parser_get_kind(GArrowTimestampParser *parser); + +#define GARROW_TYPE_STRPTIME_TIMESTAMP_PARSER \ + (garrow_strptime_timestamp_parser_get_type()) +G_DECLARE_DERIVABLE_TYPE(GArrowStrptimeTimestampParser, + garrow_strptime_timestamp_parser, + GARROW, + STRPTIME_TIMESTAMP_PARSER, + GArrowTimestampParser) +struct _GArrowStrptimeTimestampParserClass +{ + GArrowTimestampParserClass parent_class; +}; + +GARROW_AVAILABLE_IN_16_0 +GArrowStrptimeTimestampParser * +garrow_strptime_timestamp_parser_new(const gchar *format); + +GARROW_AVAILABLE_IN_16_0 +const gchar * +garrow_strptime_timestamp_parser_get_format(GArrowStrptimeTimestampParser *parser); + +#define GARROW_TYPE_ISO8601_TIMESTAMP_PARSER (garrow_iso8601_timestamp_parser_get_type()) +G_DECLARE_DERIVABLE_TYPE(GArrowISO8601TimestampParser, + garrow_iso8601_timestamp_parser, + GARROW, + ISO8601_TIMESTAMP_PARSER, + GArrowTimestampParser) +struct _GArrowISO8601TimestampParserClass +{ + GArrowTimestampParserClass parent_class; +}; + +GARROW_AVAILABLE_IN_16_0 +GArrowISO8601TimestampParser * +garrow_iso8601_timestamp_parser_new(); + +G_END_DECLS diff --git a/c_glib/arrow-glib/timestamp-parser.hpp b/c_glib/arrow-glib/timestamp-parser.hpp new file mode 100644 index 0000000000000..00c37aed9cd2f --- /dev/null +++ b/c_glib/arrow-glib/timestamp-parser.hpp @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#pragma once + +#include + +#include + +std::shared_ptr +garrow_timestamp_parser_get_raw(GArrowTimestampParser *parser); diff --git a/c_glib/test/test-timestamp-parser.rb b/c_glib/test/test-timestamp-parser.rb new file mode 100644 index 0000000000000..7095b2d26c154 --- /dev/null +++ b/c_glib/test/test-timestamp-parser.rb @@ -0,0 +1,42 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +class TestTimestampParser < Test::Unit::TestCase + sub_test_case("strptime") do + def setup + @parser = Arrow::StrptimeTimestampParser.new("%Y-%m-%d") + end + + def test_kind + assert_equal("strptime", @parser.kind) + end + + def test_format + assert_equal("%Y-%m-%d", @parser.format) + end + end + + sub_test_case("ISO8601") do + def setup + @parser = Arrow::ISO8601TimestampParser.new + end + + def test_kind + assert_equal("iso8601", @parser.kind) + end + end +end From 5908be7bbefed796ebf2bfe42a8de0014704cce2 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Tue, 12 Mar 2024 05:40:06 +0900 Subject: [PATCH 20/30] GH-40448: [CI][Dev] Run pre-commit (#40449) ### Rationale for this change We have pre-commit configuration but it's not used in CI. ### What changes are included in this PR? Run pre-commit in CI. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #40448 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- .github/workflows/dev.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 77efda58cb3d2..b58f0d2036432 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -44,6 +44,18 @@ jobs: uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 with: python-version: 3.12 + - name: Install pre-commit + run: | + python -m pip install pre-commit + pre-commit run --show-diff-on-failure --color=always + - name: Cache pre-commit + uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} + - name: Run pre-commit + run: | + pre-commit run --show-diff-on-failure --color=always - name: Setup Archery run: pip install -e dev/archery[docker] - name: Execute Docker Build From 31fa99adaf6acb656dd89e03a9d7f512d27d1195 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 05:42:12 +0900 Subject: [PATCH 21/30] MINOR: [Java] Bump org.codehaus.mojo:exec-maven-plugin from 3.1.1 to 3.2.0 in /java (#40464) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [org.codehaus.mojo:exec-maven-plugin](https://github.com/mojohaus/exec-maven-plugin) from 3.1.1 to 3.2.0.
Release notes

Sourced from org.codehaus.mojo:exec-maven-plugin's releases.

3.2.0

🚀 New features and improvements

  • Enable to exec:java runnables and not only mains with loosely coupled injections (#408) @​rmannibucau
  • Try to get rid of legacy API which can break starting with java 17 (#409) @​rmannibucau

🐛 Bug Fixes

📦 Dependency updates

👻 Maintenance

🔧 Build

Commits
  • d28f608 [maven-release-plugin] prepare release 3.2.0
  • 96d307b Bump org.codehaus.mojo:mojo-parent from 78 to 80 (#419)
  • 0134866 Fix #401 - Maven v4 compatibility
  • 198c289 Bump commons-io:commons-io in /src/it/projects/setup-parent
  • 9babd4e Bump release-drafter/release-drafter from 5 to 6
  • 97f3161 Bump project version to 3.2.0-SNAPSHOT
  • 594cb0f ITs improvement
  • bf6a0f1 Fix documentation formatting, add menu items for new examples
  • 1d90140 Execute mexec-137 also on unix family
  • a7090d0 Fixes #408, enable to exec:java runnables and not only mains with loosely cou...
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.codehaus.mojo:exec-maven-plugin&package-manager=maven&previous-version=3.1.1&new-version=3.2.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@ dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@ dependabot rebase` will rebase this PR - `@ dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@ dependabot merge` will merge this PR after your CI passes on it - `@ dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@ dependabot cancel merge` will cancel a previously requested merge and block automerging - `@ dependabot reopen` will reopen this PR if it is closed - `@ dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@ dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@ dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@ dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@ dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Sutou Kouhei --- java/performance/pom.xml | 2 +- java/pom.xml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/java/performance/pom.xml b/java/performance/pom.xml index d572876e724a5..d3bba882a0898 100644 --- a/java/performance/pom.xml +++ b/java/performance/pom.xml @@ -139,7 +139,7 @@ org.codehaus.mojo exec-maven-plugin - 3.1.1 + 3.2.0 run-java-benchmarks diff --git a/java/pom.xml b/java/pom.xml index 1fd69a12fba56..b3282e3f6ac49 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -1038,7 +1038,7 @@ org.codehaus.mojo exec-maven-plugin - 3.1.1 + 3.2.0 cdata-cmake @@ -1099,7 +1099,7 @@ org.codehaus.mojo exec-maven-plugin - 3.1.1 + 3.2.0 jni-cpp-cmake @@ -1214,7 +1214,7 @@ org.codehaus.mojo exec-maven-plugin - 3.1.1 + 3.2.0 jni-cpp-cmake From 5127ef0369e37cda05cbcfb545319ff52191668d Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Tue, 12 Mar 2024 05:59:00 +0900 Subject: [PATCH 22/30] GH-40082: [CI][C++] Add a job on ARM64 macOS (#40456) ### Rationale for this change We can use GitHub hosted M1 macOS runner. ### What changes are included in this PR? * Add a job on macos-14 * Update expected L2 CPU cache range to 32KiB-12MiB from 32KiB-8MiB because M1 macOS runner has 12MiB * Disable arrow-s3fs-test for now. It'll be fixed by GH-40410 ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #40082 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- .github/workflows/cpp.yml | 22 +++++++++++++++------- ci/scripts/cpp_test.sh | 3 +++ ci/scripts/install_minio.sh | 1 + cpp/src/arrow/util/io_util_test.cc | 2 +- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index e9409f1cd6248..a48b5aafab41d 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -181,10 +181,18 @@ jobs: docker-compose run --rm minimal macos: - name: AMD64 macOS 12 C++ - runs-on: macos-latest + name: ${{ matrix.architecture }} macOS ${{ matrix.macos-version }} C++ + runs-on: macos-${{ matrix.macos-version }} if: ${{ !contains(github.event.pull_request.title, 'WIP') }} timeout-minutes: 75 + strategy: + fail-fast: false + matrix: + include: + - architecture: AMD64 + macos-version: "12" + - architecture: ARM64 + macos-version: "14" env: ARROW_AZURE: ON ARROW_BUILD_TESTS: ON @@ -193,7 +201,7 @@ jobs: ARROW_GANDIVA: ON ARROW_GCS: ON ARROW_HDFS: ON - ARROW_HOME: /usr/local + ARROW_HOME: /tmp/local ARROW_JEMALLOC: ON ARROW_ORC: ON ARROW_PARQUET: ON @@ -225,11 +233,11 @@ jobs: - name: Install MinIO run: | $(brew --prefix bash)/bin/bash \ - ci/scripts/install_minio.sh latest /usr/local + ci/scripts/install_minio.sh latest ${ARROW_HOME} - name: Set up Python uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: 3.12 - name: Install Google Cloud Storage Testbench run: ci/scripts/install_gcs_testbench.sh default - name: Install Azurite Storage Emulator @@ -245,8 +253,8 @@ jobs: uses: actions/cache@v4 with: path: ${{ steps.ccache-info.outputs.cache-dir }} - key: cpp-ccache-macos-${{ hashFiles('cpp/**') }} - restore-keys: cpp-ccache-macos- + key: cpp-ccache-macos-${{ matrix.macos-version }}-${{ hashFiles('cpp/**') }} + restore-keys: cpp-ccache-macos-${{ matrix.macos-version }}- - name: Build run: | ci/scripts/cpp_build.sh $(pwd) $(pwd)/build diff --git a/ci/scripts/cpp_test.sh b/ci/scripts/cpp_test.sh index a23ea8eb1cd34..f388825fd0a98 100755 --- a/ci/scripts/cpp_test.sh +++ b/ci/scripts/cpp_test.sh @@ -49,6 +49,9 @@ case "$(uname)" in ;; Darwin) n_jobs=$(sysctl -n hw.ncpu) + # TODO: https://github.com/apache/arrow/issues/40410 + exclude_tests="arrow-s3fs-test" + ctest_options+=(--exclude-regex "${exclude_tests}") ;; MINGW*) n_jobs=${NUMBER_OF_PROCESSORS:-1} diff --git a/ci/scripts/install_minio.sh b/ci/scripts/install_minio.sh index e493a183b4543..40762c9f32d16 100755 --- a/ci/scripts/install_minio.sh +++ b/ci/scripts/install_minio.sh @@ -71,6 +71,7 @@ download() local output=$1 local url=$2 + mkdir -p $(dirname ${output}) if type wget > /dev/null 2>&1; then wget -nv --output-document ${output} ${url} else diff --git a/cpp/src/arrow/util/io_util_test.cc b/cpp/src/arrow/util/io_util_test.cc index 2599c92d821cf..d0569c799561f 100644 --- a/cpp/src/arrow/util/io_util_test.cc +++ b/cpp/src/arrow/util/io_util_test.cc @@ -1065,7 +1065,7 @@ TEST(CpuInfo, Basic) { const auto l2 = ci->CacheSize(CpuInfo::CacheLevel::L2); const auto l3 = ci->CacheSize(CpuInfo::CacheLevel::L3); ASSERT_TRUE(l1 >= 4 * 1024 && l1 <= 512 * 1024) << "unexpected L1 size: " << l1; - ASSERT_TRUE(l2 >= 32 * 1024 && l2 <= 8 * 1024 * 1024) << "unexpected L2 size: " << l2; + ASSERT_TRUE(l2 >= 32 * 1024 && l2 <= 12 * 1024 * 1024) << "unexpected L2 size: " << l2; ASSERT_TRUE(l3 >= 256 * 1024 && l3 <= 1024 * 1024 * 1024) << "unexpected L3 size: " << l3; ASSERT_LE(l1, l2) << "L1 cache size " << l1 << " larger than L2 " << l2; From 605f8a792c388afb2230b1f19e0f3e4df90d5abe Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Tue, 12 Mar 2024 06:34:58 +0900 Subject: [PATCH 23/30] GH-40028: [C++][FS][Azure] Add AzureFileSystem support to FileSystemFromUri() (#40325) ### Rationale for this change `FileSystemFromUri()` is a common API to create a file system object. `FileSystemFromUri()` should be able to create an `AzureFileSystem` object. ### What changes are included in this PR? Add `AzureOptions::FromUri()` and use it from `FileSystemFromUri()`. See the `AzureOptions::FromUri()`'s docstring about the supported formats. ### Are these changes tested? Yes. ### Are there any user-facing changes? Yes. * GitHub Issue: #40028 Authored-by: Sutou Kouhei Signed-off-by: Sutou Kouhei --- cpp/src/arrow/filesystem/azurefs.cc | 166 +++++++++++++++++++ cpp/src/arrow/filesystem/azurefs.h | 56 +++++++ cpp/src/arrow/filesystem/azurefs_test.cc | 196 +++++++++++++++++++++++ cpp/src/arrow/filesystem/filesystem.cc | 18 ++- 4 files changed, 433 insertions(+), 3 deletions(-) diff --git a/cpp/src/arrow/filesystem/azurefs.cc b/cpp/src/arrow/filesystem/azurefs.cc index ff078f78aeac0..dd9fb817b7aca 100644 --- a/cpp/src/arrow/filesystem/azurefs.cc +++ b/cpp/src/arrow/filesystem/azurefs.cc @@ -65,6 +65,172 @@ AzureOptions::AzureOptions() = default; AzureOptions::~AzureOptions() = default; +void AzureOptions::ExtractFromUriSchemeAndHierPart(const arrow::internal::Uri& uri, + std::string* out_path) { + const auto host = uri.host(); + std::string path; + if (arrow::internal::EndsWith(host, blob_storage_authority)) { + account_name = host.substr(0, host.size() - blob_storage_authority.size()); + path = internal::RemoveLeadingSlash(uri.path()); + } else if (arrow::internal::EndsWith(host, dfs_storage_authority)) { + account_name = host.substr(0, host.size() - dfs_storage_authority.size()); + path = internal::ConcatAbstractPath(uri.username(), uri.path()); + } else { + account_name = uri.username(); + const auto port_text = uri.port_text(); + if (host.find(".") == std::string::npos && port_text.empty()) { + // abfs://container/dir/file + path = internal::ConcatAbstractPath(host, uri.path()); + } else { + // abfs://host.domain/container/dir/file + // abfs://host.domain:port/container/dir/file + // abfs://host:port/container/dir/file + std::string host_port = host; + if (!port_text.empty()) { + host_port += ":" + port_text; + } + blob_storage_authority = host_port; + dfs_storage_authority = host_port; + path = internal::RemoveLeadingSlash(uri.path()); + } + } + if (out_path != nullptr) { + *out_path = path; + } +} + +Status AzureOptions::ExtractFromUriQuery(const arrow::internal::Uri& uri) { + const auto account_key = uri.password(); + std::optional credential_kind; + std::optional credential_kind_value; + std::string tenant_id; + std::string client_id; + std::string client_secret; + ARROW_ASSIGN_OR_RAISE(const auto options_items, uri.query_items()); + for (const auto& kv : options_items) { + if (kv.first == "blob_storage_authority") { + blob_storage_authority = kv.second; + } else if (kv.first == "dfs_storage_authority") { + dfs_storage_authority = kv.second; + } else if (kv.first == "credential_kind") { + if (kv.second == "default") { + credential_kind = CredentialKind::kDefault; + } else if (kv.second == "anonymous") { + credential_kind = CredentialKind::kAnonymous; + } else if (kv.second == "workload_identity") { + credential_kind = CredentialKind::kWorkloadIdentity; + } else { + // Other credential kinds should be inferred from the given + // parameters automatically. + return Status::Invalid("Unexpected credential_kind: '", kv.second, "'"); + } + credential_kind_value = kv.second; + } else if (kv.first == "tenant_id") { + tenant_id = kv.second; + } else if (kv.first == "client_id") { + client_id = kv.second; + } else if (kv.first == "client_secret") { + client_secret = kv.second; + } else if (kv.first == "enable_tls") { + ARROW_ASSIGN_OR_RAISE(auto enable_tls, ::arrow::internal::ParseBoolean(kv.second)); + if (enable_tls) { + blob_storage_scheme = "https"; + dfs_storage_scheme = "https"; + } else { + blob_storage_scheme = "http"; + dfs_storage_scheme = "http"; + } + } else { + return Status::Invalid( + "Unexpected query parameter in Azure Blob File System URI: '", kv.first, "'"); + } + } + + if (credential_kind) { + if (!account_key.empty()) { + return Status::Invalid("Password must not be specified with credential_kind=", + *credential_kind_value); + } + if (!tenant_id.empty()) { + return Status::Invalid("tenant_id must not be specified with credential_kind=", + *credential_kind_value); + } + if (!client_id.empty()) { + return Status::Invalid("client_id must not be specified with credential_kind=", + *credential_kind_value); + } + if (!client_secret.empty()) { + return Status::Invalid("client_secret must not be specified with credential_kind=", + *credential_kind_value); + } + + switch (*credential_kind) { + case CredentialKind::kAnonymous: + RETURN_NOT_OK(ConfigureAnonymousCredential()); + break; + case CredentialKind::kWorkloadIdentity: + RETURN_NOT_OK(ConfigureWorkloadIdentityCredential()); + break; + default: + // Default credential + break; + } + } else { + if (!account_key.empty()) { + // With password + if (!tenant_id.empty()) { + return Status::Invalid("tenant_id must not be specified with password"); + } + if (!client_id.empty()) { + return Status::Invalid("client_id must not be specified with password"); + } + if (!client_secret.empty()) { + return Status::Invalid("client_secret must not be specified with password"); + } + RETURN_NOT_OK(ConfigureAccountKeyCredential(account_key)); + } else { + // Without password + if (tenant_id.empty() && client_id.empty() && client_secret.empty()) { + // No related parameters + if (account_name.empty()) { + RETURN_NOT_OK(ConfigureAnonymousCredential()); + } else { + // Default credential + } + } else { + // One or more tenant_id, client_id or client_secret are specified + if (client_id.empty()) { + return Status::Invalid("client_id must be specified"); + } + if (tenant_id.empty() && client_secret.empty()) { + RETURN_NOT_OK(ConfigureManagedIdentityCredential(client_id)); + } else if (!tenant_id.empty() && !client_secret.empty()) { + RETURN_NOT_OK( + ConfigureClientSecretCredential(tenant_id, client_id, client_secret)); + } else { + return Status::Invalid("Both of tenant_id and client_secret must be specified"); + } + } + } + } + return Status::OK(); +} + +Result AzureOptions::FromUri(const arrow::internal::Uri& uri, + std::string* out_path) { + AzureOptions options; + options.ExtractFromUriSchemeAndHierPart(uri, out_path); + RETURN_NOT_OK(options.ExtractFromUriQuery(uri)); + return options; +} + +Result AzureOptions::FromUri(const std::string& uri_string, + std::string* out_path) { + arrow::internal::Uri uri; + RETURN_NOT_OK(uri.Parse(uri_string)); + return FromUri(uri, out_path); +} + bool AzureOptions::Equals(const AzureOptions& other) const { // TODO(GH-38598): update here when more auth methods are added. const bool equals = blob_storage_authority == other.blob_storage_authority && diff --git a/cpp/src/arrow/filesystem/azurefs.h b/cpp/src/arrow/filesystem/azurefs.h index 2a131e40c05bf..6218bf574e8dd 100644 --- a/cpp/src/arrow/filesystem/azurefs.h +++ b/cpp/src/arrow/filesystem/azurefs.h @@ -45,6 +45,7 @@ class DataLakeServiceClient; namespace arrow::fs { class TestAzureFileSystem; +class TestAzureOptions; /// Options for the AzureFileSystem implementation. /// @@ -59,6 +60,8 @@ class TestAzureFileSystem; /// /// Functions are provided for explicit configuration of credentials if that is preferred. struct ARROW_EXPORT AzureOptions { + friend class TestAzureOptions; + /// \brief The name of the Azure Storage Account being accessed. /// /// All service URLs will be constructed using this storage account name. @@ -123,6 +126,59 @@ struct ARROW_EXPORT AzureOptions { AzureOptions(); ~AzureOptions(); + private: + void ExtractFromUriSchemeAndHierPart(const arrow::internal::Uri& uri, + std::string* out_path); + Status ExtractFromUriQuery(const arrow::internal::Uri& uri); + + public: + /// \brief Construct a new AzureOptions from an URI. + /// + /// Supported formats: + /// + /// 1. abfs[s]://[:\@]\.blob.core.windows.net + /// [/\[/\]] + /// 2. abfs[s]://\[:\]@\.dfs.core.windows.net + /// [/path] + /// 3. abfs[s]://[\]@]\[\<:port\>] + /// [/\[/path]] + /// 4. abfs[s]://[\]@]\[/path] + /// + /// 1. and 2. are compatible with the Azure Data Lake Storage Gen2 URIs: + /// https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-introduction-abfs-uri + /// + /// 3. is for Azure Blob Storage compatible service including Azurite. + /// + /// 4. is a shorter version of 1. and 2. + /// + /// Note that there is no difference between abfs and abfss. HTTPS is + /// used with abfs by default. You can force to use HTTP by specifying + /// "enable_tls=false" query. + /// + /// Supported query parameters: + /// + /// * blob_storage_authority: Set AzureOptions::blob_storage_authority + /// * dfs_storage_authority: Set AzureOptions::dfs_storage_authority + /// * enable_tls: If it's "false" or "0", HTTP not HTTPS is used. + /// * credential_kind: One of "default", "anonymous", + /// "workload_identity". If "default" is specified, it's just + /// ignored. If "anonymous" is specified, + /// AzureOptions::ConfigureAnonymousCredential() is called. If + /// "workload_identity" is specified, + /// AzureOptions::ConfigureWorkloadIdentityCredential() is called. + /// * tenant_id: You must specify "client_id" and "client_secret" + /// too. AzureOptions::ConfigureClientSecretCredential() is called. + /// * client_id: If you don't specify "tenant_id" and + /// "client_secret", + /// AzureOptions::ConfigureManagedIdentityCredential() is + /// called. If you specify "tenant_id" and "client_secret" too, + /// AzureOptions::ConfigureClientSecretCredential() is called. + /// * client_secret: You must specify "tenant_id" and "client_id" + /// too. AzureOptions::ConfigureClientSecretCredential() is called. + static Result FromUri(const arrow::internal::Uri& uri, + std::string* out_path); + static Result FromUri(const std::string& uri, std::string* out_path); + Status ConfigureDefaultCredential(); Status ConfigureAnonymousCredential(); Status ConfigureAccountKeyCredential(const std::string& account_key); diff --git a/cpp/src/arrow/filesystem/azurefs_test.cc b/cpp/src/arrow/filesystem/azurefs_test.cc index f21876f03cc95..0ce84043a537c 100644 --- a/cpp/src/arrow/filesystem/azurefs_test.cc +++ b/cpp/src/arrow/filesystem/azurefs_test.cc @@ -336,6 +336,202 @@ TEST(AzureFileSystem, OptionsCompare) { EXPECT_TRUE(options.Equals(options)); } +class TestAzureOptions : public ::testing::Test { + public: + void TestFromUriBlobStorage() { + AzureOptions default_options; + std::string path; + ASSERT_OK_AND_ASSIGN( + auto options, + AzureOptions::FromUri("abfs://account.blob.core.windows.net/container/dir/blob", + &path)); + ASSERT_EQ(options.account_name, "account"); + ASSERT_EQ(options.blob_storage_authority, default_options.blob_storage_authority); + ASSERT_EQ(options.dfs_storage_authority, default_options.dfs_storage_authority); + ASSERT_EQ(options.blob_storage_scheme, default_options.blob_storage_scheme); + ASSERT_EQ(options.dfs_storage_scheme, default_options.dfs_storage_scheme); + ASSERT_EQ(options.credential_kind_, AzureOptions::CredentialKind::kDefault); + ASSERT_EQ(path, "container/dir/blob"); + } + + void TestFromUriDfsStorage() { + AzureOptions default_options; + std::string path; + ASSERT_OK_AND_ASSIGN( + auto options, + AzureOptions::FromUri("abfs://file_system@account.dfs.core.windows.net/dir/file", + &path)); + ASSERT_EQ(options.account_name, "account"); + ASSERT_EQ(options.blob_storage_authority, default_options.blob_storage_authority); + ASSERT_EQ(options.dfs_storage_authority, default_options.dfs_storage_authority); + ASSERT_EQ(options.blob_storage_scheme, default_options.blob_storage_scheme); + ASSERT_EQ(options.dfs_storage_scheme, default_options.dfs_storage_scheme); + ASSERT_EQ(options.credential_kind_, AzureOptions::CredentialKind::kDefault); + ASSERT_EQ(path, "file_system/dir/file"); + } + + void TestFromUriAbfs() { + std::string path; + ASSERT_OK_AND_ASSIGN( + auto options, + AzureOptions::FromUri( + "abfs://account:password@127.0.0.1:10000/container/dir/blob", &path)); + ASSERT_EQ(options.account_name, "account"); + ASSERT_EQ(options.blob_storage_authority, "127.0.0.1:10000"); + ASSERT_EQ(options.dfs_storage_authority, "127.0.0.1:10000"); + ASSERT_EQ(options.blob_storage_scheme, "https"); + ASSERT_EQ(options.dfs_storage_scheme, "https"); + ASSERT_EQ(options.credential_kind_, AzureOptions::CredentialKind::kStorageSharedKey); + ASSERT_EQ(path, "container/dir/blob"); + } + + void TestFromUriAbfss() { + std::string path; + ASSERT_OK_AND_ASSIGN( + auto options, + AzureOptions::FromUri( + "abfss://account:password@127.0.0.1:10000/container/dir/blob", &path)); + ASSERT_EQ(options.account_name, "account"); + ASSERT_EQ(options.blob_storage_authority, "127.0.0.1:10000"); + ASSERT_EQ(options.dfs_storage_authority, "127.0.0.1:10000"); + ASSERT_EQ(options.blob_storage_scheme, "https"); + ASSERT_EQ(options.dfs_storage_scheme, "https"); + ASSERT_EQ(options.credential_kind_, AzureOptions::CredentialKind::kStorageSharedKey); + ASSERT_EQ(path, "container/dir/blob"); + } + + void TestFromUriEnableTls() { + std::string path; + ASSERT_OK_AND_ASSIGN(auto options, + AzureOptions::FromUri( + "abfs://account:password@127.0.0.1:10000/container/dir/blob?" + "enable_tls=false", + &path)); + ASSERT_EQ(options.account_name, "account"); + ASSERT_EQ(options.blob_storage_authority, "127.0.0.1:10000"); + ASSERT_EQ(options.dfs_storage_authority, "127.0.0.1:10000"); + ASSERT_EQ(options.blob_storage_scheme, "http"); + ASSERT_EQ(options.dfs_storage_scheme, "http"); + ASSERT_EQ(options.credential_kind_, AzureOptions::CredentialKind::kStorageSharedKey); + ASSERT_EQ(path, "container/dir/blob"); + } + + void TestFromUriCredentialDefault() { + ASSERT_OK_AND_ASSIGN( + auto options, + AzureOptions::FromUri("abfs://account.blob.core.windows.net/container/dir/blob?" + "credential_kind=default", + nullptr)); + ASSERT_EQ(options.credential_kind_, AzureOptions::CredentialKind::kDefault); + } + + void TestFromUriCredentialAnonymous() { + ASSERT_OK_AND_ASSIGN( + auto options, + AzureOptions::FromUri("abfs://account.blob.core.windows.net/container/dir/blob?" + "credential_kind=anonymous", + nullptr)); + ASSERT_EQ(options.credential_kind_, AzureOptions::CredentialKind::kAnonymous); + } + + void TestFromUriCredentialStorageSharedKey() { + ASSERT_OK_AND_ASSIGN( + auto options, + AzureOptions::FromUri( + "abfs://:password@account.blob.core.windows.net/container/dir/blob", + nullptr)); + ASSERT_EQ(options.credential_kind_, AzureOptions::CredentialKind::kStorageSharedKey); + } + + void TestFromUriCredentialClientSecret() { + ASSERT_OK_AND_ASSIGN( + auto options, + AzureOptions::FromUri("abfs://account.blob.core.windows.net/container/dir/blob?" + "tenant_id=tenant-id&" + "client_id=client-id&" + "client_secret=client-secret", + nullptr)); + ASSERT_EQ(options.credential_kind_, AzureOptions::CredentialKind::kClientSecret); + } + + void TestFromUriCredentialManagedIdentity() { + ASSERT_OK_AND_ASSIGN( + auto options, + AzureOptions::FromUri("abfs://account.blob.core.windows.net/container/dir/blob?" + "client_id=client-id", + nullptr)); + ASSERT_EQ(options.credential_kind_, AzureOptions::CredentialKind::kManagedIdentity); + } + + void TestFromUriCredentialWorkloadIdentity() { + ASSERT_OK_AND_ASSIGN( + auto options, + AzureOptions::FromUri("abfs://account.blob.core.windows.net/container/dir/blob?" + "credential_kind=workload_identity", + nullptr)); + ASSERT_EQ(options.credential_kind_, AzureOptions::CredentialKind::kWorkloadIdentity); + } + + void TestFromUriCredentialInvalid() { + ASSERT_RAISES(Invalid, AzureOptions::FromUri( + "abfs://file_system@account.dfs.core.windows.net/dir/file?" + "credential_kind=invalid", + nullptr)); + } + void TestFromUriBlobStorageAuthority() { + ASSERT_OK_AND_ASSIGN( + auto options, + AzureOptions::FromUri("abfs://account.blob.core.windows.net/container/dir/blob?" + "blob_storage_authority=.blob.local", + nullptr)); + ASSERT_EQ(options.blob_storage_authority, ".blob.local"); + } + + void TestFromUriDfsStorageAuthority() { + ASSERT_OK_AND_ASSIGN( + auto options, + AzureOptions::FromUri("abfs://file_system@account.dfs.core.windows.net/dir/file?" + "dfs_storage_authority=.dfs.local", + nullptr)); + ASSERT_EQ(options.dfs_storage_authority, ".dfs.local"); + } + + void TestFromUriInvalidQueryParameter() { + ASSERT_RAISES(Invalid, AzureOptions::FromUri( + "abfs://file_system@account.dfs.core.windows.net/dir/file?" + "unknown=invalid", + nullptr)); + } +}; + +TEST_F(TestAzureOptions, FromUriBlobStorage) { TestFromUriBlobStorage(); } +TEST_F(TestAzureOptions, FromUriDfsStorage) { TestFromUriDfsStorage(); } +TEST_F(TestAzureOptions, FromUriAbfs) { TestFromUriAbfs(); } +TEST_F(TestAzureOptions, FromUriAbfss) { TestFromUriAbfss(); } +TEST_F(TestAzureOptions, FromUriEnableTls) { TestFromUriEnableTls(); } +TEST_F(TestAzureOptions, FromUriCredentialDefault) { TestFromUriCredentialDefault(); } +TEST_F(TestAzureOptions, FromUriCredentialAnonymous) { TestFromUriCredentialAnonymous(); } +TEST_F(TestAzureOptions, FromUriCredentialStorageSharedKey) { + TestFromUriCredentialStorageSharedKey(); +} +TEST_F(TestAzureOptions, FromUriCredentialClientSecret) { + TestFromUriCredentialClientSecret(); +} +TEST_F(TestAzureOptions, FromUriCredentialManagedIdentity) { + TestFromUriCredentialManagedIdentity(); +} +TEST_F(TestAzureOptions, FromUriCredentialWorkloadIdentity) { + TestFromUriCredentialWorkloadIdentity(); +} +TEST_F(TestAzureOptions, FromUriCredentialInvalid) { TestFromUriCredentialInvalid(); } +TEST_F(TestAzureOptions, FromUriBlobStorageAuthority) { + TestFromUriBlobStorageAuthority(); +} +TEST_F(TestAzureOptions, FromUriDfsStorageAuthority) { TestFromUriDfsStorageAuthority(); } +TEST_F(TestAzureOptions, FromUriInvalidQueryParameter) { + TestFromUriInvalidQueryParameter(); +} + struct PreexistingData { public: using RNG = random::pcg32_fast; diff --git a/cpp/src/arrow/filesystem/filesystem.cc b/cpp/src/arrow/filesystem/filesystem.cc index 810e9c179b156..1fb74d412988d 100644 --- a/cpp/src/arrow/filesystem/filesystem.cc +++ b/cpp/src/arrow/filesystem/filesystem.cc @@ -21,12 +21,15 @@ #include "arrow/util/config.h" #include "arrow/filesystem/filesystem.h" -#ifdef ARROW_HDFS -#include "arrow/filesystem/hdfs.h" +#ifdef ARROW_AZURE +#include "arrow/filesystem/azurefs.h" #endif #ifdef ARROW_GCS #include "arrow/filesystem/gcsfs.h" #endif +#ifdef ARROW_HDFS +#include "arrow/filesystem/hdfs.h" +#endif #ifdef ARROW_S3 #include "arrow/filesystem/s3fs.h" #endif @@ -690,6 +693,16 @@ Result> FileSystemFromUriReal(const Uri& uri, } return std::make_shared(options, io_context); } + if (scheme == "abfs" || scheme == "abfss") { +#ifdef ARROW_AZURE + ARROW_ASSIGN_OR_RAISE(auto options, AzureOptions::FromUri(uri, out_path)); + return AzureFileSystem::Make(options, io_context); +#else + return Status::NotImplemented( + "Got Azure Blob File System URI but Arrow compiled without Azure Blob File " + "System support"); +#endif + } if (scheme == "gs" || scheme == "gcs") { #ifdef ARROW_GCS ARROW_ASSIGN_OR_RAISE(auto options, GcsOptions::FromUri(uri, out_path)); @@ -698,7 +711,6 @@ Result> FileSystemFromUriReal(const Uri& uri, return Status::NotImplemented("Got GCS URI but Arrow compiled without GCS support"); #endif } - if (scheme == "hdfs" || scheme == "viewfs") { #ifdef ARROW_HDFS ARROW_ASSIGN_OR_RAISE(auto options, HdfsOptions::FromUri(uri)); From b202ede131e3c54628616330162f7854ba0c0d70 Mon Sep 17 00:00:00 2001 From: Alenka Frim Date: Tue, 12 Mar 2024 11:50:09 +0100 Subject: [PATCH 24/30] GH-40458: [Release][Docs] Changes for version and warning banner should not affect minor releases (#40459) This PR adds an if case to me make sure the change in version and warning banner only affects major releases. * GitHub Issue: #40458 Authored-by: AlenkaF Signed-off-by: AlenkaF --- dev/release/post-08-docs.sh | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/dev/release/post-08-docs.sh b/dev/release/post-08-docs.sh index 4df574700e812..1e457c95c033c 100755 --- a/dev/release/post-08-docs.sh +++ b/dev/release/post-08-docs.sh @@ -89,20 +89,22 @@ git commit -m "[Website] Update documentations for ${version}" # Update DOCUMENTATION_OPTIONS.theme_switcher_version_match and # DOCUMENTATION_OPTIONS.show_version_warning_banner -pushd docs/${previous_series} -find ./ \ - -type f \ - -exec \ - sed -i.bak \ - -e "s/DOCUMENTATION_OPTIONS.theme_switcher_version_match = '';/DOCUMENTATION_OPTIONS.theme_switcher_version_match = '${previous_version}';/g" \ - -e "s/DOCUMENTATION_OPTIONS.show_version_warning_banner = false/DOCUMENTATION_OPTIONS.show_version_warning_banner = true/g" \ - {} \; -find ./ -name '*.bak' -delete -popd -git add docs/${previous_series} -git commit -m "[Website] Update warning banner for ${previous_series}" -git clean -d -f -x -popd +if [ "$is_major_release" = "yes" ] ; then + pushd docs/${previous_series} + find ./ \ + -type f \ + -exec \ + sed -i.bak \ + -e "s/DOCUMENTATION_OPTIONS.theme_switcher_version_match = '';/DOCUMENTATION_OPTIONS.theme_switcher_version_match = '${previous_series}';/g" \ + -e "s/DOCUMENTATION_OPTIONS.show_version_warning_banner = false/DOCUMENTATION_OPTIONS.show_version_warning_banner = true/g" \ + {} \; + find ./ -name '*.bak' -delete + popd + git add docs/${previous_series} + git commit -m "[Website] Update warning banner for ${previous_series}" + git clean -d -f -x + popd +fi : ${PUSH:=1} From 6121b3fd0609b1e2d282ca573d5154a0c0ebeac5 Mon Sep 17 00:00:00 2001 From: Alenka Frim Date: Tue, 12 Mar 2024 12:45:34 +0100 Subject: [PATCH 25/30] GH-40485: [Python][CI] Skip failing test_dateutil_tzinfo_to_string (#40486) * GitHub Issue: #40485 Authored-by: AlenkaF Signed-off-by: Joris Van den Bossche --- python/pyarrow/tests/test_types.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/pyarrow/tests/test_types.py b/python/pyarrow/tests/test_types.py index 13f6d83e80a46..21b3829803487 100644 --- a/python/pyarrow/tests/test_types.py +++ b/python/pyarrow/tests/test_types.py @@ -346,6 +346,11 @@ def test_pytz_tzinfo_to_string(): def test_dateutil_tzinfo_to_string(): + if sys.platform == 'win32': + # Skip due to new release of python-dateutil + # https://github.com/apache/arrow/issues/40485 + pytest.skip('Skip on Win due to new release of python-dateutil') + pytest.importorskip("dateutil") import dateutil.tz From 0ce72675f4dd755b2696eb6597850b21df647bb8 Mon Sep 17 00:00:00 2001 From: Rossi Sun Date: Tue, 12 Mar 2024 21:57:35 +0800 Subject: [PATCH 26/30] GH-20339: [C++] Add residual filter support to swiss join (#39487) ### Rationale for this change Add residual filter support to swiss join. ### What changes are included in this PR? 1. Added class `JoinResidualFilter` as a centralized structure to evaluate residual filter in swiss join. It has various flavors of filtering for various join types. Zero-overhead is guaranteed for trivial filters (literal true and sometimes literal false/null). More detailed explanation in code comments. 2. Tuned the structure of swiss join main body (`JoinProbeProcessor::OnNextBatch`) to better cope with `JoinResidualFilter` calls. ### Are these changes tested? Legacy UTs (`HashJoin.Random`, `HashJoin.ResidualFilter` and `HashJoin.TrivialResidualFilter`) cover part of this change. New fine-grained residual filter cases added as well. ### Are there any user-facing changes? No. * Closes: #20339 Lead-authored-by: zanmato Co-authored-by: zanmato1984 Co-authored-by: Ruoxi Sun Co-authored-by: Rossi Sun Signed-off-by: Weston Pace --- cpp/src/arrow/acero/hash_join_benchmark.cc | 197 +++- cpp/src/arrow/acero/hash_join_node.cc | 6 +- cpp/src/arrow/acero/hash_join_node_test.cc | 1187 ++++++++++++++++++-- cpp/src/arrow/acero/swiss_join.cc | 606 ++++++++-- cpp/src/arrow/acero/swiss_join_internal.h | 157 ++- 5 files changed, 1975 insertions(+), 178 deletions(-) diff --git a/cpp/src/arrow/acero/hash_join_benchmark.cc b/cpp/src/arrow/acero/hash_join_benchmark.cc index 9be4bed606553..993c0b9a705b4 100644 --- a/cpp/src/arrow/acero/hash_join_benchmark.cc +++ b/cpp/src/arrow/acero/hash_join_benchmark.cc @@ -51,6 +51,10 @@ struct BenchmarkSettings { double null_percentage = 0.0; double cardinality = 1.0; // Proportion of distinct keys in build side double selectivity = 1.0; // Probability of a match for a given row + int var_length_min = 2; // Minimal length of any var length types + int var_length_max = 20; // Maximum length of any var length types + + Expression residual_filter = literal(true); }; class JoinBenchmark { @@ -79,8 +83,8 @@ class JoinBenchmark { build_metadata["null_probability"] = std::to_string(settings.null_percentage); build_metadata["min"] = std::to_string(min_build_value); build_metadata["max"] = std::to_string(max_build_value); - build_metadata["min_length"] = "2"; - build_metadata["max_length"] = "20"; + build_metadata["min_length"] = settings.var_length_min; + build_metadata["max_length"] = settings.var_length_max; std::unordered_map probe_metadata; probe_metadata["null_probability"] = std::to_string(settings.null_percentage); @@ -126,10 +130,9 @@ class JoinBenchmark { stats_.num_probe_rows = settings.num_probe_batches * settings.batch_size; schema_mgr_ = std::make_unique(); - Expression filter = literal(true); DCHECK_OK(schema_mgr_->Init(settings.join_type, *l_batches_with_schema.schema, left_keys, *r_batches_with_schema.schema, right_keys, - filter, "l_", "r_")); + settings.residual_filter, "l_", "r_")); if (settings.use_basic_implementation) { join_ = *HashJoinImpl::MakeBasic(); @@ -158,7 +161,7 @@ class JoinBenchmark { DCHECK_OK(join_->Init( &ctx_, settings.join_type, settings.num_threads, &(schema_mgr_->proj_maps[0]), - &(schema_mgr_->proj_maps[1]), std::move(key_cmp), std::move(filter), + &(schema_mgr_->proj_maps[1]), std::move(key_cmp), settings.residual_filter, std::move(register_task_group_callback), std::move(start_task_group_callback), [](int64_t, ExecBatch) { return Status::OK(); }, [](int64_t) { return Status::OK(); })); @@ -308,6 +311,60 @@ static void BM_HashJoinBasic_NullPercentage(benchmark::State& st) { HashJoinBasicBenchmarkImpl(st, settings); } + +template +static void BM_HashJoinBasic_TrivialResidualFilter(benchmark::State& st, + JoinType join_type, + Expression residual_filter, + Args&&...) { + BenchmarkSettings settings; + settings.join_type = join_type; + settings.build_payload_types = {binary()}; + settings.probe_payload_types = {binary()}; + + settings.use_basic_implementation = st.range(0); + + settings.num_build_batches = 1024; + settings.num_probe_batches = 1024; + + // Let payload column length from 1 to 100. + settings.var_length_min = 1; + settings.var_length_max = 100; + + settings.residual_filter = std::move(residual_filter); + + HashJoinBasicBenchmarkImpl(st, settings); +} + +template +static void BM_HashJoinBasic_ComplexResidualFilter(benchmark::State& st, + JoinType join_type, Args&&...) { + BenchmarkSettings settings; + settings.join_type = join_type; + settings.build_payload_types = {binary()}; + settings.probe_payload_types = {binary()}; + + settings.use_basic_implementation = st.range(0); + + settings.num_build_batches = 1024; + settings.num_probe_batches = 1024; + + // Let payload column length from 1 to 100. + settings.var_length_min = 1; + settings.var_length_max = 100; + + // Create filter referring payload columns from both sides. + // binary_length(probe_payload) + binary_length(build_payload) <= 2 * selectivity + settings.selectivity = static_cast(st.range(1)) / 100.0; + using arrow::compute::call; + using arrow::compute::field_ref; + settings.residual_filter = + call("less_equal", {call("plus", {call("binary_length", {field_ref("lp0")}), + call("binary_length", {field_ref("rp0")})}), + literal(2 * settings.selectivity)}); + + HashJoinBasicBenchmarkImpl(st, settings); +} #endif std::vector hashtable_krows = benchmark::CreateRange(1, 4096, 8); @@ -435,6 +492,136 @@ BENCHMARK(BM_HashJoinBasic_BuildParallelism) BENCHMARK(BM_HashJoinBasic_NullPercentage) ->ArgNames({"Null Percentage"}) ->DenseRange(0, 100, 10); + +const char* use_basic_argname = "Use basic"; +std::vector use_basic_arg = benchmark::CreateDenseRange(0, 1, 1); + +std::vector trivial_residual_filter_argnames = {use_basic_argname}; +std::vector> trivial_residual_filter_args = {use_basic_arg}; + +BENCHMARK_CAPTURE(BM_HashJoinBasic_TrivialResidualFilter, "Inner/Literal(true)", + JoinType::INNER, literal(true)) + ->ArgNames(trivial_residual_filter_argnames) + ->ArgsProduct(trivial_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_TrivialResidualFilter, "Left Semi/Literal(true)", + JoinType::LEFT_SEMI, literal(true)) + ->ArgNames(trivial_residual_filter_argnames) + ->ArgsProduct(trivial_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_TrivialResidualFilter, "Right Semi/Literal(true)", + JoinType::RIGHT_SEMI, literal(true)) + ->ArgNames(trivial_residual_filter_argnames) + ->ArgsProduct(trivial_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_TrivialResidualFilter, "Left Anti/Literal(true)", + JoinType::LEFT_ANTI, literal(true)) + ->ArgNames(trivial_residual_filter_argnames) + ->ArgsProduct(trivial_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_TrivialResidualFilter, "Right Anti/Literal(true)", + JoinType::RIGHT_ANTI, literal(true)) + ->ArgNames(trivial_residual_filter_argnames) + ->ArgsProduct(trivial_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_TrivialResidualFilter, "Left Outer/Literal(true)", + JoinType::LEFT_OUTER, literal(true)) + ->ArgNames(trivial_residual_filter_argnames) + ->ArgsProduct(trivial_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_TrivialResidualFilter, "Right Outer/Literal(true)", + JoinType::RIGHT_OUTER, literal(true)) + ->ArgNames(trivial_residual_filter_argnames) + ->ArgsProduct(trivial_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_TrivialResidualFilter, "Full Outer/Literal(true)", + JoinType::FULL_OUTER, literal(true)) + ->ArgNames(trivial_residual_filter_argnames) + ->ArgsProduct(trivial_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_TrivialResidualFilter, "Inner/Literal(false)", + JoinType::INNER, literal(false)) + ->ArgNames(trivial_residual_filter_argnames) + ->ArgsProduct(trivial_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_TrivialResidualFilter, "Left Semi/Literal(false)", + JoinType::LEFT_SEMI, literal(false)) + ->ArgNames(trivial_residual_filter_argnames) + ->ArgsProduct(trivial_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_TrivialResidualFilter, "Right Semi/Literal(false)", + JoinType::RIGHT_SEMI, literal(false)) + ->ArgNames(trivial_residual_filter_argnames) + ->ArgsProduct(trivial_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_TrivialResidualFilter, "Left Anti/Literal(false)", + JoinType::LEFT_ANTI, literal(false)) + ->ArgNames(trivial_residual_filter_argnames) + ->ArgsProduct(trivial_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_TrivialResidualFilter, "Right Anti/Literal(false)", + JoinType::RIGHT_ANTI, literal(false)) + ->ArgNames(trivial_residual_filter_argnames) + ->ArgsProduct(trivial_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_TrivialResidualFilter, "Left Outer/Literal(false)", + JoinType::LEFT_OUTER, literal(false)) + ->ArgNames(trivial_residual_filter_argnames) + ->ArgsProduct(trivial_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_TrivialResidualFilter, "Right Outer/Literal(false)", + JoinType::RIGHT_OUTER, literal(false)) + ->ArgNames(trivial_residual_filter_argnames) + ->ArgsProduct(trivial_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_TrivialResidualFilter, "Full Outer/Literal(false)", + JoinType::FULL_OUTER, literal(false)) + ->ArgNames(trivial_residual_filter_argnames) + ->ArgsProduct(trivial_residual_filter_args); + +std::vector complex_residual_filter_argnames = {use_basic_argname, + "Selectivity"}; +std::vector> complex_residual_filter_args = { + use_basic_arg, benchmark::CreateDenseRange(0, 100, 20)}; + +BENCHMARK_CAPTURE(BM_HashJoinBasic_ComplexResidualFilter, "Inner", JoinType::INNER) + ->ArgNames(complex_residual_filter_argnames) + ->ArgsProduct(complex_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_ComplexResidualFilter, "Left Semi", + JoinType::LEFT_SEMI) + ->ArgNames(complex_residual_filter_argnames) + ->ArgsProduct(complex_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_ComplexResidualFilter, "Right Semi", + JoinType::RIGHT_SEMI) + ->ArgNames(complex_residual_filter_argnames) + ->ArgsProduct(complex_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_ComplexResidualFilter, "Left Anti", + JoinType::LEFT_ANTI) + ->ArgNames(complex_residual_filter_argnames) + ->ArgsProduct(complex_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_ComplexResidualFilter, "Right Anti", + JoinType::RIGHT_ANTI) + ->ArgNames(complex_residual_filter_argnames) + ->ArgsProduct(complex_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_ComplexResidualFilter, "Left Outer", + JoinType::LEFT_OUTER) + ->ArgNames(complex_residual_filter_argnames) + ->ArgsProduct(complex_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_ComplexResidualFilter, "Right Outer", + JoinType::RIGHT_OUTER) + ->ArgNames(complex_residual_filter_argnames) + ->ArgsProduct(complex_residual_filter_args); + +BENCHMARK_CAPTURE(BM_HashJoinBasic_ComplexResidualFilter, "Full Outer", + JoinType::FULL_OUTER) + ->ArgNames(complex_residual_filter_argnames) + ->ArgsProduct(complex_residual_filter_args); #else BENCHMARK_CAPTURE(BM_HashJoinBasic_KeyTypes, "{int32}", {int32()}) diff --git a/cpp/src/arrow/acero/hash_join_node.cc b/cpp/src/arrow/acero/hash_join_node.cc index 254dad361ff87..c0179fd160e4e 100644 --- a/cpp/src/arrow/acero/hash_join_node.cc +++ b/cpp/src/arrow/acero/hash_join_node.cc @@ -740,13 +740,11 @@ class HashJoinNode : public ExecNode, public TracedNode { // Create hash join implementation object // SwissJoin does not support: // a) 64-bit string offsets - // b) residual predicates - // c) dictionaries + // b) dictionaries // bool use_swiss_join; #if ARROW_LITTLE_ENDIAN - use_swiss_join = (filter == literal(true)) && !schema_mgr->HasDictionaries() && - !schema_mgr->HasLargeBinary(); + use_swiss_join = !schema_mgr->HasDictionaries() && !schema_mgr->HasLargeBinary(); #else use_swiss_join = false; #endif diff --git a/cpp/src/arrow/acero/hash_join_node_test.cc b/cpp/src/arrow/acero/hash_join_node_test.cc index 58551f4eca00a..63969d9a3ed4b 100644 --- a/cpp/src/arrow/acero/hash_join_node_test.cc +++ b/cpp/src/arrow/acero/hash_join_node_test.cc @@ -1893,58 +1893,147 @@ TEST(HashJoin, CheckHashJoinNodeOptionsValidation) { } } -TEST(HashJoin, ResidualFilter) { - for (bool parallel : {false, true}) { - SCOPED_TRACE(parallel ? "parallel/merged" : "serial"); - - BatchesWithSchema input_left; - input_left.batches = {ExecBatchFromJSON({int32(), int32(), utf8()}, R"([ - [1, 6, "alpha"], - [2, 5, "beta"], - [3, 4, "alpha"] - ])")}; - input_left.schema = - schema({field("l1", int32()), field("l2", int32()), field("l_str", utf8())}); - - BatchesWithSchema input_right; - input_right.batches = {ExecBatchFromJSON({int32(), int32(), utf8()}, R"([ - [5, 11, "alpha"], - [2, 12, "beta"], - [4, 16, "alpha"] - ])")}; - input_right.schema = - schema({field("r1", int32()), field("r2", int32()), field("r_str", utf8())}); +class ResidualFilterCaseRunner { + public: + ResidualFilterCaseRunner(BatchesWithSchema left_input, BatchesWithSchema right_input) + : left_input_(std::move(left_input)), right_input_(std::move(right_input)) {} + + void Run(JoinType join_type, std::vector left_keys, + std::vector right_keys, Expression filter, + const std::vector& expected) const { + RunInternal(HashJoinNodeOptions{join_type, std::move(left_keys), + std::move(right_keys), std::move(filter)}, + expected); + } + + void Run(JoinType join_type, std::vector left_keys, + std::vector right_keys, std::vector left_output, + std::vector right_output, Expression filter, + const std::vector& expected) const { + RunInternal(HashJoinNodeOptions{join_type, std::move(left_keys), + std::move(right_keys), std::move(left_output), + std::move(right_output), std::move(filter)}, + expected); + } + + private: + void RunInternal(const HashJoinNodeOptions& options, + const std::vector& expected) const { + auto join_type_str = JoinTypeString(options.join_type); + auto join_cond_str = + JoinConditionString(options.left_keys, options.right_keys, options.filter); + auto output_str = OutputString(options.left_output, options.right_output); + for (bool parallel : {false, true}) { + auto parallel_str = parallel ? "parallel" : "serial"; + ARROW_SCOPED_TRACE(join_type_str + " " + join_cond_str + " " + output_str + " " + + parallel_str); - Declaration left{ - "source", - SourceNodeOptions{input_left.schema, input_left.gen(parallel, /*slow=*/false)}}; - Declaration right{ - "source", - SourceNodeOptions{input_right.schema, input_right.gen(parallel, /*slow=*/false)}}; + Declaration left{"source", + SourceNodeOptions{left_input_.schema, + left_input_.gen(parallel, /*slow=*/false)}}; + Declaration right{"source", + SourceNodeOptions{right_input_.schema, + right_input_.gen(parallel, /*slow=*/false)}}; - Expression mul = call("multiply", {field_ref("l1"), field_ref("l2")}); - Expression combination = call("add", {mul, field_ref("r1")}); - Expression residual_filter = less_equal(combination, field_ref("r2")); + Declaration join{"hashjoin", {std::move(left), std::move(right)}, options}; - HashJoinNodeOptions join_opts{ - JoinType::FULL_OUTER, - /*left_keys=*/{"l_str"}, - /*right_keys=*/{"r_str"}, std::move(residual_filter), "l_", "r_"}; + ASSERT_OK_AND_ASSIGN(auto result, + DeclarationToExecBatches(std::move(join), parallel)); + AssertExecBatchesEqualIgnoringOrder(result.schema, expected, result.batches); + } + } - Declaration join{"hashjoin", {std::move(left), std::move(right)}, join_opts}; + private: + BatchesWithSchema left_input_; + BatchesWithSchema right_input_; - ASSERT_OK_AND_ASSIGN(auto result, - DeclarationToExecBatches(std::move(join), parallel)); + private: + static std::string JoinTypeString(JoinType t) { + switch (t) { + case JoinType::LEFT_SEMI: + return "LEFT_SEMI"; + case JoinType::RIGHT_SEMI: + return "RIGHT_SEMI"; + case JoinType::LEFT_ANTI: + return "LEFT_ANTI"; + case JoinType::RIGHT_ANTI: + return "RIGHT_ANTI"; + case JoinType::INNER: + return "INNER"; + case JoinType::LEFT_OUTER: + return "LEFT_OUTER"; + case JoinType::RIGHT_OUTER: + return "RIGHT_OUTER"; + case JoinType::FULL_OUTER: + return "FULL_OUTER"; + } + ARROW_DCHECK(false); + return ""; + } + + static std::string JoinConditionString(const std::vector& left_keys, + const std::vector& right_keys, + const Expression& filter) { + ARROW_DCHECK(left_keys.size() > 0); + ARROW_DCHECK(left_keys.size() == right_keys.size()); + std::stringstream ss; + ss << "on ("; + for (size_t i = 0; i < left_keys.size(); ++i) { + ss << left_keys[i].ToString() << " = " << right_keys[i].ToString() << " and "; + } + ss << filter.ToString(); + ss << ")"; + return ss.str(); + } + + static std::string OutputString(const std::vector& left_output, + const std::vector& right_output) { + std::vector both_output; + both_output.reserve(left_output.size() + right_output.size()); + both_output.insert(both_output.end(), left_output.begin(), left_output.end()); + both_output.insert(both_output.end(), right_output.begin(), right_output.end()); + std::stringstream ss; + ss << "output ("; + for (size_t i = 0; i < both_output.size(); ++i) { + if (i != 0) { + ss << ", "; + } + ss << both_output[i].ToString(); + } + ss << ")"; + return ss.str(); + } +}; - std::vector expected = { - ExecBatchFromJSON({int32(), int32(), utf8(), int32(), int32(), utf8()}, R"([ - [1, 6, "alpha", 4, 16, "alpha"], - [1, 6, "alpha", 5, 11, "alpha"], - [2, 5, "beta", 2, 12, "beta"], - [3, 4, "alpha", 4, 16, "alpha"]])")}; +TEST(HashJoin, ResidualFilter) { + BatchesWithSchema input_left; + input_left.batches = {ExecBatchFromJSON({int32(), int32(), utf8()}, R"([ + [1, 6, "alpha"], + [2, 5, "beta"], + [3, 4, "alpha"]])")}; + input_left.schema = + schema({field("l1", int32()), field("l2", int32()), field("l_str", utf8())}); - AssertExecBatchesEqualIgnoringOrder(result.schema, result.batches, expected); - } + BatchesWithSchema input_right; + input_right.batches = {ExecBatchFromJSON({int32(), int32(), utf8()}, R"([ + [5, 11, "alpha"], + [2, 12, "beta"], + [4, 16, "alpha"]])")}; + input_right.schema = + schema({field("r1", int32()), field("r2", int32()), field("r_str", utf8())}); + + const ResidualFilterCaseRunner runner{std::move(input_left), std::move(input_right)}; + + Expression mul = call("multiply", {field_ref("l1"), field_ref("l2")}); + Expression combination = call("add", {mul, field_ref("r1")}); + Expression filter = less_equal(combination, field_ref("r2")); + + runner.Run(JoinType::FULL_OUTER, {"l_str"}, {"r_str"}, std::move(filter), + {ExecBatchFromJSON({int32(), int32(), utf8(), int32(), int32(), utf8()}, R"([ + [1, 6, "alpha", 4, 16, "alpha"], + [1, 6, "alpha", 5, 11, "alpha"], + [2, 5, "beta", 2, 12, "beta"], + [3, 4, "alpha", 4, 16, "alpha"]])")}); } TEST(HashJoin, TrivialResidualFilter) { @@ -1959,47 +2048,993 @@ TEST(HashJoin, TrivialResidualFilter) { std::vector expected_strings = {expected_true, expected_false}; std::vector filters = {always_true, always_false}; + BatchesWithSchema input_left; + input_left.batches = {ExecBatchFromJSON({int32(), utf8()}, R"([ + [1, "alpha"]])")}; + input_left.schema = schema({field("l1", int32()), field("l_str", utf8())}); + + BatchesWithSchema input_right; + input_right.batches = {ExecBatchFromJSON({int32(), utf8()}, R"([ + [1, "alpha"]])")}; + input_right.schema = schema({field("r1", int32()), field("r_str", utf8())}); + + ResidualFilterCaseRunner runner{std::move(input_left), std::move(input_right)}; + for (size_t test_id = 0; test_id < 2; test_id++) { - for (bool parallel : {false, true}) { - SCOPED_TRACE(parallel ? "parallel/merged" : "serial"); + runner.Run(JoinType::INNER, {"l_str"}, {"r_str"}, filters[test_id], + {ExecBatchFromJSON({int32(), utf8(), int32(), utf8()}, + expected_strings[test_id])}); + } +} - BatchesWithSchema input_left; - input_left.batches = {ExecBatchFromJSON({int32(), utf8()}, R"([ - [1, "alpha"] - ])")}; - input_left.schema = schema({field("l1", int32()), field("l_str", utf8())}); +TEST(HashJoin, FineGrainedResidualFilter) { + struct JoinSchema { + std::shared_ptr left, right; - BatchesWithSchema input_right; - input_right.batches = {ExecBatchFromJSON({int32(), utf8()}, R"([ - [1, "alpha"] - ])")}; - input_right.schema = schema({field("r1", int32()), field("r_str", utf8())}); + struct Projector { + std::shared_ptr left, right; + std::vector left_output, right_output; - auto exec_ctx = std::make_unique( - default_memory_pool(), - parallel ? arrow::internal::GetCpuThreadPool() : nullptr); + std::vector LeftOutput(JoinType join_type) const { + if (join_type == JoinType::RIGHT_SEMI || join_type == JoinType::RIGHT_ANTI) { + return {}; + } + std::vector output(left_output.size()); + std::transform(left_output.begin(), left_output.end(), output.begin(), + [](int i) { return i; }); + return output; + } - Declaration left{ - "source", - SourceNodeOptions{input_left.schema, input_left.gen(parallel, /*slow=*/false)}}; - Declaration right{"source", - SourceNodeOptions{input_right.schema, - input_right.gen(parallel, /*slow=*/false)}}; + std::vector RightOutput(JoinType join_type) const { + if (join_type == JoinType::LEFT_SEMI || join_type == JoinType::LEFT_ANTI) { + return {}; + } + std::vector output(right_output.size()); + std::transform(right_output.begin(), right_output.end(), output.begin(), + [](int i) { return i; }); + return output; + } - HashJoinNodeOptions join_opts{ - JoinType::INNER, - /*left_keys=*/{"l_str"}, - /*right_keys=*/{"r_str"}, filters[test_id], "l_", "r_"}; + ExecBatch Project(JoinType join_type, const ExecBatch& batch) const { + std::vector values; + if (join_type != JoinType::RIGHT_SEMI && join_type != JoinType::RIGHT_ANTI) { + for (int i : left_output) { + values.push_back(batch[i]); + } + } + if (join_type != JoinType::LEFT_SEMI && join_type != JoinType::LEFT_ANTI) { + int left_size = + join_type == JoinType::RIGHT_SEMI || join_type == JoinType::RIGHT_ANTI + ? 0 + : left->num_fields(); + for (int i : right_output) { + values.push_back(batch[left_size + i]); + } + } + return {std::move(values), batch.length}; + } + }; - Declaration join{"hashjoin", {std::move(left), std::move(right)}, join_opts}; + Projector GetProjector(std::vector left_output, std::vector right_output) { + return Projector{left, right, std::move(left_output), std::move(right_output)}; + } + }; + + BatchesWithSchema left; + left.batches = {ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + [null, null, "l_payload"], + [null, 0, "l_payload"], + [null, 42, "l_payload"], + ["left_only", null, "l_payload"], + ["left_only", 0, "l_payload"], + ["left_only", 42, "l_payload"], + ["both1", null, "l_payload"], + ["both1", 0, "l_payload"], + ["both1", 42, "l_payload"], + ["both2", null, "l_payload"], + ["both2", 0, "l_payload"], + ["both2", 42, "l_payload"]])")}; + left.schema = schema( + {field("l_key", utf8()), field("l_filter", int32()), field("l_payload", utf8())}); + + BatchesWithSchema right; + right.batches = {ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + [null, null, "r_payload"], + [null, 0, "r_payload"], + [null, 42, "r_payload"], + ["both1", null, "r_payload"], + ["both1", 0, "r_payload"], + ["both1", 42, "r_payload"], + ["both2", null, "r_payload"], + ["both2", 0, "r_payload"], + ["both2", 42, "r_payload"], + ["right_only", null, "r_payload"], + ["right_only", 0, "r_payload"], + ["right_only", 42, "r_payload"]])")}; + right.schema = schema( + {field("r_key", utf8()), field("r_filter", int32()), field("r_payload", utf8())}); + + JoinSchema join_schema{left.schema, right.schema}; + std::vector projectors{ + join_schema.GetProjector({0, 1, 2}, {0, 1, 2}), // Output all. + join_schema.GetProjector({0}, {0}), // Output key columns only. + join_schema.GetProjector({1}, {1}), // Output filter columns only. + join_schema.GetProjector({2}, {2})}; // Output payload columns only. + + const ResidualFilterCaseRunner runner{std::move(left), std::move(right)}; - ASSERT_OK_AND_ASSIGN(auto result, - DeclarationToExecBatches(std::move(join), parallel)); + { + // Literal true and scalar true. + for (Expression filter : {literal(true), equal(literal(1), literal(1))}) { + std::vector left_keys{"l_key", "l_filter"}, + right_keys{"r_key", "r_filter"}; + { + // Inner join. + JoinType join_type = JoinType::INNER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + ["both1", 0, "l_payload", "both1", 0, "r_payload"], + ["both1", 42, "l_payload", "both1", 42, "r_payload"], + ["both2", 0, "l_payload", "both2", 0, "r_payload"], + ["both2", 42, "l_payload", "both2", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } - std::vector expected = {ExecBatchFromJSON( - {int32(), utf8(), int32(), utf8()}, expected_strings[test_id])}; + { + // Left outer join. + JoinType join_type = JoinType::LEFT_OUTER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + [null, null, "l_payload", null, null, null], + [null, 0, "l_payload", null, null, null], + [null, 42, "l_payload", null, null, null], + ["left_only", null, "l_payload", null, null, null], + ["left_only", 0, "l_payload", null, null, null], + ["left_only", 42, "l_payload", null, null, null], + ["both1", null, "l_payload", null, null, null], + ["both2", null, "l_payload", null, null, null], + ["both1", 0, "l_payload", "both1", 0, "r_payload"], + ["both1", 42, "l_payload", "both1", 42, "r_payload"], + ["both2", 0, "l_payload", "both2", 0, "r_payload"], + ["both2", 42, "l_payload", "both2", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } - AssertExecBatchesEqualIgnoringOrder(result.schema, result.batches, expected); + { + // Right outer join. + JoinType join_type = JoinType::RIGHT_OUTER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + ["both1", 0, "l_payload", "both1", 0, "r_payload"], + ["both1", 42, "l_payload", "both1", 42, "r_payload"], + ["both2", 0, "l_payload", "both2", 0, "r_payload"], + ["both2", 42, "l_payload", "both2", 42, "r_payload"], + [null, null, null, null, null, "r_payload"], + [null, null, null, null, 0, "r_payload"], + [null, null, null, null, 42, "r_payload"], + [null, null, null, "both1", null, "r_payload"], + [null, null, null, "both2", null, "r_payload"], + [null, null, null, "right_only", null, "r_payload"], + [null, null, null, "right_only", 0, "r_payload"], + [null, null, null, "right_only", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Full outer join. + JoinType join_type = JoinType::FULL_OUTER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + [null, null, "l_payload", null, null, null], + [null, 0, "l_payload", null, null, null], + [null, 42, "l_payload", null, null, null], + ["left_only", null, "l_payload", null, null, null], + ["left_only", 0, "l_payload", null, null, null], + ["left_only", 42, "l_payload", null, null, null], + ["both1", null, "l_payload", null, null, null], + ["both2", null, "l_payload", null, null, null], + ["both1", 0, "l_payload", "both1", 0, "r_payload"], + ["both1", 42, "l_payload", "both1", 42, "r_payload"], + ["both2", 0, "l_payload", "both2", 0, "r_payload"], + ["both2", 42, "l_payload", "both2", 42, "r_payload"], + [null, null, null, null, null, "r_payload"], + [null, null, null, null, 0, "r_payload"], + [null, null, null, null, 42, "r_payload"], + [null, null, null, "both1", null, "r_payload"], + [null, null, null, "both2", null, "r_payload"], + [null, null, null, "right_only", null, "r_payload"], + [null, null, null, "right_only", 0, "r_payload"], + [null, null, null, "right_only", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Left semi join. + JoinType join_type = JoinType::LEFT_SEMI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + ["both1", 0, "l_payload"], + ["both1", 42, "l_payload"], + ["both2", 0, "l_payload"], + ["both2", 42, "l_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Left anti join. + JoinType join_type = JoinType::LEFT_ANTI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + [null, null, "l_payload"], + [null, 0, "l_payload"], + [null, 42, "l_payload"], + ["left_only", null, "l_payload"], + ["left_only", 0, "l_payload"], + ["left_only", 42, "l_payload"], + ["both1", null, "l_payload"], + ["both2", null, "l_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Right semi join. + JoinType join_type = JoinType::RIGHT_SEMI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + ["both1", 0, "r_payload"], + ["both1", 42, "r_payload"], + ["both2", 0, "r_payload"], + ["both2", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Right anti join. + JoinType join_type = JoinType::RIGHT_ANTI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + [null, null, "r_payload"], + [null, 0, "r_payload"], + [null, 42, "r_payload"], + ["both1", null, "r_payload"], + ["both2", null, "r_payload"], + ["right_only", null, "r_payload"], + ["right_only", 0, "r_payload"], + ["right_only", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + } + } + + { + // Literal false, null, and scalar false, null. + for (Expression filter : + {literal(false), literal(NullScalar()), equal(literal(0), literal(1)), + equal(literal(1), literal(NullScalar()))}) { + std::vector left_keys{"l_key", "l_filter"}, + right_keys{"r_key", "r_filter"}; + { + // Inner join. + JoinType join_type = JoinType::INNER; + auto expected = ExecBatchFromJSON( + {utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Left outer join. + JoinType join_type = JoinType::LEFT_OUTER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + [null, null, "l_payload", null, null, null], + [null, 0, "l_payload", null, null, null], + [null, 42, "l_payload", null, null, null], + ["left_only", null, "l_payload", null, null, null], + ["left_only", 0, "l_payload", null, null, null], + ["left_only", 42, "l_payload", null, null, null], + ["both1", null, "l_payload", null, null, null], + ["both1", 0, "l_payload", null, null, null], + ["both1", 42, "l_payload", null, null, null], + ["both2", null, "l_payload", null, null, null], + ["both2", 0, "l_payload", null, null, null], + ["both2", 42, "l_payload", null, null, null]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Right outer join. + JoinType join_type = JoinType::RIGHT_OUTER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + [null, null, null, null, null, "r_payload"], + [null, null, null, null, 0, "r_payload"], + [null, null, null, null, 42, "r_payload"], + [null, null, null, "both1", null, "r_payload"], + [null, null, null, "both1", 0, "r_payload"], + [null, null, null, "both1", 42, "r_payload"], + [null, null, null, "both2", null, "r_payload"], + [null, null, null, "both2", 0, "r_payload"], + [null, null, null, "both2", 42, "r_payload"], + [null, null, null, "right_only", null, "r_payload"], + [null, null, null, "right_only", 0, "r_payload"], + [null, null, null, "right_only", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Full outer join. + JoinType join_type = JoinType::FULL_OUTER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + [null, null, "l_payload", null, null, null], + [null, 0, "l_payload", null, null, null], + [null, 42, "l_payload", null, null, null], + ["left_only", null, "l_payload", null, null, null], + ["left_only", 0, "l_payload", null, null, null], + ["left_only", 42, "l_payload", null, null, null], + ["both1", null, "l_payload", null, null, null], + ["both1", 0, "l_payload", null, null, null], + ["both1", 42, "l_payload", null, null, null], + ["both2", null, "l_payload", null, null, null], + ["both2", 0, "l_payload", null, null, null], + ["both2", 42, "l_payload", null, null, null], + [null, null, null, null, null, "r_payload"], + [null, null, null, null, 0, "r_payload"], + [null, null, null, null, 42, "r_payload"], + [null, null, null, "both1", null, "r_payload"], + [null, null, null, "both1", 0, "r_payload"], + [null, null, null, "both1", 42, "r_payload"], + [null, null, null, "both2", null, "r_payload"], + [null, null, null, "both2", 0, "r_payload"], + [null, null, null, "both2", 42, "r_payload"], + [null, null, null, "right_only", null, "r_payload"], + [null, null, null, "right_only", 0, "r_payload"], + [null, null, null, "right_only", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Left semi join. + JoinType join_type = JoinType::LEFT_SEMI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Left anti join. + JoinType join_type = JoinType::LEFT_ANTI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + [null, null, "l_payload"], + [null, 0, "l_payload"], + [null, 42, "l_payload"], + ["left_only", null, "l_payload"], + ["left_only", 0, "l_payload"], + ["left_only", 42, "l_payload"], + ["both1", null, "l_payload"], + ["both1", 0, "l_payload"], + ["both1", 42, "l_payload"], + ["both2", null, "l_payload"], + ["both2", 0, "l_payload"], + ["both2", 42, "l_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Right semi join. + JoinType join_type = JoinType::RIGHT_SEMI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Right anti join. + JoinType join_type = JoinType::RIGHT_ANTI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + [null, null, "r_payload"], + [null, 0, "r_payload"], + [null, 42, "r_payload"], + ["both1", null, "r_payload"], + ["both1", 0, "r_payload"], + ["both1", 42, "r_payload"], + ["both2", null, "r_payload"], + ["both2", 0, "r_payload"], + ["both2", 42, "r_payload"], + ["right_only", null, "r_payload"], + ["right_only", 0, "r_payload"], + ["right_only", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + } + } + + { + // Non-trivial filters referring left columns only. + for (Expression filter : {equal(field_ref("l_filter"), literal(42)), + not_equal(literal(0), field_ref("l_filter"))}) { + std::vector left_keys{"l_key"}, right_keys{"r_key"}; + { + // Inner join. + JoinType join_type = JoinType::INNER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + ["both1", 42, "l_payload", "both1", null, "r_payload"], + ["both1", 42, "l_payload", "both1", 0, "r_payload"], + ["both1", 42, "l_payload", "both1", 42, "r_payload"], + ["both2", 42, "l_payload", "both2", null, "r_payload"], + ["both2", 42, "l_payload", "both2", 0, "r_payload"], + ["both2", 42, "l_payload", "both2", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Left outer join. + JoinType join_type = JoinType::LEFT_OUTER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + [null, null, "l_payload", null, null, null], + [null, 0, "l_payload", null, null, null], + [null, 42, "l_payload", null, null, null], + ["left_only", null, "l_payload", null, null, null], + ["left_only", 0, "l_payload", null, null, null], + ["left_only", 42, "l_payload", null, null, null], + ["both1", null, "l_payload", null, null, null], + ["both1", 0, "l_payload", null, null, null], + ["both2", null, "l_payload", null, null, null], + ["both2", 0, "l_payload", null, null, null], + ["both1", 42, "l_payload", "both1", null, "r_payload"], + ["both1", 42, "l_payload", "both1", 0, "r_payload"], + ["both1", 42, "l_payload", "both1", 42, "r_payload"], + ["both2", 42, "l_payload", "both2", null, "r_payload"], + ["both2", 42, "l_payload", "both2", 0, "r_payload"], + ["both2", 42, "l_payload", "both2", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Right outer join. + JoinType join_type = JoinType::RIGHT_OUTER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + ["both1", 42, "l_payload", "both1", null, "r_payload"], + ["both1", 42, "l_payload", "both1", 0, "r_payload"], + ["both1", 42, "l_payload", "both1", 42, "r_payload"], + ["both2", 42, "l_payload", "both2", null, "r_payload"], + ["both2", 42, "l_payload", "both2", 0, "r_payload"], + ["both2", 42, "l_payload", "both2", 42, "r_payload"], + [null, null, null, null, null, "r_payload"], + [null, null, null, null, 0, "r_payload"], + [null, null, null, null, 42, "r_payload"], + [null, null, null, "right_only", null, "r_payload"], + [null, null, null, "right_only", 0, "r_payload"], + [null, null, null, "right_only", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Full outer join. + JoinType join_type = JoinType::FULL_OUTER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + [null, null, "l_payload", null, null, null], + [null, 0, "l_payload", null, null, null], + [null, 42, "l_payload", null, null, null], + ["left_only", null, "l_payload", null, null, null], + ["left_only", 0, "l_payload", null, null, null], + ["left_only", 42, "l_payload", null, null, null], + ["both1", null, "l_payload", null, null, null], + ["both1", 0, "l_payload", null, null, null], + ["both2", null, "l_payload", null, null, null], + ["both2", 0, "l_payload", null, null, null], + ["both1", 42, "l_payload", "both1", null, "r_payload"], + ["both1", 42, "l_payload", "both1", 0, "r_payload"], + ["both1", 42, "l_payload", "both1", 42, "r_payload"], + ["both2", 42, "l_payload", "both2", null, "r_payload"], + ["both2", 42, "l_payload", "both2", 0, "r_payload"], + ["both2", 42, "l_payload", "both2", 42, "r_payload"], + [null, null, null, null, null, "r_payload"], + [null, null, null, null, 0, "r_payload"], + [null, null, null, null, 42, "r_payload"], + [null, null, null, "right_only", null, "r_payload"], + [null, null, null, "right_only", 0, "r_payload"], + [null, null, null, "right_only", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Left semi join. + JoinType join_type = JoinType::LEFT_SEMI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + ["both1", 42, "l_payload"], + ["both2", 42, "l_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Left anti join. + JoinType join_type = JoinType::LEFT_ANTI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + [null, null, "l_payload"], + [null, 0, "l_payload"], + [null, 42, "l_payload"], + ["left_only", null, "l_payload"], + ["left_only", 0, "l_payload"], + ["left_only", 42, "l_payload"], + ["both1", null, "l_payload"], + ["both1", 0, "l_payload"], + ["both2", null, "l_payload"], + ["both2", 0, "l_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Right semi join. + JoinType join_type = JoinType::RIGHT_SEMI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + ["both1", null, "r_payload"], + ["both1", 0, "r_payload"], + ["both1", 42, "r_payload"], + ["both2", null, "r_payload"], + ["both2", 0, "r_payload"], + ["both2", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Right anti join. + JoinType join_type = JoinType::RIGHT_ANTI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + [null, null, "r_payload"], + [null, 0, "r_payload"], + [null, 42, "r_payload"], + ["right_only", null, "r_payload"], + ["right_only", 0, "r_payload"], + ["right_only", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + } + } + + { + // Non-trivial filters referring right columns only. + for (Expression filter : {equal(field_ref("r_filter"), literal(42)), + not_equal(literal(0), field_ref("r_filter"))}) { + std::vector left_keys{"l_key"}, right_keys{"r_key"}; + { + // Inner join. + JoinType join_type = JoinType::INNER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + ["both1", null, "l_payload", "both1", 42, "r_payload"], + ["both1", 0, "l_payload", "both1", 42, "r_payload"], + ["both1", 42, "l_payload", "both1", 42, "r_payload"], + ["both2", null, "l_payload", "both2", 42, "r_payload"], + ["both2", 0, "l_payload", "both2", 42, "r_payload"], + ["both2", 42, "l_payload", "both2", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Left outer join. + JoinType join_type = JoinType::LEFT_OUTER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + [null, null, "l_payload", null, null, null], + [null, 0, "l_payload", null, null, null], + [null, 42, "l_payload", null, null, null], + ["left_only", null, "l_payload", null, null, null], + ["left_only", 0, "l_payload", null, null, null], + ["left_only", 42, "l_payload", null, null, null], + ["both1", null, "l_payload", "both1", 42, "r_payload"], + ["both1", 0, "l_payload", "both1", 42, "r_payload"], + ["both1", 42, "l_payload", "both1", 42, "r_payload"], + ["both2", null, "l_payload", "both2", 42, "r_payload"], + ["both2", 0, "l_payload", "both2", 42, "r_payload"], + ["both2", 42, "l_payload", "both2", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Right outer join. + JoinType join_type = JoinType::RIGHT_OUTER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + ["both1", null, "l_payload", "both1", 42, "r_payload"], + ["both1", 0, "l_payload", "both1", 42, "r_payload"], + ["both1", 42, "l_payload", "both1", 42, "r_payload"], + ["both2", null, "l_payload", "both2", 42, "r_payload"], + ["both2", 0, "l_payload", "both2", 42, "r_payload"], + ["both2", 42, "l_payload", "both2", 42, "r_payload"], + [null, null, null, "both1", null, "r_payload"], + [null, null, null, "both1", 0, "r_payload"], + [null, null, null, "both2", null, "r_payload"], + [null, null, null, "both2", 0, "r_payload"], + [null, null, null, null, null, "r_payload"], + [null, null, null, null, 0, "r_payload"], + [null, null, null, null, 42, "r_payload"], + [null, null, null, "right_only", null, "r_payload"], + [null, null, null, "right_only", 0, "r_payload"], + [null, null, null, "right_only", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Full outer join. + JoinType join_type = JoinType::FULL_OUTER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + [null, null, "l_payload", null, null, null], + [null, 0, "l_payload", null, null, null], + [null, 42, "l_payload", null, null, null], + ["left_only", null, "l_payload", null, null, null], + ["left_only", 0, "l_payload", null, null, null], + ["left_only", 42, "l_payload", null, null, null], + ["both1", null, "l_payload", "both1", 42, "r_payload"], + ["both1", 0, "l_payload", "both1", 42, "r_payload"], + ["both1", 42, "l_payload", "both1", 42, "r_payload"], + ["both2", null, "l_payload", "both2", 42, "r_payload"], + ["both2", 0, "l_payload", "both2", 42, "r_payload"], + ["both2", 42, "l_payload", "both2", 42, "r_payload"], + [null, null, null, "both1", null, "r_payload"], + [null, null, null, "both1", 0, "r_payload"], + [null, null, null, "both2", null, "r_payload"], + [null, null, null, "both2", 0, "r_payload"], + [null, null, null, null, null, "r_payload"], + [null, null, null, null, 0, "r_payload"], + [null, null, null, null, 42, "r_payload"], + [null, null, null, "right_only", null, "r_payload"], + [null, null, null, "right_only", 0, "r_payload"], + [null, null, null, "right_only", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Left semi join. + JoinType join_type = JoinType::LEFT_SEMI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + ["both1", null, "l_payload"], + ["both1", 0, "l_payload"], + ["both1", 42, "l_payload"], + ["both2", null, "l_payload"], + ["both2", 0, "l_payload"], + ["both2", 42, "l_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Left anti join. + JoinType join_type = JoinType::LEFT_ANTI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + [null, null, "l_payload"], + [null, 0, "l_payload"], + [null, 42, "l_payload"], + ["left_only", null, "l_payload"], + ["left_only", 0, "l_payload"], + ["left_only", 42, "l_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Right semi join. + JoinType join_type = JoinType::RIGHT_SEMI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + ["both1", 42, "r_payload"], + ["both2", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Right anti join. + JoinType join_type = JoinType::RIGHT_ANTI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + [null, null, "r_payload"], + [null, 0, "r_payload"], + [null, 42, "r_payload"], + ["both1", null, "r_payload"], + ["both1", 0, "r_payload"], + ["both2", null, "r_payload"], + ["both2", 0, "r_payload"], + ["right_only", null, "r_payload"], + ["right_only", 0, "r_payload"], + ["right_only", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + } + } + + { + // Non-trivial filters referring both left and right columns. + for (Expression filter : + {equal(field_ref("l_filter"), field_ref("r_filter")), + equal(call("subtract", {field_ref("l_filter"), field_ref("r_filter")}), + literal(0))}) { + std::vector left_keys{"l_key"}, right_keys{"r_key"}; + { + // Inner join. + JoinType join_type = JoinType::INNER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + ["both1", 0, "l_payload", "both1", 0, "r_payload"], + ["both1", 42, "l_payload", "both1", 42, "r_payload"], + ["both2", 0, "l_payload", "both2", 0, "r_payload"], + ["both2", 42, "l_payload", "both2", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Left outer join. + JoinType join_type = JoinType::LEFT_OUTER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + [null, null, "l_payload", null, null, null], + [null, 0, "l_payload", null, null, null], + [null, 42, "l_payload", null, null, null], + ["left_only", null, "l_payload", null, null, null], + ["left_only", 0, "l_payload", null, null, null], + ["left_only", 42, "l_payload", null, null, null], + ["both1", null, "l_payload", null, null, null], + ["both2", null, "l_payload", null, null, null], + ["both1", 0, "l_payload", "both1", 0, "r_payload"], + ["both1", 42, "l_payload", "both1", 42, "r_payload"], + ["both2", 0, "l_payload", "both2", 0, "r_payload"], + ["both2", 42, "l_payload", "both2", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Right outer join. + JoinType join_type = JoinType::RIGHT_OUTER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + ["both1", 0, "l_payload", "both1", 0, "r_payload"], + ["both1", 42, "l_payload", "both1", 42, "r_payload"], + ["both2", 0, "l_payload", "both2", 0, "r_payload"], + ["both2", 42, "l_payload", "both2", 42, "r_payload"], + [null, null, null, null, null, "r_payload"], + [null, null, null, null, 0, "r_payload"], + [null, null, null, null, 42, "r_payload"], + [null, null, null, "both1", null, "r_payload"], + [null, null, null, "both2", null, "r_payload"], + [null, null, null, "right_only", null, "r_payload"], + [null, null, null, "right_only", 0, "r_payload"], + [null, null, null, "right_only", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Full outer join. + JoinType join_type = JoinType::FULL_OUTER; + auto expected = + ExecBatchFromJSON({utf8(), int32(), utf8(), utf8(), int32(), utf8()}, R"([ + [null, null, "l_payload", null, null, null], + [null, 0, "l_payload", null, null, null], + [null, 42, "l_payload", null, null, null], + ["left_only", null, "l_payload", null, null, null], + ["left_only", 0, "l_payload", null, null, null], + ["left_only", 42, "l_payload", null, null, null], + ["both1", null, "l_payload", null, null, null], + ["both2", null, "l_payload", null, null, null], + ["both1", 0, "l_payload", "both1", 0, "r_payload"], + ["both1", 42, "l_payload", "both1", 42, "r_payload"], + ["both2", 0, "l_payload", "both2", 0, "r_payload"], + ["both2", 42, "l_payload", "both2", 42, "r_payload"], + [null, null, null, null, null, "r_payload"], + [null, null, null, null, 0, "r_payload"], + [null, null, null, null, 42, "r_payload"], + [null, null, null, "both1", null, "r_payload"], + [null, null, null, "both2", null, "r_payload"], + [null, null, null, "right_only", null, "r_payload"], + [null, null, null, "right_only", 0, "r_payload"], + [null, null, null, "right_only", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Left semi join. + JoinType join_type = JoinType::LEFT_SEMI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + ["both1", 0, "l_payload"], + ["both1", 42, "l_payload"], + ["both2", 0, "l_payload"], + ["both2", 42, "l_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Left anti join. + JoinType join_type = JoinType::LEFT_ANTI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + [null, null, "l_payload"], + [null, 0, "l_payload"], + [null, 42, "l_payload"], + ["left_only", null, "l_payload"], + ["left_only", 0, "l_payload"], + ["left_only", 42, "l_payload"], + ["both1", null, "l_payload"], + ["both2", null, "l_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Right semi join. + JoinType join_type = JoinType::RIGHT_SEMI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + ["both1", 0, "r_payload"], + ["both1", 42, "r_payload"], + ["both2", 0, "r_payload"], + ["both2", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } + + { + // Right anti join. + JoinType join_type = JoinType::RIGHT_ANTI; + auto expected = ExecBatchFromJSON({utf8(), int32(), utf8()}, R"([ + [null, null, "r_payload"], + [null, 0, "r_payload"], + [null, 42, "r_payload"], + ["both1", null, "r_payload"], + ["both2", null, "r_payload"], + ["right_only", null, "r_payload"], + ["right_only", 0, "r_payload"], + ["right_only", 42, "r_payload"]])"); + for (const auto& projector : projectors) { + runner.Run(join_type, left_keys, right_keys, projector.LeftOutput(join_type), + projector.RightOutput(join_type), filter, + {projector.Project(join_type, expected)}); + } + } } } } diff --git a/cpp/src/arrow/acero/swiss_join.cc b/cpp/src/arrow/acero/swiss_join.cc index 2f79ed299bb70..68b0e37b01aa9 100644 --- a/cpp/src/arrow/acero/swiss_join.cc +++ b/cpp/src/arrow/acero/swiss_join.cc @@ -1085,10 +1085,30 @@ void SwissTableForJoin::UpdateHasMatchForKeys(int64_t thread_id, int num_ids, if (num_ids == 0 || !bit_vector) { return; } + for (int ikey = 0; ikey < num_ids; ++ikey) { + // Mark payloads corresponding to this key in hash table as having a match. + // + uint32_t key_id = key_ids[ikey]; + uint32_t first_payload_for_key = key_to_payload() ? key_to_payload()[key_id] : key_id; + uint32_t last_payload_for_key = + key_to_payload() ? key_to_payload()[key_id + 1] - 1 : key_id; + for (uint32_t ipayload = first_payload_for_key; ipayload <= last_payload_for_key; + ++ipayload) { + bit_util::SetBit(bit_vector, ipayload); + } + } +} + +void SwissTableForJoin::UpdateHasMatchForPayloads(int64_t thread_id, int num_ids, + const uint32_t* payload_ids) { + uint8_t* bit_vector = local_has_match(thread_id); + if (num_ids == 0 || !bit_vector) { + return; + } for (int i = 0; i < num_ids; ++i) { - // Mark row in hash table as having a match + // Mark payload in hash table as having a match. // - bit_util::SetBit(bit_vector, key_ids[i]); + bit_util::SetBit(bit_vector, payload_ids[i]); } } @@ -1123,29 +1143,6 @@ uint32_t SwissTableForJoin::payload_id_to_key_id(uint32_t payload_id) const { return static_cast(first_greater - entries) - 1; } -void SwissTableForJoin::payload_ids_to_key_ids(int num_rows, const uint32_t* payload_ids, - uint32_t* key_ids) const { - if (num_rows == 0) { - return; - } - if (no_duplicate_keys_) { - memcpy(key_ids, payload_ids, num_rows * sizeof(uint32_t)); - return; - } - - const uint32_t* entries = key_to_payload(); - uint32_t key_id = payload_id_to_key_id(payload_ids[0]); - key_ids[0] = key_id; - for (int i = 1; i < num_rows; ++i) { - ARROW_DCHECK(payload_ids[i] > payload_ids[i - 1]); - while (entries[key_id + 1] <= payload_ids[i]) { - ++key_id; - ARROW_DCHECK(key_id < num_keys()); - } - key_ids[i] = key_id; - } -} - Status SwissTableForJoinBuild::Init(SwissTableForJoin* target, int dop, int64_t num_rows, bool reject_duplicate_keys, bool no_payload, const std::vector& key_types, @@ -1581,6 +1578,10 @@ Status JoinResultMaterialize::AppendProbeOnly(const ExecBatch& key_and_payload, int num_rows_to_append, const uint16_t* row_ids, int* num_rows_appended) { + if (num_rows_to_append == 0) { + *num_rows_appended = 0; + return Status::OK(); + } num_rows_to_append = std::min(ExecBatchBuilder::num_rows_max() - num_rows_, num_rows_to_append); if (HasProbeOutput()) { @@ -1607,6 +1608,10 @@ Status JoinResultMaterialize::AppendBuildOnly(int num_rows_to_append, const uint32_t* key_ids, const uint32_t* payload_ids, int* num_rows_appended) { + if (num_rows_to_append == 0) { + *num_rows_appended = 0; + return Status::OK(); + } num_rows_to_append = std::min(ExecBatchBuilder::num_rows_max() - num_rows_, num_rows_to_append); if (HasProbeOutput()) { @@ -1634,6 +1639,10 @@ Status JoinResultMaterialize::Append(const ExecBatch& key_and_payload, int num_rows_to_append, const uint16_t* row_ids, const uint32_t* key_ids, const uint32_t* payload_ids, int* num_rows_appended) { + if (num_rows_to_append == 0) { + *num_rows_appended = 0; + return Status::OK(); + } num_rows_to_append = std::min(ExecBatchBuilder::num_rows_max() - num_rows_, num_rows_to_append); if (HasProbeOutput()) { @@ -1791,7 +1800,7 @@ void JoinMatchIterator::SetLookupResult(int num_batch_rows, int start_batch_row, bool JoinMatchIterator::GetNextBatch(int num_rows_max, int* out_num_rows, uint16_t* batch_row_ids, uint32_t* key_ids, - uint32_t* payload_ids) { + uint32_t* payload_ids, int row_id_to_skip) { *out_num_rows = 0; if (no_duplicate_keys_) { @@ -1816,7 +1825,8 @@ bool JoinMatchIterator::GetNextBatch(int num_rows_max, int* out_num_rows, // matches to output. // while (current_row_ < num_batch_rows_ && *out_num_rows < num_rows_max) { - if (!bit_util::GetBit(batch_has_match_, current_row_)) { + if (!bit_util::GetBit(batch_has_match_, current_row_) || + current_row_ == row_id_to_skip) { ++current_row_; current_match_for_row_ = 0; continue; @@ -1855,14 +1865,415 @@ bool JoinMatchIterator::GetNextBatch(int num_rows_max, int* out_num_rows, return (*out_num_rows) > 0; } +namespace { + +// Given match_bitvector identifies that there is a match for row[batch_start_row + i] in +// given input batch if bit match_bitvector[i] == passing_bit. Collect all the passing row +// ids according to the given match_bitvector. +// +void CollectPassingBatchIds(int passing_bit, int64_t hardware_flags, int batch_start_row, + int num_batch_rows, const uint8_t* match_bitvector, + int* num_passing_ids, uint16_t* passing_batch_row_ids) { + arrow::util::bit_util::bits_to_indexes(passing_bit, hardware_flags, num_batch_rows, + match_bitvector, num_passing_ids, + passing_batch_row_ids); + // Add base batch row index. + // + for (int i = 0; i < *num_passing_ids; ++i) { + passing_batch_row_ids[i] += static_cast(batch_start_row); + } +} + +} // namespace + +void JoinResidualFilter::Init(Expression filter, QueryContext* ctx, MemoryPool* pool, + int64_t hardware_flags, + const HashJoinProjectionMaps* probe_schemas, + const HashJoinProjectionMaps* build_schemas, + SwissTableForJoin* hash_table) { + filter_ = std::move(filter); + ctx_ = ctx; + pool_ = pool; + hardware_flags_ = hardware_flags; + probe_schemas_ = probe_schemas; + build_schemas_ = build_schemas; + hash_table_ = hash_table; + + { + probe_filter_to_key_and_payload_.resize( + probe_schemas_->num_cols(HashJoinProjection::FILTER)); + int num_key_cols = probe_schemas_->num_cols(HashJoinProjection::KEY); + auto to_key = + probe_schemas_->map(HashJoinProjection::FILTER, HashJoinProjection::KEY); + auto to_payload = + probe_schemas_->map(HashJoinProjection::FILTER, HashJoinProjection::PAYLOAD); + for (int i = 0; static_cast(i) < probe_filter_to_key_and_payload_.size(); + ++i) { + if (auto idx = to_key.get(i); idx != SchemaProjectionMap::kMissingField) { + probe_filter_to_key_and_payload_[i] = idx; + } else if (idx = to_payload.get(i); idx != SchemaProjectionMap::kMissingField) { + probe_filter_to_key_and_payload_[i] = idx + num_key_cols; + } else { + ARROW_DCHECK(false); + } + } + } + + { + int num_columns = build_schemas_->num_cols(HashJoinProjection::FILTER); + auto to_key = + build_schemas_->map(HashJoinProjection::FILTER, HashJoinProjection::KEY); + auto to_payload = + build_schemas_->map(HashJoinProjection::FILTER, HashJoinProjection::PAYLOAD); + for (int i = 0; i < num_columns; ++i) { + if (to_key.get(i) != SchemaProjectionMap::kMissingField) { + num_build_keys_referred_++; + } else if (to_payload.get(i) != SchemaProjectionMap::kMissingField) { + num_build_payloads_referred_++; + } else { + ARROW_DCHECK(false); + } + } + } +} + +void JoinResidualFilter::OnBuildFinished() { + minibatch_size_ = hash_table_->keys()->swiss_table()->minibatch_size(); + build_keys_ = hash_table_->keys()->keys(); + build_payloads_ = hash_table_->payloads(); + key_to_payload_ = hash_table_->key_to_payload(); +} + +void JoinResidualFilter::InitFilterBitVector(int num_batch_rows, + uint8_t* filter_bitvector) { + std::memset(filter_bitvector, 0, bit_util::BytesForBits(num_batch_rows)); +} + +void JoinResidualFilter::UpdateFilterBitVector(int batch_start_row, int num_batch_rows, + const uint16_t* batch_row_ids, + uint8_t* filter_bitvector) { + for (int i = 0; i < num_batch_rows; ++i) { + int bit_idx = batch_row_ids[i] - batch_start_row; + bit_util::SetBitTo(filter_bitvector, bit_idx, 1); + } +} + +Status JoinResidualFilter::FilterLeftSemi(const ExecBatch& keypayload_batch, + int batch_start_row, int num_batch_rows, + const uint8_t* match_bitvector, + const uint32_t* key_ids, bool no_duplicate_keys, + arrow::util::TempVectorStack* temp_stack, + int* num_passing_ids, + uint16_t* passing_batch_row_ids) const { + if (filter_ == literal(true)) { + CollectPassingBatchIds(1, hardware_flags_, batch_start_row, num_batch_rows, + match_bitvector, num_passing_ids, passing_batch_row_ids); + return Status::OK(); + } + + *num_passing_ids = 0; + if (filter_.IsNullLiteral() || filter_ == literal(false)) { + return Status::OK(); + } + + if (num_build_keys_referred_ == 0 && num_build_payloads_referred_ == 0) { + // If filter refers no column in the right table, then we can directly filter on the + // left rows without inner matching and materializing the right rows. + // + CollectPassingBatchIds(1, hardware_flags_, batch_start_row, num_batch_rows, + match_bitvector, num_passing_ids, passing_batch_row_ids); + return FilterOneBatch(keypayload_batch, *num_passing_ids, passing_batch_row_ids, + /*key_ids_maybe_null=*/NULLPTR, + /*payload_ids_maybe_null=*/NULLPTR, + /*output_key_ids=*/false, + /*output_payload_ids=*/false, temp_stack, num_passing_ids); + } + + auto match_batch_row_ids_buf = + arrow::util::TempVectorHolder(temp_stack, minibatch_size_); + auto match_key_ids_buf = + arrow::util::TempVectorHolder(temp_stack, minibatch_size_); + auto match_payload_ids_buf = + arrow::util::TempVectorHolder(temp_stack, minibatch_size_); + + // Inner matching is necessary for non-trivial filter. Only until evaluating filter for + // all matches of the same row can we be sure that it's not passing (it could pass + // earlier though). + // + JoinMatchIterator match_iterator; + match_iterator.SetLookupResult(num_batch_rows, batch_start_row, match_bitvector, + key_ids, no_duplicate_keys, key_to_payload_); + int num_matches_next = 0; + // Used to not only collect distinct row ids, but also skip unecessary matches in the + // next batch. + // + int row_id_last = JoinMatchIterator::kInvalidRowId; + while (match_iterator.GetNextBatch(minibatch_size_, &num_matches_next, + match_batch_row_ids_buf.mutable_data(), + match_key_ids_buf.mutable_data(), + match_payload_ids_buf.mutable_data(), row_id_last)) { + int num_passing = 0; + RETURN_NOT_OK(FilterOneBatch( + keypayload_batch, num_matches_next, match_batch_row_ids_buf.mutable_data(), + match_key_ids_buf.mutable_data(), match_payload_ids_buf.mutable_data(), + /*output_key_ids=*/false, + /*output_payload_ids=*/false, temp_stack, &num_passing)); + // There may be multiple passing of a row in batch. Collect distinct row ids. + // + for (int ipassing = 0; ipassing < num_passing; ++ipassing) { + if (match_batch_row_ids_buf.mutable_data()[ipassing] == row_id_last) { + continue; + } + row_id_last = passing_batch_row_ids[*num_passing_ids] = + match_batch_row_ids_buf.mutable_data()[ipassing]; + ++(*num_passing_ids); + } + } + + return Status::OK(); +} + +Status JoinResidualFilter::FilterLeftAnti(const ExecBatch& keypayload_batch, + int batch_start_row, int num_batch_rows, + const uint8_t* match_bitvector, + const uint32_t* key_ids, bool no_duplicate_keys, + arrow::util::TempVectorStack* temp_stack, + int* num_passing_ids, + uint16_t* passing_batch_row_ids) const { + if (filter_ == literal(true)) { + CollectPassingBatchIds(0, hardware_flags_, batch_start_row, num_batch_rows, + match_bitvector, num_passing_ids, passing_batch_row_ids); + return Status::OK(); + } + + // Do FilterLeftSemi first. + // + *num_passing_ids = 0; + int num_semi_passing_ids = 0; + auto semi_passing_batch_row_ids = + arrow::util::TempVectorHolder(temp_stack, num_batch_rows); + RETURN_NOT_OK(FilterLeftSemi(keypayload_batch, batch_start_row, num_batch_rows, + match_bitvector, key_ids, no_duplicate_keys, temp_stack, + &num_semi_passing_ids, + semi_passing_batch_row_ids.mutable_data())); + + // Then collect non-passing row ids of FilterLeftSemi. + // + int isemi = 0; + for (int irow = batch_start_row; irow < batch_start_row + num_batch_rows; ++irow) { + while (isemi < num_semi_passing_ids && + semi_passing_batch_row_ids.mutable_data()[isemi] < irow) { + ++isemi; + } + if (isemi == num_semi_passing_ids || + semi_passing_batch_row_ids.mutable_data()[isemi] != irow) { + passing_batch_row_ids[*num_passing_ids] = static_cast(irow); + ++(*num_passing_ids); + } + } + + return Status::OK(); +} + +Status JoinResidualFilter::FilterRightSemiAnti( + int64_t thread_id, const ExecBatch& keypayload_batch, int batch_start_row, + int num_batch_rows, const uint8_t* match_bitvector, const uint32_t* key_ids, + bool no_duplicate_keys, arrow::util::TempVectorStack* temp_stack) const { + if (filter_.IsNullLiteral() || filter_ == literal(false)) { + return Status::OK(); + } + + int num_matching_ids = 0; + if (filter_ == literal(true)) { + auto match_relative_batch_ids_buf = + arrow::util::TempVectorHolder(temp_stack, num_batch_rows); + auto match_key_ids_buf = + arrow::util::TempVectorHolder(temp_stack, num_batch_rows); + + arrow::util::bit_util::bits_to_indexes(1, hardware_flags_, num_batch_rows, + match_bitvector, &num_matching_ids, + match_relative_batch_ids_buf.mutable_data()); + // Collect key ids of passing rows. + // + for (int i = 0; i < num_matching_ids; ++i) { + uint16_t id = match_relative_batch_ids_buf.mutable_data()[i]; + match_key_ids_buf.mutable_data()[i] = key_ids[id]; + } + + hash_table_->UpdateHasMatchForKeys(thread_id, num_matching_ids, + match_key_ids_buf.mutable_data()); + return Status::OK(); + } + + auto match_batch_row_ids_buf = + arrow::util::TempVectorHolder(temp_stack, minibatch_size_); + auto match_key_ids_buf = + arrow::util::TempVectorHolder(temp_stack, minibatch_size_); + auto match_payload_ids_buf = + arrow::util::TempVectorHolder(temp_stack, minibatch_size_); + + // Inner matching is necessary for non-trivial filter. Because even for the same row + // with same matching key, the filter results could vary for different payloads. + // + JoinMatchIterator match_iterator; + match_iterator.SetLookupResult(num_batch_rows, batch_start_row, match_bitvector, + key_ids, no_duplicate_keys, key_to_payload_); + while (match_iterator.GetNextBatch( + minibatch_size_, &num_matching_ids, match_batch_row_ids_buf.mutable_data(), + match_key_ids_buf.mutable_data(), match_payload_ids_buf.mutable_data())) { + int num_filtered = 0; + RETURN_NOT_OK(FilterOneBatch( + keypayload_batch, num_matching_ids, match_batch_row_ids_buf.mutable_data(), + match_key_ids_buf.mutable_data(), match_payload_ids_buf.mutable_data(), + /*output_key_ids=*/false, + /*output_payload_ids=*/true, temp_stack, &num_filtered)); + hash_table_->UpdateHasMatchForPayloads(thread_id, num_filtered, + match_payload_ids_buf.mutable_data()); + } + + return Status::OK(); +} + +Status JoinResidualFilter::FilterInner( + const ExecBatch& keypayload_batch, int num_batch_rows, uint16_t* batch_row_ids, + uint32_t* key_ids, uint32_t* payload_ids_maybe_null, bool output_payload_ids, + arrow::util::TempVectorStack* temp_stack, int* num_passing_rows) const { + if (filter_ == literal(true)) { + *num_passing_rows = num_batch_rows; + return Status::OK(); + } + + *num_passing_rows = 0; + if (filter_.IsNullLiteral() || filter_ == literal(false)) { + return Status::OK(); + } + + return FilterOneBatch( + keypayload_batch, num_batch_rows, batch_row_ids, key_ids, payload_ids_maybe_null, + /*output_key_ids=*/true, output_payload_ids, temp_stack, num_passing_rows); +} + +Status JoinResidualFilter::FilterOneBatch(const ExecBatch& keypayload_batch, + int num_batch_rows, uint16_t* batch_row_ids, + uint32_t* key_ids_maybe_null, + uint32_t* payload_ids_maybe_null, + bool output_key_ids, bool output_payload_ids, + arrow::util::TempVectorStack* temp_stack, + int* num_passing_rows) const { + // Caller must do shortcuts for trivial filter. + ARROW_DCHECK(!filter_.IsNullLiteral() && filter_ != literal(true) && + filter_ != literal(false)); + ARROW_DCHECK(!output_key_ids || key_ids_maybe_null); + ARROW_DCHECK(!output_payload_ids || payload_ids_maybe_null); + + *num_passing_rows = 0; + ARROW_ASSIGN_OR_RAISE(Datum mask, + EvalFilter(keypayload_batch, num_batch_rows, batch_row_ids, + key_ids_maybe_null, payload_ids_maybe_null)); + if (mask.is_scalar()) { + const auto& mask_scalar = mask.scalar_as(); + if (mask_scalar.is_valid && mask_scalar.value) { + *num_passing_rows = num_batch_rows; + } + return Status::OK(); + } + + ARROW_DCHECK_EQ(mask.array()->offset, 0); + ARROW_DCHECK_EQ(mask.array()->length, static_cast(num_batch_rows)); + const uint8_t* validity = + mask.array()->buffers[0] ? mask.array()->buffers[0]->data() : nullptr; + const uint8_t* comparisons = mask.array()->buffers[1]->data(); + for (int irow = 0; irow < num_batch_rows; ++irow) { + bool is_valid = !validity || bit_util::GetBit(validity, irow); + bool is_cmp_true = bit_util::GetBit(comparisons, irow); + if (is_valid && is_cmp_true) { + batch_row_ids[*num_passing_rows] = batch_row_ids[irow]; + if (output_key_ids) { + key_ids_maybe_null[*num_passing_rows] = key_ids_maybe_null[irow]; + } + if (output_payload_ids) { + payload_ids_maybe_null[*num_passing_rows] = payload_ids_maybe_null[irow]; + } + ++(*num_passing_rows); + } + } + + return Status::OK(); +} + +Result JoinResidualFilter::EvalFilter( + const ExecBatch& keypayload_batch, int num_batch_rows, const uint16_t* batch_row_ids, + const uint32_t* key_ids_maybe_null, const uint32_t* payload_ids_maybe_null) const { + ARROW_DCHECK(!filter_.IsNullLiteral() && filter_ != literal(true) && + filter_ != literal(false)); + + ARROW_ASSIGN_OR_RAISE( + ExecBatch input, + MaterializeFilterInput(keypayload_batch, num_batch_rows, batch_row_ids, + key_ids_maybe_null, payload_ids_maybe_null)); + return ExecuteScalarExpression(filter_, input, ctx_->exec_context()); +} + +Result JoinResidualFilter::MaterializeFilterInput( + const ExecBatch& keypayload_batch, int num_batch_rows, const uint16_t* batch_row_ids, + const uint32_t* key_ids_maybe_null, const uint32_t* payload_ids_maybe_null) const { + ExecBatch out; + out.length = num_batch_rows; + out.values.resize(probe_filter_to_key_and_payload_.size() + num_build_keys_referred_ + + num_build_payloads_referred_); + + if (probe_filter_to_key_and_payload_.size() > 0) { + ExecBatchBuilder probe_batch_builder; + RETURN_NOT_OK(probe_batch_builder.AppendSelected( + pool_, keypayload_batch, num_batch_rows, batch_row_ids, + static_cast(probe_filter_to_key_and_payload_.size()), + probe_filter_to_key_and_payload_.data())); + ExecBatch probe_batch = probe_batch_builder.Flush(); + ARROW_DCHECK(probe_batch.values.size() == probe_filter_to_key_and_payload_.size()); + for (size_t i = 0; i < probe_batch.values.size(); ++i) { + out.values[i] = std::move(probe_batch.values[i]); + } + } + + if (num_build_keys_referred_ > 0 || num_build_payloads_referred_ > 0) { + ARROW_DCHECK(num_build_keys_referred_ == 0 || key_ids_maybe_null); + ARROW_DCHECK(num_build_payloads_referred_ == 0 || payload_ids_maybe_null); + + int num_build_cols = build_schemas_->num_cols(HashJoinProjection::FILTER); + auto to_key = + build_schemas_->map(HashJoinProjection::FILTER, HashJoinProjection::KEY); + auto to_payload = + build_schemas_->map(HashJoinProjection::FILTER, HashJoinProjection::PAYLOAD); + for (int i = 0; i < num_build_cols; ++i) { + ResizableArrayData column_data; + column_data.Init(build_schemas_->data_type(HashJoinProjection::FILTER, i), pool_, + bit_util::Log2(num_batch_rows)); + if (auto idx = to_key.get(i); idx != SchemaProjectionMap::kMissingField) { + RETURN_NOT_OK(build_keys_->DecodeSelected(&column_data, idx, num_batch_rows, + key_ids_maybe_null, pool_)); + } else if (idx = to_payload.get(i); idx != SchemaProjectionMap::kMissingField) { + RETURN_NOT_OK(build_payloads_->DecodeSelected(&column_data, idx, num_batch_rows, + payload_ids_maybe_null, pool_)); + } else { + ARROW_DCHECK(false); + } + out.values[probe_filter_to_key_and_payload_.size() + i] = column_data.array_data(); + } + } + + return out; +} + void JoinProbeProcessor::Init(int num_key_columns, JoinType join_type, SwissTableForJoin* hash_table, + JoinResidualFilter* residual_filter, std::vector materialize, const std::vector* cmp, OutputBatchFn output_batch_fn) { num_key_columns_ = num_key_columns; join_type_ = join_type; hash_table_ = hash_table; + residual_filter_ = residual_filter; materialize_.resize(materialize.size()); for (size_t i = 0; i < materialize.size(); ++i) { materialize_[i] = materialize[i]; @@ -1875,6 +2286,7 @@ Status JoinProbeProcessor::OnNextBatch(int64_t thread_id, const ExecBatch& keypayload_batch, arrow::util::TempVectorStack* temp_stack, std::vector* temp_column_arrays) { + bool no_duplicate_keys = (hash_table_->key_to_payload() == nullptr); const SwissTable* swiss_table = hash_table_->keys()->swiss_table(); int64_t hardware_flags = swiss_table->hardware_flags(); int minibatch_size = swiss_table->minibatch_size(); @@ -1900,6 +2312,8 @@ Status JoinProbeProcessor::OnNextBatch(int64_t thread_id, arrow::util::TempVectorHolder(temp_stack, minibatch_size); auto materialize_payload_ids_buf = arrow::util::TempVectorHolder(temp_stack, minibatch_size); + auto filter_bitvector_buf = arrow::util::TempVectorHolder( + temp_stack, static_cast(bit_util::BytesForBits(minibatch_size))); for (int minibatch_start = 0; minibatch_start < num_rows;) { uint32_t minibatch_size_next = std::min(minibatch_size, num_rows - minibatch_start); @@ -1923,33 +2337,29 @@ Status JoinProbeProcessor::OnNextBatch(int64_t thread_id, if (join_type_ == JoinType::LEFT_SEMI || join_type_ == JoinType::LEFT_ANTI || join_type_ == JoinType::RIGHT_SEMI || join_type_ == JoinType::RIGHT_ANTI) { int num_passing_ids = 0; - arrow::util::bit_util::bits_to_indexes( - (join_type_ == JoinType::LEFT_ANTI) ? 0 : 1, hardware_flags, - minibatch_size_next, match_bitvector_buf.mutable_data(), &num_passing_ids, - materialize_batch_ids_buf.mutable_data()); - - // For right-semi, right-anti joins: update has-match flags for the rows - // in hash table. - // - if (join_type_ == JoinType::RIGHT_SEMI || join_type_ == JoinType::RIGHT_ANTI) { - for (int i = 0; i < num_passing_ids; ++i) { - uint16_t id = materialize_batch_ids_buf.mutable_data()[i]; - key_ids_buf.mutable_data()[i] = key_ids_buf.mutable_data()[id]; - } - hash_table_->UpdateHasMatchForKeys(thread_id, num_passing_ids, - key_ids_buf.mutable_data()); + if (join_type_ == JoinType::LEFT_SEMI) { + RETURN_NOT_OK(residual_filter_->FilterLeftSemi( + keypayload_batch, minibatch_start, minibatch_size_next, + match_bitvector_buf.mutable_data(), key_ids_buf.mutable_data(), + no_duplicate_keys, temp_stack, &num_passing_ids, + materialize_batch_ids_buf.mutable_data())); + } else if (join_type_ == JoinType::LEFT_ANTI) { + RETURN_NOT_OK(residual_filter_->FilterLeftAnti( + keypayload_batch, minibatch_start, minibatch_size_next, + match_bitvector_buf.mutable_data(), key_ids_buf.mutable_data(), + no_duplicate_keys, temp_stack, &num_passing_ids, + materialize_batch_ids_buf.mutable_data())); } else { - // For left-semi, left-anti joins: call materialize using match - // bit-vector. - // + RETURN_NOT_OK(residual_filter_->FilterRightSemiAnti( + thread_id, keypayload_batch, minibatch_start, minibatch_size_next, + match_bitvector_buf.mutable_data(), key_ids_buf.mutable_data(), + no_duplicate_keys, temp_stack)); + } - // Add base batch row index. + if (join_type_ == JoinType::LEFT_SEMI || join_type_ == JoinType::LEFT_ANTI) { + // For left-semi, left-anti joins: call materialize using match + // row ids. // - for (int i = 0; i < num_passing_ids; ++i) { - materialize_batch_ids_buf.mutable_data()[i] += - static_cast(minibatch_start); - } - RETURN_NOT_OK(materialize_[thread_id]->AppendProbeOnly( keypayload_batch, num_passing_ids, materialize_batch_ids_buf.mutable_data(), [&](ExecBatch batch) { @@ -1961,30 +2371,46 @@ Status JoinProbeProcessor::OnNextBatch(int64_t thread_id, // Since every hash table lookup for an input row might have multiple // matches we use a helper class that implements enumerating all of them. // - bool no_duplicate_keys = (hash_table_->key_to_payload() == nullptr); - bool no_payload_columns = (hash_table_->payloads() == nullptr); JoinMatchIterator match_iterator; match_iterator.SetLookupResult( minibatch_size_next, minibatch_start, match_bitvector_buf.mutable_data(), key_ids_buf.mutable_data(), no_duplicate_keys, hash_table_->key_to_payload()); int num_matches_next; + bool use_filter_bitvector = residual_filter_->NeedFilterBitVector(join_type_); + if (use_filter_bitvector) { + residual_filter_->InitFilterBitVector(minibatch_size_next, + filter_bitvector_buf.mutable_data()); + } while (match_iterator.GetNextBatch(minibatch_size, &num_matches_next, materialize_batch_ids_buf.mutable_data(), materialize_key_ids_buf.mutable_data(), materialize_payload_ids_buf.mutable_data())) { + RETURN_NOT_OK(residual_filter_->FilterInner( + keypayload_batch, num_matches_next, materialize_batch_ids_buf.mutable_data(), + materialize_key_ids_buf.mutable_data(), + materialize_payload_ids_buf.mutable_data(), !no_duplicate_keys, temp_stack, + &num_matches_next)); + const uint16_t* materialize_batch_ids = materialize_batch_ids_buf.mutable_data(); const uint32_t* materialize_key_ids = materialize_key_ids_buf.mutable_data(); const uint32_t* materialize_payload_ids = - no_duplicate_keys || no_payload_columns - ? materialize_key_ids_buf.mutable_data() - : materialize_payload_ids_buf.mutable_data(); + no_duplicate_keys ? materialize_key_ids_buf.mutable_data() + : materialize_payload_ids_buf.mutable_data(); + + // For filtered result, update filter bit-vector. + // + if (use_filter_bitvector) { + residual_filter_->UpdateFilterBitVector(minibatch_start, num_matches_next, + materialize_batch_ids, + filter_bitvector_buf.mutable_data()); + } // For right-outer, full-outer joins we need to update has-match flags // for the rows in hash table. // if (join_type_ == JoinType::RIGHT_OUTER || join_type_ == JoinType::FULL_OUTER) { - hash_table_->UpdateHasMatchForKeys(thread_id, num_matches_next, - materialize_key_ids); + hash_table_->UpdateHasMatchForPayloads(thread_id, num_matches_next, + materialize_payload_ids); } // Call materialize for resulting id tuples pointing to matching pairs @@ -2004,17 +2430,11 @@ Status JoinProbeProcessor::OnNextBatch(int64_t thread_id, // if (join_type_ == JoinType::LEFT_OUTER || join_type_ == JoinType::FULL_OUTER) { int num_passing_ids = 0; - arrow::util::bit_util::bits_to_indexes( - /*bit_to_search=*/0, hardware_flags, minibatch_size_next, - match_bitvector_buf.mutable_data(), &num_passing_ids, - materialize_batch_ids_buf.mutable_data()); - - // Add base batch row index. - // - for (int i = 0; i < num_passing_ids; ++i) { - materialize_batch_ids_buf.mutable_data()[i] += - static_cast(minibatch_start); - } + CollectPassingBatchIds(0, hardware_flags, minibatch_start, minibatch_size_next, + use_filter_bitvector ? filter_bitvector_buf.mutable_data() + : match_bitvector_buf.mutable_data(), + &num_passing_ids, + materialize_batch_ids_buf.mutable_data()); RETURN_NOT_OK(materialize_[thread_id]->AppendProbeOnly( keypayload_batch, num_passing_ids, materialize_batch_ids_buf.mutable_data(), @@ -2099,8 +2519,12 @@ class SwissJoin : public HashJoinImpl { materialize[i] = &local_states_[i].materialize; } + residual_filter_.Init(std::move(filter), ctx_, pool_, hardware_flags_, proj_map_left, + proj_map_right, &hash_table_); + probe_processor_.Init(proj_map_left->num_cols(HashJoinProjection::KEY), join_type_, - &hash_table_, materialize, &key_cmp_, output_batch_callback_); + &hash_table_, &residual_filter_, materialize, &key_cmp_, + output_batch_callback_); InitTaskGroups(); @@ -2180,9 +2604,11 @@ class SwissJoin : public HashJoinImpl { // const HashJoinProjectionMaps* schema = schema_[1]; bool reject_duplicate_keys = - join_type_ == JoinType::LEFT_SEMI || join_type_ == JoinType::LEFT_ANTI; + (join_type_ == JoinType::LEFT_SEMI || join_type_ == JoinType::LEFT_ANTI) && + residual_filter_.NumBuildPayloadsReferred() == 0; bool no_payload = - reject_duplicate_keys || schema->num_cols(HashJoinProjection::PAYLOAD) == 0; + reject_duplicate_keys || (schema->num_cols(HashJoinProjection::PAYLOAD) == 0 && + residual_filter_.NumBuildPayloadsReferred() == 0); std::vector key_types; for (int i = 0; i < schema->num_cols(HashJoinProjection::KEY); ++i) { @@ -2302,6 +2728,8 @@ class SwissJoin : public HashJoinImpl { } hash_table_ready_.store(true); + residual_filter_.OnBuildFinished(); + return build_finished_callback_(thread_id); } @@ -2364,24 +2792,25 @@ class SwissJoin : public HashJoinImpl { static_cast(mini_batch_start + mini_batch_size_next - 1)); int num_output_rows = 0; for (uint32_t key_id = first_key_id; key_id <= last_key_id; ++key_id) { - if (bit_util::GetBit(hash_table_.has_match(), key_id) == bit_to_output) { - uint32_t first_payload_for_key = - std::max(static_cast(mini_batch_start), - hash_table_.key_to_payload() ? hash_table_.key_to_payload()[key_id] - : key_id); - uint32_t last_payload_for_key = std::min( - static_cast(mini_batch_start + mini_batch_size_next - 1), - hash_table_.key_to_payload() ? hash_table_.key_to_payload()[key_id + 1] - 1 - : key_id); - uint32_t num_payloads_for_key = - last_payload_for_key - first_payload_for_key + 1; - for (uint32_t i = 0; i < num_payloads_for_key; ++i) { - key_ids_buf.mutable_data()[num_output_rows + i] = key_id; - payload_ids_buf.mutable_data()[num_output_rows + i] = - first_payload_for_key + i; + uint32_t first_payload_for_key = std::max( + static_cast(mini_batch_start), + hash_table_.key_to_payload() ? hash_table_.key_to_payload()[key_id] : key_id); + uint32_t last_payload_for_key = std::min( + static_cast(mini_batch_start + mini_batch_size_next - 1), + hash_table_.key_to_payload() ? hash_table_.key_to_payload()[key_id + 1] - 1 + : key_id); + uint32_t num_payloads_for_key = last_payload_for_key - first_payload_for_key + 1; + uint32_t num_payloads_match = 0; + for (uint32_t i = 0; i < num_payloads_for_key; ++i) { + uint32_t payload = first_payload_for_key + i; + if (bit_util::GetBit(hash_table_.has_match(), payload) == bit_to_output) { + key_ids_buf.mutable_data()[num_output_rows + num_payloads_match] = key_id; + payload_ids_buf.mutable_data()[num_output_rows + num_payloads_match] = + payload; + num_payloads_match++; } - num_output_rows += num_payloads_for_key; } + num_output_rows += num_payloads_match; } if (num_output_rows > 0) { @@ -2524,6 +2953,7 @@ class SwissJoin : public HashJoinImpl { SwissTableForJoin hash_table_; JoinProbeProcessor probe_processor_; + JoinResidualFilter residual_filter_; SwissTableForJoinBuild hash_table_build_; AccumulationQueue build_side_batches_; diff --git a/cpp/src/arrow/acero/swiss_join_internal.h b/cpp/src/arrow/acero/swiss_join_internal.h index 6403b7a655e96..aa36a61109274 100644 --- a/cpp/src/arrow/acero/swiss_join_internal.h +++ b/cpp/src/arrow/acero/swiss_join_internal.h @@ -367,7 +367,13 @@ class SwissTableForJoin { friend class SwissTableForJoinBuild; public: + // Update all payloads corresponding to the given keys as having a match. + // void UpdateHasMatchForKeys(int64_t thread_id, int num_rows, const uint32_t* key_ids); + // Update the given payloads as having a match. + // + void UpdateHasMatchForPayloads(int64_t thread_id, int num_rows, + const uint32_t* payload_ids); void MergeHasMatch(); const SwissTableWithKeys* keys() const { return &map_; } @@ -385,10 +391,6 @@ class SwissTableForJoin { } uint32_t payload_id_to_key_id(uint32_t payload_id) const; - // Input payload ids must form an increasing sequence. - // - void payload_ids_to_key_ids(int num_rows, const uint32_t* payload_ids, - uint32_t* key_ids) const; private: uint8_t* local_has_match(int64_t thread_id); @@ -397,8 +399,10 @@ class SwissTableForJoin { int dop_; struct ThreadLocalState { + // Bit-vector for keeping track of whether each payload in the hash table had a match. std::vector has_match; }; + // Bit-vector for keeping track of whether each payload in the hash table had a match. std::vector local_states_; std::vector has_match_; @@ -714,8 +718,20 @@ class JoinMatchIterator { void SetLookupResult(int num_batch_rows, int start_batch_row, const uint8_t* batch_has_match, const uint32_t* key_ids, bool no_duplicate_keys, const uint32_t* key_to_payload); + // Get the next batch of matching rows by outputting the batch row ids, key ids and + // payload ids. If the row_id_to_skip is not kInvalidRowId, then the row with that id + // will be skipped. This is useful for left-anti and left-semi joins, where we can + // safely skip the subsequent matchings of the row that already has a match in the + // previous batch. + // bool GetNextBatch(int num_rows_max, int* out_num_rows, uint16_t* batch_row_ids, - uint32_t* key_ids, uint32_t* payload_ids); + uint32_t* key_ids, uint32_t* payload_ids, + int row_id_to_skip = kInvalidRowId); + + // The row id that will never exist in an ExecBatch. Used to indicate that there is no + // row to skip. + // + static constexpr uint32_t kInvalidRowId = std::numeric_limits::max() + 1; private: int num_batch_rows_; @@ -736,6 +752,135 @@ class JoinMatchIterator { int current_match_for_row_; }; +// Implement the residual filter support used when processing the probe side exec batches. +// There are four filtering patterns, each with a corresponding public FilterXXX method: +// - LeftSemi and LeftAnti, each for its co-naming join type, opposite to each other. +// - RightSemiAnti for both right-semi and right-anti joins: they have the same filtering +// logic and differ only in the scanning phase. +// - Inner for inner joins and the inner part of outer joins: caller should take care of +// filtering the outer part. +// All the public Filter* methods have zero-cost shortcut for trivial filter. +// +class JoinResidualFilter { + public: + void Init(Expression filter, QueryContext* ctx, MemoryPool* pool, + int64_t hardware_flags, const HashJoinProjectionMaps* probe_schemas, + const HashJoinProjectionMaps* build_schemas, SwissTableForJoin* hash_table); + + void OnBuildFinished(); + + int NumBuildKeysReferred() const { return num_build_keys_referred_; } + int NumBuildPayloadsReferred() const { return num_build_payloads_referred_; } + + // Left-outer and full-outer joins can result in a different bit-vector than the one of + // probing the hash table if the residual filter is not a literal true. If so, caller + // should setup a bit-vector for filtering properly and call `UpdateFilterBitVector` + // accordingly. + // + bool NeedFilterBitVector(JoinType join_type) const { + return (join_type == JoinType::LEFT_OUTER || join_type == JoinType::FULL_OUTER) && + filter_ != literal(true); + } + + // Init the bit-vector for filtering. Caller should make sure the bit-vector has enough + // size for a particular probe side batch. + // + void InitFilterBitVector(int num_batch_rows, uint8_t* filter_bitvector); + + // Update the bit-vector for filtering according to the given batch row ids. + // + void UpdateFilterBitVector(int batch_start_row, int num_batch_rows, + const uint16_t* batch_row_ids, uint8_t* filter_bitvector); + + // Left row is passing if filter evaluates true. Output all the passing row ids in + // the input batch. Like the left-semi join semantic, each passing row is output only + // once. + // Zero-overhead shortcut guarantee for trivial filter. + // + Status FilterLeftSemi(const ExecBatch& keypayload_batch, int batch_start_row, + int num_batch_rows, const uint8_t* match_bitvector, + const uint32_t* key_ids, bool no_duplicate_keys, + arrow::util::TempVectorStack* temp_stack, int* num_passing_ids, + uint16_t* passing_batch_row_ids) const; + + // Logically the opposite of FilterLeftSemi. Output all the passing row ids in the input + // batch. Like the left-anti join semantic, each passing row is output only once. + // Zero-overhead shortcut guarantee for trivial filter. + // + Status FilterLeftAnti(const ExecBatch& keypayload_batch, int batch_start_row, + int num_batch_rows, const uint8_t* match_bitvector, + const uint32_t* key_ids, bool no_duplicate_keys, + arrow::util::TempVectorStack* temp_stack, int* num_passing_ids, + uint16_t* passing_batch_row_ids) const; + + // Right row is passing if filter evaluates true. Mark a match for all the passing + // payload ids in the hash table. This applies for both right-semi and right-anti joins: + // they differ in scanning phase. + // Zero-overhead shortcut guarantee for trivial filter. + // + Status FilterRightSemiAnti(int64_t thread_id, const ExecBatch& keypayload_batch, + int batch_start_row, int num_batch_rows, + const uint8_t* match_bitvector, const uint32_t* key_ids, + bool no_duplicate_keys, + arrow::util::TempVectorStack* temp_stack) const; + + // For a given batch of an inner match (an inner-join or the inner part of an + // outer-join), row is passing if filter evaluates true. Does not do any outer filtering + // because this method is usually called within a inner match loop, which doesn't have + // the full scope of outer join. This requires caller to handle the outer part properly. + // All batch_row_ids, key_ids and payload_ids_maybe_null are input and output, this is + // for efficient shortcut. + // Zero-overhead shortcut guarantee for trivial filter. + // + Status FilterInner(const ExecBatch& keypayload_batch, int num_batch_rows, + uint16_t* batch_row_ids, uint32_t* key_ids, + uint32_t* payload_ids_maybe_null, bool output_payload_ids, + arrow::util::TempVectorStack* temp_stack, + int* num_passing_rows) const; + + private: + // Evaluates the filter for a given batch of matching rows, and outputs the passing + // rows. Always introduces overhead of materialization and evaluation, so caller must do + // shortcut properly for trivial filters. + // + Status FilterOneBatch(const ExecBatch& keypayload_batch, int num_batch_rows, + uint16_t* batch_row_ids, uint32_t* key_ids_maybe_null, + uint32_t* payload_ids_maybe_null, bool output_key_ids, + bool output_payload_ids, arrow::util::TempVectorStack* temp_stack, + int* num_passing_rows) const; + + Result EvalFilter(const ExecBatch& keypayload_batch, int num_batch_rows, + const uint16_t* batch_row_ids, + const uint32_t* key_ids_maybe_null, + const uint32_t* payload_ids_maybe_null) const; + + Result MaterializeFilterInput(const ExecBatch& keypayload_batch, + int num_batch_rows, + const uint16_t* batch_row_ids, + const uint32_t* key_ids_maybe_null, + const uint32_t* payload_ids_maybe_null) const; + + private: + Expression filter_; + + QueryContext* ctx_; + MemoryPool* pool_; + int64_t hardware_flags_; + + const HashJoinProjectionMaps* probe_schemas_; + const HashJoinProjectionMaps* build_schemas_; + + SwissTableForJoin* hash_table_; + std::vector probe_filter_to_key_and_payload_; + int num_build_keys_referred_ = 0; + int num_build_payloads_referred_ = 0; + + int minibatch_size_; + const RowArray* build_keys_; + const RowArray* build_payloads_; + const uint32_t* key_to_payload_; +}; + // Implements entire processing of a probe side exec batch, // provided the join hash table is already built and available. // @@ -744,6 +889,7 @@ class JoinProbeProcessor { using OutputBatchFn = std::function; void Init(int num_key_columns, JoinType join_type, SwissTableForJoin* hash_table, + JoinResidualFilter* residual_filter, std::vector materialize, const std::vector* cmp, OutputBatchFn output_batch_fn); Status OnNextBatch(int64_t thread_id, const ExecBatch& keypayload_batch, @@ -760,6 +906,7 @@ class JoinProbeProcessor { JoinType join_type_; SwissTableForJoin* hash_table_; + JoinResidualFilter* residual_filter_; // One element per thread // std::vector materialize_; From 60dbaab71c60bbc88404446f4965de7fcff8d272 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Wed, 13 Mar 2024 13:34:17 +0900 Subject: [PATCH 27/30] GH-40394: [C++] Add support for mold (#40397) ### Rationale for this change mold is a faster linker. It will reduce build time. mold supports only ELF. So it's available on only Linux and *BSD. ### What changes are included in this PR? Add new `ARROW_USE_MOLD` CMake option. It's `OFF` by default because it doesn't work with conda. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #40394 Authored-by: Sutou Kouhei Signed-off-by: Jacob Wujciak-Jens --- ci/docker/ubuntu-22.04-cpp.dockerfile | 2 ++ ci/docker/ubuntu-24.04-cpp.dockerfile | 2 ++ ci/scripts/cpp_build.sh | 1 + cpp/cmake_modules/DefineOptions.cmake | 13 +++++++++ cpp/cmake_modules/SetupCxxFlags.cmake | 27 +++++++++++++++++++ cpp/src/arrow/symbols.map | 3 +-- .../apt/debian-bookworm/Dockerfile | 1 + .../apache-arrow/apt/debian-trixie/Dockerfile | 1 + .../apache-arrow/apt/ubuntu-jammy/Dockerfile | 1 + .../apache-arrow/apt/ubuntu-noble/Dockerfile | 1 + .../linux-packages/apache-arrow/debian/rules | 1 + 11 files changed, 51 insertions(+), 2 deletions(-) diff --git a/ci/docker/ubuntu-22.04-cpp.dockerfile b/ci/docker/ubuntu-22.04-cpp.dockerfile index 848f62ab8aef8..e8416c1378a9a 100644 --- a/ci/docker/ubuntu-22.04-cpp.dockerfile +++ b/ci/docker/ubuntu-22.04-cpp.dockerfile @@ -102,6 +102,7 @@ RUN apt-get update -y -q && \ libxml2-dev \ libzstd-dev \ make \ + mold \ ninja-build \ nlohmann-json3-dev \ npm \ @@ -188,6 +189,7 @@ ENV absl_SOURCE=BUNDLED \ ARROW_SUBSTRAIT=ON \ ARROW_USE_ASAN=OFF \ ARROW_USE_CCACHE=ON \ + ARROW_USE_MOLD=ON \ ARROW_USE_UBSAN=OFF \ ARROW_WITH_BROTLI=ON \ ARROW_WITH_BZ2=ON \ diff --git a/ci/docker/ubuntu-24.04-cpp.dockerfile b/ci/docker/ubuntu-24.04-cpp.dockerfile index d56895a792f7c..629d532a3dc76 100644 --- a/ci/docker/ubuntu-24.04-cpp.dockerfile +++ b/ci/docker/ubuntu-24.04-cpp.dockerfile @@ -102,6 +102,7 @@ RUN apt-get update -y -q && \ libxml2-dev \ libzstd-dev \ make \ + mold \ ninja-build \ nlohmann-json3-dev \ npm \ @@ -184,6 +185,7 @@ ENV ARROW_ACERO=ON \ ARROW_SUBSTRAIT=ON \ ARROW_USE_ASAN=OFF \ ARROW_USE_CCACHE=ON \ + ARROW_USE_MOLD=ON \ ARROW_USE_UBSAN=OFF \ ARROW_WITH_BROTLI=ON \ ARROW_WITH_BZ2=ON \ diff --git a/ci/scripts/cpp_build.sh b/ci/scripts/cpp_build.sh index 60cab1a9feaba..1e09924a5e576 100755 --- a/ci/scripts/cpp_build.sh +++ b/ci/scripts/cpp_build.sh @@ -147,6 +147,7 @@ cmake \ -DARROW_USE_CCACHE=${ARROW_USE_CCACHE:-ON} \ -DARROW_USE_GLOG=${ARROW_USE_GLOG:-OFF} \ -DARROW_USE_LD_GOLD=${ARROW_USE_LD_GOLD:-OFF} \ + -DARROW_USE_MOLD=${ARROW_USE_MOLD:-OFF} \ -DARROW_USE_PRECOMPILED_HEADERS=${ARROW_USE_PRECOMPILED_HEADERS:-OFF} \ -DARROW_USE_STATIC_CRT=${ARROW_USE_STATIC_CRT:-OFF} \ -DARROW_USE_TSAN=${ARROW_USE_TSAN:-OFF} \ diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake index cce21b6bdba24..5b8bcb3ac6965 100644 --- a/cpp/cmake_modules/DefineOptions.cmake +++ b/cpp/cmake_modules/DefineOptions.cmake @@ -110,6 +110,17 @@ macro(resolve_option_dependencies) if(MSVC_TOOLCHAIN) set(ARROW_USE_GLOG OFF) endif() + # Tests are crashed with mold + sanitizer checks. + if(ARROW_USE_ASAN + OR ARROW_USE_TSAN + OR ARROW_USE_UBSAN) + if(ARROW_USE_MOLD) + message(WARNING "ARROW_USE_MOLD is disabled when one of " + "ARROW_USE_ASAN, ARROW_USE_TSAN or ARROW_USE_UBSAN is specified " + "because it causes some problems.") + set(ARROW_USE_MOLD OFF) + endif() + endif() tsort_bool_option_dependencies() foreach(option_name ${ARROW_BOOL_OPTION_DEPENDENCIES_TSORTED}) @@ -159,6 +170,8 @@ takes precedence over ccache if a storage backend is configured" ON) define_option(ARROW_USE_LD_GOLD "Use ld.gold for linking on Linux (if available)" OFF) + define_option(ARROW_USE_MOLD "Use mold for linking on Linux (if available)" OFF) + define_option(ARROW_USE_PRECOMPILED_HEADERS "Use precompiled headers when compiling" OFF) diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake index 6940c6befacc7..5ef27dd5fd02a 100644 --- a/cpp/cmake_modules/SetupCxxFlags.cmake +++ b/cpp/cmake_modules/SetupCxxFlags.cmake @@ -625,6 +625,33 @@ if(NOT WIN32 AND NOT APPLE) endif() endif() +if(NOT WIN32 AND NOT APPLE) + if(ARROW_USE_MOLD) + find_program(LD_MOLD ld.mold) + if(LD_MOLD) + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.1.0") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=mold") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=mold") + message(STATUS "Using optional mold linker") + else() + message(STATUS "Need GCC 12.1.0 or later to use mold linker: ${CMAKE_CXX_COMPILER_VERSION}" + ) + endif() + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --ld-path=${LD_MOLD}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --ld-path=${LD_MOLD}") + message(STATUS "Using optional mold linker") + else() + message(STATUS "Using the default linker because compiler doesn't support mold: ${CMAKE_CXX_COMPILER_ID}" + ) + endif() + else() + message(STATUS "Using the default linker because mold isn't found") + endif() + endif() +endif() + # compiler flags for different build types (run 'cmake -DCMAKE_BUILD_TYPE= .') # For all builds: # For CMAKE_BUILD_TYPE=Debug diff --git a/cpp/src/arrow/symbols.map b/cpp/src/arrow/symbols.map index 0144e6116554b..d3c38c22c9070 100644 --- a/cpp/src/arrow/symbols.map +++ b/cpp/src/arrow/symbols.map @@ -34,8 +34,7 @@ arrow_*; Arrow*; # ARROW-14771: export Protobuf symbol table - descriptor_table_Flight_2eproto; - descriptor_table_FlightSql_2eproto; + descriptor_table_Flight*_2eproto; # Symbols marked as 'local' are not exported by the DSO and thus may not # be used by client applications. Everything except the above falls here. diff --git a/dev/tasks/linux-packages/apache-arrow/apt/debian-bookworm/Dockerfile b/dev/tasks/linux-packages/apache-arrow/apt/debian-bookworm/Dockerfile index f7aa57848bd36..b38ee72d68c75 100644 --- a/dev/tasks/linux-packages/apache-arrow/apt/debian-bookworm/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/apt/debian-bookworm/Dockerfile @@ -69,6 +69,7 @@ RUN \ llvm-dev \ lsb-release \ meson \ + mold \ ninja-build \ nlohmann-json3-dev \ pkg-config \ diff --git a/dev/tasks/linux-packages/apache-arrow/apt/debian-trixie/Dockerfile b/dev/tasks/linux-packages/apache-arrow/apt/debian-trixie/Dockerfile index 8a6accbfc8b16..3126c6d3cded0 100644 --- a/dev/tasks/linux-packages/apache-arrow/apt/debian-trixie/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/apt/debian-trixie/Dockerfile @@ -70,6 +70,7 @@ RUN \ llvm-dev \ lsb-release \ meson \ + mold \ ninja-build \ nlohmann-json3-dev \ pkg-config \ diff --git a/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-jammy/Dockerfile b/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-jammy/Dockerfile index ad3db51252f87..e6718e59b0aba 100644 --- a/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-jammy/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-jammy/Dockerfile @@ -62,6 +62,7 @@ RUN \ llvm-dev \ lsb-release \ meson \ + mold \ ninja-build \ nlohmann-json3-dev \ pkg-config \ diff --git a/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-noble/Dockerfile b/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-noble/Dockerfile index 386be00c37ed7..87ea2402456b0 100644 --- a/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-noble/Dockerfile +++ b/dev/tasks/linux-packages/apache-arrow/apt/ubuntu-noble/Dockerfile @@ -64,6 +64,7 @@ RUN \ llvm-dev \ lsb-release \ meson \ + mold \ mlir-15-tools \ ninja-build \ nlohmann-json3-dev \ diff --git a/dev/tasks/linux-packages/apache-arrow/debian/rules b/dev/tasks/linux-packages/apache-arrow/debian/rules index 36c43cf0d5968..83bcad98a7a6e 100755 --- a/dev/tasks/linux-packages/apache-arrow/debian/rules +++ b/dev/tasks/linux-packages/apache-arrow/debian/rules @@ -42,6 +42,7 @@ override_dh_auto_configure: -DARROW_PARQUET=ON \ -DARROW_S3=ON \ -DARROW_USE_CCACHE=OFF \ + -DARROW_USE_MOLD=ON \ -DARROW_WITH_BROTLI=ON \ -DARROW_WITH_BZ2=ON \ -DARROW_WITH_LZ4=ON \ From 7ee25f1616bfb73bd2d76a832a89303492ab302d Mon Sep 17 00:00:00 2001 From: Hyunseok Seo Date: Wed, 13 Mar 2024 16:20:52 +0900 Subject: [PATCH 28/30] GH-39669: [C++][Gandiva] Ensure Gandiva benchmarks present a bytes/s or items/s metric (#40435) ### Rationale for this change The Gandiva microbenchmarks only present an iteration time in (nano,micro...)seconds. That is usually tedious to read and difficult to interpret. ### What changes are included in this PR? Ensure that Gandiva benchmarks present an items/seconds and/or a bytes/seconds metric where that makes sense. ### Are these changes tested? Manually ### Are there any user-facing changes? No * GitHub Issue: #39669 Authored-by: Hyunseok Seo Signed-off-by: Sutou Kouhei --- cpp/src/gandiva/tests/timed_evaluate.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cpp/src/gandiva/tests/timed_evaluate.h b/cpp/src/gandiva/tests/timed_evaluate.h index eba0f5eb96388..63087f33cfbce 100644 --- a/cpp/src/gandiva/tests/timed_evaluate.h +++ b/cpp/src/gandiva/tests/timed_evaluate.h @@ -90,12 +90,15 @@ Status TimedEvaluate(SchemaPtr schema, BaseEvaluator& evaluator, int num_fields = schema->num_fields(); int num_calls = 0; Status status; + int64_t total_bytes_processed = 0; + int64_t total_items_processed = 0; // Generate batches of data std::shared_ptr batches[NUM_BATCHES]; for (int i = 0; i < NUM_BATCHES; i++) { // generate data for all columns in the schema std::vector columns; + int64_t batch_bytes = 0; for (int col = 0; col < num_fields; col++) { std::vector data = GenerateData(batch_size, data_generator); std::vector validity(batch_size, true); @@ -103,12 +106,14 @@ Status TimedEvaluate(SchemaPtr schema, BaseEvaluator& evaluator, MakeArrowArray(schema->field(col)->type(), data, validity); columns.push_back(col_data); + batch_bytes += data.size() * sizeof(C_TYPE); } // make the record batch std::shared_ptr batch = arrow::RecordBatch::Make(schema, batch_size, columns); batches[i] = batch; + total_bytes_processed += batch_bytes; } for (auto _ : state) { @@ -127,9 +132,13 @@ Status TimedEvaluate(SchemaPtr schema, BaseEvaluator& evaluator, num_calls++; num_remaining -= num_in_batch; + total_items_processed += num_in_batch; } } + state.SetBytesProcessed(total_bytes_processed); + state.SetItemsProcessed(total_items_processed); + return Status::OK(); } From acdf2a7f68409446e42ff37cc8ebbd68736756d0 Mon Sep 17 00:00:00 2001 From: Dane Pitkin <48041712+danepitkin@users.noreply.github.com> Date: Wed, 13 Mar 2024 03:23:50 -0400 Subject: [PATCH 29/30] GH-40312: [Python] Add ListView documentation to user guide (#40313) ### Rationale for this change Add documentation of the new ListView array type. ### What changes are included in this PR? * Update the PyArrow data types documentation page ### Are these changes tested? Yes, built docs locally and verified. ### Are there any user-facing changes? No, unless you count documentation updates as user-facing. * GitHub Issue: #40312 Authored-by: Dane Pitkin Signed-off-by: AlenkaF --- docs/source/python/data.rst | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/docs/source/python/data.rst b/docs/source/python/data.rst index 0ce2ddd698414..1c186d847392f 100644 --- a/docs/source/python/data.rst +++ b/docs/source/python/data.rst @@ -230,6 +230,28 @@ like lists: nested_arr = pa.array([[], None, [1, 2], [None, 1]]) print(nested_arr.type) +ListView arrays +~~~~~~~~~~~ + +``pyarrow.array`` can create an alternate list type called ListView: + +.. ipython:: python + + nested_arr = pa.array([[], None, [1, 2], [None, 1]], type=pa.list_view(pa.int64())) + print(nested_arr.type) + +ListView arrays have a different set of buffers than List arrays. The ListView array +has both an offsets and sizes buffer, while a List array only has an offsets buffer. +This allows for ListView arrays to specify out-of-order offsets: + +.. ipython:: python + + values = [1, 2, 3, 4, 5, 6] + offsets = [4, 2, 0] + sizes = [2, 2, 2] + arr = pa.ListViewArray.from_arrays(offsets, sizes, values) + arr + Struct arrays ~~~~~~~~~~~~~ @@ -240,7 +262,7 @@ dictionaries: pa.array([{'x': 1, 'y': True}, {'z': 3.4, 'x': 4}]) -Struct arrays can be initialized from a sequence of Python dicts or tuples. For tuples, +Struct arrays can be initialized from a sequence of Python dicts or tuples. For tuples, you must explicitly pass the type: .. ipython:: python @@ -282,10 +304,10 @@ the type is explicitly passed into :meth:`array`: ty = pa.map_(pa.string(), pa.int64()) pa.array(data, type=ty) -MapArrays can also be constructed from offset, key, and item arrays. Offsets represent the +MapArrays can also be constructed from offset, key, and item arrays. Offsets represent the starting position of each map. Note that the :attr:`MapArray.keys` and :attr:`MapArray.items` -properties give the *flattened* keys and items. To keep the keys and items associated to -their row, use the :meth:`ListArray.from_arrays` constructor with the +properties give the *flattened* keys and items. To keep the keys and items associated to +their row, use the :meth:`ListArray.from_arrays` constructor with the :attr:`MapArray.offsets` property. .. ipython:: python From a421314900c4fd38f238a944e506a28cdc322967 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Wed, 13 Mar 2024 08:55:59 +0100 Subject: [PATCH 30/30] GH-40376: [Python] Update for NumPy 2.0 ABI change in PyArray_Descr->elsize (#40418) ### Rationale for this change NumPy 2.0 is changing some ABI, see the issue description and https://github.com/numpy/numpy/pull/25946 for more details. The changes here should make our code compatible both with current numpy 1.x and future numpy 2.x * GitHub Issue: #40376 Lead-authored-by: Joris Van den Bossche Co-authored-by: Sebastian Berg Signed-off-by: Joris Van den Bossche --- .env | 2 +- python/CMakeLists.txt | 3 +++ .../src/arrow/python/arrow_to_pandas.cc | 10 +++++---- .../pyarrow/src/arrow/python/numpy_convert.cc | 6 +++--- .../pyarrow/src/arrow/python/numpy_interop.h | 7 +++++++ .../src/arrow/python/numpy_to_arrow.cc | 21 +++++++++++-------- 6 files changed, 32 insertions(+), 17 deletions(-) diff --git a/.env b/.env index 00c238421d301..afed658db198f 100644 --- a/.env +++ b/.env @@ -98,7 +98,7 @@ VCPKG="a42af01b72c28a8e1d7b48107b33e4f286a55ef6" # 2023.11.20 Release # ci/docker/python-wheel-windows-vs2019.dockerfile. # This is a workaround for our CI problem that "archery docker build" doesn't # use pulled built images in dev/tasks/python-wheels/github.windows.yml. -PYTHON_WHEEL_WINDOWS_IMAGE_REVISION=2024-02-05 +PYTHON_WHEEL_WINDOWS_IMAGE_REVISION=2024-03-12 # Use conanio/${CONAN} for "docker-compose run --rm conan". See # https://github.com/conan-io/conan-docker-tools#readme for available diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index c3a1c578689c8..8c98e269d6ff4 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -260,6 +260,9 @@ set(EXECUTABLE_OUTPUT_PATH "${BUILD_OUTPUT_ROOT_DIRECTORY}") # Python and Numpy libraries find_package(Python3Alt REQUIRED) +message(STATUS "Found NumPy version: ${Python3_NumPy_VERSION}") +message(STATUS "NumPy include dir: ${NUMPY_INCLUDE_DIRS}") + include(UseCython) # PyArrow C++ diff --git a/python/pyarrow/src/arrow/python/arrow_to_pandas.cc b/python/pyarrow/src/arrow/python/arrow_to_pandas.cc index cb9cbe5b930e7..023ba5585e704 100644 --- a/python/pyarrow/src/arrow/python/arrow_to_pandas.cc +++ b/python/pyarrow/src/arrow/python/arrow_to_pandas.cc @@ -255,7 +255,8 @@ Status SetBufferBase(PyArrayObject* arr, const std::shared_ptr& buffer) } inline void set_numpy_metadata(int type, const DataType* datatype, PyArray_Descr* out) { - auto metadata = reinterpret_cast(out->c_metadata); + auto metadata = + reinterpret_cast(PyDataType_C_METADATA(out)); if (type == NPY_DATETIME) { if (datatype->id() == Type::TIMESTAMP) { const auto& timestamp_type = checked_cast(*datatype); @@ -276,7 +277,7 @@ Status PyArray_NewFromPool(int nd, npy_intp* dims, PyArray_Descr* descr, MemoryP // // * Track allocations // * Get better performance through custom allocators - int64_t total_size = descr->elsize; + int64_t total_size = PyDataType_ELSIZE(descr); for (int i = 0; i < nd; ++i) { total_size *= dims[i]; } @@ -537,8 +538,9 @@ class PandasWriter { void SetDatetimeUnit(NPY_DATETIMEUNIT unit) { PyAcquireGIL lock; - auto date_dtype = reinterpret_cast( - PyArray_DESCR(reinterpret_cast(block_arr_.obj()))->c_metadata); + auto date_dtype = + reinterpret_cast(PyDataType_C_METADATA( + PyArray_DESCR(reinterpret_cast(block_arr_.obj())))); date_dtype->meta.base = unit; } diff --git a/python/pyarrow/src/arrow/python/numpy_convert.cc b/python/pyarrow/src/arrow/python/numpy_convert.cc index dfee88c092e65..5fd2cb511ff8a 100644 --- a/python/pyarrow/src/arrow/python/numpy_convert.cc +++ b/python/pyarrow/src/arrow/python/numpy_convert.cc @@ -46,7 +46,7 @@ NumPyBuffer::NumPyBuffer(PyObject* ao) : Buffer(nullptr, 0) { PyArrayObject* ndarray = reinterpret_cast(ao); auto ptr = reinterpret_cast(PyArray_DATA(ndarray)); data_ = const_cast(ptr); - size_ = PyArray_SIZE(ndarray) * PyArray_DESCR(ndarray)->elsize; + size_ = PyArray_NBYTES(ndarray); capacity_ = size_; is_mutable_ = !!(PyArray_FLAGS(ndarray) & NPY_ARRAY_WRITEABLE); } @@ -150,7 +150,7 @@ Result> NumPyDtypeToArrow(PyArray_Descr* descr) { TO_ARROW_TYPE_CASE(UNICODE, utf8); case NPY_DATETIME: { auto date_dtype = - reinterpret_cast(descr->c_metadata); + reinterpret_cast(PyDataType_C_METADATA(descr)); switch (date_dtype->meta.base) { case NPY_FR_s: return timestamp(TimeUnit::SECOND); @@ -170,7 +170,7 @@ Result> NumPyDtypeToArrow(PyArray_Descr* descr) { } break; case NPY_TIMEDELTA: { auto timedelta_dtype = - reinterpret_cast(descr->c_metadata); + reinterpret_cast(PyDataType_C_METADATA(descr)); switch (timedelta_dtype->meta.base) { case NPY_FR_s: return duration(TimeUnit::SECOND); diff --git a/python/pyarrow/src/arrow/python/numpy_interop.h b/python/pyarrow/src/arrow/python/numpy_interop.h index ce7baed259f91..7ea7d6e16f528 100644 --- a/python/pyarrow/src/arrow/python/numpy_interop.h +++ b/python/pyarrow/src/arrow/python/numpy_interop.h @@ -67,6 +67,13 @@ #define NPY_INT32_IS_INT 0 #endif +// Backported NumPy 2 API (can be removed if numpy 2 is required) +#if NPY_ABI_VERSION < 0x02000000 +#define PyDataType_ELSIZE(descr) ((descr)->elsize) +#define PyDataType_C_METADATA(descr) ((descr)->c_metadata) +#define PyDataType_FIELDS(descr) ((descr)->fields) +#endif + namespace arrow { namespace py { diff --git a/python/pyarrow/src/arrow/python/numpy_to_arrow.cc b/python/pyarrow/src/arrow/python/numpy_to_arrow.cc index 8903df31be826..460b1d0ce3fa6 100644 --- a/python/pyarrow/src/arrow/python/numpy_to_arrow.cc +++ b/python/pyarrow/src/arrow/python/numpy_to_arrow.cc @@ -196,7 +196,7 @@ class NumPyConverter { mask_ = reinterpret_cast(mo); } length_ = static_cast(PyArray_SIZE(arr_)); - itemsize_ = static_cast(PyArray_DESCR(arr_)->elsize); + itemsize_ = static_cast(PyArray_ITEMSIZE(arr_)); stride_ = static_cast(PyArray_STRIDES(arr_)[0]); } @@ -296,7 +296,7 @@ class NumPyConverter { PyArrayObject* mask_; int64_t length_; int64_t stride_; - int itemsize_; + int64_t itemsize_; bool from_pandas_; compute::CastOptions cast_options_; @@ -478,7 +478,8 @@ inline Status NumPyConverter::ConvertData(std::shared_ptr* d RETURN_NOT_OK(PrepareInputData(data)); - auto date_dtype = reinterpret_cast(dtype_->c_metadata); + auto date_dtype = + reinterpret_cast(PyDataType_C_METADATA(dtype_)); if (dtype_->type_num == NPY_DATETIME) { // If we have inbound datetime64[D] data, this needs to be downcasted // separately here from int64_t to int32_t, because this data is not @@ -514,7 +515,8 @@ inline Status NumPyConverter::ConvertData(std::shared_ptr* d RETURN_NOT_OK(PrepareInputData(data)); - auto date_dtype = reinterpret_cast(dtype_->c_metadata); + auto date_dtype = + reinterpret_cast(PyDataType_C_METADATA(dtype_)); if (dtype_->type_num == NPY_DATETIME) { // If we have inbound datetime64[D] data, this needs to be downcasted // separately here from int64_t to int32_t, because this data is not @@ -628,11 +630,11 @@ namespace { // NumPy unicode is UCS4/UTF32 always constexpr int kNumPyUnicodeSize = 4; -Status AppendUTF32(const char* data, int itemsize, int byteorder, +Status AppendUTF32(const char* data, int64_t itemsize, int byteorder, ::arrow::internal::ChunkedStringBuilder* builder) { // The binary \x00\x00\x00\x00 indicates a nul terminator in NumPy unicode, // so we need to detect that here to truncate if necessary. Yep. - int actual_length = 0; + Py_ssize_t actual_length = 0; for (; actual_length < itemsize / kNumPyUnicodeSize; ++actual_length) { const char* code_point = data + actual_length * kNumPyUnicodeSize; if ((*code_point == '\0') && (*(code_point + 1) == '\0') && @@ -705,7 +707,7 @@ Status NumPyConverter::Visit(const StringType& type) { auto AppendNonNullValue = [&](const uint8_t* data) { if (is_binary_type) { if (ARROW_PREDICT_TRUE(util::ValidateUTF8(data, itemsize_))) { - return builder.Append(data, itemsize_); + return builder.Append(data, static_cast(itemsize_)); } else { return Status::Invalid("Encountered non-UTF8 binary value: ", HexEncode(data, itemsize_)); @@ -750,12 +752,13 @@ Status NumPyConverter::Visit(const StructType& type) { PyAcquireGIL gil_lock; // Create converters for each struct type field - if (dtype_->fields == NULL || !PyDict_Check(dtype_->fields)) { + if (PyDataType_FIELDS(dtype_) == NULL || !PyDict_Check(PyDataType_FIELDS(dtype_))) { return Status::TypeError("Expected struct array"); } for (auto field : type.fields()) { - PyObject* tup = PyDict_GetItemString(dtype_->fields, field->name().c_str()); + PyObject* tup = + PyDict_GetItemString(PyDataType_FIELDS(dtype_), field->name().c_str()); if (tup == NULL) { return Status::Invalid("Missing field '", field->name(), "' in struct array"); }