Skip to content

Commit

Permalink
Read in config
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenv committed Mar 25, 2024
1 parent 14e4846 commit 0b029d7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
9 changes: 2 additions & 7 deletions apis/python/src/tiledbsoma/_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ def create(
domains = pa.StructArray.from_arrays(domains, names=index_column_names)
extents = pa.StructArray.from_arrays(extents, names=index_column_names)

print(index_column_names)

print(platform_config)
# TODO add as kw args
clib.SOMADataFrame.create(
uri,
Expand Down Expand Up @@ -398,11 +398,6 @@ def read(

if value_filter is not None:
sr.set_condition(QueryCondition(value_filter), handle.schema)

print("sr.schema:")
print(sr.schema)
print("coords:")
print(coords)

self._set_reader_coords(sr, coords)

Expand Down
4 changes: 3 additions & 1 deletion libtiledbsoma/src/soma/soma_dataframe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ void SOMADataFrame::create(
ColumnIndexInfo index_columns,
std::shared_ptr<SOMAContext> ctx,
std::optional<std::pair<uint64_t, uint64_t>> timestamp) {
PlatformConfig platform_cfg = {
{"tiledb", {{"create", {{"allow_duplicates", false}}}}}};
auto tiledb_schema = ArrowAdapter::tiledb_schema_from_arrow_schema(
ctx->tiledb_ctx(), schema, index_columns);
ctx->tiledb_ctx(), schema, index_columns, platform_cfg);
SOMAArray::create(ctx, uri, tiledb_schema, "SOMADataFrame", timestamp);
}

Expand Down
8 changes: 7 additions & 1 deletion libtiledbsoma/src/utils/arrow_adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,15 @@ std::pair<const void*, std::size_t> ArrowAdapter::_get_data_and_length(
ArraySchema ArrowAdapter::tiledb_schema_from_arrow_schema(
std::shared_ptr<Context> ctx,
std::shared_ptr<ArrowSchema> arrow_schema,
ColumnIndexInfo index_column_info) {
ColumnIndexInfo index_column_info,
PlatformConfig platform_config) {
auto [index_column_names, domains, extents] = index_column_info;

std::cout << (platform_config["tiledb"]["create"]["allows_duplicates"] ?
"yes" :
"No")
<< std::endl;

ArraySchema schema(*ctx, TILEDB_SPARSE);
Domain domain(*ctx);

Expand Down
6 changes: 5 additions & 1 deletion libtiledbsoma/src/utils/arrow_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ using ColumnIndexInfo = std::tuple<
std::shared_ptr<ArrowArray> // tile extent
>;

using PlatformConfig =
std::map<std::string, std::map<std::string, std::map<std::string, bool>>>;

class ArrowAdapter {
public:
static void release_schema(struct ArrowSchema* schema);
Expand Down Expand Up @@ -70,7 +73,8 @@ class ArrowAdapter {
static ArraySchema tiledb_schema_from_arrow_schema(
std::shared_ptr<Context> ctx,
std::shared_ptr<ArrowSchema> arrow_schema,
ColumnIndexInfo index_column_info);
ColumnIndexInfo index_column_info,
PlatformConfig platform_config);

/**
* @brief Get Arrow format string from TileDB datatype.
Expand Down

0 comments on commit 0b029d7

Please sign in to comment.