Skip to content

Commit

Permalink
tool pytest fix and swig fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vagetablechicken committed Jun 27, 2024
1 parent 9cb4cfe commit 04ab5af
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions src/sdk/sql_cluster_router.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1452,13 +1452,13 @@ bool SQLClusterRouter::PutRow(uint32_t tid, const std::shared_ptr<SQLInsertRow>&
// 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()) {
Expand Down Expand Up @@ -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()) {
Expand Down
6 changes: 3 additions & 3 deletions src/storage/index_organized_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ absl::Status IndexOrganizedTable::CheckDataExists(uint64_t tsv, const Dimensions
}

// <pkey_col_name, (idx_in_row, type)>, error if empty
std::map<std::string, std::pair<uint32_t, type::DataType>> IndexOrganizedTable::MakePkeysHint(
std::map<std::string, std::pair<uint32_t, type::DataType>> MakePkeysHint(
const codec::Schema& schema, const common::ColumnKey& cidx_ck) {
if (cidx_ck.col_name().empty()) {
LOG(WARNING) << "empty cidx column key";
Expand Down Expand Up @@ -486,7 +486,7 @@ std::map<std::string, std::pair<uint32_t, type::DataType>> 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<std::string, std::pair<uint32_t, type::DataType>>& col_idx) {
auto sql_prefix = absl::StrCat("delete from ", db, ".", name, " where ");
Expand Down Expand Up @@ -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<std::string, std::pair<uint32_t, type::DataType>>& col_idx) {
// join with |
Expand Down
20 changes: 10 additions & 10 deletions src/storage/index_organized_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,6 @@ class IndexOrganizedTable : public MemTable {

void SchedGCByDelete(const std::shared_ptr<sdk::SQLRouter>& router);

static std::map<std::string, std::pair<uint32_t, type::DataType>> 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<std::string, std::pair<uint32_t, type::DataType>>& col_idx);
static std::string ExtractPkeys(const common::ColumnKey& cidx_ck, const int8_t* values,
const codec::RowView& row_view,
const std::map<std::string, std::pair<uint32_t, type::DataType>>& col_idx);

private:
absl::Status ClusteredIndexGCByDelete(const std::shared_ptr<sdk::SQLRouter>& router);

Expand All @@ -72,6 +63,15 @@ class IndexOrganizedTable : public MemTable {

std::mutex gc_lock_;
};
} // namespace openmldb::storage

static std::map<std::string, std::pair<uint32_t, type::DataType>> 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<std::string, std::pair<uint32_t, type::DataType>>& col_idx);
static std::string ExtractPkeys(const common::ColumnKey& cidx_ck, const int8_t* values,
const codec::RowView& row_view,
const std::map<std::string, std::pair<uint32_t, type::DataType>>& col_idx);

} // namespace openmldb::storage
#endif
4 changes: 2 additions & 2 deletions steps/test_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 04ab5af

Please sign in to comment.