From 04ab5af4d3aa934e39b95d5ee2a27e96e8020eaf Mon Sep 17 00:00:00 2001 From: HuangWei Date: Thu, 27 Jun 2024 09:05:26 +0000 Subject: [PATCH] tool pytest fix and swig fix --- src/sdk/sql_cluster_router.cc | 8 ++++---- src/storage/index_organized_table.cc | 6 +++--- src/storage/index_organized_table.h | 20 ++++++++++---------- steps/test_python.sh | 4 ++-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/sdk/sql_cluster_router.cc b/src/sdk/sql_cluster_router.cc index cd438b90c3b..4bbf57ec13a 100644 --- a/src/sdk/sql_cluster_router.cc +++ b/src/sdk/sql_cluster_router.cc @@ -1452,13 +1452,13 @@ bool SQLClusterRouter::PutRow(uint32_t tid, const std::shared_ptr& // revertput or SQLDeleteRow is not easy to use here, so make a sql DLOG(INFO) << "primary key exists, delete old data then insert new data"; // just where primary key, not all columns(redundant condition) - auto hint = storage::IndexOrganizedTable::MakePkeysHint(row->GetTableInfo().column_desc(), + auto hint = storage::MakePkeysHint(row->GetTableInfo().column_desc(), row->GetTableInfo().column_key(0)); if (hint.empty()) { SET_STATUS_AND_WARN(status, StatusCode::kCmdError, "make pkeys hint failed"); return false; } - auto sql = storage::IndexOrganizedTable::MakeDeleteSQL(row->GetTableInfo().db(), row->GetTableInfo().name(), + auto sql = storage::MakeDeleteSQL(row->GetTableInfo().db(), row->GetTableInfo().name(), row->GetTableInfo().column_key(0), (int8_t*)exists_value.c_str(), ts, row_view, hint); if (sql.empty()) { @@ -1687,12 +1687,12 @@ bool SQLClusterRouter::ExecuteInsert(const std::string& db, const std::string& n DLOG(INFO) << "primary key exists, delete old data then insert new data"; // just where primary key, not all columns(redundant condition) auto hint = - storage::IndexOrganizedTable::MakePkeysHint(table_info->column_desc(), table_info->column_key(0)); + storage::MakePkeysHint(table_info->column_desc(), table_info->column_key(0)); if (hint.empty()) { SET_STATUS_AND_WARN(status, StatusCode::kCmdError, "make pkeys hint failed"); return false; } - auto sql = storage::IndexOrganizedTable::MakeDeleteSQL(table_info->db(), table_info->name(), + auto sql = storage::MakeDeleteSQL(table_info->db(), table_info->name(), table_info->column_key(0), (int8_t*)exists_value.c_str(), ts, row_view, hint); if (sql.empty()) { diff --git a/src/storage/index_organized_table.cc b/src/storage/index_organized_table.cc index 84354dc5d9e..8b02cb74243 100644 --- a/src/storage/index_organized_table.cc +++ b/src/storage/index_organized_table.cc @@ -453,7 +453,7 @@ absl::Status IndexOrganizedTable::CheckDataExists(uint64_t tsv, const Dimensions } // , error if empty -std::map> IndexOrganizedTable::MakePkeysHint( +std::map> MakePkeysHint( const codec::Schema& schema, const common::ColumnKey& cidx_ck) { if (cidx_ck.col_name().empty()) { LOG(WARNING) << "empty cidx column key"; @@ -486,7 +486,7 @@ std::map> IndexOrganizedTable:: } // error if empty -std::string IndexOrganizedTable::MakeDeleteSQL( +std::string MakeDeleteSQL( const std::string& db, const std::string& name, const common::ColumnKey& cidx_ck, const int8_t* values, uint64_t ts, const codec::RowView& row_view, const std::map>& col_idx) { auto sql_prefix = absl::StrCat("delete from ", db, ".", name, " where "); @@ -529,7 +529,7 @@ std::string IndexOrganizedTable::MakeDeleteSQL( } // error if empty -std::string IndexOrganizedTable::ExtractPkeys( +std::string ExtractPkeys( const common::ColumnKey& cidx_ck, const int8_t* values, const codec::RowView& row_view, const std::map>& col_idx) { // join with | diff --git a/src/storage/index_organized_table.h b/src/storage/index_organized_table.h index a037c8cf05a..7e0eb5e351d 100644 --- a/src/storage/index_organized_table.h +++ b/src/storage/index_organized_table.h @@ -54,15 +54,6 @@ class IndexOrganizedTable : public MemTable { void SchedGCByDelete(const std::shared_ptr& router); - static std::map> MakePkeysHint(const codec::Schema& schema, - const common::ColumnKey& cidx_ck); - static std::string MakeDeleteSQL(const std::string& db, const std::string& name, const common::ColumnKey& cidx_ck, - const int8_t* values, uint64_t ts, const codec::RowView& row_view, - const std::map>& col_idx); - static std::string ExtractPkeys(const common::ColumnKey& cidx_ck, const int8_t* values, - const codec::RowView& row_view, - const std::map>& col_idx); - private: absl::Status ClusteredIndexGCByDelete(const std::shared_ptr& router); @@ -72,6 +63,15 @@ class IndexOrganizedTable : public MemTable { std::mutex gc_lock_; }; -} // namespace openmldb::storage +static std::map> MakePkeysHint(const codec::Schema& schema, + const common::ColumnKey& cidx_ck); +static std::string MakeDeleteSQL(const std::string& db, const std::string& name, const common::ColumnKey& cidx_ck, + const int8_t* values, uint64_t ts, const codec::RowView& row_view, + const std::map>& col_idx); +static std::string ExtractPkeys(const common::ColumnKey& cidx_ck, const int8_t* values, + const codec::RowView& row_view, + const std::map>& col_idx); + +} // namespace openmldb::storage #endif diff --git a/steps/test_python.sh b/steps/test_python.sh index 8c366f77b0c..3e3588b0db7 100644 --- a/steps/test_python.sh +++ b/steps/test_python.sh @@ -42,8 +42,8 @@ python3 -m pip install "${whl_name_sdk}[test]" cd "${ROOT_DIR}"/python/openmldb_tool/dist/ whl_name_tool=$(ls openmldb*.whl) echo "whl_name_tool:${whl_name_tool}" -# pip 23.1.2 just needs to install test(rpc is required by test) -python3 -m pip install "${whl_name_tool}[rpc,test]" +# pip 23.1.2 just needs to install test +python3 -m pip install "${whl_name_tool}[test]" python3 -m pip install pytest-cov