Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for creating array type in python sdk #2496

Merged
merged 2 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions python/infinity_embedded/local_infinity/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,8 @@ def get_data_type_from_column_big_info(column_big_info: list) -> WrapDataType:
return sparse_type
# return get_sparse_info(column_info, column_defs, column_name, index)
case "array":
if len(column_big_info) < 2:
raise InfinityException(ErrorCode.INVALID_DATA_TYPE, f"No element type for array!")
proto_column_type = WrapDataType()
proto_column_type.logical_type = LogicalType.kArray
proto_column_type.array_type = get_data_type_from_column_big_info(column_big_info[1:])
Expand Down
2 changes: 2 additions & 0 deletions python/infinity_sdk/infinity/remote_thrift/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,8 @@ def get_data_type_from_column_big_info(column_big_info: list) -> ttypes.DataType
return sparse_type
# return get_sparse_info(column_info, column_defs, column_name, index)
case "array":
if len(column_big_info) < 2:
raise InfinityException(ErrorCode.INVALID_DATA_TYPE, f"No element type for array!")
array_type = ttypes.DataType()
array_type.logic_type = ttypes.LogicType.Array
array_type.physical_type = ttypes.PhysicalType()
Expand Down
2 changes: 2 additions & 0 deletions python/test_pysdk/test_insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,8 @@ def _test_insert_array(self, suffix):
pytest.skip("HTTP not support array type")
db_obj = self.infinity_obj.get_database("default_db")
db_obj.drop_table("test_insert_array" + suffix, ConflictType.Ignore)
with pytest.raises(InfinityException):
db_obj.create_table("test_insert_array" + suffix, {"c1": {"type": "array,array"}}, ConflictType.Error)
table_obj = db_obj.create_table("test_insert_array" + suffix, {"c1": {"type": "array,array,array,int"}},
ConflictType.Error)
assert table_obj
Expand Down
6 changes: 4 additions & 2 deletions src/storage/meta/entry/segment_index_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,11 +658,13 @@ void SegmentIndexEntry::GetChunkIndexEntries(Vector<SharedPtr<ChunkIndexEntry>>
for (SizeT i = 0; i < num; i++) {
auto &chunk_index_entry = chunk_index_entries_[i];
bool add = chunk_index_entry->CheckVisible(txn);
LOG_INFO(fmt::format("GetChunkIndexEntries, CheckVisible ret: {}, chunk_id: {}, deprecate ts: {}, txn_id: {}",
LOG_INFO(fmt::format("GetChunkIndexEntries, CheckVisible ret: {}, chunk_id: {}, deprecate ts: {}, txn_id: {}, base_rowid: {}, row_count: {}",
add,
chunk_index_entry->chunk_id_,
chunk_index_entry->deprecate_ts_.load(),
txn_id_str));
txn_id_str,
chunk_index_entry->base_rowid_.ToString(),
chunk_index_entry->row_count_));
if (add) {
chunk_index_entries.push_back(chunk_index_entry);
}
Expand Down