Skip to content

Commit

Permalink
feat(glib): Add Apache Arrow GLib integration library
Browse files Browse the repository at this point in the history
Fixes #1280.

We can use
`GArrowRecordBatch`/`GArrowSchema`/`GArrowRecordBatchReader` instead
of C data API with this library.
  • Loading branch information
kou committed Jan 14, 2024
1 parent c92f7de commit 3409476
Show file tree
Hide file tree
Showing 33 changed files with 981 additions and 67 deletions.
55 changes: 55 additions & 0 deletions ci/linux-packages/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Build-Depends:
debhelper-compat (= 12),
gobject-introspection,
golang | golang-1.20,
libarrow-glib-dev,
libgirepository1.0-dev,
libpq-dev,
libsqlite3-dev,
Expand Down Expand Up @@ -197,3 +198,57 @@ Recommends:
Description: Apache Arrow Database Connectivity (ADBC) driver manager
.
This package provides documentations.

Package: libadbc-arrow-glib0
Section: libs
Architecture: any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends:
${misc:Depends},
${shlibs:Depends},
libadbc-glib0 (= ${binary:Version})
Description: Apache Arrow Database Connectivity (ADBC) driver manager
.
This package provides library files for Apache Arrow GLib integration.

Package: gir1.2-adbc-arrow-1.0
Section: introspection
Architecture: any
Multi-Arch: same
Depends:
${gir:Depends},
${misc:Depends},
gir1.2-adbc-1.0 (= ${binary:Version})
Description: Apache Arrow Database Connectivity (ADBC) driver manager
.
This package provides GObject Introspection typelib files for Apache
Arrow GLib integration.

Package: libadbc-arrow-glib-dev
Section: libdevel
Architecture: any
Multi-Arch: same
Depends:
${misc:Depends},
gir1.2-adbc-arrow-1.0 (= ${binary:Version}),
libadbc-glib-dev (= ${binary:Version})
Description: Apache Arrow Database Connectivity (ADBC) driver manager
.
This package provides header files for Apache Arrow GLib
integration.

