You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by jo...@apache.org on 2021/04/18 14:40:18 UTC
[arrow-rs] 08/14: Removed go.
This is an automated email from the ASF dual-hosted git repository.
jorgecarleitao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
commit 8d9f27fd6c5b8ddced4e39d3b54a525b33691541
Author: Jorge C. Leitao <jo...@gmail.com>
AuthorDate: Sun Apr 18 14:21:03 2021 +0000
Removed go.
---
go/README.md | 124 -
go/arrow/.editorconfig | 21 -
go/arrow/.gitignore | 35 -
go/arrow/Gopkg.lock | 44 -
go/arrow/Gopkg.toml | 23 -
go/arrow/LICENSE.txt | 1987 ----
go/arrow/Makefile | 54 -
go/arrow/_examples/helloworld/main.go | 32 -
go/arrow/_tools/tmpl/main.go | 267 -
go/arrow/_tools/tmpl/main_test.go | 73 -
go/arrow/array/array.go | 208 -
go/arrow/array/array_test.go | 301 -
go/arrow/array/binary.go | 134 -
go/arrow/array/binary_test.go | 430 -
go/arrow/array/binarybuilder.go | 217 -
go/arrow/array/binarybuilder_test.go | 87 -
go/arrow/array/boolean.go | 95 -
go/arrow/array/boolean_test.go | 288 -
go/arrow/array/booleanbuilder.go | 165 -
go/arrow/array/booleanbuilder_test.go | 90 -
go/arrow/array/bufferbuilder.go | 127 -
go/arrow/array/bufferbuilder_byte.go | 30 -
go/arrow/array/bufferbuilder_numeric.gen.go | 58 -
go/arrow/array/bufferbuilder_numeric.gen.go.tmpl | 61 -
go/arrow/array/bufferbuilder_numeric_test.go | 106 -
go/arrow/array/builder.go | 289 -
go/arrow/array/builder_test.go | 83 -
go/arrow/array/compare.go | 474 -
go/arrow/array/compare_test.go | 531 -
go/arrow/array/data.go | 179 -
go/arrow/array/data_test.go | 51 -
go/arrow/array/decimal128.go | 235 -
go/arrow/array/decimal128_test.go | 179 -
go/arrow/array/doc.go | 20 -
go/arrow/array/fixed_size_list.go | 240 -
go/arrow/array/fixed_size_list_test.go | 215 -
go/arrow/array/fixedsize_binary.go | 95 -
go/arrow/array/fixedsize_binary_test.go | 111 -
go/arrow/array/fixedsize_binarybuilder.go | 154 -
go/arrow/array/fixedsize_binarybuilder_test.go | 107 -
go/arrow/array/float16.go | 87 -
go/arrow/array/float16_builder.go | 165 -
go/arrow/array/float16_builder_test.go | 119 -
go/arrow/array/interval.go | 434 -
go/arrow/array/interval_test.go | 276 -
go/arrow/array/list.go | 269 -
go/arrow/array/list_test.go | 213 -
go/arrow/array/null.go | 140 -
go/arrow/array/null_test.go | 77 -
go/arrow/array/numeric.gen.go | 1098 --
go/arrow/array/numeric.gen.go.tmpl | 95 -
go/arrow/array/numeric_test.go | 616 --
go/arrow/array/numericbuilder.gen.go | 2227 ----
go/arrow/array/numericbuilder.gen.go.tmpl | 182 -
go/arrow/array/numericbuilder.gen_test.go | 2700 -----
go/arrow/array/numericbuilder.gen_test.go.tmpl | 216 -
go/arrow/array/record.go | 345 -
go/arrow/array/record_test.go | 709 --
go/arrow/array/string.go | 205 -
go/arrow/array/string_test.go | 183 -
go/arrow/array/struct.go | 278 -
go/arrow/array/struct_test.go | 409 -
go/arrow/array/table.go | 455 -
go/arrow/array/table_test.go | 747 --
go/arrow/array/util.go | 24 -
go/arrow/arrio/arrio.go | 91 -
go/arrow/arrio/arrio_test.go | 205 -
go/arrow/bitutil/bitutil.go | 159 -
go/arrow/bitutil/bitutil_test.go | 287 -
go/arrow/compare.go | 79 -
go/arrow/compare_test.go | 286 -
go/arrow/csv/common.go | 174 -
go/arrow/csv/reader.go | 531 -
go/arrow/csv/reader_test.go | 604 -
go/arrow/csv/testdata/header.csv | 21 -
go/arrow/csv/testdata/simple.csv | 28 -
go/arrow/csv/testdata/types.csv | 21 -
go/arrow/csv/writer.go | 218 -
go/arrow/csv/writer_test.go | 274 -
go/arrow/datatype.go | 143 -
go/arrow/datatype_binary.go | 41 -
go/arrow/datatype_binary_test.go | 53 -
go/arrow/datatype_fixedwidth.go | 213 -
go/arrow/datatype_fixedwidth_test.go | 297 -
go/arrow/datatype_nested.go | 180 -
go/arrow/datatype_nested_test.go | 356 -
go/arrow/datatype_null.go | 29 -
go/arrow/datatype_null_test.go | 38 -
go/arrow/datatype_numeric.gen.go | 134 -
go/arrow/datatype_numeric.gen.go.tmpl | 40 -
go/arrow/datatype_numeric.gen.go.tmpldata | 66 -
go/arrow/decimal128/decimal128.go | 73 -
go/arrow/decimal128/decimal128_test.go | 94 -
go/arrow/doc.go | 39 -
go/arrow/endian/big.go | 25 -
go/arrow/endian/little.go | 25 -
go/arrow/example_test.go | 595 -
go/arrow/flight/Flight.pb.go | 1473 ---
go/arrow/flight/Flight_grpc.pb.go | 877 --
go/arrow/flight/basic_auth_flight_test.go | 205 -
go/arrow/flight/client.go | 129 -
go/arrow/flight/client_auth.go | 91 -
go/arrow/flight/example_flight_server_test.go | 86 -
go/arrow/flight/flight_test.go | 313 -
go/arrow/flight/gen.go | 19 -
go/arrow/flight/record_batch_reader.go | 87 -
go/arrow/flight/record_batch_writer.go | 72 -
go/arrow/flight/server.go | 118 -
go/arrow/flight/server_auth.go | 229 -
go/arrow/float16/float16.go | 70 -
go/arrow/float16/float16_test.go | 45 -
go/arrow/gen-flatbuffers.go | 122 -
go/arrow/go.mod | 38 -
go/arrow/go.sum | 110 -
go/arrow/internal/arrdata/arrdata.go | 1189 --
go/arrow/internal/arrdata/ioutil.go | 274 -
go/arrow/internal/arrjson/arrjson.go | 1501 ---
go/arrow/internal/arrjson/arrjson_test.go | 3104 ------
go/arrow/internal/arrjson/option.go | 57 -
go/arrow/internal/arrjson/reader.go | 100 -
go/arrow/internal/arrjson/writer.go | 116 -
go/arrow/internal/cpu/README.md | 42 -
go/arrow/internal/cpu/cpu.go | 77 -
go/arrow/internal/cpu/cpu_s390x.go | 7 -
go/arrow/internal/cpu/cpu_test.go | 51 -
go/arrow/internal/cpu/cpu_x86.go | 107 -
go/arrow/internal/cpu/cpu_x86.s | 32 -
go/arrow/internal/debug/assert_off.go | 24 -
go/arrow/internal/debug/assert_on.go | 28 -
go/arrow/internal/debug/doc.go | 32 -
go/arrow/internal/debug/log_off.go | 21 -
go/arrow/internal/debug/log_on.go | 32 -
go/arrow/internal/debug/util.go | 37 -
go/arrow/internal/flatbuf/Binary.go | 51 -
go/arrow/internal/flatbuf/Block.go | 74 -
go/arrow/internal/flatbuf/BodyCompression.go | 87 -
go/arrow/internal/flatbuf/BodyCompressionMethod.go | 52 -
go/arrow/internal/flatbuf/Bool.go | 50 -
go/arrow/internal/flatbuf/Buffer.go | 73 -
go/arrow/internal/flatbuf/CompressionType.go | 45 -
go/arrow/internal/flatbuf/Date.go | 71 -
go/arrow/internal/flatbuf/DateUnit.go | 45 -
go/arrow/internal/flatbuf/Decimal.go | 107 -
go/arrow/internal/flatbuf/DictionaryBatch.go | 108 -
go/arrow/internal/flatbuf/DictionaryEncoding.go | 135 -
go/arrow/internal/flatbuf/DictionaryKind.go | 47 -
go/arrow/internal/flatbuf/Duration.go | 65 -
go/arrow/internal/flatbuf/Endianness.go | 47 -
go/arrow/internal/flatbuf/Feature.go | 71 -
go/arrow/internal/flatbuf/Field.go | 188 -
go/arrow/internal/flatbuf/FieldNode.go | 76 -
go/arrow/internal/flatbuf/FixedSizeBinary.go | 67 -
go/arrow/internal/flatbuf/FixedSizeList.go | 67 -
go/arrow/internal/flatbuf/FloatingPoint.go | 65 -
go/arrow/internal/flatbuf/Footer.go | 162 -
go/arrow/internal/flatbuf/Int.go | 80 -
go/arrow/internal/flatbuf/Interval.go | 65 -
go/arrow/internal/flatbuf/IntervalUnit.go | 45 -
go/arrow/internal/flatbuf/KeyValue.go | 75 -
go/arrow/internal/flatbuf/LargeBinary.go | 52 -
go/arrow/internal/flatbuf/LargeList.go | 52 -
go/arrow/internal/flatbuf/LargeUtf8.go | 52 -
go/arrow/internal/flatbuf/List.go | 50 -
go/arrow/internal/flatbuf/Map.go | 92 -
go/arrow/internal/flatbuf/Message.go | 133 -
go/arrow/internal/flatbuf/MessageHeader.go | 65 -
go/arrow/internal/flatbuf/MetadataVersion.go | 65 -
go/arrow/internal/flatbuf/Null.go | 51 -
go/arrow/internal/flatbuf/Precision.go | 48 -
go/arrow/internal/flatbuf/RecordBatch.go | 154 -
go/arrow/internal/flatbuf/Schema.go | 159 -
.../internal/flatbuf/SparseMatrixCompressedAxis.go | 45 -
go/arrow/internal/flatbuf/SparseMatrixIndexCSR.go | 181 -
go/arrow/internal/flatbuf/SparseMatrixIndexCSX.go | 200 -
go/arrow/internal/flatbuf/SparseTensor.go | 175 -
go/arrow/internal/flatbuf/SparseTensorIndex.go | 51 -
go/arrow/internal/flatbuf/SparseTensorIndexCOO.go | 179 -
go/arrow/internal/flatbuf/SparseTensorIndexCSF.go | 291 -
go/arrow/internal/flatbuf/Struct_.go | 53 -
go/arrow/internal/flatbuf/Tensor.go | 163 -
go/arrow/internal/flatbuf/TensorDim.go | 83 -
go/arrow/internal/flatbuf/Time.go | 83 -
go/arrow/internal/flatbuf/TimeUnit.go | 51 -
go/arrow/internal/flatbuf/Timestamp.go | 122 -
go/arrow/internal/flatbuf/Type.go | 108 -
go/arrow/internal/flatbuf/Union.go | 101 -
go/arrow/internal/flatbuf/UnionMode.go | 45 -
go/arrow/internal/flatbuf/Utf8.go | 51 -
go/arrow/internal/testing/tools/bits.go | 40 -
go/arrow/internal/testing/tools/bits_test.go | 42 -
go/arrow/internal/testing/tools/bool.go | 25 -
go/arrow/ipc/cmd/arrow-cat/main.go | 216 -
go/arrow/ipc/cmd/arrow-cat/main_test.go | 582 -
go/arrow/ipc/cmd/arrow-file-to-stream/main.go | 83 -
go/arrow/ipc/cmd/arrow-file-to-stream/main_test.go | 73 -
.../ipc/cmd/arrow-json-integration-test/main.go | 226 -
.../cmd/arrow-json-integration-test/main_test.go | 94 -
go/arrow/ipc/cmd/arrow-ls/main.go | 201 -
go/arrow/ipc/cmd/arrow-ls/main_test.go | 341 -
go/arrow/ipc/cmd/arrow-stream-to-file/main.go | 71 -
go/arrow/ipc/cmd/arrow-stream-to-file/main_test.go | 82 -
go/arrow/ipc/compression.go | 109 -
go/arrow/ipc/dict.go | 85 -
go/arrow/ipc/dict_test.go | 196 -
go/arrow/ipc/file_reader.go | 615 --
go/arrow/ipc/file_test.go | 83 -
go/arrow/ipc/file_writer.go | 376 -
go/arrow/ipc/ipc.go | 144 -
go/arrow/ipc/message.go | 241 -
go/arrow/ipc/metadata.go | 1073 --
go/arrow/ipc/metadata_test.go | 159 -
go/arrow/ipc/reader.go | 209 -
go/arrow/ipc/stream_test.go | 111 -
go/arrow/ipc/writer.go | 565 -
go/arrow/math/Makefile | 90 -
go/arrow/math/_lib/.gitignore | 18 -
go/arrow/math/_lib/CMakeLists.txt | 22 -
go/arrow/math/_lib/arch.h | 27 -
go/arrow/math/_lib/float64.c | 26 -
go/arrow/math/_lib/float64_avx2.s | 176 -
go/arrow/math/_lib/float64_sse4.s | 103 -
go/arrow/math/_lib/int64.c | 27 -
go/arrow/math/_lib/int64_avx2.s | 181 -
go/arrow/math/_lib/int64_sse4.s | 108 -
go/arrow/math/_lib/uint64.c | 27 -
go/arrow/math/_lib/uint64_avx2.s | 181 -
go/arrow/math/_lib/uint64_sse4.s | 108 -
go/arrow/math/doc.go | 30 -
go/arrow/math/float64.go | 47 -
go/arrow/math/float64.tmpldata | 4 -
go/arrow/math/float64_amd64.go | 33 -
go/arrow/math/float64_avx2_amd64.go | 41 -
go/arrow/math/float64_avx2_amd64.s | 167 -
go/arrow/math/float64_noasm.go | 25 -
go/arrow/math/float64_s390x.go | 25 -
go/arrow/math/float64_sse4_amd64.go | 41 -
go/arrow/math/float64_sse4_amd64.s | 94 -
go/arrow/math/float64_test.go | 86 -
go/arrow/math/int64.go | 47 -
go/arrow/math/int64.tmpldata | 4 -
go/arrow/math/int64_amd64.go | 33 -
go/arrow/math/int64_avx2_amd64.go | 41 -
go/arrow/math/int64_avx2_amd64.s | 173 -
go/arrow/math/int64_noasm.go | 25 -
go/arrow/math/int64_s390x.go | 25 -
go/arrow/math/int64_sse4_amd64.go | 41 -
go/arrow/math/int64_sse4_amd64.s | 100 -
go/arrow/math/int64_test.go | 86 -
go/arrow/math/math_amd64.go | 51 -
go/arrow/math/math_noasm.go | 29 -
go/arrow/math/math_s390x.go | 29 -
go/arrow/math/type.go.tmpl | 48 -
go/arrow/math/type_amd64.go.tmpl | 33 -
go/arrow/math/type_noasm.go.tmpl | 25 -
go/arrow/math/type_s390x.go.tmpl | 25 -
go/arrow/math/type_simd_amd64.go.tmpl | 42 -
go/arrow/math/type_test.go.tmpl | 87 -
go/arrow/math/uint64.go | 47 -
go/arrow/math/uint64.tmpldata | 4 -
go/arrow/math/uint64_amd64.go | 33 -
go/arrow/math/uint64_avx2_amd64.go | 41 -
go/arrow/math/uint64_avx2_amd64.s | 173 -
go/arrow/math/uint64_noasm.go | 25 -
go/arrow/math/uint64_s390x.go | 25 -
go/arrow/math/uint64_sse4_amd64.go | 41 -
go/arrow/math/uint64_sse4_amd64.s | 100 -
go/arrow/math/uint64_test.go | 86 -
go/arrow/memory/Makefile | 54 -
go/arrow/memory/_lib/.gitignore | 18 -
go/arrow/memory/_lib/CMakeLists.txt | 22 -
go/arrow/memory/_lib/arch.h | 27 -
go/arrow/memory/_lib/memory.c | 27 -
go/arrow/memory/_lib/memory_avx2.s | 97 -
go/arrow/memory/_lib/memory_sse4.s | 96 -
go/arrow/memory/allocator.go | 33 -
go/arrow/memory/buffer.go | 125 -
go/arrow/memory/buffer_test.go | 57 -
go/arrow/memory/checked_allocator.go | 74 -
go/arrow/memory/doc.go | 20 -
go/arrow/memory/go_allocator.go | 48 -
go/arrow/memory/go_allocator_test.go | 76 -
go/arrow/memory/memory.go | 33 -
go/arrow/memory/memory_amd64.go | 33 -
go/arrow/memory/memory_avx2_amd64.go | 41 -
go/arrow/memory/memory_avx2_amd64.s | 85 -
go/arrow/memory/memory_js_wasm.go | 23 -
go/arrow/memory/memory_noasm.go | 23 -
go/arrow/memory/memory_sse4_amd64.go | 31 -
go/arrow/memory/memory_sse4_amd64.s | 84 -
go/arrow/memory/memory_test.go | 125 -
go/arrow/memory/util.go | 37 -
go/arrow/memory/util_test.go | 61 -
go/arrow/numeric.schema.json | 15 -
go/arrow/numeric.tmpldata | 141 -
go/arrow/schema.go | 193 -
go/arrow/schema_test.go | 363 -
go/arrow/tensor/numeric.gen.go | 327 -
go/arrow/tensor/numeric.gen.go.tmpl | 55 -
go/arrow/tensor/numeric.gen_test.go | 1170 --
go/arrow/tensor/numeric.gen_test.go.tmpl | 126 -
go/arrow/tensor/tensor.go | 247 -
go/arrow/tensor/tensor_test.go | 166 -
go/arrow/type_string.go | 53 -
go/arrow/type_traits_boolean.go | 28 -
go/arrow/type_traits_decimal128.go | 75 -
go/arrow/type_traits_float16.go | 74 -
go/arrow/type_traits_interval.go | 126 -
go/arrow/type_traits_numeric.gen.go | 814 --
go/arrow/type_traits_numeric.gen.go.tmpl | 95 -
go/arrow/type_traits_numeric.gen_test.go | 570 -
go/arrow/type_traits_numeric.gen_test.go.tmpl | 61 -
go/arrow/type_traits_test.go | 201 -
go/parquet/.gitignore | 31 -
go/parquet/LICENSE.txt | 1987 ----
go/parquet/compress/brotli.go | 115 -
go/parquet/compress/compress.go | 156 -
go/parquet/compress/compress_test.go | 138 -
go/parquet/compress/gzip.go | 98 -
go/parquet/compress/snappy.go | 62 -
go/parquet/compress/zstd.go | 112 -
go/parquet/doc.go | 68 -
go/parquet/encryption_properties.go | 711 --
go/parquet/encryption_properties_test.go | 217 -
go/parquet/go.mod | 35 -
go/parquet/go.sum | 155 -
go/parquet/internal/bmi/Makefile | 47 -
go/parquet/internal/bmi/_lib/bitmap_bmi2.c | 30 -
go/parquet/internal/bmi/_lib/bitmap_bmi2.s | 140 -
go/parquet/internal/bmi/bitmap_bmi2.go | 48 -
go/parquet/internal/bmi/bitmap_bmi2.s | 117 -
go/parquet/internal/bmi/bmi_init.go | 60 -
go/parquet/internal/bmi/bmi_noasm.go | 249 -
go/parquet/internal/debug/assert_off.go | 24 -
go/parquet/internal/debug/assert_on.go | 28 -
go/parquet/internal/debug/doc.go | 23 -
go/parquet/internal/encryption/aes.go | 264 -
go/parquet/internal/encryption/decryptor.go | 261 -
go/parquet/internal/encryption/encryptor.go | 237 -
go/parquet/internal/encryption/key_handling.go | 62 -
.../gen-go/parquet/GoUnusedProtection__.go | 6 -
.../internal/gen-go/parquet/parquet-consts.go | 23 -
go/parquet/internal/gen-go/parquet/parquet.go | 10961 -------------------
.../internal/gen-go/parquet/staticcheck.conf | 17 -
go/parquet/internal/testutils/random.go | 452 -
go/parquet/internal/testutils/random_arrow.go | 488 -
go/parquet/internal/thrift/helpers.go | 87 -
go/parquet/internal/utils/Makefile | 72 -
go/parquet/internal/utils/_lib/arch.h | 27 -
go/parquet/internal/utils/_lib/bit_packing_avx2.c | 1879 ----
go/parquet/internal/utils/_lib/bit_packing_avx2.s | 4012 -------
go/parquet/internal/utils/_lib/min_max.c | 73 -
go/parquet/internal/utils/_lib/min_max_avx2.s | 1366 ---
go/parquet/internal/utils/_lib/min_max_sse4.s | 613 --
go/parquet/internal/utils/_lib/unpack_bool.c | 30 -
go/parquet/internal/utils/_lib/unpack_bool_avx2.s | 6293 -----------
go/parquet/internal/utils/_lib/unpack_bool_sse4.s | 104 -
go/parquet/internal/utils/bit_benchmark_test.go | 220 -
go/parquet/internal/utils/bit_block_counter.go | 263 -
.../internal/utils/bit_block_counter_test.go | 201 -
go/parquet/internal/utils/bit_packing.go | 35 -
go/parquet/internal/utils/bit_packing_avx2.go | 53 -
go/parquet/internal/utils/bit_packing_avx2.s | 3439 ------
go/parquet/internal/utils/bit_packing_default.go | 1941 ----
go/parquet/internal/utils/bit_packing_noasm.go | 23 -
go/parquet/internal/utils/bit_reader.go | 348 -
go/parquet/internal/utils/bit_reader_test.go | 619 --
go/parquet/internal/utils/bit_run_reader.go | 148 -
go/parquet/internal/utils/bit_run_reader_test.go | 158 -
go/parquet/internal/utils/bit_set_run_reader.go | 345 -
.../internal/utils/bit_set_run_reader_test.go | 276 -
go/parquet/internal/utils/bit_writer.go | 182 -
go/parquet/internal/utils/bitmap_reader.go | 72 -
go/parquet/internal/utils/bitmap_reader_test.go | 75 -
go/parquet/internal/utils/bitmap_writer.go | 277 -
go/parquet/internal/utils/bitmap_writer_test.go | 304 -
go/parquet/internal/utils/clib_amd64.s | 87 -
go/parquet/internal/utils/dictionary.go | 87 -
go/parquet/internal/utils/math.go | 49 -
go/parquet/internal/utils/min_max.go | 120 -
go/parquet/internal/utils/min_max_amd64.go | 43 -
go/parquet/internal/utils/min_max_avx2.go | 58 -
go/parquet/internal/utils/min_max_avx2.s | 1352 ---
go/parquet/internal/utils/min_max_noasm.go | 27 -
go/parquet/internal/utils/min_max_sse4.go | 56 -
go/parquet/internal/utils/min_max_sse4.s | 592 -
go/parquet/internal/utils/physical_types.tmpldata | 52 -
go/parquet/internal/utils/rle.go | 583 -
go/parquet/internal/utils/typed_rle_dict.gen.go | 1375 ---
.../internal/utils/typed_rle_dict.gen.go.tmpl | 218 -
go/parquet/internal/utils/unpack_bool.go | 26 -
go/parquet/internal/utils/unpack_bool_amd64.go | 41 -
go/parquet/internal/utils/unpack_bool_avx2.go | 29 -
go/parquet/internal/utils/unpack_bool_avx2.s | 6961 ------------
go/parquet/internal/utils/unpack_bool_noasm.go | 25 -
go/parquet/internal/utils/unpack_bool_sse4.go | 29 -
go/parquet/internal/utils/unpack_bool_sse4.s | 88 -
go/parquet/internal/utils/write_utils.go | 57 -
go/parquet/reader_properties.go | 79 -
go/parquet/reader_writer_properties_test.go | 69 -
go/parquet/tools.go | 25 -
go/parquet/types.go | 354 -
go/parquet/writer_properties.go | 510 -
402 files changed, 111043 deletions(-)
diff --git a/go/README.md b/go/README.md
deleted file mode 100644
index 6bf8438..0000000
--- a/go/README.md
+++ /dev/null
@@ -1,124 +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.
--->
-
-Apache Arrow for Go
-===================
-
-[![GoDoc](https://godoc.org/github.com/apache/arrow/go/arrow?status.svg)](https://godoc.org/github.com/apache/arrow/go/arrow)
-
-[Apache Arrow][arrow] is a cross-language development platform for in-memory
-data. It specifies a standardized language-independent columnar memory format
-for flat and hierarchical data, organized for efficient analytic operations on
-modern hardware. It also provides computational libraries and zero-copy
-streaming messaging and inter-process communication.
-
-
-Reference Counting
-------------------
-
-The library makes use of reference counting so that it can track when memory
-buffers are no longer used. This allows Arrow to update resource accounting,
-pool memory such and track overall memory usage as objects are created and
-released. Types expose two methods to deal with this pattern. The `Retain`
-method will increase the reference count by 1 and `Release` method will reduce
-the count by 1. Once the reference count of an object is zero, any associated
-object will be freed. `Retain` and `Release` are safe to call from multiple
-goroutines.
-
-### When to call `Retain` / `Release`?
-
-* If you are passed an object and wish to take ownership of it, you must call
- `Retain`. You must later pair this with a call to `Release` when you no
- longer need the object. "Taking ownership" typically means you wish to
- access the object outside the scope of the current function call.
-
-* You own any object you create via functions whose name begins with `New` or
- `Copy` or when receiving an object over a channel. Therefore you must call
- `Release` once you no longer need the object.
-
-* If you send an object over a channel, you must call `Retain` before sending
- it as the receiver is assumed to own the object and will later call `Release`
- when it no longer needs the object.
-
-Performance
------------
-
-The arrow package makes extensive use of [c2goasm][] to leverage LLVM's
-advanced optimizer and generate PLAN9 assembly functions from C/C++ code. The
-arrow package can be compiled without these optimizations using the `noasm`
-build tag. Alternatively, by configuring an environment variable, it is
-possible to dynamically configure which architecture optimizations are used at
-runtime. See the `cpu` package [README](arrow/internal/cpu/README.md) for a
-description of this environment variable.
-
-### Example Usage
-
-The following benchmarks demonstrate summing an array of 8192 values using
-various optimizations.
-
-Disable no architecture optimizations (thus using AVX2):
-
-```sh
-$ INTEL_DISABLE_EXT=NONE go test -bench=8192 -run=. ./math
-goos: darwin
-goarch: amd64
-pkg: github.com/apache/arrow/go/arrow/math
-BenchmarkFloat64Funcs_Sum_8192-8 2000000 687 ns/op 95375.41 MB/s
-BenchmarkInt64Funcs_Sum_8192-8 2000000 719 ns/op 91061.06 MB/s
-BenchmarkUint64Funcs_Sum_8192-8 2000000 691 ns/op 94797.29 MB/s
-PASS
-ok github.com/apache/arrow/go/arrow/math 6.444s
-```
-
-**NOTE:** `NONE` is simply ignored, thus enabling optimizations for AVX2 and SSE4
-
-----
-
-Disable AVX2 architecture optimizations:
-
-```sh
-$ INTEL_DISABLE_EXT=AVX2 go test -bench=8192 -run=. ./math
-goos: darwin
-goarch: amd64
-pkg: github.com/apache/arrow/go/arrow/math
-BenchmarkFloat64Funcs_Sum_8192-8 1000000 1912 ns/op 34263.63 MB/s
-BenchmarkInt64Funcs_Sum_8192-8 1000000 1392 ns/op 47065.57 MB/s
-BenchmarkUint64Funcs_Sum_8192-8 1000000 1405 ns/op 46636.41 MB/s
-PASS
-ok github.com/apache/arrow/go/arrow/math 4.786s
-```
-
-----
-
-Disable ALL architecture optimizations, thus using pure Go implementation:
-
-```sh
-$ INTEL_DISABLE_EXT=ALL go test -bench=8192 -run=. ./math
-goos: darwin
-goarch: amd64
-pkg: github.com/apache/arrow/go/arrow/math
-BenchmarkFloat64Funcs_Sum_8192-8 200000 10285 ns/op 6371.41 MB/s
-BenchmarkInt64Funcs_Sum_8192-8 500000 3892 ns/op 16837.37 MB/s
-BenchmarkUint64Funcs_Sum_8192-8 500000 3929 ns/op 16680.00 MB/s
-PASS
-ok github.com/apache/arrow/go/arrow/math 6.179s
-```
-
-[arrow]: https://arrow.apache.org
-[c2goasm]: https://github.com/minio/c2goasm
diff --git a/go/arrow/.editorconfig b/go/arrow/.editorconfig
deleted file mode 100644
index a7ceaf9..0000000
--- a/go/arrow/.editorconfig
+++ /dev/null
@@ -1,21 +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.
-
-root = true
-
-[*.tmpl]
-indent_style = tab
-indent_size = 4
\ No newline at end of file
diff --git a/go/arrow/.gitignore b/go/arrow/.gitignore
deleted file mode 100644
index d4b831a..0000000
--- a/go/arrow/.gitignore
+++ /dev/null
@@ -1,35 +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.
-
-### Go template
-# Binaries for programs and plugins
-*.exe
-*.dll
-*.so
-*.dylib
-*.o
-
-# Test binary, build with `go test -c`
-*.test
-
-# Output of the go coverage tool, specifically when used with LiteIDE
-*.out
-
-# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
-.glide/
-
-bin/
-vendor/
\ No newline at end of file
diff --git a/go/arrow/Gopkg.lock b/go/arrow/Gopkg.lock
deleted file mode 100644
index 143e4f9..0000000
--- a/go/arrow/Gopkg.lock
+++ /dev/null
@@ -1,44 +0,0 @@
-# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
-
-
-[[projects]]
- digest = "1:56c130d885a4aacae1dd9c7b71cfe39912c7ebc1ff7d2b46083c8812996dc43b"
- name = "github.com/davecgh/go-spew"
- packages = ["spew"]
- pruneopts = ""
- revision = "346938d642f2ec3594ed81d874461961cd0faa76"
- version = "v1.1.0"
-
-[[projects]]
- digest = "1:1d7e1867c49a6dd9856598ef7c3123604ea3daabf5b83f303ff457bcbc410b1d"
- name = "github.com/pkg/errors"
- packages = ["."]
- pruneopts = ""
- revision = "ba968bfe8b2f7e042a574c888954fccecfa385b4"
- version = "v0.8.1"
-
-[[projects]]
- digest = "1:256484dbbcd271f9ecebc6795b2df8cad4c458dd0f5fd82a8c2fa0c29f233411"
- name = "github.com/pmezard/go-difflib"
- packages = ["difflib"]
- pruneopts = ""
- revision = "792786c7400a136282c1664665ae0a8db921c6c2"
- version = "v1.0.0"
-
-[[projects]]
- digest = "1:2d0dc026c4aef5e2f3a0e06a4dabe268b840d8f63190cf6894e02134a03f52c5"
- name = "github.com/stretchr/testify"
- packages = ["assert"]
- pruneopts = ""
- revision = "b91bfb9ebec76498946beb6af7c0230c7cc7ba6c"
- version = "v1.2.0"
-
-[solve-meta]
- analyzer-name = "dep"
- analyzer-version = 1
- input-imports = [
- "github.com/pkg/errors",
- "github.com/stretchr/testify/assert",
- ]
- solver-name = "gps-cdcl"
- solver-version = 1
diff --git a/go/arrow/Gopkg.toml b/go/arrow/Gopkg.toml
deleted file mode 100644
index b27807d..0000000
--- a/go/arrow/Gopkg.toml
+++ /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.
-
-[[constraint]]
- name = "github.com/stretchr/testify"
- version = "1.2.0"
-
-[[constraint]]
- name = "github.com/pkg/errors"
- version = "0.8.1"
\ No newline at end of file
diff --git a/go/arrow/LICENSE.txt b/go/arrow/LICENSE.txt
deleted file mode 100644
index 6884e08..0000000
--- a/go/arrow/LICENSE.txt
+++ /dev/null
@@ -1,1987 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
-
---------------------------------------------------------------------------------
-
-src/plasma/fling.cc and src/plasma/fling.h: Apache 2.0
-
-Copyright 2013 Sharvil Nanavati
-
-Licensed 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.
-
---------------------------------------------------------------------------------
-
-src/plasma/thirdparty/ae: Modified / 3-Clause BSD
-
-Copyright (c) 2006-2010, Salvatore Sanfilippo <antirez at gmail dot com>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Redis nor the names of its contributors may be used
- to endorse or promote products derived from this software without
- specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
-
-src/plasma/thirdparty/dlmalloc.c: CC0
-
-This is a version (aka dlmalloc) of malloc/free/realloc written by
-Doug Lea and released to the public domain, as explained at
-http://creativecommons.org/publicdomain/zero/1.0/ Send questions,
-comments, complaints, performance data, etc to dl@cs.oswego.edu
-
---------------------------------------------------------------------------------
-
-src/plasma/common.cc (some portions)
-
-Copyright (c) Austin Appleby (aappleby (AT) gmail)
-
-Some portions of this file are derived from code in the MurmurHash project
-
-All code is released to the public domain. For business purposes, Murmurhash is
-under the MIT license.
-
-https://sites.google.com/site/murmurhash/
-
---------------------------------------------------------------------------------
-
-src/arrow/util (some portions): Apache 2.0, and 3-clause BSD
-
-Some portions of this module are derived from code in the Chromium project,
-copyright (c) Google inc and (c) The Chromium Authors and licensed under the
-Apache 2.0 License or the under the 3-clause BSD license:
-
- Copyright (c) 2013 The Chromium Authors. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following disclaimer
- in the documentation and/or other materials provided with the
- distribution.
- * Neither the name of Google Inc. nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
-
-This project includes code from Daniel Lemire's FrameOfReference project.
-
-https://github.com/lemire/FrameOfReference/blob/6ccaf9e97160f9a3b299e23a8ef739e711ef0c71/src/bpacking.cpp
-
-Copyright: 2013 Daniel Lemire
-Home page: http://lemire.me/en/
-Project page: https://github.com/lemire/FrameOfReference
-License: Apache License Version 2.0 http://www.apache.org/licenses/LICENSE-2.0
-
---------------------------------------------------------------------------------
-
-This project includes code from the TensorFlow project
-
-Copyright 2015 The TensorFlow Authors. All Rights Reserved.
-
-Licensed 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.
-
---------------------------------------------------------------------------------
-
-This project includes code from the NumPy project.
-
-https://github.com/numpy/numpy/blob/e1f191c46f2eebd6cb892a4bfe14d9dd43a06c4e/numpy/core/src/multiarray/multiarraymodule.c#L2910
-
-https://github.com/numpy/numpy/blob/68fd82271b9ea5a9e50d4e761061dfcca851382a/numpy/core/src/multiarray/datetime.c
-
-Copyright (c) 2005-2017, NumPy Developers.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-
- * Neither the name of the NumPy Developers nor the names of any
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
-
-This project includes code from the Boost project
-
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-
---------------------------------------------------------------------------------
-
-This project includes code from the FlatBuffers project
-
-Copyright 2014 Google Inc.
-
-Licensed 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.
-
---------------------------------------------------------------------------------
-
-This project includes code from the tslib project
-
-Copyright 2015 Microsoft Corporation. All rights reserved.
-
-Licensed 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.
-
---------------------------------------------------------------------------------
-
-This project includes code from the jemalloc project
-
-https://github.com/jemalloc/jemalloc
-
-Copyright (C) 2002-2017 Jason Evans <ja...@canonware.com>.
-All rights reserved.
-Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved.
-Copyright (C) 2009-2017 Facebook, Inc. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-1. Redistributions of source code must retain the above copyright notice(s),
- this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright notice(s),
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
-OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------------
-
-This project includes code from the Go project, BSD 3-clause license + PATENTS
-weak patent termination clause
-(https://github.com/golang/go/blob/master/PATENTS).
-
-Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
-
-This project includes code from the hs2client
-
-https://github.com/cloudera/hs2client
-
-Copyright 2016 Cloudera Inc.
-
-Licensed 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.
-
---------------------------------------------------------------------------------
-
-The script ci/scripts/util_wait_for_it.sh has the following license
-
-Copyright (c) 2016 Giles Hall
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
---------------------------------------------------------------------------------
-
-The script r/configure has the following license (MIT)
-
-Copyright (c) 2017, Jeroen Ooms and Jim Hester
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
---------------------------------------------------------------------------------
-
-cpp/src/arrow/util/logging.cc, cpp/src/arrow/util/logging.h and
-cpp/src/arrow/util/logging-test.cc are adapted from
-Ray Project (https://github.com/ray-project/ray) (Apache 2.0).
-
-Copyright (c) 2016 Ray Project (https://github.com/ray-project/ray)
-
-Licensed 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.
-
---------------------------------------------------------------------------------
-The files cpp/src/arrow/vendored/datetime/date.h, cpp/src/arrow/vendored/datetime/tz.h,
-cpp/src/arrow/vendored/datetime/tz_private.h, cpp/src/arrow/vendored/datetime/ios.h,
-cpp/src/arrow/vendored/datetime/ios.mm,
-cpp/src/arrow/vendored/datetime/tz.cpp are adapted from
-Howard Hinnant's date library (https://github.com/HowardHinnant/date)
-It is licensed under MIT license.
-
-The MIT License (MIT)
-Copyright (c) 2015, 2016, 2017 Howard Hinnant
-Copyright (c) 2016 Adrian Colomitchi
-Copyright (c) 2017 Florian Dang
-Copyright (c) 2017 Paul Thompson
-Copyright (c) 2018 Tomasz Kamiński
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
---------------------------------------------------------------------------------
-
-The file cpp/src/arrow/util/utf8.h includes code adapted from the page
- https://bjoern.hoehrmann.de/utf-8/decoder/dfa/
-with the following license (MIT)
-
-Copyright (c) 2008-2009 Bjoern Hoehrmann <bj...@hoehrmann.de>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
---------------------------------------------------------------------------------
-
-The file cpp/src/arrow/vendored/string_view.hpp has the following license
-
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-
---------------------------------------------------------------------------------
-
-The files in cpp/src/arrow/vendored/xxhash/ have the following license
-(BSD 2-Clause License)
-
-xxHash Library
-Copyright (c) 2012-2014, Yann Collet
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice, this
- list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-You can contact the author at :
-- xxHash homepage: http://www.xxhash.com
-- xxHash source repository : https://github.com/Cyan4973/xxHash
-
---------------------------------------------------------------------------------
-
-The files in cpp/src/arrow/vendored/double-conversion/ have the following license
-(BSD 3-Clause License)
-
-Copyright 2006-2011, the V8 project authors. All rights reserved.
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of Google Inc. nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
-
-The files in cpp/src/arrow/vendored/uriparser/ have the following license
-(BSD 3-Clause License)
-
-uriparser - RFC 3986 URI parsing library
-
-Copyright (C) 2007, Weijia Song <so...@gmail.com>
-Copyright (C) 2007, Sebastian Pipping <se...@pipping.org>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
- * Redistributions of source code must retain the above
- copyright notice, this list of conditions and the following
- disclaimer.
-
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- * Neither the name of the <ORGANIZATION> nor the names of its
- contributors may be used to endorse or promote products
- derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
-
-The files under dev/tasks/conda-recipes have the following license
-
-BSD 3-clause license
-Copyright (c) 2015-2018, conda-forge
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-3. Neither the name of the copyright holder nor the names of its contributors
- may be used to endorse or promote products derived from this software without
- specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
-TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
-
-The files in cpp/src/arrow/vendored/utf8cpp/ have the following license
-
-Copyright 2006 Nemanja Trifunovic
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-
---------------------------------------------------------------------------------
-
-This project includes code from Apache Kudu.
-
- * cpp/cmake_modules/CompilerInfo.cmake is based on Kudu's cmake_modules/CompilerInfo.cmake
-
-Copyright: 2016 The Apache Software Foundation.
-Home page: https://kudu.apache.org/
-License: http://www.apache.org/licenses/LICENSE-2.0
-
---------------------------------------------------------------------------------
-
-This project includes code from Apache Impala (incubating), formerly
-Impala. The Impala code and rights were donated to the ASF as part of the
-Incubator process after the initial code imports into Apache Parquet.
-
-Copyright: 2012 Cloudera, Inc.
-Copyright: 2016 The Apache Software Foundation.
-Home page: http://impala.apache.org/
-License: http://www.apache.org/licenses/LICENSE-2.0
-
---------------------------------------------------------------------------------
-
-This project includes code from Apache Aurora.
-
-* dev/release/{release,changelog,release-candidate} are based on the scripts from
- Apache Aurora
-
-Copyright: 2016 The Apache Software Foundation.
-Home page: https://aurora.apache.org/
-License: http://www.apache.org/licenses/LICENSE-2.0
-
---------------------------------------------------------------------------------
-
-This project includes code from the Google styleguide.
-
-* cpp/build-support/cpplint.py is based on the scripts from the Google styleguide.
-
-Copyright: 2009 Google Inc. All rights reserved.
-Homepage: https://github.com/google/styleguide
-License: 3-clause BSD
-
---------------------------------------------------------------------------------
-
-This project includes code from Snappy.
-
-* cpp/cmake_modules/{SnappyCMakeLists.txt,SnappyConfig.h} are based on code
- from Google's Snappy project.
-
-Copyright: 2009 Google Inc. All rights reserved.
-Homepage: https://github.com/google/snappy
-License: 3-clause BSD
-
---------------------------------------------------------------------------------
-
-This project includes code from the manylinux project.
-
-* python/manylinux1/scripts/{build_python.sh,python-tag-abi-tag.py,
- requirements.txt} are based on code from the manylinux project.
-
-Copyright: 2016 manylinux
-Homepage: https://github.com/pypa/manylinux
-License: The MIT License (MIT)
-
---------------------------------------------------------------------------------
-
-This project includes code from the cymove project:
-
-* python/pyarrow/includes/common.pxd includes code from the cymove project
-
-The MIT License (MIT)
-Copyright (c) 2019 Omer Ozarslan
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
-OR OTHER DEALINGS IN THE SOFTWARE.
-
---------------------------------------------------------------------------------
-
-The projects includes code from the Ursabot project under the dev/archery
-directory.
-
-License: BSD 2-Clause
-
-Copyright 2019 RStudio, Inc.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
-
-This project include code from CMake.
-
-* cpp/cmake_modules/FindGTest.cmake is based on code from CMake.
-
-Copyright: Copyright 2000-2019 Kitware, Inc. and Contributors
-Homepage: https://gitlab.kitware.com/cmake/cmake
-License: 3-clause BSD
-
---------------------------------------------------------------------------------
-
-This project include code from mingw-w64.
-
-* cpp/src/arrow/util/cpu-info.cc has a polyfill for mingw-w64 < 5
-
-Copyright (c) 2009 - 2013 by the mingw-w64 project
-Homepage: https://mingw-w64.org
-License: Zope Public License (ZPL) Version 2.1.
-
----------------------------------------------------------------------------------
-
-This project include code from Google's Asylo project.
-
-* cpp/src/arrow/result.h is based on status_or.h
-
-Copyright (c) Copyright 2017 Asylo authors
-Homepage: https://asylo.dev/
-License: Apache 2.0
-
---------------------------------------------------------------------------------
-
-This project includes code from Google's protobuf project
-
-* cpp/src/arrow/result.h ARROW_ASSIGN_OR_RAISE is based off ASSIGN_OR_RETURN
-
-Copyright 2008 Google Inc. All rights reserved.
-Homepage: https://developers.google.com/protocol-buffers/
-License:
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Code generated by the Protocol Buffer compiler is owned by the owner
-of the input file used when generating it. This code is not
-standalone and requires a support library to be linked with it. This
-support library is itself covered by the above license.
-
---------------------------------------------------------------------------------
-
-3rdparty dependency LLVM is statically linked in certain binary distributions.
-Additionally some sections of source code have been derived from sources in LLVM
-and have been clearly labeled as such. LLVM has the following license:
-
-==============================================================================
-LLVM Release License
-==============================================================================
-University of Illinois/NCSA
-Open Source License
-
-Copyright (c) 2003-2018 University of Illinois at Urbana-Champaign.
-All rights reserved.
-
-Developed by:
-
- LLVM Team
-
- University of Illinois at Urbana-Champaign
-
- http://llvm.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal with
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimers.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimers in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the names of the LLVM Team, University of Illinois at
- Urbana-Champaign, nor the names of its contributors may be used to
- endorse or promote products derived from this Software without specific
- prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
-SOFTWARE.
-
-==============================================================================
-Copyrights and Licenses for Third Party Software Distributed with LLVM:
-==============================================================================
-The LLVM software contains code written by third parties. Such software will
-have its own individual LICENSE.TXT file in the directory in which it appears.
-This file will describe the copyrights, license, and restrictions which apply
-to that code.
-
-The disclaimer of warranty in the University of Illinois Open Source License
-applies to all code in the LLVM Distribution, and nothing in any of the
-other licenses gives permission to use the names of the LLVM Team or the
-University of Illinois to endorse or promote products derived from this
-Software.
-
-The following pieces of software have additional or alternate copyrights,
-licenses, and/or restrictions:
-
-Program Directory
-------- ---------
-Google Test llvm/utils/unittest/googletest
-OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}
-pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT}
-ARM contributions llvm/lib/Target/ARM/LICENSE.TXT
-md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h
-
---------------------------------------------------------------------------------
-
-3rdparty dependency gRPC is statically linked in certain binary
-distributions, like the python wheels. gRPC has the following license:
-
-Copyright 2014 gRPC authors.
-
-Licensed 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.
-
---------------------------------------------------------------------------------
-
-3rdparty dependency Apache Thrift is statically linked in certain binary
-distributions, like the python wheels. Apache Thrift has the following license:
-
-Apache Thrift
-Copyright (C) 2006 - 2019, The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-Licensed 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.
-
---------------------------------------------------------------------------------
-
-3rdparty dependency Apache ORC is statically linked in certain binary
-distributions, like the python wheels. Apache ORC has the following license:
-
-Apache ORC
-Copyright 2013-2019 The Apache Software Foundation
-
-This product includes software developed by The Apache Software
-Foundation (http://www.apache.org/).
-
-This product includes software developed by Hewlett-Packard:
-(c) Copyright [2014-2015] Hewlett-Packard Development Company, L.P
-
-Licensed 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.
-
---------------------------------------------------------------------------------
-
-3rdparty dependency zstd is statically linked in certain binary
-distributions, like the python wheels. ZSTD has the following license:
-
-BSD License
-
-For Zstandard software
-
-Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- * Neither the name Facebook nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific
- prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
-
-3rdparty dependency lz4 is statically linked in certain binary
-distributions, like the python wheels. lz4 has the following license:
-
-LZ4 Library
-Copyright (c) 2011-2016, Yann Collet
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice, this
- list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
-
-3rdparty dependency Brotli is statically linked in certain binary
-distributions, like the python wheels. Brotli has the following license:
-
-Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
---------------------------------------------------------------------------------
-
-3rdparty dependency rapidjson is statically linked in certain binary
-distributions, like the python wheels. rapidjson and its dependencies have the
-following licenses:
-
-Tencent is pleased to support the open source community by making RapidJSON
-available.
-
-Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip.
-All rights reserved.
-
-If you have downloaded a copy of the RapidJSON binary from Tencent, please note
-that the RapidJSON binary is licensed under the MIT License.
-If you have downloaded a copy of the RapidJSON source code from Tencent, please
-note that RapidJSON source code is licensed under the MIT License, except for
-the third-party components listed below which are subject to different license
-terms. Your integration of RapidJSON into your own projects may require
-compliance with the MIT License, as well as the other licenses applicable to
-the third-party components included within RapidJSON. To avoid the problematic
-JSON license in your own projects, it's sufficient to exclude the
-bin/jsonchecker/ directory, as it's the only code under the JSON license.
-A copy of the MIT License is included in this file.
-
-Other dependencies and licenses:
-
- Open Source Software Licensed Under the BSD License:
- --------------------------------------------------------------------
-
- The msinttypes r29
- Copyright (c) 2006-2013 Alexander Chemeris
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name of copyright holder nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR
- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- DAMAGE.
-
- Open Source Software Licensed Under the JSON License:
- --------------------------------------------------------------------
-
- json.org
- Copyright (c) 2002 JSON.org
- All Rights Reserved.
-
- JSON_checker
- Copyright (c) 2002 JSON.org
- All Rights Reserved.
-
-
- Terms of the JSON License:
- ---------------------------------------------------
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- The Software shall be used for Good, not Evil.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
-
-
- Terms of the MIT License:
- --------------------------------------------------------------------
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
-
---------------------------------------------------------------------------------
-
-3rdparty dependency snappy is statically linked in certain binary
-distributions, like the python wheels. snappy has the following license:
-
-Copyright 2011, Google Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name of Google Inc. nor the names of its contributors may be
- used to endorse or promote products derived from this software without
- specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-===
-
-Some of the benchmark data in testdata/ is licensed differently:
-
- - fireworks.jpeg is Copyright 2013 Steinar H. Gunderson, and
- is licensed under the Creative Commons Attribution 3.0 license
- (CC-BY-3.0). See https://creativecommons.org/licenses/by/3.0/
- for more information.
-
- - kppkn.gtb is taken from the Gaviota chess tablebase set, and
- is licensed under the MIT License. See
- https://sites.google.com/site/gaviotachessengine/Home/endgame-tablebases-1
- for more information.
-
- - paper-100k.pdf is an excerpt (bytes 92160 to 194560) from the paper
- “Combinatorial Modeling of Chromatin Features Quantitatively Predicts DNA
- Replication Timing in _Drosophila_” by Federico Comoglio and Renato Paro,
- which is licensed under the CC-BY license. See
- http://www.ploscompbiol.org/static/license for more ifnormation.
-
- - alice29.txt, asyoulik.txt, plrabn12.txt and lcet10.txt are from Project
- Gutenberg. The first three have expired copyrights and are in the public
- domain; the latter does not have expired copyright, but is still in the
- public domain according to the license information
- (http://www.gutenberg.org/ebooks/53).
-
---------------------------------------------------------------------------------
-
-3rdparty dependency gflags is statically linked in certain binary
-distributions, like the python wheels. gflags has the following license:
-
-Copyright (c) 2006, Google Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
-
-3rdparty dependency glog is statically linked in certain binary
-distributions, like the python wheels. glog has the following license:
-
-Copyright (c) 2008, Google Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-A function gettimeofday in utilities.cc is based on
-
-http://www.google.com/codesearch/p?hl=en#dR3YEbitojA/COPYING&q=GetSystemTimeAsFileTime%20license:bsd
-
-The license of this code is:
-
-Copyright (c) 2003-2008, Jouni Malinen <j...@w1.fi> and contributors
-All Rights Reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-3. Neither the name(s) of the above-listed copyright holder(s) nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
-
-3rdparty dependency re2 is statically linked in certain binary
-distributions, like the python wheels. re2 has the following license:
-
-Copyright (c) 2009 The RE2 Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of Google Inc. nor the names of its contributors
- may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
-
-3rdparty dependency c-ares is statically linked in certain binary
-distributions, like the python wheels. c-ares has the following license:
-
-# c-ares license
-
-Copyright (c) 2007 - 2018, Daniel Stenberg with many contributors, see AUTHORS
-file.
-
-Copyright 1998 by the Massachusetts Institute of Technology.
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted, provided that
-the above copyright notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting documentation, and that
-the name of M.I.T. not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-M.I.T. makes no representations about the suitability of this software for any
-purpose. It is provided "as is" without express or implied warranty.
-
---------------------------------------------------------------------------------
-
-3rdparty dependency zlib is redistributed as a dynamically linked shared
-library in certain binary distributions, like the python wheels. In the future
-this will likely change to static linkage. zlib has the following license:
-
-zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.2.11, January 15th, 2017
-
- Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jean-loup Gailly Mark Adler
- jloup@gzip.org madler@alumni.caltech.edu
-
---------------------------------------------------------------------------------
-
-3rdparty dependency openssl is redistributed as a dynamically linked shared
-library in certain binary distributions, like the python wheels. openssl
-preceding version 3 has the following license:
-
- LICENSE ISSUES
- ==============
-
- The OpenSSL toolkit stays under a double license, i.e. both the conditions of
- the OpenSSL License and the original SSLeay license apply to the toolkit.
- See below for the actual license texts.
-
- OpenSSL License
- ---------------
-
-/* ====================================================================
- * Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core@openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- * This product includes cryptographic software written by Eric Young
- * (eay@cryptsoft.com). This product includes software written by Tim
- * Hudson (tjh@cryptsoft.com).
- *
- */
-
- Original SSLeay License
- -----------------------
-
-/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay@cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- *
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attribution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay@cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the library
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from
- * the apps directory (application code) you must include an acknowledgement:
- * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- *
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * The licence and distribution terms for any publically available version or
- * derivative of this code cannot be changed. i.e. this code cannot simply be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
---------------------------------------------------------------------------------
-
-This project includes code from the rtools-backports project.
-
-* ci/scripts/PKGBUILD and ci/scripts/r_windows_build.sh are based on code
- from the rtools-backports project.
-
-Copyright: Copyright (c) 2013 - 2019, Алексей and Jeroen Ooms.
-All rights reserved.
-Homepage: https://github.com/r-windows/rtools-backports
-License: 3-clause BSD
-
---------------------------------------------------------------------------------
-
-Some code from pandas has been adapted for the pyarrow codebase. pandas is
-available under the 3-clause BSD license, which follows:
-
-pandas license
-==============
-
-Copyright (c) 2011-2012, Lambda Foundry, Inc. and PyData Development Team
-All rights reserved.
-
-Copyright (c) 2008-2011 AQR Capital Management, LLC
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-
- * Neither the name of the copyright holder nor the names of any
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
-
-Some bits from DyND, in particular aspects of the build system, have been
-adapted from libdynd and dynd-python under the terms of the BSD 2-clause
-license
-
-The BSD 2-Clause License
-
- Copyright (C) 2011-12, Dynamic NDArray Developers
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Dynamic NDArray Developers list:
-
- * Mark Wiebe
- * Continuum Analytics
-
---------------------------------------------------------------------------------
-
-Some source code from Ibis (https://github.com/cloudera/ibis) has been adapted
-for PyArrow. Ibis is released under the Apache License, Version 2.0.
-
---------------------------------------------------------------------------------
-
-This project includes code from the autobrew project.
-
-* r/tools/autobrew and dev/tasks/homebrew-formulae/autobrew/apache-arrow.rb
- are based on code from the autobrew project.
-
-Copyright (c) 2019, Jeroen Ooms
-License: MIT
-Homepage: https://github.com/jeroen/autobrew
-
---------------------------------------------------------------------------------
-
-dev/tasks/homebrew-formulae/apache-arrow.rb has the following license:
-
-BSD 2-Clause License
-
-Copyright (c) 2009-present, Homebrew contributors
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-----------------------------------------------------------------------
-
-cpp/src/arrow/vendored/base64.cpp has the following license
-
-ZLIB License
-
-Copyright (C) 2004-2017 René Nyffenegger
-
-This source code is provided 'as-is', without any express or implied
-warranty. In no event will the author be held liable for any damages arising
-from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose, including
-commercial applications, and to alter it and redistribute it freely, subject to
-the following restrictions:
-
-1. The origin of this source code must not be misrepresented; you must not
- claim that you wrote the original source code. If you use this source code
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original source code.
-
-3. This notice may not be removed or altered from any source distribution.
-
-René Nyffenegger rene.nyffenegger@adp-gmbh.ch
-
---------------------------------------------------------------------------------
-
-The file cpp/src/arrow/vendored/optional.hpp has the following license
-
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
-
---------------------------------------------------------------------------------
-
-The file cpp/src/arrow/vendored/musl/strptime.c has the following license
-
-Copyright © 2005-2020 Rich Felker, et al.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/go/arrow/Makefile b/go/arrow/Makefile
deleted file mode 100644
index 9c4a232..0000000
--- a/go/arrow/Makefile
+++ /dev/null
@@ -1,54 +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.
-
-GO_BUILD=go build
-GO_GEN=go generate
-GO_TEST?=go test
-GOPATH=$(realpath ../../../../../..)
-
-GO_SOURCES := $(shell find . -path ./_lib -prune -o -name '*.go' -not -name '*_test.go')
-ALL_SOURCES := $(shell find . -path ./_lib -prune -o -name '*.go' -name '*.s' -not -name '*_test.go')
-SOURCES_NO_VENDOR := $(shell find . -path ./vendor -prune -o -name "*.go" -not -name '*_test.go' -print)
-
-.PHONEY: test bench assembly generate
-
-assembly:
- @$(MAKE) -C memory assembly
- @$(MAKE) -C math assembly
-
-generate: bin/tmpl
- bin/tmpl -i -data=numeric.tmpldata type_traits_numeric.gen.go.tmpl type_traits_numeric.gen_test.go.tmpl array/numeric.gen.go.tmpl array/numericbuilder.gen_test.go.tmpl array/numericbuilder.gen.go.tmpl array/bufferbuilder_numeric.gen.go.tmpl
- bin/tmpl -i -data=datatype_numeric.gen.go.tmpldata datatype_numeric.gen.go.tmpl
- @$(MAKE) -C math generate
-
-fmt: $(SOURCES_NO_VENDOR)
- goimports -w $^
-
-bench: $(GO_SOURCES) | assembly
- $(GO_TEST) $(GO_TEST_ARGS) -bench=. -run=- ./...
-
-bench-noasm: $(GO_SOURCES)
- $(GO_TEST) $(GO_TEST_ARGS) -tags='noasm' -bench=. -run=- ./...
-
-test: $(GO_SOURCES) | assembly
- $(GO_TEST) $(GO_TEST_ARGS) ./...
-
-test-noasm: $(GO_SOURCES)
- $(GO_TEST) $(GO_TEST_ARGS) -tags='noasm' ./...
-
-bin/tmpl: _tools/tmpl/main.go
- $(GO_BUILD) -o $@ ./_tools/tmpl
-
diff --git a/go/arrow/_examples/helloworld/main.go b/go/arrow/_examples/helloworld/main.go
deleted file mode 100644
index ab21f6b..0000000
--- a/go/arrow/_examples/helloworld/main.go
+++ /dev/null
@@ -1,32 +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.
-
-package main
-
-import (
- "github.com/apache/arrow/go/arrow/array"
- "github.com/apache/arrow/go/arrow/math"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-func main() {
- fb := array.NewFloat64Builder(memory.DefaultAllocator)
-
- fb.AppendValues([]float64{1, 3, 5, 7, 9, 11}, nil)
-
- vec := fb.NewFloat64Array()
- math.Float64.Sum(vec)
-}
diff --git a/go/arrow/_tools/tmpl/main.go b/go/arrow/_tools/tmpl/main.go
deleted file mode 100644
index 0cabef3..0000000
--- a/go/arrow/_tools/tmpl/main.go
+++ /dev/null
@@ -1,267 +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.
-
-package main
-
-import (
- "bytes"
- "encoding/json"
- "flag"
- "fmt"
- "go/format"
- "io/ioutil"
- "os"
- "os/exec"
- "path/filepath"
- "strings"
- "text/template"
-)
-
-const Ext = ".tmpl"
-
-type pathSpec struct {
- in, out string
-}
-
-func (p *pathSpec) String() string { return p.in + " → " + p.out }
-func (p *pathSpec) IsGoFile() bool { return filepath.Ext(p.out) == ".go" }
-
-func parsePath(path string) (string, string) {
- p := strings.IndexByte(path, '=')
- if p == -1 {
- if filepath.Ext(path) != Ext {
- errExit("template file '%s' must have .tmpl extension", path)
- }
- return path, path[:len(path)-len(Ext)]
- }
-
- return path[:p], path[p+1:]
-}
-
-type data struct {
- In interface{}
- D listValue
-}
-
-func errExit(format string, a ...interface{}) {
- fmt.Fprintf(os.Stderr, format, a...)
- fmt.Fprintln(os.Stderr)
- os.Exit(1)
-}
-
-type listValue map[string]string
-
-func (l listValue) String() string {
- res := make([]string, 0, len(l))
- for k, v := range l {
- res = append(res, fmt.Sprintf("%s=%s", k, v))
- }
- return strings.Join(res, ", ")
-}
-
-func (l listValue) Set(v string) error {
- nv := strings.Split(v, "=")
- if len(nv) != 2 {
- return fmt.Errorf("expected NAME=VALUE, got %s", v)
- }
- l[nv[0]] = nv[1]
- return nil
-}
-
-func main() {
- var (
- dataArg = flag.String("data", "", "input JSON data")
- gi = flag.Bool("i", false, "run goimports")
- in = &data{D: make(listValue)}
- )
-
- flag.Var(&in.D, "d", "-d NAME=VALUE")
-
- flag.Parse()
- if *dataArg == "" {
- errExit("data option is required")
- }
-
- if *gi {
- if _, err := exec.LookPath("goimports"); err != nil {
- errExit("failed to find goimports: %s", err.Error())
- }
- formatter = formatSource
- } else {
- formatter = format.Source
- }
-
- paths := flag.Args()
- if len(paths) == 0 {
- errExit("no tmpl files specified")
- }
-
- specs := make([]pathSpec, len(paths))
- for i, p := range paths {
- in, out := parsePath(p)
- specs[i] = pathSpec{in: in, out: out}
- }
-
- in.In = readData(*dataArg)
- process(in, specs)
-}
-
-func mustReadAll(path string) []byte {
- data, err := ioutil.ReadFile(path)
- if err != nil {
- errExit(err.Error())
- }
-
- return data
-}
-
-func readData(path string) interface{} {
- data := mustReadAll(path)
- var v interface{}
- if err := json.Unmarshal(StripComments(data), &v); err != nil {
- errExit("invalid JSON data: %s", err.Error())
- }
- return v
-}
-
-func fileMode(path string) os.FileMode {
- stat, err := os.Stat(path)
- if err != nil {
- errExit(err.Error())
- }
- return stat.Mode()
-}
-
-var funcs = template.FuncMap{
- "lower": strings.ToLower,
- "upper": strings.ToUpper,
-}
-
-func process(data interface{}, specs []pathSpec) {
- for _, spec := range specs {
- var (
- t *template.Template
- err error
- )
- t, err = template.New("gen").Funcs(funcs).Parse(string(mustReadAll(spec.in)))
- if err != nil {
- errExit("error processing template '%s': %s", spec.in, err.Error())
- }
-
- var buf bytes.Buffer
- if spec.IsGoFile() {
- // preamble
- fmt.Fprintf(&buf, "// Code generated by %s. DO NOT EDIT.\n", spec.in)
- fmt.Fprintln(&buf)
- }
- err = t.Execute(&buf, data)
- if err != nil {
- errExit("error executing template '%s': %s", spec.in, err.Error())
- }
-
- generated := buf.Bytes()
- if spec.IsGoFile() {
- generated, err = formatter(generated)
- if err != nil {
- errExit("error formatting '%s': %s", spec.in, err.Error())
- }
- }
-
- ioutil.WriteFile(spec.out, generated, fileMode(spec.in))
- }
-}
-
-var (
- formatter func([]byte) ([]byte, error)
-)
-
-func formatSource(in []byte) ([]byte, error) {
- r := bytes.NewReader(in)
- cmd := exec.Command("goimports")
- cmd.Stdin = r
- out, err := cmd.Output()
- if err != nil {
- if ee, ok := err.(*exec.ExitError); ok {
- return nil, fmt.Errorf("error running goimports: %s", string(ee.Stderr))
- }
- return nil, fmt.Errorf("error running goimports: %s", string(out))
- }
-
- return out, nil
-}
-
-func StripComments(raw []byte) []byte {
- var (
- quoted, esc bool
- comment bool
- )
-
- buf := bytes.Buffer{}
-
- for i := 0; i < len(raw); i++ {
- b := raw[i]
-
- if comment {
- switch b {
- case '/':
- comment = false
- j := bytes.IndexByte(raw[i+1:], '\n')
- if j == -1 {
- i = len(raw)
- } else {
- i += j // keep new line
- }
- case '*':
- j := bytes.Index(raw[i+1:], []byte("*/"))
- if j == -1 {
- i = len(raw)
- } else {
- i += j + 2
- comment = false
- }
- }
- continue
- }
-
- if esc {
- esc = false
- continue
- }
-
- if b == '\\' && quoted {
- esc = true
- continue
- }
-
- if b == '"' || b == '\'' {
- quoted = !quoted
- }
-
- if b == '/' && !quoted {
- comment = true
- continue
- }
-
- buf.WriteByte(b)
- }
-
- if quoted || esc || comment {
- // unexpected state, so return raw bytes
- return raw
- }
-
- return buf.Bytes()
-}
diff --git a/go/arrow/_tools/tmpl/main_test.go b/go/arrow/_tools/tmpl/main_test.go
deleted file mode 100644
index 831cf79..0000000
--- a/go/arrow/_tools/tmpl/main_test.go
+++ /dev/null
@@ -1,73 +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.
-
-package main
-
-import (
- "testing"
-)
-
-func TestStripComments(t *testing.T) {
- tests := []struct {
- name string
- in string
- exp string
- }{
- {name: "none", in: `[1,2,3]`, exp: `[1,2,3]`},
- {name: "single-line, line comment at end", in: `[1,2,3] // foo bar`, exp: `[1,2,3] `},
- {name: "single-line, block comment at end", in: `[1,2,3] /* foo bar */ `, exp: `[1,2,3] `},
- {name: "single-line, block comment at end", in: `[1,2,3] /* /* // */`, exp: `[1,2,3] `},
- {name: "single-line, block comment in middle", in: `[1,/* foo bar */2,3]`, exp: `[1,2,3]`},
- {name: "single-line, block comment in string", in: `[1,"/* foo bar */"]`, exp: `[1,"/* foo bar */"]`},
- {name: "single-line, malformed block comment", in: `[1,2,/*]`, exp: `[1,2,/*]`},
- {name: "single-line, malformed JSON", in: `[1,2,/]`, exp: `[1,2,/]`},
-
- {
- name: "multi-line",
- in: `[
- 1,
- 2,
- 3
-]`,
- exp: `[
- 1,
- 2,
- 3
-]`,
- },
- {
- name: "multi-line, multiple line comments",
- in: `[ // foo
- 1, // bar
- 2,
- 3
-] // fit`,
- exp: `[
- 1,
- 2,
- 3
-] `,
- },
- }
- for _, test := range tests {
- t.Run(test.name, func(t *testing.T) {
- got := string(StripComments([]byte(test.in)))
- if got != test.exp {
- t.Errorf("got:\n%s\nexp:\n%s", got, test.exp)
- }
- })
- }
-}
diff --git a/go/arrow/array/array.go b/go/arrow/array/array.go
deleted file mode 100644
index 9cbaef9..0000000
--- a/go/arrow/array/array.go
+++ /dev/null
@@ -1,208 +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.
-
-package array // import "github.com/apache/arrow/go/arrow/array"
-
-import (
- "sync/atomic"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/bitutil"
- "github.com/apache/arrow/go/arrow/internal/debug"
-)
-
-// A type which satisfies array.Interface represents an immutable sequence of values.
-type Interface interface {
- // DataType returns the type metadata for this instance.
- DataType() arrow.DataType
-
- // NullN returns the number of null values in the array.
- NullN() int
-
- // NullBitmapBytes returns a byte slice of the validity bitmap.
- NullBitmapBytes() []byte
-
- // IsNull returns true if value at index is null.
- // NOTE: IsNull will panic if NullBitmapBytes is not empty and 0 > i ≥ Len.
- IsNull(i int) bool
-
- // IsValid returns true if value at index is not null.
- // NOTE: IsValid will panic if NullBitmapBytes is not empty and 0 > i ≥ Len.
- IsValid(i int) bool
-
- Data() *Data
-
- // Len returns the number of elements in the array.
- Len() int
-
- // Retain increases the reference count by 1.
- // Retain may be called simultaneously from multiple goroutines.
- Retain()
-
- // Release decreases the reference count by 1.
- // Release may be called simultaneously from multiple goroutines.
- // When the reference count goes to zero, the memory is freed.
- Release()
-}
-
-const (
- // UnknownNullCount specifies the NullN should be calculated from the null bitmap buffer.
- UnknownNullCount = -1
-)
-
-type array struct {
- refCount int64
- data *Data
- nullBitmapBytes []byte
-}
-
-// Retain increases the reference count by 1.
-// Retain may be called simultaneously from multiple goroutines.
-func (a *array) Retain() {
- atomic.AddInt64(&a.refCount, 1)
-}
-
-// Release decreases the reference count by 1.
-// Release may be called simultaneously from multiple goroutines.
-// When the reference count goes to zero, the memory is freed.
-func (a *array) Release() {
- debug.Assert(atomic.LoadInt64(&a.refCount) > 0, "too many releases")
-
- if atomic.AddInt64(&a.refCount, -1) == 0 {
- a.data.Release()
- a.data, a.nullBitmapBytes = nil, nil
- }
-}
-
-// DataType returns the type metadata for this instance.
-func (a *array) DataType() arrow.DataType { return a.data.dtype }
-
-// NullN returns the number of null values in the array.
-func (a *array) NullN() int {
- if a.data.nulls < 0 {
- a.data.nulls = a.data.length - bitutil.CountSetBits(a.nullBitmapBytes, a.data.offset, a.data.length)
- }
- return a.data.nulls
-}
-
-// NullBitmapBytes returns a byte slice of the validity bitmap.
-func (a *array) NullBitmapBytes() []byte { return a.nullBitmapBytes }
-
-func (a *array) Data() *Data { return a.data }
-
-// Len returns the number of elements in the array.
-func (a *array) Len() int { return a.data.length }
-
-// IsNull returns true if value at index is null.
-// NOTE: IsNull will panic if NullBitmapBytes is not empty and 0 > i ≥ Len.
-func (a *array) IsNull(i int) bool {
- return len(a.nullBitmapBytes) != 0 && bitutil.BitIsNotSet(a.nullBitmapBytes, a.data.offset+i)
-}
-
-// IsValid returns true if value at index is not null.
-// NOTE: IsValid will panic if NullBitmapBytes is not empty and 0 > i ≥ Len.
-func (a *array) IsValid(i int) bool {
- return len(a.nullBitmapBytes) == 0 || bitutil.BitIsSet(a.nullBitmapBytes, a.data.offset+i)
-}
-
-func (a *array) setData(data *Data) {
- // Retain before releasing in case a.data is the same as data.
- data.Retain()
-
- if a.data != nil {
- a.data.Release()
- }
-
- if len(data.buffers) > 0 && data.buffers[0] != nil {
- a.nullBitmapBytes = data.buffers[0].Bytes()
- }
- a.data = data
-}
-
-func (a *array) Offset() int {
- return a.data.Offset()
-}
-
-type arrayConstructorFn func(*Data) Interface
-
-var (
- makeArrayFn [32]arrayConstructorFn
-)
-
-func unsupportedArrayType(data *Data) Interface {
- panic("unsupported data type: " + data.dtype.ID().String())
-}
-
-func invalidDataType(data *Data) Interface {
- panic("invalid data type: " + data.dtype.ID().String())
-}
-
-// MakeFromData constructs a strongly-typed array instance from generic Data.
-func MakeFromData(data *Data) Interface {
- return makeArrayFn[byte(data.dtype.ID()&0x1f)](data)
-}
-
-// NewSlice constructs a zero-copy slice of the array with the indicated
-// indices i and j, corresponding to array[i:j].
-// The returned array must be Release()'d after use.
-//
-// NewSlice panics if the slice is outside the valid range of the input array.
-// NewSlice panics if j < i.
-func NewSlice(arr Interface, i, j int64) Interface {
- data := NewSliceData(arr.Data(), i, j)
- slice := MakeFromData(data)
- data.Release()
- return slice
-}
-
-func init() {
- makeArrayFn = [...]arrayConstructorFn{
- arrow.NULL: func(data *Data) Interface { return NewNullData(data) },
- arrow.BOOL: func(data *Data) Interface { return NewBooleanData(data) },
- arrow.UINT8: func(data *Data) Interface { return NewUint8Data(data) },
- arrow.INT8: func(data *Data) Interface { return NewInt8Data(data) },
- arrow.UINT16: func(data *Data) Interface { return NewUint16Data(data) },
- arrow.INT16: func(data *Data) Interface { return NewInt16Data(data) },
- arrow.UINT32: func(data *Data) Interface { return NewUint32Data(data) },
- arrow.INT32: func(data *Data) Interface { return NewInt32Data(data) },
- arrow.UINT64: func(data *Data) Interface { return NewUint64Data(data) },
- arrow.INT64: func(data *Data) Interface { return NewInt64Data(data) },
- arrow.FLOAT16: func(data *Data) Interface { return NewFloat16Data(data) },
- arrow.FLOAT32: func(data *Data) Interface { return NewFloat32Data(data) },
- arrow.FLOAT64: func(data *Data) Interface { return NewFloat64Data(data) },
- arrow.STRING: func(data *Data) Interface { return NewStringData(data) },
- arrow.BINARY: func(data *Data) Interface { return NewBinaryData(data) },
- arrow.FIXED_SIZE_BINARY: func(data *Data) Interface { return NewFixedSizeBinaryData(data) },
- arrow.DATE32: func(data *Data) Interface { return NewDate32Data(data) },
- arrow.DATE64: func(data *Data) Interface { return NewDate64Data(data) },
- arrow.TIMESTAMP: func(data *Data) Interface { return NewTimestampData(data) },
- arrow.TIME32: func(data *Data) Interface { return NewTime32Data(data) },
- arrow.TIME64: func(data *Data) Interface { return NewTime64Data(data) },
- arrow.INTERVAL: func(data *Data) Interface { return NewIntervalData(data) },
- arrow.DECIMAL: func(data *Data) Interface { return NewDecimal128Data(data) },
- arrow.LIST: func(data *Data) Interface { return NewListData(data) },
- arrow.STRUCT: func(data *Data) Interface { return NewStructData(data) },
- arrow.UNION: unsupportedArrayType,
- arrow.DICTIONARY: unsupportedArrayType,
- arrow.MAP: unsupportedArrayType,
- arrow.EXTENSION: unsupportedArrayType,
- arrow.FIXED_SIZE_LIST: func(data *Data) Interface { return NewFixedSizeListData(data) },
- arrow.DURATION: func(data *Data) Interface { return NewDurationData(data) },
-
- // invalid data types to fill out array size 2⁵-1
- 31: invalidDataType,
- }
-}
diff --git a/go/arrow/array/array_test.go b/go/arrow/array/array_test.go
deleted file mode 100644
index 48c2386..0000000
--- a/go/arrow/array/array_test.go
+++ /dev/null
@@ -1,301 +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.
-
-package array_test
-
-import (
- "testing"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/array"
- "github.com/apache/arrow/go/arrow/internal/testing/tools"
- "github.com/apache/arrow/go/arrow/memory"
- "github.com/stretchr/testify/assert"
-)
-
-type testDataType struct {
- id arrow.Type
-}
-
-func (d *testDataType) ID() arrow.Type { return d.id }
-func (d *testDataType) Name() string { panic("implement me") }
-func (d *testDataType) BitWidth() int { return 8 }
-
-func TestMakeFromData(t *testing.T) {
- tests := []struct {
- name string
- d arrow.DataType
- size int
- child []*array.Data
- expPanic bool
- expError string
- }{
- // supported types
- {name: "null", d: &testDataType{arrow.NULL}},
- {name: "bool", d: &testDataType{arrow.BOOL}},
- {name: "uint8", d: &testDataType{arrow.UINT8}},
- {name: "uint16", d: &testDataType{arrow.UINT16}},
- {name: "uint32", d: &testDataType{arrow.UINT32}},
- {name: "uint64", d: &testDataType{arrow.UINT64}},
- {name: "int8", d: &testDataType{arrow.INT8}},
- {name: "int16", d: &testDataType{arrow.INT16}},
- {name: "int32", d: &testDataType{arrow.INT32}},
- {name: "int64", d: &testDataType{arrow.INT64}},
- {name: "float32", d: &testDataType{arrow.FLOAT32}},
- {name: "float64", d: &testDataType{arrow.FLOAT64}},
- {name: "string", d: &testDataType{arrow.STRING}, size: 3},
- {name: "binary", d: &testDataType{arrow.BINARY}, size: 3},
- {name: "fixed_size_binary", d: &testDataType{arrow.FIXED_SIZE_BINARY}},
- {name: "date32", d: &testDataType{arrow.DATE32}},
- {name: "date64", d: &testDataType{arrow.DATE64}},
- {name: "timestamp", d: &testDataType{arrow.TIMESTAMP}},
- {name: "time32", d: &testDataType{arrow.TIME32}},
- {name: "time64", d: &testDataType{arrow.TIME64}},
- {name: "month_interval", d: arrow.FixedWidthTypes.MonthInterval},
- {name: "day_time_interval", d: arrow.FixedWidthTypes.DayTimeInterval},
- {name: "decimal", d: &testDataType{arrow.DECIMAL}},
-
- {name: "list", d: &testDataType{arrow.LIST}, child: []*array.Data{
- array.NewData(&testDataType{arrow.INT64}, 0, make([]*memory.Buffer, 4), nil, 0, 0),
- array.NewData(&testDataType{arrow.INT64}, 0, make([]*memory.Buffer, 4), nil, 0, 0),
- }},
-
- {name: "struct", d: &testDataType{arrow.STRUCT}},
- {name: "struct", d: &testDataType{arrow.STRUCT}, child: []*array.Data{
- array.NewData(&testDataType{arrow.INT64}, 0, make([]*memory.Buffer, 4), nil, 0, 0),
- array.NewData(&testDataType{arrow.INT64}, 0, make([]*memory.Buffer, 4), nil, 0, 0),
- }},
-
- {name: "fixed_size_list", d: arrow.FixedSizeListOf(4, arrow.PrimitiveTypes.Int64), child: []*array.Data{
- array.NewData(&testDataType{arrow.INT64}, 0, make([]*memory.Buffer, 4), nil, 0, 0),
- array.NewData(&testDataType{arrow.INT64}, 0, make([]*memory.Buffer, 4), nil, 0, 0),
- }},
- {name: "duration", d: &testDataType{arrow.DURATION}},
-
- // unsupported types
- {name: "union", d: &testDataType{arrow.UNION}, expPanic: true, expError: "unsupported data type: UNION"},
- {name: "dictionary", d: &testDataType{arrow.DICTIONARY}, expPanic: true, expError: "unsupported data type: DICTIONARY"},
- {name: "map", d: &testDataType{arrow.Type(27)}, expPanic: true, expError: "unsupported data type: MAP"},
- {name: "extension", d: &testDataType{arrow.Type(28)}, expPanic: true, expError: "unsupported data type: EXTENSION"},
-
- // invalid types
- {name: "invalid(-1)", d: &testDataType{arrow.Type(-1)}, expPanic: true, expError: "invalid data type: Type(-1)"},
- {name: "invalid(31)", d: &testDataType{arrow.Type(31)}, expPanic: true, expError: "invalid data type: Type(31)"},
- }
- for _, test := range tests {
- t.Run(test.name, func(t *testing.T) {
- var b [4]*memory.Buffer
- var n = 4
- if test.size != 0 {
- n = test.size
- }
- data := array.NewData(test.d, 0, b[:n], test.child, 0, 0)
-
- if test.expPanic {
- assert.PanicsWithValue(t, test.expError, func() {
- array.MakeFromData(data)
- })
- } else {
- assert.NotNil(t, array.MakeFromData(data))
- }
- })
- }
-}
-
-func bbits(v ...int32) []byte {
- return tools.IntsToBitsLSB(v...)
-}
-
-func TestArray_NullN(t *testing.T) {
- tests := []struct {
- name string
- l int
- bm []byte
- n int
- exp int
- }{
- {name: "unknown,l16", l: 16, bm: bbits(0x11001010, 0x00110011), n: array.UnknownNullCount, exp: 8},
- {name: "unknown,l12,ignores last nibble", l: 12, bm: bbits(0x11001010, 0x00111111), n: array.UnknownNullCount, exp: 6},
- {name: "unknown,l12,12 nulls", l: 12, bm: bbits(0x00000000, 0x00000000), n: array.UnknownNullCount, exp: 12},
- {name: "unknown,l12,00 nulls", l: 12, bm: bbits(0x11111111, 0x11111111), n: array.UnknownNullCount, exp: 0},
- }
- for _, test := range tests {
- t.Run(test.name, func(t *testing.T) {
- buf := memory.NewBufferBytes(test.bm)
- data := array.NewData(arrow.FixedWidthTypes.Boolean, test.l, []*memory.Buffer{buf, nil}, nil, test.n, 0)
- buf.Release()
- ar := array.MakeFromData(data)
- data.Release()
- got := ar.NullN()
- ar.Release()
- assert.Equal(t, test.exp, got)
- })
- }
-}
-
-func TestArraySlice(t *testing.T) {
- pool := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer pool.AssertSize(t, 0)
-
- var (
- valids = []bool{true, true, true, false, true, true}
- vs = []float64{1, 2, 3, 0, 4, 5}
- )
-
- b := array.NewFloat64Builder(pool)
- defer b.Release()
-
- for _, tc := range []struct {
- i, j int
- panics bool
- len int
- }{
- {i: 0, j: len(valids), panics: false, len: len(valids)},
- {i: len(valids), j: len(valids), panics: false, len: 0},
- {i: 0, j: 1, panics: false, len: 1},
- {i: 1, j: 1, panics: false, len: 0},
- {i: 0, j: len(valids) + 1, panics: true},
- {i: 2, j: 1, panics: true},
- {i: len(valids) + 1, j: len(valids) + 1, panics: true},
- } {
- t.Run("", func(t *testing.T) {
- b.AppendValues(vs, valids)
-
- arr := b.NewFloat64Array()
- defer arr.Release()
-
- if got, want := arr.Len(), len(valids); got != want {
- t.Fatalf("got=%d, want=%d", got, want)
- }
-
- if tc.panics {
- defer func() {
- e := recover()
- if e == nil {
- t.Fatalf("this should have panicked, but did not")
- }
- }()
- }
-
- slice := array.NewSlice(arr, int64(tc.i), int64(tc.j)).(*array.Float64)
- defer slice.Release()
-
- if got, want := slice.Len(), tc.len; got != want {
- t.Fatalf("invalid slice length: got=%d, want=%d", got, want)
- }
- })
- }
-}
-
-func TestArraySliceTypes(t *testing.T) {
- pool := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer pool.AssertSize(t, 0)
-
- valids := []bool{true, true, true, false, true, true}
-
- for _, tc := range []struct {
- values interface{}
- builder array.Builder
- append func(b array.Builder, vs interface{})
- }{
- {
- values: []bool{true, false, true, false, true, false},
- builder: array.NewBooleanBuilder(pool),
- append: func(b array.Builder, vs interface{}) { b.(*array.BooleanBuilder).AppendValues(vs.([]bool), valids) },
- },
- {
- values: []uint8{1, 2, 3, 0, 4, 5},
- builder: array.NewUint8Builder(pool),
- append: func(b array.Builder, vs interface{}) { b.(*array.Uint8Builder).AppendValues(vs.([]uint8), valids) },
- },
- {
- values: []uint16{1, 2, 3, 0, 4, 5},
- builder: array.NewUint16Builder(pool),
- append: func(b array.Builder, vs interface{}) { b.(*array.Uint16Builder).AppendValues(vs.([]uint16), valids) },
- },
- {
- values: []uint32{1, 2, 3, 0, 4, 5},
- builder: array.NewUint32Builder(pool),
- append: func(b array.Builder, vs interface{}) { b.(*array.Uint32Builder).AppendValues(vs.([]uint32), valids) },
- },
- {
- values: []uint64{1, 2, 3, 0, 4, 5},
- builder: array.NewUint64Builder(pool),
- append: func(b array.Builder, vs interface{}) { b.(*array.Uint64Builder).AppendValues(vs.([]uint64), valids) },
- },
- {
- values: []int8{1, 2, 3, 0, 4, 5},
- builder: array.NewInt8Builder(pool),
- append: func(b array.Builder, vs interface{}) { b.(*array.Int8Builder).AppendValues(vs.([]int8), valids) },
- },
- {
- values: []int16{1, 2, 3, 0, 4, 5},
- builder: array.NewInt16Builder(pool),
- append: func(b array.Builder, vs interface{}) { b.(*array.Int16Builder).AppendValues(vs.([]int16), valids) },
- },
- {
- values: []int32{1, 2, 3, 0, 4, 5},
- builder: array.NewInt32Builder(pool),
- append: func(b array.Builder, vs interface{}) { b.(*array.Int32Builder).AppendValues(vs.([]int32), valids) },
- },
- {
- values: []int64{1, 2, 3, 0, 4, 5},
- builder: array.NewInt64Builder(pool),
- append: func(b array.Builder, vs interface{}) { b.(*array.Int64Builder).AppendValues(vs.([]int64), valids) },
- },
- {
- values: []float32{1, 2, 3, 0, 4, 5},
- builder: array.NewFloat32Builder(pool),
- append: func(b array.Builder, vs interface{}) { b.(*array.Float32Builder).AppendValues(vs.([]float32), valids) },
- },
- {
- values: []float64{1, 2, 3, 0, 4, 5},
- builder: array.NewFloat64Builder(pool),
- append: func(b array.Builder, vs interface{}) { b.(*array.Float64Builder).AppendValues(vs.([]float64), valids) },
- },
- } {
- t.Run("", func(t *testing.T) {
- defer tc.builder.Release()
-
- b := tc.builder
- tc.append(b, tc.values)
-
- arr := b.NewArray()
- defer arr.Release()
-
- if got, want := arr.Len(), len(valids); got != want {
- t.Fatalf("invalid length: got=%d, want=%d", got, want)
- }
-
- slice := array.NewSlice(arr, 2, 5)
- defer slice.Release()
-
- if got, want := slice.Len(), 3; got != want {
- t.Fatalf("invalid slice length: got=%d, want=%d", got, want)
- }
-
- shortSlice := array.NewSlice(arr, 2, 3)
- defer shortSlice.Release()
-
- sliceOfShortSlice := array.NewSlice(shortSlice, 0, 1)
- defer sliceOfShortSlice.Release()
-
- if got, want := sliceOfShortSlice.Len(), 1; got != want {
- t.Fatalf("invalid short slice length: got=%d, want=%d", got, want)
- }
- })
- }
-}
diff --git a/go/arrow/array/binary.go b/go/arrow/array/binary.go
deleted file mode 100644
index ed58910..0000000
--- a/go/arrow/array/binary.go
+++ /dev/null
@@ -1,134 +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.
-
-package array
-
-import (
- "bytes"
- "fmt"
- "strings"
- "unsafe"
-
- "github.com/apache/arrow/go/arrow"
-)
-
-// A type which represents an immutable sequence of variable-length binary strings.
-type Binary struct {
- array
- valueOffsets []int32
- valueBytes []byte
-}
-
-// NewBinaryData constructs a new Binary array from data.
-func NewBinaryData(data *Data) *Binary {
- a := &Binary{}
- a.refCount = 1
- a.setData(data)
- return a
-}
-
-// Value returns the slice at index i. This value should not be mutated.
-func (a *Binary) Value(i int) []byte {
- if i < 0 || i >= a.array.data.length {
- panic("arrow/array: index out of range")
- }
- idx := a.array.data.offset + i
- return a.valueBytes[a.valueOffsets[idx]:a.valueOffsets[idx+1]]
-}
-
-// ValueString returns the string at index i without performing additional allocations.
-// The string is only valid for the lifetime of the Binary array.
-func (a *Binary) ValueString(i int) string {
- b := a.Value(i)
- return *(*string)(unsafe.Pointer(&b))
-}
-
-func (a *Binary) ValueOffset(i int) int {
- if i < 0 || i >= a.array.data.length {
- panic("arrow/array: index out of range")
- }
- return int(a.valueOffsets[a.array.data.offset+i])
-}
-
-func (a *Binary) ValueLen(i int) int {
- if i < 0 || i >= a.array.data.length {
- panic("arrow/array: index out of range")
- }
- beg := a.array.data.offset + i
- return int(a.valueOffsets[beg+1] - a.valueOffsets[beg])
-}
-
-func (a *Binary) ValueOffsets() []int32 {
- beg := a.array.data.offset
- end := beg + a.array.data.length + 1
- return a.valueOffsets[beg:end]
-}
-
-func (a *Binary) ValueBytes() []byte {
- beg := a.array.data.offset
- end := beg + a.array.data.length
- return a.valueBytes[a.valueOffsets[beg]:a.valueOffsets[end]]
-}
-
-func (a *Binary) String() string {
- o := new(strings.Builder)
- o.WriteString("[")
- for i := 0; i < a.Len(); i++ {
- if i > 0 {
- o.WriteString(" ")
- }
- switch {
- case a.IsNull(i):
- o.WriteString("(null)")
- default:
- fmt.Fprintf(o, "%q", a.ValueString(i))
- }
- }
- o.WriteString("]")
- return o.String()
-}
-
-func (a *Binary) setData(data *Data) {
- if len(data.buffers) != 3 {
- panic("len(data.buffers) != 3")
- }
-
- a.array.setData(data)
-
- if valueData := data.buffers[2]; valueData != nil {
- a.valueBytes = valueData.Bytes()
- }
-
- if valueOffsets := data.buffers[1]; valueOffsets != nil {
- a.valueOffsets = arrow.Int32Traits.CastFromBytes(valueOffsets.Bytes())
- }
-}
-
-func arrayEqualBinary(left, right *Binary) bool {
- for i := 0; i < left.Len(); i++ {
- if left.IsNull(i) {
- continue
- }
- if bytes.Compare(left.Value(i), right.Value(i)) != 0 {
- return false
- }
- }
- return true
-}
-
-var (
- _ Interface = (*Binary)(nil)
-)
diff --git a/go/arrow/array/binary_test.go b/go/arrow/array/binary_test.go
deleted file mode 100644
index a7bbd47..0000000
--- a/go/arrow/array/binary_test.go
+++ /dev/null
@@ -1,430 +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.
-
-package array
-
-import (
- "reflect"
- "testing"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-func TestBinary(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- b := NewBinaryBuilder(mem, arrow.BinaryTypes.Binary)
-
- values := [][]byte{
- []byte("AAA"),
- nil,
- []byte("BBBB"),
- }
- valid := []bool{true, false, true}
- b.AppendValues(values, valid)
-
- b.Retain()
- b.Release()
-
- a := b.NewBinaryArray()
- assert.Equal(t, 3, a.Len())
- assert.Equal(t, 1, a.NullN())
- assert.Equal(t, []byte("AAA"), a.Value(0))
- assert.Equal(t, []byte{}, a.Value(1))
- assert.Equal(t, []byte("BBBB"), a.Value(2))
- a.Release()
-
- // Test builder reset and NewArray API.
- b.AppendValues(values, valid)
- a = b.NewArray().(*Binary)
- assert.Equal(t, 3, a.Len())
- assert.Equal(t, 1, a.NullN())
- assert.Equal(t, []byte("AAA"), a.Value(0))
- assert.Equal(t, []byte{}, a.Value(1))
- assert.Equal(t, []byte("BBBB"), a.Value(2))
- a.Release()
-
- b.Release()
-}
-
-func TestBinarySliceData(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- values := []string{"a", "bc", "def", "g", "hijk", "lm", "n", "opq", "rs", "tu"}
-
- b := NewBinaryBuilder(mem, arrow.BinaryTypes.Binary)
- defer b.Release()
-
- for _, v := range values {
- b.AppendString(v)
- }
-
- arr := b.NewArray().(*Binary)
- defer arr.Release()
-
- if got, want := arr.Len(), len(values); got != want {
- t.Fatalf("got=%d, want=%d", got, want)
- }
-
- vs := make([]string, arr.Len())
-
- for i := range vs {
- vs[i] = arr.ValueString(i)
- }
-
- if got, want := vs, values; !reflect.DeepEqual(got, want) {
- t.Fatalf("got=%v, want=%v", got, want)
- }
-
- tests := []struct {
- interval [2]int64
- want []string
- }{
- {
- interval: [2]int64{0, 0},
- want: []string{},
- },
- {
- interval: [2]int64{0, 5},
- want: []string{"a", "bc", "def", "g", "hijk"},
- },
- {
- interval: [2]int64{0, 10},
- want: []string{"a", "bc", "def", "g", "hijk", "lm", "n", "opq", "rs", "tu"},
- },
- {
- interval: [2]int64{5, 10},
- want: []string{"lm", "n", "opq", "rs", "tu"},
- },
- {
- interval: [2]int64{10, 10},
- want: []string{},
- },
- {
- interval: [2]int64{2, 7},
- want: []string{"def", "g", "hijk", "lm", "n"},
- },
- }
-
- for _, tc := range tests {
- t.Run("", func(t *testing.T) {
-
- slice := NewSlice(arr, tc.interval[0], tc.interval[1]).(*Binary)
- defer slice.Release()
-
- if got, want := slice.Len(), len(tc.want); got != want {
- t.Fatalf("got=%d, want=%d", got, want)
- }
-
- vs := make([]string, slice.Len())
-
- for i := range vs {
- vs[i] = slice.ValueString(i)
- }
-
- if got, want := vs, tc.want; !reflect.DeepEqual(got, want) {
- t.Fatalf("got=%v, want=%v", got, want)
- }
- })
- }
-}
-
-func TestBinarySliceDataWithNull(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- values := []string{"a", "bc", "", "", "hijk", "lm", "", "opq", "", "tu"}
- valids := []bool{true, true, false, false, true, true, true, true, false, true}
-
- b := NewBinaryBuilder(mem, arrow.BinaryTypes.Binary)
- defer b.Release()
-
- b.AppendStringValues(values, valids)
-
- arr := b.NewArray().(*Binary)
- defer arr.Release()
-
- if got, want := arr.Len(), len(values); got != want {
- t.Fatalf("got=%d, want=%d", got, want)
- }
-
- if got, want := arr.NullN(), 3; got != want {
- t.Fatalf("got=%d, want=%d", got, want)
- }
-
- vs := make([]string, arr.Len())
-
- for i := range vs {
- vs[i] = arr.ValueString(i)
- }
-
- if got, want := vs, values; !reflect.DeepEqual(got, want) {
- t.Fatalf("got=%v, want=%v", got, want)
- }
-
- tests := []struct {
- interval [2]int64
- nulls int
- want []string
- }{
- {
- interval: [2]int64{0, 2},
- nulls: 0,
- want: []string{"a", "bc"},
- },
- {
- interval: [2]int64{0, 3},
- nulls: 1,
- want: []string{"a", "bc", ""},
- },
- {
- interval: [2]int64{0, 4},
- nulls: 2,
- want: []string{"a", "bc", "", ""},
- },
- {
- interval: [2]int64{4, 8},
- nulls: 0,
- want: []string{"hijk", "lm", "", "opq"},
- },
- {
- interval: [2]int64{2, 9},
- nulls: 3,
- want: []string{"", "", "hijk", "lm", "", "opq", ""},
- },
- }
-
- for _, tc := range tests {
- t.Run("", func(t *testing.T) {
-
- slice := NewSlice(arr, tc.interval[0], tc.interval[1]).(*Binary)
- defer slice.Release()
-
- if got, want := slice.Len(), len(tc.want); got != want {
- t.Fatalf("got=%d, want=%d", got, want)
- }
-
- if got, want := slice.NullN(), tc.nulls; got != want {
- t.Errorf("got=%d, want=%d", got, want)
- }
-
- vs := make([]string, slice.Len())
-
- for i := range vs {
- vs[i] = slice.ValueString(i)
- }
-
- if got, want := vs, tc.want; !reflect.DeepEqual(got, want) {
- t.Fatalf("got=%v, want=%v", got, want)
- }
- })
- }
-}
-
-func TestBinarySliceOutOfBounds(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- values := []string{"a", "bc", "def", "g", "hijk", "lm", "n", "opq", "rs", "tu"}
-
- b := NewBinaryBuilder(mem, arrow.BinaryTypes.Binary)
- defer b.Release()
-
- for _, v := range values {
- b.AppendString(v)
- }
-
- arr := b.NewArray().(*Binary)
- defer arr.Release()
-
- slice := NewSlice(arr, 3, 8).(*Binary)
- defer slice.Release()
-
- tests := []struct {
- index int
- panic bool
- }{
- {
- index: -1,
- panic: true,
- },
- {
- index: 5,
- panic: true,
- },
- {
- index: 0,
- panic: false,
- },
- {
- index: 4,
- panic: false,
- },
- }
-
- for _, tc := range tests {
- t.Run("", func(t *testing.T) {
-
- var val string
-
- if tc.panic {
- defer func() {
- e := recover()
- if e == nil {
- t.Fatalf("this should have panicked, but did not; slice value %q", val)
- }
- if got, want := e.(string), "arrow/array: index out of range"; got != want {
- t.Fatalf("invalid error. got=%q, want=%q", got, want)
- }
- }()
- } else {
- defer func() {
- if e := recover(); e != nil {
- t.Fatalf("unexpected panic: %v", e)
- }
- }()
- }
-
- val = slice.ValueString(tc.index)
- })
- }
-}
-
-func TestBinaryValueOffset(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- values := []string{"a", "bc", "", "", "hijk", "lm", "", "opq", "", "tu"}
- valids := []bool{true, true, false, false, true, true, true, true, false, true}
-
- b := NewBinaryBuilder(mem, arrow.BinaryTypes.Binary)
- defer b.Release()
-
- b.AppendStringValues(values, valids)
-
- arr := b.NewArray().(*Binary)
- defer arr.Release()
-
- slice := NewSlice(arr, 2, 9).(*Binary)
- defer slice.Release()
-
- offset := 3
- vs := values[2:9]
-
- for i, v := range vs {
- assert.Equal(t, offset, slice.ValueOffset(i))
- offset += len(v)
- }
-}
-
-func TestBinaryValueLen(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- values := []string{"a", "bc", "", "", "hijk", "lm", "", "opq", "", "tu"}
- valids := []bool{true, true, false, false, true, true, true, true, false, true}
-
- b := NewBinaryBuilder(mem, arrow.BinaryTypes.Binary)
- defer b.Release()
-
- b.AppendStringValues(values, valids)
-
- arr := b.NewArray().(*Binary)
- defer arr.Release()
-
- slice := NewSlice(arr, 2, 9).(*Binary)
- defer slice.Release()
-
- vs := values[2:9]
-
- for i, v := range vs {
- assert.Equal(t, len(v), slice.ValueLen(i))
- }
-}
-
-func TestBinaryValueOffsets(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- values := []string{"a", "bc", "", "", "hijk", "lm", "", "opq", "", "tu"}
- valids := []bool{true, true, false, false, true, true, true, true, false, true}
-
- b := NewBinaryBuilder(mem, arrow.BinaryTypes.Binary)
- defer b.Release()
-
- b.AppendStringValues(values, valids)
-
- arr := b.NewArray().(*Binary)
- defer arr.Release()
-
- assert.Equal(t, []int32{0, 1, 3, 3, 3, 7, 9, 9, 12, 12, 14}, arr.ValueOffsets())
-
- slice := NewSlice(arr, 2, 9).(*Binary)
- defer slice.Release()
-
- assert.Equal(t, []int32{3, 3, 3, 7, 9, 9, 12, 12}, slice.ValueOffsets())
-}
-
-func TestBinaryValueBytes(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- values := []string{"a", "bc", "", "", "hijk", "lm", "", "opq", "", "tu"}
- valids := []bool{true, true, false, false, true, true, true, true, false, true}
-
- b := NewBinaryBuilder(mem, arrow.BinaryTypes.Binary)
- defer b.Release()
-
- b.AppendStringValues(values, valids)
-
- arr := b.NewArray().(*Binary)
- defer arr.Release()
-
- assert.Equal(t, []byte{'a', 'b', 'c', 'h', 'i', 'j', 'k', 'l', 'm', 'o', 'p', 'q', 't', 'u'}, arr.ValueBytes())
-
- slice := NewSlice(arr, 2, 9).(*Binary)
- defer slice.Release()
-
- assert.Equal(t, []byte{'h', 'i', 'j', 'k', 'l', 'm', 'o', 'p', 'q'}, slice.ValueBytes())
-}
-
-func TestBinaryStringer(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- values := []string{"a", "bc", "", "é", "", "hijk", "lm", "", "opq", "", "tu"}
- valids := []bool{true, true, false, true, false, true, true, true, true, false, true}
-
- b := NewBinaryBuilder(mem, arrow.BinaryTypes.Binary)
- defer b.Release()
-
- b.AppendStringValues(values, valids)
-
- arr := b.NewArray().(*Binary)
- defer arr.Release()
-
- got := arr.String()
- want := `["a" "bc" (null) "é" (null) "hijk" "lm" "" "opq" (null) "tu"]`
-
- if got != want {
- t.Fatalf("invalid stringer:\ngot= %s\nwant=%s\n", got, want)
- }
-}
diff --git a/go/arrow/array/binarybuilder.go b/go/arrow/array/binarybuilder.go
deleted file mode 100644
index 17562fc..0000000
--- a/go/arrow/array/binarybuilder.go
+++ /dev/null
@@ -1,217 +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.
-
-package array
-
-import (
- "math"
- "sync/atomic"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/internal/debug"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-const (
- binaryArrayMaximumCapacity = math.MaxInt32
-)
-
-// A BinaryBuilder is used to build a Binary array using the Append methods.
-type BinaryBuilder struct {
- builder
-
- dtype arrow.BinaryDataType
- offsets *int32BufferBuilder
- values *byteBufferBuilder
-}
-
-func NewBinaryBuilder(mem memory.Allocator, dtype arrow.BinaryDataType) *BinaryBuilder {
- b := &BinaryBuilder{
- builder: builder{refCount: 1, mem: mem},
- dtype: dtype,
- offsets: newInt32BufferBuilder(mem),
- values: newByteBufferBuilder(mem),
- }
- return b
-}
-
-// Release decreases the reference count by 1.
-// When the reference count goes to zero, the memory is freed.
-// Release may be called simultaneously from multiple goroutines.
-func (b *BinaryBuilder) Release() {
- debug.Assert(atomic.LoadInt64(&b.refCount) > 0, "too many releases")
-
- if atomic.AddInt64(&b.refCount, -1) == 0 {
- if b.nullBitmap != nil {
- b.nullBitmap.Release()
- b.nullBitmap = nil
- }
- if b.offsets != nil {
- b.offsets.Release()
- b.offsets = nil
- }
- if b.values != nil {
- b.values.Release()
- b.values = nil
- }
- }
-}
-
-func (b *BinaryBuilder) Append(v []byte) {
- b.Reserve(1)
- b.appendNextOffset()
- b.values.Append(v)
- b.UnsafeAppendBoolToBitmap(true)
-}
-
-func (b *BinaryBuilder) AppendString(v string) {
- b.Append([]byte(v))
-}
-
-func (b *BinaryBuilder) AppendNull() {
- b.Reserve(1)
- b.appendNextOffset()
- b.UnsafeAppendBoolToBitmap(false)
-}
-
-// AppendValues will append the values in the v slice. The valid slice determines which values
-// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
-// all values in v are appended and considered valid.
-func (b *BinaryBuilder) AppendValues(v [][]byte, valid []bool) {
- if len(v) != len(valid) && len(valid) != 0 {
- panic("len(v) != len(valid) && len(valid) != 0")
- }
-
- if len(v) == 0 {
- return
- }
-
- b.Reserve(len(v))
- for _, vv := range v {
- b.appendNextOffset()
- b.values.Append(vv)
- }
-
- b.builder.unsafeAppendBoolsToBitmap(valid, len(v))
-}
-
-// AppendStringValues will append the values in the v slice. The valid slice determines which values
-// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
-// all values in v are appended and considered valid.
-func (b *BinaryBuilder) AppendStringValues(v []string, valid []bool) {
- if len(v) != len(valid) && len(valid) != 0 {
- panic("len(v) != len(valid) && len(valid) != 0")
- }
-
- if len(v) == 0 {
- return
- }
-
- b.Reserve(len(v))
- for _, vv := range v {
- b.appendNextOffset()
- b.values.Append([]byte(vv))
- }
-
- b.builder.unsafeAppendBoolsToBitmap(valid, len(v))
-}
-
-func (b *BinaryBuilder) Value(i int) []byte {
- offsets := b.offsets.Values()
- start := int(offsets[i])
- var end int
- if i == (b.length - 1) {
- end = b.values.Len()
- } else {
- end = int(offsets[i+1])
- }
- return b.values.Bytes()[start:end]
-}
-
-func (b *BinaryBuilder) init(capacity int) {
- b.builder.init(capacity)
- b.offsets.resize((capacity + 1) * arrow.Int32SizeBytes)
-}
-
-// DataLen returns the number of bytes in the data array.
-func (b *BinaryBuilder) DataLen() int { return b.values.length }
-
-// DataCap returns the total number of bytes that can be stored
-// without allocating additional memory.
-func (b *BinaryBuilder) DataCap() int { return b.values.capacity }
-
-// Reserve ensures there is enough space for appending n elements
-// by checking the capacity and calling Resize if necessary.
-func (b *BinaryBuilder) Reserve(n int) {
- b.builder.reserve(n, b.Resize)
-}
-
-// ReserveData ensures there is enough space for appending n bytes
-// by checking the capacity and resizing the data buffer if necessary.
-func (b *BinaryBuilder) ReserveData(n int) {
- if b.values.capacity < b.values.length+n {
- b.values.resize(b.values.Len() + n)
- }
-}
-
-// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
-// additional memory will be allocated. If n is smaller, the allocated memory may be reduced.
-func (b *BinaryBuilder) Resize(n int) {
- b.offsets.resize((n + 1) * arrow.Int32SizeBytes)
- b.builder.resize(n, b.init)
-}
-
-// NewArray creates a Binary array from the memory buffers used by the builder and resets the BinaryBuilder
-// so it can be used to build a new array.
-func (b *BinaryBuilder) NewArray() Interface {
- return b.NewBinaryArray()
-}
-
-// NewBinaryArray creates a Binary array from the memory buffers used by the builder and resets the BinaryBuilder
-// so it can be used to build a new array.
-func (b *BinaryBuilder) NewBinaryArray() (a *Binary) {
- data := b.newData()
- a = NewBinaryData(data)
- data.Release()
- return
-}
-
-func (b *BinaryBuilder) newData() (data *Data) {
- b.appendNextOffset()
- offsets, values := b.offsets.Finish(), b.values.Finish()
- data = NewData(b.dtype, b.length, []*memory.Buffer{b.nullBitmap, offsets, values}, nil, b.nulls, 0)
- if offsets != nil {
- offsets.Release()
- }
-
- if values != nil {
- values.Release()
- }
-
- b.builder.reset()
-
- return
-}
-
-func (b *BinaryBuilder) appendNextOffset() {
- numBytes := b.values.Len()
- // TODO(sgc): check binaryArrayMaximumCapacity?
- b.offsets.AppendValue(int32(numBytes))
-}
-
-var (
- _ Builder = (*BinaryBuilder)(nil)
-)
diff --git a/go/arrow/array/binarybuilder_test.go b/go/arrow/array/binarybuilder_test.go
deleted file mode 100644
index 145435b..0000000
--- a/go/arrow/array/binarybuilder_test.go
+++ /dev/null
@@ -1,87 +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.
-
-package array_test
-
-import (
- "bytes"
- "testing"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/array"
- "github.com/apache/arrow/go/arrow/memory"
- "github.com/stretchr/testify/assert"
-)
-
-func TestBinaryBuilder(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- ab := array.NewBinaryBuilder(mem, arrow.BinaryTypes.Binary)
-
- exp := [][]byte{[]byte("foo"), []byte("bar"), nil, []byte("sydney"), []byte("cameron")}
- for _, v := range exp {
- if v == nil {
- ab.AppendNull()
- } else {
- ab.Append(v)
- }
- }
-
- assert.Equal(t, len(exp), ab.Len(), "unexpected Len()")
- assert.Equal(t, 1, ab.NullN(), "unexpected NullN()")
-
- for i, v := range exp {
- if v == nil {
- v = []byte{}
- }
- assert.Equal(t, v, ab.Value(i), "unexpected BinaryArrayBuilder.Value(%d)", i)
- }
-
- ar := ab.NewBinaryArray()
- ab.Release()
- ar.Release()
-
- // check state of builder after NewBinaryArray
- assert.Zero(t, ab.Len(), "unexpected ArrayBuilder.Len(), NewBinaryArray did not reset state")
- assert.Zero(t, ab.Cap(), "unexpected ArrayBuilder.Cap(), NewBinaryArray did not reset state")
- assert.Zero(t, ab.NullN(), "unexpected ArrayBuilder.NullN(), NewBinaryArray did not reset state")
-}
-
-func TestBinaryBuilder_ReserveData(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- ab := array.NewBinaryBuilder(mem, arrow.BinaryTypes.Binary)
-
- // call ReserveData and ensure the capacity doesn't change
- // when appending entries until that count.
- ab.ReserveData(256)
- expCap := ab.DataCap()
- for i := 0; i < 256 / 8; i++ {
- ab.Append(bytes.Repeat([]byte("a"), 8))
- }
- assert.Equal(t, expCap, ab.DataCap(), "unexpected BinaryArrayBuilder.DataCap()")
-
- ar := ab.NewBinaryArray()
- ab.Release()
- ar.Release()
-
- // check state of builder after NewBinaryArray
- assert.Zero(t, ab.Len(), "unexpected ArrayBuilder.Len(), NewBinaryArray did not reset state")
- assert.Zero(t, ab.Cap(), "unexpected ArrayBuilder.Cap(), NewBinaryArray did not reset state")
- assert.Zero(t, ab.NullN(), "unexpected ArrayBuilder.NullN(), NewBinaryArray did not reset state")
-}
diff --git a/go/arrow/array/boolean.go b/go/arrow/array/boolean.go
deleted file mode 100644
index e352e6e..0000000
--- a/go/arrow/array/boolean.go
+++ /dev/null
@@ -1,95 +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.
-
-package array
-
-import (
- "fmt"
- "strings"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/bitutil"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-// A type which represents an immutable sequence of boolean values.
-type Boolean struct {
- array
- values []byte
-}
-
-// NewBoolean creates a boolean array from the data memory.Buffer and contains length elements.
-// The nullBitmap buffer can be nil of there are no null values.
-// If nulls is not known, use UnknownNullCount to calculate the value of NullN at runtime from the nullBitmap buffer.
-func NewBoolean(length int, data *memory.Buffer, nullBitmap *memory.Buffer, nulls int) *Boolean {
- return NewBooleanData(NewData(arrow.FixedWidthTypes.Boolean, length, []*memory.Buffer{nullBitmap, data}, nil, nulls, 0))
-}
-
-func NewBooleanData(data *Data) *Boolean {
- a := &Boolean{}
- a.refCount = 1
- a.setData(data)
- return a
-}
-
-func (a *Boolean) Value(i int) bool {
- if i < 0 || i >= a.array.data.length {
- panic("arrow/array: index out of range")
- }
- return bitutil.BitIsSet(a.values, a.array.data.offset+i)
-}
-
-func (a *Boolean) String() string {
- o := new(strings.Builder)
- o.WriteString("[")
- for i := 0; i < a.Len(); i++ {
- if i > 0 {
- fmt.Fprintf(o, " ")
- }
- switch {
- case a.IsNull(i):
- o.WriteString("(null)")
- default:
- fmt.Fprintf(o, "%v", a.Value(i))
- }
- }
- o.WriteString("]")
- return o.String()
-}
-
-func (a *Boolean) setData(data *Data) {
- a.array.setData(data)
- vals := data.buffers[1]
- if vals != nil {
- a.values = vals.Bytes()
- }
-}
-
-func arrayEqualBoolean(left, right *Boolean) bool {
- for i := 0; i < left.Len(); i++ {
- if left.IsNull(i) {
- continue
- }
- if left.Value(i) != right.Value(i) {
- return false
- }
- }
- return true
-}
-
-var (
- _ Interface = (*Boolean)(nil)
-)
diff --git a/go/arrow/array/boolean_test.go b/go/arrow/array/boolean_test.go
deleted file mode 100644
index e2d5805..0000000
--- a/go/arrow/array/boolean_test.go
+++ /dev/null
@@ -1,288 +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.
-
-package array_test
-
-import (
- "fmt"
- "reflect"
- "strings"
- "testing"
-
- "github.com/apache/arrow/go/arrow/array"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-func TestBooleanSliceData(t *testing.T) {
- pool := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer pool.AssertSize(t, 0)
-
- values := []bool{true, false, true, true, true, true, true, false, true, false}
-
- b := array.NewBooleanBuilder(pool)
- defer b.Release()
-
- for _, v := range values {
- b.Append(v)
- }
-
- arr := b.NewArray().(*array.Boolean)
- defer arr.Release()
-
- if got, want := arr.Len(), len(values); got != want {
- t.Fatalf("got=%d, want=%d", got, want)
- }
-
- vs := make([]bool, arr.Len())
-
- for i := range vs {
- vs[i] = arr.Value(i)
- }
-
- if got, want := vs, values; !reflect.DeepEqual(got, want) {
- t.Fatalf("got=%v, want=%v", got, want)
- }
-
- tests := []struct {
- interval [2]int64
- want []bool
- }{
- {
- interval: [2]int64{0, 0},
- want: []bool{},
- },
- {
- interval: [2]int64{10, 10},
- want: []bool{},
- },
- {
- interval: [2]int64{0, 5},
- want: []bool{true, false, true, true, true},
- },
- {
- interval: [2]int64{5, 10},
- want: []bool{true, true, false, true, false},
- },
- {
- interval: [2]int64{2, 7},
- want: []bool{true, true, true, true, true},
- },
- }
-
- for _, tc := range tests {
- t.Run("", func(t *testing.T) {
-
- slice := array.NewSlice(arr, tc.interval[0], tc.interval[1]).(*array.Boolean)
- defer slice.Release()
-
- if got, want := slice.Len(), len(tc.want); got != want {
- t.Fatalf("got=%d, want=%d", got, want)
- }
-
- vs := make([]bool, slice.Len())
-
- for i := range vs {
- vs[i] = slice.Value(i)
- }
-
- if got, want := vs, tc.want; !reflect.DeepEqual(got, want) {
- t.Fatalf("got=%v, want=%v", got, want)
- }
- })
- }
-}
-
-func TestBooleanSliceDataWithNull(t *testing.T) {
- pool := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer pool.AssertSize(t, 0)
-
- values := []bool{true, false, true, false, false, false, true, false, true, false}
- valids := []bool{true, false, true, true, true, true, true, false, true, true}
-
- b := array.NewBooleanBuilder(pool)
- defer b.Release()
-
- b.AppendValues(values, valids)
-
- arr := b.NewArray().(*array.Boolean)
- defer arr.Release()
-
- if got, want := arr.Len(), len(valids); got != want {
- t.Fatalf("got=%d, want=%d", got, want)
- }
-
- if got, want := arr.NullN(), 2; got != want {
- t.Fatalf("got=%d, want=%d", got, want)
- }
-
- vs := make([]bool, arr.Len())
-
- for i := range vs {
- vs[i] = arr.Value(i)
- }
-
- if got, want := vs, values; !reflect.DeepEqual(got, want) {
- t.Fatalf("got=%v, want=%v", got, want)
- }
-
- tests := []struct {
- interval [2]int64
- nulls int
- want []bool
- }{
- {
- interval: [2]int64{2, 9},
- nulls: 1,
- want: []bool{true, false, false, false, true, false, true},
- },
- {
- interval: [2]int64{0, 7},
- nulls: 1,
- want: []bool{true, false, true, false, false, false, true},
- },
- {
- interval: [2]int64{1, 8},
- nulls: 2,
- want: []bool{false, true, false, false, false, true, false},
- },
- {
- interval: [2]int64{2, 7},
- nulls: 0,
- want: []bool{true, false, false, false, true},
- },
- }
-
- for _, tc := range tests {
- t.Run("", func(t *testing.T) {
-
- slice := array.NewSlice(arr, tc.interval[0], tc.interval[1]).(*array.Boolean)
- defer slice.Release()
-
- if got, want := slice.NullN(), tc.nulls; got != want {
- t.Errorf("got=%d, want=%d", got, want)
- }
-
- if got, want := slice.Len(), len(tc.want); got != want {
- t.Fatalf("got=%d, want=%d", got, want)
- }
-
- vs := make([]bool, slice.Len())
-
- for i := range vs {
- vs[i] = slice.Value(i)
- }
-
- if got, want := vs, tc.want; !reflect.DeepEqual(got, want) {
- t.Fatalf("got=%v, want=%v", got, want)
- }
- })
- }
-}
-
-func TestBooleanSliceOutOfBounds(t *testing.T) {
- pool := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer pool.AssertSize(t, 0)
-
- values := []bool{true, false, true, false, true, false, true, false, true, false}
-
- b := array.NewBooleanBuilder(pool)
- defer b.Release()
-
- for _, v := range values {
- b.Append(v)
- }
-
- arr := b.NewArray().(*array.Boolean)
- defer arr.Release()
-
- slice := array.NewSlice(arr, 3, 8).(*array.Boolean)
- defer slice.Release()
-
- tests := []struct {
- index int
- panic bool
- }{
- {
- index: -1,
- panic: true,
- },
- {
- index: 5,
- panic: true,
- },
- {
- index: 0,
- panic: false,
- },
- {
- index: 4,
- panic: false,
- },
- }
-
- for _, tc := range tests {
- t.Run("", func(t *testing.T) {
-
- var val bool
-
- if tc.panic {
- defer func() {
- e := recover()
- if e == nil {
- t.Fatalf("this should have panicked, but did not; slice value %v", val)
- }
- if got, want := e.(string), "arrow/array: index out of range"; got != want {
- t.Fatalf("invalid error. got=%q, want=%q", got, want)
- }
- }()
- } else {
- defer func() {
- if e := recover(); e != nil {
- t.Fatalf("unexpected panic: %v", e)
- }
- }()
- }
-
- val = slice.Value(tc.index)
- })
- }
-}
-
-func TestBooleanStringer(t *testing.T) {
- pool := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer pool.AssertSize(t, 0)
-
- var (
- values = []bool{true, false, true, false, true, false, true, false, true, false}
- valids = []bool{true, true, false, true, true, true, false, true, true, true}
- )
-
- b := array.NewBooleanBuilder(pool)
- defer b.Release()
-
- b.AppendValues(values, valids)
-
- arr := b.NewArray().(*array.Boolean)
- defer arr.Release()
-
- out := new(strings.Builder)
- fmt.Fprintf(out, "%v", arr)
-
- const want = "[true false (null) false true false (null) false true false]"
- if got := out.String(); got != want {
- t.Fatalf("invalid stringer:\ngot= %q\nwant=%q", got, want)
- }
-}
diff --git a/go/arrow/array/booleanbuilder.go b/go/arrow/array/booleanbuilder.go
deleted file mode 100644
index 4a38156..0000000
--- a/go/arrow/array/booleanbuilder.go
+++ /dev/null
@@ -1,165 +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.
-
-package array
-
-import (
- "sync/atomic"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/bitutil"
- "github.com/apache/arrow/go/arrow/internal/debug"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-type BooleanBuilder struct {
- builder
-
- data *memory.Buffer
- rawData []byte
-}
-
-func NewBooleanBuilder(mem memory.Allocator) *BooleanBuilder {
- return &BooleanBuilder{builder: builder{refCount: 1, mem: mem}}
-}
-
-// Release decreases the reference count by 1.
-// When the reference count goes to zero, the memory is freed.
-// Release may be called simultaneously from multiple goroutines.
-func (b *BooleanBuilder) Release() {
- debug.Assert(atomic.LoadInt64(&b.refCount) > 0, "too many releases")
-
- if atomic.AddInt64(&b.refCount, -1) == 0 {
- if b.nullBitmap != nil {
- b.nullBitmap.Release()
- b.nullBitmap = nil
- }
- if b.data != nil {
- b.data.Release()
- b.data = nil
- b.rawData = nil
- }
- }
-}
-
-func (b *BooleanBuilder) Append(v bool) {
- b.Reserve(1)
- b.UnsafeAppend(v)
-}
-
-func (b *BooleanBuilder) AppendByte(v byte) {
- b.Reserve(1)
- b.UnsafeAppend(v != 0)
-}
-
-func (b *BooleanBuilder) AppendNull() {
- b.Reserve(1)
- b.UnsafeAppendBoolToBitmap(false)
-}
-
-func (b *BooleanBuilder) UnsafeAppend(v bool) {
- bitutil.SetBit(b.nullBitmap.Bytes(), b.length)
- if v {
- bitutil.SetBit(b.rawData, b.length)
- } else {
- bitutil.ClearBit(b.rawData, b.length)
- }
- b.length++
-}
-
-func (b *BooleanBuilder) AppendValues(v []bool, valid []bool) {
- if len(v) != len(valid) && len(valid) != 0 {
- panic("len(v) != len(valid) && len(valid) != 0")
- }
-
- if len(v) == 0 {
- return
- }
-
- b.Reserve(len(v))
- for i, vv := range v {
- bitutil.SetBitTo(b.rawData, b.length+i, vv)
- }
- b.builder.unsafeAppendBoolsToBitmap(valid, len(v))
-}
-
-func (b *BooleanBuilder) init(capacity int) {
- b.builder.init(capacity)
-
- b.data = memory.NewResizableBuffer(b.mem)
- bytesN := arrow.BooleanTraits.BytesRequired(capacity)
- b.data.Resize(bytesN)
- b.rawData = b.data.Bytes()
-}
-
-// Reserve ensures there is enough space for appending n elements
-// by checking the capacity and calling Resize if necessary.
-func (b *BooleanBuilder) Reserve(n int) {
- b.builder.reserve(n, b.Resize)
-}
-
-// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
-// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
-func (b *BooleanBuilder) Resize(n int) {
- if n < minBuilderCapacity {
- n = minBuilderCapacity
- }
-
- if b.capacity == 0 {
- b.init(n)
- } else {
- b.builder.resize(n, b.init)
- b.data.Resize(arrow.BooleanTraits.BytesRequired(n))
- b.rawData = b.data.Bytes()
- }
-}
-
-// NewArray creates a Boolean array from the memory buffers used by the builder and resets the BooleanBuilder
-// so it can be used to build a new array.
-func (b *BooleanBuilder) NewArray() Interface {
- return b.NewBooleanArray()
-}
-
-// NewBooleanArray creates a Boolean array from the memory buffers used by the builder and resets the BooleanBuilder
-// so it can be used to build a new array.
-func (b *BooleanBuilder) NewBooleanArray() (a *Boolean) {
- data := b.newData()
- a = NewBooleanData(data)
- data.Release()
- return
-}
-
-func (b *BooleanBuilder) newData() *Data {
- bytesRequired := arrow.BooleanTraits.BytesRequired(b.length)
- if bytesRequired > 0 && bytesRequired < b.data.Len() {
- // trim buffers
- b.data.Resize(bytesRequired)
- }
- res := NewData(arrow.FixedWidthTypes.Boolean, b.length, []*memory.Buffer{b.nullBitmap, b.data}, nil, b.nulls, 0)
- b.reset()
-
- if b.data != nil {
- b.data.Release()
- b.data = nil
- b.rawData = nil
- }
-
- return res
-}
-
-var (
- _ Builder = (*BooleanBuilder)(nil)
-)
diff --git a/go/arrow/array/booleanbuilder_test.go b/go/arrow/array/booleanbuilder_test.go
deleted file mode 100644
index 26de4c9..0000000
--- a/go/arrow/array/booleanbuilder_test.go
+++ /dev/null
@@ -1,90 +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.
-
-package array_test
-
-import (
- "testing"
-
- "github.com/apache/arrow/go/arrow/array"
- "github.com/apache/arrow/go/arrow/internal/testing/tools"
- "github.com/apache/arrow/go/arrow/memory"
- "github.com/stretchr/testify/assert"
-)
-
-func TestBooleanBuilder_AppendValues(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- b := array.NewBooleanBuilder(mem)
-
- exp := tools.Bools(1, 1, 0, 1, 1, 0, 1, 0)
- got := make([]bool, len(exp))
-
- b.AppendValues(exp, nil)
- a := b.NewBooleanArray()
- b.Release()
- for i := 0; i < a.Len(); i++ {
- got[i] = a.Value(i)
- }
- assert.Equal(t, exp, got)
- a.Release()
-}
-
-func TestBooleanBuilder_Empty(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- ab := array.NewBooleanBuilder(mem)
- defer ab.Release()
-
- want := tools.Bools(1, 1, 0, 1, 1, 0, 1, 0)
-
- boolValues := func(a *array.Boolean) []bool {
- vs := make([]bool, a.Len())
- for i := range vs {
- vs[i] = a.Value(i)
- }
- return vs
- }
-
- ab.AppendValues([]bool{}, nil)
- a := ab.NewBooleanArray()
- assert.Zero(t, a.Len())
- a.Release()
-
- ab.AppendValues(nil, nil)
- a = ab.NewBooleanArray()
- assert.Zero(t, a.Len())
- a.Release()
-
- ab.AppendValues(want, nil)
- a = ab.NewBooleanArray()
- assert.Equal(t, want, boolValues(a))
- a.Release()
-
- ab.AppendValues([]bool{}, nil)
- ab.AppendValues(want, nil)
- a = ab.NewBooleanArray()
- assert.Equal(t, want, boolValues(a))
- a.Release()
-
- ab.AppendValues(want, nil)
- ab.AppendValues([]bool{}, nil)
- a = ab.NewBooleanArray()
- assert.Equal(t, want, boolValues(a))
- a.Release()
-}
diff --git a/go/arrow/array/bufferbuilder.go b/go/arrow/array/bufferbuilder.go
deleted file mode 100644
index bcc7153..0000000
--- a/go/arrow/array/bufferbuilder.go
+++ /dev/null
@@ -1,127 +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.
-
-package array
-
-import (
- "sync/atomic"
-
- "github.com/apache/arrow/go/arrow/bitutil"
- "github.com/apache/arrow/go/arrow/internal/debug"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-// A bufferBuilder provides common functionality for populating memory with a sequence of type-specific values.
-// Specialized implementations provide type-safe APIs for appending and accessing the memory.
-type bufferBuilder struct {
- refCount int64
- mem memory.Allocator
- buffer *memory.Buffer
- length int
- capacity int
-
- bytes []byte
-}
-
-// Retain increases the reference count by 1.
-// Retain may be called simultaneously from multiple goroutines.
-func (b *bufferBuilder) Retain() {
- atomic.AddInt64(&b.refCount, 1)
-}
-
-// Release decreases the reference count by 1.
-// When the reference count goes to zero, the memory is freed.
-// Release may be called simultaneously from multiple goroutines.
-func (b *bufferBuilder) Release() {
- debug.Assert(atomic.LoadInt64(&b.refCount) > 0, "too many releases")
-
- if atomic.AddInt64(&b.refCount, -1) == 0 {
- if b.buffer != nil {
- b.buffer.Release()
- b.buffer, b.bytes = nil, nil
- }
- }
-}
-
-// Len returns the length of the memory buffer in bytes.
-func (b *bufferBuilder) Len() int { return b.length }
-
-// Cap returns the total number of bytes that can be stored without allocating additional memory.
-func (b *bufferBuilder) Cap() int { return b.capacity }
-
-// Bytes returns a slice of length b.Len().
-// The slice is only valid for use until the next buffer modification. That is, until the next call
-// to Advance, Reset, Finish or any Append function. The slice aliases the buffer content at least until the next
-// buffer modification.
-func (b *bufferBuilder) Bytes() []byte { return b.bytes[:b.length] }
-
-func (b *bufferBuilder) resize(elements int) {
- if b.buffer == nil {
- b.buffer = memory.NewResizableBuffer(b.mem)
- }
-
- b.buffer.Resize(elements)
- oldCapacity := b.capacity
- b.capacity = b.buffer.Cap()
- b.bytes = b.buffer.Buf()
-
- if b.capacity > oldCapacity {
- memory.Set(b.bytes[oldCapacity:], 0)
- }
-}
-
-// Advance increases the buffer by length and initializes the skipped bytes to zero.
-func (b *bufferBuilder) Advance(length int) {
- if b.capacity < b.length+length {
- newCapacity := bitutil.NextPowerOf2(b.length + length)
- b.resize(newCapacity)
- }
- b.length += length
-}
-
-// Append appends the contents of v to the buffer, resizing it if necessary.
-func (b *bufferBuilder) Append(v []byte) {
- if b.capacity < b.length+len(v) {
- newCapacity := bitutil.NextPowerOf2(b.length + len(v))
- b.resize(newCapacity)
- }
- b.unsafeAppend(v)
-}
-
-// Reset returns the buffer to an empty state. Reset releases the memory and sets the length and capacity to zero.
-func (b *bufferBuilder) Reset() {
- if b.buffer != nil {
- b.buffer.Release()
- }
- b.buffer, b.bytes = nil, nil
- b.capacity, b.length = 0, 0
-}
-
-// Finish TODO(sgc)
-func (b *bufferBuilder) Finish() (buffer *memory.Buffer) {
- if b.length > 0 {
- b.buffer.ResizeNoShrink(b.length)
- }
- buffer = b.buffer
- b.buffer = nil
- b.Reset()
- return
-}
-
-func (b *bufferBuilder) unsafeAppend(data []byte) {
- copy(b.bytes[b.length:], data)
- b.length += len(data)
-}
diff --git a/go/arrow/array/bufferbuilder_byte.go b/go/arrow/array/bufferbuilder_byte.go
deleted file mode 100644
index f5f5445..0000000
--- a/go/arrow/array/bufferbuilder_byte.go
+++ /dev/null
@@ -1,30 +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.
-
-package array
-
-import "github.com/apache/arrow/go/arrow/memory"
-
-type byteBufferBuilder struct {
- bufferBuilder
-}
-
-func newByteBufferBuilder(mem memory.Allocator) *byteBufferBuilder {
- return &byteBufferBuilder{bufferBuilder: bufferBuilder{refCount: 1, mem: mem}}
-}
-
-func (b *byteBufferBuilder) Values() []byte { return b.Bytes() }
-func (b *byteBufferBuilder) Value(i int) byte { return b.bytes[i] }
diff --git a/go/arrow/array/bufferbuilder_numeric.gen.go b/go/arrow/array/bufferbuilder_numeric.gen.go
deleted file mode 100644
index 4cdf426..0000000
--- a/go/arrow/array/bufferbuilder_numeric.gen.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Code generated by array/bufferbuilder_numeric.gen.go.tmpl. DO NOT EDIT.
-
-// 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 array
-
-import (
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/bitutil"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-type int32BufferBuilder struct {
- bufferBuilder
-}
-
-func newInt32BufferBuilder(mem memory.Allocator) *int32BufferBuilder {
- return &int32BufferBuilder{bufferBuilder: bufferBuilder{refCount: 1, mem: mem}}
-}
-
-// AppendValues appends the contents of v to the buffer, growing the buffer as needed.
-func (b *int32BufferBuilder) AppendValues(v []int32) { b.Append(arrow.Int32Traits.CastToBytes(v)) }
-
-// Values returns a slice of length b.Len().
-// The slice is only valid for use until the next buffer modification. That is, until the next call
-// to Advance, Reset, Finish or any Append function. The slice aliases the buffer content at least until the next
-// buffer modification.
-func (b *int32BufferBuilder) Values() []int32 { return arrow.Int32Traits.CastFromBytes(b.Bytes()) }
-
-// Value returns the int32 element at the index i. Value will panic if i is negative or ≥ Len.
-func (b *int32BufferBuilder) Value(i int) int32 { return b.Values()[i] }
-
-// Len returns the number of int32 elements in the buffer.
-func (b *int32BufferBuilder) Len() int { return b.length / arrow.Int32SizeBytes }
-
-// AppendValue appends v to the buffer, growing the buffer as needed.
-func (b *int32BufferBuilder) AppendValue(v int32) {
- if b.capacity < b.length+arrow.Int32SizeBytes {
- newCapacity := bitutil.NextPowerOf2(b.length + arrow.Int32SizeBytes)
- b.resize(newCapacity)
- }
- arrow.Int32Traits.PutValue(b.bytes[b.length:], v)
- b.length += arrow.Int32SizeBytes
-}
diff --git a/go/arrow/array/bufferbuilder_numeric.gen.go.tmpl b/go/arrow/array/bufferbuilder_numeric.gen.go.tmpl
deleted file mode 100644
index a0ff764..0000000
--- a/go/arrow/array/bufferbuilder_numeric.gen.go.tmpl
+++ /dev/null
@@ -1,61 +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.
-
-package array
-
-import (
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/bitutil"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-{{range .In}}
-{{$TypeNamePrefix := .name}}
-{{if .Opt.BufferBuilder}}
-type {{$TypeNamePrefix}}BufferBuilder struct {
- bufferBuilder
-}
-
-func new{{.Name}}BufferBuilder(mem memory.Allocator) *{{$TypeNamePrefix}}BufferBuilder {
- return &{{$TypeNamePrefix}}BufferBuilder{bufferBuilder:bufferBuilder{refCount: 1, mem:mem}}
-}
-
-// AppendValues appends the contents of v to the buffer, growing the buffer as needed.
-func (b *{{$TypeNamePrefix}}BufferBuilder) AppendValues(v []{{.Type}}) { b.Append(arrow.{{.Name}}Traits.CastToBytes(v)) }
-
-// Values returns a slice of length b.Len().
-// The slice is only valid for use until the next buffer modification. That is, until the next call
-// to Advance, Reset, Finish or any Append function. The slice aliases the buffer content at least until the next
-// buffer modification.
-func (b *{{$TypeNamePrefix}}BufferBuilder) Values() []{{.Type}} { return arrow.{{.Name}}Traits.CastFromBytes(b.Bytes()) }
-
-// Value returns the {{.Type}} element at the index i. Value will panic if i is negative or ≥ Len.
-func (b *{{$TypeNamePrefix}}BufferBuilder) Value(i int) {{.Type}} { return b.Values()[i] }
-
-// Len returns the number of {{.Type}} elements in the buffer.
-func (b *{{$TypeNamePrefix}}BufferBuilder) Len() int { return b.length/arrow.{{.Name}}SizeBytes }
-
-// AppendValue appends v to the buffer, growing the buffer as needed.
-func (b *{{$TypeNamePrefix}}BufferBuilder) AppendValue(v {{.Type}}) {
- if b.capacity < b.length+arrow.{{.Name}}SizeBytes {
- newCapacity := bitutil.NextPowerOf2(b.length + arrow.{{.Name}}SizeBytes)
- b.resize(newCapacity)
- }
- arrow.{{.Name}}Traits.PutValue(b.bytes[b.length:], v)
- b.length+=arrow.{{.Name}}SizeBytes
-}
-{{end}}
-{{end}}
diff --git a/go/arrow/array/bufferbuilder_numeric_test.go b/go/arrow/array/bufferbuilder_numeric_test.go
deleted file mode 100644
index 7834679..0000000
--- a/go/arrow/array/bufferbuilder_numeric_test.go
+++ /dev/null
@@ -1,106 +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.
-
-package array
-
-import (
- "testing"
- "unsafe"
-
- "github.com/apache/arrow/go/arrow/memory"
- "github.com/apache/arrow/go/arrow/endian"
- "github.com/stretchr/testify/assert"
-)
-
-func TestInt32BufferBuilder(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- bb := newInt32BufferBuilder(mem)
- exp := []int32{0x01020304, 0x05060708, 0x090a0b0c, 0x0d0e0f01, 0x02030405, 0x06070809}
- bb.AppendValues(exp[:3])
- bb.AppendValues(exp[3:])
-
- var expBuf []byte
- if endian.IsBigEndian {
- expBuf = []byte{
- 0x01, 0x02, 0x03, 0x04,
- 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0a, 0x0b, 0x0c,
- 0x0d, 0x0e, 0x0f, 0x01,
- 0x02, 0x03, 0x04, 0x05,
- 0x06, 0x07, 0x08, 0x09,
- }
- } else {
- expBuf = []byte{
- 0x04, 0x03, 0x02, 0x01,
- 0x08, 0x07, 0x06, 0x05,
- 0x0c, 0x0b, 0x0a, 0x09,
- 0x01, 0x0f, 0x0e, 0x0d,
- 0x05, 0x04, 0x03, 0x02,
- 0x09, 0x08, 0x07, 0x06,
- }
- }
- assert.Equal(t, expBuf, bb.Bytes(), "unexpected byte values")
- assert.Equal(t, exp, bb.Values(), "unexpected int32 values")
- assert.Equal(t, len(exp), bb.Len(), "unexpected Len()")
-
- buflen := bb.Len()
- bfr := bb.Finish()
- assert.Equal(t, buflen*int(unsafe.Sizeof(int32(0))), bfr.Len(), "Buffer was not resized")
- assert.Len(t, bfr.Bytes(), bfr.Len(), "Buffer.Bytes() != Buffer.Len()")
- bfr.Release()
-
- assert.Len(t, bb.Bytes(), 0, "BufferBuilder was not reset after Finish")
- assert.Zero(t, bb.Len(), "BufferBuilder was not reset after Finish")
- bb.Release()
-}
-
-func TestInt32BufferBuilder_AppendValue(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- bb := newInt32BufferBuilder(mem)
- exp := []int32{0x01020304, 0x05060708, 0x090a0b0c, 0x0d0e0f01, 0x02030405, 0x06070809}
- for _, v := range exp {
- bb.AppendValue(v)
- }
-
- var expBuf []byte
- if endian.IsBigEndian {
- expBuf = []byte{
- 0x01, 0x02, 0x03, 0x04,
- 0x05, 0x06, 0x07, 0x08,
- 0x09, 0x0a, 0x0b, 0x0c,
- 0x0d, 0x0e, 0x0f, 0x01,
- 0x02, 0x03, 0x04, 0x05,
- 0x06, 0x07, 0x08, 0x09,
- }
- } else {
- expBuf = []byte{
- 0x04, 0x03, 0x02, 0x01,
- 0x08, 0x07, 0x06, 0x05,
- 0x0c, 0x0b, 0x0a, 0x09,
- 0x01, 0x0f, 0x0e, 0x0d,
- 0x05, 0x04, 0x03, 0x02,
- 0x09, 0x08, 0x07, 0x06,
- }
- }
- assert.Equal(t, expBuf, bb.Bytes(), "unexpected byte values")
- assert.Equal(t, exp, bb.Values(), "unexpected int32 values")
- assert.Equal(t, len(exp), bb.Len(), "unexpected Len()")
- bb.Release()
-}
diff --git a/go/arrow/array/builder.go b/go/arrow/array/builder.go
deleted file mode 100644
index 0066e1d..0000000
--- a/go/arrow/array/builder.go
+++ /dev/null
@@ -1,289 +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.
-
-package array
-
-import (
- "fmt"
- "sync/atomic"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/bitutil"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-const (
- minBuilderCapacity = 1 << 5
-)
-
-// Builder provides an interface to build arrow arrays.
-type Builder interface {
- // Retain increases the reference count by 1.
- // Retain may be called simultaneously from multiple goroutines.
- Retain()
-
- // Release decreases the reference count by 1.
- Release()
-
- // Len returns the number of elements in the array builder.
- Len() int
-
- // Cap returns the total number of elements that can be stored
- // without allocating additional memory.
- Cap() int
-
- // NullN returns the number of null values in the array builder.
- NullN() int
-
- // AppendNull adds a new null value to the array being built.
- AppendNull()
-
- // Reserve ensures there is enough space for appending n elements
- // by checking the capacity and calling Resize if necessary.
- Reserve(n int)
-
- // Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
- // additional memory will be allocated. If n is smaller, the allocated memory may reduced.
- Resize(n int)
-
- // NewArray creates a new array from the memory buffers used
- // by the builder and resets the Builder so it can be used to build
- // a new array.
- NewArray() Interface
-
- init(capacity int)
- resize(newBits int, init func(int))
-}
-
-// builder provides common functionality for managing the validity bitmap (nulls) when building arrays.
-type builder struct {
- refCount int64
- mem memory.Allocator
- nullBitmap *memory.Buffer
- nulls int
- length int
- capacity int
-}
-
-// Retain increases the reference count by 1.
-// Retain may be called simultaneously from multiple goroutines.
-func (b *builder) Retain() {
- atomic.AddInt64(&b.refCount, 1)
-}
-
-// Len returns the number of elements in the array builder.
-func (b *builder) Len() int { return b.length }
-
-// Cap returns the total number of elements that can be stored without allocating additional memory.
-func (b *builder) Cap() int { return b.capacity }
-
-// NullN returns the number of null values in the array builder.
-func (b *builder) NullN() int { return b.nulls }
-
-func (b *builder) init(capacity int) {
- toAlloc := bitutil.CeilByte(capacity) / 8
- b.nullBitmap = memory.NewResizableBuffer(b.mem)
- b.nullBitmap.Resize(toAlloc)
- b.capacity = capacity
- memory.Set(b.nullBitmap.Buf(), 0)
-}
-
-func (b *builder) reset() {
- if b.nullBitmap != nil {
- b.nullBitmap.Release()
- b.nullBitmap = nil
- }
-
- b.nulls = 0
- b.length = 0
- b.capacity = 0
-}
-
-func (b *builder) resize(newBits int, init func(int)) {
- if b.nullBitmap == nil {
- init(newBits)
- return
- }
-
- newBytesN := bitutil.CeilByte(newBits) / 8
- oldBytesN := b.nullBitmap.Len()
- b.nullBitmap.Resize(newBytesN)
- b.capacity = newBits
- if oldBytesN < newBytesN {
- // TODO(sgc): necessary?
- memory.Set(b.nullBitmap.Buf()[oldBytesN:], 0)
- }
- if newBits < b.length {
- b.length = newBits
- b.nulls = newBits - bitutil.CountSetBits(b.nullBitmap.Buf(), 0, newBits)
- }
-}
-
-func (b *builder) reserve(elements int, resize func(int)) {
- if b.length+elements > b.capacity {
- newCap := bitutil.NextPowerOf2(b.length + elements)
- resize(newCap)
- }
-}
-
-// unsafeAppendBoolsToBitmap appends the contents of valid to the validity bitmap.
-// As an optimization, if the valid slice is empty, the next length bits will be set to valid (not null).
-func (b *builder) unsafeAppendBoolsToBitmap(valid []bool, length int) {
- if len(valid) == 0 {
- b.unsafeSetValid(length)
- return
- }
-
- byteOffset := b.length / 8
- bitOffset := byte(b.length % 8)
- nullBitmap := b.nullBitmap.Bytes()
- bitSet := nullBitmap[byteOffset]
-
- for _, v := range valid {
- if bitOffset == 8 {
- bitOffset = 0
- nullBitmap[byteOffset] = bitSet
- byteOffset++
- bitSet = nullBitmap[byteOffset]
- }
-
- if v {
- bitSet |= bitutil.BitMask[bitOffset]
- } else {
- bitSet &= bitutil.FlippedBitMask[bitOffset]
- b.nulls++
- }
- bitOffset++
- }
-
- if bitOffset != 0 {
- nullBitmap[byteOffset] = bitSet
- }
- b.length += len(valid)
-}
-
-// unsafeSetValid sets the next length bits to valid in the validity bitmap.
-func (b *builder) unsafeSetValid(length int) {
- padToByte := min(8-(b.length%8), length)
- if padToByte == 8 {
- padToByte = 0
- }
- bits := b.nullBitmap.Bytes()
- for i := b.length; i < b.length+padToByte; i++ {
- bitutil.SetBit(bits, i)
- }
-
- start := (b.length + padToByte) / 8
- fastLength := (length - padToByte) / 8
- memory.Set(bits[start:start+fastLength], 0xff)
-
- newLength := b.length + length
- // trailing bytes
- for i := b.length + padToByte + (fastLength * 8); i < newLength; i++ {
- bitutil.SetBit(bits, i)
- }
-
- b.length = newLength
-}
-
-func (b *builder) UnsafeAppendBoolToBitmap(isValid bool) {
- if isValid {
- bitutil.SetBit(b.nullBitmap.Bytes(), b.length)
- } else {
- b.nulls++
- }
- b.length++
-}
-
-func NewBuilder(mem memory.Allocator, dtype arrow.DataType) Builder {
- // FIXME(sbinet): use a type switch on dtype instead?
- switch dtype.ID() {
- case arrow.NULL:
- return NewNullBuilder(mem)
- case arrow.BOOL:
- return NewBooleanBuilder(mem)
- case arrow.UINT8:
- return NewUint8Builder(mem)
- case arrow.INT8:
- return NewInt8Builder(mem)
- case arrow.UINT16:
- return NewUint16Builder(mem)
- case arrow.INT16:
- return NewInt16Builder(mem)
- case arrow.UINT32:
- return NewUint32Builder(mem)
- case arrow.INT32:
- return NewInt32Builder(mem)
- case arrow.UINT64:
- return NewUint64Builder(mem)
- case arrow.INT64:
- return NewInt64Builder(mem)
- case arrow.FLOAT16:
- return NewFloat16Builder(mem)
- case arrow.FLOAT32:
- return NewFloat32Builder(mem)
- case arrow.FLOAT64:
- return NewFloat64Builder(mem)
- case arrow.STRING:
- return NewStringBuilder(mem)
- case arrow.BINARY:
- return NewBinaryBuilder(mem, arrow.BinaryTypes.Binary)
- case arrow.FIXED_SIZE_BINARY:
- typ := dtype.(*arrow.FixedSizeBinaryType)
- return NewFixedSizeBinaryBuilder(mem, typ)
- case arrow.DATE32:
- return NewDate32Builder(mem)
- case arrow.DATE64:
- return NewDate64Builder(mem)
- case arrow.TIMESTAMP:
- typ := dtype.(*arrow.TimestampType)
- return NewTimestampBuilder(mem, typ)
- case arrow.TIME32:
- typ := dtype.(*arrow.Time32Type)
- return NewTime32Builder(mem, typ)
- case arrow.TIME64:
- typ := dtype.(*arrow.Time64Type)
- return NewTime64Builder(mem, typ)
- case arrow.INTERVAL:
- switch dtype.(type) {
- case *arrow.DayTimeIntervalType:
- return NewDayTimeIntervalBuilder(mem)
- case *arrow.MonthIntervalType:
- return NewMonthIntervalBuilder(mem)
- }
- case arrow.DECIMAL:
- if typ, ok := dtype.(*arrow.Decimal128Type); ok {
- return NewDecimal128Builder(mem, typ)
- }
- case arrow.LIST:
- typ := dtype.(*arrow.ListType)
- return NewListBuilder(mem, typ.Elem())
- case arrow.STRUCT:
- typ := dtype.(*arrow.StructType)
- return NewStructBuilder(mem, typ)
- case arrow.UNION:
- case arrow.DICTIONARY:
- case arrow.MAP:
- case arrow.EXTENSION:
- case arrow.FIXED_SIZE_LIST:
- typ := dtype.(*arrow.FixedSizeListType)
- return NewFixedSizeListBuilder(mem, typ.Len(), typ.Elem())
- case arrow.DURATION:
- typ := dtype.(*arrow.DurationType)
- return NewDurationBuilder(mem, typ)
- }
- panic(fmt.Errorf("arrow/array: unsupported builder for %T", dtype))
-}
diff --git a/go/arrow/array/builder_test.go b/go/arrow/array/builder_test.go
deleted file mode 100644
index 76dfaee..0000000
--- a/go/arrow/array/builder_test.go
+++ /dev/null
@@ -1,83 +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.
-
-package array
-
-import (
- "testing"
-
- "github.com/apache/arrow/go/arrow/internal/testing/tools"
- "github.com/apache/arrow/go/arrow/memory"
- "github.com/stretchr/testify/assert"
-)
-
-func TestBuilder_Init(t *testing.T) {
- type exp struct{ size int }
- tests := []struct {
- name string
- cap int
-
- exp exp
- }{
- {"07 bits", 07, exp{size: 1}},
- {"19 bits", 19, exp{size: 3}},
- }
- for _, test := range tests {
- t.Run(test.name, func(t *testing.T) {
- ab := &builder{mem: memory.NewGoAllocator()}
- ab.init(test.cap)
- assert.Equal(t, test.cap, ab.Cap(), "invalid capacity")
- assert.Equal(t, test.exp.size, ab.nullBitmap.Len(), "invalid length")
- })
- }
-}
-
-func TestBuilder_UnsafeSetValid(t *testing.T) {
- ab := &builder{mem: memory.NewGoAllocator()}
- ab.init(32)
- ab.unsafeAppendBoolsToBitmap(tools.Bools(0, 0, 0, 0, 0), 5)
- assert.Equal(t, 5, ab.Len())
- assert.Equal(t, []byte{0, 0, 0, 0}, ab.nullBitmap.Bytes())
-
- ab.unsafeSetValid(17)
- assert.Equal(t, []byte{0xe0, 0xff, 0x3f, 0}, ab.nullBitmap.Bytes())
-}
-
-func TestBuilder_resize(t *testing.T) {
- b := &builder{mem: memory.NewGoAllocator()}
- n := 64
-
- b.init(n)
- assert.Equal(t, n, b.Cap())
- assert.Equal(t, 0, b.Len())
-
- b.UnsafeAppendBoolToBitmap(true)
- for i := 1; i < n; i++ {
- b.UnsafeAppendBoolToBitmap(false)
- }
- assert.Equal(t, n, b.Cap())
- assert.Equal(t, n, b.Len())
- assert.Equal(t, n-1, b.NullN())
-
- n = 5
- b.resize(n, b.init)
- assert.Equal(t, n, b.Len())
- assert.Equal(t, n-1, b.NullN())
-
- b.resize(32, b.init)
- assert.Equal(t, n, b.Len())
- assert.Equal(t, n-1, b.NullN())
-}
diff --git a/go/arrow/array/compare.go b/go/arrow/array/compare.go
deleted file mode 100644
index 537630d..0000000
--- a/go/arrow/array/compare.go
+++ /dev/null
@@ -1,474 +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.
-
-package array
-
-import (
- "math"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/float16"
- "golang.org/x/xerrors"
-)
-
-// RecordEqual reports whether the two provided records are equal.
-func RecordEqual(left, right Record) bool {
- switch {
- case left.NumCols() != right.NumCols():
- return false
- case left.NumRows() != right.NumRows():
- return false
- }
-
- for i := range left.Columns() {
- lc := left.Column(i)
- rc := right.Column(i)
- if !ArrayEqual(lc, rc) {
- return false
- }
- }
- return true
-}
-
-// RecordApproxEqual reports whether the two provided records are approximately equal.
-// For non-floating point columns, it is equivalent to RecordEqual.
-func RecordApproxEqual(left, right Record, opts ...EqualOption) bool {
- switch {
- case left.NumCols() != right.NumCols():
- return false
- case left.NumRows() != right.NumRows():
- return false
- }
-
- opt := newEqualOption(opts...)
-
- for i := range left.Columns() {
- lc := left.Column(i)
- rc := right.Column(i)
- if !arrayApproxEqual(lc, rc, opt) {
- return false
- }
- }
- return true
-}
-
-// ArrayEqual reports whether the two provided arrays are equal.
-func ArrayEqual(left, right Interface) bool {
- switch {
- case !baseArrayEqual(left, right):
- return false
- case left.Len() == 0:
- return true
- case left.NullN() == left.Len():
- return true
- }
-
- // at this point, we know both arrays have same type, same length, same number of nulls
- // and nulls at the same place.
- // compare the values.
-
- switch l := left.(type) {
- case *Null:
- return true
- case *Boolean:
- r := right.(*Boolean)
- return arrayEqualBoolean(l, r)
- case *FixedSizeBinary:
- r := right.(*FixedSizeBinary)
- return arrayEqualFixedSizeBinary(l, r)
- case *Binary:
- r := right.(*Binary)
- return arrayEqualBinary(l, r)
- case *String:
- r := right.(*String)
- return arrayEqualString(l, r)
- case *Int8:
- r := right.(*Int8)
- return arrayEqualInt8(l, r)
- case *Int16:
- r := right.(*Int16)
- return arrayEqualInt16(l, r)
- case *Int32:
- r := right.(*Int32)
- return arrayEqualInt32(l, r)
- case *Int64:
- r := right.(*Int64)
- return arrayEqualInt64(l, r)
- case *Uint8:
- r := right.(*Uint8)
- return arrayEqualUint8(l, r)
- case *Uint16:
- r := right.(*Uint16)
- return arrayEqualUint16(l, r)
- case *Uint32:
- r := right.(*Uint32)
- return arrayEqualUint32(l, r)
- case *Uint64:
- r := right.(*Uint64)
- return arrayEqualUint64(l, r)
- case *Float16:
- r := right.(*Float16)
- return arrayEqualFloat16(l, r)
- case *Float32:
- r := right.(*Float32)
- return arrayEqualFloat32(l, r)
- case *Float64:
- r := right.(*Float64)
- return arrayEqualFloat64(l, r)
- case *Decimal128:
- r := right.(*Decimal128)
- return arrayEqualDecimal128(l, r)
- case *Date32:
- r := right.(*Date32)
- return arrayEqualDate32(l, r)
- case *Date64:
- r := right.(*Date64)
- return arrayEqualDate64(l, r)
- case *Time32:
- r := right.(*Time32)
- return arrayEqualTime32(l, r)
- case *Time64:
- r := right.(*Time64)
- return arrayEqualTime64(l, r)
- case *Timestamp:
- r := right.(*Timestamp)
- return arrayEqualTimestamp(l, r)
- case *List:
- r := right.(*List)
- return arrayEqualList(l, r)
- case *FixedSizeList:
- r := right.(*FixedSizeList)
- return arrayEqualFixedSizeList(l, r)
- case *Struct:
- r := right.(*Struct)
- return arrayEqualStruct(l, r)
- case *MonthInterval:
- r := right.(*MonthInterval)
- return arrayEqualMonthInterval(l, r)
- case *DayTimeInterval:
- r := right.(*DayTimeInterval)
- return arrayEqualDayTimeInterval(l, r)
- case *Duration:
- r := right.(*Duration)
- return arrayEqualDuration(l, r)
-
- default:
- panic(xerrors.Errorf("arrow/array: unknown array type %T", l))
- }
-}
-
-// ArraySliceEqual reports whether slices left[lbeg:lend] and right[rbeg:rend] are equal.
-func ArraySliceEqual(left Interface, lbeg, lend int64, right Interface, rbeg, rend int64) bool {
- l := NewSlice(left, lbeg, lend)
- defer l.Release()
- r := NewSlice(right, rbeg, rend)
- defer r.Release()
-
- return ArrayEqual(l, r)
-}
-
-const defaultAbsoluteTolerance = 1e-5
-
-type equalOption struct {
- atol float64 // absolute tolerance
- nansEq bool // whether NaNs are considered equal.
-}
-
-func (eq equalOption) f16(f1, f2 float16.Num) bool {
- v1 := float64(f1.Float32())
- v2 := float64(f2.Float32())
- switch {
- case eq.nansEq:
- return math.Abs(v1-v2) <= eq.atol || (math.IsNaN(v1) && math.IsNaN(v2))
- default:
- return math.Abs(v1-v2) <= eq.atol
- }
-}
-
-func (eq equalOption) f32(f1, f2 float32) bool {
- v1 := float64(f1)
- v2 := float64(f2)
- switch {
- case eq.nansEq:
- return math.Abs(v1-v2) <= eq.atol || (math.IsNaN(v1) && math.IsNaN(v2))
- default:
- return math.Abs(v1-v2) <= eq.atol
- }
-}
-
-func (eq equalOption) f64(v1, v2 float64) bool {
- switch {
- case eq.nansEq:
- return math.Abs(v1-v2) <= eq.atol || (math.IsNaN(v1) && math.IsNaN(v2))
- default:
- return math.Abs(v1-v2) <= eq.atol
- }
-}
-
-func newEqualOption(opts ...EqualOption) equalOption {
- eq := equalOption{
- atol: defaultAbsoluteTolerance,
- nansEq: false,
- }
- for _, opt := range opts {
- opt(&eq)
- }
-
- return eq
-}
-
-// EqualOption is a functional option type used to configure how Records and Arrays are compared.
-type EqualOption func(*equalOption)
-
-// WithNaNsEqual configures the comparison functions so that NaNs are considered equal.
-func WithNaNsEqual(v bool) EqualOption {
- return func(o *equalOption) {
- o.nansEq = v
- }
-}
-
-// WithAbsTolerance configures the comparison functions so that 2 floating point values
-// v1 and v2 are considered equal if |v1-v2| <= atol.
-func WithAbsTolerance(atol float64) EqualOption {
- return func(o *equalOption) {
- o.atol = atol
- }
-}
-
-// ArrayApproxEqual reports whether the two provided arrays are approximately equal.
-// For non-floating point arrays, it is equivalent to ArrayEqual.
-func ArrayApproxEqual(left, right Interface, opts ...EqualOption) bool {
- opt := newEqualOption(opts...)
- return arrayApproxEqual(left, right, opt)
-}
-
-func arrayApproxEqual(left, right Interface, opt equalOption) bool {
- switch {
- case !baseArrayEqual(left, right):
- return false
- case left.Len() == 0:
- return true
- case left.NullN() == left.Len():
- return true
- }
-
- // at this point, we know both arrays have same type, same length, same number of nulls
- // and nulls at the same place.
- // compare the values.
-
- switch l := left.(type) {
- case *Null:
- return true
- case *Boolean:
- r := right.(*Boolean)
- return arrayEqualBoolean(l, r)
- case *FixedSizeBinary:
- r := right.(*FixedSizeBinary)
- return arrayEqualFixedSizeBinary(l, r)
- case *Binary:
- r := right.(*Binary)
- return arrayEqualBinary(l, r)
- case *String:
- r := right.(*String)
- return arrayEqualString(l, r)
- case *Int8:
- r := right.(*Int8)
- return arrayEqualInt8(l, r)
- case *Int16:
- r := right.(*Int16)
- return arrayEqualInt16(l, r)
- case *Int32:
- r := right.(*Int32)
- return arrayEqualInt32(l, r)
- case *Int64:
- r := right.(*Int64)
- return arrayEqualInt64(l, r)
- case *Uint8:
- r := right.(*Uint8)
- return arrayEqualUint8(l, r)
- case *Uint16:
- r := right.(*Uint16)
- return arrayEqualUint16(l, r)
- case *Uint32:
- r := right.(*Uint32)
- return arrayEqualUint32(l, r)
- case *Uint64:
- r := right.(*Uint64)
- return arrayEqualUint64(l, r)
- case *Float16:
- r := right.(*Float16)
- return arrayApproxEqualFloat16(l, r, opt)
- case *Float32:
- r := right.(*Float32)
- return arrayApproxEqualFloat32(l, r, opt)
- case *Float64:
- r := right.(*Float64)
- return arrayApproxEqualFloat64(l, r, opt)
- case *Decimal128:
- r := right.(*Decimal128)
- return arrayEqualDecimal128(l, r)
- case *Date32:
- r := right.(*Date32)
- return arrayEqualDate32(l, r)
- case *Date64:
- r := right.(*Date64)
- return arrayEqualDate64(l, r)
- case *Time32:
- r := right.(*Time32)
- return arrayEqualTime32(l, r)
- case *Time64:
- r := right.(*Time64)
- return arrayEqualTime64(l, r)
- case *Timestamp:
- r := right.(*Timestamp)
- return arrayEqualTimestamp(l, r)
- case *List:
- r := right.(*List)
- return arrayApproxEqualList(l, r, opt)
- case *FixedSizeList:
- r := right.(*FixedSizeList)
- return arrayApproxEqualFixedSizeList(l, r, opt)
- case *Struct:
- r := right.(*Struct)
- return arrayApproxEqualStruct(l, r, opt)
- case *MonthInterval:
- r := right.(*MonthInterval)
- return arrayEqualMonthInterval(l, r)
- case *DayTimeInterval:
- r := right.(*DayTimeInterval)
- return arrayEqualDayTimeInterval(l, r)
- case *Duration:
- r := right.(*Duration)
- return arrayEqualDuration(l, r)
-
- default:
- panic(xerrors.Errorf("arrow/array: unknown array type %T", l))
- }
-
- return false
-}
-
-func baseArrayEqual(left, right Interface) bool {
- switch {
- case left.Len() != right.Len():
- return false
- case left.NullN() != right.NullN():
- return false
- case !arrow.TypeEqual(left.DataType(), right.DataType()): // We do not check for metadata as in the C++ implementation.
- return false
- case !validityBitmapEqual(left, right):
- return false
- }
- return true
-}
-
-func validityBitmapEqual(left, right Interface) bool {
- // TODO(alexandreyc): make it faster by comparing byte slices of the validity bitmap?
- n := left.Len()
- if n != right.Len() {
- return false
- }
- for i := 0; i < n; i++ {
- if left.IsNull(i) != right.IsNull(i) {
- return false
- }
- }
- return true
-}
-
-func arrayApproxEqualFloat16(left, right *Float16, opt equalOption) bool {
- for i := 0; i < left.Len(); i++ {
- if left.IsNull(i) {
- continue
- }
- if !opt.f16(left.Value(i), right.Value(i)) {
- return false
- }
- }
- return true
-}
-
-func arrayApproxEqualFloat32(left, right *Float32, opt equalOption) bool {
- for i := 0; i < left.Len(); i++ {
- if left.IsNull(i) {
- continue
- }
- if !opt.f32(left.Value(i), right.Value(i)) {
- return false
- }
- }
- return true
-}
-
-func arrayApproxEqualFloat64(left, right *Float64, opt equalOption) bool {
- for i := 0; i < left.Len(); i++ {
- if left.IsNull(i) {
- continue
- }
- if !opt.f64(left.Value(i), right.Value(i)) {
- return false
- }
- }
- return true
-}
-
-func arrayApproxEqualList(left, right *List, opt equalOption) bool {
- for i := 0; i < left.Len(); i++ {
- if left.IsNull(i) {
- continue
- }
- o := func() bool {
- l := left.newListValue(i)
- defer l.Release()
- r := right.newListValue(i)
- defer r.Release()
- return arrayApproxEqual(l, r, opt)
- }()
- if !o {
- return false
- }
- }
- return true
-}
-
-func arrayApproxEqualFixedSizeList(left, right *FixedSizeList, opt equalOption) bool {
- for i := 0; i < left.Len(); i++ {
- if left.IsNull(i) {
- continue
- }
- o := func() bool {
- l := left.newListValue(i)
- defer l.Release()
- r := right.newListValue(i)
- defer r.Release()
- return arrayApproxEqual(l, r, opt)
- }()
- if !o {
- return false
- }
- }
- return true
-}
-
-func arrayApproxEqualStruct(left, right *Struct, opt equalOption) bool {
- for i, lf := range left.fields {
- rf := right.fields[i]
- if !arrayApproxEqual(lf, rf, opt) {
- return false
- }
- }
- return true
-}
diff --git a/go/arrow/array/compare_test.go b/go/arrow/array/compare_test.go
deleted file mode 100644
index 3ed326b..0000000
--- a/go/arrow/array/compare_test.go
+++ /dev/null
@@ -1,531 +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.
-
-package array_test
-
-import (
- "fmt"
- "math"
- "testing"
-
- "github.com/apache/arrow/go/arrow/array"
- "github.com/apache/arrow/go/arrow/float16"
- "github.com/apache/arrow/go/arrow/internal/arrdata"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-func TestArrayEqual(t *testing.T) {
- for name, recs := range arrdata.Records {
- t.Run(name, func(t *testing.T) {
- rec := recs[0]
- schema := rec.Schema()
- for i, col := range rec.Columns() {
- t.Run(schema.Field(i).Name, func(t *testing.T) {
- arr := col
- if !array.ArrayEqual(arr, arr) {
- t.Fatalf("identical arrays should compare equal:\narray=%v", arr)
- }
- sub1 := array.NewSlice(arr, 1, int64(arr.Len()))
- defer sub1.Release()
-
- sub2 := array.NewSlice(arr, 0, int64(arr.Len()-1))
- defer sub2.Release()
-
- if array.ArrayEqual(sub1, sub2) && name != "nulls" {
- t.Fatalf("non-identical arrays should not compare equal:\nsub1=%v\nsub2=%v\narrf=%v\n", sub1, sub2, arr)
- }
- })
- }
- })
- }
-}
-
-func TestArraySliceEqual(t *testing.T) {
- for name, recs := range arrdata.Records {
- t.Run(name, func(t *testing.T) {
- rec := recs[0]
- schema := rec.Schema()
- for i, col := range rec.Columns() {
- t.Run(schema.Field(i).Name, func(t *testing.T) {
- arr := col
- if !array.ArraySliceEqual(
- arr, 0, int64(arr.Len()),
- arr, 0, int64(arr.Len()),
- ) {
- t.Fatalf("identical slices should compare equal:\narray=%v", arr)
- }
- sub1 := array.NewSlice(arr, 1, int64(arr.Len()))
- defer sub1.Release()
-
- sub2 := array.NewSlice(arr, 0, int64(arr.Len()-1))
- defer sub2.Release()
-
- if array.ArraySliceEqual(sub1, 0, int64(sub1.Len()), sub2, 0, int64(sub2.Len())) && name != "nulls" {
- t.Fatalf("non-identical slices should not compare equal:\nsub1=%v\nsub2=%v\narrf=%v\n", sub1, sub2, arr)
- }
- })
- }
- })
- }
-}
-
-func TestArrayApproxEqual(t *testing.T) {
- for name, recs := range arrdata.Records {
- t.Run(name, func(t *testing.T) {
- rec := recs[0]
- schema := rec.Schema()
- for i, col := range rec.Columns() {
- t.Run(schema.Field(i).Name, func(t *testing.T) {
- arr := col
- if !array.ArrayApproxEqual(arr, arr) {
- t.Fatalf("identical arrays should compare equal:\narray=%v", arr)
- }
- sub1 := array.NewSlice(arr, 1, int64(arr.Len()))
- defer sub1.Release()
-
- sub2 := array.NewSlice(arr, 0, int64(arr.Len()-1))
- defer sub2.Release()
-
- if array.ArrayApproxEqual(sub1, sub2) && name != "nulls" {
- t.Fatalf("non-identical arrays should not compare equal:\nsub1=%v\nsub2=%v\narrf=%v\n", sub1, sub2, arr)
- }
- })
- }
- })
- }
-}
-
-func TestArrayApproxEqualFloats(t *testing.T) {
- f16sFrom := func(vs []float64) []float16.Num {
- o := make([]float16.Num, len(vs))
- for i, v := range vs {
- o[i] = float16.New(float32(v))
- }
- return o
- }
-
- for _, tc := range []struct {
- name string
- a1 interface{}
- a2 interface{}
- opts []array.EqualOption
- want bool
- }{
- {
- name: "f16",
- a1: f16sFrom([]float64{1, 2, 3, 4, 5, 6}),
- a2: f16sFrom([]float64{1, 2, 3, 4, 5, 6}),
- want: true,
- },
- {
- name: "f16-no-tol",
- a1: f16sFrom([]float64{1, 2, 3, 4, 5, 6}),
- a2: f16sFrom([]float64{1, 2, 3, 4, 5, 7}),
- want: false,
- },
- {
- name: "f16-tol-ok",
- a1: f16sFrom([]float64{1, 2, 3, 4, 5, 6}),
- a2: f16sFrom([]float64{1, 2, 3, 4, 5, 7}),
- opts: []array.EqualOption{array.WithAbsTolerance(1)},
- want: true,
- },
- {
- name: "f16-nan",
- a1: f16sFrom([]float64{1, 2, 3, 4, 5, 6}),
- a2: f16sFrom([]float64{1, 2, 3, 4, 5, math.NaN()}),
- want: false,
- },
- {
- name: "f16-nan-not",
- a1: f16sFrom([]float64{1, 2, 3, 4, 5, 6}),
- a2: f16sFrom([]float64{1, 2, 3, 4, 5, math.NaN()}),
- opts: []array.EqualOption{array.WithNaNsEqual(true)},
- want: false,
- },
- {
- name: "f16-nan-ok",
- a1: f16sFrom([]float64{1, 2, 3, 4, 5, math.NaN()}),
- a2: f16sFrom([]float64{1, 2, 3, 4, 5, math.NaN()}),
- opts: []array.EqualOption{array.WithNaNsEqual(true)},
- want: true,
- },
- {
- name: "f16-nan-no-tol",
- a1: f16sFrom([]float64{1, 2, 3, 4, 5, math.NaN()}),
- a2: f16sFrom([]float64{1, 2, 3, 4, 6, math.NaN()}),
- opts: []array.EqualOption{array.WithNaNsEqual(true)},
- want: false,
- },
- {
- name: "f16-nan-tol",
- a1: f16sFrom([]float64{1, 2, 3, 4, 5, math.NaN()}),
- a2: f16sFrom([]float64{1, 2, 3, 4, 6, math.NaN()}),
- opts: []array.EqualOption{array.WithNaNsEqual(true), array.WithAbsTolerance(1)},
- want: true,
- },
- {
- name: "f32",
- a1: []float32{1, 2, 3, 4, 5, 6},
- a2: []float32{1, 2, 3, 4, 5, 6},
- want: true,
- },
- {
- name: "f32-no-tol",
- a1: []float32{1, 2, 3, 4, 5, 6},
- a2: []float32{1, 2, 3, 4, 5, 7},
- want: false,
- },
- {
- name: "f32-tol-ok",
- a1: []float32{1, 2, 3, 4, 5, 6},
- a2: []float32{1, 2, 3, 4, 5, 7},
- opts: []array.EqualOption{array.WithAbsTolerance(1)},
- want: true,
- },
- {
- name: "f32-nan",
- a1: []float32{1, 2, 3, 4, 5, 6},
- a2: []float32{1, 2, 3, 4, 5, float32(math.NaN())},
- want: false,
- },
- {
- name: "f32-nan-not",
- a1: []float32{1, 2, 3, 4, 5, 6},
- a2: []float32{1, 2, 3, 4, 5, float32(math.NaN())},
- opts: []array.EqualOption{array.WithNaNsEqual(true)},
- want: false,
- },
- {
- name: "f32-nan-ok",
- a1: []float32{1, 2, 3, 4, 5, float32(math.NaN())},
- a2: []float32{1, 2, 3, 4, 5, float32(math.NaN())},
- opts: []array.EqualOption{array.WithNaNsEqual(true)},
- want: true,
- },
- {
- name: "f32-nan-no-tol",
- a1: []float32{1, 2, 3, 4, 5, float32(math.NaN())},
- a2: []float32{1, 2, 3, 4, 6, float32(math.NaN())},
- opts: []array.EqualOption{array.WithNaNsEqual(true)},
- want: false,
- },
- {
- name: "f32-nan-tol",
- a1: []float32{1, 2, 3, 4, 5, float32(math.NaN())},
- a2: []float32{1, 2, 3, 4, 6, float32(math.NaN())},
- opts: []array.EqualOption{array.WithNaNsEqual(true), array.WithAbsTolerance(1)},
- want: true,
- },
- {
- name: "f64",
- a1: []float64{1, 2, 3, 4, 5, 6},
- a2: []float64{1, 2, 3, 4, 5, 6},
- want: true,
- },
- {
- name: "f64-no-tol",
- a1: []float64{1, 2, 3, 4, 5, 6},
- a2: []float64{1, 2, 3, 4, 5, 7},
- want: false,
- },
- {
- name: "f64-tol-ok",
- a1: []float64{1, 2, 3, 4, 5, 6},
- a2: []float64{1, 2, 3, 4, 5, 7},
- opts: []array.EqualOption{array.WithAbsTolerance(1)},
- want: true,
- },
- {
- name: "f64-nan",
- a1: []float64{1, 2, 3, 4, 5, 6},
- a2: []float64{1, 2, 3, 4, 5, math.NaN()},
- want: false,
- },
- {
- name: "f64-nan-not",
- a1: []float64{1, 2, 3, 4, 5, 6},
- a2: []float64{1, 2, 3, 4, 5, math.NaN()},
- opts: []array.EqualOption{array.WithNaNsEqual(true)},
- want: false,
- },
- {
- name: "f64-nan-ok",
- a1: []float64{1, 2, 3, 4, 5, math.NaN()},
- a2: []float64{1, 2, 3, 4, 5, math.NaN()},
- opts: []array.EqualOption{array.WithNaNsEqual(true)},
- want: true,
- },
- {
- name: "f64-nan-no-tol",
- a1: []float64{1, 2, 3, 4, 5, math.NaN()},
- a2: []float64{1, 2, 3, 4, 6, math.NaN()},
- opts: []array.EqualOption{array.WithNaNsEqual(true)},
- want: false,
- },
- {
- name: "f64-nan-tol",
- a1: []float64{1, 2, 3, 4, 5, math.NaN()},
- a2: []float64{1, 2, 3, 4, 6, math.NaN()},
- opts: []array.EqualOption{array.WithNaNsEqual(true), array.WithAbsTolerance(1)},
- want: true,
- },
- } {
- t.Run(tc.name, func(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- a1 := arrayOf(mem, tc.a1, nil)
- defer a1.Release()
- a2 := arrayOf(mem, tc.a2, nil)
- defer a2.Release()
-
- if got, want := array.ArrayApproxEqual(a1, a2, tc.opts...), tc.want; got != want {
- t.Fatalf("invalid comparison: got=%v, want=%v\na1: %v\na2: %v\n", got, want, a1, a2)
- }
- })
- }
-}
-
-func arrayOf(mem memory.Allocator, a interface{}, valids []bool) array.Interface {
- if mem == nil {
- mem = memory.NewGoAllocator()
- }
-
- switch a := a.(type) {
- case []float16.Num:
- bldr := array.NewFloat16Builder(mem)
- defer bldr.Release()
-
- bldr.AppendValues(a, valids)
- return bldr.NewFloat16Array()
-
- case []float32:
- bldr := array.NewFloat32Builder(mem)
- defer bldr.Release()
-
- bldr.AppendValues(a, valids)
- return bldr.NewFloat32Array()
-
- case []float64:
- bldr := array.NewFloat64Builder(mem)
- defer bldr.Release()
-
- bldr.AppendValues(a, valids)
- return bldr.NewFloat64Array()
-
- default:
- panic(fmt.Errorf("arrdata: invalid data slice type %T", a))
- }
-}
-
-func TestArrayEqualBaseArray(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- b1 := array.NewBooleanBuilder(mem)
- defer b1.Release()
- b1.Append(true)
- a1 := b1.NewBooleanArray()
- defer a1.Release()
-
- b2 := array.NewBooleanBuilder(mem)
- defer b2.Release()
- a2 := b2.NewBooleanArray()
- defer a2.Release()
-
- if array.ArrayEqual(a1, a2) {
- t.Errorf("two arrays with different lengths must not be equal")
- }
-
- b3 := array.NewBooleanBuilder(mem)
- defer b3.Release()
- b3.AppendNull()
- a3 := b3.NewBooleanArray()
- defer a3.Release()
-
- if array.ArrayEqual(a1, a3) {
- t.Errorf("two arrays with different number of null values must not be equal")
- }
-
- b4 := array.NewInt32Builder(mem)
- defer b4.Release()
- b4.Append(0)
- a4 := b4.NewInt32Array()
- defer a4.Release()
-
- if array.ArrayEqual(a1, a4) {
- t.Errorf("two arrays with different types must not be equal")
- }
-
- b5 := array.NewBooleanBuilder(mem)
- defer b5.Release()
- b5.AppendNull()
- b5.Append(true)
- a5 := b5.NewBooleanArray()
- defer a5.Release()
- b1.AppendNull()
-
- if array.ArrayEqual(a1, a5) {
- t.Errorf("two arrays with different validity bitmaps must not be equal")
- }
-}
-
-func TestArrayEqualNull(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- null := array.NewNull(0)
- defer null.Release()
-
- if !array.ArrayEqual(null, null) {
- t.Fatalf("identical arrays should compare equal")
- }
-
- n0 := array.NewNull(10)
- defer n0.Release()
-
- n1 := array.NewNull(10)
- defer n1.Release()
-
- if !array.ArrayEqual(n0, n0) {
- t.Fatalf("identical arrays should compare equal")
- }
- if !array.ArrayEqual(n1, n1) {
- t.Fatalf("identical arrays should compare equal")
- }
- if !array.ArrayEqual(n0, n1) || !array.ArrayEqual(n1, n0) {
- t.Fatalf("n0 and n1 should compare equal")
- }
-
- sub07 := array.NewSlice(n0, 0, 7)
- defer sub07.Release()
- sub08 := array.NewSlice(n0, 0, 8)
- defer sub08.Release()
- sub19 := array.NewSlice(n0, 1, 9)
- defer sub19.Release()
-
- if !array.ArrayEqual(sub08, sub19) {
- t.Fatalf("sub08 and sub19 should compare equal")
- }
-
- if array.ArrayEqual(sub08, sub07) {
- t.Fatalf("sub08 and sub07 should not compare equal")
- }
-}
-
-func TestArrayEqualMaskedArray(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- ab := array.NewInt32Builder(mem)
- defer ab.Release()
-
- valids := []bool{false, false, false, false}
- ab.AppendValues([]int32{1, 2, 0, 4}, valids)
-
- a1 := ab.NewInt32Array()
- defer a1.Release()
-
- ab.AppendValues([]int32{1, 2, 3, 4}, valids)
- a2 := ab.NewInt32Array()
- defer a2.Release()
-
- if !array.ArrayEqual(a1, a1) || !array.ArrayEqual(a2, a2) {
- t.Errorf("an array must be equal to itself")
- }
-
- if !array.ArrayEqual(a1, a2) {
- t.Errorf("%v must be equal to %v", a1, a2)
- }
-}
-
-func TestArrayEqualDifferentMaskedValues(t *testing.T) {
- // test 2 int32 arrays, with same nulls (but different masked values) compare equal.
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- ab := array.NewInt32Builder(mem)
- defer ab.Release()
-
- valids := []bool{true, true, false, true}
- ab.AppendValues([]int32{1, 2, 0, 4}, valids)
-
- a1 := ab.NewInt32Array()
- defer a1.Release()
-
- ab.AppendValues([]int32{1, 2, 3, 4}, valids)
- a2 := ab.NewInt32Array()
- defer a2.Release()
-
- if !array.ArrayEqual(a1, a1) || !array.ArrayEqual(a2, a2) {
- t.Errorf("an array must be equal to itself")
- }
-
- if !array.ArrayEqual(a1, a2) {
- t.Errorf("%v must be equal to %v", a1, a2)
- }
-}
-
-func TestRecordEqual(t *testing.T) {
- for name, recs := range arrdata.Records {
- t.Run(name, func(t *testing.T) {
- rec0 := recs[0]
- rec1 := recs[1]
- if !array.RecordEqual(rec0, rec0) {
- t.Fatalf("identical records should compare equal:\nrecord:\n%v", rec0)
- }
-
- if array.RecordEqual(rec0, rec1) && name != "nulls" {
- t.Fatalf("non-identical records should not compare equal:\nrec0:\n%v\nrec1:\n%v", rec0, rec1)
- }
-
- sub00 := rec0.NewSlice(0, recs[0].NumRows()-1)
- defer sub00.Release()
- sub01 := rec0.NewSlice(1, recs[0].NumRows())
- defer sub01.Release()
-
- if array.RecordEqual(sub00, sub01) && name != "nulls" {
- t.Fatalf("non-identical records should not compare equal:\nsub0:\n%v\nsub1:\n%v", sub00, sub01)
- }
- })
- }
-}
-
-func TestRecordApproxEqual(t *testing.T) {
- for name, recs := range arrdata.Records {
- t.Run(name, func(t *testing.T) {
- rec0 := recs[0]
- rec1 := recs[1]
- if !array.RecordApproxEqual(rec0, rec0) {
- t.Fatalf("identical records should compare equal:\nrecord:\n%v", rec0)
- }
-
- if array.RecordApproxEqual(rec0, rec1) && name != "nulls" {
- t.Fatalf("non-identical records should not compare equal:\nrec0:\n%v\nrec1:\n%v", rec0, rec1)
- }
-
- sub00 := rec0.NewSlice(0, recs[0].NumRows()-1)
- defer sub00.Release()
- sub01 := rec0.NewSlice(1, recs[0].NumRows())
- defer sub01.Release()
-
- if array.RecordApproxEqual(sub00, sub01) && name != "nulls" {
- t.Fatalf("non-identical records should not compare equal:\nsub0:\n%v\nsub1:\n%v", sub00, sub01)
- }
- })
- }
-}
diff --git a/go/arrow/array/data.go b/go/arrow/array/data.go
deleted file mode 100644
index 2648961..0000000
--- a/go/arrow/array/data.go
+++ /dev/null
@@ -1,179 +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.
-
-package array
-
-import (
- "sync/atomic"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/internal/debug"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-// Data represents the memory and metadata of an Arrow array.
-type Data struct {
- refCount int64
- dtype arrow.DataType
- nulls int
- offset int
- length int
- buffers []*memory.Buffer // TODO(sgc): should this be an interface?
- childData []*Data // TODO(sgc): managed by ListArray, StructArray and UnionArray types
-}
-
-// NewData creates a new Data.
-func NewData(dtype arrow.DataType, length int, buffers []*memory.Buffer, childData []*Data, nulls, offset int) *Data {
- for _, b := range buffers {
- if b != nil {
- b.Retain()
- }
- }
-
- for _, child := range childData {
- if child != nil {
- child.Retain()
- }
- }
-
- return &Data{
- refCount: 1,
- dtype: dtype,
- nulls: nulls,
- length: length,
- offset: offset,
- buffers: buffers,
- childData: childData,
- }
-}
-
-// Reset sets the Data for re-use.
-func (d *Data) Reset(dtype arrow.DataType, length int, buffers []*memory.Buffer, childData []*Data, nulls, offset int) {
- // Retain new buffers before releasing existing buffers in-case they're the same ones to prevent accidental premature
- // release.
- for _, b := range buffers {
- if b != nil {
- b.Retain()
- }
- }
- for _, b := range d.buffers {
- if b != nil {
- b.Release()
- }
- }
- d.buffers = buffers
-
- // Retain new children data before releasing existing children data in-case they're the same ones to prevent accidental
- // premature release.
- for _, d := range childData {
- if d != nil {
- d.Retain()
- }
- }
- for _, d := range d.childData {
- if d != nil {
- d.Release()
- }
- }
- d.childData = childData
-
- d.dtype = dtype
- d.length = length
- d.nulls = nulls
- d.offset = offset
-}
-
-// Retain increases the reference count by 1.
-// Retain may be called simultaneously from multiple goroutines.
-func (d *Data) Retain() {
- atomic.AddInt64(&d.refCount, 1)
-}
-
-// Release decreases the reference count by 1.
-// When the reference count goes to zero, the memory is freed.
-// Release may be called simultaneously from multiple goroutines.
-func (d *Data) Release() {
- debug.Assert(atomic.LoadInt64(&d.refCount) > 0, "too many releases")
-
- if atomic.AddInt64(&d.refCount, -1) == 0 {
- for _, b := range d.buffers {
- if b != nil {
- b.Release()
- }
- }
-
- for _, b := range d.childData {
- b.Release()
- }
- d.buffers, d.childData = nil, nil
- }
-}
-
-// DataType returns the DataType of the data.
-func (d *Data) DataType() arrow.DataType { return d.dtype }
-
-// NullN returns the number of nulls.
-func (d *Data) NullN() int { return d.nulls }
-
-// Len returns the length.
-func (d *Data) Len() int { return d.length }
-
-// Offset returns the offset.
-func (d *Data) Offset() int { return d.offset }
-
-// Buffers returns the buffers.
-func (d *Data) Buffers() []*memory.Buffer { return d.buffers }
-
-// NewSliceData returns a new slice that shares backing data with the input.
-// The returned Data slice starts at i and extends j-i elements, such as:
-// slice := data[i:j]
-// The returned value must be Release'd after use.
-//
-// NewSliceData panics if the slice is outside the valid range of the input Data.
-// NewSliceData panics if j < i.
-func NewSliceData(data *Data, i, j int64) *Data {
- if j > int64(data.length) || i > j || data.offset+int(i) > data.offset+data.length {
- panic("arrow/array: index out of range")
- }
-
- for _, b := range data.buffers {
- if b != nil {
- b.Retain()
- }
- }
-
- for _, child := range data.childData {
- if child != nil {
- child.Retain()
- }
- }
-
- o := &Data{
- refCount: 1,
- dtype: data.dtype,
- nulls: UnknownNullCount,
- length: int(j - i),
- offset: data.offset + int(i),
- buffers: data.buffers,
- childData: data.childData,
- }
-
- if data.nulls == 0 {
- o.nulls = 0
- }
-
- return o
-}
diff --git a/go/arrow/array/data_test.go b/go/arrow/array/data_test.go
deleted file mode 100644
index de87b80..0000000
--- a/go/arrow/array/data_test.go
+++ /dev/null
@@ -1,51 +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.
-
-package array
-
-import (
- "testing"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/memory"
- "github.com/stretchr/testify/assert"
-)
-
-func TestDataReset(t *testing.T) {
- var (
- buffers1 = make([]*memory.Buffer, 0, 3)
- buffers2 = make([]*memory.Buffer, 0, 3)
- )
- for i := 0; i < cap(buffers1); i++ {
- buffers1 = append(buffers1, memory.NewBufferBytes([]byte("some-bytes1")))
- buffers2 = append(buffers2, memory.NewBufferBytes([]byte("some-bytes2")))
- }
-
- data := NewData(&arrow.StringType{}, 10, buffers1, nil, 0, 0)
- data.Reset(&arrow.Int64Type{}, 5, buffers2, nil, 1, 2)
-
- for i := 0; i < 2; i++ {
- assert.Equal(t, buffers2, data.Buffers())
- assert.Equal(t, &arrow.Int64Type{}, data.DataType())
- assert.Equal(t, 1, data.NullN())
- assert.Equal(t, 2, data.Offset())
- assert.Equal(t, 5, data.Len())
-
- // Make sure it works when resetting the data with its own buffers (new buffers are retained
- // before old ones are released.)
- data.Reset(&arrow.Int64Type{}, 5, data.Buffers(), nil, 1, 2)
- }
-}
diff --git a/go/arrow/array/decimal128.go b/go/arrow/array/decimal128.go
deleted file mode 100644
index 3acf6b9..0000000
--- a/go/arrow/array/decimal128.go
+++ /dev/null
@@ -1,235 +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.
-
-package array // import "github.com/apache/arrow/go/arrow/array"
-
-import (
- "fmt"
- "strings"
- "sync/atomic"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/bitutil"
- "github.com/apache/arrow/go/arrow/decimal128"
- "github.com/apache/arrow/go/arrow/internal/debug"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-// A type which represents an immutable sequence of 128-bit decimal values.
-type Decimal128 struct {
- array
-
- values []decimal128.Num
-}
-
-func NewDecimal128Data(data *Data) *Decimal128 {
- a := &Decimal128{}
- a.refCount = 1
- a.setData(data)
- return a
-}
-
-func (a *Decimal128) Value(i int) decimal128.Num { return a.values[i] }
-
-func (a *Decimal128) Values() []decimal128.Num { return a.values }
-
-func (a *Decimal128) String() string {
- o := new(strings.Builder)
- o.WriteString("[")
- for i := 0; i < a.Len(); i++ {
- if i > 0 {
- fmt.Fprintf(o, " ")
- }
- switch {
- case a.IsNull(i):
- o.WriteString("(null)")
- default:
- fmt.Fprintf(o, "%v", a.Value(i))
- }
- }
- o.WriteString("]")
- return o.String()
-}
-
-func (a *Decimal128) setData(data *Data) {
- a.array.setData(data)
- vals := data.buffers[1]
- if vals != nil {
- a.values = arrow.Decimal128Traits.CastFromBytes(vals.Bytes())
- beg := a.array.data.offset
- end := beg + a.array.data.length
- a.values = a.values[beg:end]
- }
-}
-
-func arrayEqualDecimal128(left, right *Decimal128) bool {
- for i := 0; i < left.Len(); i++ {
- if left.IsNull(i) {
- continue
- }
- if left.Value(i) != right.Value(i) {
- return false
- }
- }
- return true
-}
-
-type Decimal128Builder struct {
- builder
-
- dtype *arrow.Decimal128Type
- data *memory.Buffer
- rawData []decimal128.Num
-}
-
-func NewDecimal128Builder(mem memory.Allocator, dtype *arrow.Decimal128Type) *Decimal128Builder {
- return &Decimal128Builder{
- builder: builder{refCount: 1, mem: mem},
- dtype: dtype,
- }
-}
-
-// Release decreases the reference count by 1.
-// When the reference count goes to zero, the memory is freed.
-func (b *Decimal128Builder) Release() {
- debug.Assert(atomic.LoadInt64(&b.refCount) > 0, "too many releases")
-
- if atomic.AddInt64(&b.refCount, -1) == 0 {
- if b.nullBitmap != nil {
- b.nullBitmap.Release()
- b.nullBitmap = nil
- }
- if b.data != nil {
- b.data.Release()
- b.data = nil
- b.rawData = nil
- }
- }
-}
-
-func (b *Decimal128Builder) Append(v decimal128.Num) {
- b.Reserve(1)
- b.UnsafeAppend(v)
-}
-
-func (b *Decimal128Builder) UnsafeAppend(v decimal128.Num) {
- bitutil.SetBit(b.nullBitmap.Bytes(), b.length)
- b.rawData[b.length] = v
- b.length++
-}
-
-func (b *Decimal128Builder) AppendNull() {
- b.Reserve(1)
- b.UnsafeAppendBoolToBitmap(false)
-}
-
-func (b *Decimal128Builder) UnsafeAppendBoolToBitmap(isValid bool) {
- if isValid {
- bitutil.SetBit(b.nullBitmap.Bytes(), b.length)
- } else {
- b.nulls++
- }
- b.length++
-}
-
-// AppendValues will append the values in the v slice. The valid slice determines which values
-// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
-// all values in v are appended and considered valid.
-func (b *Decimal128Builder) AppendValues(v []decimal128.Num, valid []bool) {
- if len(v) != len(valid) && len(valid) != 0 {
- panic("len(v) != len(valid) && len(valid) != 0")
- }
-
- if len(v) == 0 {
- return
- }
-
- b.Reserve(len(v))
- if len(v) > 0 {
- arrow.Decimal128Traits.Copy(b.rawData[b.length:], v)
- }
- b.builder.unsafeAppendBoolsToBitmap(valid, len(v))
-}
-
-func (b *Decimal128Builder) init(capacity int) {
- b.builder.init(capacity)
-
- b.data = memory.NewResizableBuffer(b.mem)
- bytesN := arrow.Decimal128Traits.BytesRequired(capacity)
- b.data.Resize(bytesN)
- b.rawData = arrow.Decimal128Traits.CastFromBytes(b.data.Bytes())
-}
-
-// Reserve ensures there is enough space for appending n elements
-// by checking the capacity and calling Resize if necessary.
-func (b *Decimal128Builder) Reserve(n int) {
- b.builder.reserve(n, b.Resize)
-}
-
-// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
-// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
-func (b *Decimal128Builder) Resize(n int) {
- nBuilder := n
- if n < minBuilderCapacity {
- n = minBuilderCapacity
- }
-
- if b.capacity == 0 {
- b.init(n)
- } else {
- b.builder.resize(nBuilder, b.init)
- b.data.Resize(arrow.Decimal128Traits.BytesRequired(n))
- b.rawData = arrow.Decimal128Traits.CastFromBytes(b.data.Bytes())
- }
-}
-
-// NewArray creates a Decimal128 array from the memory buffers used by the builder and resets the Decimal128Builder
-// so it can be used to build a new array.
-func (b *Decimal128Builder) NewArray() Interface {
- return b.NewDecimal128Array()
-}
-
-// NewDecimal128Array creates a Decimal128 array from the memory buffers used by the builder and resets the Decimal128Builder
-// so it can be used to build a new array.
-func (b *Decimal128Builder) NewDecimal128Array() (a *Decimal128) {
- data := b.newData()
- a = NewDecimal128Data(data)
- data.Release()
- return
-}
-
-func (b *Decimal128Builder) newData() (data *Data) {
- bytesRequired := arrow.Decimal128Traits.BytesRequired(b.length)
- if bytesRequired > 0 && bytesRequired < b.data.Len() {
- // trim buffers
- b.data.Resize(bytesRequired)
- }
- data = NewData(b.dtype, b.length, []*memory.Buffer{b.nullBitmap, b.data}, nil, b.nulls, 0)
- b.reset()
-
- if b.data != nil {
- b.data.Release()
- b.data = nil
- b.rawData = nil
- }
-
- return
-}
-
-var (
- _ Interface = (*Decimal128)(nil)
- _ Builder = (*Decimal128Builder)(nil)
-)
diff --git a/go/arrow/array/decimal128_test.go b/go/arrow/array/decimal128_test.go
deleted file mode 100644
index 5a39d92..0000000
--- a/go/arrow/array/decimal128_test.go
+++ /dev/null
@@ -1,179 +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.
-
-package array_test
-
-import (
- "testing"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/array"
- "github.com/apache/arrow/go/arrow/decimal128"
- "github.com/apache/arrow/go/arrow/memory"
- "github.com/stretchr/testify/assert"
-)
-
-func TestNewDecimal128Builder(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- ab := array.NewDecimal128Builder(mem, &arrow.Decimal128Type{Precision: 10, Scale: 1})
- defer ab.Release()
-
- ab.Retain()
- ab.Release()
-
- want := []decimal128.Num{
- decimal128.New(1, 1),
- decimal128.New(2, 2),
- decimal128.New(3, 3),
- {},
- decimal128.FromI64(-5),
- decimal128.FromI64(-6),
- {},
- decimal128.FromI64(8),
- decimal128.FromI64(9),
- decimal128.FromI64(10),
- }
- valids := []bool{true, true, true, false, true, true, false, true, true, true}
-
- for i, valid := range valids {
- switch {
- case valid:
- ab.Append(want[i])
- default:
- ab.AppendNull()
- }
- }
-
- // check state of builder before NewDecimal128Array
- assert.Equal(t, 10, ab.Len(), "unexpected Len()")
- assert.Equal(t, 2, ab.NullN(), "unexpected NullN()")
-
- a := ab.NewArray().(*array.Decimal128)
- a.Retain()
- a.Release()
-
- // check state of builder after NewDecimal128Array
- assert.Zero(t, ab.Len(), "unexpected ArrayBuilder.Len(), NewDecimal128Array did not reset state")
- assert.Zero(t, ab.Cap(), "unexpected ArrayBuilder.Cap(), NewDecimal128Array did not reset state")
- assert.Zero(t, ab.NullN(), "unexpected ArrayBuilder.NullN(), NewDecimal128Array did not reset state")
-
- // check state of array
- assert.Equal(t, 2, a.NullN(), "unexpected null count")
-
- assert.Equal(t, want, a.Values(), "unexpected Decimal128Values")
- assert.Equal(t, []byte{0xb7}, a.NullBitmapBytes()[:1]) // 4 bytes due to minBuilderCapacity
- assert.Len(t, a.Values(), 10, "unexpected length of Decimal128Values")
-
- a.Release()
- ab.Append(decimal128.FromI64(7))
- ab.Append(decimal128.FromI64(8))
-
- a = ab.NewDecimal128Array()
-
- assert.Equal(t, 0, a.NullN())
- assert.Equal(t, []decimal128.Num{decimal128.FromI64(7), decimal128.FromI64(8)}, a.Values())
- assert.Len(t, a.Values(), 2)
-
- a.Release()
-}
-
-func TestDecimal128Builder_Empty(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- ab := array.NewDecimal128Builder(mem, &arrow.Decimal128Type{Precision: 10, Scale: 1})
- defer ab.Release()
-
- want := []decimal128.Num{decimal128.FromI64(3), decimal128.FromI64(4)}
-
- ab.AppendValues([]decimal128.Num{}, nil)
- a := ab.NewDecimal128Array()
- assert.Zero(t, a.Len())
- a.Release()
-
- ab.AppendValues(nil, nil)
- a = ab.NewDecimal128Array()
- assert.Zero(t, a.Len())
- a.Release()
-
- ab.AppendValues(want, nil)
- a = ab.NewDecimal128Array()
- assert.Equal(t, want, a.Values())
- a.Release()
-
- ab.AppendValues([]decimal128.Num{}, nil)
- ab.AppendValues(want, nil)
- a = ab.NewDecimal128Array()
- assert.Equal(t, want, a.Values())
- a.Release()
-
- ab.AppendValues(want, nil)
- ab.AppendValues([]decimal128.Num{}, nil)
- a = ab.NewDecimal128Array()
- assert.Equal(t, want, a.Values())
- a.Release()
-}
-
-func TestDecimal128Slice(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- dtype := &arrow.Decimal128Type{Precision: 10, Scale: 1}
- b := array.NewDecimal128Builder(mem, dtype)
- defer b.Release()
-
- var data = []decimal128.Num{
- decimal128.FromI64(-1),
- decimal128.FromI64(+0),
- decimal128.FromI64(+1),
- decimal128.New(-4, 4),
- }
- b.AppendValues(data[:2], nil)
- b.AppendNull()
- b.Append(data[3])
-
- arr := b.NewDecimal128Array()
- defer arr.Release()
-
- if got, want := arr.Len(), len(data); got != want {
- t.Fatalf("invalid array length: got=%d, want=%d", got, want)
- }
-
- slice := array.NewSliceData(arr.Data(), 2, 4)
- defer slice.Release()
-
- sub1 := array.MakeFromData(slice)
- defer sub1.Release()
-
- v, ok := sub1.(*array.Decimal128)
- if !ok {
- t.Fatalf("could not type-assert to array.String")
- }
-
- if got, want := v.String(), `[(null) {4 -4}]`; got != want {
- t.Fatalf("got=%q, want=%q", got, want)
- }
-
- if got, want := v.NullN(), 1; got != want {
- t.Fatalf("got=%q, want=%q", got, want)
- }
-
- if got, want := v.Data().Offset(), 2; got != want {
- t.Fatalf("invalid offset: got=%d, want=%d", got, want)
- }
-}
diff --git a/go/arrow/array/doc.go b/go/arrow/array/doc.go
deleted file mode 100644
index 5cf8540..0000000
--- a/go/arrow/array/doc.go
+++ /dev/null
@@ -1,20 +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.
-
-/*
-Package array provides implementations of various Arrow array types.
-*/
-package array
diff --git a/go/arrow/array/fixed_size_list.go b/go/arrow/array/fixed_size_list.go
deleted file mode 100644
index 5cfaa5c..0000000
--- a/go/arrow/array/fixed_size_list.go
+++ /dev/null
@@ -1,240 +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.
-
-package array
-
-import (
- "fmt"
- "strings"
- "sync/atomic"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/bitutil"
- "github.com/apache/arrow/go/arrow/internal/debug"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-// FixedSizeList represents an immutable sequence of N array values.
-type FixedSizeList struct {
- array
- n int32
- values Interface
-}
-
-// NewFixedSizeListData returns a new List array value, from data.
-func NewFixedSizeListData(data *Data) *FixedSizeList {
- a := &FixedSizeList{}
- a.refCount = 1
- a.setData(data)
- return a
-}
-
-func (a *FixedSizeList) ListValues() Interface { return a.values }
-
-func (a *FixedSizeList) String() string {
- o := new(strings.Builder)
- o.WriteString("[")
- for i := 0; i < a.Len(); i++ {
- if i > 0 {
- o.WriteString(" ")
- }
- if !a.IsValid(i) {
- o.WriteString("(null)")
- continue
- }
- sub := a.newListValue(i)
- fmt.Fprintf(o, "%v", sub)
- sub.Release()
- }
- o.WriteString("]")
- return o.String()
-}
-
-func (a *FixedSizeList) newListValue(i int) Interface {
- n := int64(a.n)
- off := int64(a.array.data.offset)
- beg := (off + int64(i)) * n
- end := (off + int64(i+1)) * n
- sli := NewSlice(a.values, beg, end)
- return sli
-}
-
-func (a *FixedSizeList) setData(data *Data) {
- a.array.setData(data)
- a.n = a.DataType().(*arrow.FixedSizeListType).Len()
- a.values = MakeFromData(data.childData[0])
-}
-
-func arrayEqualFixedSizeList(left, right *FixedSizeList) bool {
- for i := 0; i < left.Len(); i++ {
- if left.IsNull(i) {
- continue
- }
- o := func() bool {
- l := left.newListValue(i)
- defer l.Release()
- r := right.newListValue(i)
- defer r.Release()
- return ArrayEqual(l, r)
- }()
- if !o {
- return false
- }
- }
- return true
-}
-
-// Len returns the number of elements in the array.
-func (a *FixedSizeList) Len() int { return a.array.Len() }
-
-func (a *FixedSizeList) Retain() {
- a.array.Retain()
- a.values.Retain()
-}
-
-func (a *FixedSizeList) Release() {
- a.array.Release()
- a.values.Release()
-}
-
-type FixedSizeListBuilder struct {
- builder
-
- etype arrow.DataType // data type of the list's elements.
- n int32 // number of elements in the fixed-size list.
- values Builder // value builder for the list's elements.
-}
-
-// NewFixedSizeListBuilder returns a builder, using the provided memory allocator.
-// The created list builder will create a list whose elements will be of type etype.
-func NewFixedSizeListBuilder(mem memory.Allocator, n int32, etype arrow.DataType) *FixedSizeListBuilder {
- return &FixedSizeListBuilder{
- builder: builder{refCount: 1, mem: mem},
- etype: etype,
- n: n,
- values: NewBuilder(mem, etype),
- }
-}
-
-// Release decreases the reference count by 1.
-// When the reference count goes to zero, the memory is freed.
-func (b *FixedSizeListBuilder) Release() {
- debug.Assert(atomic.LoadInt64(&b.refCount) > 0, "too many releases")
-
- if atomic.AddInt64(&b.refCount, -1) == 0 {
- if b.nullBitmap != nil {
- b.nullBitmap.Release()
- b.nullBitmap = nil
- }
- if b.values != nil {
- b.values.Release()
- b.values = nil
- }
- }
-}
-
-func (b *FixedSizeListBuilder) Append(v bool) {
- b.Reserve(1)
- b.unsafeAppendBoolToBitmap(v)
-}
-
-func (b *FixedSizeListBuilder) AppendNull() {
- b.Reserve(1)
- b.unsafeAppendBoolToBitmap(false)
-}
-
-func (b *FixedSizeListBuilder) AppendValues(valid []bool) {
- b.Reserve(len(valid))
- b.builder.unsafeAppendBoolsToBitmap(valid, len(valid))
-}
-
-func (b *FixedSizeListBuilder) unsafeAppend(v bool) {
- bitutil.SetBit(b.nullBitmap.Bytes(), b.length)
- b.length++
-}
-
-func (b *FixedSizeListBuilder) unsafeAppendBoolToBitmap(isValid bool) {
- if isValid {
- bitutil.SetBit(b.nullBitmap.Bytes(), b.length)
- } else {
- b.nulls++
- }
- b.length++
-}
-
-func (b *FixedSizeListBuilder) init(capacity int) {
- b.builder.init(capacity)
-}
-
-// Reserve ensures there is enough space for appending n elements
-// by checking the capacity and calling Resize if necessary.
-func (b *FixedSizeListBuilder) Reserve(n int) {
- b.builder.reserve(n, b.Resize)
-}
-
-// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
-// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
-func (b *FixedSizeListBuilder) Resize(n int) {
- if n < minBuilderCapacity {
- n = minBuilderCapacity
- }
-
- if b.capacity == 0 {
- b.init(n)
- } else {
- b.builder.resize(n, b.builder.init)
- }
-}
-
-func (b *FixedSizeListBuilder) ValueBuilder() Builder {
- return b.values
-}
-
-// NewArray creates a List array from the memory buffers used by the builder and resets the FixedSizeListBuilder
-// so it can be used to build a new array.
-func (b *FixedSizeListBuilder) NewArray() Interface {
- return b.NewListArray()
-}
-
-// NewListArray creates a List array from the memory buffers used by the builder and resets the FixedSizeListBuilder
-// so it can be used to build a new array.
-func (b *FixedSizeListBuilder) NewListArray() (a *FixedSizeList) {
- data := b.newData()
- a = NewFixedSizeListData(data)
- data.Release()
- return
-}
-
-func (b *FixedSizeListBuilder) newData() (data *Data) {
- values := b.values.NewArray()
- defer values.Release()
-
- data = NewData(
- arrow.FixedSizeListOf(b.n, b.etype), b.length,
- []*memory.Buffer{b.nullBitmap},
- []*Data{values.Data()},
- b.nulls,
- 0,
- )
- b.reset()
-
- return
-}
-
-var (
- _ Interface = (*FixedSizeList)(nil)
- _ Builder = (*FixedSizeListBuilder)(nil)
-)
diff --git a/go/arrow/array/fixed_size_list_test.go b/go/arrow/array/fixed_size_list_test.go
deleted file mode 100644
index d72bc0b..0000000
--- a/go/arrow/array/fixed_size_list_test.go
+++ /dev/null
@@ -1,215 +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.
-
-package array_test
-
-import (
- "reflect"
- "testing"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/array"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-func TestFixedSizeListArray(t *testing.T) {
- pool := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer pool.AssertSize(t, 0)
-
- var (
- vs = []int32{0, 1, 2, 3, 4, 5, 6}
- lengths = []int{3, 0, 4}
- isValid = []bool{true, false, true}
- )
-
- lb := array.NewFixedSizeListBuilder(pool, int32(len(vs)), arrow.PrimitiveTypes.Int32)
- defer lb.Release()
-
- for i := 0; i < 10; i++ {
- vb := lb.ValueBuilder().(*array.Int32Builder)
- vb.Reserve(len(vs))
-
- pos := 0
- for i, length := range lengths {
- lb.Append(isValid[i])
- for j := 0; j < length; j++ {
- vb.Append(vs[pos])
- pos++
- }
- }
-
- arr := lb.NewArray().(*array.FixedSizeList)
- defer arr.Release()
-
- arr.Retain()
- arr.Release()
-
- if got, want := arr.DataType().ID(), arrow.FIXED_SIZE_LIST; got != want {
- t.Fatalf("got=%v, want=%v", got, want)
- }
-
- if got, want := arr.Len(), len(isValid); got != want {
- t.Fatalf("got=%d, want=%d", got, want)
- }
-
- for i := range lengths {
- if got, want := arr.IsValid(i), isValid[i]; got != want {
- t.Fatalf("got[%d]=%v, want[%d]=%v", i, got, i, want)
- }
- if got, want := arr.IsNull(i), lengths[i] == 0; got != want {
- t.Fatalf("got[%d]=%v, want[%d]=%v", i, got, i, want)
- }
- }
-
- varr := arr.ListValues().(*array.Int32)
- if got, want := varr.Int32Values(), vs; !reflect.DeepEqual(got, want) {
- t.Fatalf("got=%v, want=%v", got, want)
- }
- }
-}
-
-func TestFixedSizeListArrayEmpty(t *testing.T) {
- pool := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer pool.AssertSize(t, 0)
-
- lb := array.NewFixedSizeListBuilder(pool, 3, arrow.PrimitiveTypes.Int32)
- defer lb.Release()
- arr := lb.NewArray().(*array.FixedSizeList)
- defer arr.Release()
- if got, want := arr.Len(), 0; got != want {
- t.Fatalf("got=%d, want=%d", got, want)
- }
-}
-
-func TestFixedSizeListArrayBulkAppend(t *testing.T) {
- pool := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer pool.AssertSize(t, 0)
-
- var (
- vs = []int32{0, 1, 2, 3, 4, 5, 6}
- lengths = []int{3, 0, 4}
- isValid = []bool{true, false, true}
- )
-
- lb := array.NewFixedSizeListBuilder(pool, int32(len(vs)), arrow.PrimitiveTypes.Int32)
- defer lb.Release()
- vb := lb.ValueBuilder().(*array.Int32Builder)
- vb.Reserve(len(vs))
-
- lb.AppendValues(isValid)
- for _, v := range vs {
- vb.Append(v)
- }
-
- arr := lb.NewArray().(*array.FixedSizeList)
- defer arr.Release()
-
- if got, want := arr.DataType().ID(), arrow.FIXED_SIZE_LIST; got != want {
- t.Fatalf("got=%v, want=%v", got, want)
- }
-
- if got, want := arr.Len(), len(isValid); got != want {
- t.Fatalf("got=%d, want=%d", got, want)
- }
-
- for i := range lengths {
- if got, want := arr.IsValid(i), isValid[i]; got != want {
- t.Fatalf("got[%d]=%v, want[%d]=%v", i, got, i, want)
- }
- if got, want := arr.IsNull(i), lengths[i] == 0; got != want {
- t.Fatalf("got[%d]=%v, want[%d]=%v", i, got, i, want)
- }
- }
-
- varr := arr.ListValues().(*array.Int32)
- if got, want := varr.Int32Values(), vs; !reflect.DeepEqual(got, want) {
- t.Fatalf("got=%v, want=%v", got, want)
- }
-}
-
-func TestFixedSizeListArrayStringer(t *testing.T) {
- pool := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer pool.AssertSize(t, 0)
-
- const N = 3
- var (
- vs = [][N]int32{{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {9, -9, -8}}
- isValid = []bool{true, false, true, true}
- )
-
- lb := array.NewFixedSizeListBuilder(pool, N, arrow.PrimitiveTypes.Int32)
- defer lb.Release()
-
- vb := lb.ValueBuilder().(*array.Int32Builder)
- vb.Reserve(len(vs))
-
- for i, v := range vs {
- lb.Append(isValid[i])
- vb.AppendValues(v[:], nil)
- }
-
- arr := lb.NewArray().(*array.FixedSizeList)
- defer arr.Release()
-
- arr.Retain()
- arr.Release()
-
- want := `[[0 1 2] (null) [6 7 8] [9 -9 -8]]`
- if got, want := arr.String(), want; got != want {
- t.Fatalf("got=%q, want=%q", got, want)
- }
-}
-
-func TestFixedSizeListArraySlice(t *testing.T) {
- pool := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer pool.AssertSize(t, 0)
-
- const N = 3
- var (
- vs = [][N]int32{{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {9, -9, -8}}
- isValid = []bool{true, false, true, true}
- )
-
- lb := array.NewFixedSizeListBuilder(pool, N, arrow.PrimitiveTypes.Int32)
- defer lb.Release()
-
- vb := lb.ValueBuilder().(*array.Int32Builder)
- vb.Reserve(len(vs))
-
- for i, v := range vs {
- lb.Append(isValid[i])
- vb.AppendValues(v[:], nil)
- }
-
- arr := lb.NewArray().(*array.FixedSizeList)
- defer arr.Release()
-
- arr.Retain()
- arr.Release()
-
- want := `[[0 1 2] (null) [6 7 8] [9 -9 -8]]`
- if got, want := arr.String(), want; got != want {
- t.Fatalf("got=%q, want=%q", got, want)
- }
-
- sub := array.NewSlice(arr, 1, 3).(*array.FixedSizeList)
- defer sub.Release()
-
- want = `[(null) [6 7 8]]`
- if got, want := sub.String(), want; got != want {
- t.Fatalf("got=%q, want=%q", got, want)
- }
-}
diff --git a/go/arrow/array/fixedsize_binary.go b/go/arrow/array/fixedsize_binary.go
deleted file mode 100644
index 502fb99..0000000
--- a/go/arrow/array/fixedsize_binary.go
+++ /dev/null
@@ -1,95 +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.
-
-package array
-
-import (
- "bytes"
- "fmt"
- "strings"
-
- "github.com/apache/arrow/go/arrow"
-)
-
-// A type which represents an immutable sequence of fixed-length binary strings.
-type FixedSizeBinary struct {
- array
-
- valueBytes []byte
- bytewidth int32
-}
-
-// NewFixedSizeBinaryData constructs a new fixed-size binary array from data.
-func NewFixedSizeBinaryData(data *Data) *FixedSizeBinary {
- a := &FixedSizeBinary{bytewidth: int32(data.DataType().(arrow.FixedWidthDataType).BitWidth() / 8)}
- a.refCount = 1
- a.setData(data)
- return a
-}
-
-// Value returns the fixed-size slice at index i. This value should not be mutated.
-func (a *FixedSizeBinary) Value(i int) []byte {
- i += a.array.data.offset
- var (
- bw = int(a.bytewidth)
- beg = i * bw
- end = (i + 1) * bw
- )
- return a.valueBytes[beg:end]
-}
-
-func (a *FixedSizeBinary) String() string {
- o := new(strings.Builder)
- o.WriteString("[")
- for i := 0; i < a.Len(); i++ {
- if i > 0 {
- o.WriteString(" ")
- }
- switch {
- case a.IsNull(i):
- o.WriteString("(null)")
- default:
- fmt.Fprintf(o, "%q", a.Value(i))
- }
- }
- o.WriteString("]")
- return o.String()
-}
-
-func (a *FixedSizeBinary) setData(data *Data) {
- a.array.setData(data)
- vals := data.buffers[1]
- if vals != nil {
- a.valueBytes = vals.Bytes()
- }
-
-}
-
-func arrayEqualFixedSizeBinary(left, right *FixedSizeBinary) bool {
- for i := 0; i < left.Len(); i++ {
- if left.IsNull(i) {
- continue
- }
- if bytes.Compare(left.Value(i), right.Value(i)) != 0 {
- return false
- }
- }
- return true
-}
-
-var (
- _ Interface = (*FixedSizeBinary)(nil)
-)
diff --git a/go/arrow/array/fixedsize_binary_test.go b/go/arrow/array/fixedsize_binary_test.go
deleted file mode 100644
index 4d2d724..0000000
--- a/go/arrow/array/fixedsize_binary_test.go
+++ /dev/null
@@ -1,111 +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.
-
-package array_test
-
-import (
- "testing"
-
- "github.com/stretchr/testify/assert"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/array"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-func TestFixedSizeBinary(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- dtype := arrow.FixedSizeBinaryType{ByteWidth: 7}
- b := array.NewFixedSizeBinaryBuilder(mem, &dtype)
-
- zero := make([]byte, dtype.ByteWidth)
-
- values := [][]byte{
- []byte("7654321"),
- nil,
- []byte("AZERTYU"),
- }
- valid := []bool{true, false, true}
- b.AppendValues(values, valid)
-
- b.Retain()
- b.Release()
-
- a := b.NewFixedSizeBinaryArray()
- assert.Equal(t, 3, a.Len())
- assert.Equal(t, 1, a.NullN())
- assert.Equal(t, []byte("7654321"), a.Value(0))
- assert.Equal(t, zero, a.Value(1))
- assert.Equal(t, true, a.IsNull(1))
- assert.Equal(t, false, a.IsValid(1))
- assert.Equal(t, []byte("AZERTYU"), a.Value(2))
- a.Release()
-
- // Test builder reset and NewArray API.
- b.AppendValues(values, valid)
- a = b.NewArray().(*array.FixedSizeBinary)
- assert.Equal(t, 3, a.Len())
- assert.Equal(t, 1, a.NullN())
- assert.Equal(t, []byte("7654321"), a.Value(0))
- assert.Equal(t, zero, a.Value(1))
- assert.Equal(t, []byte("AZERTYU"), a.Value(2))
- a.Release()
-
- b.Release()
-}
-
-func TestFixedSizeBinarySlice(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- dtype := &arrow.FixedSizeBinaryType{ByteWidth: 4}
- b := array.NewFixedSizeBinaryBuilder(mem, dtype)
- defer b.Release()
-
- var data = [][]byte{
- []byte("ABCD"),
- []byte("1234"),
- nil,
- []byte("AZER"),
- }
- b.AppendValues(data[:2], nil)
- b.AppendNull()
- b.Append(data[3])
-
- arr := b.NewFixedSizeBinaryArray()
- defer arr.Release()
-
- slice := array.NewSliceData(arr.Data(), 2, 4)
- defer slice.Release()
-
- sub1 := array.MakeFromData(slice)
- defer sub1.Release()
-
- v, ok := sub1.(*array.FixedSizeBinary)
- if !ok {
- t.Fatalf("could not type-assert to array.String")
- }
-
- if got, want := v.String(), `[(null) "AZER"]`; got != want {
- t.Fatalf("got=%q, want=%q", got, want)
- }
-
- if got, want := v.NullN(), 1; got != want {
- t.Fatalf("got=%q, want=%q", got, want)
- }
-}
diff --git a/go/arrow/array/fixedsize_binarybuilder.go b/go/arrow/array/fixedsize_binarybuilder.go
deleted file mode 100644
index 8a2f65f..0000000
--- a/go/arrow/array/fixedsize_binarybuilder.go
+++ /dev/null
@@ -1,154 +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.
-
-package array
-
-import (
- "fmt"
- "sync/atomic"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/internal/debug"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-// A FixedSizeBinaryBuilder is used to build a FixedSizeBinary array using the Append methods.
-type FixedSizeBinaryBuilder struct {
- builder
-
- dtype *arrow.FixedSizeBinaryType
- values *byteBufferBuilder
-}
-
-func NewFixedSizeBinaryBuilder(mem memory.Allocator, dtype *arrow.FixedSizeBinaryType) *FixedSizeBinaryBuilder {
- b := &FixedSizeBinaryBuilder{
- builder: builder{refCount: 1, mem: mem},
- dtype: dtype,
- values: newByteBufferBuilder(mem),
- }
- return b
-}
-
-// Release decreases the reference count by 1.
-// When the reference count goes to zero, the memory is freed.
-// Release may be called simultaneously from multiple goroutines.
-func (b *FixedSizeBinaryBuilder) Release() {
- debug.Assert(atomic.LoadInt64(&b.refCount) > 0, "too many releases")
-
- if atomic.AddInt64(&b.refCount, -1) == 0 {
- if b.nullBitmap != nil {
- b.nullBitmap.Release()
- b.nullBitmap = nil
- }
- if b.values != nil {
- b.values.Release()
- b.values = nil
- }
- }
-}
-
-func (b *FixedSizeBinaryBuilder) Append(v []byte) {
- if len(v) != b.dtype.ByteWidth {
- // TODO(alexandre): should we return an error instead?
- panic("len(v) != b.dtype.ByteWidth")
- }
-
- b.Reserve(1)
- b.values.Append(v)
- b.UnsafeAppendBoolToBitmap(true)
-}
-
-func (b *FixedSizeBinaryBuilder) AppendNull() {
- b.Reserve(1)
- b.values.Advance(b.dtype.ByteWidth)
- b.UnsafeAppendBoolToBitmap(false)
-}
-
-// AppendValues will append the values in the v slice. The valid slice determines which values
-// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
-// all values in v are appended and considered valid.
-func (b *FixedSizeBinaryBuilder) AppendValues(v [][]byte, valid []bool) {
- if len(v) != len(valid) && len(valid) != 0 {
- panic("len(v) != len(valid) && len(valid) != 0")
- }
-
- if len(v) == 0 {
- return
- }
-
- b.Reserve(len(v))
- for _, vv := range v {
- switch len(vv) {
- case 0:
- b.values.Advance(b.dtype.ByteWidth)
- case b.dtype.ByteWidth:
- b.values.Append(vv)
- default:
- panic(fmt.Errorf("array: invalid binary length (got=%d, want=%d)", len(vv), b.dtype.ByteWidth))
- }
- }
-
- b.builder.unsafeAppendBoolsToBitmap(valid, len(v))
-}
-
-func (b *FixedSizeBinaryBuilder) init(capacity int) {
- b.builder.init(capacity)
- b.values.resize(capacity * b.dtype.ByteWidth)
-}
-
-// Reserve ensures there is enough space for appending n elements
-// by checking the capacity and calling Resize if necessary.
-func (b *FixedSizeBinaryBuilder) Reserve(n int) {
- b.builder.reserve(n, b.Resize)
-}
-
-// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
-// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
-func (b *FixedSizeBinaryBuilder) Resize(n int) {
- b.builder.resize(n, b.init)
-}
-
-// NewArray creates a FixedSizeBinary array from the memory buffers used by the
-// builder and resets the FixedSizeBinaryBuilder so it can be used to build a new array.
-func (b *FixedSizeBinaryBuilder) NewArray() Interface {
- return b.NewFixedSizeBinaryArray()
-}
-
-// NewFixedSizeBinaryArray creates a FixedSizeBinary array from the memory buffers used by the builder and resets the FixedSizeBinaryBuilder
-// so it can be used to build a new array.
-func (b *FixedSizeBinaryBuilder) NewFixedSizeBinaryArray() (a *FixedSizeBinary) {
- data := b.newData()
- a = NewFixedSizeBinaryData(data)
- data.Release()
- return
-}
-
-func (b *FixedSizeBinaryBuilder) newData() (data *Data) {
- values := b.values.Finish()
- data = NewData(b.dtype, b.length, []*memory.Buffer{b.nullBitmap, values}, nil, b.nulls, 0)
-
- if values != nil {
- values.Release()
- }
-
- b.builder.reset()
-
- return
-}
-
-var (
- _ Builder = (*FixedSizeBinaryBuilder)(nil)
-)
diff --git a/go/arrow/array/fixedsize_binarybuilder_test.go b/go/arrow/array/fixedsize_binarybuilder_test.go
deleted file mode 100644
index 08740c5..0000000
--- a/go/arrow/array/fixedsize_binarybuilder_test.go
+++ /dev/null
@@ -1,107 +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.
-
-package array
-
-import (
- "testing"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/memory"
- "github.com/stretchr/testify/assert"
-)
-
-func TestFixedSizeBinaryBuilder(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- dtype := arrow.FixedSizeBinaryType{ByteWidth: 7}
- b := NewFixedSizeBinaryBuilder(mem, &dtype)
-
- b.Append([]byte("1234567"))
- b.AppendNull()
- b.Append([]byte("ABCDEFG"))
- b.AppendNull()
-
- assert.Equal(t, 4, b.Len(), "unexpected Len()")
- assert.Equal(t, 2, b.NullN(), "unexpected NullN()")
-
- values := [][]byte{
- []byte("7654321"),
- nil,
- []byte("AZERTYU"),
- }
- b.AppendValues(values, []bool{true, false, true})
-
- assert.Equal(t, 7, b.Len(), "unexpected Len()")
- assert.Equal(t, 3, b.NullN(), "unexpected NullN()")
-
- a := b.NewFixedSizeBinaryArray()
-
- // check state of builder after NewFixedSizeBinaryArray
- assert.Zero(t, b.Len(), "unexpected ArrayBuilder.Len(), NewFixedSizeBinaryArray did not reset state")
- assert.Zero(t, b.Cap(), "unexpected ArrayBuilder.Cap(), NewFixedSizeBinaryArray did not reset state")
- assert.Zero(t, b.NullN(), "unexpected ArrayBuilder.NullN(), NewFixedSizeBinaryArray did not reset state")
- assert.Equal(t, a.String(), `["1234567" (null) "ABCDEFG" (null) "7654321" (null) "AZERTYU"]`)
-
- b.Release()
- a.Release()
-}
-
-func TestFixedSizeBinaryBuilder_Empty(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- dtype := arrow.FixedSizeBinaryType{ByteWidth: 7}
- ab := NewFixedSizeBinaryBuilder(mem, &dtype)
- defer ab.Release()
-
- want := [][]byte{
- []byte("1234567"),
- []byte("AZERTYU"),
- []byte("7654321"),
- }
-
- fixedSizeValues := func(a *FixedSizeBinary) [][]byte {
- vs := make([][]byte, a.Len())
- for i := range vs {
- vs[i] = a.Value(i)
- }
- return vs
- }
-
- ab.AppendValues([][]byte{}, nil)
- a := ab.NewFixedSizeBinaryArray()
- assert.Zero(t, a.Len())
- a.Release()
-
- ab.AppendValues(nil, nil)
- a = ab.NewFixedSizeBinaryArray()
- assert.Zero(t, a.Len())
- a.Release()
-
- ab.AppendValues([][]byte{}, nil)
- ab.AppendValues(want, nil)
- a = ab.NewFixedSizeBinaryArray()
- assert.Equal(t, want, fixedSizeValues(a))
- a.Release()
-
- ab.AppendValues(want, nil)
- ab.AppendValues([][]byte{}, nil)
- a = ab.NewFixedSizeBinaryArray()
- assert.Equal(t, want, fixedSizeValues(a))
- a.Release()
-}
diff --git a/go/arrow/array/float16.go b/go/arrow/array/float16.go
deleted file mode 100644
index 931e2d9..0000000
--- a/go/arrow/array/float16.go
+++ /dev/null
@@ -1,87 +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.
-
-package array
-
-import (
- "fmt"
- "strings"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/float16"
-)
-
-// A type which represents an immutable sequence of Float16 values.
-type Float16 struct {
- array
- values []float16.Num
-}
-
-func NewFloat16Data(data *Data) *Float16 {
- a := &Float16{}
- a.refCount = 1
- a.setData(data)
- return a
-}
-
-func (a *Float16) Value(i int) float16.Num { return a.values[i] }
-
-func (a *Float16) Values() []float16.Num { return a.values }
-
-func (a *Float16) String() string {
- o := new(strings.Builder)
- o.WriteString("[")
- for i := 0; i < a.Len(); i++ {
- if i > 0 {
- fmt.Fprintf(o, " ")
- }
- switch {
- case a.IsNull(i):
- o.WriteString("(null)")
- default:
- fmt.Fprintf(o, "%v", a.values[i].Float32())
- }
- }
- o.WriteString("]")
- return o.String()
-}
-
-func (a *Float16) setData(data *Data) {
- a.array.setData(data)
- vals := data.buffers[1]
- if vals != nil {
- a.values = arrow.Float16Traits.CastFromBytes(vals.Bytes())
- beg := a.array.data.offset
- end := beg + a.array.data.length
- a.values = a.values[beg:end]
- }
-}
-
-func arrayEqualFloat16(left, right *Float16) bool {
- for i := 0; i < left.Len(); i++ {
- if left.IsNull(i) {
- continue
- }
- if left.Value(i) != right.Value(i) {
- return false
- }
- }
- return true
-}
-
-var (
- _ Interface = (*Float16)(nil)
-)
diff --git a/go/arrow/array/float16_builder.go b/go/arrow/array/float16_builder.go
deleted file mode 100644
index 8086427..0000000
--- a/go/arrow/array/float16_builder.go
+++ /dev/null
@@ -1,165 +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.
-
-package array
-
-import (
- "sync/atomic"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/bitutil"
- "github.com/apache/arrow/go/arrow/float16"
- "github.com/apache/arrow/go/arrow/internal/debug"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-type Float16Builder struct {
- builder
-
- data *memory.Buffer
- rawData []float16.Num
-}
-
-func NewFloat16Builder(mem memory.Allocator) *Float16Builder {
- return &Float16Builder{builder: builder{refCount: 1, mem: mem}}
-}
-
-// Release decreases the reference count by 1.
-// When the reference count goes to zero, the memory is freed.
-func (b *Float16Builder) Release() {
- debug.Assert(atomic.LoadInt64(&b.refCount) > 0, "too many releases")
-
- if atomic.AddInt64(&b.refCount, -1) == 0 {
- if b.nullBitmap != nil {
- b.nullBitmap.Release()
- b.nullBitmap = nil
- }
- if b.data != nil {
- b.data.Release()
- b.data = nil
- b.rawData = nil
- }
- }
-}
-
-func (b *Float16Builder) Append(v float16.Num) {
- b.Reserve(1)
- b.UnsafeAppend(v)
-}
-
-func (b *Float16Builder) UnsafeAppend(v float16.Num) {
- bitutil.SetBit(b.nullBitmap.Bytes(), b.length)
- b.rawData[b.length] = v
- b.length++
-}
-
-func (b *Float16Builder) AppendNull() {
- b.Reserve(1)
- b.UnsafeAppendBoolToBitmap(false)
-}
-
-func (b *Float16Builder) UnsafeAppendBoolToBitmap(isValid bool) {
- if isValid {
- bitutil.SetBit(b.nullBitmap.Bytes(), b.length)
- } else {
- b.nulls++
- }
- b.length++
-}
-
-// AppendValues will append the values in the v slice. The valid slice determines which values
-// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
-// all values in v are appended and considered valid.
-func (b *Float16Builder) AppendValues(v []float16.Num, valid []bool) {
- if len(v) != len(valid) && len(valid) != 0 {
- panic("len(v) != len(valid) && len(valid) != 0")
- }
-
- if len(v) == 0 {
- return
- }
-
- b.Reserve(len(v))
- if len(v) > 0 {
- arrow.Float16Traits.Copy(b.rawData[b.length:], v)
- }
- b.builder.unsafeAppendBoolsToBitmap(valid, len(v))
-}
-
-func (b *Float16Builder) init(capacity int) {
- b.builder.init(capacity)
-
- b.data = memory.NewResizableBuffer(b.mem)
- bytesN := arrow.Uint16Traits.BytesRequired(capacity)
- b.data.Resize(bytesN)
- b.rawData = arrow.Float16Traits.CastFromBytes(b.data.Bytes())
-}
-
-// Reserve ensures there is enough space for appending n elements
-// by checking the capacity and calling Resize if necessary.
-func (b *Float16Builder) Reserve(n int) {
- b.builder.reserve(n, b.Resize)
-}
-
-// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
-// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
-func (b *Float16Builder) Resize(n int) {
- nBuilder := n
- if n < minBuilderCapacity {
- n = minBuilderCapacity
- }
-
- if b.capacity == 0 {
- b.init(n)
- } else {
- b.builder.resize(nBuilder, b.init)
- b.data.Resize(arrow.Float16Traits.BytesRequired(n))
- b.rawData = arrow.Float16Traits.CastFromBytes(b.data.Bytes())
- }
-}
-
-// NewArray creates a Float16 array from the memory buffers used by the builder and resets the Float16Builder
-// so it can be used to build a new array.
-func (b *Float16Builder) NewArray() Interface {
- return b.NewFloat16Array()
-}
-
-// NewFloat16Array creates a Float16 array from the memory buffers used by the builder and resets the Float16Builder
-// so it can be used to build a new array.
-func (b *Float16Builder) NewFloat16Array() (a *Float16) {
- data := b.newData()
- a = NewFloat16Data(data)
- data.Release()
- return
-}
-
-func (b *Float16Builder) newData() (data *Data) {
- bytesRequired := arrow.Float16Traits.BytesRequired(b.length)
- if bytesRequired > 0 && bytesRequired < b.data.Len() {
- // trim buffers
- b.data.Resize(bytesRequired)
- }
- data = NewData(arrow.FixedWidthTypes.Float16, b.length, []*memory.Buffer{b.nullBitmap, b.data}, nil, b.nulls, 0)
- b.reset()
-
- if b.data != nil {
- b.data.Release()
- b.data = nil
- b.rawData = nil
- }
-
- return
-}
diff --git a/go/arrow/array/float16_builder_test.go b/go/arrow/array/float16_builder_test.go
deleted file mode 100644
index 23d25d2..0000000
--- a/go/arrow/array/float16_builder_test.go
+++ /dev/null
@@ -1,119 +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.
-
-package array_test
-
-import (
- "testing"
-
- "github.com/apache/arrow/go/arrow/array"
- "github.com/apache/arrow/go/arrow/float16"
- "github.com/apache/arrow/go/arrow/memory"
- "github.com/stretchr/testify/assert"
-)
-
-func float32Values(a *array.Float16) []float32 {
- values := make([]float32, a.Len())
- for i, v := range a.Values() {
- values[i] = v.Float32()
- }
- return values
-}
-
-func TestNewFloat16Builder(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- ab := array.NewFloat16Builder(mem)
-
- ab.Append(float16.New(1))
- ab.Append(float16.New(2))
- ab.Append(float16.New(3))
- ab.AppendNull()
- ab.Append(float16.New(5))
- ab.Append(float16.New(6))
- ab.AppendNull()
- ab.Append(float16.New(8))
- ab.Append(float16.New(9))
- ab.Append(float16.New(10))
-
- // check state of builder before NewFloat16Array
- assert.Equal(t, 10, ab.Len(), "unexpected Len()")
- assert.Equal(t, 2, ab.NullN(), "unexpected NullN()")
-
- a := ab.NewFloat16Array()
-
- // check state of builder after NewFloat16Array
- assert.Zero(t, ab.Len(), "unexpected ArrayBuilder.Len(), NewFloat16Array did not reset state")
- assert.Zero(t, ab.Cap(), "unexpected ArrayBuilder.Cap(), NewFloat16Array did not reset state")
- assert.Zero(t, ab.NullN(), "unexpected ArrayBuilder.NullN(), NewFloat16Array did not reset state")
-
- // check state of array
- assert.Equal(t, 2, a.NullN(), "unexpected null count")
-
- assert.Equal(t, []float32{1, 2, 3, 0, 5, 6, 0, 8, 9, 10}, float32Values(a), "unexpected Float16Values")
- assert.Equal(t, []byte{0xb7}, a.NullBitmapBytes()[:1]) // 4 bytes due to minBuilderCapacity
- assert.Len(t, a.Values(), 10, "unexpected length of Float16Values")
-
- a.Release()
- ab.Append(float16.New(7))
- ab.Append(float16.New(8))
-
- a = ab.NewFloat16Array()
-
- assert.Equal(t, 0, a.NullN())
- assert.Equal(t, []float32{7, 8}, float32Values(a))
- assert.Len(t, a.Values(), 2)
-
- a.Release()
-}
-
-func TestFloat16Builder_Empty(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- ab := array.NewFloat16Builder(mem)
- defer ab.Release()
-
- want := []float16.Num{float16.New(3), float16.New(4)}
-
- ab.AppendValues([]float16.Num{}, nil)
- a := ab.NewFloat16Array()
- assert.Zero(t, a.Len())
- a.Release()
-
- ab.AppendValues(nil, nil)
- a = ab.NewFloat16Array()
- assert.Zero(t, a.Len())
- a.Release()
-
- ab.AppendValues(want, nil)
- a = ab.NewFloat16Array()
- assert.Equal(t, want, a.Values())
- a.Release()
-
- ab.AppendValues([]float16.Num{}, nil)
- ab.AppendValues(want, nil)
- a = ab.NewFloat16Array()
- assert.Equal(t, want, a.Values())
- a.Release()
-
- ab.AppendValues(want, nil)
- ab.AppendValues([]float16.Num{}, nil)
- a = ab.NewFloat16Array()
- assert.Equal(t, want, a.Values())
- a.Release()
-}
diff --git a/go/arrow/array/interval.go b/go/arrow/array/interval.go
deleted file mode 100644
index d313558..0000000
--- a/go/arrow/array/interval.go
+++ /dev/null
@@ -1,434 +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.
-
-package array // import "github.com/apache/arrow/go/arrow/array"
-
-import (
- "fmt"
- "strings"
- "sync/atomic"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/bitutil"
- "github.com/apache/arrow/go/arrow/internal/debug"
- "github.com/apache/arrow/go/arrow/memory"
- "golang.org/x/xerrors"
-)
-
-func NewIntervalData(data *Data) Interface {
- switch data.dtype.(type) {
- case *arrow.MonthIntervalType:
- return NewMonthIntervalData(data)
- case *arrow.DayTimeIntervalType:
- return NewDayTimeIntervalData(data)
- default:
- panic(xerrors.Errorf("arrow/array: unknown interval data type %T", data.dtype))
- }
-}
-
-// A type which represents an immutable sequence of arrow.MonthInterval values.
-type MonthInterval struct {
- array
- values []arrow.MonthInterval
-}
-
-func NewMonthIntervalData(data *Data) *MonthInterval {
- a := &MonthInterval{}
- a.refCount = 1
- a.setData(data)
- return a
-}
-
-func (a *MonthInterval) Value(i int) arrow.MonthInterval { return a.values[i] }
-func (a *MonthInterval) MonthIntervalValues() []arrow.MonthInterval { return a.values }
-
-func (a *MonthInterval) String() string {
- o := new(strings.Builder)
- o.WriteString("[")
- for i, v := range a.values {
- if i > 0 {
- fmt.Fprintf(o, " ")
- }
- switch {
- case a.IsNull(i):
- o.WriteString("(null)")
- default:
- fmt.Fprintf(o, "%v", v)
- }
- }
- o.WriteString("]")
- return o.String()
-}
-
-func (a *MonthInterval) setData(data *Data) {
- a.array.setData(data)
- vals := data.buffers[1]
- if vals != nil {
- a.values = arrow.MonthIntervalTraits.CastFromBytes(vals.Bytes())
- beg := a.array.data.offset
- end := beg + a.array.data.length
- a.values = a.values[beg:end]
- }
-}
-
-func arrayEqualMonthInterval(left, right *MonthInterval) bool {
- for i := 0; i < left.Len(); i++ {
- if left.IsNull(i) {
- continue
- }
- if left.Value(i) != right.Value(i) {
- return false
- }
- }
- return true
-}
-
-type MonthIntervalBuilder struct {
- builder
-
- data *memory.Buffer
- rawData []arrow.MonthInterval
-}
-
-func NewMonthIntervalBuilder(mem memory.Allocator) *MonthIntervalBuilder {
- return &MonthIntervalBuilder{builder: builder{refCount: 1, mem: mem}}
-}
-
-// Release decreases the reference count by 1.
-// When the reference count goes to zero, the memory is freed.
-func (b *MonthIntervalBuilder) Release() {
- debug.Assert(atomic.LoadInt64(&b.refCount) > 0, "too many releases")
-
- if atomic.AddInt64(&b.refCount, -1) == 0 {
- if b.nullBitmap != nil {
- b.nullBitmap.Release()
- b.nullBitmap = nil
- }
- if b.data != nil {
- b.data.Release()
- b.data = nil
- b.rawData = nil
- }
- }
-}
-
-func (b *MonthIntervalBuilder) Append(v arrow.MonthInterval) {
- b.Reserve(1)
- b.UnsafeAppend(v)
-}
-
-func (b *MonthIntervalBuilder) AppendNull() {
- b.Reserve(1)
- b.UnsafeAppendBoolToBitmap(false)
-}
-
-func (b *MonthIntervalBuilder) UnsafeAppend(v arrow.MonthInterval) {
- bitutil.SetBit(b.nullBitmap.Bytes(), b.length)
- b.rawData[b.length] = v
- b.length++
-}
-
-func (b *MonthIntervalBuilder) UnsafeAppendBoolToBitmap(isValid bool) {
- if isValid {
- bitutil.SetBit(b.nullBitmap.Bytes(), b.length)
- } else {
- b.nulls++
- }
- b.length++
-}
-
-// AppendValues will append the values in the v slice. The valid slice determines which values
-// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
-// all values in v are appended and considered valid.
-func (b *MonthIntervalBuilder) AppendValues(v []arrow.MonthInterval, valid []bool) {
- if len(v) != len(valid) && len(valid) != 0 {
- panic("len(v) != len(valid) && len(valid) != 0")
- }
-
- if len(v) == 0 {
- return
- }
-
- b.Reserve(len(v))
- arrow.MonthIntervalTraits.Copy(b.rawData[b.length:], v)
- b.builder.unsafeAppendBoolsToBitmap(valid, len(v))
-}
-
-func (b *MonthIntervalBuilder) init(capacity int) {
- b.builder.init(capacity)
-
- b.data = memory.NewResizableBuffer(b.mem)
- bytesN := arrow.MonthIntervalTraits.BytesRequired(capacity)
- b.data.Resize(bytesN)
- b.rawData = arrow.MonthIntervalTraits.CastFromBytes(b.data.Bytes())
-}
-
-// Reserve ensures there is enough space for appending n elements
-// by checking the capacity and calling Resize if necessary.
-func (b *MonthIntervalBuilder) Reserve(n int) {
- b.builder.reserve(n, b.Resize)
-}
-
-// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
-// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
-func (b *MonthIntervalBuilder) Resize(n int) {
- nBuilder := n
- if n < minBuilderCapacity {
- n = minBuilderCapacity
- }
-
- if b.capacity == 0 {
- b.init(n)
- } else {
- b.builder.resize(nBuilder, b.init)
- b.data.Resize(arrow.MonthIntervalTraits.BytesRequired(n))
- b.rawData = arrow.MonthIntervalTraits.CastFromBytes(b.data.Bytes())
- }
-}
-
-// NewArray creates a MonthInterval array from the memory buffers used by the builder and resets the MonthIntervalBuilder
-// so it can be used to build a new array.
-func (b *MonthIntervalBuilder) NewArray() Interface {
- return b.NewMonthIntervalArray()
-}
-
-// NewMonthIntervalArray creates a MonthInterval array from the memory buffers used by the builder and resets the MonthIntervalBuilder
-// so it can be used to build a new array.
-func (b *MonthIntervalBuilder) NewMonthIntervalArray() (a *MonthInterval) {
- data := b.newData()
- a = NewMonthIntervalData(data)
- data.Release()
- return
-}
-
-func (b *MonthIntervalBuilder) newData() (data *Data) {
- bytesRequired := arrow.MonthIntervalTraits.BytesRequired(b.length)
- if bytesRequired > 0 && bytesRequired < b.data.Len() {
- // trim buffers
- b.data.Resize(bytesRequired)
- }
- data = NewData(arrow.FixedWidthTypes.MonthInterval, b.length, []*memory.Buffer{b.nullBitmap, b.data}, nil, b.nulls, 0)
- b.reset()
-
- if b.data != nil {
- b.data.Release()
- b.data = nil
- b.rawData = nil
- }
-
- return
-}
-
-// A type which represents an immutable sequence of arrow.DayTimeInterval values.
-type DayTimeInterval struct {
- array
- values []arrow.DayTimeInterval
-}
-
-func NewDayTimeIntervalData(data *Data) *DayTimeInterval {
- a := &DayTimeInterval{}
- a.refCount = 1
- a.setData(data)
- return a
-}
-
-func (a *DayTimeInterval) Value(i int) arrow.DayTimeInterval { return a.values[i] }
-func (a *DayTimeInterval) DayTimeIntervalValues() []arrow.DayTimeInterval { return a.values }
-
-func (a *DayTimeInterval) String() string {
- o := new(strings.Builder)
- o.WriteString("[")
- for i, v := range a.values {
- if i > 0 {
- fmt.Fprintf(o, " ")
- }
- switch {
- case a.IsNull(i):
- o.WriteString("(null)")
- default:
- fmt.Fprintf(o, "%v", v)
- }
- }
- o.WriteString("]")
- return o.String()
-}
-
-func (a *DayTimeInterval) setData(data *Data) {
- a.array.setData(data)
- vals := data.buffers[1]
- if vals != nil {
- a.values = arrow.DayTimeIntervalTraits.CastFromBytes(vals.Bytes())
- beg := a.array.data.offset
- end := beg + a.array.data.length
- a.values = a.values[beg:end]
- }
-}
-
-func arrayEqualDayTimeInterval(left, right *DayTimeInterval) bool {
- for i := 0; i < left.Len(); i++ {
- if left.IsNull(i) {
- continue
- }
- if left.Value(i) != right.Value(i) {
- return false
- }
- }
- return true
-}
-
-type DayTimeIntervalBuilder struct {
- builder
-
- data *memory.Buffer
- rawData []arrow.DayTimeInterval
-}
-
-func NewDayTimeIntervalBuilder(mem memory.Allocator) *DayTimeIntervalBuilder {
- return &DayTimeIntervalBuilder{builder: builder{refCount: 1, mem: mem}}
-}
-
-// Release decreases the reference count by 1.
-// When the reference count goes to zero, the memory is freed.
-func (b *DayTimeIntervalBuilder) Release() {
- debug.Assert(atomic.LoadInt64(&b.refCount) > 0, "too many releases")
-
- if atomic.AddInt64(&b.refCount, -1) == 0 {
- if b.nullBitmap != nil {
- b.nullBitmap.Release()
- b.nullBitmap = nil
- }
- if b.data != nil {
- b.data.Release()
- b.data = nil
- b.rawData = nil
- }
- }
-}
-
-func (b *DayTimeIntervalBuilder) Append(v arrow.DayTimeInterval) {
- b.Reserve(1)
- b.UnsafeAppend(v)
-}
-
-func (b *DayTimeIntervalBuilder) AppendNull() {
- b.Reserve(1)
- b.UnsafeAppendBoolToBitmap(false)
-}
-
-func (b *DayTimeIntervalBuilder) UnsafeAppend(v arrow.DayTimeInterval) {
- bitutil.SetBit(b.nullBitmap.Bytes(), b.length)
- b.rawData[b.length] = v
- b.length++
-}
-
-func (b *DayTimeIntervalBuilder) UnsafeAppendBoolToBitmap(isValid bool) {
- if isValid {
- bitutil.SetBit(b.nullBitmap.Bytes(), b.length)
- } else {
- b.nulls++
- }
- b.length++
-}
-
-// AppendValues will append the values in the v slice. The valid slice determines which values
-// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
-// all values in v are appended and considered valid.
-func (b *DayTimeIntervalBuilder) AppendValues(v []arrow.DayTimeInterval, valid []bool) {
- if len(v) != len(valid) && len(valid) != 0 {
- panic("len(v) != len(valid) && len(valid) != 0")
- }
-
- if len(v) == 0 {
- return
- }
-
- b.Reserve(len(v))
- arrow.DayTimeIntervalTraits.Copy(b.rawData[b.length:], v)
- b.builder.unsafeAppendBoolsToBitmap(valid, len(v))
-}
-
-func (b *DayTimeIntervalBuilder) init(capacity int) {
- b.builder.init(capacity)
-
- b.data = memory.NewResizableBuffer(b.mem)
- bytesN := arrow.DayTimeIntervalTraits.BytesRequired(capacity)
- b.data.Resize(bytesN)
- b.rawData = arrow.DayTimeIntervalTraits.CastFromBytes(b.data.Bytes())
-}
-
-// Reserve ensures there is enough space for appending n elements
-// by checking the capacity and calling Resize if necessary.
-func (b *DayTimeIntervalBuilder) Reserve(n int) {
- b.builder.reserve(n, b.Resize)
-}
-
-// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
-// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
-func (b *DayTimeIntervalBuilder) Resize(n int) {
- nBuilder := n
- if n < minBuilderCapacity {
- n = minBuilderCapacity
- }
-
- if b.capacity == 0 {
- b.init(n)
- } else {
- b.builder.resize(nBuilder, b.init)
- b.data.Resize(arrow.DayTimeIntervalTraits.BytesRequired(n))
- b.rawData = arrow.DayTimeIntervalTraits.CastFromBytes(b.data.Bytes())
- }
-}
-
-// NewArray creates a DayTimeInterval array from the memory buffers used by the builder and resets the DayTimeIntervalBuilder
-// so it can be used to build a new array.
-func (b *DayTimeIntervalBuilder) NewArray() Interface {
- return b.NewDayTimeIntervalArray()
-}
-
-// NewDayTimeIntervalArray creates a DayTimeInterval array from the memory buffers used by the builder and resets the DayTimeIntervalBuilder
-// so it can be used to build a new array.
-func (b *DayTimeIntervalBuilder) NewDayTimeIntervalArray() (a *DayTimeInterval) {
- data := b.newData()
- a = NewDayTimeIntervalData(data)
- data.Release()
- return
-}
-
-func (b *DayTimeIntervalBuilder) newData() (data *Data) {
- bytesRequired := arrow.DayTimeIntervalTraits.BytesRequired(b.length)
- if bytesRequired > 0 && bytesRequired < b.data.Len() {
- // trim buffers
- b.data.Resize(bytesRequired)
- }
- data = NewData(arrow.FixedWidthTypes.DayTimeInterval, b.length, []*memory.Buffer{b.nullBitmap, b.data}, nil, b.nulls, 0)
- b.reset()
-
- if b.data != nil {
- b.data.Release()
- b.data = nil
- b.rawData = nil
- }
-
- return
-}
-
-var (
- _ Interface = (*MonthInterval)(nil)
- _ Interface = (*DayTimeInterval)(nil)
-
- _ Builder = (*MonthIntervalBuilder)(nil)
- _ Builder = (*DayTimeIntervalBuilder)(nil)
-)
diff --git a/go/arrow/array/interval_test.go b/go/arrow/array/interval_test.go
deleted file mode 100644
index bac0bb4..0000000
--- a/go/arrow/array/interval_test.go
+++ /dev/null
@@ -1,276 +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.
-
-package array_test
-
-import (
- "testing"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/array"
- "github.com/apache/arrow/go/arrow/memory"
- "github.com/stretchr/testify/assert"
-)
-
-func TestMonthIntervalArray(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- var (
- want = []arrow.MonthInterval{1, 2, 3, 4}
- valids = []bool{true, true, false, true}
- )
-
- b := array.NewMonthIntervalBuilder(mem)
- defer b.Release()
-
- b.Retain()
- b.Release()
-
- b.AppendValues(want[:2], nil)
- b.AppendNull()
- b.Append(want[3])
-
- if got, want := b.Len(), len(want); got != want {
- t.Fatalf("invalid len: got=%d, want=%d", got, want)
- }
-
- if got, want := b.NullN(), 1; got != want {
- t.Fatalf("invalid nulls: got=%d, want=%d", got, want)
- }
-
- arr := b.NewMonthIntervalArray()
- defer arr.Release()
-
- arr.Retain()
- arr.Release()
-
- if got, want := arr.Len(), len(want); got != want {
- t.Fatalf("invalid len: got=%d, want=%d", got, want)
- }
-
- if got, want := arr.NullN(), 1; got != want {
- t.Fatalf("invalid nulls: got=%d, want=%d", got, want)
- }
-
- for i := range want {
- if arr.IsNull(i) != !valids[i] {
- t.Fatalf("arr[%d]-validity: got=%v want=%v", i, !arr.IsNull(i), valids[i])
- }
- switch {
- case arr.IsNull(i):
- default:
- got := arr.Value(i)
- if got != want[i] {
- t.Fatalf("arr[%d]: got=%q, want=%q", i, got, want[i])
- }
- }
- }
-
- sub := array.MakeFromData(arr.Data())
- defer sub.Release()
-
- if sub.DataType().ID() != arrow.INTERVAL {
- t.Fatalf("invalid type: got=%q, want=interval", sub.DataType().Name())
- }
-
- if _, ok := sub.(*array.MonthInterval); !ok {
- t.Fatalf("could not type-assert to array.MonthInterval")
- }
-
- if got, want := arr.String(), `[1 2 (null) 4]`; got != want {
- t.Fatalf("got=%q, want=%q", got, want)
- }
- slice := array.NewSliceData(arr.Data(), 2, 4)
- defer slice.Release()
-
- sub1 := array.MakeFromData(slice)
- defer sub1.Release()
-
- v, ok := sub1.(*array.MonthInterval)
- if !ok {
- t.Fatalf("could not type-assert to array.MonthInterval")
- }
-
- if got, want := v.String(), `[(null) 4]`; got != want {
- t.Fatalf("got=%q, want=%q", got, want)
- }
-}
-
-func TestMonthIntervalBuilder_Empty(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- want := []arrow.MonthInterval{1, 2, 3, 4}
-
- b := array.NewMonthIntervalBuilder(mem)
- defer b.Release()
-
- miValues := func(a *array.MonthInterval) []arrow.MonthInterval {
- vs := make([]arrow.MonthInterval, a.Len())
- for i := range vs {
- vs[i] = a.Value(i)
- }
- return vs
- }
-
- b.AppendValues([]arrow.MonthInterval{}, nil)
- arr := b.NewMonthIntervalArray()
- assert.Zero(t, arr.Len())
- arr.Release()
-
- b.AppendValues(nil, nil)
- arr = b.NewMonthIntervalArray()
- assert.Zero(t, arr.Len())
- arr.Release()
-
- b.AppendValues([]arrow.MonthInterval{}, nil)
- b.AppendValues(want, nil)
- arr = b.NewMonthIntervalArray()
- assert.Equal(t, want, miValues(arr))
- arr.Release()
-
- b.AppendValues(want, nil)
- b.AppendValues([]arrow.MonthInterval{}, nil)
- arr = b.NewMonthIntervalArray()
- assert.Equal(t, want, miValues(arr))
- arr.Release()
-}
-
-func TestDayTimeArray(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- var (
- want = []arrow.DayTimeInterval{{1, 1}, {2, 2}, {3, 3}, {4, 4}}
- valids = []bool{true, true, false, true}
- )
-
- b := array.NewDayTimeIntervalBuilder(mem)
- defer b.Release()
-
- b.Retain()
- b.Release()
-
- b.AppendValues(want[:2], nil)
- b.AppendNull()
- b.Append(want[3])
-
- if got, want := b.Len(), len(want); got != want {
- t.Fatalf("invalid len: got=%d, want=%d", got, want)
- }
-
- if got, want := b.NullN(), 1; got != want {
- t.Fatalf("invalid nulls: got=%d, want=%d", got, want)
- }
-
- arr := b.NewDayTimeIntervalArray()
- defer arr.Release()
-
- arr.Retain()
- arr.Release()
-
- if got, want := arr.Len(), len(want); got != want {
- t.Fatalf("invalid len: got=%d, want=%d", got, want)
- }
-
- if got, want := arr.NullN(), 1; got != want {
- t.Fatalf("invalid nulls: got=%d, want=%d", got, want)
- }
-
- for i := range want {
- if arr.IsNull(i) != !valids[i] {
- t.Fatalf("arr[%d]-validity: got=%v want=%v", i, !arr.IsNull(i), valids[i])
- }
- switch {
- case arr.IsNull(i):
- default:
- got := arr.Value(i)
- if got != want[i] {
- t.Fatalf("arr[%d]: got=%q, want=%q", i, got, want[i])
- }
- }
- }
-
- sub := array.MakeFromData(arr.Data())
- defer sub.Release()
-
- if sub.DataType().ID() != arrow.INTERVAL {
- t.Fatalf("invalid type: got=%q, want=interval", sub.DataType().Name())
- }
-
- if _, ok := sub.(*array.DayTimeInterval); !ok {
- t.Fatalf("could not type-assert to array.DayTimeInterval")
- }
-
- if got, want := arr.String(), `[{1 1} {2 2} (null) {4 4}]`; got != want {
- t.Fatalf("got=%q, want=%q", got, want)
- }
- slice := array.NewSliceData(arr.Data(), 2, 4)
- defer slice.Release()
-
- sub1 := array.MakeFromData(slice)
- defer sub1.Release()
-
- v, ok := sub1.(*array.DayTimeInterval)
- if !ok {
- t.Fatalf("could not type-assert to array.DayInterval")
- }
-
- if got, want := v.String(), `[(null) {4 4}]`; got != want {
- t.Fatalf("got=%q, want=%q", got, want)
- }
-}
-
-func TestDayTimeIntervalBuilder_Empty(t *testing.T) {
- mem := memory.NewCheckedAllocator(memory.NewGoAllocator())
- defer mem.AssertSize(t, 0)
-
- want := []arrow.DayTimeInterval{{1, 1}, {2, 2}, {3, 3}, {4, 4}}
-
- b := array.NewDayTimeIntervalBuilder(mem)
- defer b.Release()
-
- dtValues := func(a *array.DayTimeInterval) []arrow.DayTimeInterval {
- vs := make([]arrow.DayTimeInterval, a.Len())
- for i := range vs {
- vs[i] = a.Value(i)
- }
- return vs
- }
-
- b.AppendValues([]arrow.DayTimeInterval{}, nil)
- arr := b.NewDayTimeIntervalArray()
- assert.Zero(t, arr.Len())
- arr.Release()
-
- b.AppendValues(nil, nil)
- arr = b.NewDayTimeIntervalArray()
- assert.Zero(t, arr.Len())
- arr.Release()
-
- b.AppendValues([]arrow.DayTimeInterval{}, nil)
- b.AppendValues(want, nil)
- arr = b.NewDayTimeIntervalArray()
- assert.Equal(t, want, dtValues(arr))
- arr.Release()
-
- b.AppendValues(want, nil)
- b.AppendValues([]arrow.DayTimeInterval{}, nil)
- arr = b.NewDayTimeIntervalArray()
- assert.Equal(t, want, dtValues(arr))
- arr.Release()
-}
diff --git a/go/arrow/array/list.go b/go/arrow/array/list.go
deleted file mode 100644
index 22014c8..0000000
--- a/go/arrow/array/list.go
+++ /dev/null
@@ -1,269 +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.
-
-package array
-
-import (
- "fmt"
- "strings"
- "sync/atomic"
-
- "github.com/apache/arrow/go/arrow"
- "github.com/apache/arrow/go/arrow/bitutil"
- "github.com/apache/arrow/go/arrow/internal/debug"
- "github.com/apache/arrow/go/arrow/memory"
-)
-
-// List represents an immutable sequence of array values.
-type List struct {
- array
- values Interface
- offsets []int32
-}
-
-// NewListData returns a new List array value, from data.
-func NewListData(data *Data) *List {
- a := &List{}
- a.refCount = 1
- a.setData(data)
- return a
-}
-
-func (a *List) ListValues() Interface { return a.values }
-
-func (a *List) String() string {
- o := new(strings.Builder)
- o.WriteString("[")
- for i := 0; i < a.Len(); i++ {
- if i > 0 {
- o.WriteString(" ")
- }
- if !a.IsValid(i) {
- o.WriteString("(null)")
- continue
- }
- sub := a.newListValue(i)
- fmt.Fprintf(o, "%v", sub)
- sub.Release()
- }
- o.WriteString("]")
- return o.String()
-}
-
-func (a *List) newListValue(i int) Interface {
- j := i + a.array.data.offset
- beg := int64(a.offsets[j])
- end := int64(a.offsets[j+1])
- return NewSlice(a.values, beg, end)
-}
-
-func (a *List) setData(data *Data) {
- a.array.setData(data)
- vals := data.buffers[1]
- if vals != nil {
- a.offsets = arrow.Int32Traits.CastFromBytes(vals.Bytes())
- }
- a.values = MakeFromData(data.childData[0])
-}
-
-func arrayEqualList(left, right *List) bool {
- for i := 0; i < left.Len(); i++ {
- if left.IsNull(i) {
- continue
- }
- o := func() bool {
- l := left.newListValue(i)
- defer l.Release()
- r := right.newListValue(i)
- defer r.Release()
- return ArrayEqual(l, r)
- }()
- if !o {
- return false
- }
- }
- return true
-}
-
-// Len returns the number of elements in the array.
-func (a *List) Len() int { return a.array.Len() }
-
-func (a *List) Offsets() []int32 { return a.offsets }
-
-func (a *List) Retain() {
- a.array.Retain()
- a.values.Retain()
-}
-
-func (a *List) Release() {
- a.array.Release()
- a.values.Release()
-}
-
-type ListBuilder struct {
- builder
-
- etype arrow.DataType // data type of the list's elements.
- values Builder // value builder for the list's elements.
- offsets *Int32Builder
-}
-
-// NewListBuilder returns a builder, using the provided memory allocator.
-// The created list builder will create a list whose elements will be of type etype.
-func NewListBuilder(mem memory.Allocator, etype arrow.DataType) *ListBuilder {
- return &ListBuilder{
- builder: builder{refCount: 1, mem: mem},
- etype: etype,
- values: NewBuilder(mem, etype),
- offsets: NewInt32Builder(mem),
- }
-}
-
-// Release decreases the reference count by 1.
-// When the reference count goes to zero, the memory is freed.
-func (b *ListBuilder) Release() {
- debug.Assert(atomic.LoadInt64(&b.refCount) > 0, "too many releases")
-
- if atomic.AddInt64(&b.refCount, -1) == 0 {
- if b.nullBitmap != nil {
- b.nullBitmap.Release()
- b.nullBitmap = nil
- }
- }
-
- b.values.Release()
- b.offsets.Release()
-}
-
-func (b *ListBuilder) appendNextOffset() {
- b.offsets.Append(int32(b.values.Len()))
-}
-
-func (b *ListBuilder) Append(v bool) {
- b.Reserve(1)
- b.unsafeAppendBoolToBitmap(v)
- b.appendNextOffset()
-}
-
-func (b *ListBuilder) AppendNull() {
- b.Reserve(1)
- b.unsafeAppendBoolToBitmap(false)
- b.appendNextOffset()
-}
-
-func (b *ListBuilder) AppendValues(offsets []int32, valid []bool) {
- b.Reserve(len(valid))
- b.offsets.AppendValues(offsets, nil)
- b.builder.unsafeAppendBoolsToBitmap(valid, len(valid))
-}
-
-func (b *ListBuilder) unsafeAppend(v bool) {
- bitutil.SetBit(b.nullBitmap.Bytes(), b.length)
- b.length++
-}
-
-func (b *ListBuilder) unsafeAppendBoolToBitmap(isValid bool) {
- if isValid {
- bitutil.SetBit(b.nullBitmap.Bytes(), b.length)
- } else {
- b.nulls++
- }
- b.length++
-}
-
-func (b *ListBuilder) init(capacity int) {
- b.builder.init(capacity)
- b.offsets.init(capacity + 1)
-}
-
-// Reserve ensures there is enough space for appending n elements
-// by checking the capacity and calling Resize if necessary.
-func (b *ListBuilder) Reserve(n int) {
- b.builder.reserve(n, b.resizeHelper)
- b.offsets.Reserve(n)
-}
-
-// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
-// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
-func (b *ListBuilder) Resize(n int) {
- b.resizeHelper(n)
- b.offsets.Resize(n)
-}
-
-func (b *ListBuilder) resizeHelper(n int) {
- if n < minBuilderCapacity {
- n = minBuilderCapacity
- }
-
... 103886 lines suppressed ...