commit | fd73986cd1e6742e8f5e3d1ebb307fcf5060a734 | [log] [tgz] |
---|---|---|
author | Dewey Dunnington <dewey@dunnington.ca> | Thu Dec 21 11:13:27 2023 -0400 |
committer | GitHub <noreply@github.com> | Thu Dec 21 11:13:27 2023 -0400 |
tree | 0cd3e354df9ffe2aea06069cb4c41e588387d78d | |
parent | 14dfcaaf9745a83af5b265ae14b9075e749e2d82 [diff] |
chore(ci): Fix verification builds for Windows and centos7 (#341) This PR contains a few updates such that the verification job passes on Windows and centos7, and fedora. On centos7/fedora, the builds were failing because the new test that was added needs to be compiled with `-fPIC`. I updated the verification script to always set `CMAKE_POSITION_INDEPENDENT_CODE=ON` from the top-level `cmake` invocation. This was easier than trying to get `target_compile_options()` working on the versions of cmake available by default in all the runners. On the GitHub Actions-based verifications, the builds were failing because the cached Arrow C++ build was not built with the zlib/the gzip codec. Simply adding `ARROW_WITH_ZLIB=ON` did not work on Windows (something about a missing `.lib` file), so I just switched to using zlib directly. When the IPC reader supports compression we will need it anyway and it was a fairly minimal change. There were also a few compiler warnings that I fixed while I had a real live Windows/MSVC session going.
The nanoarrow library is a set of helper functions to interpret and generate Arrow C Data Interface and Arrow C Stream Interface structures. The library is in active early development and users should update regularly from the main branch of this repository.
Whereas the current suite of Arrow implementations provide the basis for a comprehensive data analysis toolkit, this library is intended to support clients that wish to produce or interpret Arrow C Data and/or Arrow C Stream structures where linking to a higher level Arrow binding is difficult or impossible.
The nanoarrow C library is intended to be copied and vendored. This can be done using CMake or by using the bundled nanoarrow.h/nanorrow.c distribution available in the dist/ directory in this repository. Examples of both can be found in the examples/ directory in this repository.
A simple producer example:
#include "nanoarrow.h" int make_simple_array(struct ArrowArray* array_out, struct ArrowSchema* schema_out) { struct ArrowError error; array_out->release = NULL; schema_out->release = NULL; NANOARROW_RETURN_NOT_OK(ArrowArrayInitFromType(array_out, NANOARROW_TYPE_INT32)); NANOARROW_RETURN_NOT_OK(ArrowArrayStartAppending(array_out)); NANOARROW_RETURN_NOT_OK(ArrowArrayAppendInt(array_out, 1)); NANOARROW_RETURN_NOT_OK(ArrowArrayAppendInt(array_out, 2)); NANOARROW_RETURN_NOT_OK(ArrowArrayAppendInt(array_out, 3)); NANOARROW_RETURN_NOT_OK(ArrowArrayFinishBuildingDefault(array_out, &error)); NANOARROW_RETURN_NOT_OK(ArrowSchemaInitFromType(schema_out, NANOARROW_TYPE_INT32)); return NANOARROW_OK; }
A simple consumer example:
#include <stdio.h> #include "nanoarrow.h" int print_simple_array(struct ArrowArray* array, struct ArrowSchema* schema) { struct ArrowError error; struct ArrowArrayView array_view; NANOARROW_RETURN_NOT_OK(ArrowArrayViewInitFromSchema(&array_view, schema, &error)); if (array_view.storage_type != NANOARROW_TYPE_INT32) { printf("Array has storage that is not int32\n"); } int result = ArrowArrayViewSetArray(&array_view, array, &error); if (result != NANOARROW_OK) { ArrowArrayViewReset(&array_view); return result; } for (int64_t i = 0; i < array->length; i++) { printf("%d\n", (int)ArrowArrayViewGetIntUnsafe(&array_view, i)); } ArrowArrayViewReset(&array_view); return NANOARROW_OK; }