Skip to content

Commit

Permalink
adds GetRanges
Browse files Browse the repository at this point in the history
  • Loading branch information
antalakas committed Nov 7, 2019
1 parent 1811dfb commit 5ba98f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
12 changes: 3 additions & 9 deletions examples/range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,16 @@ func addRange() {
query, err := tiledb.NewQuery(ctx, array)
checkError(err)

var startFloat float32 = 1
var endFloat float32 = 3

// Try with invalid dimension types
err = query.AddRange(0, &startFloat, &endFloat)
err = query.AddRange(0, float32(1), float32(3))
fmt.Println(err)

var start int32 = 1
var end int32 = 3

// Try with invalid dimension index
err = query.AddRange(2, &start, &end)
err = query.AddRange(2, int32(1), int32(3))
fmt.Println(err)

// Try using valid index, range
err = query.AddRange(0, &start, &end)
err = query.AddRange(0, int32(1), int32(3))
checkError(err)

err = array.Close()
Expand Down
7 changes: 7 additions & 0 deletions examples/reading_range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ func readReadRangeArray(dimIdx uint32) {
fmt.Printf("Range for dimension: %d, start: %v, end: %v\n", dimIdx, start, end)
}

ranges, err := query.GetRanges()
checkError(err)

fmt.Printf("Ranges: %v\n", ranges)

_, err = query.SetBuffer("a", data)
checkError(err)

Expand Down Expand Up @@ -177,10 +182,12 @@ func ExampleReadRangeArray() {
// Output: Num of Ranges: 2
// Range for dimension: 0, start: 1, end: 1
// Range for dimension: 0, start: 3, end: 4
// Ranges: [[{1 1} {3 4}] [{1 4}]]
// [1 2 3 4 9 10 11 12 13 14 15 16]
// Num of Ranges: 2
// Range for dimension: 1, start: 1, end: 1
// Range for dimension: 1, start: 3, end: 4
// Ranges: [[{1 4}] [{1 1} {3 4}]]
// [1 3 4 5 7 8 9 11 12 13 15 16]
}

Expand Down

0 comments on commit 5ba98f6

Please sign in to comment.