Skip to content

Commit

Permalink
add support for TILEDB_GEOM_WKB and TILEDB_GEOM_WKB:
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisStaratzis committed Jan 26, 2024
1 parent d0f1c2e commit 1de2e6f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
2 changes: 2 additions & 0 deletions mytile/ha_mytile.cc
Expand Up @@ -3219,6 +3219,8 @@ int8_t tile::mytile::compare_key_to_dim(const uint64_t dim_idx,
return compare_key_to_dim<char>(dim_idx, key + key_offset, char_length, buff, size);
}
case TILEDB_BLOB:
case TILEDB_GEOM_WKB:
case TILEDB_GEOM_WKT:
return compare_key_to_dim<std::byte>(dim_idx, key, key_part_len, fixed_buff_pointer);
case TILEDB_BOOL:
return compare_key_to_dim<bool>(dim_idx, key, key_part_len, fixed_buff_pointer);
Expand Down
2 changes: 2 additions & 0 deletions mytile/mytile-metadata.cc
Expand Up @@ -70,6 +70,8 @@ std::string tile::build_metadata_value_string(THD *thd, const void *data,
case TILEDB_STRING_UCS4:
case TILEDB_ANY:
case TILEDB_BLOB:
case TILEDB_GEOM_WKB:
case TILEDB_GEOM_WKT:
return tile::build_metadata_string_value_string<char>(data, num);
case TILEDB_DATETIME_YEAR:
return tile::build_metadata_numeric_value_string<int64_t>(data, num);
Expand Down
22 changes: 19 additions & 3 deletions mytile/mytile.cc
Expand Up @@ -187,7 +187,9 @@ int tile::TileDBTypeToMysqlType(tiledb_datatype_t type, bool multi_value, uint32
return MYSQL_TYPE_LONG_BLOB;
return MYSQL_TYPE_TINY;
}
case TILEDB_BLOB: {
case TILEDB_BLOB:
case TILEDB_GEOM_WKB:
case TILEDB_GEOM_WKT:{
if (multi_value)
return MYSQL_TYPE_LONG_BLOB;
return MYSQL_TYPE_TINY_BLOB;
Expand Down Expand Up @@ -351,7 +353,9 @@ std::string tile::TileDBTypeValueToString(tiledb_datatype_t type,
case TILEDB_STRING_UCS2:
case TILEDB_STRING_UCS4:
case TILEDB_ANY:
case TILEDB_BLOB: {
case TILEDB_BLOB:
case TILEDB_GEOM_WKB:
case TILEDB_GEOM_WKT: {
auto v = reinterpret_cast<const char *>(value);
std::string s(v, value_size);
// If the string is the null character we have to us the escaped version
Expand Down Expand Up @@ -751,6 +755,8 @@ void *tile::alloc_buffer(tiledb_datatype_t type, uint64_t size) {
return alloc_buffer<int64_t>(rounded_size);

case tiledb_datatype_t::TILEDB_BLOB:
case tiledb_datatype_t::TILEDB_GEOM_WKB:
case tiledb_datatype_t::TILEDB_GEOM_WKT:
return alloc_buffer<std::byte>(rounded_size);

case tiledb_datatype_t::TILEDB_BOOL:
Expand Down Expand Up @@ -1062,6 +1068,8 @@ int tile::set_field(THD *thd, Field *field, std::shared_ptr<buffer> &buff,
MYSQL_TIMESTAMP_TIME);
}
case TILEDB_BLOB:
case TILEDB_GEOM_WKB:
case TILEDB_GEOM_WKT:
return set_string_field<std::byte>(field, buff, i, &my_charset_latin1);
case TILEDB_BOOL:
return set_field<bool>(field, i, buff, fixed_size_multi_value, fixed_size_elements);
Expand Down Expand Up @@ -1245,7 +1253,9 @@ int tile::set_buffer_from_field(Field *field, std::shared_ptr<buffer> &buff,
int64_t xs = MysqlTimeToTileDBTimeVal(thd, mysql_time, buff->type);
return set_buffer_from_field<int64_t>(xs, field_null, buff, i);
}
case TILEDB_BLOB: {
case TILEDB_BLOB:
case TILEDB_GEOM_WKB:
case TILEDB_GEOM_WKT:{
if (buff->offset_buffer != nullptr)
return set_string_buffer_from_field<std::byte>(field, field_null, buff,
i);
Expand Down Expand Up @@ -1473,6 +1483,8 @@ const void *tile::default_tiledb_fill_value(const tiledb_datatype_t &type) {
case tiledb_datatype_t::TILEDB_ANY:
return &constants::empty_any;
case tiledb_datatype_t::TILEDB_BLOB:
case tiledb_datatype_t::TILEDB_GEOM_WKB:
case tiledb_datatype_t::TILEDB_GEOM_WKT:
return &constants::empty_blob;
case tiledb_datatype_t::TILEDB_STRING_ASCII:
return &constants::empty_ascii;
Expand Down Expand Up @@ -1541,6 +1553,8 @@ bool tile::is_string_datatype(const tiledb_datatype_t &type) {
case tiledb_datatype_t::TILEDB_FLOAT64:
case tiledb_datatype_t::TILEDB_ANY:
case tiledb_datatype_t::TILEDB_BLOB:
case tiledb_datatype_t::TILEDB_GEOM_WKB:
case tiledb_datatype_t::TILEDB_GEOM_WKT:
case tiledb_datatype_t::TILEDB_DATETIME_YEAR:
case tiledb_datatype_t::TILEDB_DATETIME_MONTH:
case tiledb_datatype_t::TILEDB_DATETIME_WEEK:
Expand Down Expand Up @@ -1676,6 +1690,8 @@ tile::BufferSizeByType tile::compute_buffer_sizes(
num_int64_buffers += 1;
break;
case TILEDB_BLOB:
case TILEDB_GEOM_WKB:
case TILEDB_GEOM_WKT:
num_blob_buffers += 1;
break;
case TILEDB_BOOL:
Expand Down
2 changes: 2 additions & 0 deletions mytile/mytile.h
Expand Up @@ -126,6 +126,8 @@ struct BufferSizeByType {
case TILEDB_TIME_AS:
return int64_buffer_size;
case TILEDB_BLOB:
case TILEDB_GEOM_WKB:
case TILEDB_GEOM_WKT:
return blob_buffer_size;
case TILEDB_BOOL:
return bool_buffer_size;
Expand Down

0 comments on commit 1de2e6f

Please sign in to comment.