From 4e591a6ffe043cbeef677390cef3fde448b42286 Mon Sep 17 00:00:00 2001 From: Pontus Melke Date: Thu, 31 Aug 2017 12:37:07 +0200 Subject: [PATCH] Move AnyValues.of out of values module --- .../v1/runtime/ExecutionPlanConverter.java | 6 +- .../org/neo4j/bolt/testing/BoltMatchers.java | 4 +- .../messaging/BoltRequestMessageWriter.java | 6 +- .../v1/messaging/BoltResponseMessageTest.java | 4 +- .../bolt/v1/messaging/Neo4jPackTest.java | 4 +- .../runtime/ExecutionPlanConverterTest.java | 6 +- .../NodeProxyWrappingNodeValue.java | 111 +++++++ .../RelationshipProxyWrappingEdgeValue.java | 139 +++++++++ .../internal/javacompat/ValueUtils.java | 284 ++++++++++++++++++ .../v2_3/ExecutionResultWrapper.scala | 8 +- .../v3_1/ExecutionResultWrapper.scala | 5 +- .../v3_2/ExecutionResultWrapper.scala | 5 +- .../commands/expressions/PointFunction.scala | 5 +- .../expressions/ShortestPathExpression.scala | 15 +- .../procs/ProcedureExecutionResult.scala | 8 +- .../runtime/helpers/ValueConversion.scala | 33 +- .../v3_3/runtime/pipes/AllNodesScanPipe.scala | 4 +- .../runtime/pipes/CachingExpandInto.scala | 5 +- .../v3_3/runtime/pipes/CreateNodePipe.scala | 5 +- .../pipes/CreateRelationshipPipe.scala | 5 +- .../v3_3/runtime/pipes/ExpandAllPipe.scala | 2 +- .../FullPruningVarLengthExpandPipe.scala | 4 +- .../v3_3/runtime/pipes/IdSeekIterator.scala | 21 +- .../runtime/pipes/NodeByLabelScanPipe.scala | 4 +- .../pipes/NodeIndexContainsScanPipe.scala | 4 +- .../runtime/pipes/NodeIndexScanPipe.scala | 6 +- .../runtime/pipes/NodeIndexSeekPipe.scala | 2 +- .../runtime/pipes/OptionalExpandAllPipe.scala | 7 +- .../pipes/PruningVarLengthExpandPipe.scala | 4 +- .../v3_3/runtime/pipes/StartPipe.scala | 7 +- .../runtime/pipes/VarLengthExpandPipe.scala | 5 +- .../pipes/matching/PatternRelationship.scala | 10 +- .../v3_3/TransactionBoundQueryContext.scala | 4 +- .../v3_3/MatchingContextTest.scala | 8 +- .../runtime/ImplicitValueConversion.scala | 23 +- .../runtime/commands/LengthFunctionTest.scala | 4 +- .../expressions/PathValueBuilderTest.scala | 2 +- .../GraphElementPropertyFunctionsTest.scala | 4 +- .../runtime/pipes/ExpandAllPipeTest.scala | 6 +- .../runtime/pipes/ExpandIntoPipeTest.scala | 2 +- .../v3_3/runtime/pipes/FakePipe.scala | 4 +- .../runtime/pipes/NodeByIdSeekPipeTest.scala | 2 +- .../pipes/NodeByLabelScanPipeTest.scala | 2 +- .../runtime/pipes/NodeHashJoinPipeTest.scala | 2 +- .../runtime/pipes/NodeIndexScanPipeTest.scala | 2 +- .../runtime/pipes/NodeIndexSeekPipeTest.scala | 2 +- .../pipes/NodeOuterHashJoinPipeTest.scala | 2 +- .../pipes/OptionalExpandAllPipeTest.scala | 2 +- .../pipes/OptionalExpandIntoPipeTest.scala | 2 +- .../v3_3/runtime/pipes/PipeTestSupport.scala | 4 +- .../pipes/ProjectEndpointsPipeTest.scala | 3 +- .../v3_3/runtime/pipes/TopPipeTest.scala | 4 +- .../pipes/TriadicSelectionPipeTest.scala | 7 +- ...DirectedRelationshipByIdSeekPipeTest.scala | 2 +- .../aggregation/PercentileFunctionsTest.scala | 5 +- .../pipes/aggregation/StdevFunctionTest.scala | 4 +- .../v3_3/AllShortestPathsPipeTest.scala | 3 +- .../compiler/v3_3/PathExpressionTest.scala | 2 +- .../v3_3/SingleShortestPathPipeTest.scala | 3 +- .../FullPruningVarLengthExpandPipeTest.scala | 5 +- .../PruningVarLengthExpandPipeTest.scala | 36 +-- .../kernel/impl/store/TestShortArray.java | 4 +- .../main/java/org/neo4j/values/AnyValues.java | 252 ---------------- .../org/neo4j/values/virtual/EdgeValue.java | 112 ------- .../org/neo4j/values/virtual/NodeValue.java | 86 ------ .../neo4j/values/virtual/VirtualValues.java | 12 - .../expressions/NodeFromRegister.scala | 2 +- .../RelationshipFromRegister.scala | 5 +- .../pipes/VarLengthExpandRegisterPipe.scala | 4 +- .../codegen/GeneratedMethodStructure.scala | 15 +- .../v3_3/codegen/CodeGeneratorTest.scala | 5 +- .../codegen/CompiledExecutionResultTest.scala | 6 +- .../auth/BoltAuthScenariosInteractionIT.java | 4 +- .../BoltBuiltInProceduresInteractionIT.java | 4 +- ...tConfiguredAuthScenariosInteractionIT.java | 4 +- .../auth/BoltConfiguredProceduresIT.java | 4 +- ...UserManagementProceduresInteractionIT.java | 4 +- 77 files changed, 752 insertions(+), 660 deletions(-) create mode 100644 community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/NodeProxyWrappingNodeValue.java create mode 100644 community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/RelationshipProxyWrappingEdgeValue.java create mode 100644 community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/ValueUtils.java diff --git a/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/ExecutionPlanConverter.java b/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/ExecutionPlanConverter.java index 3695516a2994..a2614d7b3203 100644 --- a/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/ExecutionPlanConverter.java +++ b/community/bolt/src/main/java/org/neo4j/bolt/v1/runtime/ExecutionPlanConverter.java @@ -24,9 +24,9 @@ import java.util.List; import java.util.Map; +import org.neo4j.cypher.internal.javacompat.ValueUtils; import org.neo4j.graphdb.ExecutionPlanDescription; import org.neo4j.values.AnyValue; -import org.neo4j.values.AnyValues; import org.neo4j.values.virtual.ListValue; import org.neo4j.values.virtual.MapValue; import org.neo4j.values.virtual.VirtualValues; @@ -46,8 +46,8 @@ public static MapValue convert( ExecutionPlanDescription plan ) { Map out = new HashMap<>(); out.put( "operatorType", stringValue( plan.getName() ) ); - out.put( "args", AnyValues.asMapValue( plan.getArguments() ) ); - out.put( "identifiers", AnyValues.asListValue( plan.getIdentifiers() ) ); + out.put( "args", ValueUtils.asMapValue( plan.getArguments() ) ); + out.put( "identifiers", ValueUtils.asListValue( plan.getIdentifiers() ) ); out.put( "children", children( plan ) ); if ( plan.hasProfilerStatistics() ) { diff --git a/community/bolt/src/test/java/org/neo4j/bolt/testing/BoltMatchers.java b/community/bolt/src/test/java/org/neo4j/bolt/testing/BoltMatchers.java index e45c932c7f7f..9a00965c960d 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/testing/BoltMatchers.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/testing/BoltMatchers.java @@ -30,11 +30,11 @@ import org.neo4j.bolt.v1.runtime.BoltConnectionFatality; import org.neo4j.bolt.v1.runtime.BoltStateMachine; import org.neo4j.bolt.v1.runtime.StatementProcessor; +import org.neo4j.cypher.internal.javacompat.ValueUtils; import org.neo4j.function.ThrowingAction; import org.neo4j.function.ThrowingBiConsumer; import org.neo4j.kernel.api.exceptions.Status; import org.neo4j.values.AnyValue; -import org.neo4j.values.AnyValues; import org.neo4j.values.result.QueryResult; import org.neo4j.values.storable.TextValue; @@ -99,7 +99,7 @@ public static Matcher succeededWithRecord( final Object... { return new BaseMatcher() { - private AnyValue[] anyValues = Arrays.stream( values ).map( AnyValues::of ).toArray( AnyValue[]::new ); + private AnyValue[] anyValues = Arrays.stream( values ).map( ValueUtils::of ).toArray( AnyValue[]::new ); @Override public boolean matches( final Object item ) diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageWriter.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageWriter.java index 28fcbb83a3bc..39fd70a6b595 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageWriter.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltRequestMessageWriter.java @@ -24,7 +24,7 @@ import org.neo4j.bolt.v1.messaging.message.RequestMessage; import org.neo4j.bolt.v1.runtime.Neo4jError; -import org.neo4j.values.AnyValues; +import org.neo4j.cypher.internal.javacompat.ValueUtils; import static org.neo4j.bolt.v1.messaging.BoltRequestMessage.ACK_FAILURE; import static org.neo4j.bolt.v1.messaging.BoltRequestMessage.DISCARD_ALL; @@ -57,7 +57,7 @@ public void onInit( String clientName, Map credentials ) throws I { packer.packStructHeader( 1, INIT.signature() ); packer.pack( clientName ); - packer.packRawMap( AnyValues.asMapValue( credentials ) ); + packer.packRawMap( ValueUtils.asMapValue( credentials ) ); onMessageComplete.onMessageComplete(); } @@ -81,7 +81,7 @@ public void onRun( String statement, Map params ) { packer.packStructHeader( 2, RUN.signature() ); packer.pack( statement ); - packer.packRawMap( AnyValues.asMapValue( params ) ); + packer.packRawMap( ValueUtils.asMapValue( params ) ); onMessageComplete.onMessageComplete(); } diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltResponseMessageTest.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltResponseMessageTest.java index 007cd26bdc2a..f5b03f3b3830 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltResponseMessageTest.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/BoltResponseMessageTest.java @@ -33,10 +33,10 @@ import org.neo4j.bolt.v1.messaging.message.SuccessMessage; import org.neo4j.bolt.v1.packstream.BufferedChannelInput; import org.neo4j.bolt.v1.packstream.BufferedChannelOutput; +import org.neo4j.cypher.internal.javacompat.ValueUtils; import org.neo4j.kernel.api.exceptions.Status; import org.neo4j.kernel.impl.util.HexPrinter; import org.neo4j.values.AnyValue; -import org.neo4j.values.AnyValues; import org.neo4j.values.virtual.EdgeValue; import org.neo4j.values.virtual.NodeValue; import org.neo4j.values.virtual.VirtualValues; @@ -258,7 +258,7 @@ private T unpack( BoltResponseMessageReader reader, private void assertSerializesNeoValue( Object val ) throws IOException { - assertSerializes( new RecordMessage( record( AnyValues.of( val ) ) ) ); + assertSerializes( new RecordMessage( record( ValueUtils.of( val ) ) ) ); } } diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/Neo4jPackTest.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/Neo4jPackTest.java index 25c170a9d748..c46d9c2edea5 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/Neo4jPackTest.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/messaging/Neo4jPackTest.java @@ -33,9 +33,9 @@ import org.neo4j.bolt.v1.packstream.PackedInputArray; import org.neo4j.bolt.v1.packstream.PackedOutputArray; import org.neo4j.bolt.v1.runtime.Neo4jError; +import org.neo4j.cypher.internal.javacompat.ValueUtils; import org.neo4j.kernel.api.exceptions.Status; import org.neo4j.values.AnyValue; -import org.neo4j.values.AnyValues; import org.neo4j.values.storable.TextArray; import org.neo4j.values.storable.TextValue; import org.neo4j.values.storable.Values; @@ -96,7 +96,7 @@ public void shouldBeAbleToPackAndUnpackListStream() throws IOException // Then assertThat( unpacked, instanceOf( ListValue.class ) ); ListValue unpackedList = (ListValue) unpacked; - assertThat( unpackedList, equalTo( AnyValues.asListValue( expected ) ) ); + assertThat( unpackedList, equalTo( ValueUtils.asListValue( expected ) ) ); } @SuppressWarnings( "unchecked" ) diff --git a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/ExecutionPlanConverterTest.java b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/ExecutionPlanConverterTest.java index 3d77dbacf93a..256583ee995b 100644 --- a/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/ExecutionPlanConverterTest.java +++ b/community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/ExecutionPlanConverterTest.java @@ -26,10 +26,10 @@ import java.util.Map; import java.util.Set; +import org.neo4j.cypher.internal.javacompat.ValueUtils; import org.neo4j.graphdb.ExecutionPlanDescription; import org.neo4j.helpers.collection.Iterators; import org.neo4j.helpers.collection.MapUtil; -import org.neo4j.values.AnyValues; import org.neo4j.values.storable.DoubleValue; import org.neo4j.values.virtual.MapValue; import org.neo4j.values.virtual.VirtualValues; @@ -48,8 +48,8 @@ public void profileStatisticConversion() throws Exception new TestExecutionPlanDescription( "description", getProfilerStatistics(), getIdentifiers(), getArguments() ) ); assertEquals( convertedMap.get( "operatorType" ), stringValue( "description" ) ); - assertEquals( convertedMap.get( "args" ), AnyValues.asMapValue( getArguments() ) ); - assertEquals( convertedMap.get( "identifiers" ), AnyValues.asListValue( getIdentifiers() )); + assertEquals( convertedMap.get( "args" ), ValueUtils.asMapValue( getArguments() ) ); + assertEquals( convertedMap.get( "identifiers" ), ValueUtils.asListValue( getIdentifiers() )); assertEquals( convertedMap.get( "children" ), VirtualValues.EMPTY_LIST ); assertEquals( convertedMap.get( "rows" ), longValue( 1L )); assertEquals( convertedMap.get( "dbHits" ), longValue( 2L ) ); diff --git a/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/NodeProxyWrappingNodeValue.java b/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/NodeProxyWrappingNodeValue.java new file mode 100644 index 000000000000..59bb07fe00c5 --- /dev/null +++ b/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/NodeProxyWrappingNodeValue.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2002-2017 "Neo Technology," + * Network Engine for Objects in Lund AB [http://neotechnology.com] + * + * This file is part of Neo4j. + * + * Neo4j is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.neo4j.cypher.internal.javacompat; + +import java.util.ArrayList; + +import org.neo4j.graphdb.Label; +import org.neo4j.graphdb.Node; +import org.neo4j.graphdb.NotFoundException; +import org.neo4j.values.AnyValueWriter; +import org.neo4j.values.storable.TextArray; +import org.neo4j.values.storable.Values; +import org.neo4j.values.virtual.MapValue; +import org.neo4j.values.virtual.NodeValue; +import org.neo4j.values.virtual.VirtualValues; + +public class NodeProxyWrappingNodeValue extends NodeValue +{ + private final Node node; + private volatile TextArray labels; + private volatile MapValue properties; + + NodeProxyWrappingNodeValue( Node node ) + { + super( node.getId() ); + this.node = node; + } + + public Node nodeProxy() + { + return node; + } + + @Override + public void writeTo( AnyValueWriter writer ) throws E + { + TextArray l; + MapValue p; + try + { + l = labels(); + p = properties(); + } + catch ( NotFoundException e ) + { + l = Values.stringArray(); + p = VirtualValues.EMPTY_MAP; + + } + writer.writeNode( node.getId(), l, p ); + } + + @Override + public TextArray labels() + { + TextArray l = labels; + if ( l == null ) + { + synchronized ( this ) + { + l = labels; + if ( l == null ) + { + ArrayList ls = new ArrayList<>(); + for ( Label label : node.getLabels() ) + { + ls.add( label.name() ); + } + l = labels = Values.stringArray( ls.toArray( new String[ls.size()] ) ); + + } + } + } + return l; + } + + @Override + public MapValue properties() + { + MapValue m = properties; + if ( m == null ) + { + synchronized ( this ) + { + m = properties; + if ( m == null ) + { + m = properties = ValueUtils.asMapValue( node.getAllProperties() ); + } + } + } + return m; + } +} diff --git a/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/RelationshipProxyWrappingEdgeValue.java b/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/RelationshipProxyWrappingEdgeValue.java new file mode 100644 index 000000000000..1ba19a62b72c --- /dev/null +++ b/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/RelationshipProxyWrappingEdgeValue.java @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2002-2017 "Neo Technology," + * Network Engine for Objects in Lund AB [http://neotechnology.com] + * + * This file is part of Neo4j. + * + * Neo4j is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.neo4j.cypher.internal.javacompat; + +import org.neo4j.graphdb.NotFoundException; +import org.neo4j.graphdb.Relationship; +import org.neo4j.values.AnyValueWriter; +import org.neo4j.values.storable.TextValue; +import org.neo4j.values.storable.Values; +import org.neo4j.values.virtual.EdgeValue; +import org.neo4j.values.virtual.MapValue; +import org.neo4j.values.virtual.NodeValue; +import org.neo4j.values.virtual.VirtualValues; + +public class RelationshipProxyWrappingEdgeValue extends EdgeValue +{ + private final Relationship relationship; + private volatile TextValue type; + private volatile MapValue properties; + private volatile NodeValue startNode; + private volatile NodeValue endNode; + + RelationshipProxyWrappingEdgeValue( Relationship relationship ) + { + super( relationship.getId() ); + this.relationship = relationship; + } + + public Relationship relationshipProxy() + { + return relationship; + } + + @Override + public void writeTo( AnyValueWriter writer ) throws E + { + MapValue p; + try + { + p = properties(); + } + catch ( NotFoundException e ) + { + p = VirtualValues.EMPTY_MAP; + + } + writer.writeEdge( id(), startNode().id(), endNode().id(), type(), p ); + } + + @Override + public NodeValue startNode() + { + NodeValue start = startNode; + if ( start == null ) + { + synchronized ( this ) + { + start = startNode; + if ( start == null ) + { + start = startNode = ValueUtils.fromNodeProxy( relationship.getStartNode() ); + } + } + } + return start; + } + + @Override + public NodeValue endNode() + { + NodeValue end = endNode; + if ( end == null ) + { + synchronized ( this ) + { + end = endNode; + if ( end == null ) + { + end = endNode = ValueUtils.fromNodeProxy( relationship.getEndNode() ); + } + } + } + return end; + } + + @Override + public TextValue type() + { + TextValue t = type; + if ( t == null ) + { + synchronized ( this ) + { + t = type; + if ( t == null ) + { + t = type = Values.stringValue( relationship.getType().name() ); + } + } + } + return t; + } + + @Override + public MapValue properties() + { + MapValue m = properties; + if ( m == null ) + { + synchronized ( this ) + { + m = properties; + if ( m == null ) + { + m = properties = ValueUtils.asMapValue( relationship.getAllProperties() ); + } + } + } + return m; + } +} + diff --git a/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/ValueUtils.java b/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/ValueUtils.java new file mode 100644 index 000000000000..6296f337ced1 --- /dev/null +++ b/community/cypher/cypher/src/main/java/org/neo4j/cypher/internal/javacompat/ValueUtils.java @@ -0,0 +1,284 @@ +/* + * Copyright (c) 2002-2017 "Neo Technology," + * Network Engine for Objects in Lund AB [http://neotechnology.com] + * + * This file is part of Neo4j. + * + * Neo4j is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.neo4j.cypher.internal.javacompat; + +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +import org.neo4j.graphdb.Node; +import org.neo4j.graphdb.Path; +import org.neo4j.graphdb.PropertyContainer; +import org.neo4j.graphdb.Relationship; +import org.neo4j.graphdb.spatial.Geometry; +import org.neo4j.graphdb.spatial.Point; +import org.neo4j.helpers.collection.Iterables; +import org.neo4j.values.AnyValue; +import org.neo4j.values.storable.NumberValue; +import org.neo4j.values.storable.TextValue; +import org.neo4j.values.storable.Values; +import org.neo4j.values.virtual.CoordinateReferenceSystem; +import org.neo4j.values.virtual.EdgeValue; +import org.neo4j.values.virtual.ListValue; +import org.neo4j.values.virtual.MapValue; +import org.neo4j.values.virtual.NodeValue; +import org.neo4j.values.virtual.PathValue; +import org.neo4j.values.virtual.PointValue; +import org.neo4j.values.virtual.VirtualValues; + +import static java.util.stream.StreamSupport.stream; +import static org.neo4j.values.virtual.VirtualValues.list; +import static org.neo4j.values.virtual.VirtualValues.map; + +public final class ValueUtils +{ + private ValueUtils() + { + throw new UnsupportedOperationException( "do not instantiate" ); + } + + /** + * Creates an AnyValue by doing type inspection. Do not use in production code where performance is important. + * + * @param object the object to turned into a AnyValue + * @return the AnyValue corresponding to object. + */ + @SuppressWarnings( "unchecked" ) + public static AnyValue of( Object object ) + { + try + { + return Values.of( object ); + } + catch ( IllegalArgumentException e ) + { + if ( object instanceof Node ) + { + return fromNodeProxy( (Node) object ); + } + else if ( object instanceof Relationship ) + { + return fromRelationshipProxy( (Relationship) object ); + } + else if ( object instanceof Path ) + { + return asPathValue( (Path) object ); + } + else if ( object instanceof Map ) + { + return asMapValue( (Map) object ); + } + else if ( object instanceof Collection ) + { + return asListValue( (Collection) object ); + } + else if ( object instanceof Stream ) + { + return asListValue( ((Stream) object).collect( Collectors.toList() ) ); + } + else if ( object instanceof Point ) + { + return asPointValue( (Point) object ); + } + else if ( object instanceof Geometry ) + { + return asPointValue( (Geometry) object ); + } + else if ( object instanceof Object[] ) + { + Object[] array = (Object[]) object; + AnyValue[] anyValues = new AnyValue[array.length]; + for ( int i = 0; i < array.length; i++ ) + { + anyValues[i] = of( array[i] ); + } + return VirtualValues.list( anyValues ); + } + else + { + throw new IllegalArgumentException( + String.format( "Cannot convert %s to AnyValue", object.getClass().getName() ) ); + } + } + } + + public static PointValue asPointValue( Point point ) + { + return toPoint( point ); + } + + public static PointValue asPointValue( Geometry geometry ) + { + if ( !geometry.getGeometryType().equals( "Point" ) ) + { + throw new IllegalArgumentException( "Cannot handle geometry type: " + geometry.getCRS().getType() ); + } + return toPoint( geometry ); + } + + private static PointValue toPoint( Geometry geometry ) + { + List coordinate = geometry.getCoordinates().get( 0 ).getCoordinate(); + if ( geometry.getCRS().getCode() == CoordinateReferenceSystem.Cartesian.code ) + { + return VirtualValues.pointCartesian( coordinate.get( 0 ), coordinate.get( 1 ) ); + } + else if ( geometry.getCRS().getCode() == CoordinateReferenceSystem.WGS84.code ) + { + return VirtualValues.pointGeographic( coordinate.get( 0 ), coordinate.get( 1 ) ); + } + else + { + throw new IllegalArgumentException( "Unknown coordinate reference system " + geometry.getCRS() ); + } + } + + public static ListValue asListValue( Iterable collection ) + { + AnyValue[] anyValues = + Iterables.stream( collection ).map( ValueUtils::of ).toArray( AnyValue[]::new ); + return list( anyValues ); + } + + public static AnyValue asNodeOrEdgeValue( PropertyContainer container ) + { + if ( container instanceof Node ) + { + return fromNodeProxy( (Node) container ); + } + else if ( container instanceof Relationship ) + { + return fromRelationshipProxy( (Relationship) container ); + } + else + { + throw new IllegalArgumentException( + "Cannot produce a node or edge from " + container.getClass().getName() ); + } + } + + public static PathValue asPathValue( Path path ) + { + NodeValue[] nodes = stream( path.nodes().spliterator(), false ) + .map( ValueUtils::fromNodeProxy ).toArray( NodeValue[]::new ); + EdgeValue[] edges = stream( path.relationships().spliterator(), false ) + .map( ValueUtils::fromRelationshipProxy ).toArray( EdgeValue[]::new ); + + return VirtualValues.path( nodes, edges ); + } + + public static ListValue asListOfEdges( Iterable rels ) + { + return VirtualValues.list( StreamSupport.stream( rels.spliterator(), false ) + .map( ValueUtils::fromRelationshipProxy ).toArray( EdgeValue[]::new ) ); + } + + public static ListValue asListOfEdges( Relationship[] rels ) + { + EdgeValue[] edgeValues = new EdgeValue[rels.length]; + for ( int i = 0; i < edgeValues.length; i++ ) + { + edgeValues[i] = fromRelationshipProxy( rels[i] ); + } + return VirtualValues.list( edgeValues ); + } + + public static MapValue asMapValue( Map map ) + { + return map( mapValues( map ) ); + } + + public static PointValue fromMap( MapValue map ) + { + if ( map.containsKey( "x" ) && map.containsKey( "y" ) ) + { + double x = ((NumberValue) map.get( "x" )).doubleValue(); + double y = ((NumberValue) map.get( "y" )).doubleValue(); + if ( !map.containsKey( "crs" ) ) + { + return VirtualValues.pointCartesian( x, y ); + } + + TextValue crs = (TextValue) map.get( "crs" ); + if ( crs.stringValue().equals( CoordinateReferenceSystem.Cartesian.type() ) ) + { + return VirtualValues.pointCartesian( x, y ); + } + else if ( crs.stringValue().equals( CoordinateReferenceSystem.WGS84.type() ) ) + { + return VirtualValues.pointGeographic( x, y ); + } + else + { + throw new IllegalArgumentException( "Unknown coordinate reference system: " + crs.stringValue() ); + } + } + else if ( map.containsKey( "latitude" ) && map.containsKey( "longitude" ) ) + { + double latitude = ((NumberValue) map.get( "latitude" )).doubleValue(); + double longitude = ((NumberValue) map.get( "longitude" )).doubleValue(); + if ( !map.containsKey( "crs" ) ) + { + return VirtualValues.pointGeographic( longitude, latitude ); + } + + TextValue crs = (TextValue) map.get( "crs" ); + if ( crs.stringValue().equals( CoordinateReferenceSystem.WGS84.type() ) ) + { + return VirtualValues.pointGeographic( longitude, latitude ); + } + else + { + throw new IllegalArgumentException( + "Geographic points does not support coordinate reference system: " + crs.stringValue() ); + } + } + else + { + throw new IllegalArgumentException( + "A point must contain either 'x' and 'y' or 'latitude' and 'longitude'" ); + } + } + + private static Map mapValues( Map map ) + { + HashMap newMap = new HashMap<>( map.size() ); + for ( Map.Entry entry : map.entrySet() ) + { + newMap.put( entry.getKey(), of( entry.getValue() ) ); + } + + return newMap; + } + + public static NodeValue fromNodeProxy( Node node ) + { + return new NodeProxyWrappingNodeValue( node ); + } + + public static EdgeValue fromRelationshipProxy( Relationship relationship ) + { + return new RelationshipProxyWrappingEdgeValue( relationship ); + } +} diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v2_3/ExecutionResultWrapper.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v2_3/ExecutionResultWrapper.scala index 84a9c5046b02..20b104a9fd3a 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v2_3/ExecutionResultWrapper.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v2_3/ExecutionResultWrapper.scala @@ -32,18 +32,18 @@ import org.neo4j.cypher.internal.compiler.v2_3.planDescription.InternalPlanDescr import org.neo4j.cypher.internal.compiler.v2_3.planDescription.InternalPlanDescription.Arguments._ import org.neo4j.cypher.internal.compiler.v2_3.planDescription.{Argument, InternalPlanDescription} import org.neo4j.cypher.internal.compiler.v2_3.{PlannerName, _} -import org.neo4j.cypher.internal.frontend.v2_3 import org.neo4j.cypher.internal.frontend.v2_3.SemanticDirection.{BOTH, INCOMING, OUTGOING} import org.neo4j.cypher.internal.frontend.v2_3.notification.{InternalNotification, LegacyPlannerNotification, PlannerUnsupportedNotification, RuntimeUnsupportedNotification, _} import org.neo4j.cypher.internal.frontend.v2_3.{InputPosition => InternalInputPosition} -import org.neo4j.cypher.internal.frontend.v3_3 +import org.neo4j.cypher.internal.frontend.{v2_3, v3_3} +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.internal.{QueryStatistics, compatibility} import org.neo4j.graphdb.Result.ResultVisitor import org.neo4j.graphdb._ import org.neo4j.graphdb.impl.notification.{NotificationCode, NotificationDetail} +import org.neo4j.values.AnyValue import org.neo4j.values.result.QueryResult import org.neo4j.values.result.QueryResult.Record -import org.neo4j.values.{AnyValue, AnyValues} import scala.collection.JavaConverters._ @@ -206,7 +206,7 @@ class ExecutionResultWrapper(val inner: InternalExecutionResult, val planner: Pl override def accept[E <: Exception](visitor: QueryResult.QueryResultVisitor[E]): Unit = inner.accept(new ResultVisitor[E] { override def visit(row: Result.ResultRow): Boolean = visitor.visit(new Record { - override def fields(): Array[AnyValue] = fieldNames().map(k => AnyValues.of(row.get(k))) + override def fields(): Array[AnyValue] = fieldNames().map(k => ValueUtils.of(row.get(k))) }) }) } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_1/ExecutionResultWrapper.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_1/ExecutionResultWrapper.scala index f926df73b13a..462c69b3e25e 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_1/ExecutionResultWrapper.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_1/ExecutionResultWrapper.scala @@ -37,13 +37,14 @@ import org.neo4j.cypher.internal.compiler.v3_1.{PlannerName, ExplainMode => Expl import org.neo4j.cypher.internal.frontend.v3_1.SemanticDirection.{BOTH, INCOMING, OUTGOING} import org.neo4j.cypher.internal.frontend.v3_1.notification.{DeprecatedPlannerNotification, InternalNotification, PlannerUnsupportedNotification, RuntimeUnsupportedNotification, _} import org.neo4j.cypher.internal.frontend.v3_3 +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb import org.neo4j.graphdb.Result.{ResultRow, ResultVisitor} import org.neo4j.graphdb.impl.notification.{NotificationCode, NotificationDetail} import org.neo4j.graphdb.{InputPosition, Notification, ResourceIterator} +import org.neo4j.values.AnyValue import org.neo4j.values.result.QueryResult import org.neo4j.values.result.QueryResult.Record -import org.neo4j.values.{AnyValue, AnyValues} import scala.collection.JavaConverters._ @@ -162,7 +163,7 @@ class ExecutionResultWrapper(val inner: InternalExecutionResult, val planner: Pl override def accept[E <: Exception](visitor: QueryResult.QueryResultVisitor[E]): Unit = inner.accept(new InternalResultVisitor[E] { override def visit(internalResultRow: InternalResultRow): Boolean = visitor.visit(new Record { - override def fields(): Array[AnyValue] = fieldNames().map(k => AnyValues.of(internalResultRow.get(k))) + override def fields(): Array[AnyValue] = fieldNames().map(k => ValueUtils.of(internalResultRow.get(k))) }) }) } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_2/ExecutionResultWrapper.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_2/ExecutionResultWrapper.scala index 9db41dd85647..dffdb2eb9c7a 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_2/ExecutionResultWrapper.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_2/ExecutionResultWrapper.scala @@ -38,13 +38,14 @@ import org.neo4j.cypher.internal.frontend.v3_2.PlannerName import org.neo4j.cypher.internal.frontend.v3_2.SemanticDirection.{BOTH, INCOMING, OUTGOING} import org.neo4j.cypher.internal.frontend.v3_2.notification.{DeprecatedPlannerNotification, InternalNotification, PlannerUnsupportedNotification, RuntimeUnsupportedNotification, _} import org.neo4j.cypher.internal.frontend.v3_3 +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb import org.neo4j.graphdb.Result.{ResultRow, ResultVisitor} import org.neo4j.graphdb.impl.notification.{NotificationCode, NotificationDetail} import org.neo4j.graphdb.{Notification, ResourceIterator} +import org.neo4j.values.AnyValue import org.neo4j.values.result.QueryResult import org.neo4j.values.result.QueryResult.Record -import org.neo4j.values.{AnyValue, AnyValues} import scala.collection.JavaConverters._ @@ -238,7 +239,7 @@ class ExecutionResultWrapper(val inner: InternalExecutionResult, val planner: Pl override def accept[E <: Exception](visitor: QueryResult.QueryResultVisitor[E]): Unit = inner.accept(new InternalResultVisitor[E] { override def visit(row: InternalResultRow): Boolean = visitor.visit(new Record { - override def fields(): Array[AnyValue] = fieldNames().map(k => AnyValues.of(row.get(k))) + override def fields(): Array[AnyValue] = fieldNames().map(k => ValueUtils.of(row.get(k))) }) }) } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/PointFunction.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/PointFunction.scala index 490b985177a5..1728360b9b8e 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/PointFunction.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/PointFunction.scala @@ -25,16 +25,17 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.IsMap import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.QueryState import org.neo4j.cypher.internal.frontend.v3_3.CypherTypeException +import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import org.neo4j.values.virtual.MapValue -import org.neo4j.values.{AnyValue, AnyValues} case class PointFunction(data: Expression) extends NullInNullOutExpression(data) { override def compute(value: AnyValue, ctx: ExecutionContext)(implicit state: QueryState): AnyValue = value match { case IsMap(mapCreator) => val map = mapCreator(state.query) if (containsNull(map)) Values.NO_VALUE - else AnyValues.fromMap(map) + else ValueUtils.fromMap(map) case x => throw new CypherTypeException(s"Expected a map but got $x") } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/ShortestPathExpression.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/ShortestPathExpression.scala index 86bedcdeba74..c85021ce109f 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/ShortestPathExpression.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/ShortestPathExpression.scala @@ -26,10 +26,11 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.Relationship import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.QueryState import org.neo4j.cypher.internal.frontend.v3_3.helpers.NonEmptyList import org.neo4j.cypher.internal.frontend.v3_3.{ShortestPathCommonEndNodesForbiddenException, SyntaxException} +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb.{Path, PropertyContainer} +import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import org.neo4j.values.virtual.{NodeValue, VirtualValues} -import org.neo4j.values.{AnyValue, AnyValues} import scala.collection.JavaConverters._ import scala.collection.Map @@ -67,13 +68,13 @@ case class ShortestPathExpression(shortestPathPattern: ShortestPath, predicates: shortestPathPredicate, nodePredicates) if (!shortestPathPattern.allowZeroLength && result.forall(p => p.length() == 0)) Values.NO_VALUE - else result.map(AnyValues.asPathValue).getOrElse(Values.NO_VALUE) + else result.map(ValueUtils.asPathValue).getOrElse(Values.NO_VALUE) } else { val result = state.query .allShortestPath(start.id(), end.id(), shortestPathPattern.maxDepth.getOrElse(Int.MaxValue), expander, shortestPathPredicate, nodePredicates) - .filter { p => shortestPathPattern.allowZeroLength || p.length() > 0 }.map(AnyValues.asPathValue).toArray + .filter { p => shortestPathPattern.allowZeroLength || p.length() > 0 }.map(ValueUtils.asPathValue).toArray VirtualValues.list(result:_*) } } @@ -83,8 +84,8 @@ case class ShortestPathExpression(shortestPathPattern: ShortestPath, predicates: new KernelPredicate[Path] { override def test(path: Path): Boolean = maybePredicate.forall { predicate => - incomingCtx += shortestPathPattern.pathName -> AnyValues.asPathValue(path) - incomingCtx += shortestPathPattern.relIterator.get -> AnyValues.asListOfEdges(path.relationships()) + incomingCtx += shortestPathPattern.pathName -> ValueUtils.asPathValue(path) + incomingCtx += shortestPathPattern.relIterator.get -> ValueUtils.asListOfEdges(path.relationships()) predicate.isTrue(incomingCtx) } && (!withFallBack || RelationshipSupport.areRelationshipsUnique(path.relationships.asScala.toList)) } @@ -121,14 +122,14 @@ case class ShortestPathExpression(shortestPathPattern: ShortestPath, predicates: private def cypherPositivePredicatesAsExpander(incomingCtx: ExecutionContext, name: String, predicate: Predicate) (implicit state: QueryState) = new KernelPredicate[PropertyContainer] { override def test(t: PropertyContainer): Boolean = { - predicate.isTrue(incomingCtx += (name -> AnyValues.asNodeOrEdgeValue(t))) + predicate.isTrue(incomingCtx += (name -> ValueUtils.asNodeOrEdgeValue(t))) } } private def cypherNegativePredicatesAsExpander(incomingCtx: ExecutionContext, name: String, predicate: Predicate) (implicit state: QueryState) = new KernelPredicate[PropertyContainer] { override def test(t: PropertyContainer): Boolean = { - !predicate.isTrue(incomingCtx += (name -> AnyValues.asNodeOrEdgeValue(t))) + !predicate.isTrue(incomingCtx += (name -> ValueUtils.asNodeOrEdgeValue(t))) } } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/procs/ProcedureExecutionResult.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/procs/ProcedureExecutionResult.scala index ea28b71319a9..9763a1201db4 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/procs/ProcedureExecutionResult.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/executionplan/procs/ProcedureExecutionResult.scala @@ -28,16 +28,16 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Inte import org.neo4j.cypher.internal.compiler.v3_3.spi.QualifiedName import org.neo4j.cypher.internal.frontend.v3_3.ProfilerStatisticsNotReadyException import org.neo4j.cypher.internal.frontend.v3_3.symbols.{CypherType, _} +import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.cypher.internal.javacompat.ValueUtils.{fromNodeProxy, fromRelationshipProxy, _} import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.cypher.internal.{InternalExecutionResult, QueryStatistics} import org.neo4j.graphdb.Notification import org.neo4j.graphdb.spatial.{Geometry, Point} -import org.neo4j.values.AnyValues._ +import org.neo4j.values.AnyValue import org.neo4j.values.result.QueryResult.{QueryResultVisitor, Record} import org.neo4j.values.storable.Values import org.neo4j.values.storable.Values.{of => _, _} -import org.neo4j.values.virtual.VirtualValues.{fromNodeProxy, fromRelationshipProxy} -import org.neo4j.values.{AnyValue, AnyValues} /** * Execution result of a Procedure @@ -110,7 +110,7 @@ class ProcedureExecutionResult[E <: Exception](context: QueryContext, case CTGeometry => transform(res(pos), (g: Geometry) => asPointValue(g)) case CTMap => transform(res(pos), asMapValue) case ListType(_) => transform(res(pos), asListValue) - case CTAny => transform(res(pos), AnyValues.of) + case CTAny => transform(res(pos), ValueUtils.of) } i += 1 } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/helpers/ValueConversion.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/helpers/ValueConversion.scala index 7d64c76b9c05..3c9da844acf6 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/helpers/ValueConversion.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/helpers/ValueConversion.scala @@ -22,31 +22,32 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers import org.neo4j.cypher.internal.frontend.v3_3.helpers.Eagerly import org.neo4j.cypher.internal.frontend.v3_3.symbols import org.neo4j.cypher.internal.frontend.v3_3.symbols.CypherType +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb.spatial.{Geometry, Point} import org.neo4j.graphdb.{Node, Path, Relationship} +import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import org.neo4j.values.storable.Values.byteArray import org.neo4j.values.virtual.VirtualValues.fromArray import org.neo4j.values.virtual.{MapValue, VirtualValues} -import org.neo4j.values.{AnyValue, AnyValues} import scala.collection.JavaConverters._ object ValueConversion { def getValueConverter(cType: CypherType): Any => AnyValue = cType match { - case symbols.CTNode => n => AnyValues.asNodeValue(n.asInstanceOf[Node]) - case symbols.CTRelationship => r => AnyValues.asEdgeValue(r.asInstanceOf[Relationship]) + case symbols.CTNode => n => ValueUtils.fromNodeProxy(n.asInstanceOf[Node]) + case symbols.CTRelationship => r => ValueUtils.fromRelationshipProxy(r.asInstanceOf[Relationship]) case symbols.CTBoolean => b => Values.booleanValue(b.asInstanceOf[Boolean]) case symbols.CTFloat => d => Values.doubleValue(d.asInstanceOf[Double]) case symbols.CTInteger => l => Values.longValue(l.asInstanceOf[Long]) case symbols.CTNumber => l => Values.numberValue(l.asInstanceOf[Number]) case symbols.CTString => l => Values.stringValue(l.asInstanceOf[String]) - case symbols.CTPath => p => AnyValues.asPathValue(p.asInstanceOf[Path]) - case symbols.CTMap => m => AnyValues.asMapValue(m.asInstanceOf[java.util.Map[String, AnyRef]]) - case symbols.ListType(_) => l => AnyValues.asListValue(l.asInstanceOf[java.util.Collection[_]]) - case symbols.CTAny => o => AnyValues.of(o) - case symbols.CTPoint => o => AnyValues.asPointValue(o.asInstanceOf[Point]) - case symbols.CTGeometry => o => AnyValues.asPointValue(o.asInstanceOf[Geometry]) + case symbols.CTPath => p => ValueUtils.asPathValue(p.asInstanceOf[Path]) + case symbols.CTMap => m => ValueUtils.asMapValue(m.asInstanceOf[java.util.Map[String, AnyRef]]) + case symbols.ListType(_) => l => ValueUtils.asListValue(l.asInstanceOf[java.util.Collection[_]]) + case symbols.CTAny => o => ValueUtils.of(o) + case symbols.CTPoint => o => ValueUtils.asPointValue(o.asInstanceOf[Point]) + case symbols.CTGeometry => o => ValueUtils.asPointValue(o.asInstanceOf[Geometry]) } def asValues(params: Map[String, Any]): MapValue = VirtualValues.map(Eagerly.immutableMapValues(params, asValue).asJava) @@ -58,15 +59,15 @@ object ValueConversion { case f: Float => Values.doubleValue(f) case n: Number => Values.longValue(n.longValue()) case b: Boolean => Values.booleanValue(b) - case n: Node => VirtualValues.fromNodeProxy(n) - case r: Relationship => VirtualValues.fromRelationshipProxy(r) - case p: Path => AnyValues.asPathValue(p) - case p: Point => AnyValues.asPointValue(p) - case p: Geometry => AnyValues.asPointValue(p) + case n: Node => ValueUtils.fromNodeProxy(n) + case r: Relationship => ValueUtils.fromRelationshipProxy(r) + case p: Path => ValueUtils.asPathValue(p) + case p: Point => ValueUtils.asPointValue(p) + case p: Geometry => ValueUtils.asPointValue(p) case m: Map[_, _] => VirtualValues.map(Eagerly.immutableMapValues(m.asInstanceOf[Map[String, Any]], asValue).asJava) - case m: java.util.Map[_, _] => AnyValues.asMapValue(m.asInstanceOf[java.util.Map[String, AnyRef]]) + case m: java.util.Map[_, _] => ValueUtils.asMapValue(m.asInstanceOf[java.util.Map[String, AnyRef]]) case a: TraversableOnce[_] => VirtualValues.list(a.map(asValue).toArray:_*) - case c: java.util.Collection[_] => AnyValues.asListValue(c) + case c: java.util.Collection[_] => ValueUtils.asListValue(c) case a: Array[_] => a.getClass.getComponentType.getName match { case "byte" => fromArray(byteArray(a.asInstanceOf[Array[Byte]])) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/AllNodesScanPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/AllNodesScanPipe.scala index ac1d48402c2c..cefc6d2e9de7 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/AllNodesScanPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/AllNodesScanPipe.scala @@ -21,13 +21,13 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id -import org.neo4j.values.AnyValues +import org.neo4j.cypher.internal.javacompat.ValueUtils case class AllNodesScanPipe(ident: String)(val id: Id = new Id) extends Pipe { protected def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = { val baseContext = state.createOrGetInitialContext() - state.query.nodeOps.all.map(n => baseContext.newWith1(ident, AnyValues.asNodeValue(n))) + state.query.nodeOps.all.map(n => baseContext.newWith1(ident, ValueUtils.fromNodeProxy(n))) } } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CachingExpandInto.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CachingExpandInto.scala index eedbb34bcd29..4364d65d9faf 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CachingExpandInto.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CachingExpandInto.scala @@ -21,11 +21,12 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.helpers.collection.PrefetchingIterator import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values.NO_VALUE -import org.neo4j.values.virtual.{EdgeValue, NodeValue, VirtualValues} +import org.neo4j.values.virtual.{EdgeValue, NodeValue} import scala.collection.JavaConverters._ import scala.collection.mutable @@ -88,7 +89,7 @@ trait CachingExpandInto { private def relIterator(query: QueryContext, fromNode: NodeValue, toNode: NodeValue, preserveDirection: Boolean, relTypes: Option[Seq[Int]], relCache: RelationshipsCache, dir: SemanticDirection) = { val (start, localDirection, end) = if(preserveDirection) (fromNode, dir, toNode) else (toNode, dir.reversed, fromNode) - val relationships = query.getRelationshipsForIds(start.id(), localDirection, relTypes).map(VirtualValues.fromRelationshipProxy) + val relationships = query.getRelationshipsForIds(start.id(), localDirection, relTypes).map(ValueUtils.fromRelationshipProxy) new PrefetchingIterator[EdgeValue] { //we do not expect two nodes to have many connecting relationships val connectedRelationships = new ArrayBuffer[EdgeValue](2) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateNodePipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateNodePipe.scala index 279959cdff4c..8870cffc5d60 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateNodePipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateNodePipe.scala @@ -27,10 +27,11 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.IsMap import org.neo4j.cypher.internal.compatibility.v3_3.runtime.mutation.{GraphElementPropertyFunctions, makeValueNeoSafe} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.{CypherTypeException, InvalidSemanticsException} +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values -import org.neo4j.values.virtual.{EdgeValue, NodeValue, VirtualValues} +import org.neo4j.values.virtual.{EdgeValue, NodeValue} abstract class BaseCreateNodePipe(src: Pipe, key: String, labels: Seq[LazyLabel], properties: Option[Expression]) extends PipeWithSource(src) with GraphElementPropertyFunctions { @@ -42,7 +43,7 @@ abstract class BaseCreateNodePipe(src: Pipe, key: String, labels: Seq[LazyLabel] val node = state.query.createNode() setProperties(context, state, node.getId) setLabels(context, state, node.getId) - context += key -> VirtualValues.fromNodeProxy(node) + context += key -> ValueUtils.fromNodeProxy(node) } private def setProperties(context: ExecutionContext, state: QueryState, nodeId: Long) = { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateRelationshipPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateRelationshipPipe.scala index 0bae29e4af4c..7eb6aa6d6d8f 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateRelationshipPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/CreateRelationshipPipe.scala @@ -27,10 +27,11 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.helpers.IsMap import org.neo4j.cypher.internal.compatibility.v3_3.runtime.mutation.{GraphElementPropertyFunctions, makeValueNeoSafe} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.{CypherTypeException, InternalException, InvalidSemanticsException} +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.internal.spi.v3_3.QueryContext +import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import org.neo4j.values.virtual.{EdgeValue, NodeValue} -import org.neo4j.values.{AnyValue, AnyValues} abstract class BaseRelationshipPipe(src: Pipe, key: String, startNode: String, typ: LazyType, endNode: String, properties: Option[Expression]) @@ -46,7 +47,7 @@ abstract class BaseRelationshipPipe(src: Pipe, key: String, startNode: String, t val relationship = state.query.createRelationship(start.id(), end.id(), typeId) relationship.getType // we do this to make sure the relationship is loaded from the store into this object setProperties(context, state, relationship.getId) - context += key -> AnyValues.asEdgeValue(relationship) + context += key -> ValueUtils.fromRelationshipProxy(relationship) } private def getNode(row: ExecutionContext, name: String): NodeValue = diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipe.scala index 9a328e0080ce..e00409fd9e00 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipe.scala @@ -22,11 +22,11 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} +import org.neo4j.cypher.internal.javacompat.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.graphdb.Relationship import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values import org.neo4j.values.virtual.NodeValue -import org.neo4j.values.virtual.VirtualValues.{fromNodeProxy, fromRelationshipProxy} case class ExpandAllPipe(source: Pipe, fromName: String, diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FullPruningVarLengthExpandPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FullPruningVarLengthExpandPipe.scala index 63292de7b076..02f221b80a0b 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FullPruningVarLengthExpandPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FullPruningVarLengthExpandPipe.scala @@ -23,7 +23,7 @@ import org.neo4j.collection.primitive.{Primitive, PrimitiveLongObjectMap} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} -import org.neo4j.values.AnyValues +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.values.virtual.{EdgeValue, NodeValue} case class FullPruningVarLengthExpandPipe(source: Pipe, @@ -245,7 +245,7 @@ case class FullPruningVarLengthExpandPipe(source: Pipe, */ def ensureExpanded(queryState: QueryState, row: ExecutionContext, node: NodeValue) = { if ( rels == null ) { - val allRels = queryState.query.getRelationshipsForIds(node.id(), dir, types.types(queryState.query)).map(AnyValues.asEdgeValue) + val allRels = queryState.query.getRelationshipsForIds(node.id(), dir, types.types(queryState.query)).map(ValueUtils.fromRelationshipProxy) rels = allRels.filter(r => { filteringStep.filterRelationship(row, queryState)(r) && filteringStep.filterNode(row, queryState)(r.otherNode(node)) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/IdSeekIterator.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/IdSeekIterator.scala index becf3761dbfb..59513d94dbc5 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/IdSeekIterator.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/IdSeekIterator.scala @@ -21,9 +21,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.NumericHelper +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.internal.spi.v3_3.Operations import org.neo4j.graphdb.{Node, PropertyContainer, Relationship} -import org.neo4j.values.{AnyValue, AnyValues} +import org.neo4j.values.AnyValue abstract class IdSeekIterator[T <: PropertyContainer] extends Iterator[ExecutionContext] with NumericHelper { @@ -68,7 +69,7 @@ final class NodeIdSeekIterator(ident: String, def next(): ExecutionContext = baseContext.newWith1(ident, asAnyValue(nextEntity())) - override protected def asAnyValue(entity: Node): AnyValue = AnyValues.asNodeValue(entity) + override protected def asAnyValue(entity: Node): AnyValue = ValueUtils.fromNodeProxy(entity) } final class DirectedRelationshipIdSeekIterator(ident: String, @@ -83,11 +84,11 @@ final class DirectedRelationshipIdSeekIterator(ident: String, def next(): ExecutionContext = { val rel = nextEntity() - baseContext.newWith3(ident, AnyValues.asEdgeValue(rel), fromNode, AnyValues.asNodeValue(rel.getStartNode), toNode, - AnyValues.asNodeValue(rel.getEndNode)) + baseContext.newWith3(ident, ValueUtils.fromRelationshipProxy(rel), fromNode, ValueUtils.fromNodeProxy(rel.getStartNode), toNode, + ValueUtils.fromNodeProxy(rel.getEndNode)) } - override protected def asAnyValue(entity: Relationship): AnyValue = AnyValues.asEdgeValue(entity) + override protected def asAnyValue(entity: Relationship): AnyValue = ValueUtils.fromRelationshipProxy(entity) } final class UndirectedRelationshipIdSeekIterator(ident: String, @@ -108,16 +109,16 @@ final class UndirectedRelationshipIdSeekIterator(ident: String, def next(): ExecutionContext = { if (emitSibling) { emitSibling = false - baseContext.newWith3(ident, AnyValues.asEdgeValue(lastEntity), fromNode, AnyValues.asNodeValue(lastEnd), - toNode, AnyValues.asNodeValue(lastStart)) + baseContext.newWith3(ident, ValueUtils.fromRelationshipProxy(lastEntity), fromNode, ValueUtils.fromNodeProxy(lastEnd), + toNode, ValueUtils.fromNodeProxy(lastStart)) } else { emitSibling = true lastEntity = nextEntity() lastStart = lastEntity.getStartNode lastEnd = lastEntity.getEndNode - baseContext.newWith3(ident, AnyValues.asEdgeValue(lastEntity), fromNode, AnyValues.asNodeValue(lastStart), toNode, - AnyValues.asNodeValue(lastEnd)) + baseContext.newWith3(ident, ValueUtils.fromRelationshipProxy(lastEntity), fromNode, ValueUtils.fromNodeProxy(lastStart), toNode, + ValueUtils.fromNodeProxy(lastEnd)) } } - override protected def asAnyValue(entity: Relationship): AnyValue = AnyValues.asEdgeValue(entity) + override protected def asAnyValue(entity: Relationship): AnyValue = ValueUtils.fromRelationshipProxy(entity) } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipe.scala index c2e8b05a05a3..b7436c21721e 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipe.scala @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id -import org.neo4j.values.AnyValues +import org.neo4j.cypher.internal.javacompat.ValueUtils case class NodeByLabelScanPipe(ident: String, label: LazyLabel) (val id: Id = new Id) extends Pipe { @@ -32,7 +32,7 @@ case class NodeByLabelScanPipe(ident: String, label: LazyLabel) case Some(labelId) => val nodes = state.query.getNodesByLabel(labelId.id) val baseContext = state.createOrGetInitialContext() - nodes.map(n => baseContext.newWith1(ident, AnyValues.asNodeValue(n))) + nodes.map(n => baseContext.newWith1(ident, ValueUtils.fromNodeProxy(n))) case None => Iterator.empty } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexContainsScanPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexContainsScanPipe.scala index f8f2dd2f4f42..b4e49267a417 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexContainsScanPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexContainsScanPipe.scala @@ -25,8 +25,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compiler.v3_3._ import org.neo4j.cypher.internal.frontend.v3_3.CypherTypeException import org.neo4j.cypher.internal.frontend.v3_3.ast.{LabelToken, PropertyKeyToken} +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb.Node -import org.neo4j.values.AnyValues import org.neo4j.values.storable.{TextValue, Values} abstract class AbstractNodeIndexStringScanPipe(ident: String, @@ -45,7 +45,7 @@ abstract class AbstractNodeIndexStringScanPipe(ident: String, val resultNodes = value match { case value: TextValue => queryContextCall(state, descriptor, value.stringValue()). - map(node => baseContext.newWith1(ident, AnyValues.asNodeValue(node))) + map(node => baseContext.newWith1(ident, ValueUtils.fromNodeProxy(node))) case Values.NO_VALUE => Iterator.empty case x => throw new CypherTypeException(s"Expected a string value, but got $x") diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipe.scala index 31f1e43e742a..c954cec90692 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipe.scala @@ -20,10 +20,10 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext -import org.neo4j.cypher.internal.compiler.v3_3._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id +import org.neo4j.cypher.internal.compiler.v3_3._ import org.neo4j.cypher.internal.frontend.v3_3.ast.{LabelToken, PropertyKeyToken} -import org.neo4j.values.AnyValues +import org.neo4j.cypher.internal.javacompat.ValueUtils case class NodeIndexScanPipe(ident: String, label: LabelToken, @@ -35,7 +35,7 @@ case class NodeIndexScanPipe(ident: String, protected def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = { val baseContext = state.createOrGetInitialContext() val resultNodes = state.query.indexScan(descriptor) - resultNodes.map(node => baseContext.newWith1(ident, AnyValues.asNodeValue(node))) + resultNodes.map(node => baseContext.newWith1(ident, ValueUtils.fromNodeProxy(node))) } } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipe.scala index 942f13a6b4da..0cc62703882f 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipe.scala @@ -26,7 +26,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compiler.v3_3._ import org.neo4j.cypher.internal.compiler.v3_3.planner.logical.plans.QueryExpression import org.neo4j.cypher.internal.frontend.v3_3.ast.{LabelToken, PropertyKeyToken} -import org.neo4j.values.virtual.VirtualValues.fromNodeProxy +import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy case class NodeIndexSeekPipe(ident: String, label: LabelToken, diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipe.scala index 951a5679063d..cb3ed6190f00 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipe.scala @@ -23,9 +23,10 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.Predicate import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} +import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values -import org.neo4j.values.virtual.{NodeValue, VirtualValues} -import org.neo4j.values.{AnyValue, AnyValues} +import org.neo4j.values.virtual.NodeValue case class OptionalExpandAllPipe(source: Pipe, fromName: String, relName: String, toName: String, dir: SemanticDirection, types: LazyTypes, predicate: Predicate) @@ -45,7 +46,7 @@ case class OptionalExpandAllPipe(source: Pipe, fromName: String, relName: String val relationships = state.query.getRelationshipsForIds(n.id(), dir, types.types(state.query)) val matchIterator = relationships.map { r => val other = if (n.id() == r.getStartNodeId) r.getEndNode else r.getStartNode - row.newWith2(relName, AnyValues.asEdgeValue(r), toName, VirtualValues.fromNodeProxy(other)) + row.newWith2(relName, ValueUtils.fromRelationshipProxy(r), toName, ValueUtils.fromNodeProxy(other)) }.filter(ctx => predicate.isTrue(ctx)) if (matchIterator.isEmpty) { diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PruningVarLengthExpandPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PruningVarLengthExpandPipe.scala index d320ac234286..51dc6db3d508 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PruningVarLengthExpandPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PruningVarLengthExpandPipe.scala @@ -23,7 +23,7 @@ import org.neo4j.collection.primitive.{Primitive, PrimitiveLongObjectMap} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} -import org.neo4j.values.AnyValues +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.values.virtual.{EdgeValue, NodeValue} case class PruningVarLengthExpandPipe(source: Pipe, @@ -297,7 +297,7 @@ case class PruningVarLengthExpandPipe(source: Pipe, * List all relationships of a node, given the predicates of this pipe. */ def expand(row: ExecutionContext, node: NodeValue) = { - val relationships = state.query.getRelationshipsForIds(node.id(), dir, types.types(state.query)).map(AnyValues.asEdgeValue) + val relationships = state.query.getRelationshipsForIds(node.id(), dir, types.types(state.query)).map(ValueUtils.fromRelationshipProxy) relationships.filter(r => { filteringStep.filterRelationship(row, state)(r) && filteringStep.filterNode(row, state)(r.otherNode(node)) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/StartPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/StartPipe.scala index 223a8c5570fa..053815f89b99 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/StartPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/StartPipe.scala @@ -23,8 +23,9 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan.{Effects, ReadsAllNodes} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.symbols._ +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb.{Node, PropertyContainer, Relationship} -import org.neo4j.values.{AnyValue, AnyValues} +import org.neo4j.values.AnyValue sealed abstract class StartPipe[T <: PropertyContainer](source: Pipe, name: String, @@ -50,13 +51,13 @@ case class NodeStartPipe(source: Pipe, extends StartPipe[Node](source, name, createSource) { def variableType = CTNode - override def asAnyValue(in: Node): AnyValue = AnyValues.asNodeValue(in) + override def asAnyValue(in: Node): AnyValue = ValueUtils.fromNodeProxy(in) } case class RelationshipStartPipe(source: Pipe, name: String, createSource: EntityProducer[Relationship]) (val id: Id = new Id) extends StartPipe[Relationship](source, name, createSource) { def variableType = CTRelationship - override def asAnyValue(in: Relationship): AnyValue = AnyValues.asEdgeValue(in) + override def asAnyValue(in: Relationship): AnyValue = ValueUtils.fromRelationshipProxy(in) } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/VarLengthExpandPipe.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/VarLengthExpandPipe.scala index f1e5e35e3ce6..0635b90d3216 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/VarLengthExpandPipe.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/VarLengthExpandPipe.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} -import org.neo4j.values.AnyValues +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.values.storable.Values import org.neo4j.values.virtual.{EdgeValue, NodeValue, VirtualValues} @@ -63,7 +63,8 @@ case class VarLengthExpandPipe(source: Pipe, def next(): (NodeValue, Seq[EdgeValue]) = { val (node, rels) = stack.pop() if (rels.length < maxDepth.getOrElse(Int.MaxValue) && filteringStep.filterNode(row,state)(node)) { - val relationships: Iterator[EdgeValue] = state.query.getRelationshipsForIds(node.id(), dir, types.types(state.query)).map(AnyValues.asEdgeValue) + val relationships: Iterator[EdgeValue] = state.query.getRelationshipsForIds(node.id(), dir, + types.types(state.query)).map(ValueUtils.fromRelationshipProxy) relationships.filter(filteringStep.filterRelationship(row, state)).foreach { rel => val otherNode = rel.otherNode(node) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/matching/PatternRelationship.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/matching/PatternRelationship.scala index 661ac126379f..bb6d52449897 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/matching/PatternRelationship.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/matching/PatternRelationship.scala @@ -26,8 +26,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{LazyTypes, Qu import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection.{BOTH, INCOMING, OUTGOING} import org.neo4j.cypher.internal.frontend.v3_3.symbols._ -import org.neo4j.graphdb.{Node, Path, Relationship} -import org.neo4j.values.AnyValues +import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.graphdb.Path import org.neo4j.values.virtual.{EdgeValue, NodeValue} import scala.collection.JavaConverters._ @@ -50,7 +50,7 @@ class PatternRelationship(key: String, val result: Iterator[GraphRelationship] = state.query. getRelationshipsForIds(realNode.id(), getDirection(node), types.types(state.query)) - .map(AnyValues.asEdgeValue) + .map(ValueUtils.fromRelationshipProxy) .filter(r => canUseThis(r, state, f)). map(new SingleGraphRelationship(_)) @@ -147,11 +147,11 @@ class VariableLengthPatternRelationship(pathName: String, matchedPaths } else { matchedPaths.filter { - path => path.relationships().iterator().asScala.forall(r => canUseThis(AnyValues.asEdgeValue(r), state, f)) + path => path.relationships().iterator().asScala.forall(r => canUseThis(ValueUtils.fromRelationshipProxy(r), state, f)) } } - filteredPaths.toStream.map(p => VariableLengthGraphRelationship(AnyValues.asPathValue(p))) + filteredPaths.toStream.map(p => VariableLengthGraphRelationship(ValueUtils.asPathValue(p))) } } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundQueryContext.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundQueryContext.scala index 2a2dd3e1b783..142c48ff64a4 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundQueryContext.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundQueryContext.scala @@ -35,7 +35,7 @@ import org.neo4j.cypher.internal.compiler.v3_3.MinMaxOrdering._ import org.neo4j.cypher.internal.compiler.v3_3.spi.QualifiedName import org.neo4j.cypher.internal.compiler.v3_3.{IndexDescriptor, _} import org.neo4j.cypher.internal.frontend.v3_3._ -import org.neo4j.cypher.internal.javacompat.ValueToObjectSerializer +import org.neo4j.cypher.internal.javacompat.{NodeProxyWrappingNodeValue, RelationshipProxyWrappingEdgeValue, ValueToObjectSerializer} import org.neo4j.cypher.internal.spi.BeansAPIRelationshipIterator import org.neo4j.cypher.internal.spi.v3_3.TransactionBoundQueryContext.IndexSearchMonitor import org.neo4j.cypher.javacompat.internal.GraphDatabaseCypherService @@ -62,8 +62,6 @@ import org.neo4j.kernel.impl.locking.ResourceTypes import org.neo4j.values.AnyValue import org.neo4j.values.storable.{Value, Values} import org.neo4j.values.virtual.EdgeValue -import org.neo4j.values.virtual.EdgeValue.RelationshipProxyWrappingEdgeValue -import org.neo4j.values.virtual.NodeValue.NodeProxyWrappingNodeValue import scala.collection.Iterator import scala.collection.JavaConverters._ diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/MatchingContextTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/MatchingContextTest.scala index d9b14438a8fd..a0e64743aefc 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/MatchingContextTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/MatchingContextTest.scala @@ -21,6 +21,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3 import org.neo4j.cypher.GraphDatabaseFunSuite import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext +import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ImplicitValueConversion._ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{Literal, Property, Variable} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.{Equals, Predicate} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.values.TokenType.PropertyKey @@ -31,8 +32,9 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.symbols.SymbolTable import org.neo4j.cypher.internal.compiler.v3_3.QueryStateTestSupport import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.symbols._ -import org.neo4j.values.{AnyValue, AnyValues} -import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ImplicitValueConversion._ +import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.values.AnyValue + import scala.collection.Map class MatchingContextTest extends GraphDatabaseFunSuite with PatternGraphBuilder with QueryStateTestSupport { @@ -442,7 +444,7 @@ class MatchingContextTest extends GraphDatabaseFunSuite with PatternGraphBuilder private var matchingContext: MatchingContext = null private def getMatches(params: (String, Any)*) = withQueryState { queryState => - val ctx = ExecutionContext().newWith(params.map(p => (p._1, AnyValues.of(p._2)))) + val ctx = ExecutionContext().newWith(params.map(p => (p._1, ValueUtils.of(p._2)))) matchingContext.getMatches(ctx, queryState).toList } diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/ImplicitValueConversion.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/ImplicitValueConversion.scala index 8cb33660591d..db17341dc321 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/ImplicitValueConversion.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/ImplicitValueConversion.scala @@ -20,20 +20,21 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.PathImpl +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb.{Node, Path, Relationship} import org.neo4j.values._ +import org.neo4j.values.storable.Values._ import org.neo4j.values.storable._ import org.neo4j.values.virtual.VirtualValues._ -import org.neo4j.values.storable.Values._ import org.neo4j.values.virtual._ import scala.collection.JavaConverters._ object ImplicitValueConversion { - implicit def toListValue(s: Seq[_]): ListValue = list(s.map(AnyValues.of): _*) + implicit def toListValue(s: Seq[_]): ListValue = list(s.map(ValueUtils.of): _*) - implicit def toListValue(list: java.util.List[_]): ListValue = AnyValues.asListValue(list) + implicit def toListValue(list: java.util.List[_]): ListValue = ValueUtils.asListValue(list) implicit def toStringValue(s: String): TextValue = stringValue(s) @@ -68,22 +69,22 @@ object ImplicitValueConversion { implicit def toFloatValue(s: Float): FloatValue = floatValue(s) implicit def toMapValue(m: Map[String, _]): MapValue = - AnyValues.asMapValue(m.asJava.asInstanceOf[java.util.Map[String, AnyRef]]) + ValueUtils.asMapValue(m.asJava.asInstanceOf[java.util.Map[String, AnyRef]]) implicit def toMapValue(m: java.util.Map[String, Any]): MapValue = - AnyValues.asMapValue(m.asInstanceOf[java.util.Map[String, AnyRef]]) + ValueUtils.asMapValue(m.asInstanceOf[java.util.Map[String, AnyRef]]) - implicit def toNodeValue(n: Node): NodeValue = AnyValues.asNodeValue(n) + implicit def toNodeValue(n: Node): NodeValue = ValueUtils.fromNodeProxy(n) - implicit def toEdgeValue(r: Relationship): EdgeValue = AnyValues.asEdgeValue(r) + implicit def toEdgeValue(r: Relationship): EdgeValue = ValueUtils.fromRelationshipProxy(r) - implicit def toPathValue(p: Path): PathValue = AnyValues.asPathValue(p) + implicit def toPathValue(p: Path): PathValue = ValueUtils.asPathValue(p) - implicit def toPathValue(p: PathImpl): PathValue = AnyValues.asPathValue(p) + implicit def toPathValue(p: PathImpl): PathValue = ValueUtils.asPathValue(p) implicit def toListValue(t: TraversableOnce[_]): ListValue = - AnyValues.asListValue(t.toIterable.asJava) + ValueUtils.asListValue(t.toIterable.asJava) - implicit def toValueTuple(t: (String, Any)): (String, AnyValue) = (t._1, AnyValues.of(t._2)) + implicit def toValueTuple(t: (String, Any)): (String, AnyValue) = (t._1, ValueUtils.of(t._2)) } diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/LengthFunctionTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/LengthFunctionTest.scala index 50ed088121b4..0db9a101e72b 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/LengthFunctionTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/LengthFunctionTest.scala @@ -24,8 +24,8 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ImplicitValueConvers import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{LengthFunction, PathImpl, Variable} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.QueryStateHelper import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb.{Node, Relationship} -import org.neo4j.values.AnyValues import org.neo4j.values.storable.Values.intValue class LengthFunctionTest extends CypherFunSuite { @@ -33,7 +33,7 @@ class LengthFunctionTest extends CypherFunSuite { test("length can be used on paths") { //given val p = PathImpl(mock[Node], mock[Relationship], mock[Node]) - val m = ExecutionContext.from("p" -> AnyValues.asPathValue(p)) + val m = ExecutionContext.from("p" -> ValueUtils.asPathValue(p)) val lengthFunction = LengthFunction(Variable("p")) //when diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/PathValueBuilderTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/PathValueBuilderTest.scala index b1c836803945..7a3af67823ce 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/PathValueBuilderTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/commands/expressions/PathValueBuilderTest.scala @@ -22,8 +22,8 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expression import org.mockito.Mockito import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ImplicitValueConversion._ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite +import org.neo4j.cypher.internal.javacompat.ValueUtils.asPathValue import org.neo4j.graphdb.{Node, Relationship, RelationshipType} -import org.neo4j.values.AnyValues.asPathValue import org.neo4j.values.storable.Values.NO_VALUE class PathValueBuilderTest extends CypherFunSuite { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/mutation/GraphElementPropertyFunctionsTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/mutation/GraphElementPropertyFunctionsTest.scala index 6764b80b9311..3efa9529fb41 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/mutation/GraphElementPropertyFunctionsTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/mutation/GraphElementPropertyFunctionsTest.scala @@ -20,7 +20,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.mutation import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.values.AnyValues +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.values.storable.ArrayValue import org.neo4j.values.storable.Values._ @@ -80,6 +80,6 @@ class GraphElementPropertyFunctionsTest extends CypherFunSuite with GraphElement implicit class CheckValeNeoSafe(expected: ArrayValue) { import scala.collection.JavaConverters._ def ==>(vals: Any*): Unit = - makeValueNeoSafe(AnyValues.asListValue(vals.asJava)) should equal(expected) + makeValueNeoSafe(ValueUtils.asListValue(vals.asJava)) should equal(expected) } } diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipeTest.scala index ffee96df0cd8..089be1bab8fa 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandAllPipeTest.scala @@ -27,10 +27,10 @@ import org.mockito.stubbing.Answer import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite +import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.cypher.internal.javacompat.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.{Node, Relationship} -import org.neo4j.values.AnyValues -import org.neo4j.values.virtual.VirtualValues.{fromNodeProxy, fromRelationshipProxy} class ExpandAllPipeTest extends CypherFunSuite { @@ -140,7 +140,7 @@ class ExpandAllPipeTest extends CypherFunSuite { single.toMap should equal(Map("a" -> fromNodeProxy(startNode), "r" -> fromRelationshipProxy(relationship1), "b" -> fromNodeProxy(endNode1))) } - private def row(values: (String, Any)*) = ExecutionContext.from(values.map(v => (v._1, AnyValues.of(v._2))): _*) + private def row(values: (String, Any)*) = ExecutionContext.from(values.map(v => (v._1, ValueUtils.of(v._2))): _*) private def mockRelationships(rels: Relationship*) { when(query.getRelationshipsForIds(any(), any(), any())).thenAnswer(new Answer[Iterator[Relationship]] { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandIntoPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandIntoPipeTest.scala index 2fae10c136ea..7fbbc7b7eba0 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandIntoPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ExpandIntoPipeTest.scala @@ -26,8 +26,8 @@ import org.mockito.stubbing.Answer import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.symbols._ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite +import org.neo4j.cypher.internal.javacompat.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.graphdb.Relationship -import org.neo4j.values.virtual.VirtualValues.{fromNodeProxy, fromRelationshipProxy} class ExpandIntoPipeTest extends CypherFunSuite with PipeTestSupport { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FakePipe.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FakePipe.scala index 5f9f9def9ab2..412c0eac7f5f 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FakePipe.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/FakePipe.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.symbols.CypherType -import org.neo4j.values.AnyValues +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.scalatest.mock.MockitoSugar import scala.collection.Map @@ -32,7 +32,7 @@ class FakePipe(val data: Iterator[Map[String, Any]], newVariables: (String, Cyph def this(data: Traversable[Map[String, Any]], variables: (String, CypherType)*) = this(data.toIterator, variables:_*) def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = - data.map(m => ExecutionContext(collection.mutable.Map(m.mapValues(AnyValues.of).toSeq: _*))) + data.map(m => ExecutionContext(collection.mutable.Map(m.mapValues(ValueUtils.of).toSeq: _*))) var id = new Id } diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByIdSeekPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByIdSeekPipeTest.scala index 4c98ec91aa4f..004e4738283c 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByIdSeekPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByIdSeekPipeTest.scala @@ -22,9 +22,9 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.mockito.Mockito import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{ListLiteral, Literal} import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite +import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.cypher.internal.spi.v3_3.{Operations, QueryContext} import org.neo4j.graphdb.Node -import org.neo4j.values.virtual.VirtualValues.fromNodeProxy class NodeByIdSeekPipeTest extends CypherFunSuite { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipeTest.scala index a8035f78db28..0325ed28ac49 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeByLabelScanPipeTest.scala @@ -22,9 +22,9 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.frontend.v3_3.ast.LabelName import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite import org.neo4j.cypher.internal.frontend.v3_3.{LabelId, SemanticTable} +import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.Node -import org.neo4j.values.virtual.VirtualValues.fromNodeProxy class NodeByLabelScanPipeTest extends CypherFunSuite { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeHashJoinPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeHashJoinPipeTest.scala index 02ee00b47df1..fdc1c85046bf 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeHashJoinPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeHashJoinPipeTest.scala @@ -28,10 +28,10 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.symbols.SymbolTable import org.neo4j.cypher.internal.compiler.v3_3.test_helpers.TestableIterator import org.neo4j.cypher.internal.frontend.v3_3.symbols._ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite +import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.graphdb.Node import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values.{NO_VALUE, intValue} -import org.neo4j.values.virtual.VirtualValues.fromNodeProxy class NodeHashJoinPipeTest extends CypherFunSuite { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipeTest.scala index 097b1e8ce111..f8995239e436 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexScanPipeTest.scala @@ -25,9 +25,9 @@ import org.neo4j.cypher.internal.compiler.v3_3.IndexDescriptor import org.neo4j.cypher.internal.frontend.v3_3.ast.{LabelToken, PropertyKeyToken, _} import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite import org.neo4j.cypher.internal.frontend.v3_3.{LabelId, PropertyKeyId} +import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.Node -import org.neo4j.values.virtual.VirtualValues.fromNodeProxy class NodeIndexScanPipeTest extends CypherFunSuite with AstConstructionTestSupport { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipeTest.scala index eacd1922cf40..6126c81f887b 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeIndexSeekPipeTest.scala @@ -29,10 +29,10 @@ import org.neo4j.cypher.internal.compiler.v3_3.planner.logical.plans.{CompositeQ import org.neo4j.cypher.internal.frontend.v3_3.ast._ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.{CypherFunSuite, WindowsStringSafe} import org.neo4j.cypher.internal.frontend.v3_3.{CypherTypeException, LabelId, PropertyKeyId} +import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.Node import org.neo4j.values.storable.Values.stringValue -import org.neo4j.values.virtual.VirtualValues.fromNodeProxy class NodeIndexSeekPipeTest extends CypherFunSuite with AstConstructionTestSupport { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeOuterHashJoinPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeOuterHashJoinPipeTest.scala index ce1e637593b1..8005d4550786 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeOuterHashJoinPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/NodeOuterHashJoinPipeTest.scala @@ -25,10 +25,10 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ImplicitValueConversion._ import org.neo4j.cypher.internal.compiler.v3_3.test_helpers.TestableIterator import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite +import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.graphdb.Node import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values.{NO_VALUE, intValue} -import org.neo4j.values.virtual.VirtualValues.fromNodeProxy class NodeOuterHashJoinPipeTest extends CypherFunSuite { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipeTest.scala index 6fa28fe1a618..d5b95a639b0e 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandAllPipeTest.scala @@ -28,11 +28,11 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ImplicitValueConvers import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.{Not, Predicate, True} import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite +import org.neo4j.cypher.internal.javacompat.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.{Node, Relationship} import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values.NO_VALUE -import org.neo4j.values.virtual.VirtualValues.{fromNodeProxy, fromRelationshipProxy} class OptionalExpandAllPipeTest extends CypherFunSuite { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandIntoPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandIntoPipeTest.scala index 00f10afa828e..44f10dca2053 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandIntoPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/OptionalExpandIntoPipeTest.scala @@ -28,11 +28,11 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ImplicitValueConvers import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.{Not, Predicate, True} import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite +import org.neo4j.cypher.internal.javacompat.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.{Node, Relationship} import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values.NO_VALUE -import org.neo4j.values.virtual.VirtualValues.{fromNodeProxy, fromRelationshipProxy} class OptionalExpandIntoPipeTest extends CypherFunSuite { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PipeTestSupport.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PipeTestSupport.scala index 900e1cbc4366..9ce3a1631d58 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PipeTestSupport.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/PipeTestSupport.scala @@ -28,9 +28,9 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.symbols.{CypherType, _} import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherTestSupport +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.{Node, Relationship} -import org.neo4j.values.AnyValues import org.scalatest.mock.MockitoSugar trait PipeTestSupport extends CypherTestSupport with MockitoSugar { @@ -44,7 +44,7 @@ trait PipeTestSupport extends CypherTestSupport with MockitoSugar { override def id: Id = new Id } - def row(values: (String, Any)*) = ExecutionContext.from(values.map(v => (v._1, AnyValues.of(v._2))): _*) + def row(values: (String, Any)*) = ExecutionContext.from(values.map(v => (v._1, ValueUtils.of(v._2))): _*) def setUpRelMockingInQueryContext(rels: Relationship*) { val relsByStartNode = rels.groupBy(_.getStartNode) diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProjectEndpointsPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProjectEndpointsPipeTest.scala index 32f5eabf572c..0b9ec548d260 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProjectEndpointsPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/ProjectEndpointsPipeTest.scala @@ -27,11 +27,10 @@ import org.neo4j.cypher.ValueComparisonHelper.beEquivalentTo import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ImplicitValueConversion._ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite +import org.neo4j.cypher.internal.javacompat.ValueUtils.{asListOfEdges, fromNodeProxy} import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.graphdb.{Node, Relationship} import org.neo4j.values.AnyValue -import org.neo4j.values.AnyValues.asListOfEdges -import org.neo4j.values.virtual.VirtualValues.fromNodeProxy class ProjectEndpointsPipeTest extends CypherFunSuite { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TopPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TopPipeTest.scala index 4432d3079283..0c1e2370add9 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TopPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TopPipeTest.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Literal import org.neo4j.cypher.internal.frontend.v3_3.symbols._ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.values.AnyValues +import org.neo4j.cypher.internal.javacompat.ValueUtils import scala.util.Random @@ -188,7 +188,7 @@ class TopPipeTest extends CypherFunSuite { result should equal(list(10,null)) } - private def list(a: Any*) = a.map(AnyValues.of).toList + private def list(a: Any*) = a.map(ValueUtils.of).toList private def createFakePipeWith(count: Int): FakePipe = { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TriadicSelectionPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TriadicSelectionPipeTest.scala index 82e523c85bb7..2ffc7859b316 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TriadicSelectionPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/TriadicSelectionPipeTest.scala @@ -23,9 +23,10 @@ import org.neo4j.collection.primitive.PrimitiveLongIterable import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.frontend.v3_3.symbols._ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.kernel.impl.core.NodeProxy +import org.neo4j.values.AnyValue import org.neo4j.values.virtual.NodeValue -import org.neo4j.values.{AnyValue, AnyValues} import scala.collection.{Map, mutable} @@ -203,8 +204,8 @@ class TriadicSelectionPipeTest extends CypherFunSuite { override def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = state.initialContext match { case Some(context: ExecutionContext) => in.flatMap { m => - if (AnyValues.of(m(keys(0))) == context(keys(0))) { - val stringToProxy: mutable.Map[String, AnyValue] = collection.mutable.Map(m.mapValues(AnyValues.of).toSeq: _*) + if (ValueUtils.of(m(keys(0))) == context(keys(0))) { + val stringToProxy: mutable.Map[String, AnyValue] = collection.mutable.Map(m.mapValues(ValueUtils.of).toSeq: _*) Some(ExecutionContext(stringToProxy)) } else None diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UndirectedDirectedRelationshipByIdSeekPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UndirectedDirectedRelationshipByIdSeekPipeTest.scala index e4adaebb5750..f38785c6ff08 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UndirectedDirectedRelationshipByIdSeekPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/UndirectedDirectedRelationshipByIdSeekPipeTest.scala @@ -24,9 +24,9 @@ import org.neo4j.cypher.ValueComparisonHelper.beEquivalentTo import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{ListLiteral, Literal} import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite +import org.neo4j.cypher.internal.javacompat.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.cypher.internal.spi.v3_3.{Operations, QueryContext} import org.neo4j.graphdb.{Node, Relationship} -import org.neo4j.values.virtual.VirtualValues.{fromNodeProxy, fromRelationshipProxy} class UndirectedDirectedRelationshipByIdSeekPipeTest extends CypherFunSuite { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/aggregation/PercentileFunctionsTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/aggregation/PercentileFunctionsTest.scala index 97fb3bf0cbd5..75b7e7f35f3b 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/aggregation/PercentileFunctionsTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/aggregation/PercentileFunctionsTest.scala @@ -23,8 +23,9 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{Expression, Literal, NumericHelper, Variable} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.QueryStateHelper import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite +import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.values.AnyValue import org.neo4j.values.storable.Values.doubleValue -import org.neo4j.values.{AnyValue, AnyValues} trait PercentileTest { implicit val state = QueryStateHelper.empty @@ -34,7 +35,7 @@ trait PercentileTest { def getPercentile(percentile: Double, values: List[Any]): AnyValue = { val func = createAggregator(Variable("x"), Literal(percentile)) values.foreach(value => { - func(ExecutionContext.from("x" -> AnyValues.of(value)))(QueryStateHelper.empty) + func(ExecutionContext.from("x" -> ValueUtils.of(value)))(QueryStateHelper.empty) }) func.result } diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/aggregation/StdevFunctionTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/aggregation/StdevFunctionTest.scala index daf037a55bd6..50c8aa87958d 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/aggregation/StdevFunctionTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/pipes/aggregation/StdevFunctionTest.scala @@ -23,7 +23,7 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.{Expression, NumericHelper, Variable} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.QueryStateHelper import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.values.AnyValues +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.values.storable.DoubleValue trait StdevTest { @@ -34,7 +34,7 @@ trait StdevTest { def getStdev(values: List[Any]): Double = { val func = createAggregator(Variable("x")) values.foreach(value => { - func(ExecutionContext.from("x" -> AnyValues.of(value)))(QueryStateHelper.empty) + func(ExecutionContext.from("x" -> ValueUtils.of(value)))(QueryStateHelper.empty) }) func.result match { case x: DoubleValue => x.doubleValue() diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/AllShortestPathsPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/AllShortestPathsPipeTest.scala index 13dbb59ddf15..e174cb5b9d44 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/AllShortestPathsPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/AllShortestPathsPipeTest.scala @@ -25,9 +25,10 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{FakePipe, Sho import org.neo4j.cypher.internal.compiler.v3_3.QueryStateHelper.withQueryState import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.symbols._ +import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.graphdb.Node import org.neo4j.values.virtual.PathValue -import org.neo4j.values.virtual.VirtualValues.{EMPTY_MAP, fromNodeProxy} +import org.neo4j.values.virtual.VirtualValues.EMPTY_MAP import scala.collection.mutable diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/PathExpressionTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/PathExpressionTest.scala index b3548fb66628..da30dcc05a83 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/PathExpressionTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/PathExpressionTest.scala @@ -27,9 +27,9 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.predicates.{NonEmpty, True} import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.values.UnresolvedLabel import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection +import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.values.storable.Values.{FALSE, TRUE} import org.neo4j.values.virtual.PathValue -import org.neo4j.values.virtual.VirtualValues.fromNodeProxy class PathExpressionTest extends GraphDatabaseFunSuite with QueryStateTestSupport { diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/SingleShortestPathPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/SingleShortestPathPipeTest.scala index 4d9955755434..3bcd928a8b38 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/SingleShortestPathPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/SingleShortestPathPipeTest.scala @@ -25,9 +25,10 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{FakePipe, Sho import org.neo4j.cypher.internal.compiler.v3_3.QueryStateHelper.withQueryState import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection import org.neo4j.cypher.internal.frontend.v3_3.symbols._ +import org.neo4j.cypher.internal.javacompat.ValueUtils.{fromNodeProxy, fromRelationshipProxy} import org.neo4j.graphdb.Node import org.neo4j.values.virtual.PathValue -import org.neo4j.values.virtual.VirtualValues.{EMPTY_MAP, fromNodeProxy, fromRelationshipProxy} +import org.neo4j.values.virtual.VirtualValues.EMPTY_MAP class SingleShortestPathPipeTest extends GraphDatabaseFunSuite { private val path = ShortestPath("p", SingleNode("a"), SingleNode("b"), Seq(), SemanticDirection.BOTH, diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/FullPruningVarLengthExpandPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/FullPruningVarLengthExpandPipeTest.scala index 546cf258c83e..9b89a1ea3669 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/FullPruningVarLengthExpandPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/FullPruningVarLengthExpandPipeTest.scala @@ -28,11 +28,12 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.values.Unre import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ import org.neo4j.cypher.internal.compiler.v3_3.QueryStateHelper.withQueryState import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection +import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.graphdb.Node import org.neo4j.kernel.api.KernelTransaction.Type import org.neo4j.kernel.api.security.SecurityContext -import org.neo4j.values.virtual.VirtualValues.{EMPTY_MAP, fromNodeProxy} -import org.neo4j.values.virtual.{EdgeValue, NodeValue, VirtualValues} +import org.neo4j.values.virtual.VirtualValues.EMPTY_MAP +import org.neo4j.values.virtual.{EdgeValue, NodeValue} import scala.collection.immutable.IndexedSeq import scala.util.Random diff --git a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/PruningVarLengthExpandPipeTest.scala b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/PruningVarLengthExpandPipeTest.scala index c3486f20e615..3ed14cea7e53 100644 --- a/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/PruningVarLengthExpandPipeTest.scala +++ b/community/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiler/v3_3/pipes/PruningVarLengthExpandPipeTest.scala @@ -27,12 +27,12 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.values.Unre import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes._ import org.neo4j.cypher.internal.compiler.v3_3.QueryStateHelper.withQueryState import org.neo4j.cypher.internal.frontend.v3_3.SemanticDirection +import org.neo4j.cypher.internal.javacompat.ValueUtils._ import org.neo4j.graphdb.Node import org.neo4j.kernel.api.KernelTransaction.Type import org.neo4j.kernel.api.security.SecurityContext -import org.neo4j.values.AnyValues.asNodeValue import org.neo4j.values.virtual.VirtualValues.EMPTY_MAP -import org.neo4j.values.virtual.{EdgeValue, NodeValue, VirtualValues} +import org.neo4j.values.virtual.{EdgeValue, NodeValue} import scala.collection.immutable.IndexedSeq import scala.util.Random @@ -61,7 +61,7 @@ class PruningVarLengthExpandPipeTest extends GraphDatabaseFunSuite { graph.withTx { tx => withQueryState(graph, tx, EMPTY_MAP, { queryState => - pipeUnderTest.createResults(queryState).toList shouldBe List(Map("from" -> asNodeValue(n1), "to" -> asNodeValue(n2))) + pipeUnderTest.createResults(queryState).toList shouldBe List(Map("from" -> fromNodeProxy(n1), "to" -> fromNodeProxy(n2))) }) } } @@ -76,8 +76,8 @@ class PruningVarLengthExpandPipeTest extends GraphDatabaseFunSuite { graph.withTx { tx => withQueryState(graph, tx, EMPTY_MAP, { queryState => pipeUnderTest.createResults(queryState).toList shouldBe List( - Map("from" -> asNodeValue(n1), "to" -> asNodeValue(n2)), - Map("from" -> asNodeValue(n1), "to" -> asNodeValue(n1)) + Map("from" -> fromNodeProxy(n1), "to" -> fromNodeProxy(n2)), + Map("from" -> fromNodeProxy(n1), "to" -> fromNodeProxy(n1)) ) }) } @@ -101,7 +101,7 @@ class PruningVarLengthExpandPipeTest extends GraphDatabaseFunSuite { graph.withTx { tx => withQueryState(graph, tx, EMPTY_MAP, { queryState => pipeUnderTest.createResults(queryState).map(_.apply("to")).toSet should equal( - nodes.slice(min, max + 1).map(asNodeValue).toSet // Slice is excluding the end, whereas ()-[*3..5]->() is including + nodes.slice(min, max + 1).map(fromNodeProxy).toSet // Slice is excluding the end, whereas ()-[*3..5]->() is including ) }) } @@ -124,7 +124,7 @@ class PruningVarLengthExpandPipeTest extends GraphDatabaseFunSuite { withQueryState(graph, tx, EMPTY_MAP, { queryState => pipeUnderTest.createResults(queryState).toList should equal( List( - Map("from" -> asNodeValue(n1), "to" -> asNodeValue(n2)) + Map("from" -> fromNodeProxy(n1), "to" -> fromNodeProxy(n2)) ) ) }) @@ -151,7 +151,7 @@ class PruningVarLengthExpandPipeTest extends GraphDatabaseFunSuite { withQueryState(graph, tx, EMPTY_MAP, { queryState => pipeUnderTest.createResults(queryState).toList should equal( List( - Map("from" -> asNodeValue(n1), "to" -> asNodeValue(n2)) + Map("from" -> fromNodeProxy(n1), "to" -> fromNodeProxy(n2)) ) ) }) @@ -178,7 +178,7 @@ class PruningVarLengthExpandPipeTest extends GraphDatabaseFunSuite { withQueryState(graph, tx, EMPTY_MAP, { queryState => pipeUnderTest.createResults(queryState).toList should equal( List( - Map("from" -> asNodeValue(n1), "to" -> asNodeValue(n2)) + Map("from" -> fromNodeProxy(n1), "to" -> fromNodeProxy(n2)) )) }) } @@ -209,7 +209,7 @@ class PruningVarLengthExpandPipeTest extends GraphDatabaseFunSuite { graph.withTx { tx => withQueryState(graph, tx, EMPTY_MAP, { queryState => - pipeUnderTest.createResults(queryState).toSet should equal(nodes.tail.map(n => Map("from" -> asNodeValue(n1), "to" -> asNodeValue(n))).toSet) + pipeUnderTest.createResults(queryState).toSet should equal(nodes.tail.map(n => Map("from" -> fromNodeProxy(n1), "to" -> fromNodeProxy(n))).toSet) }) } } @@ -229,14 +229,14 @@ class PruningVarLengthExpandPipeTest extends GraphDatabaseFunSuite { graph.withTx { tx => withQueryState(graph, tx, EMPTY_MAP, { queryState => pipeUnderTest.createResults(queryState).toSet should equal(Set( - Map("from" -> asNodeValue(nodes(1)), "to" -> asNodeValue(nodes(2))), - Map("from" -> asNodeValue(nodes(1)), "to" -> asNodeValue(nodes(3))), - Map("from" -> asNodeValue(nodes(1)), "to" -> asNodeValue(nodes(4))), - Map("from" -> asNodeValue(nodes(1)), "to" -> asNodeValue(nodes(5))), - Map("from" -> asNodeValue(nodes(5)), "to" -> asNodeValue(nodes(6))), - Map("from" -> asNodeValue(nodes(5)), "to" -> asNodeValue(nodes(7))), - Map("from" -> asNodeValue(nodes(5)), "to" -> asNodeValue(nodes(8))), - Map("from" -> asNodeValue(nodes(5)), "to" -> asNodeValue(nodes(9))) + Map("from" -> fromNodeProxy(nodes(1)), "to" -> fromNodeProxy(nodes(2))), + Map("from" -> fromNodeProxy(nodes(1)), "to" -> fromNodeProxy(nodes(3))), + Map("from" -> fromNodeProxy(nodes(1)), "to" -> fromNodeProxy(nodes(4))), + Map("from" -> fromNodeProxy(nodes(1)), "to" -> fromNodeProxy(nodes(5))), + Map("from" -> fromNodeProxy(nodes(5)), "to" -> fromNodeProxy(nodes(6))), + Map("from" -> fromNodeProxy(nodes(5)), "to" -> fromNodeProxy(nodes(7))), + Map("from" -> fromNodeProxy(nodes(5)), "to" -> fromNodeProxy(nodes(8))), + Map("from" -> fromNodeProxy(nodes(5)), "to" -> fromNodeProxy(nodes(9))) )) }) } diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/store/TestShortArray.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/store/TestShortArray.java index 0efbd7a272d8..d20a6296ed26 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/store/TestShortArray.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/store/TestShortArray.java @@ -22,7 +22,7 @@ import org.junit.Test; import org.neo4j.kernel.impl.store.record.PropertyBlock; -import org.neo4j.values.AnyValues; +import org.neo4j.values.storable.Values; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -97,6 +97,6 @@ private void assertCanEncodeAndDecodeToSameValue( Object value, int payloadSize PropertyBlock target = new PropertyBlock(); boolean encoded = ShortArray.encode( 0, value, target, payloadSize ); assertTrue( encoded ); - assertEquals( AnyValues.of( value ), ShortArray.decode( target ) ); + assertEquals( Values.of( value ), ShortArray.decode( target ) ); } } diff --git a/community/values/src/main/java/org/neo4j/values/AnyValues.java b/community/values/src/main/java/org/neo4j/values/AnyValues.java index 0f4c95c040d9..96582b1966c5 100644 --- a/community/values/src/main/java/org/neo4j/values/AnyValues.java +++ b/community/values/src/main/java/org/neo4j/values/AnyValues.java @@ -19,38 +19,10 @@ */ package org.neo4j.values; -import java.util.Collection; import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import java.util.stream.StreamSupport; -import org.neo4j.graphdb.Node; -import org.neo4j.graphdb.Path; -import org.neo4j.graphdb.PropertyContainer; -import org.neo4j.graphdb.Relationship; -import org.neo4j.graphdb.spatial.Geometry; -import org.neo4j.graphdb.spatial.Point; -import org.neo4j.helpers.collection.Iterables; -import org.neo4j.values.storable.NumberValue; -import org.neo4j.values.storable.TextValue; import org.neo4j.values.storable.Values; -import org.neo4j.values.virtual.CoordinateReferenceSystem; -import org.neo4j.values.virtual.EdgeValue; -import org.neo4j.values.virtual.ListValue; -import org.neo4j.values.virtual.MapValue; -import org.neo4j.values.virtual.NodeValue; -import org.neo4j.values.virtual.PathValue; -import org.neo4j.values.virtual.PointValue; import org.neo4j.values.virtual.VirtualValueGroup; -import org.neo4j.values.virtual.VirtualValues; - -import static java.util.stream.StreamSupport.stream; -import static org.neo4j.values.virtual.VirtualValues.list; -import static org.neo4j.values.virtual.VirtualValues.map; @SuppressWarnings( "WeakerAccess" ) public final class AnyValues @@ -97,228 +69,4 @@ public final class AnyValues */ public static final Comparator COMPARATOR = new AnyValueComparator( Values.COMPARATOR, VirtualValueGroup::compareTo ); - - /** - * Creates an AnyValue by doing type inspection. Do not use in production code where performance is important. - * - * @param object the object to turned into a AnyValue - * @return the AnyValue corresponding to object. - */ - @SuppressWarnings( "unchecked" ) - public static AnyValue of( Object object ) - { - try - { - return Values.of( object ); - } - catch ( IllegalArgumentException e ) - { - if ( object instanceof Node ) - { - return asNodeValue( (Node) object ); - } - else if ( object instanceof Relationship ) - { - return asEdgeValue( (Relationship) object ); - } - else if ( object instanceof Path ) - { - return asPathValue( (Path) object ); - } - else if ( object instanceof Map ) - { - return asMapValue( (Map) object ); - } - else if ( object instanceof Collection ) - { - return asListValue( (Collection) object ); - } - else if ( object instanceof Stream ) - { - return asListValue( ((Stream) object).collect( Collectors.toList() ) ); - } - else if ( object instanceof Point ) - { - return asPointValue( (Point) object ); - } - else if ( object instanceof Geometry ) - { - return asPointValue( (Geometry) object ); - } - else if ( object instanceof Object[] ) - { - Object[] array = (Object[]) object; - AnyValue[] anyValues = new AnyValue[array.length]; - for ( int i = 0; i < array.length; i++ ) - { - anyValues[i] = of( array[i] ); - } - return VirtualValues.list( anyValues ); - } - else - { - throw new IllegalArgumentException( - String.format( "Cannot convert %s to AnyValue", object.getClass().getName() ) ); - } - } - } - - public static PointValue asPointValue( Point point ) - { - return toPoint( point ); - } - - public static PointValue asPointValue( Geometry geometry ) - { - if ( !geometry.getGeometryType().equals( "Point" ) ) - { - throw new IllegalArgumentException( "Cannot handle geometry type: " + geometry.getCRS().getType() ); - } - return toPoint( geometry ); - } - - private static PointValue toPoint( Geometry geometry ) - { - List coordinate = geometry.getCoordinates().get( 0 ).getCoordinate(); - if ( geometry.getCRS().getCode() == CoordinateReferenceSystem.Cartesian.code ) - { - return VirtualValues.pointCartesian( coordinate.get( 0 ), coordinate.get( 1 ) ); - } - else if ( geometry.getCRS().getCode() == CoordinateReferenceSystem.WGS84.code ) - { - return VirtualValues.pointGeographic( coordinate.get( 0 ), coordinate.get( 1 ) ); - } - else - { - throw new IllegalArgumentException( "Unknown coordinate reference system " + geometry.getCRS() ); - } - } - - public static ListValue asListValue( Iterable collection ) - { - AnyValue[] anyValues = - Iterables.stream( collection ).map( AnyValues::of ).toArray( AnyValue[]::new ); - return list( anyValues ); - } - - public static NodeValue asNodeValue( Node node ) - { - return VirtualValues.fromNodeProxy( node ); - } - - public static EdgeValue asEdgeValue( Relationship rel ) - { - return VirtualValues.fromRelationshipProxy( rel ); - } - - public static AnyValue asNodeOrEdgeValue( PropertyContainer container ) - { - if ( container instanceof Node ) - { - return asNodeValue( (Node) container ); - } - else if ( container instanceof Relationship ) - { - return asEdgeValue( (Relationship) container ); - } - else - { - throw new IllegalArgumentException( - "Cannot produce a node or edge from " + container.getClass().getName() ); - } - } - - public static PathValue asPathValue( Path path ) - { - NodeValue[] nodes = stream( path.nodes().spliterator(), false ) - .map( AnyValues::asNodeValue ).toArray( NodeValue[]::new ); - EdgeValue[] edges = stream( path.relationships().spliterator(), false ) - .map( AnyValues::asEdgeValue ).toArray( EdgeValue[]::new ); - - return VirtualValues.path( nodes, edges ); - } - - public static ListValue asListOfEdges( Iterable rels ) - { - return VirtualValues.list( StreamSupport.stream( rels.spliterator(), false ) - .map( AnyValues::asEdgeValue ).toArray( EdgeValue[]::new ) ); - } - - public static ListValue asListOfEdges( Relationship[] rels ) - { - EdgeValue[] edgeValues = new EdgeValue[rels.length]; - for ( int i = 0; i < edgeValues.length; i++ ) - { - edgeValues[i] = asEdgeValue( rels[i] ); - } - return VirtualValues.list( edgeValues ); - } - - public static MapValue asMapValue( Map map ) - { - return map( mapValues( map ) ); - } - - public static PointValue fromMap( MapValue map ) - { - if ( map.containsKey( "x" ) && map.containsKey( "y" ) ) - { - double x = ((NumberValue) map.get( "x" )).doubleValue(); - double y = ((NumberValue) map.get( "y" )).doubleValue(); - if ( !map.containsKey( "crs" ) ) - { - return VirtualValues.pointCartesian( x, y ); - } - - TextValue crs = (TextValue) map.get( "crs" ); - if ( crs.stringValue().equals( CoordinateReferenceSystem.Cartesian.type() ) ) - { - return VirtualValues.pointCartesian( x, y ); - } - else if ( crs.stringValue().equals( CoordinateReferenceSystem.WGS84.type() ) ) - { - return VirtualValues.pointGeographic( x, y ); - } - else - { - throw new IllegalArgumentException( "Unknown coordinate reference system: " + crs.stringValue() ); - } - } - else if ( map.containsKey( "latitude" ) && map.containsKey( "longitude" ) ) - { - double latitude = ((NumberValue) map.get( "latitude" )).doubleValue(); - double longitude = ((NumberValue) map.get( "longitude" )).doubleValue(); - if ( !map.containsKey( "crs" ) ) - { - return VirtualValues.pointGeographic( longitude, latitude ); - } - - TextValue crs = (TextValue) map.get( "crs" ); - if ( crs.stringValue().equals( CoordinateReferenceSystem.WGS84.type() ) ) - { - return VirtualValues.pointGeographic( longitude, latitude ); - } - else - { - throw new IllegalArgumentException( - "Geographic points does not support coordinate reference system: " + crs.stringValue() ); - } - } - else - { - throw new IllegalArgumentException( - "A point must contain either 'x' and 'y' or 'latitude' and 'longitude'" ); - } - } - - private static Map mapValues( Map map ) - { - HashMap newMap = new HashMap<>( map.size() ); - for ( Map.Entry entry : map.entrySet() ) - { - newMap.put( entry.getKey(), of( entry.getValue() ) ); - } - - return newMap; - } } diff --git a/community/values/src/main/java/org/neo4j/values/virtual/EdgeValue.java b/community/values/src/main/java/org/neo4j/values/virtual/EdgeValue.java index 329bbaa15fb9..12fe3d00b287 100644 --- a/community/values/src/main/java/org/neo4j/values/virtual/EdgeValue.java +++ b/community/values/src/main/java/org/neo4j/values/virtual/EdgeValue.java @@ -19,12 +19,8 @@ */ package org.neo4j.values.virtual; -import org.neo4j.graphdb.NotFoundException; -import org.neo4j.graphdb.Relationship; import org.neo4j.values.AnyValueWriter; -import org.neo4j.values.AnyValues; import org.neo4j.values.storable.TextValue; -import org.neo4j.values.storable.Values; import static java.lang.String.format; @@ -110,112 +106,4 @@ public MapValue properties() return properties; } } - - public static class RelationshipProxyWrappingEdgeValue extends EdgeValue - { - private final Relationship relationship; - private volatile TextValue type; - private volatile MapValue properties; - private volatile NodeValue startNode; - private volatile NodeValue endNode; - - RelationshipProxyWrappingEdgeValue( Relationship relationship ) - { - super( relationship.getId() ); - this.relationship = relationship; - } - - public Relationship relationshipProxy() - { - return relationship; - } - - @Override - public void writeTo( AnyValueWriter writer ) throws E - { - MapValue p; - try - { - p = properties(); - } - catch ( NotFoundException e ) - { - p = VirtualValues.EMPTY_MAP; - - } - writer.writeEdge( id(), startNode().id(), endNode().id(), type(), p); - } - - @Override - public NodeValue startNode() - { - NodeValue start = startNode; - if ( start == null ) - { - synchronized ( this ) - { - start = startNode; - if ( start == null ) - { - start = startNode = VirtualValues.fromNodeProxy( relationship.getStartNode() ); - } - } - } - return start; - } - - @Override - public NodeValue endNode() - { - NodeValue end = endNode; - if ( end == null ) - { - synchronized ( this ) - { - end = endNode; - if ( end == null ) - { - end = endNode = VirtualValues.fromNodeProxy( relationship.getEndNode() ); - } - } - } - return end; - } - - @Override - public TextValue type() - { - TextValue t = type; - if ( t == null ) - { - synchronized ( this ) - { - t = type; - if ( t == null ) - { - t = type = Values.stringValue( relationship.getType().name() ); - } - } - } - return t; - } - - @Override - public MapValue properties() - { - MapValue m = properties; - if ( m == null ) - { - synchronized ( this ) - { - m = properties; - if ( m == null ) - { - m = properties = AnyValues.asMapValue( relationship.getAllProperties() ); - } - } - } - return m; - } - } } diff --git a/community/values/src/main/java/org/neo4j/values/virtual/NodeValue.java b/community/values/src/main/java/org/neo4j/values/virtual/NodeValue.java index 40e6c4f2ccd4..ad48fbd5d91d 100644 --- a/community/values/src/main/java/org/neo4j/values/virtual/NodeValue.java +++ b/community/values/src/main/java/org/neo4j/values/virtual/NodeValue.java @@ -20,15 +20,8 @@ package org.neo4j.values.virtual; -import java.util.ArrayList; - -import org.neo4j.graphdb.Label; -import org.neo4j.graphdb.Node; -import org.neo4j.graphdb.NotFoundException; import org.neo4j.values.AnyValueWriter; -import org.neo4j.values.AnyValues; import org.neo4j.values.storable.TextArray; -import org.neo4j.values.storable.Values; import static java.lang.String.format; @@ -87,83 +80,4 @@ public MapValue properties() return properties; } } - - public static class NodeProxyWrappingNodeValue extends NodeValue - { - private final Node node; - private volatile TextArray labels; - private volatile MapValue properties; - - NodeProxyWrappingNodeValue( Node node ) - { - super( node.getId() ); - this.node = node; - } - - public Node nodeProxy() - { - return node; - } - - @Override - public void writeTo( AnyValueWriter writer ) throws E - { - TextArray l; - MapValue p; - try - { - l = labels(); - p = properties(); - } - catch ( NotFoundException e ) - { - l = Values.stringArray(); - p = VirtualValues.EMPTY_MAP; - - } - writer.writeNode( node.getId(), l, p ); - } - - @Override - public TextArray labels() - { - TextArray l = labels; - if ( l == null ) - { - synchronized ( this ) - { - l = labels; - if ( l == null ) - { - ArrayList ls = new ArrayList<>(); - for ( Label label : node.getLabels() ) - { - ls.add( label.name() ); - } - l = labels = Values.stringArray( ls.toArray( new String[ls.size()] ) ); - - } - } - } - return l; - } - - @Override - public MapValue properties() - { - MapValue m = properties; - if ( m == null ) - { - synchronized ( this ) - { - m = properties; - if ( m == null ) - { - m = properties = AnyValues.asMapValue( node.getAllProperties() ); - } - } - } - return m; - } - } } diff --git a/community/values/src/main/java/org/neo4j/values/virtual/VirtualValues.java b/community/values/src/main/java/org/neo4j/values/virtual/VirtualValues.java index 83713190d9ab..fc4856d4b866 100644 --- a/community/values/src/main/java/org/neo4j/values/virtual/VirtualValues.java +++ b/community/values/src/main/java/org/neo4j/values/virtual/VirtualValues.java @@ -25,8 +25,6 @@ import java.util.Map; import java.util.function.Function; -import org.neo4j.graphdb.Node; -import org.neo4j.graphdb.Relationship; import org.neo4j.values.AnyValue; import org.neo4j.values.storable.ArrayValue; import org.neo4j.values.storable.TextArray; @@ -195,19 +193,9 @@ public static NodeValue nodeValue( long id, TextArray labels, MapValue propertie return new NodeValue.DirectNodeValue( id, labels, properties ); } - public static NodeValue fromNodeProxy( Node node ) - { - return new NodeValue.NodeProxyWrappingNodeValue( node ); - } - public static EdgeValue edgeValue( long id, NodeValue startNode, NodeValue endNode, TextValue type, MapValue properties ) { return new EdgeValue.DirectEdgeValue( id, startNode, endNode, type, properties ); } - - public static EdgeValue fromRelationshipProxy( Relationship relationship ) - { - return new EdgeValue.RelationshipProxyWrappingEdgeValue( relationship ); - } } diff --git a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/interpreted/expressions/NodeFromRegister.scala b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/interpreted/expressions/NodeFromRegister.scala index 55f1cae40cd8..bad6be9fd395 100644 --- a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/interpreted/expressions/NodeFromRegister.scala +++ b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/interpreted/expressions/NodeFromRegister.scala @@ -22,8 +22,8 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.interpreted.express import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.QueryState +import org.neo4j.cypher.internal.javacompat.ValueUtils.fromNodeProxy import org.neo4j.values.virtual.NodeValue -import org.neo4j.values.virtual.VirtualValues.fromNodeProxy case class NodeFromRegister(offset: Int) extends Expression with RegisterExpression { diff --git a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/interpreted/expressions/RelationshipFromRegister.scala b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/interpreted/expressions/RelationshipFromRegister.scala index 062b3dd7d3c0..820607b2de0a 100644 --- a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/interpreted/expressions/RelationshipFromRegister.scala +++ b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/interpreted/expressions/RelationshipFromRegister.scala @@ -22,11 +22,12 @@ package org.neo4j.cypher.internal.compatibility.v3_3.runtime.interpreted.express import org.neo4j.cypher.internal.compatibility.v3_3.runtime.ExecutionContext import org.neo4j.cypher.internal.compatibility.v3_3.runtime.commands.expressions.Expression import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.QueryState -import org.neo4j.values.virtual.{EdgeValue, VirtualValues} +import org.neo4j.cypher.internal.javacompat.ValueUtils +import org.neo4j.values.virtual.EdgeValue case class RelationshipFromRegister(offset: Int) extends Expression with RegisterExpression { override def apply(ctx: ExecutionContext)(implicit state: QueryState): EdgeValue = - VirtualValues.fromRelationshipProxy(state.query.relationshipOps.getById(ctx.getLongAt(offset))) + ValueUtils.fromRelationshipProxy(state.query.relationshipOps.getById(ctx.getLongAt(offset))) } diff --git a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/interpreted/pipes/VarLengthExpandRegisterPipe.scala b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/interpreted/pipes/VarLengthExpandRegisterPipe.scala index e7a69c29fcdc..e4073e2b7d1b 100644 --- a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/interpreted/pipes/VarLengthExpandRegisterPipe.scala +++ b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_3/runtime/interpreted/pipes/VarLengthExpandRegisterPipe.scala @@ -25,10 +25,10 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.pipes.{LazyTypes, Pi import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.Id import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionContext, PipelineInformation} import org.neo4j.cypher.internal.frontend.v3_3.{InternalException, SemanticDirection} +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.graphdb.Relationship import org.neo4j.kernel.impl.api.RelationshipVisitor import org.neo4j.kernel.impl.api.store.RelationshipIterator -import org.neo4j.values.AnyValues import scala.collection.mutable @@ -122,7 +122,7 @@ case class VarLengthExpandRegisterPipe(source: Pipe, val resultRow = PrimitiveExecutionContext(pipeline) resultRow.copyFrom(inputRowWithFromNode, longsToCopy, pipeline .initialNumberOfReferences) resultRow.setLongAt(toOffset, toNode) - resultRow.setRefAt(relOffset, AnyValues.asListOfEdges(rels.toArray)) + resultRow.setRefAt(relOffset, ValueUtils.asListOfEdges(rels.toArray)) resultRow } } diff --git a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/GeneratedMethodStructure.scala b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/GeneratedMethodStructure.scala index f2f26385fbe6..17310ebd6ea0 100644 --- a/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/GeneratedMethodStructure.scala +++ b/enterprise/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/codegen/GeneratedMethodStructure.scala @@ -39,6 +39,7 @@ import org.neo4j.cypher.internal.compiler.v3_3.spi.{NodeIdWrapper, RelationshipI import org.neo4j.cypher.internal.frontend.v3_3.helpers._ import org.neo4j.cypher.internal.frontend.v3_3.symbols.{CTInteger, CTNode, CTRelationship, ListType} import org.neo4j.cypher.internal.frontend.v3_3.{ParameterNotFoundException, SemanticDirection, symbols} +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.internal.spi.v3_3.codegen.GeneratedMethodStructure.CompletableFinalizer import org.neo4j.cypher.internal.spi.v3_3.codegen.Methods._ import org.neo4j.cypher.internal.spi.v3_3.codegen.Templates.{createNewInstance, handleKernelExceptions, newRelationshipDataExtractor, tryCatch} @@ -48,9 +49,9 @@ import org.neo4j.kernel.api.schema.index.{IndexDescriptor, IndexDescriptorFactor import org.neo4j.kernel.api.schema.{IndexQuery, LabelSchemaDescriptor} import org.neo4j.kernel.impl.api.RelationshipDataExtractor import org.neo4j.kernel.impl.api.store.RelationshipIterator +import org.neo4j.values.AnyValue import org.neo4j.values.storable._ -import org.neo4j.values.virtual.{EdgeValue, MapValue, NodeValue, VirtualValues} -import org.neo4j.values.{AnyValue, AnyValues} +import org.neo4j.values.virtual.{EdgeValue, MapValue, NodeValue} import scala.collection.mutable @@ -254,15 +255,15 @@ class GeneratedMethodStructure(val fields: Fields, val generator: CodeBlock, aux override def toAnyValue(expression: Expression, codeGenType: CodeGenType): Expression = codeGenType match { case CodeGenType.primitiveNode => - invoke(method[VirtualValues, NodeValue]("fromNodeProxy", typeRef[Node]), + invoke(method[ValueUtils, NodeValue]("fromNodeProxy", typeRef[Node]), invoke(nodeManager, newNodeProxyById, expression)) case CypherCodeGenType(CTNode, _) => - invoke(method[VirtualValues, NodeValue]("fromNodeProxy", typeRef[Node]), cast(typeRef[Node], expression)) + invoke(method[ValueUtils, NodeValue]("fromNodeProxy", typeRef[Node]), cast(typeRef[Node], expression)) case CodeGenType.primitiveRel => - invoke(method[VirtualValues, EdgeValue]("fromRelationshipProxy", typeRef[Node]), + invoke(method[ValueUtils, EdgeValue]("fromRelationshipProxy", typeRef[Node]), invoke(nodeManager, newRelationshipProxyById, expression)) case CypherCodeGenType(CTRelationship, _) => - invoke(method[VirtualValues, EdgeValue]("fromRelationshipProxy", typeRef[Relationship]), + invoke(method[ValueUtils, EdgeValue]("fromRelationshipProxy", typeRef[Relationship]), cast(typeRef[Relationship], expression)) case CodeGenType.primitiveInt => invoke(method[Values, LongValue]("longValue", typeRef[Long]), expression) @@ -282,7 +283,7 @@ class GeneratedMethodStructure(val fields: Fields, val generator: CodeBlock, aux case CypherCodeGenType(symbols.CTString, _) => invoke(method[Values, TextValue]("stringValue", typeRef[String]), cast(typeRef[String], expression)) case _ => - invoke(method[AnyValues, AnyValue]("of", typeRef[Object]), expression) + invoke(method[ValueUtils, AnyValue]("of", typeRef[Object]), expression) } diff --git a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CodeGeneratorTest.scala b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CodeGeneratorTest.scala index b4e91389f3a9..e918c63794d9 100644 --- a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CodeGeneratorTest.scala +++ b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CodeGeneratorTest.scala @@ -40,6 +40,7 @@ import org.neo4j.cypher.internal.frontend.v3_3.symbols._ import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite import org.neo4j.cypher.internal.frontend.v3_3.{ParameterNotFoundException, SemanticDirection, SemanticTable, _} import org.neo4j.cypher.internal.ir.v3_3.IdName +import org.neo4j.cypher.internal.javacompat.ValueUtils import org.neo4j.cypher.internal.spi.v3_3.codegen.GeneratedQueryStructure import org.neo4j.cypher.internal.spi.v3_3.{QueryContext, TransactionalContextWrapper} import org.neo4j.graphdb.Result.{ResultRow, ResultVisitor} @@ -49,10 +50,10 @@ import org.neo4j.kernel.impl.api.RelationshipVisitor import org.neo4j.kernel.impl.api.store.RelationshipIterator import org.neo4j.kernel.impl.core.{NodeManager, NodeProxy, RelationshipProxy} import org.neo4j.time.Clocks +import org.neo4j.values.AnyValue import org.neo4j.values.storable._ import org.neo4j.values.virtual.VirtualValues.EMPTY_MAP import org.neo4j.values.virtual.{EdgeValue, ListValue, MapValue, NodeValue} -import org.neo4j.values.{AnyValue, AnyValues} import scala.collection.JavaConverters._ import scala.collection.{JavaConverters, mutable} @@ -1536,7 +1537,7 @@ abstract class CodeGeneratorTest extends CypherFunSuite with LogicalPlanningTest } import JavaConverters._ - private def param(values: (String,AnyRef)*): MapValue = AnyValues.asMapValue(values.toMap.asJava) + private def param(values: (String,AnyRef)*): MapValue = ValueUtils.asMapValue(values.toMap.asJava) private def compile(plan: LogicalPlan) = { generator.generate(plan, newMockedPlanContext, semanticTable, CostBasedPlannerName.default) diff --git a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CompiledExecutionResultTest.scala b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CompiledExecutionResultTest.scala index 2f306dfeb2d6..f07576a2ee15 100644 --- a/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CompiledExecutionResultTest.scala +++ b/enterprise/cypher/cypher/src/test/scala/org/neo4j/cypher/internal/compiled_runtime/v3_3/codegen/CompiledExecutionResultTest.scala @@ -31,16 +31,16 @@ import org.neo4j.cypher.internal.compatibility.v3_3.runtime.executionplan.Comple import org.neo4j.cypher.internal.compatibility.v3_3.runtime.planDescription.InternalPlanDescription import org.neo4j.cypher.internal.compatibility.v3_3.runtime.{ExecutionMode, NormalMode, TaskCloser} import org.neo4j.cypher.internal.frontend.v3_3.test_helpers.CypherFunSuite -import org.neo4j.cypher.internal.javacompat.ResultRecord +import org.neo4j.cypher.internal.javacompat.{ResultRecord, ValueUtils} import org.neo4j.cypher.internal.spi.v3_3.QueryContext import org.neo4j.cypher.internal.v3_3.executionplan.GeneratedQueryExecution import org.neo4j.graphdb.NotFoundException import org.neo4j.graphdb.Result.{ResultRow, ResultVisitor} import org.neo4j.helpers.collection.Iterators +import org.neo4j.values.AnyValue import org.neo4j.values.result.QueryResult.QueryResultVisitor import org.neo4j.values.storable._ import org.neo4j.values.virtual.{ListValue, MapValue} -import org.neo4j.values.{AnyValue, AnyValues} import scala.collection.JavaConverters import scala.collection.JavaConverters._ @@ -179,7 +179,7 @@ class CompiledExecutionResultTest extends CypherFunSuite { val fields = new Array[AnyValue](row.size()) var i = 0 row.asScala.foreach { case (k, v) => - fields(i) = AnyValues.of(v) + fields(i) = ValueUtils.of(v) i += 1 } visitor.visit(new ResultRecord(fields)) diff --git a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltAuthScenariosInteractionIT.java b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltAuthScenariosInteractionIT.java index 5edb09482be4..6fe04136c22e 100644 --- a/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltAuthScenariosInteractionIT.java +++ b/enterprise/security/src/test/java/org/neo4j/server/security/enterprise/auth/BoltAuthScenariosInteractionIT.java @@ -23,9 +23,9 @@ import java.util.Map; +import org.neo4j.cypher.internal.javacompat.ValueUtils; import org.neo4j.graphdb.mockfs.UncloseableDelegatingFileSystemAbstraction; import org.neo4j.test.rule.fs.EphemeralFileSystemRule; -import org.neo4j.values.AnyValues; public class BoltAuthScenariosInteractionIT extends AuthScenariosInteractionTestBase { @@ -50,6 +50,6 @@ public NeoInteractionLevel setUpNeoServer( Map { @@ -43,6 +43,6 @@ public NeoInteractionLevel setUpNeoServer( Map { @@ -42,7 +42,7 @@ public NeoInteractionLevel setUpNeoServer( Map { @@ -29,7 +29,7 @@ public class BoltConfiguredProceduresIT extends ConfiguredProceduresTestBase { @@ -43,6 +43,6 @@ public NeoInteractionLevel setUpNeoServer( Map