Remove redundant code
This commit is contained in:
parent
37f5fb29ea
commit
d080e260e6
@ -407,7 +407,7 @@ class ExpressionEvaluator : public ExpressionVisitor<TypedValue> {
|
|||||||
typename TReturnType = std::enable_if_t<std::is_same_v<TTag, StorageTag>, bool>>
|
typename TReturnType = std::enable_if_t<std::is_same_v<TTag, StorageTag>, bool>>
|
||||||
TReturnType HasLabelImpl(const VertexAccessor &vertex, const LabelIx &label, StorageTag /*tag*/) {
|
TReturnType HasLabelImpl(const VertexAccessor &vertex, const LabelIx &label, StorageTag /*tag*/) {
|
||||||
auto has_label = vertex.HasLabel(view_, GetLabel(label));
|
auto has_label = vertex.HasLabel(view_, GetLabel(label));
|
||||||
if (has_label.HasError() && has_label.GetError().code == Error::NONEXISTENT_OBJECT) {
|
if (has_label.HasError() && has_label.GetError() == Error::NONEXISTENT_OBJECT) {
|
||||||
// This is a very nasty and temporary hack in order to make MERGE
|
// This is a very nasty and temporary hack in order to make MERGE
|
||||||
// work. The old storage had the following logic when returning an
|
// work. The old storage had the following logic when returning an
|
||||||
// `OLD` view: `return old ? old : new`. That means that if the
|
// `OLD` view: `return old ? old : new`. That means that if the
|
||||||
@ -746,7 +746,7 @@ class ExpressionEvaluator : public ExpressionVisitor<TypedValue> {
|
|||||||
class TReturnType = std::enable_if_t<std::is_same_v<TTag, StorageTag>, TypedValue>>
|
class TReturnType = std::enable_if_t<std::is_same_v<TTag, StorageTag>, TypedValue>>
|
||||||
TypedValue GetProperty(const TRecordAccessor &record_accessor, PropertyIx prop) {
|
TypedValue GetProperty(const TRecordAccessor &record_accessor, PropertyIx prop) {
|
||||||
auto maybe_prop = record_accessor.GetProperty(view_, ctx_->properties[prop.ix]);
|
auto maybe_prop = record_accessor.GetProperty(view_, ctx_->properties[prop.ix]);
|
||||||
if (maybe_prop.HasError() && maybe_prop.GetError().code == Error::NONEXISTENT_OBJECT) {
|
if (maybe_prop.HasError() && maybe_prop.GetError() == Error::NONEXISTENT_OBJECT) {
|
||||||
// This is a very nasty and temporary hack in order to make MERGE work.
|
// This is a very nasty and temporary hack in order to make MERGE work.
|
||||||
// The old storage had the following logic when returning an `OLD` view:
|
// The old storage had the following logic when returning an `OLD` view:
|
||||||
// `return old ? old : new`. That means that if the `OLD` view didn't
|
// `return old ? old : new`. That means that if the `OLD` view didn't
|
||||||
@ -765,7 +765,7 @@ class ExpressionEvaluator : public ExpressionVisitor<TypedValue> {
|
|||||||
class TReturnType = std::enable_if_t<std::is_same_v<TTag, StorageTag>, TypedValue>>
|
class TReturnType = std::enable_if_t<std::is_same_v<TTag, StorageTag>, TypedValue>>
|
||||||
TypedValue GetProperty(const TRecordAccessor &record_accessor, const std::string_view name) {
|
TypedValue GetProperty(const TRecordAccessor &record_accessor, const std::string_view name) {
|
||||||
auto maybe_prop = record_accessor.GetProperty(view_, dba_->NameToProperty(name));
|
auto maybe_prop = record_accessor.GetProperty(view_, dba_->NameToProperty(name));
|
||||||
if (maybe_prop.HasError() && maybe_prop.GetError().code == Error::NONEXISTENT_OBJECT) {
|
if (maybe_prop.HasError() && maybe_prop.GetError() == Error::NONEXISTENT_OBJECT) {
|
||||||
// This is a very nasty and temporary hack in order to make MERGE work.
|
// This is a very nasty and temporary hack in order to make MERGE work.
|
||||||
// The old storage had the following logic when returning an `OLD` view:
|
// The old storage had the following logic when returning an `OLD` view:
|
||||||
// `return old ? old : new`. That means that if the `OLD` view didn't
|
// `return old ? old : new`. That means that if the `OLD` view didn't
|
||||||
|
@ -81,19 +81,5 @@ inline void ExpectType(const Symbol &symbol, const TypedValue &value, TypedValue
|
|||||||
throw QueryRuntimeException("Expected a {} for '{}', but got {}.", expected, symbol.name(), value.type());
|
throw QueryRuntimeException("Expected a {} for '{}', but got {}.", expected, symbol.name(), value.type());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
concept AccessorWithSetProperty = requires(T accessor, const storage::v3::PropertyId key,
|
|
||||||
const storage::v3::PropertyValue new_value) {
|
|
||||||
{ accessor.SetProperty(key, new_value) } -> std::same_as<storage::v3::ShardResult<storage::v3::PropertyValue>>;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
concept AccessorWithSetPropertyAndValidate = requires(T accessor, const storage::v3::PropertyId key,
|
|
||||||
const storage::v3::PropertyValue new_value) {
|
|
||||||
{
|
|
||||||
accessor.SetPropertyAndValidate(key, new_value)
|
|
||||||
} -> std::same_as<storage::v3::ShardResult<storage::v3::PropertyValue>>;
|
|
||||||
};
|
|
||||||
|
|
||||||
int64_t QueryTimestamp();
|
int64_t QueryTimestamp();
|
||||||
} // namespace memgraph::query::v2
|
} // namespace memgraph::query::v2
|
||||||
|
@ -816,45 +816,9 @@ std::vector<Symbol> SetProperties::ModifiedSymbols(const SymbolTable &table) con
|
|||||||
SetProperties::SetPropertiesCursor::SetPropertiesCursor(const SetProperties &self, utils::MemoryResource *mem)
|
SetProperties::SetPropertiesCursor::SetPropertiesCursor(const SetProperties &self, utils::MemoryResource *mem)
|
||||||
: self_(self), input_cursor_(self.input_->MakeCursor(mem)) {}
|
: self_(self), input_cursor_(self.input_->MakeCursor(mem)) {}
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
concept AccessorWithProperties = requires(T value, storage::v3::PropertyId property_id,
|
|
||||||
storage::v3::PropertyValue property_value) {
|
|
||||||
{
|
|
||||||
value.ClearProperties()
|
|
||||||
} -> std::same_as<storage::v3::ShardResult<std::map<storage::v3::PropertyId, storage::v3::PropertyValue>>>;
|
|
||||||
{value.SetProperty(property_id, property_value)};
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
bool SetProperties::SetPropertiesCursor::Pull(Frame &frame, ExecutionContext &context) {
|
bool SetProperties::SetPropertiesCursor::Pull(Frame &frame, ExecutionContext &context) {
|
||||||
SCOPED_PROFILE_OP("SetProperties");
|
SCOPED_PROFILE_OP("SetProperties");
|
||||||
return false;
|
return false;
|
||||||
// if (!input_cursor_->Pull(frame, context)) return false;
|
|
||||||
//
|
|
||||||
// TypedValue &lhs = frame[self_.input_symbol_];
|
|
||||||
//
|
|
||||||
// // Set, just like Create needs to see the latest changes.
|
|
||||||
// ExpressionEvaluator evaluator(&frame, context.symbol_table, context.evaluation_context, context.db_accessor,
|
|
||||||
// storage::v3::View::NEW);
|
|
||||||
// TypedValue rhs = self_.rhs_->Accept(evaluator);
|
|
||||||
//
|
|
||||||
// switch (lhs.type()) {
|
|
||||||
// case TypedValue::Type::Vertex:
|
|
||||||
// SetPropertiesOnRecord(&lhs.ValueVertex(), rhs, self_.op_, &context);
|
|
||||||
// break;
|
|
||||||
// case TypedValue::Type::Edge:
|
|
||||||
// SetPropertiesOnRecord(&lhs.ValueEdge(), rhs, self_.op_, &context);
|
|
||||||
// break;
|
|
||||||
// case TypedValue::Type::Null:
|
|
||||||
// // Skip setting properties on Null (can occur in optional match).
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// throw QueryRuntimeException("Properties can only be set on edges and vertices.");
|
|
||||||
// }
|
|
||||||
// return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetProperties::SetPropertiesCursor::Shutdown() { input_cursor_->Shutdown(); }
|
void SetProperties::SetPropertiesCursor::Shutdown() { input_cursor_->Shutdown(); }
|
||||||
|
@ -37,6 +37,8 @@ struct ShardError {
|
|||||||
std::string source;
|
std::string source;
|
||||||
|
|
||||||
inline friend bool operator==(const ShardError &lhs, const ShardError &rhs) { return lhs.code == rhs.code; }
|
inline friend bool operator==(const ShardError &lhs, const ShardError &rhs) { return lhs.code == rhs.code; }
|
||||||
|
|
||||||
|
inline friend bool operator==(const ShardError &lhs, const common::ErrorCode rhs) { return lhs.code == rhs; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
|
||||||
|
Loading…
Reference in New Issue
Block a user