Skip to content

Commit

Permalink
Merge branch 'apache:main' into Benchmark-CI
Browse files Browse the repository at this point in the history
  • Loading branch information
singh1203 authored Jan 21, 2025
2 parents 8dc4aa8 + 218e674 commit 80dabba
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 43 deletions.
5 changes: 5 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Apache Arrow Go
Copyright 2016-2025 The Apache Software Foundation

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
File renamed without changes.
4 changes: 2 additions & 2 deletions arrow/cdata/cdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ package cdata

// implement handling of the Arrow C Data Interface. At least from a consuming side.

// #include "arrow/c/abi.h"
// #include "arrow/c/helpers.h"
// #include "abi.h"
// #include "helpers.h"
// #include <stdlib.h>
// int stream_get_schema(struct ArrowArrayStream* st, struct ArrowSchema* out) { return st->get_schema(st, out); }
// int stream_get_next(struct ArrowArrayStream* st, struct ArrowArray* out) { return st->get_next(st, out); }
Expand Down
2 changes: 1 addition & 1 deletion arrow/cdata/cdata_allocate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package cdata

// #include <stdlib.h>
// #include "arrow/c/abi.h"
// #include "abi.h"
import "C"

import (
Expand Down
4 changes: 2 additions & 2 deletions arrow/cdata/cdata_exports.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package cdata
// #include <errno.h>
// #include <stdint.h>
// #include <stdlib.h>
// #include "arrow/c/abi.h"
// #include "arrow/c/helpers.h"
// #include "abi.h"
// #include "helpers.h"
//
// extern void releaseExportedSchema(struct ArrowSchema* schema);
// extern void releaseExportedArray(struct ArrowArray* array);
Expand Down
4 changes: 2 additions & 2 deletions arrow/cdata/cdata_fulltest.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include "arrow/c/abi.h"
#include "arrow/c/helpers.h"
#include "abi.h"
#include "helpers.h"
#include "utils.h"

int is_little_endian()
Expand Down
4 changes: 2 additions & 2 deletions arrow/cdata/cdata_test_framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ package cdata
// #include <stdlib.h>
// #include <stdint.h>
// #include <string.h>
// #include "arrow/c/abi.h"
// #include "arrow/c/helpers.h"
// #include "abi.h"
// #include "helpers.h"
//
// void setup_array_stream_test(const int n_batches, struct ArrowArrayStream* out);
// static struct ArrowArray* get_test_arr() {
Expand Down
4 changes: 2 additions & 2 deletions arrow/cdata/exports.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import (

// #include <stdlib.h>
// #include <errno.h>
// #include "arrow/c/abi.h"
// #include "arrow/c/helpers.h"
// #include "abi.h"
// #include "helpers.h"
//
// typedef const char cchar_t;
// extern int streamGetSchema(struct ArrowArrayStream*, struct ArrowSchema*);
Expand Down
42 changes: 21 additions & 21 deletions arrow/cdata/arrow/c/helpers.h → arrow/cdata/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <stdlib.h>
#include <string.h>

#include "arrow/c/abi.h"
#include "abi.h"

#define ARROW_C_ASSERT(condition, msg) \
do { \
Expand All @@ -37,28 +37,28 @@ extern "C" {
#endif

/// Query whether the C schema is released
inline int ArrowSchemaIsReleased(const struct ArrowSchema* schema) {
static inline int ArrowSchemaIsReleased(const struct ArrowSchema* schema) {
return schema->release == NULL;
}

/// Mark the C schema released (for use in release callbacks)
inline void ArrowSchemaMarkReleased(struct ArrowSchema* schema) {
static inline void ArrowSchemaMarkReleased(struct ArrowSchema* schema) {
schema->release = NULL;
}

/// Move the C schema from `src` to `dest`
///
/// Note `dest` must *not* point to a valid schema already, otherwise there
/// will be a memory leak.
inline void ArrowSchemaMove(struct ArrowSchema* src, struct ArrowSchema* dest) {
static inline void ArrowSchemaMove(struct ArrowSchema* src, struct ArrowSchema* dest) {
assert(dest != src);
assert(!ArrowSchemaIsReleased(src));
memcpy(dest, src, sizeof(struct ArrowSchema));
ArrowSchemaMarkReleased(src);
}

/// Release the C schema, if necessary, by calling its release callback
inline void ArrowSchemaRelease(struct ArrowSchema* schema) {
static inline void ArrowSchemaRelease(struct ArrowSchema* schema) {
if (!ArrowSchemaIsReleased(schema)) {
schema->release(schema);
ARROW_C_ASSERT(ArrowSchemaIsReleased(schema),
Expand All @@ -67,33 +67,33 @@ inline void ArrowSchemaRelease(struct ArrowSchema* schema) {
}

/// Query whether the C array is released
inline int ArrowArrayIsReleased(const struct ArrowArray* array) {
static inline int ArrowArrayIsReleased(const struct ArrowArray* array) {
return array->release == NULL;
}

inline int ArrowDeviceArrayIsReleased(const struct ArrowDeviceArray* array) {
static inline int ArrowDeviceArrayIsReleased(const struct ArrowDeviceArray* array) {
return ArrowArrayIsReleased(&array->array);
}

/// Mark the C array released (for use in release callbacks)
inline void ArrowArrayMarkReleased(struct ArrowArray* array) { array->release = NULL; }
static inline void ArrowArrayMarkReleased(struct ArrowArray* array) { array->release = NULL; }

inline void ArrowDeviceArrayMarkReleased(struct ArrowDeviceArray* array) {
static inline void ArrowDeviceArrayMarkReleased(struct ArrowDeviceArray* array) {
ArrowArrayMarkReleased(&array->array);
}

/// Move the C array from `src` to `dest`
///
/// Note `dest` must *not* point to a valid array already, otherwise there
/// will be a memory leak.
inline void ArrowArrayMove(struct ArrowArray* src, struct ArrowArray* dest) {
static inline void ArrowArrayMove(struct ArrowArray* src, struct ArrowArray* dest) {
assert(dest != src);
assert(!ArrowArrayIsReleased(src));
memcpy(dest, src, sizeof(struct ArrowArray));
ArrowArrayMarkReleased(src);
}

inline void ArrowDeviceArrayMove(struct ArrowDeviceArray* src,
static inline void ArrowDeviceArrayMove(struct ArrowDeviceArray* src,
struct ArrowDeviceArray* dest) {
assert(dest != src);
assert(!ArrowDeviceArrayIsReleased(src));
Expand All @@ -102,15 +102,15 @@ inline void ArrowDeviceArrayMove(struct ArrowDeviceArray* src,
}

/// Release the C array, if necessary, by calling its release callback
inline void ArrowArrayRelease(struct ArrowArray* array) {
static inline void ArrowArrayRelease(struct ArrowArray* array) {
if (!ArrowArrayIsReleased(array)) {
array->release(array);
ARROW_C_ASSERT(ArrowArrayIsReleased(array),
"ArrowArrayRelease did not cleanup release callback");
}
}

inline void ArrowDeviceArrayRelease(struct ArrowDeviceArray* array) {
static inline void ArrowDeviceArrayRelease(struct ArrowDeviceArray* array) {
if (!ArrowDeviceArrayIsReleased(array)) {
array->array.release(&array->array);
ARROW_C_ASSERT(ArrowDeviceArrayIsReleased(array),
Expand All @@ -119,36 +119,36 @@ inline void ArrowDeviceArrayRelease(struct ArrowDeviceArray* array) {
}

/// Query whether the C array stream is released
inline int ArrowArrayStreamIsReleased(const struct ArrowArrayStream* stream) {
static inline int ArrowArrayStreamIsReleased(const struct ArrowArrayStream* stream) {
return stream->release == NULL;
}

inline int ArrowDeviceArrayStreamIsReleased(const struct ArrowDeviceArrayStream* stream) {
static inline int ArrowDeviceArrayStreamIsReleased(const struct ArrowDeviceArrayStream* stream) {
return stream->release == NULL;
}

/// Mark the C array stream released (for use in release callbacks)
inline void ArrowArrayStreamMarkReleased(struct ArrowArrayStream* stream) {
static inline void ArrowArrayStreamMarkReleased(struct ArrowArrayStream* stream) {
stream->release = NULL;
}

inline void ArrowDeviceArrayStreamMarkReleased(struct ArrowDeviceArrayStream* stream) {
static inline void ArrowDeviceArrayStreamMarkReleased(struct ArrowDeviceArrayStream* stream) {
stream->release = NULL;
}

/// Move the C array stream from `src` to `dest`
///
/// Note `dest` must *not* point to a valid stream already, otherwise there
/// will be a memory leak.
inline void ArrowArrayStreamMove(struct ArrowArrayStream* src,
static inline void ArrowArrayStreamMove(struct ArrowArrayStream* src,
struct ArrowArrayStream* dest) {
assert(dest != src);
assert(!ArrowArrayStreamIsReleased(src));
memcpy(dest, src, sizeof(struct ArrowArrayStream));
ArrowArrayStreamMarkReleased(src);
}

inline void ArrowDeviceArrayStreamMove(struct ArrowDeviceArrayStream* src,
static inline void ArrowDeviceArrayStreamMove(struct ArrowDeviceArrayStream* src,
struct ArrowDeviceArrayStream* dest) {
assert(dest != src);
assert(!ArrowDeviceArrayStreamIsReleased(src));
Expand All @@ -157,15 +157,15 @@ inline void ArrowDeviceArrayStreamMove(struct ArrowDeviceArrayStream* src,
}

/// Release the C array stream, if necessary, by calling its release callback
inline void ArrowArrayStreamRelease(struct ArrowArrayStream* stream) {
static inline void ArrowArrayStreamRelease(struct ArrowArrayStream* stream) {
if (!ArrowArrayStreamIsReleased(stream)) {
stream->release(stream);
ARROW_C_ASSERT(ArrowArrayStreamIsReleased(stream),
"ArrowArrayStreamRelease did not cleanup release callback");
}
}

inline void ArrowDeviceArrayStreamRelease(struct ArrowDeviceArrayStream* stream) {
static inline void ArrowDeviceArrayStreamRelease(struct ArrowDeviceArrayStream* stream) {
if (!ArrowDeviceArrayStreamIsReleased(stream)) {
stream->release(stream);
ARROW_C_ASSERT(ArrowDeviceArrayStreamIsReleased(stream),
Expand Down
2 changes: 1 addition & 1 deletion arrow/cdata/import_allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/apache/arrow-go/v18/arrow/internal/debug"
)

// #include "arrow/c/helpers.h"
// #include "helpers.h"
// #include <stdlib.h>
import "C"

Expand Down
2 changes: 1 addition & 1 deletion arrow/cdata/trampoline.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <string.h>

#include "arrow/c/abi.h"
#include "abi.h"

int streamGetSchema(struct ArrowArrayStream*, struct ArrowSchema*);
int streamGetNext(struct ArrowArrayStream*, struct ArrowArray*);
Expand Down
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ require (
github.com/pierrec/lz4/v4 v4.1.22
github.com/stoewer/go-strcase v1.3.0
github.com/stretchr/testify v1.10.0
github.com/substrait-io/substrait-go/v3 v3.3.0
github.com/substrait-io/substrait-go/v3 v3.4.0
github.com/tidwall/sjson v1.2.5
github.com/zeebo/xxh3 v1.0.2
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
Expand All @@ -48,11 +48,12 @@ require (
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da
gonum.org/v1/gonum v0.15.1
google.golang.org/grpc v1.69.2
google.golang.org/protobuf v1.36.2
google.golang.org/protobuf v1.36.3
modernc.org/sqlite v1.29.6
)

require (
cloud.google.com/go v0.118.0 // indirect
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
github.com/creasty/defaults v1.8.0 // indirect
Expand All @@ -79,7 +80,7 @@ require (
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/text v0.21.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
modernc.org/libc v1.41.0 // indirect
Expand Down
14 changes: 8 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cloud.google.com/go v0.118.0 h1:tvZe1mgqRxpiVa3XlIGMiPcEUbP1gNXELgD4y/IXmeQ=
cloud.google.com/go v0.118.0/go.mod h1:zIt2pkedt/mo+DQjcT4/L3NDxzHPR29j5HcclNH+9PM=
github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c h1:RGWPOewvKIROun94nF7v2cua9qP+thov/7M50KEoeSU=
github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk=
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
Expand Down Expand Up @@ -110,8 +112,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/substrait-io/substrait v0.63.1 h1:XNPvrEYNPjDqenK4TxqBDDUNzglafdjzjejzQqEwk5Y=
github.com/substrait-io/substrait v0.63.1/go.mod h1:MPFNw6sToJgpD5Z2rj0rQrdP/Oq8HG7Z2t3CAEHtkHw=
github.com/substrait-io/substrait-go/v3 v3.3.0 h1:QT8PGpIwU8+lehugWDYnsylHP9X1rg5aTa2f2iUQslw=
github.com/substrait-io/substrait-go/v3 v3.3.0/go.mod h1:qI0Hu7ywDv41z99O26YIGUH1c35pbF+NUjbUN8mhDjo=
github.com/substrait-io/substrait-go/v3 v3.4.0 h1:S7/sAyVV7gy6TQaqsQzO8nxxOOK4fCdcdD7ekUlheQY=
github.com/substrait-io/substrait-go/v3 v3.4.0/go.mod h1:S+yTQwCuWtTe5SD24JJ9S8x8Oae8h9rVDCpZlS9EV5A=
github.com/tidwall/gjson v1.14.2 h1:6BBkirS0rAHjumnjHF6qgy5d2YAJ1TLIaFE2lzfOLqo=
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
Expand Down Expand Up @@ -158,12 +160,12 @@ golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da h1:noIWHXmPHxILtqtCOPIhS
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90=
gonum.org/v1/gonum v0.15.1 h1:FNy7N6OUZVUaWG9pTiD+jlhdQ3lMP+/LcTpJ6+a8sQ0=
gonum.org/v1/gonum v0.15.1/go.mod h1:eZTZuRFrzu5pcyjN5wJhcIhnUdNijYxX1T2IcrOGY0o=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 h1:XVhgTWWV3kGQlwJHR3upFWZeTsei6Oks1apkZSeonIE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 h1:8ZmaLZE4XWrtU3MyClkYqqtl6Oegr3235h7jxsDyqCY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU=
google.golang.org/grpc v1.69.2 h1:U3S9QEtbXC0bYNvRtcoklF3xGtLViumSYxWykJS+7AU=
google.golang.org/grpc v1.69.2/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4=
google.golang.org/protobuf v1.36.2 h1:R8FeyR1/eLmkutZOM5CWghmo5itiG9z0ktFlTVLuTmU=
google.golang.org/protobuf v1.36.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.3 h1:82DV7MYdb8anAVi3qge1wSnMDrnKK7ebr+I0hHRN1BU=
google.golang.org/protobuf v1.36.3/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
Expand Down

0 comments on commit 80dabba

Please sign in to comment.