Skip to content

Commit

Permalink
Merge pull request #215 from TileDB-Inc/group-support
Browse files Browse the repository at this point in the history
TileDB 2.8 and Groups API
  • Loading branch information
snagles authored Apr 13, 2022
2 parents 02d5db3 + 5106837 commit 5687906
Show file tree
Hide file tree
Showing 16 changed files with 869 additions and 204 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/install_tiledb_linux.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set -e -x
curl --location -o tiledb.tar.gz https://github.com/TileDB-Inc/TileDB/releases/download/2.6.1/tiledb-linux-x86_64-2.6.1-2f6b7f6.tar.gz \
curl --location -o tiledb.tar.gz https://github.com/TileDB-Inc/TileDB/releases/download/2.8.0/tiledb-linux-x86_64-2.8.0-f8efd39.tar.gz \
&& sudo tar -C /usr/local -xf tiledb.tar.gz
sudo ldconfig /usr/local/lib
2 changes: 1 addition & 1 deletion .github/scripts/install_tiledb_linux_debug.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set -e -x
git clone https://github.com/TileDB-Inc/TileDB.git -b 2.6.1
git clone https://github.com/TileDB-Inc/TileDB.git -b 2.8.0
cd TileDB
mkdir build && cd build
cmake -DSANITIZER=leak -DTILEDB_VERBOSE=OFF -DTILEDB_S3=ON -DTILEDB_SERIALIZATION=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr/local ..
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/install_tiledb_macos.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
set -e -x
curl --location -o tiledb.tar.gz https://github.com/TileDB-Inc/TileDB/releases/download/2.6.1/tiledb-macos-x86_64-2.6.1-2f6b7f6.tar.gz \
curl --location -o tiledb.tar.gz https://github.com/TileDB-Inc/TileDB/releases/download/2.8.0/tiledb-macos-x86_64-2.8.0-f8efd39.tar.gz \
&& sudo tar -C /usr/local -xf tiledb.tar.gz
2 changes: 1 addition & 1 deletion .github/scripts/install_tiledb_source_linux.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set -e -x
git clone https://github.com/TileDB-Inc/TileDB.git -b 2.6.1
git clone https://github.com/TileDB-Inc/TileDB.git -b 2.8.0
cd TileDB
mkdir build && cd build
cmake -DTILEDB_VERBOSE=OFF -DTILEDB_S3=ON -DTILEDB_SERIALIZATION=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/install_tiledb_source_macos.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set -e -x
git clone https://github.com/TileDB-Inc/TileDB.git -b 2.6.1
git clone https://github.com/TileDB-Inc/TileDB.git -b 2.8.0
cd TileDB
mkdir build && cd build
cmake -DTILEDB_VERBOSE=OFF -DTILEDB_S3=ON -DTILEDB_SERIALIZATION=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
Expand Down
1 change: 0 additions & 1 deletion cmd/tiledb-go-examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ func main() {
examples_lib.RunConfig()
examples_lib.RunDeserializeSparseLayouts()
examples_lib.RunEncryptedArray()
examples_lib.RunErrors()
examples_lib.RunFiltersArray()
examples_lib.RunFragmentsConsolidationArray()
examples_lib.RunMultiAttributeArray()
Expand Down
19 changes: 19 additions & 0 deletions enums.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,25 @@ const (
TILEDB_ARRAY ObjectTypeEnum = C.TILEDB_ARRAY
)

// String returns string representation
func (o ObjectTypeEnum) String() string {
var cname *C.char
C.tiledb_object_type_to_str(C.tiledb_object_t(o), &cname)
return C.GoString(cname)
}

// ObjectTypeFromString returns the internal representation of the object type
func ObjectTypeFromString(s string) (ObjectTypeEnum, error) {
cname := C.CString(s)
defer C.free(unsafe.Pointer(cname))
var cObjType C.tiledb_object_t
ret := C.tiledb_object_type_from_str(cname, &cObjType)
if ret != C.TILEDB_OK {
return 0, fmt.Errorf("%q is not a recognized tiledb_object_t", s)
}
return ObjectTypeEnum(cObjType), nil
}

// WalkOrder
type WalkOrder int8

Expand Down
21 changes: 21 additions & 0 deletions enums_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//go:build experimental
// +build experimental

package tiledb

import "testing"

func TestObjectType(t *testing.T) {
v := TILEDB_ARRAY
s := v.String()

got, err := ObjectTypeFromString(s)
if err != nil {
t.Errorf("unexpected error: %s", err)
}

if got != v {
t.Errorf("got: %v not equal to input: %v", got, v)
}

}
12 changes: 0 additions & 12 deletions examples/errors_test.go

This file was deleted.

4 changes: 2 additions & 2 deletions examples/range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ import "github.com/TileDB-Inc/TileDB-Go/examples_lib"
func ExampleRange() {
examples_lib.RunRange()

// Output: Error adding query range: [TileDB::Dimension] Error: Cannot add range to dimension; Lower range bound 1065353216 cannot be larger than the higher bound 4
// Error adding query range: [TileDB::Query] Error: Cannot add range; Invalid dimension index
// Error adding query range: [TileDB::Dimension] Error: Cannot add range to dimension; Lower range bound 1065353216 cannot be larger than the higher bound 4
// Error adding query range: [TileDB::Subarray] Error: Cannot add range; Invalid dimension index
// Number of ranges across dimension 0 is: 1
// Number of ranges across dimension `rows` is: 1
// Range start for dimension 0, range 0 is: 1
Expand Down
4 changes: 2 additions & 2 deletions examples/vacuum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ func ExampleVacuumSparseArray() {
// Cell (1) has data 1
// Cell (2) has data 2
// Cell (3) has data 3
// Num of fragments after 2 writes before consolidate: 3
// Num of fragments after 2 writes before consolidate: 4
// Num of fragments after consolidate: 4
// Num of fragments after vacuum: 2
// Num of fragments after vacuum: 4
// Estimated query size in bytes for attribute 'a': 12
// Estimated query size in bytes for dimension 'd': 12
// Cell (1) has data 1
Expand Down
74 changes: 0 additions & 74 deletions examples_lib/errors.go

This file was deleted.

4 changes: 2 additions & 2 deletions fragment_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestFragmentInfo(t *testing.T) {
require.NoError(t, err)

fragmentSize := testFragmentInfo(t, context)
assert.Equal(t, uint64(2291), fragmentSize)
assert.Equal(t, uint64(4181), fragmentSize)
}

func TestFragmentInfoEncryption(t *testing.T) {
Expand All @@ -40,7 +40,7 @@ func TestFragmentInfoEncryption(t *testing.T) {
require.NoError(t, err)

fragmentSize := testFragmentInfo(t, context)
assert.Equal(t, uint64(4072), fragmentSize)
assert.Equal(t, uint64(7407), fragmentSize)
}

func testFragmentInfo(t testing.TB, context *Context) uint64 {
Expand Down
Loading

0 comments on commit 5687906

Please sign in to comment.