fix for crash (weak strict ordering)

This commit is contained in:
vaclavt
2022-05-31 19:28:56 +02:00
parent 41bdeeda89
commit 316bd953f4
2 changed files with 2 additions and 3 deletions

View File

@@ -171,7 +171,7 @@ public:
case 5:
return (ColValue &) *std::get_if<ColBooleanValue>(&m_columns[i]);
default:
throw Exception("should not happen");
throw Exception("ColValue &operator[](int i), type index invalid :" + std::to_string(type_index));
}
}

View File

@@ -155,8 +155,7 @@ void USql::setup_order_columns(std::vector<ColOrderNode> &node, Table *table) {
void USql::execute_distinct(SelectFromTableNode &node, Table *result) {
if (!node.distinct) return;
auto compare_rows = [](const Row &a, const Row &b) { return a.compare(b) >= 0; };
std::sort(result->m_rows.begin(), result->m_rows.end(), compare_rows);
std::sort(result->m_rows.begin(), result->m_rows.end(), [](const Row &a, const Row &b) { return a.compare(b) > 0; });
result->m_rows.erase(std::unique(result->m_rows.begin(), result->m_rows.end()), result->m_rows.end());
}