Skip to content

Commit

Permalink
Merge branch 'dev' into teo/remove-superbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
teo-tsirpanis committed Jul 3, 2024
2 parents 7f660dc + df74fdb commit 8d9b959
Show file tree
Hide file tree
Showing 240 changed files with 13,069 additions and 2,407 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Flag all PR configuration changes for documentation follow-up.
/tiledb/sm/cpp_api/config.h @TileDB-Inc/tiledb-docs
/tiledb/api/c_api/config/config_api_external.h @TileDB-Inc/tiledb-docs
1 change: 0 additions & 1 deletion .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ jobs:
TILEDB_WEBP: ${{ matrix.TILEDB_WEBP }}
TILEDB_CMAKE_BUILD_TYPE: 'Release'
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
CXXFLAGS: '/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR' # https://github.com/actions/runner-images/issues/10004
steps:
- name: 'tiledb env prep'
run: |
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/ci-linux_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ on:
description: 'CMake generator'
required: false
type: string
build_only:
default: false
description: 'Whether to only build TileDB and not run tests'
required: false
type: boolean

env:
BACKWARDS_COMPATIBILITY_ARRAYS: OFF
Expand Down Expand Up @@ -176,6 +181,7 @@ jobs:
- name: 'Test libtiledb'
id: test
if: ${{ !inputs.build_only }}
shell: bash
env:
ASAN_OPTIONS: ${{ inputs.asan && 'detect_leaks=0' || '' }}
Expand Down Expand Up @@ -266,6 +272,7 @@ jobs:
/cores/
- name: 'Test status check'
if: ${{ !inputs.build_only }}
run: |
# tiledb_unit is configured to set a variable TILEDB_CI_SUCCESS=1
# following the test run. If this variable is not set, the build should fail.
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/nightly-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,15 @@ jobs:
run: |
cmake --build build --target check --config ${{ matrix.config || 'Release' }}
test_hdfs:
test_hdfs_build:
uses: ./.github/workflows/ci-linux_mac.yml
with:
ci_backend: HDFS
matrix_image: ubuntu-24.04
matrix_compiler_cc: 'gcc-13'
matrix_compiler_cxx: 'g++-13'
timeout: 300
build_only: true
bootstrap_args: '--enable-hdfs --enable-static-tiledb --disable-werror'

create_issue_on_fail:
Expand All @@ -81,7 +82,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- test
- test_hdfs
- test_hdfs_build
if: failure() || cancelled()
steps:
- name: Checkout TileDB `dev`
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/unit-test-runs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Temporarily reverting to windows-2019 until https://github.com/actions/runner-images/issues/10004 gets fixed.
os: [macos-latest, ubuntu-latest, windows-2019]
os: [macos-latest, ubuntu-latest, windows-latest]
fail-fast: false
name: Build - ${{ matrix.os }}
timeout-minutes: 90
Expand Down Expand Up @@ -54,11 +53,6 @@ jobs:
shell: bash
if: ${{ !startsWith(matrix.os, 'windows-') }}

- name: 'Print env'
run: set
shell: cmd
if: ${{ startsWith(matrix.os, 'windows-') }}

