You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "paleolimbot (via GitHub)" <gi...@apache.org> on 2024/09/24 18:05:59 UTC

[PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

paleolimbot opened a new pull request, #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186

   (no comment)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on code in PR #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186#discussion_r1819391957


##########
docs/source/cpp/recipe_driver/driver_example.cc:
##########
@@ -0,0 +1,304 @@
+// 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.
+
+// RECIPE STARTS HERE
+
+/// Here we'll show the structure of building an ADBC driver in C++ using
+/// the ADBC driver framework library. This is the same library that ADBC
+/// uses to build its SQLite and PostgreSQL drivers and abstracts away
+/// the details of C callables and catalog/metadata functions that can be
+/// difficult to implement but are essential for efficiently leveraging
+/// the rest of the ADBC ecosystem.
+///
+/// At a high level, we'll be building a driver whose "database" is a directory
+/// where each "table" in the database is a file containing an Arrow IPC stream.
+/// Tables can be written using the bulk ingest feature and tables can be read
+/// with a simple query in the form ``SELECT * FROM (the file)``.
+///
+/// Installation
+/// ============
+///
+/// This quickstart is actually a literate C++ file.  You can clone
+/// the repository, build the sample, and follow along.
+///
+/// We'll assume you're using conda-forge_ for dependencies.  CMake, a
+/// C++17 compiler, and the ADBC libraries are required.  They can be
+/// installed as follows:
+///
+/// .. code-block:: shell
+///
+///    mamba install cmake compilers libadbc-driver-manager
+///
+/// .. _conda-forge: https://conda-forge.org/
+///
+/// Building
+/// ========
+///
+/// We'll use CMake_ here.  From a source checkout of the ADBC repository:
+///
+/// .. code-block:: shell
+///
+///    mkdir build
+///    cd build
+///    cmake ../docs/source/cpp/recipe_driver -DADBC_DRIVER_EXAMPLE_BUILD_TESTS=ON
+///    cmake --build .
+///    ctest
+///
+/// .. _CMake: https://cmake.org/
+///
+/// Building an ADBC Driver using C++
+/// =================================
+///
+/// Let's start with some includes. Notably, we'll need the driver framework
+/// header files and nanoarrow_, which we'll use to create and consume the
+/// Arrow C data interface structures in this example driver.
+
+/// .. _nanoarrow: https://arrow.apache.org/nanoarrow
+
+#include "driver_example.h"
+
+#include <cstdio>
+#include <string>
+
+#include "driver/framework/connection.h"
+#include "driver/framework/database.h"
+#include "driver/framework/statement.h"
+
+#include "nanoarrow/nanoarrow.hpp"
+#include "nanoarrow/nanoarrow_ipc.hpp"
+
+#include "arrow-adbc/adbc.h"
+
+/// Next, we'll bring a few essential framework types into the namespace
+/// to reduce the verbosity of the implementation:
+///
+/// * ``Option``: Options can be set on an ADBC database, connection, and

Review Comment:
   I'll give it a try!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on PR #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186#issuecomment-2444574937

   No problem! Thank you!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on PR #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186#issuecomment-2443423532

   I took a look and interestingly, Status::Impl is documented in the XML, but not in the HTML.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on PR #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186#issuecomment-2443449542

   Ok I think the main issue is that I just haven't implemented enough to also scrape C++ headers well...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on PR #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186#issuecomment-2444178517

   Sorry, I pushed a bunch of crap here...let's hope the docs work now :sweat_smile: 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot merged PR #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on PR #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186#issuecomment-2442892284

   Hmm, there's something not right with the scrape...I'll see if I can take a look too
   
   ```
     File "/adbc/docs/source/ext/doxygen_inventory.py", line 209, in <module>
       main()
     File "/adbc/docs/source/ext/doxygen_inventory.py", line 193, in main
       domains = make_fake_domains(args.html_path, args.xml_path, args.url)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/adbc/docs/source/ext/doxygen_inventory.py", line 145, in make_fake_domains
       for domain, name, typ, anchor, url in scrape_links(item_id_to_url, root):
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/adbc/docs/source/ext/doxygen_inventory.py", line 66, in scrape_links
       url = item_id_to_url[anchor]
             ~~~~~~~~~~~~~~^^^^^^^^
   KeyError: 'structadbc_1_1driver_1_1Status_1_1Impl'
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on code in PR #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186#discussion_r1808010373


##########
docs/source/cpp/recipe_driver/CMakeLists.txt:
##########
@@ -0,0 +1,76 @@
+# 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.
+
+cmake_minimum_required(VERSION 3.18)
+
+project(adbc_cookbook_recipes_driver
+        VERSION "1.0.0"
+        LANGUAGES CXX)
+
+include(CTest)
+include(FetchContent)
+
+set(CMAKE_CXX_STANDARD 17)
+
+# TODO: This currently depends on about-to-be-released nanoarrow, which allows
+# access to both nanoarrow and the IPC reader using a single fetchcontent.
+set(NANOARROW_IPC ON)
+set(NANOARROW_NAMESPACE "DriverExamplePrivate")
+fetchcontent_declare(nanoarrow
+                     GIT_REPOSITORY https://github.com/apache/arrow-nanoarrow.git
+                     GIT_TAG main
+                     GIT_SHALLOW TRUE)
+fetchcontent_makeavailable(nanoarrow)
+
+# TODO: We could allow this to be installed + linked to as a target; however,
+# fetchcontent is a little nicer for this kind of thing (statically linked
+# pinned version of something that doesn't rely on a system libraray).
+add_library(adbc_driver_framework ../../../../c/driver/framework/utility.cc
+                                  ../../../../c/driver/framework/objects.cc)
+target_include_directories(adbc_driver_framework PRIVATE ../../../../c
+                                                         ../../../../c/include)
+target_link_libraries(adbc_driver_framework PRIVATE nanoarrow::nanoarrow)
+
+# TODO: Do we want any symbol visiblity presets here to ensure that the only one exposed
+# is the init function?
+add_library(driver_example SHARED driver_example.cc)
+target_include_directories(driver_example PRIVATE ../../../../c ../../../../c/include)
+target_link_libraries(driver_example PRIVATE adbc_driver_framework
+                                             nanoarrow::nanoarrow_ipc)
+
+# TODO: Do we want to have this as part of the example? We could make the validation library

Review Comment:
   Ok! I leaned into this comment and made it a part of the recipe!



##########
docs/source/cpp/recipe_driver/CMakeLists.txt:
##########
@@ -0,0 +1,76 @@
+# 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.
+
+cmake_minimum_required(VERSION 3.18)
+
+project(adbc_cookbook_recipes_driver
+        VERSION "1.0.0"
+        LANGUAGES CXX)
+
+include(CTest)
+include(FetchContent)
+
+set(CMAKE_CXX_STANDARD 17)
+
+# TODO: This currently depends on about-to-be-released nanoarrow, which allows
+# access to both nanoarrow and the IPC reader using a single fetchcontent.
+set(NANOARROW_IPC ON)
+set(NANOARROW_NAMESPACE "DriverExamplePrivate")
+fetchcontent_declare(nanoarrow
+                     GIT_REPOSITORY https://github.com/apache/arrow-nanoarrow.git
+                     GIT_TAG main
+                     GIT_SHALLOW TRUE)
+fetchcontent_makeavailable(nanoarrow)
+
+# TODO: We could allow this to be installed + linked to as a target; however,
+# fetchcontent is a little nicer for this kind of thing (statically linked
+# pinned version of something that doesn't rely on a system libraray).
+add_library(adbc_driver_framework ../../../../c/driver/framework/utility.cc
+                                  ../../../../c/driver/framework/objects.cc)
+target_include_directories(adbc_driver_framework PRIVATE ../../../../c
+                                                         ../../../../c/include)
+target_link_libraries(adbc_driver_framework PRIVATE nanoarrow::nanoarrow)
+
+# TODO: Do we want any symbol visiblity presets here to ensure that the only one exposed

Review Comment:
   Removed!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186#discussion_r1818004126


##########
docs/source/cpp/recipe_driver/driver_example.cc:
##########
@@ -0,0 +1,304 @@
+// 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.
+
+// RECIPE STARTS HERE
+
+/// Here we'll show the structure of building an ADBC driver in C++ using
+/// the ADBC driver framework library. This is the same library that ADBC
+/// uses to build its SQLite and PostgreSQL drivers and abstracts away
+/// the details of C callables and catalog/metadata functions that can be
+/// difficult to implement but are essential for efficiently leveraging
+/// the rest of the ADBC ecosystem.
+///
+/// At a high level, we'll be building a driver whose "database" is a directory
+/// where each "table" in the database is a file containing an Arrow IPC stream.
+/// Tables can be written using the bulk ingest feature and tables can be read
+/// with a simple query in the form ``SELECT * FROM (the file)``.
+///
+/// Installation
+/// ============
+///
+/// This quickstart is actually a literate C++ file.  You can clone
+/// the repository, build the sample, and follow along.
+///
+/// We'll assume you're using conda-forge_ for dependencies.  CMake, a
+/// C++17 compiler, and the ADBC libraries are required.  They can be
+/// installed as follows:
+///
+/// .. code-block:: shell
+///
+///    mamba install cmake compilers libadbc-driver-manager
+///
+/// .. _conda-forge: https://conda-forge.org/
+///
+/// Building
+/// ========
+///
+/// We'll use CMake_ here.  From a source checkout of the ADBC repository:
+///
+/// .. code-block:: shell
+///
+///    mkdir build
+///    cd build
+///    cmake ../docs/source/cpp/recipe_driver -DADBC_DRIVER_EXAMPLE_BUILD_TESTS=ON
+///    cmake --build .
+///    ctest
+///
+/// .. _CMake: https://cmake.org/
+///
+/// Building an ADBC Driver using C++
+/// =================================
+///
+/// Let's start with some includes. Notably, we'll need the driver framework
+/// header files and nanoarrow_, which we'll use to create and consume the
+/// Arrow C data interface structures in this example driver.
+
+/// .. _nanoarrow: https://arrow.apache.org/nanoarrow
+
+#include "driver_example.h"
+
+#include <cstdio>
+#include <string>
+
+#include "driver/framework/connection.h"
+#include "driver/framework/database.h"
+#include "driver/framework/statement.h"
+
+#include "nanoarrow/nanoarrow.hpp"
+#include "nanoarrow/nanoarrow_ipc.hpp"
+
+#include "arrow-adbc/adbc.h"
+
+/// Next, we'll bring a few essential framework types into the namespace
+/// to reduce the verbosity of the implementation:
+///
+/// * ``Option``: Options can be set on an ADBC database, connection, and

Review Comment:
   I _think_ something like 
   
   ```
   :cpp:class:`adbc::driver::Option`
   ```
   
   should work now (and eventually result in a proper link to the API docs from the prose docs), though no big deal either way (it can be finicky to set up and test locally)



##########
docs/source/cpp/recipe_driver/CMakeLists.txt:
##########
@@ -0,0 +1,71 @@
+# 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.
+
+cmake_minimum_required(VERSION 3.18)
+
+project(adbc_cookbook_recipes_driver
+        VERSION "1.0.0"
+        LANGUAGES CXX)
+
+include(CTest)
+include(FetchContent)
+
+set(CMAKE_CXX_STANDARD 17)
+
+# TODO: This currently depends on about-to-be-released nanoarrow, which allows
+# access to both nanoarrow and the IPC reader using a single fetchcontent.

Review Comment:
   Can we update this now?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186#discussion_r1774519233


##########
ci/scripts/cpp_recipe_driver.sh:
##########


Review Comment:
   Ah I'm mostly just saying, we can just have a single shell script to invoke all the CMake builds for recipes. Not too big deal to me though



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186#discussion_r1774457386


##########
ci/scripts/cpp_recipe_driver.sh:
##########


Review Comment:
   If I'm not mistaken we already have cpp_recipe.sh for testing? Can we just fold all the test scripts into one?
   
   (We could even have a single parent CMake that adds the quickstart/driver example as child CMakes, though I can understand if you want the driver example to be fully self-contained there)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on code in PR #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186#discussion_r1774468966


##########
ci/scripts/cpp_recipe_driver.sh:
##########


Review Comment:
   I think a self-contained CMakeLists.txt is more realistic although I'm open to any suggestions here! I mostly just tried to emulate the existing art here which is great!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on code in PR #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186#discussion_r1808010563


##########
ci/scripts/cpp_recipe_driver.sh:
##########


Review Comment:
   I think I did this (but happy to restructure as required!)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on PR #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186#issuecomment-2443195696

   I ran out of time today to debug but I can take a look tomorrow too!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on PR #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186#issuecomment-2443469173

   Ok, I think that should fix the main things...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs(c/driver/framework): Add documentation for building a driver using the driver framework [arrow-adbc]

Posted by "WillAyd (via GitHub)" <gi...@apache.org>.
WillAyd commented on code in PR #2186:
URL: https://github.com/apache/arrow-adbc/pull/2186#discussion_r1805284814


##########
docs/source/cpp/recipe_driver/CMakeLists.txt:
##########
@@ -0,0 +1,76 @@
+# 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.
+
+cmake_minimum_required(VERSION 3.18)
+
+project(adbc_cookbook_recipes_driver
+        VERSION "1.0.0"
+        LANGUAGES CXX)
+
+include(CTest)
+include(FetchContent)
+
+set(CMAKE_CXX_STANDARD 17)
+
+# TODO: This currently depends on about-to-be-released nanoarrow, which allows
+# access to both nanoarrow and the IPC reader using a single fetchcontent.
+set(NANOARROW_IPC ON)
+set(NANOARROW_NAMESPACE "DriverExamplePrivate")
+fetchcontent_declare(nanoarrow
+                     GIT_REPOSITORY https://github.com/apache/arrow-nanoarrow.git
+                     GIT_TAG main
+                     GIT_SHALLOW TRUE)
+fetchcontent_makeavailable(nanoarrow)
+
+# TODO: We could allow this to be installed + linked to as a target; however,
+# fetchcontent is a little nicer for this kind of thing (statically linked
+# pinned version of something that doesn't rely on a system libraray).
+add_library(adbc_driver_framework ../../../../c/driver/framework/utility.cc
+                                  ../../../../c/driver/framework/objects.cc)
+target_include_directories(adbc_driver_framework PRIVATE ../../../../c
+                                                         ../../../../c/include)
+target_link_libraries(adbc_driver_framework PRIVATE nanoarrow::nanoarrow)
+
+# TODO: Do we want any symbol visiblity presets here to ensure that the only one exposed

Review Comment:
   This would be nice but we don't have this worked out in the main project yet either do we? Maybe worth punting until then



##########
docs/source/cpp/recipe_driver/CMakeLists.txt:
##########
@@ -0,0 +1,76 @@
+# 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.
+
+cmake_minimum_required(VERSION 3.18)
+
+project(adbc_cookbook_recipes_driver
+        VERSION "1.0.0"
+        LANGUAGES CXX)
+
+include(CTest)
+include(FetchContent)
+
+set(CMAKE_CXX_STANDARD 17)
+
+# TODO: This currently depends on about-to-be-released nanoarrow, which allows
+# access to both nanoarrow and the IPC reader using a single fetchcontent.
+set(NANOARROW_IPC ON)
+set(NANOARROW_NAMESPACE "DriverExamplePrivate")
+fetchcontent_declare(nanoarrow
+                     GIT_REPOSITORY https://github.com/apache/arrow-nanoarrow.git
+                     GIT_TAG main
+                     GIT_SHALLOW TRUE)
+fetchcontent_makeavailable(nanoarrow)
+
+# TODO: We could allow this to be installed + linked to as a target; however,
+# fetchcontent is a little nicer for this kind of thing (statically linked
+# pinned version of something that doesn't rely on a system libraray).
+add_library(adbc_driver_framework ../../../../c/driver/framework/utility.cc
+                                  ../../../../c/driver/framework/objects.cc)
+target_include_directories(adbc_driver_framework PRIVATE ../../../../c
+                                                         ../../../../c/include)
+target_link_libraries(adbc_driver_framework PRIVATE nanoarrow::nanoarrow)
+
+# TODO: Do we want any symbol visiblity presets here to ensure that the only one exposed
+# is the init function?
+add_library(driver_example SHARED driver_example.cc)
+target_include_directories(driver_example PRIVATE ../../../../c ../../../../c/include)
+target_link_libraries(driver_example PRIVATE adbc_driver_framework
+                                             nanoarrow::nanoarrow_ipc)
+
+# TODO: Do we want to have this as part of the example? We could make the validation library

Review Comment:
   I am +1 to including this in the example - I think the test is helpful to read



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org