use of org.neo4j.values.virtual.MapValue in project neo4j by neo4j.
the class AnyValueComparatorTest method shouldTernaryCompareNodes.
@Test
void shouldTernaryCompareNodes() {
assertTernaryCompare(nodeValue(42, stringArray("L"), EMPTY_MAP), nodeValue(42, stringArray("L"), EMPTY_MAP), EQUAL);
assertTernaryCompare(nodeValue(42, stringArray("L"), EMPTY_MAP), nodeValue(43, stringArray("L"), EMPTY_MAP), SMALLER_THAN);
assertTernaryCompare(node(42), nodeValue(42, stringArray("L"), EMPTY_MAP), EQUAL);
assertTernaryCompare(nodeValue(42, stringArray("L"), EMPTY_MAP), intValue(42), UNDEFINED);
MapValue propMap = map("foo", "bar");
assertTernaryCompare(nodeValue(42, stringArray("L"), propMap), propMap, UNDEFINED);
}
use of org.neo4j.values.virtual.MapValue in project neo4j by neo4j.
the class FabricKernelTransaction method makeChildTransactionalContext.
private TransactionalContext makeChildTransactionalContext(StatementLifecycle lifecycle) {
var parentQuery = lifecycle.getMonitoredQuery();
if (lifecycle.isParentChildMonitoringMode()) {
// Cypher engine reports separately for each child query
String queryText = "Internal query for parent query id: " + parentQuery.id();
MapValue params = MapValue.EMPTY;
return transactionalContextFactory.newContext(internalTransaction, queryText, params);
} else {
// Mark query as no longer in Fabric phase
lifecycle.doneFabricPhase();
// Cypher engine reports directly to parent query
return transactionalContextFactory.newContextForQuery(internalTransaction, parentQuery);
}
}
use of org.neo4j.values.virtual.MapValue in project neo4j by neo4j.
the class NodeEntityWrappingNodeValue method properties.
public MapValue properties(NodeCursor nodeCursor, PropertyCursor propertyCursor) {
MapValue m = properties;
if (m == null) {
try {
synchronized (this) {
m = properties;
if (m == null) {
// No DBHits for Virtual node hacks.
var nodeProperties = node instanceof NodeEntity ? ((NodeEntity) node).getAllProperties(nodeCursor, propertyCursor) : node.getAllProperties();
m = properties = ValueUtils.asMapValue(nodeProperties);
}
}
} catch (NotFoundException | IllegalStateException | StoreFailureException e) {
throw new ReadAndDeleteTransactionConflictException(NodeEntity.isDeletedInCurrentTransaction(node), e);
}
}
return m;
}
use of org.neo4j.values.virtual.MapValue in project neo4j by neo4j.
the class RelationshipEntityWrappingValue method properties.
public MapValue properties(PropertyCursor propertyCursor) {
MapValue m = properties;
if (m == null) {
try {
synchronized (this) {
m = properties;
if (m == null) {
var relProperties = relationship instanceof RelationshipEntity ? ((RelationshipEntity) relationship).getAllProperties(propertyCursor) : relationship.getAllProperties();
m = properties = ValueUtils.asMapValue(relProperties);
}
}
} catch (NotFoundException | IllegalStateException e) {
throw new ReadAndDeleteTransactionConflictException(RelationshipEntity.isDeletedInCurrentTransaction(relationship), e);
}
}
return m;
}
use of org.neo4j.values.virtual.MapValue in project neo4j by neo4j.
the class RelationshipEntityWrappingValue method writeTo.
@Override
public <E extends Exception> void writeTo(AnyValueWriter<E> writer) throws E {
if (writer.entityMode() == REFERENCE) {
writer.writeRelationshipReference(id());
} else {
if (relationship instanceof RelationshipEntity) {
RelationshipEntity proxy = (RelationshipEntity) relationship;
if (!proxy.initializeData()) {
// and that they need to retry it.
throw new ReadAndDeleteTransactionConflictException(RelationshipEntity.isDeletedInCurrentTransaction(relationship));
}
}
MapValue p;
try {
p = properties();
} catch (ReadAndDeleteTransactionConflictException e) {
if (!e.wasDeletedInThisTransaction()) {
throw e;
}
// If it isn't a transient error then the relationship was deleted in the current transaction and we should write an 'empty' relationship.
p = VirtualValues.EMPTY_MAP;
}
if (id() < 0) {
writer.writeVirtualRelationshipHack(relationship);
}
writer.writeRelationship(id(), startNode().id(), endNode().id(), type(), p);
}
}
Aggregations