Package: libadbc-arrow-glib-doc
Section: doc
Architecture: all
Multi-Arch: foreign
Depends:
${misc:Depends}
Recommends:
libglib2.0-doc,
libadbc-glib-doc,
libarrow-glib-doc
Description: Apache Arrow Database Connectivity (ADBC) driver manager
.
This package provides documentations for Apache Arrow GLib
integration.
1 change: 1 addition & 0 deletions ci/linux-packages/debian/gir1.2-adbc-arrow-1.0.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/girepository-1.0/ADBCArrow-*.typelib
6 changes: 6 additions & 0 deletions ci/linux-packages/debian/libadbc-arrow-glib-dev.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
usr/include/adbc-arrow-glib/
usr/lib/*/libadbc-arrow-glib.so
usr/lib/*/pkgconfig/adbc-arrow-glib.pc
usr/share/adbc-arrow-glib/example/
usr/share/gir-1.0/ADBCArrow-*.gir
usr/share/vala/vapi/adbc-arrow-glib.*
1 change: 1 addition & 0 deletions ci/linux-packages/debian/libadbc-arrow-glib-doc.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/share/doc/adbc-arrow-glib/
1 change: 1 addition & 0 deletions ci/linux-packages/debian/libadbc-arrow-glib0.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/libadbc-arrow-glib.so.*
2 changes: 1 addition & 1 deletion ci/linux-packages/debian/libadbc-glib-dev.install
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ usr/lib/*/libadbc-glib.so
usr/lib/*/pkgconfig/adbc-glib.pc
usr/share/adbc-glib/example/
usr/share/gir-1.0/ADBC-*.gir
usr/share/vala/vapi/*
usr/share/vala/vapi/adbc-glib.*
1 change: 1 addition & 0 deletions ci/linux-packages/yum/almalinux-8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ RUN \
yum install -y ${quiet} epel-release && \
yum install -y https://apache.jfrog.io/artifactory/arrow/almalinux/$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)/apache-arrow-release-latest.rpm && \
yum install --enablerepo=powertools -y ${quiet} \
arrow-glib-devel \
ccache \
cmake \
gcc-c++ \
Expand Down
1 change: 1 addition & 0 deletions ci/linux-packages/yum/almalinux-9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ RUN \
dnf install -y ${quiet} epel-release && \
dnf install -y https://apache.jfrog.io/artifactory/arrow/almalinux/$(cut -d: -f5 /etc/system-release-cpe | cut -d. -f1)/apache-arrow-release-latest.rpm && \
dnf install --enablerepo=crb -y ${quiet} \
arrow-glib-devel \
ccache \
cmake \
gcc-c++ \
Expand Down
57 changes: 54 additions & 3 deletions ci/linux-packages/yum/apache-arrow-adbc.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ License: Apache-2.0
URL: https://arrow.apache.org/adbc/
Source0: https://www.apache.org/dyn/closer.lua?action=download&path=/arrow/arrow-adbc-%{version}/apache-arrow-adbc-%{version}.tar.gz

BuildRequires: arrow-glib-devel
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: gobject-introspection-devel
Expand Down Expand Up @@ -260,7 +261,7 @@ This package contains the libraries for ADBC GLib.
%defattr(-,root,root,-)
%doc README.md
%license LICENSE.txt NOTICE.txt
%{_libdir}/girepository-1.0/
%{_libdir}/girepository-1.0/ADBC-*.typelib
%{_libdir}/libadbc-glib.so.*

%package glib-devel
Expand All @@ -278,8 +279,8 @@ Libraries and header files for ADBC GLib.
%defattr(-,root,root,-)
%doc README.md
%license LICENSE.txt NOTICE.txt
%{_datadir}/gir-1.0/
%{_datadir}/vala/vapi/
%{_datadir}/gir-1.0/ADBC-*.gir
%{_datadir}/vala/vapi/adbc-glib.*
%{_includedir}/adbc-glib/
%{_libdir}/libadbc-glib.a
%{_libdir}/libadbc-glib.so
Expand All @@ -299,6 +300,56 @@ Documentation for ADBC GLib.
%{_datadir}/adbc-glib/example/
%{_docdir}/adbc-glib/

%package arrow-glib%{major_version}-libs
Summary: Runtime libraries for Apache Arrow GLib integration
License: Apache-2.0
Requires: %{name}-glib%{major_version}-libs = %{version}-%{release}

%description arrow-glib%{major_version}-libs
This package contains the libraries for Apache Arrow GLib integration.

%files arrow-glib%{major_version}-libs
%defattr(-,root,root,-)
%doc README.md
%license LICENSE.txt NOTICE.txt
%{_libdir}/girepository-1.0/ADBCArrow-*.typelib
%{_libdir}/libadbc-arrow-glib.so.*

%package arrow-glib-devel
Summary: Libraries and header files for Apache Arrow GLib integration
License: Apache-2.0
Requires: %{name}-arrow-glib%{major_version}-libs = %{version}-%{release}
Requires: %{name}-glib-devel = %{version}-%{release}
Requires: arrow-glib-devel

%description arrow-glib-devel
Libraries and header files for Apache Arrow GLib integration

%files arrow-glib-devel
%defattr(-,root,root,-)
%doc README.md
%license LICENSE.txt NOTICE.txt
%{_datadir}/gir-1.0/ADBCArrow-*.gir
%{_datadir}/vala/vapi/adbc-arrow-glib.*
%{_includedir}/adbc-arrow-glib/
%{_libdir}/libadbc-arrow-glib.a
%{_libdir}/libadbc-arrow-glib.so
%{_libdir}/pkgconfig/adbc-arrow-glib.pc

%package arrow-glib-doc
Summary: Documentation for Apache Arrow GLib integration
License: Apache-2.0

%description arrow-glib-doc
Documentation for Apache Arrow GLib integration.

%files arrow-glib-doc
%defattr(-,root,root,-)
%doc README.md
%license LICENSE.txt NOTICE.txt
%{_datadir}/adbc-arrow-glib/example/
%{_docdir}/adbc-arrow-glib/

%changelog
* Thu Apr 27 2023 Matt Topol <[email protected]> - 0.4.0-1
- Add snowflake driver
Expand Down
8 changes: 8 additions & 0 deletions dev/release/verify-apt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,11 @@ ${APT_INSTALL} ruby-dev rubygems-integration
gem install gobject-introspection
ruby -r gi -e "p GI.load('ADBC')"
echo "::endgroup::"

echo "::group::Test ADBC Arrow GLib"

${APT_INSTALL} libadbc-arrow-glib-dev=${package_version}
${APT_INSTALL} libadbc-arrow-glib-doc=${package_version}

ruby -r gi -e "p GI.load('ADBCArrow')"
echo "::endgroup::"
10 changes: 9 additions & 1 deletion dev/release/verify-yum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ echo "::group::Test ADBC Snowflake Driver"
${install_command} --enablerepo=epel adbc-driver-snowflake-devel-${package_version}
echo "::endgroup::"

echo "::group::Test Apache Arrow GLib"
echo "::group::Test ADBC GLib"
export G_DEBUG=fatal-warnings

${install_command} --enablerepo=epel adbc-glib-devel-${package_version}
Expand All @@ -167,3 +167,11 @@ ${install_command} "${ruby_devel_packages[@]}"
gem install gobject-introspection
ruby -r gi -e "p GI.load('ADBC')"
echo "::endgroup::"

echo "::group::Test ADBC Arrow GLib"

${install_command} --enablerepo=epel adbc-arrow-glib-devel-${package_version}
${install_command} --enablerepo=epel adbc-arrow-glib-doc-${package_version}

ruby -r gi -e "p GI.load('ADBCArrow')"
echo "::endgroup::"
24 changes: 24 additions & 0 deletions glib/adbc-arrow-glib/adbc-arrow-glib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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 <adbc-arrow-glib/version.h>

#include <adbc-arrow-glib/statement.h>
115 changes: 115 additions & 0 deletions glib/adbc-arrow-glib/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# -*- 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.

sources = files(
'statement.c',
)

definition_headers = files(
'statement.h',
)

headers = definition_headers
headers += files(
'adbc-arrow-glib.h',
)

version_h_conf = configuration_data()
version_h_conf.set('GADBC_ARROW_VERSION', meson.project_version())
version_h_conf.set('GADBC_ARROW_VERSION_MAJOR', version_major)
version_h_conf.set('GADBC_ARROW_VERSION_MINOR', version_minor)
version_h_conf.set('GADBC_ARROW_VERSION_MICRO', version_micro)
version_h = configure_file(input: 'version.h.in',
output: 'version.h',
configuration: version_h_conf)
headers += version_h

enums = gnome.mkenums_simple('enum-types',
identifier_prefix: 'GADBCArrow',
sources: definition_headers,
symbol_prefix: 'gadbc_arrow')
enums_header = enums[1]

install_headers(headers, subdir: 'adbc-arrow-glib')


dependencies = [
adbc_glib,
arrow_glib,
]
libadbc_arrow_glib = library('adbc-arrow-glib',
c_args: '-DG_LOG_DOMAIN="ADBC-Arrow"',
sources: sources + enums,
install: true,
dependencies: dependencies,
include_directories: base_include_directories,
soversion: so_version,
version: library_version)
adbc_arrow_glib = \
declare_dependency(link_with: libadbc_arrow_glib,
include_directories: base_include_directories,
dependencies: dependencies,
sources: enums_header)

pkgconfig.generate(libadbc_arrow_glib,
description: 'Arrow GLib integration API for ADBC GLib',
filebase: 'adbc-arrow-glib',
name: 'ADBC Arrow GLib',
requires: ['adbc-glib', 'arrow-glib'],
variables: pkgconfig_variables,
version: meson.project_version())

adbc_arrow_glib_gir = \
gnome.generate_gir(libadbc_arrow_glib,
dependencies: [
declare_dependency(sources: adbc_glib_gir),
arrow_glib,
],
export_packages: 'adbc-arrow-glib',
extra_args: [
'--warn-all',
],
fatal_warnings: gi_fatal_warnings,
header: 'adbc-arrow-glib/adbc-arrow-glib.h',
identifier_prefix: 'GADBCArrow',
includes: [
'ADBC-1.0',
'Arrow-1.0',
],
install: true,
namespace: 'ADBCArrow',
nsversion: api_version,
sources: sources + definition_headers + enums,
symbol_prefix: 'gadbc_arrow')
if generate_vapi
adbc_arrow_glib_vapi = \
gnome.generate_vapi('adbc-arrow-glib',
gir_dirs: [
arrow_glib.get_variable('girdir'),
],
install: true,
packages: [
adbc_glib_vapi,
'arrow-glib',
],
sources: [adbc_arrow_glib_gir[0]],
vapi_dirs: [
arrow_glib.get_variable('vapidir'),
])
endif
Loading

0 comments on commit 3409476

Please sign in to comment.