Skip to content

Commit

Permalink
Fix C query condition examples (#4912)
Browse files Browse the repository at this point in the history
The examples were attempting to use query conditions that were already
destroyed in the last example which led to erroneous output.

Shoutout to @rroelke who was the one that noticed the disparity.

[sc-46017]

---
TYPE: BUG
DESC: Fix C query condition examples
  • Loading branch information
davisp authored Apr 24, 2024
1 parent 3925eeb commit 5298c22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/c_api/query_condition_dense.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ int main() {
const char* eve = "eve";
tiledb_query_condition_init(ctx, qc1, "b", eve, strlen(eve), TILEDB_LT);
read_array_with_qc(ctx, qc1);
tiledb_query_condition_free(&qc1);
printf("\n");

// Execute a read query with query condition `c >= 1`.
Expand Down Expand Up @@ -338,7 +337,6 @@ int main() {
read_array_with_qc(ctx, qc5);
tiledb_query_condition_free(&qc3);
tiledb_query_condition_free(&qc4);
tiledb_query_condition_free(&qc5);
printf("\n");

// Execute a read query with query condition `3.0f <= d AND d <= 4.0f AND a !=
Expand All @@ -356,6 +354,8 @@ int main() {
tiledb_query_condition_alloc(ctx, &qc8);
tiledb_query_condition_combine(ctx, qc7, qc1, TILEDB_AND, &qc8);
read_array_with_qc(ctx, qc8);
tiledb_query_condition_free(&qc1);
tiledb_query_condition_free(&qc5);
tiledb_query_condition_free(&qc6);
tiledb_query_condition_free(&qc7);
tiledb_query_condition_free(&qc8);
Expand Down
4 changes: 2 additions & 2 deletions examples/c_api/query_condition_sparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ int main() {
const char* eve = "eve";
tiledb_query_condition_init(ctx, qc1, "b", eve, strlen(eve), TILEDB_LT);
read_array_with_qc(ctx, qc1);
tiledb_query_condition_free(&qc1);
printf("\n");

// Execute a read query with query condition `c >= 1`.
Expand Down Expand Up @@ -328,7 +327,6 @@ int main() {
read_array_with_qc(ctx, qc5);
tiledb_query_condition_free(&qc3);
tiledb_query_condition_free(&qc4);
tiledb_query_condition_free(&qc5);
printf("\n");

// Execute a read query with query condition `3.0f <= d AND d <= 4.0f AND a !=
Expand All @@ -346,6 +344,8 @@ int main() {
tiledb_query_condition_alloc(ctx, &qc8);
tiledb_query_condition_combine(ctx, qc7, qc1, TILEDB_AND, &qc8);
read_array_with_qc(ctx, qc8);
tiledb_query_condition_free(&qc1);
tiledb_query_condition_free(&qc5);
tiledb_query_condition_free(&qc6);
tiledb_query_condition_free(&qc7);
tiledb_query_condition_free(&qc8);
Expand Down

0 comments on commit 5298c22

Please sign in to comment.