- name: 'Build standalone unit tests'
run: |
cmake -S . \
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ list(APPEND TILEDB_C_API_RELATIVE_HEADERS
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/buffer_list/buffer_list_api_external.h"
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/config/config_api_external.h"
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/context/context_api_external.h"
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/current_domain/current_domain_api_enum.h"
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/current_domain/current_domain_api_external_experimental.h"
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/data_order/data_order_api_enum.h"
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/data_order/data_order_api_external.h"
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/datatype/datatype_api_enum.h"
Expand All @@ -307,6 +309,7 @@ list(APPEND TILEDB_C_API_RELATIVE_HEADERS
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/filter/filter_api_external.h"
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/filter_list/filter_list_api_external.h"
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/group/group_api_external.h"
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/ndrectangle/ndrectangle_api_external_experimental.h"
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/object/object_api_enum.h"
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/object/object_api_external.h"
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/query/query_api_enum.h"
Expand Down
4 changes: 4 additions & 0 deletions cmake/Options/BuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ if (DEFINED TILEDB_VCPKG AND NOT TILEDB_VCPKG)
message(FATAL_ERROR "Disabling TILEDB_VCPKG is not supported. To disable automatically downloading vcpkg, enable the TILEDB_DISABLE_AUTO_VCPKG option, or set ENV{TILEDB_DISABLE_AUTO_VCPKG} to any value.")
endif()

if (TILEDB_HDFS)
message(DEPRECATION "The HDFS storage backend is deprecated and receiving build-only official validation. It will be removed in TileDB 2.28.")
endif()

# enable assertions by default for debug builds
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(TILEDB_ASSERTIONS TRUE)
Expand Down
228 changes: 228 additions & 0 deletions examples/c_api/current_domain.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
/**
* @file current_domain.c
*
* @section LICENSE
*
* The MIT License
*
* @copyright Copyright (c) 2024 TileDB, Inc.
*
* 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.
*
* @section DESCRIPTION
*
* When run, this program will create a simple 1D sparse array with a current
* domain, print it, expand it with array schema evolution, and print it again.
*/

#include <stdio.h>
#include <stdlib.h>
#include <tiledb/tiledb.h>
#include <tiledb/tiledb_experimental.h>

// Name of array.
const char* array_name = "current_domain_array";

void create_array() {
// Create TileDB context
tiledb_ctx_t* ctx;
tiledb_ctx_alloc(NULL, &ctx);

// The array will be 1000x1 with dimension "d1", with domain [1,1000].
int dim_domain[] = {1, 1000};
int tile_extent = 50;
tiledb_dimension_t* d1;
tiledb_dimension_alloc(
ctx, "d1", TILEDB_INT32, &dim_domain[0], &tile_extent, &d1);

// Create domain
tiledb_domain_t* domain;
tiledb_domain_alloc(ctx, &domain);
tiledb_domain_add_dimension(ctx, domain, d1);

// Create current domain
tiledb_current_domain_t* current_domain;
tiledb_current_domain_create(ctx, &current_domain);

// Create an n-dimensional rectangle
tiledb_ndrectangle_t* ndrect;
tiledb_ndrectangle_alloc(ctx, domain, &ndrect);

// Assign the range [1, 100] to the rectangle's first dimension
int32_t expanded_current_domain[] = {1, 100};
tiledb_range_t range = {
&expanded_current_domain[0],
sizeof(expanded_current_domain[0]),
&expanded_current_domain[1],
sizeof(expanded_current_domain[1])};
tiledb_ndrectangle_set_range_for_name(ctx, ndrect, "d1", &range);

// Assign the rectangle to the current domain
tiledb_current_domain_set_ndrectangle(current_domain, ndrect);

// Create a single attribute "a" so each cell can store an integer
tiledb_attribute_t* a;
tiledb_attribute_alloc(ctx, "a", TILEDB_INT32, &a);

// Create array schema
tiledb_array_schema_t* array_schema;
tiledb_array_schema_alloc(ctx, TILEDB_SPARSE, &array_schema);
tiledb_array_schema_set_cell_order(ctx, array_schema, TILEDB_ROW_MAJOR);
tiledb_array_schema_set_tile_order(ctx, array_schema, TILEDB_ROW_MAJOR);
tiledb_array_schema_set_domain(ctx, array_schema, domain);
tiledb_array_schema_add_attribute(ctx, array_schema, a);

// Assign the current domain to the array schema
tiledb_array_schema_set_current_domain(ctx, array_schema, current_domain);

// Create array
tiledb_array_create(ctx, array_name, array_schema);

// Clean up
tiledb_array_schema_free(&array_schema);
tiledb_attribute_free(&a);
tiledb_ndrectangle_free(&ndrect);
tiledb_current_domain_free(&current_domain);
tiledb_domain_free(&domain);
tiledb_dimension_free(&d1);
tiledb_ctx_free(&ctx);
}

void print_current_domain() {
// Create TileDB context
tiledb_ctx_t* ctx;
tiledb_ctx_alloc(NULL, &ctx);

// Load array schema
tiledb_array_schema_t* array_schema;
tiledb_array_schema_load(ctx, array_name, &array_schema);

// Get current domain
tiledb_current_domain_t* current_domain;
tiledb_array_schema_get_current_domain(ctx, array_schema, &current_domain);

// Check if current domain is empty
uint32_t is_empty;
tiledb_current_domain_get_is_empty(current_domain, &is_empty);

if (is_empty) {
printf("Current domain: empty\n");
} else {
// Get current domain type
tiledb_current_domain_type_t current_domain_type;
tiledb_current_domain_get_type(current_domain, &current_domain_type);

if (current_domain_type == TILEDB_NDRECTANGLE) {
printf("Current domain type: NDRECTANGLE\n");

// Get the ND rectangle
tiledb_ndrectangle_t* ndrect;
tiledb_current_domain_get_ndrectangle(current_domain, &ndrect);

tiledb_range_t range;
tiledb_ndrectangle_get_range_from_name(ctx, ndrect, "d1", &range);

printf(
"Current domain range: [%d, %d]\n",
*(int*)range.min,
*(int*)range.max);

// Clean up
tiledb_ndrectangle_free(&ndrect);
} else {
printf("Current domain type: unknown\n");
}
}

// Clean up
tiledb_current_domain_free(&current_domain);
tiledb_array_schema_free(&array_schema);
tiledb_ctx_free(&ctx);
}

void expand_current_domain() {
// Create TileDB context
tiledb_ctx_t* ctx;
tiledb_ctx_alloc(NULL, &ctx);

// Load array schema
tiledb_array_schema_t* array_schema;
tiledb_array_schema_load(ctx, array_name, &array_schema);

// Get domain
tiledb_domain_t* domain;
tiledb_array_schema_get_domain(ctx, array_schema, &domain);

// Create schema evolution
tiledb_array_schema_evolution_t* schema_evolution;
tiledb_array_schema_evolution_alloc(ctx, &schema_evolution);

// Create the new current domain
tiledb_current_domain_t* new_current_domain;
tiledb_current_domain_create(ctx, &new_current_domain);

// Create an n-dimensional rectangle
tiledb_ndrectangle_t* ndrect;
tiledb_ndrectangle_alloc(ctx, domain, &ndrect);

// Assign the range [1, 200] to the rectangle's first dimension
int32_t expanded_current_domain[] = {1, 200};
tiledb_range_t range = {
&expanded_current_domain[0],
sizeof(expanded_current_domain[0]),
&expanded_current_domain[1],
sizeof(expanded_current_domain[1])};
tiledb_ndrectangle_set_range_for_name(ctx, ndrect, "d1", &range);

// Set the rectangle to the current domain
tiledb_current_domain_set_ndrectangle(new_current_domain, ndrect);

// Expand the current domain
tiledb_array_schema_evolution_expand_current_domain(
ctx, schema_evolution, new_current_domain);

// Evolve the array
tiledb_array_evolve(ctx, array_name, schema_evolution);

// Clean up
tiledb_ndrectangle_free(&ndrect);
tiledb_current_domain_free(&new_current_domain);
tiledb_array_schema_evolution_free(&schema_evolution);
tiledb_domain_free(&domain);
tiledb_array_schema_free(&array_schema);
tiledb_ctx_free(&ctx);
}

int main() {
// Get object type
tiledb_ctx_t* ctx;
tiledb_ctx_alloc(NULL, &ctx);
tiledb_object_t type;
tiledb_object_type(ctx, array_name, &type);
tiledb_ctx_free(&ctx);

if (type != TILEDB_ARRAY) {
create_array();
print_current_domain();
expand_current_domain();
}

print_current_domain();
return 0;
}
Loading

0 comments on commit 8d9b959

Please sign in to comment.