This is an automated email from the ASF dual-hosted git repository. xiazcy pushed a commit to branch graphbinary-remove-serializers in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 57c77334501b945f92e12a775a782a083c91faac Author: Yang Xia <[email protected]> AuthorDate: Fri Sep 6 14:07:35 2024 -0700 Remove serializers for types to be removed from GraphBinaryV4 spec --- .../gremlin/structure/io/binary/DataType.java | 36 +- .../io/binary/TypeSerializerRegistry.java | 90 +---- .../structure/io/binary/types/ClassSerializer.java | 47 --- .../structure/io/binary/types/DateSerializer.java | 54 --- .../structure/io/binary/types/EnumSerializer.java | 10 - .../io/binary/types/InetAddressSerializer.java | 56 --- .../io/binary/types/InstantSerializer.java | 46 --- .../io/binary/types/LambdaSerializer.java | 59 --- .../io/binary/types/LocalDateSerializer.java | 46 --- .../io/binary/types/LocalDateTimeSerializer.java | 50 --- .../io/binary/types/LocalTimeSerializer.java | 46 --- .../io/binary/types/MetricsSerializer.java | 67 ---- .../io/binary/types/MonthDaySerializer.java | 46 --- .../io/binary/types/OffsetDateTimeSerializer.java | 1 + .../io/binary/types/OffsetTimeSerializer.java | 51 --- .../io/binary/types/PeriodSerializer.java | 46 --- .../io/binary/types/SingleTypeSerializer.java | 4 +- .../binary/types/TraversalMetricsSerializer.java | 53 --- .../binary/types/TraversalStrategySerializer.java | 68 ---- .../io/binary/types/YearMonthSerializer.java | 46 --- .../io/binary/types/ZoneOffsetSerializer.java | 47 --- .../io/binary/types/ZonedDateTimeSerializer.java | 51 --- .../gremlin/process/traversal/OrderTest.java | 9 +- .../python/gremlin_python/process/traversal.py | 131 ------- .../gremlin_python/structure/io/graphbinaryV4.py | 423 +-------------------- gremlin-python/src/main/python/radish/gremlin.py | 13 - .../tests/driver/test_driver_remote_connection.py | 16 +- .../main/python/tests/process/test_traversal.py | 1 - .../tests/structure/io/test_functionalityio.py | 3 +- .../tests/structure/io/test_graphbinaryV4.py | 30 +- .../tests/structure/io/test_graphbinaryv4model.py | 2 + .../process/traversal/step/OrderabilityTest.java | 2 + .../EarlyLimitStrategyProcessTest.java | 2 + .../gremlin/test/features/map/AsDate.feature | 163 ++++---- .../gremlin/test/features/map/DateAdd.feature | 145 +++---- .../io/AbstractTypedCompatibilityTest.java | 10 +- .../gremlin/util/ser/AbstractRoundTripTest.java | 61 --- .../types/sample/SamplePersonSerializerTest.java | 3 + 38 files changed, 208 insertions(+), 1826 deletions(-) diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/DataType.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/DataType.java index f8c844f223..4f52b6069d 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/DataType.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/DataType.java @@ -28,9 +28,7 @@ public enum DataType { INT(0x01), LONG(0x02), STRING(0X03), - DATE(0X04), - TIMESTAMP(0X05), - CLASS(0X06), + DATETIME(0X04), // todo: to be updated from OffsetDateTime DOUBLE(0X07), FLOAT(0X08), LIST(0X09), @@ -43,19 +41,7 @@ public enum DataType { GRAPH(0X10), VERTEX(0X11), VERTEXPROPERTY(0X12), - BARRIER(0X13), - // was BINDING(0X14), - // was BYTECODE(0X15), - CARDINALITY(0X16), - COLUMN(0X17), DIRECTION(0X18), - OPERATOR(0X19), - ORDER(0X1A), - PICK(0X1B), - POP(0X1C), - LAMBDA(0X1D), - P(0X1E), - SCOPE(0X1F), T(0X20), TRAVERSER(0X21), BIGDECIMAL(0X22), @@ -64,30 +50,12 @@ public enum DataType { BYTEBUFFER(0X25), SHORT(0X26), BOOLEAN(0x27), - TEXTP(0x28), - TRAVERSALSTRATEGY(0X29), - BULKSET(0X2A), + BULKSET(0X2A), // todo: TREE(0X2B), - METRICS(0x2C), - TRAVERSALMETRICS(0x2D), - MERGE(0x2E), - DT(0x2F), CHAR(0X80), DURATION(0X81), - INETADDRESS(0X82), - INSTANT(0X83), - LOCALDATE(0X84), - LOCALDATETIME(0X85), - LOCALTIME(0X86), - MONTHDAY(0X87), OFFSETDATETIME(0X88), - OFFSETTIME(0X89), - PERIOD(0X8A), - YEAR(0X8B), - YEARMONTH(0X8C), - ZONEDATETIME(0X8D), - ZONEOFFSET(0X8E), CUSTOM(0), MARKER(0XFD), diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/TypeSerializerRegistry.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/TypeSerializerRegistry.java index 5273f77113..427de19c28 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/TypeSerializerRegistry.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/TypeSerializerRegistry.java @@ -18,27 +18,11 @@ */ package org.apache.tinkerpop.gremlin.structure.io.binary; -import org.apache.tinkerpop.gremlin.process.traversal.DT; -import org.apache.tinkerpop.gremlin.process.traversal.Merge; -import org.apache.tinkerpop.gremlin.process.traversal.Operator; -import org.apache.tinkerpop.gremlin.process.traversal.Order; -import org.apache.tinkerpop.gremlin.process.traversal.P; import org.apache.tinkerpop.gremlin.process.traversal.Path; -import org.apache.tinkerpop.gremlin.process.traversal.Pick; -import org.apache.tinkerpop.gremlin.process.traversal.Pop; -import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions; -import org.apache.tinkerpop.gremlin.process.traversal.Scope; -import org.apache.tinkerpop.gremlin.process.traversal.TextP; -import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy; import org.apache.tinkerpop.gremlin.process.traversal.Traverser; import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet; import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree; -import org.apache.tinkerpop.gremlin.process.traversal.util.AndP; -import org.apache.tinkerpop.gremlin.process.traversal.util.Metrics; -import org.apache.tinkerpop.gremlin.process.traversal.util.OrP; import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalExplanation; -import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalMetrics; -import org.apache.tinkerpop.gremlin.structure.Column; import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Graph; @@ -52,73 +36,38 @@ import org.apache.tinkerpop.gremlin.structure.io.binary.types.BigIntegerSerializ import org.apache.tinkerpop.gremlin.structure.io.binary.types.BulkSetSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.ByteBufferSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.CharSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.ClassSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.CustomTypeSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.DateSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.DurationSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.EdgeSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.EnumSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.GraphSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.InetAddressSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.InstantSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.LambdaSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.ListSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.LocalDateSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.LocalDateTimeSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.LocalTimeSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.MapEntrySerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.MapSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.MetricsSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.MonthDaySerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.OffsetDateTimeSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.OffsetTimeSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.PSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.PathSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.PeriodSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.PropertySerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.SetSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.SingleTypeSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.StringSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.TransformSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.TraversalExplanationSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.TraversalMetricsSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.TraversalStrategySerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.TraverserSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.TreeSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.UUIDSerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.VertexPropertySerializer; import org.apache.tinkerpop.gremlin.structure.io.binary.types.VertexSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.YearMonthSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.ZoneOffsetSerializer; -import org.apache.tinkerpop.gremlin.structure.io.binary.types.ZonedDateTimeSerializer; -import org.apache.tinkerpop.gremlin.util.function.Lambda; import org.javatuples.Pair; import java.io.IOException; import java.lang.reflect.Modifier; import java.math.BigDecimal; import java.math.BigInteger; -import java.net.Inet4Address; -import java.net.Inet6Address; -import java.net.InetAddress; import java.nio.ByteBuffer; -import java.sql.Timestamp; import java.time.Duration; -import java.time.Instant; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.time.MonthDay; import java.time.OffsetDateTime; -import java.time.OffsetTime; -import java.time.Period; -import java.time.Year; -import java.time.YearMonth; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; import java.util.Arrays; import java.util.Collection; -import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; @@ -140,9 +89,6 @@ public class TypeSerializerRegistry { new RegistryEntry<>(Integer.class, SingleTypeSerializer.IntSerializer), new RegistryEntry<>(Long.class, SingleTypeSerializer.LongSerializer), new RegistryEntry<>(String.class, new StringSerializer()), - new RegistryEntry<>(Date.class, DateSerializer.DateSerializer), - new RegistryEntry<>(Timestamp.class, DateSerializer.TimestampSerializer), - new RegistryEntry<>(Class.class, new ClassSerializer()), new RegistryEntry<>(Double.class, SingleTypeSerializer.DoubleSerializer), new RegistryEntry<>(Float.class, SingleTypeSerializer.FloatSerializer), new RegistryEntry<>(List.class, new ListSerializer()), @@ -155,22 +101,7 @@ public class TypeSerializerRegistry { new RegistryEntry<>(Property.class, new PropertySerializer()), new RegistryEntry<>(Graph.class, new GraphSerializer()), new RegistryEntry<>(Vertex.class, new VertexSerializer()), - new RegistryEntry<>(SackFunctions.Barrier.class, EnumSerializer.BarrierSerializer), - new RegistryEntry<>(VertexProperty.Cardinality.class, EnumSerializer.CardinalitySerializer), - new RegistryEntry<>(Column.class, EnumSerializer.ColumnSerializer), new RegistryEntry<>(Direction.class, EnumSerializer.DirectionSerializer), - new RegistryEntry<>(DT.class, EnumSerializer.DTSerializer), - new RegistryEntry<>(Merge.class, EnumSerializer.MergeSerializer), - new RegistryEntry<>(Operator.class, EnumSerializer.OperatorSerializer), - new RegistryEntry<>(Order.class, EnumSerializer.OrderSerializer), - new RegistryEntry<>(Pick.class, EnumSerializer.PickSerializer), - new RegistryEntry<>(Pop.class, EnumSerializer.PopSerializer), - new RegistryEntry<>(Lambda.class, new LambdaSerializer()), - new RegistryEntry<>(P.class, new PSerializer<>(DataType.P, P.class)), - new RegistryEntry<>(AndP.class, new PSerializer<>(DataType.P, AndP.class)), - new RegistryEntry<>(OrP.class, new PSerializer<>(DataType.P, OrP.class)), - new RegistryEntry<>(TextP.class, new PSerializer<>(DataType.TEXTP, TextP.class)), - new RegistryEntry<>(Scope.class, EnumSerializer.ScopeSerializer), new RegistryEntry<>(T.class, EnumSerializer.TSerializer), new RegistryEntry<>(Traverser.class, new TraverserSerializer()), new RegistryEntry<>(BigDecimal.class, new BigDecimalSerializer()), @@ -179,11 +110,8 @@ public class TypeSerializerRegistry { new RegistryEntry<>(ByteBuffer.class, new ByteBufferSerializer()), new RegistryEntry<>(Short.class, SingleTypeSerializer.ShortSerializer), new RegistryEntry<>(Boolean.class, SingleTypeSerializer.BooleanSerializer), - new RegistryEntry<>(TraversalStrategy.class, new TraversalStrategySerializer()), - new RegistryEntry<>(BulkSet.class, new BulkSetSerializer()), + new RegistryEntry<>(BulkSet.class, new BulkSetSerializer()), //todo: to be removed when bulk implemented in list new RegistryEntry<>(Tree.class, new TreeSerializer()), - new RegistryEntry<>(Metrics.class, new MetricsSerializer()), - new RegistryEntry<>(TraversalMetrics.class, new TraversalMetricsSerializer()), new RegistryEntry<>(Marker.class, SingleTypeSerializer.MarkerSerializer), // TransformSerializer implementations @@ -192,21 +120,7 @@ public class TypeSerializerRegistry { new RegistryEntry<>(Character.class, new CharSerializer()), new RegistryEntry<>(Duration.class, new DurationSerializer()), - new RegistryEntry<>(InetAddress.class, new InetAddressSerializer()), - new RegistryEntry<>(Inet4Address.class, new InetAddressSerializer<>()), - new RegistryEntry<>(Inet6Address.class, new InetAddressSerializer<>()), - new RegistryEntry<>(Instant.class, new InstantSerializer()), - new RegistryEntry<>(LocalDate.class, new LocalDateSerializer()), - new RegistryEntry<>(LocalTime.class, new LocalTimeSerializer()), - new RegistryEntry<>(LocalDateTime.class, new LocalDateTimeSerializer()), - new RegistryEntry<>(MonthDay.class, new MonthDaySerializer()), - new RegistryEntry<>(OffsetDateTime.class, new OffsetDateTimeSerializer()), - new RegistryEntry<>(OffsetTime.class, new OffsetTimeSerializer()), - new RegistryEntry<>(Period.class, new PeriodSerializer()), - new RegistryEntry<>(Year.class, SingleTypeSerializer.YearSerializer), - new RegistryEntry<>(YearMonth.class, new YearMonthSerializer()), - new RegistryEntry<>(ZonedDateTime.class, new ZonedDateTimeSerializer()), - new RegistryEntry<>(ZoneOffset.class, new ZoneOffsetSerializer()) + new RegistryEntry<>(OffsetDateTime.class, new OffsetDateTimeSerializer()), //todo: to be updated to DateTime serializer }; diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/ClassSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/ClassSerializer.java deleted file mode 100644 index 0b832879df..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/ClassSerializer.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; - -import java.io.IOException; - -public class ClassSerializer extends SimpleTypeSerializer<Class> { - public ClassSerializer() { - super(DataType.CLASS); - } - - @Override - protected Class readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { - final String name = context.readValue(buffer, String.class, false); - try { - return Class.forName(name); - } catch (Exception ex) { - throw new RuntimeException(ex); - } - } - - @Override - protected void writeValue(final Class value, final Buffer buffer, final GraphBinaryWriter context) throws IOException { - context.writeValue(value.getName(), buffer, false); - } -} diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/DateSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/DateSerializer.java deleted file mode 100644 index 1487383b20..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/DateSerializer.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; - -import java.sql.Timestamp; -import java.util.Date; -import java.util.function.Function; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class DateSerializer<T extends Date> extends SimpleTypeSerializer<T> { - - public static final DateSerializer<Date> DateSerializer = new DateSerializer<>(DataType.DATE, Date::new); - public static final DateSerializer<Timestamp> TimestampSerializer = new DateSerializer<>(DataType.TIMESTAMP, Timestamp::new); - - private final Function<Long, T> reader; - - private DateSerializer(final DataType type, final Function<Long, T> reader) { - super(type); - this.reader = reader; - } - - @Override - protected T readValue(final Buffer buffer, final GraphBinaryReader context) { - return reader.apply(buffer.readLong()); - } - - @Override - protected void writeValue(final T value, final Buffer buffer, final GraphBinaryWriter context) { - buffer.writeLong(value.getTime()); - } -} diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/EnumSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/EnumSerializer.java index dcd1469460..394477dd4b 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/EnumSerializer.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/EnumSerializer.java @@ -45,17 +45,7 @@ import java.util.function.Function; */ public class EnumSerializer<E extends Enum> extends SimpleTypeSerializer<E> { - public static final EnumSerializer<SackFunctions.Barrier> BarrierSerializer = new EnumSerializer<>(DataType.BARRIER, SackFunctions.Barrier::valueOf); - public static final EnumSerializer<VertexProperty.Cardinality> CardinalitySerializer = new EnumSerializer<>(DataType.CARDINALITY, VertexProperty.Cardinality::valueOf); - public static final EnumSerializer<Column> ColumnSerializer = new EnumSerializer<>(DataType.COLUMN, Column::valueOf); public static final EnumSerializer<Direction> DirectionSerializer = new EnumSerializer<>(DataType.DIRECTION, Direction::valueOf); - public static final EnumSerializer<DT> DTSerializer = new EnumSerializer<>(DataType.DT, DT::valueOf); - public static final EnumSerializer<Merge> MergeSerializer = new EnumSerializer<>(DataType.MERGE, Merge::valueOf); - public static final EnumSerializer<Operator> OperatorSerializer = new EnumSerializer<>(DataType.OPERATOR, Operator::valueOf); - public static final EnumSerializer<Order> OrderSerializer = new EnumSerializer<>(DataType.ORDER, Order::valueOf); - public static final EnumSerializer<Pick> PickSerializer = new EnumSerializer<>(DataType.PICK, Pick::valueOf); - public static final EnumSerializer<Pop> PopSerializer = new EnumSerializer<>(DataType.POP, Pop::valueOf); - public static final EnumSerializer<Scope> ScopeSerializer = new EnumSerializer<>(DataType.SCOPE, Scope::valueOf); public static final EnumSerializer<T> TSerializer = new EnumSerializer<>(DataType.T, T::valueOf); private final Function<String, E> readFunc; diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/InetAddressSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/InetAddressSerializer.java deleted file mode 100644 index c6153c4ab6..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/InetAddressSerializer.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.UnknownHostException; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class InetAddressSerializer<T extends InetAddress> extends SimpleTypeSerializer<T> { - public InetAddressSerializer() { - super(DataType.INETADDRESS); - } - - @Override - protected T readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { - final int length = buffer.readInt(); - final byte[] bytes = new byte[length]; - buffer.readBytes(bytes); - - try { - return (T) InetAddress.getByAddress(bytes); - } catch (UnknownHostException uhe) { - throw new IOException("Cannot deserialize InetAddress value", uhe); - } - } - - @Override - protected void writeValue(final T value, final Buffer buffer, final GraphBinaryWriter context) throws IOException { - final byte[] bytes = value.getAddress(); - buffer.writeInt(bytes.length).writeBytes(bytes); - } -} diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/InstantSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/InstantSerializer.java deleted file mode 100644 index ce0b87b11f..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/InstantSerializer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; - -import java.io.IOException; -import java.time.Instant; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class InstantSerializer extends SimpleTypeSerializer<Instant> { - public InstantSerializer() { - super(DataType.INSTANT); - } - - @Override - protected Instant readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { - return Instant.ofEpochSecond(buffer.readLong(), buffer.readInt()); - } - - @Override - protected void writeValue(final Instant value, final Buffer buffer, final GraphBinaryWriter context) throws IOException { - buffer.writeLong(value.getEpochSecond()).writeInt(value.getNano()); - } -} diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/LambdaSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/LambdaSerializer.java deleted file mode 100644 index 50cbb5298b..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/LambdaSerializer.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; -import org.apache.tinkerpop.gremlin.util.function.Lambda; - -import java.io.IOException; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class LambdaSerializer extends SimpleTypeSerializer<Lambda> { - public LambdaSerializer() { - super(DataType.LAMBDA); - } - - @Override - protected Lambda readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { - final String lang = context.readValue(buffer, String.class, false); - final String script = context.readValue(buffer, String.class, false); - final int args = context.readValue(buffer, Integer.class, false); - - if (0 == args) - return new Lambda.ZeroArgLambda<>(script, lang); - else if (1 == args) - return new Lambda.OneArgLambda<>(script, lang); - else if (2 == args) - return new Lambda.TwoArgLambda<>(script, lang); - else - return new Lambda.UnknownArgLambda(script, lang, args); - } - - @Override - protected void writeValue(final Lambda value, final Buffer buffer, final GraphBinaryWriter context) throws IOException { - context.writeValue(value.getLambdaLanguage(), buffer, false); - context.writeValue(value.getLambdaScript(), buffer, false); - context.writeValue(value.getLambdaArguments(), buffer, false); - } -} diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/LocalDateSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/LocalDateSerializer.java deleted file mode 100644 index 46a3a02523..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/LocalDateSerializer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; - -import java.io.IOException; -import java.time.LocalDate; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class LocalDateSerializer extends SimpleTypeSerializer<LocalDate> { - public LocalDateSerializer() { - super(DataType.LOCALDATE); - } - - @Override - protected LocalDate readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { - return LocalDate.of(buffer.readInt(), buffer.readByte(), buffer.readByte()); - } - - @Override - protected void writeValue(final LocalDate value, final Buffer buffer, final GraphBinaryWriter context) throws IOException { - buffer.writeInt(value.getYear()).writeByte(value.getMonthValue()).writeByte(value.getDayOfMonth()); - } -} diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/LocalDateTimeSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/LocalDateTimeSerializer.java deleted file mode 100644 index c3e92c88c1..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/LocalDateTimeSerializer.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; - -import java.io.IOException; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class LocalDateTimeSerializer extends SimpleTypeSerializer<LocalDateTime> { - public LocalDateTimeSerializer() { - super(DataType.LOCALDATETIME); - } - - @Override - protected LocalDateTime readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { - return LocalDateTime.of(context.readValue(buffer, LocalDate.class, false), - context.readValue(buffer, LocalTime.class, false)); - } - - @Override - protected void writeValue(final LocalDateTime value, final Buffer buffer, final GraphBinaryWriter context) throws IOException { - context.writeValue(value.toLocalDate(), buffer, false); - context.writeValue(value.toLocalTime(), buffer, false); - } -} diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/LocalTimeSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/LocalTimeSerializer.java deleted file mode 100644 index bb654ac4e3..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/LocalTimeSerializer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; - -import java.io.IOException; -import java.time.LocalTime; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class LocalTimeSerializer extends SimpleTypeSerializer<LocalTime> { - public LocalTimeSerializer() { - super(DataType.LOCALTIME); - } - - @Override - protected LocalTime readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { - return LocalTime.ofNanoOfDay(buffer.readLong()); - } - - @Override - protected void writeValue(final LocalTime value, final Buffer buffer, final GraphBinaryWriter context) throws IOException { - buffer.writeLong(value.toNanoOfDay()); - } -} diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/MetricsSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/MetricsSerializer.java deleted file mode 100644 index bedf2cba28..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/MetricsSerializer.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.process.traversal.util.Metrics; -import org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; - -import java.io.IOException; -import java.util.Collection; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -public class MetricsSerializer extends SimpleTypeSerializer<Metrics> { - private static final CollectionSerializer collectionSerializer = new CollectionSerializer(DataType.LIST); - - public MetricsSerializer() { - super(DataType.METRICS); - } - - @Override - protected Metrics readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { - // Consider using a custom implementation, like "DefaultMetrics" - final MutableMetrics result = new MutableMetrics( - context.readValue(buffer, String.class, false), - context.readValue(buffer, String.class, false)); - result.setDuration(context.readValue(buffer, Long.class, false), TimeUnit.NANOSECONDS); - final Map<String, Long> counts = context.readValue(buffer, Map.class, false); - counts.forEach(result::setCount); - final Map<String, Object> annotations = context.readValue(buffer, Map.class, false); - annotations.forEach(result::setAnnotation); - final Collection<MutableMetrics> nestedMetrics = collectionSerializer.readValue(buffer, context); - nestedMetrics.forEach(result::addNested); - return result; - } - - @Override - protected void writeValue(final Metrics value, final Buffer buffer, final GraphBinaryWriter context) throws IOException { - context.writeValue(value.getId(), buffer, false); - context.writeValue(value.getName(), buffer, false); - context.writeValue(value.getDuration(TimeUnit.NANOSECONDS), buffer, false); - context.writeValue(value.getCounts(), buffer, false); - context.writeValue(value.getAnnotations(), buffer, false); - - // Avoid changing type to List - collectionSerializer.writeValue(value.getNested(), buffer, context); - } -} diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/MonthDaySerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/MonthDaySerializer.java deleted file mode 100644 index 32c2c92a89..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/MonthDaySerializer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; - -import java.io.IOException; -import java.time.MonthDay; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class MonthDaySerializer extends SimpleTypeSerializer<MonthDay> { - public MonthDaySerializer() { - super(DataType.MONTHDAY); - } - - @Override - protected MonthDay readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { - return MonthDay.of(buffer.readByte(), buffer.readByte()); - } - - @Override - protected void writeValue(final MonthDay value, final Buffer buffer, final GraphBinaryWriter context) throws IOException { - buffer.writeByte(value.getMonthValue()).writeByte(value.getDayOfMonth()); - } -} diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/OffsetDateTimeSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/OffsetDateTimeSerializer.java index 90b1c797b6..96019c1a20 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/OffsetDateTimeSerializer.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/OffsetDateTimeSerializer.java @@ -38,6 +38,7 @@ public class OffsetDateTimeSerializer extends SimpleTypeSerializer<OffsetDateTim @Override protected OffsetDateTime readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { + // todo: Updates needed for deserializing these values as their serializers are removed final LocalDateTime ldt = context.readValue(buffer, LocalDateTime.class, false); final ZoneOffset zo = context.readValue(buffer, ZoneOffset.class, false); return OffsetDateTime.of(ldt, zo); diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/OffsetTimeSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/OffsetTimeSerializer.java deleted file mode 100644 index f4dcfe696c..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/OffsetTimeSerializer.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; - -import java.io.IOException; -import java.time.LocalTime; -import java.time.OffsetTime; -import java.time.ZoneOffset; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class OffsetTimeSerializer extends SimpleTypeSerializer<OffsetTime> { - public OffsetTimeSerializer() { - super(DataType.OFFSETTIME); - } - - @Override - protected OffsetTime readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { - final LocalTime ldt = context.readValue(buffer, LocalTime.class, false); - final ZoneOffset zo = context.readValue(buffer, ZoneOffset.class, false); - return OffsetTime.of(ldt, zo); - } - - @Override - protected void writeValue(final OffsetTime value, final Buffer buffer, final GraphBinaryWriter context) throws IOException { - context.writeValue(value.toLocalTime(), buffer, false); - context.writeValue(value.getOffset(), buffer, false); - } -} diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/PeriodSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/PeriodSerializer.java deleted file mode 100644 index 267e2cbf1f..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/PeriodSerializer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; - -import java.io.IOException; -import java.time.Period; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class PeriodSerializer extends SimpleTypeSerializer<Period> { - public PeriodSerializer() { - super(DataType.PERIOD); - } - - @Override - protected Period readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { - return Period.of(buffer.readInt(), buffer.readInt(), buffer.readInt()); - } - - @Override - protected void writeValue(final Period value, final Buffer buffer, final GraphBinaryWriter context) throws IOException { - buffer.writeInt(value.getYears()).writeInt(value.getMonths()).writeInt(value.getDays()); - } -} diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/SingleTypeSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/SingleTypeSerializer.java index 7d163209cf..3b4390e87e 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/SingleTypeSerializer.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/SingleTypeSerializer.java @@ -47,8 +47,8 @@ public class SingleTypeSerializer<T> extends SimpleTypeSerializer<T> { new SingleTypeSerializer<>(DataType.BOOLEAN, Buffer::readBoolean, (v, b) -> b.writeBoolean(v)); public static final SingleTypeSerializer<Byte> ByteSerializer = new SingleTypeSerializer<>(DataType.BYTE, Buffer::readByte, (v, b) -> b.writeByte(v)); - public static final SingleTypeSerializer<Year> YearSerializer = - new SingleTypeSerializer<>(DataType.YEAR, bb -> Year.of(bb.readInt()), (v, b) -> b.writeInt(v.getValue())); +// public static final SingleTypeSerializer<Year> YearSerializer = +// new SingleTypeSerializer<>(DataType.YEAR, bb -> Year.of(bb.readInt()), (v, b) -> b.writeInt(v.getValue())); public static final SingleTypeSerializer<Marker> MarkerSerializer = new SingleTypeSerializer<>(DataType.MARKER, bb -> Marker.of(bb.readByte()), (v, b) -> b.writeByte(v.getValue())); diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/TraversalMetricsSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/TraversalMetricsSerializer.java deleted file mode 100644 index ff7b360c5f..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/TraversalMetricsSerializer.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics; -import org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics; -import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalMetrics; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - -public class TraversalMetricsSerializer extends SimpleTypeSerializer<TraversalMetrics> { - private static final CollectionSerializer collectionSerializer = new CollectionSerializer(DataType.LIST); - - public TraversalMetricsSerializer() { - super(DataType.TRAVERSALMETRICS); - } - - @Override - protected TraversalMetrics readValue(Buffer buffer, GraphBinaryReader context) throws IOException { - Long durationNanos = context.readValue(buffer, Long.class, false); - final List<MutableMetrics> metrics = new ArrayList<>(collectionSerializer.readValue(buffer, context)); - return new DefaultTraversalMetrics(durationNanos, metrics); - } - - @Override - protected void writeValue(TraversalMetrics value, Buffer buffer, GraphBinaryWriter context) throws IOException { - context.writeValue(value.getDuration(TimeUnit.NANOSECONDS), buffer, false); - collectionSerializer.writeValue(value.getMetrics(), buffer, context); - } -} diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/TraversalStrategySerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/TraversalStrategySerializer.java deleted file mode 100644 index 386804fb83..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/TraversalStrategySerializer.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.commons.configuration2.ConfigurationConverter; -import org.apache.commons.configuration2.MapConfiguration; -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.process.traversal.Traversal; -import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy; -import org.apache.tinkerpop.gremlin.process.traversal.strategy.TraversalStrategyProxy; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; - -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class TraversalStrategySerializer extends SimpleTypeSerializer<TraversalStrategy> { - - public TraversalStrategySerializer() { - super(DataType.TRAVERSALSTRATEGY); - } - - @Override - protected TraversalStrategy readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { - final Class<TraversalStrategy> clazz = context.readValue(buffer, Class.class, false); - final Map config = context.readValue(buffer, Map.class, false); - - return new TraversalStrategyProxy(clazz, new MapConfiguration(config)); - } - - @Override - protected void writeValue(final TraversalStrategy value, final Buffer buffer, final GraphBinaryWriter context) throws IOException { - context.writeValue(value.getClass(), buffer, false); - context.writeValue(translateToBytecode(ConfigurationConverter.getMap(value.getConfiguration())), buffer, false); - } - - private static Map<Object,Object> translateToBytecode(final Map<Object,Object> conf) { - final Map<Object,Object> newConf = new LinkedHashMap<>(conf.size()); - conf.entrySet().forEach(entry -> { - if (entry.getValue() instanceof Traversal) - newConf.put(entry.getKey(), ((Traversal) entry.getValue()).asAdmin().getGremlinLang()); - else - newConf.put(entry.getKey(), entry.getValue()); - }); - return newConf; - } -} diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/YearMonthSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/YearMonthSerializer.java deleted file mode 100644 index 070c214957..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/YearMonthSerializer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; - -import java.io.IOException; -import java.time.YearMonth; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class YearMonthSerializer extends SimpleTypeSerializer<YearMonth> { - public YearMonthSerializer() { - super(DataType.YEARMONTH); - } - - @Override - protected YearMonth readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { - return YearMonth.of(buffer.readInt(), buffer.readByte()); - } - - @Override - protected void writeValue(final YearMonth value, final Buffer buffer, final GraphBinaryWriter context) throws IOException { - buffer.writeInt(value.getYear()).writeByte(value.getMonthValue()); - } -} diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/ZoneOffsetSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/ZoneOffsetSerializer.java deleted file mode 100644 index 09b6e47386..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/ZoneOffsetSerializer.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; - -import java.io.IOException; -import java.time.ZoneOffset; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class ZoneOffsetSerializer extends SimpleTypeSerializer<ZoneOffset> { - - public ZoneOffsetSerializer() { - super(DataType.ZONEOFFSET); - } - - @Override - protected ZoneOffset readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { - return ZoneOffset.ofTotalSeconds(buffer.readInt()); - } - - @Override - protected void writeValue(final ZoneOffset value, final Buffer buffer, final GraphBinaryWriter context) throws IOException { - buffer.writeInt(value.getTotalSeconds()); - } -} diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/ZonedDateTimeSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/ZonedDateTimeSerializer.java deleted file mode 100644 index c39dff71cc..0000000000 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/ZonedDateTimeSerializer.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tinkerpop.gremlin.structure.io.binary.types; - -import org.apache.tinkerpop.gremlin.structure.io.binary.DataType; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; -import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; -import org.apache.tinkerpop.gremlin.structure.io.Buffer; - -import java.io.IOException; -import java.time.LocalDateTime; -import java.time.ZonedDateTime; -import java.time.ZoneOffset; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class ZonedDateTimeSerializer extends SimpleTypeSerializer<ZonedDateTime> { - public ZonedDateTimeSerializer() { - super(DataType.ZONEDATETIME); - } - - @Override - protected ZonedDateTime readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { - final LocalDateTime ldt = context.readValue(buffer, LocalDateTime.class, false); - final ZoneOffset zo = context.readValue(buffer, ZoneOffset.class, false); - return ZonedDateTime.of(ldt, zo); - } - - @Override - protected void writeValue(final ZonedDateTime value, final Buffer buffer, final GraphBinaryWriter context) throws IOException { - context.writeValue(value.toLocalDateTime(), buffer, false); - context.writeValue(value.getOffset(), buffer, false); - } -} diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/OrderTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/OrderTest.java index 9d17501923..01e630fc82 100644 --- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/OrderTest.java +++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/OrderTest.java @@ -52,6 +52,7 @@ public class OrderTest { @RunWith(Parameterized.class) public static class OrderListTest { + // todo: re-enable date-related tests after implementing datetime private static final SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); @Parameterized.Parameters(name = "{0}.sort({1}) = {2}") @@ -61,10 +62,10 @@ public class OrderTest { {Order.asc, Arrays.asList("b", "a", "c", "d"), Arrays.asList("a", "b", "c", "d")}, {Order.desc, Arrays.asList("b", "a", "c", "d"), Arrays.asList("d", "c", "b", "a")}, {Order.desc, Arrays.asList("c", "a", null, "d"), Arrays.asList("d", "c", "a", null)}, - {Order.asc, Arrays.asList(formatter.parse("1-Jan-2018"), formatter.parse("1-Jan-2020"), formatter.parse("1-Jan-2008")), - Arrays.asList(formatter.parse("1-Jan-2008"), formatter.parse("1-Jan-2018"), formatter.parse("1-Jan-2020"))}, - {Order.desc, Arrays.asList(formatter.parse("1-Jan-2018"), formatter.parse("1-Jan-2020"), formatter.parse("1-Jan-2008")), - Arrays.asList(formatter.parse("1-Jan-2020"), formatter.parse("1-Jan-2018"), formatter.parse("1-Jan-2008"))}, +// {Order.asc, Arrays.asList(formatter.parse("1-Jan-2018"), formatter.parse("1-Jan-2020"), formatter.parse("1-Jan-2008")), +// Arrays.asList(formatter.parse("1-Jan-2008"), formatter.parse("1-Jan-2018"), formatter.parse("1-Jan-2020"))}, +// {Order.desc, Arrays.asList(formatter.parse("1-Jan-2018"), formatter.parse("1-Jan-2020"), formatter.parse("1-Jan-2008")), +// Arrays.asList(formatter.parse("1-Jan-2020"), formatter.parse("1-Jan-2018"), formatter.parse("1-Jan-2008"))}, {Order.desc, Arrays.asList(100L, 1L, null, -1L, 0L), Arrays.asList(100L, 1L, 0L, -1L, null)}, {Order.desc, Arrays.asList(100L, 1L, -1L, 0L), Arrays.asList(100L, 1L, 0L, -1L)}, {Order.asc, Arrays.asList(100L, 1L, null, -1L, 0L), Arrays.asList(null, -1L, 0L, 1L, 100L)}, diff --git a/gremlin-python/src/main/python/gremlin_python/process/traversal.py b/gremlin-python/src/main/python/gremlin_python/process/traversal.py index 453a7ec6c0..05635d5dd7 100644 --- a/gremlin-python/src/main/python/gremlin_python/process/traversal.py +++ b/gremlin-python/src/main/python/gremlin_python/process/traversal.py @@ -19,16 +19,11 @@ import copy import math -import numbers -import re import threading import warnings -from io import StringIO from aenum import Enum -# from gremlin_python.process.strategies import OptionsStrategy from gremlin_python.structure.graph import Vertex -# from gremlin_python.process.gremlin_lang import GremlinLang from .. import statics from ..statics import long, SingleByte, short, bigint, BigDecimal @@ -747,132 +742,6 @@ class TraversalStrategy(object): return self.strategy_name -''' -BYTECODE -''' - - -# TODO to be removed -class Bytecode(object): - def __init__(self, bytecode=None): - self.source_instructions = [] - self.step_instructions = [] - self.bindings = {} - if bytecode is not None: - self.source_instructions = list(bytecode.source_instructions) - self.step_instructions = list(bytecode.step_instructions) - - def add_source(self, source_name, *args): - instruction = [source_name] - for arg in args: - instruction.append(self.__convertArgument(arg)) - self.source_instructions.append(instruction) - - def add_step(self, step_name, *args): - instruction = [step_name] - for arg in args: - instruction.append(self.__convertArgument(arg)) - self.step_instructions.append(instruction) - - def __eq__(self, other): - if isinstance(other, self.__class__): - return self.source_instructions == other.source_instructions and self.step_instructions == other.step_instructions - else: - return False - - def __copy__(self): - bb = Bytecode() - bb.source_instructions = self.source_instructions - bb.step_instructions = self.step_instructions - bb.bindings = self.bindings - return bb - - def __deepcopy__(self, memo={}): - bb = Bytecode() - bb.source_instructions = copy.deepcopy(self.source_instructions, memo) - bb.step_instructions = copy.deepcopy(self.step_instructions, memo) - bb.bindings = copy.deepcopy(self.bindings, memo) - return bb - - def __convertArgument(self, arg): - if isinstance(arg, Traversal): - if arg.graph is not None: - raise TypeError("The child traversal of " + str( - arg) + " was not spawned anonymously - use the __ class rather than a TraversalSource to construct the child traversal") - self.bindings.update(arg.bytecode.bindings) - return arg.bytecode - elif isinstance(arg, dict): - newDict = {} - for key in arg: - newDict[self.__convertArgument(key)] = self.__convertArgument(arg[key]) - return newDict - elif isinstance(arg, list): - newList = [] - for item in arg: - newList.append(self.__convertArgument(item)) - return newList - elif isinstance(arg, set): - newSet = set() - for item in arg: - newSet.add(self.__convertArgument(item)) - return newSet - elif isinstance(arg, Binding): - self.bindings[arg.key] = arg.value - return Binding(arg.key, self.__convertArgument(arg.value)) - else: - return arg - - def __repr__(self): - return (str(self.source_instructions) if len(self.source_instructions) > 0 else "") + \ - (str(self.step_instructions) if len(self.step_instructions) > 0 else "") - - @staticmethod - def _create_graph_op(name, *values): - bc = Bytecode() - bc.add_source(name, *values) - return bc - - @staticmethod - class GraphOp: - @staticmethod - def commit(): - return Bytecode._create_graph_op("tx", "commit") - - @staticmethod - def rollback(): - return Bytecode._create_graph_op("tx", "rollback") - - -''' -BINDINGS -''' - - -# TODO to be removed -class Bindings(object): - - @staticmethod - def of(key, value): - if not isinstance(key, str): - raise TypeError("Key must be str") - return Binding(key, value) - - -class Binding(object): - def __init__(self, key, value): - self.key = key - self.value = value - - def __eq__(self, other): - return isinstance(other, self.__class__) and self.key == other.key and self.value == other.value - - def __hash__(self): - return hash(self.key) + hash(self.value) - - def __repr__(self): - return "binding[" + self.key + "=" + str(self.value) + "]" - - ''' WITH OPTIONS ''' diff --git a/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV4.py b/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV4.py index ef86445458..095d7debe4 100644 --- a/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV4.py +++ b/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV4.py @@ -16,27 +16,21 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ - -import datetime import calendar -import uuid -import math +import datetime import io +import logging +import math import struct +import uuid from collections import OrderedDict -import logging - +from datetime import timedelta from struct import pack, unpack + from aenum import Enum -from datetime import timedelta -from gremlin_python import statics -from gremlin_python.statics import FloatType, BigDecimal, FunctionType, ShortType, IntType, LongType, BigIntType, \ - TypeType, DictType, ListType, SetType, SingleByte, ByteBufferType, GremlinType, \ - SingleChar -from gremlin_python.process.traversal import Barrier, Binding, Bytecode, Cardinality, Column, Direction, DT, Merge, \ - Operator, Order, Pick, Pop, P, Scope, TextP, Traversal, Traverser, \ - TraversalStrategy, T -from gremlin_python.process.graph_traversal import GraphTraversal +from gremlin_python.process.traversal import Direction, T +from gremlin_python.statics import FloatType, BigDecimal, ShortType, IntType, LongType, BigIntType, \ + DictType, SetType, SingleByte, ByteBufferType, SingleChar from gremlin_python.structure.graph import Graph, Edge, Property, Vertex, VertexProperty, Path from gremlin_python.structure.io.util import HashableDict, SymbolUtil, Marker @@ -54,9 +48,7 @@ class DataType(Enum): int = 0x01 long = 0x02 string = 0x03 - date = 0x04 - timestamp = 0x05 - clazz = 0x06 + # date = 0x04 double = 0x07 float = 0x08 list = 0x09 @@ -69,51 +61,20 @@ class DataType(Enum): graph = 0x10 # not supported - no graph object in python yet vertex = 0x11 vertexproperty = 0x12 - barrier = 0x13 - binding = 0x14 - bytecode = 0x15 - cardinality = 0x16 - column = 0x17 direction = 0x18 - operator = 0x19 - order = 0x1a - pick = 0x1b - pop = 0x1c - lambda_ = 0x1d - p = 0x1e - scope = 0x1f t = 0x20 - traverser = 0x21 bigdecimal = 0x22 biginteger = 0x23 byte = 0x24 bytebuffer = 0x25 short = 0x26 boolean = 0x27 - textp = 0x28 - traversalstrategy = 0x29 - bulkset = 0x2a + bulkset = 0x2a # todo: to be removed when bulk is implemented in list tree = 0x2b # not supported - no tree object in Python yet - metrics = 0x2c - traversalmetrics = 0x2d - merge = 0x2e - dt = 0x2f char = 0x80 duration = 0x81 marker = 0xfd - inetaddress = 0x82 # todo - instant = 0x83 # todo - localdate = 0x84 # todo - localdatetime = 0x85 # todo - localtime = 0x86 # todo - monthday = 0x87 # todo - offsetdatetime = 0x88 # todo - offsettime = 0x89 # todo - period = 0x8a # todo - year = 0x8b # todo - yearmonth = 0x8c # todo - zonedatetime = 0x8d # todo - zoneoffset = 0x8e # todo + offsetdatetime = 0x88 # todo: will need to update to datetime custom = 0x00 # todo @@ -319,52 +280,6 @@ class BigIntIO(_GraphBinaryTypeIO): return cls.is_null(buff, reader, lambda b, r: cls.read_bigint(b), nullable) -class DateIO(_GraphBinaryTypeIO): - - python_type = datetime.datetime - graphbinary_type = DataType.date - - @classmethod - def dictify(cls, obj, writer, to_extend, as_value=False, nullable=True): - try: - timestamp_seconds = calendar.timegm(obj.utctimetuple()) - pts = timestamp_seconds * 1e3 + getattr(obj, 'microsecond', 0) / 1e3 - except AttributeError: - pts = calendar.timegm(obj.timetuple()) * 1e3 - - ts = int(round(pts)) - cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend) - to_extend.extend(int64_pack(ts)) - return to_extend - - @classmethod - def objectify(cls, buff, reader, nullable=True): - return cls.is_null(buff, reader, - lambda b, r: datetime.datetime.utcfromtimestamp(int64_unpack(b.read(8)) / 1000.0), - nullable) - - -# Based on current implementation, this class must always be declared before FloatIO. -# Seems pretty fragile for future maintainers. Maybe look into this. -class TimestampIO(_GraphBinaryTypeIO): - python_type = statics.timestamp - graphbinary_type = DataType.timestamp - - @classmethod - def dictify(cls, obj, writer, to_extend, as_value=False, nullable=True): - # Java timestamp expects milliseconds integer - Have to use int because of legacy Python - ts = int(round(obj * 1000)) - cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend) - to_extend.extend(int64_pack(ts)) - return to_extend - - @classmethod - def objectify(cls, buff, reader, nullable=True): - # Python timestamp expects seconds - return cls.is_null(buff, reader, lambda b, r: statics.timestamp(int64_unpack(b.read(8)) / 1000.0), - nullable) - - def _long_bits_to_double(bits): return unpack('d', pack('Q', bits))[0] @@ -732,21 +647,6 @@ class _EnumIO(_GraphBinaryTypeIO): return cls.python_type[SymbolUtil.to_snake_case(enum_name)] -class BarrierIO(_EnumIO): - graphbinary_type = DataType.barrier - python_type = Barrier - - -class CardinalityIO(_EnumIO): - graphbinary_type = DataType.cardinality - python_type = Cardinality - - -class ColumnIO(_EnumIO): - graphbinary_type = DataType.column - python_type = Column - - class DirectionIO(_EnumIO): graphbinary_type = DataType.direction python_type = Direction @@ -759,210 +659,11 @@ class DirectionIO(_EnumIO): return cls.python_type[enum_name] -class OperatorIO(_EnumIO): - graphbinary_type = DataType.operator - python_type = Operator - - -class OrderIO(_EnumIO): - graphbinary_type = DataType.order - python_type = Order - - -class PickIO(_EnumIO): - graphbinary_type = DataType.pick - python_type = Pick - - -class PopIO(_EnumIO): - graphbinary_type = DataType.pop - python_type = Pop - - -class BindingIO(_GraphBinaryTypeIO): - - python_type = Binding - graphbinary_type = DataType.binding - - @classmethod - def dictify(cls, obj, writer, to_extend, as_value=False, nullable=True): - cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend) - StringIO.dictify(obj.key, writer, to_extend, True, False) - writer.to_dict(obj.value, to_extend) - return to_extend - - @classmethod - def objectify(cls, buff, reader, nullable=True): - return cls.is_null(buff, reader, lambda b, r: Binding(r.to_object(b, DataType.string, False), - reader.read_object(b)), nullable) - - -class BytecodeIO(_GraphBinaryTypeIO): - python_type = Bytecode - graphbinary_type = DataType.bytecode - - @classmethod - def dictify(cls, obj, writer, to_extend, as_value=False, nullable=True): - cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend) - bc = obj.bytecode if isinstance(obj, Traversal) else obj - to_extend.extend(int32_pack(len(bc.step_instructions))) - for inst in bc.step_instructions: - inst_name, inst_args = inst[0], inst[1:] if len(inst) > 1 else [] - StringIO.dictify(inst_name, writer, to_extend, True, False) - to_extend.extend(int32_pack(len(inst_args))) - for arg in inst_args: - writer.to_dict(arg, to_extend) - - to_extend.extend(int32_pack(len(bc.source_instructions))) - for inst in bc.source_instructions: - inst_name, inst_args = inst[0], inst[1:] if len(inst) > 1 else [] - StringIO.dictify(inst_name, writer, to_extend, True, False) - to_extend.extend(int32_pack(len(inst_args))) - for arg in inst_args: - if isinstance(arg, TypeType): - writer.to_dict(GremlinType(arg().fqcn), to_extend) - else: - writer.to_dict(arg, to_extend) - return to_extend - - @classmethod - def objectify(cls, buff, reader, nullable=True): - return cls.is_null(buff, reader, cls._read_bytecode, nullable) - - @classmethod - def _read_bytecode(cls, b, r): - bytecode = Bytecode() - - step_count = cls.read_int(b) - ix = 0 - while ix < step_count: - inst = [r.to_object(b, DataType.string, False)] - inst_ct = cls.read_int(b) - iy = 0 - while iy < inst_ct: - inst.append(r.read_object(b)) - iy += 1 - bytecode.step_instructions.append(inst) - ix += 1 - - source_count = cls.read_int(b) - ix = 0 - while ix < source_count: - inst = [r.to_object(b, DataType.string, False)] - inst_ct = cls.read_int(b) - iy = 0 - while iy < inst_ct: - inst.append(r.read_object(b)) - iy += 1 - bytecode.source_instructions.append(inst) - ix += 1 - - return bytecode - - -class TraversalIO(BytecodeIO): - python_type = GraphTraversal - - -class LambdaSerializer(_GraphBinaryTypeIO): - - python_type = FunctionType - graphbinary_type = DataType.lambda_ - - @classmethod - def dictify(cls, obj, writer, to_extend, as_value=False, nullable=True): - cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend) - - lambda_result = obj() - script = lambda_result if isinstance(lambda_result, str) else lambda_result[0] - language = statics.default_lambda_language if isinstance(lambda_result, str) else lambda_result[1] - - StringIO.dictify(language, writer, to_extend, True, False) - - script_cleaned = script - script_args = -1 - - if language == "gremlin-groovy" and "->" in script: - # if the user has explicitly added parameters to the groovy closure then we can easily detect one or two - # arg lambdas - if we can't detect 1 or 2 then we just go with "unknown" - args = script[0:script.find("->")] - script_args = 2 if "," in args else 1 - - StringIO.dictify(script_cleaned, writer, to_extend, True, False) - to_extend.extend(int32_pack(script_args)) - - return to_extend - - -class PSerializer(_GraphBinaryTypeIO): - graphbinary_type = DataType.p - python_type = P - - @classmethod - def dictify(cls, obj, writer, to_extend, as_value=False, nullable=True): - cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend) - - StringIO.dictify(obj.operator, writer, to_extend, True, False) - - args = [] - if obj.other is None: - if isinstance(obj.value, ListType): - args = obj.value - else: - args.append(obj.value) - else: - args.append(obj.value) - args.append(obj.other) - - to_extend.extend(int32_pack(len(args))) - for a in args: - writer.to_dict(a, to_extend) - - return to_extend - - -class DTIO(_EnumIO): - graphbinary_type = DataType.dt - python_type = DT - - -class MergeIO(_EnumIO): - graphbinary_type = DataType.merge - python_type = Merge - - -class ScopeIO(_EnumIO): - graphbinary_type = DataType.scope - python_type = Scope - - class TIO(_EnumIO): graphbinary_type = DataType.t python_type = T -class TraverserIO(_GraphBinaryTypeIO): - graphbinary_type = DataType.traverser - python_type = Traverser - - @classmethod - def dictify(cls, obj, writer, to_extend, as_value=False, nullable=True): - cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend) - to_extend.extend(int64_pack(obj.bulk)) - writer.to_dict(obj.object, to_extend) - return to_extend - - @classmethod - def objectify(cls, buff, reader, nullable=True): - return cls.is_null(buff, reader, cls._read_traverser, nullable) - - @classmethod - def _read_traverser(cls, b, r): - bulk = int64_unpack(b.read(8)) - obj = r.read_object(b) - return Traverser(obj, bulk=bulk) - - class ByteIO(_GraphBinaryTypeIO): python_type = SingleByte graphbinary_type = DataType.byte @@ -1018,33 +719,7 @@ class BooleanIO(_GraphBinaryTypeIO): nullable) -class TextPSerializer(_GraphBinaryTypeIO): - graphbinary_type = DataType.textp - python_type = TextP - - @classmethod - def dictify(cls, obj, writer, to_extend, as_value=False, nullable=True): - cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend) - - StringIO.dictify(obj.operator, writer, to_extend, True, False) - - args = [] - if obj.other is None: - if isinstance(obj.value, ListType): - args = obj.value - else: - args.append(obj.value) - else: - args.append(obj.value) - args.append(obj.other) - - to_extend.extend(int32_pack(len(args))) - for a in args: - writer.to_dict(a, to_extend) - - return to_extend - - +# todo: to be removed when updated with bulking in list class BulkSetDeserializer(_GraphBinaryTypeIO): graphbinary_type = DataType.bulkset @@ -1067,78 +742,6 @@ class BulkSetDeserializer(_GraphBinaryTypeIO): return the_list -class MetricsDeserializer(_GraphBinaryTypeIO): - - graphbinary_type = DataType.metrics - - @classmethod - def objectify(cls, buff, reader, nullable=True): - return cls.is_null(buff, reader, cls._read_metrics, nullable) - - @classmethod - def _read_metrics(cls, b, r): - metricid = r.to_object(b, DataType.string, False) - name = r.to_object(b, DataType.string, False) - duration = r.to_object(b, DataType.long, nullable=False) - counts = r.to_object(b, DataType.map, nullable=False) - annotations = r.to_object(b, DataType.map, nullable=False) - metrics = r.to_object(b, DataType.list, nullable=False) - - return {"id": metricid, - "name": name, - "dur": duration, - "counts": counts, - "annotations": annotations, - "metrics": metrics} - - -class TraversalMetricsDeserializer(_GraphBinaryTypeIO): - - graphbinary_type = DataType.traversalmetrics - - @classmethod - def objectify(cls, buff, reader, nullable=True): - return cls.is_null(buff, reader, cls._read_traversalmetrics, nullable) - - @classmethod - def _read_traversalmetrics(cls, b, r): - duration = r.to_object(b, DataType.long, nullable=False) - metrics = r.to_object(b, DataType.list, nullable=False) - - return {"dur": duration, - "metrics": metrics} - - -class ClassSerializer(_GraphBinaryTypeIO): - graphbinary_type = DataType.clazz - python_type = GremlinType - - @classmethod - def dictify(cls, obj, writer, to_extend, as_value=False, nullable=True): - cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend) - StringIO.dictify(obj.gremlin_type, writer, to_extend, True, False) - return to_extend - - -class TraversalStrategySerializer(_GraphBinaryTypeIO): - graphbinary_type = DataType.traversalstrategy - python_type = TraversalStrategy - - @classmethod - def dictify(cls, obj, writer, to_extend, as_value=False, nullable=True): - cls.prefix_bytes(cls.graphbinary_type, as_value, nullable, to_extend) - - ClassSerializer.dictify(GremlinType(obj.fqcn), writer, to_extend, True, False) - conf = {k: cls._convert(v) for k, v in obj.configuration.items()} - MapIO.dictify(conf, writer, to_extend, True, False) - - return to_extend - - @classmethod - def _convert(cls, v): - return v.bytecode if isinstance(v, Traversal) else v - - class DurationIO(_GraphBinaryTypeIO): python_type = timedelta graphbinary_type = DataType.duration diff --git a/gremlin-python/src/main/python/radish/gremlin.py b/gremlin-python/src/main/python/radish/gremlin.py index e743770e98..448717fee9 100644 --- a/gremlin-python/src/main/python/radish/gremlin.py +++ b/gremlin-python/src/main/python/radish/gremlin.py @@ -522,13 +522,6 @@ world.gremlins = { 'g_addVXpersonX_propertyXname_markoX_propertyXfriendWeight_null_acl_nullX': [(lambda g:g.add_v('person').property('name', 'marko').property('friendWeight', None, 'acl', None)), (lambda g:g.V().has('person', 'name', 'marko').has('friendWeight', None)), (lambda g:g.V().has('person', 'name', 'marko').properties('friendWeight').has('acl', None)), (lambda g:g.V().has('person', 'name', 'marko').properties('friendWeight').count())], 'g_V_hasXperson_name_aliceX_propertyXsingle_age_unionXage_constantX1XX_sumX': [(lambda g:g.add_v('person').property('name', 'alice').property(Cardinality.single, 'age', 50)), (lambda g:g.V().has('person', 'name', 'alice').property('age', __.union(__.values('age'), __.constant(1)).sum_())), (lambda g:g.V().has('person', 'age', 50)), (lambda g:g.V().has('person', 'age', 51))], 'g_V_limitX3X_addVXsoftwareX_aggregateXa1X_byXlabelX_aggregateXa2X_byXlabelX_capXa1_a2X_selectXa_bX_byXunfoldX_foldX': [(lambda g:g.add_v('person').property('name', 'marko').property('age', 29).as_('marko').add_v('person').property('name', 'vadas').property('age', 27).as_('vadas').add_v('software').property('name', 'lop').property('lang', 'java').as_('lop').add_v('person').property('name', 'josh').property('age', 32).as_('josh').add_v('software').property('name', 'ripple').property(' [...] - 'g_injectXstrX_asDate': [(lambda g:g.inject('2023-08-02T00:00:00Z').as_date())], - 'g_injectX1694017707000X_asDate': [(lambda g:g.inject(long(1694017707000)).as_date())], - 'g_injectX1694017708000LX_asDate': [(lambda g, xx1=None:g.inject(xx1).as_date())], - 'g_injectX1694017709000dX_asDate': [(lambda g, xx1=None:g.inject(xx1).as_date())], - 'g_injectX1_2X_asDate': [(lambda g, xx1=None:g.inject(xx1).as_date())], - 'g_injectXnullX_asDate': [(lambda g:g.inject(None).as_date())], - 'g_injectXinvalidstrX_asDate': [(lambda g:g.inject('This String is not an ISO 8601 Date').as_date())], 'g_injectX1_2X_asString': [(lambda g, xx1=None,xx2=None:g.inject(xx1, xx2).as_string())], 'g_injectX1_2X_asStringXlocalX': [(lambda g, xx1=None,xx2=None:g.inject(xx1, xx2).as_string(Scope.local))], 'g_injectXlist_1_2X_asStringXlocalX': [(lambda g, xx1=None:g.inject(xx1).as_string(Scope.local))], @@ -635,12 +628,6 @@ world.gremlins = { 'g_V_order_byXnoX_count': [(lambda g:g.V().order().by('no').count())], 'g_V_group_byXlabelX_count': [(lambda g:g.V().group().by(T.label).count())], 'g_V_group_byXlabelX_countXlocalX': [(lambda g:g.V().group().by(T.label).count(Scope.local))], - 'g_injectXdatetimeXstrXX_dateAddXDT_hour_2X': [(lambda g:g.inject(datetime.datetime.utcfromtimestamp(1690934400000 / 1000.0)).date_add(DT.hour, 2))], - 'g_injectXdatetimeXstrXX_dateAddXhour_2X': [(lambda g:g.inject(datetime.datetime.utcfromtimestamp(1690934400000 / 1000.0)).date_add(DT.hour, 2))], - 'g_injectXdatetimeXstrXX_dateAddXhour_1X': [(lambda g:g.inject(datetime.datetime.utcfromtimestamp(1690934400000 / 1000.0)).date_add(DT.hour, -1))], - 'g_injectXdatetimeXstrXX_dateAddXminute_10X': [(lambda g:g.inject(datetime.datetime.utcfromtimestamp(1690934400000 / 1000.0)).date_add(DT.minute, 10))], - 'g_injectXdatetimeXstrXX_dateAddXsecond_20X': [(lambda g:g.inject(datetime.datetime.utcfromtimestamp(1690934400000 / 1000.0)).date_add(DT.second, 20))], - 'g_injectXdatetimeXstrXX_dateAddXday_11X': [(lambda g:g.inject(datetime.datetime.utcfromtimestamp(1693958400000 / 1000.0)).date_add(DT.day, 11))], 'g_injectXdatetimeXstr1XX_dateDiffXdatetimeXstr2XX': [(lambda g:g.inject(datetime.datetime.utcfromtimestamp(1690934400000 / 1000.0)).date_diff(datetime.datetime.utcfromtimestamp(1691539200000 / 1000.0)))], 'g_injectXdatetimeXstr1XX_dateDiffXconstantXdatetimeXstr2XXX': [(lambda g:g.inject(datetime.datetime.utcfromtimestamp(1691452800000 / 1000.0)).date_diff(__.constant(datetime.datetime.utcfromtimestamp(1690848000000 / 1000.0))))], 'g_injectXdatetimeXstr1XX_dateDiffXinjectXdatetimeXstr2XXX': [(lambda g:g.inject(datetime.datetime.utcfromtimestamp(1691452800000 / 1000.0)).date_diff(__.inject(datetime.datetime.utcfromtimestamp(1696982400000 / 1000.0))))], diff --git a/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection.py b/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection.py index 35f3c63130..7262042e0d 100644 --- a/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection.py +++ b/gremlin-python/src/main/python/tests/driver/test_driver_remote_connection.py @@ -19,10 +19,9 @@ import os from datetime import datetime -import pytest from gremlin_python import statics from gremlin_python.statics import long -from gremlin_python.process.traversal import TraversalStrategy, P, Order, T, Parameter +from gremlin_python.process.traversal import TraversalStrategy, P, Order, T, DT, Parameter, Cardinality from gremlin_python.process.graph_traversal import __ from gremlin_python.process.anonymous_traversal import traversal from gremlin_python.structure.graph import Vertex @@ -36,6 +35,10 @@ test_no_auth_url = gremlin_server_url.format(45940) class TestDriverRemoteConnection(object): + # def test_test(self, remote_connection): + # g = traversal().with_(remote_connection) + # print(g.inject(datetime.utcfromtimestamp(1690934400000 / 1000.0)).date_add(DT.hour, 2).to_list()) + def test_extract_request_options(self, remote_connection): g = traversal().with_(remote_connection) t = g.with_("evaluationTimeout", 1000).with_("batchSize", 100).V().count() @@ -84,10 +87,11 @@ class TestDriverRemoteConnection(object): assert 'josh' in results assert 'peter' in results # # - results = g.V().out().profile().to_list() - assert 1 == len(results) - assert 'metrics' in results[0] - assert 'dur' in results[0] + # # todo: enable when profile/explain serialization is implemented + # results = g.V().out().profile().to_list() + # assert 1 == len(results) + # assert 'metrics' in results[0] + # assert 'dur' in results[0] # # results = g.V().has('name', 'peter').as_('a').out('created').as_('b').select('a', 'b').by( __.value_map()).to_list() diff --git a/gremlin-python/src/main/python/tests/process/test_traversal.py b/gremlin-python/src/main/python/tests/process/test_traversal.py index a87f465e00..c7f64a5990 100644 --- a/gremlin-python/src/main/python/tests/process/test_traversal.py +++ b/gremlin-python/src/main/python/tests/process/test_traversal.py @@ -28,7 +28,6 @@ from gremlin_python.driver.driver_remote_connection import DriverRemoteConnectio from gremlin_python.structure.graph import Graph from gremlin_python.process.anonymous_traversal import traversal from gremlin_python.process.traversal import P, Direction -from gremlin_python.process.traversal import Binding, Bindings from gremlin_python.process.graph_traversal import __ gremlin_server_url = os.environ.get('GREMLIN_SERVER_URL', 'ws://localhost:{}/gremlin') diff --git a/gremlin-python/src/main/python/tests/structure/io/test_functionalityio.py b/gremlin-python/src/main/python/tests/structure/io/test_functionalityio.py index 8ca18f1652..5f8c2de196 100644 --- a/gremlin-python/src/main/python/tests/structure/io/test_functionalityio.py +++ b/gremlin-python/src/main/python/tests/structure/io/test_functionalityio.py @@ -81,7 +81,7 @@ def test_vertex_vertex_properties(remote_connection_crew): assert vertex.properties[1].properties[1].value == 2000 [email protected](reason="proposing to be removed in GraphBinaryV4") [email protected](reason="timestamp replaced by datetime in GraphBinaryV4, revisit to update after implementation") def test_timestamp(remote_connection): g = traversal().with_(remote_connection) ts = timestamp(1481750076295 / 1000) @@ -96,6 +96,7 @@ def test_timestamp(remote_connection): g.V(vid).drop().iterate() [email protected](reason="timestamp replaced by datetime in GraphBinaryV4, revisit to update after implementation") def test_datetime(remote_connection): g = traversal().with_(remote_connection) dt = datetime.datetime.utcfromtimestamp(1481750076295 / 1000) diff --git a/gremlin-python/src/main/python/tests/structure/io/test_graphbinaryV4.py b/gremlin-python/src/main/python/tests/structure/io/test_graphbinaryV4.py index a8e970b6d5..0702895ac4 100644 --- a/gremlin-python/src/main/python/tests/structure/io/test_graphbinaryV4.py +++ b/gremlin-python/src/main/python/tests/structure/io/test_graphbinaryV4.py @@ -24,7 +24,7 @@ import math from gremlin_python.statics import timestamp, long, bigint, BigDecimal, SingleByte, SingleChar, ByteBufferType from gremlin_python.structure.graph import Vertex, Edge, Property, VertexProperty, Path from gremlin_python.structure.io.graphbinaryV4 import GraphBinaryWriter, GraphBinaryReader -from gremlin_python.process.traversal import Barrier, Binding, Bytecode, Merge, Direction +from gremlin_python.process.traversal import Direction from gremlin_python.structure.io.util import Marker @@ -79,11 +79,6 @@ class TestGraphBinaryV4(object): assert x.scale == output.scale assert x.unscaled_value == output.unscaled_value - def test_date(self): - x = datetime.datetime(2016, 12, 14, 16, 14, 36, 295000) - output = self.graphbinary_reader.read_object(self.graphbinary_writer.write_object(x)) - assert x == output - def test_timestamp(self): x = timestamp(1481750076295 / 1000) output = self.graphbinary_reader.read_object(self.graphbinary_writer.write_object(x)) @@ -168,16 +163,6 @@ class TestGraphBinaryV4(object): x = VertexProperty(123, "name", "stephen", None) output = self.graphbinary_reader.read_object(self.graphbinary_writer.write_object(x)) assert x == output - - def test_barrier(self): - x = Barrier.norm_sack - output = self.graphbinary_reader.read_object(self.graphbinary_writer.write_object(x)) - assert x == output - - def test_merge(self): - x = Merge.on_match - output = self.graphbinary_reader.read_object(self.graphbinary_writer.write_object(x)) - assert x == output def test_direction(self): x = Direction.OUT @@ -188,19 +173,6 @@ class TestGraphBinaryV4(object): output = self.graphbinary_reader.read_object(self.graphbinary_writer.write_object(x)) assert x == output - def test_binding(self): - x = Binding("name", "marko") - output = self.graphbinary_reader.read_object(self.graphbinary_writer.write_object(x)) - assert x == output - - def test_bytecode(self): - x = Bytecode() - x.source_instructions.append(["withStrategies", "SubgraphStrategy"]) - x.step_instructions.append(["V", 1, 2, 3]) - x.step_instructions.append(["out"]) - output = self.graphbinary_reader.read_object(self.graphbinary_writer.write_object(x)) - assert x == output - def test_byte(self): x = int.__new__(SingleByte, 1) output = self.graphbinary_reader.read_object(self.graphbinary_writer.write_object(x)) diff --git a/gremlin-python/src/main/python/tests/structure/io/test_graphbinaryv4model.py b/gremlin-python/src/main/python/tests/structure/io/test_graphbinaryv4model.py index d92d974b31..9515ba6902 100644 --- a/gremlin-python/src/main/python/tests/structure/io/test_graphbinaryv4model.py +++ b/gremlin-python/src/main/python/tests/structure/io/test_graphbinaryv4model.py @@ -16,6 +16,7 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ +import pytest """ Round trip testing of GraphBinaryV4 compared to a correct "model". @@ -145,6 +146,7 @@ def test_var_type_list(): def test_empty_list(): run("empty-list") [email protected](reason="Date has been removed in GraphBinary, need to update test files") def test_var_type_map(): # can't write tuple run_read("var-type-map") diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/OrderabilityTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/OrderabilityTest.java index e99812aca6..4bbf99e048 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/OrderabilityTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/OrderabilityTest.java @@ -28,6 +28,7 @@ import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Property; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.util.CollectionUtil; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -177,6 +178,7 @@ public abstract class OrderabilityTest extends AbstractGremlinProcessTest { * Mixed type values including list, set, map, uuid, date, boolean, numeric, string, null. */ @Test + @Ignore // todo: re-enable after datetime serialization is implemented @FeatureRequirement(featureClass = GraphFeatures.class, feature = GraphFeatures.FEATURE_ORDERABILITY_SEMANTICS) public void g_inject_order() { final Traversal traversal = get_g_inject_order(); diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/EarlyLimitStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/EarlyLimitStrategyProcessTest.java index 2bf5c42c65..75792ba1ac 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/EarlyLimitStrategyProcessTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/EarlyLimitStrategyProcessTest.java @@ -28,6 +28,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalMetrics; import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -49,6 +50,7 @@ public class EarlyLimitStrategyProcessTest extends AbstractGremlinProcessTest { @Test @LoadGraphWith(GRATEFUL) @IgnoreEngine(TraversalEngine.Type.COMPUTER) + @Ignore // todo: re-enable after traversal metrics serialization is implemented public void shouldHandleRangeSteps() throws Exception { final GraphTraversal<Vertex, Map<String, List<String>>> t = diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/AsDate.feature b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/AsDate.feature index a410fd70e7..122be0dff7 100644 --- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/AsDate.feature +++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/AsDate.feature @@ -15,86 +15,87 @@ # specific language governing permissions and limitations # under the License. +# todo: re-enable after datetime is implemented @StepClassMap @StepAsDate Feature: Step - asDate() - - @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectXstrX_asDate - Given the empty graph - And the traversal of - """ - g.inject("2023-08-02T00:00:00Z").asDate() - """ - When iterated to list - Then the result should be unordered - | result | - | dt[2023-08-02T00:00:00Z] | - - @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectX1694017707000X_asDate - Given the empty graph - And the traversal of - """ - g.inject(1694017707000).asDate() - """ - When iterated to list - Then the result should be unordered - | result | - | dt[2023-09-06T16:28:27Z] | - - @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectX1694017708000LX_asDate - Given the empty graph - And using the parameter xx1 defined as "d[1694017708000].l" - And the traversal of - """ - g.inject(xx1).asDate() - """ - When iterated to list - Then the result should be unordered - | result | - | dt[2023-09-06T16:28:28Z] | - - @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectX1694017709000dX_asDate - Given the empty graph - And using the parameter xx1 defined as "d[1694017709000.1].d" - And the traversal of - """ - g.inject(xx1).asDate() - """ - When iterated to list - Then the result should be unordered - | result | - | dt[2023-09-06T16:28:29Z] | - - @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectX1_2X_asDate - Given the empty graph - And using the parameter xx1 defined as "l[1,2]" - And the traversal of - """ - g.inject(xx1).asDate() - """ - When iterated to list - Then the traversal will raise an error with message containing text of "Can't parse" - - @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectXnullX_asDate - Given the empty graph - And the traversal of - """ - g.inject(null).asDate() - """ - When iterated to list - Then the traversal will raise an error with message containing text of "Can't parse" - - @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectXinvalidstrX_asDate - Given the empty graph - And the traversal of - """ - g.inject('This String is not an ISO 8601 Date').asDate() - """ - When iterated to list - Then the traversal will raise an error with message containing text of "Can't parse" \ No newline at end of file +# +# @GraphComputerVerificationInjectionNotSupported +# Scenario: g_injectXstrX_asDate +# Given the empty graph +# And the traversal of +# """ +# g.inject("2023-08-02T00:00:00Z").asDate() +# """ +# When iterated to list +# Then the result should be unordered +# | result | +# | dt[2023-08-02T00:00:00Z] | +# +# @GraphComputerVerificationInjectionNotSupported +# Scenario: g_injectX1694017707000X_asDate +# Given the empty graph +# And the traversal of +# """ +# g.inject(1694017707000).asDate() +# """ +# When iterated to list +# Then the result should be unordered +# | result | +# | dt[2023-09-06T16:28:27Z] | +# +# @GraphComputerVerificationInjectionNotSupported +# Scenario: g_injectX1694017708000LX_asDate +# Given the empty graph +# And using the parameter xx1 defined as "d[1694017708000].l" +# And the traversal of +# """ +# g.inject(xx1).asDate() +# """ +# When iterated to list +# Then the result should be unordered +# | result | +# | dt[2023-09-06T16:28:28Z] | +# +# @GraphComputerVerificationInjectionNotSupported +# Scenario: g_injectX1694017709000dX_asDate +# Given the empty graph +# And using the parameter xx1 defined as "d[1694017709000.1].d" +# And the traversal of +# """ +# g.inject(xx1).asDate() +# """ +# When iterated to list +# Then the result should be unordered +# | result | +# | dt[2023-09-06T16:28:29Z] | +# +# @GraphComputerVerificationInjectionNotSupported +# Scenario: g_injectX1_2X_asDate +# Given the empty graph +# And using the parameter xx1 defined as "l[1,2]" +# And the traversal of +# """ +# g.inject(xx1).asDate() +# """ +# When iterated to list +# Then the traversal will raise an error with message containing text of "Can't parse" +# +# @GraphComputerVerificationInjectionNotSupported +# Scenario: g_injectXnullX_asDate +# Given the empty graph +# And the traversal of +# """ +# g.inject(null).asDate() +# """ +# When iterated to list +# Then the traversal will raise an error with message containing text of "Can't parse" +# +# @GraphComputerVerificationInjectionNotSupported +# Scenario: g_injectXinvalidstrX_asDate +# Given the empty graph +# And the traversal of +# """ +# g.inject('This String is not an ISO 8601 Date').asDate() +# """ +# When iterated to list +# Then the traversal will raise an error with message containing text of "Can't parse" \ No newline at end of file diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/DateAdd.feature b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/DateAdd.feature index 6bd3fc6c9d..c22dae07f2 100644 --- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/DateAdd.feature +++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/DateAdd.feature @@ -15,77 +15,78 @@ # specific language governing permissions and limitations # under the License. +# todo: re-enable after datetime is implemented @StepClassMap @StepDateAdd Feature: Step - dateAdd() - - @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectXdatetimeXstrXX_dateAddXDT_hour_2X - Given the empty graph - And the traversal of - """ - g.inject(datetime('2023-08-02T00:00:00Z')).dateAdd(DT.hour, 2) - """ - When iterated to list - Then the result should be unordered - | result | - | dt[2023-08-02T02:00:00Z] | - - @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectXdatetimeXstrXX_dateAddXhour_2X - Given the empty graph - And the traversal of - """ - g.inject(datetime('2023-08-02T00:00:00Z')).dateAdd(hour, 2) - """ - When iterated to list - Then the result should be unordered - | result | - | dt[2023-08-02T02:00:00Z] | - - @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectXdatetimeXstrXX_dateAddXhour_1X - Given the empty graph - And the traversal of - """ - g.inject(datetime('2023-08-02T00:00:00Z')).dateAdd(hour, -1) - """ - When iterated to list - Then the result should be unordered - | result | - | dt[2023-08-01T23:00:00Z] | - - @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectXdatetimeXstrXX_dateAddXminute_10X - Given the empty graph - And the traversal of - """ - g.inject(datetime('2023-08-02T00:00:00Z')).dateAdd(minute, 10) - """ - When iterated to list - Then the result should be unordered - | result | - | dt[2023-08-02T00:10:00Z] | - - @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectXdatetimeXstrXX_dateAddXsecond_20X - Given the empty graph - And the traversal of - """ - g.inject(datetime('2023-08-02T00:00:00Z')).dateAdd(second, 20) - """ - When iterated to list - Then the result should be unordered - | result | - | dt[2023-08-02T00:00:20Z] | - - @GraphComputerVerificationInjectionNotSupported - Scenario: g_injectXdatetimeXstrXX_dateAddXday_11X - Given the empty graph - And the traversal of - """ - g.inject(datetime('2023-09-06T00:00:00Z')).dateAdd(day, 11) - """ - When iterated to list - Then the result should be unordered - | result | - | dt[2023-09-17T00:00:00Z] | +# +# @GraphComputerVerificationInjectionNotSupported +# Scenario: g_injectXdatetimeXstrXX_dateAddXDT_hour_2X +# Given the empty graph +# And the traversal of +# """ +# g.inject(datetime('2023-08-02T00:00:00Z')).dateAdd(DT.hour, 2) +# """ +# When iterated to list +# Then the result should be unordered +# | result | +# | dt[2023-08-02T02:00:00Z] | +# +# @GraphComputerVerificationInjectionNotSupported +# Scenario: g_injectXdatetimeXstrXX_dateAddXhour_2X +# Given the empty graph +# And the traversal of +# """ +# g.inject(datetime('2023-08-02T00:00:00Z')).dateAdd(hour, 2) +# """ +# When iterated to list +# Then the result should be unordered +# | result | +# | dt[2023-08-02T02:00:00Z] | +# +# @GraphComputerVerificationInjectionNotSupported +# Scenario: g_injectXdatetimeXstrXX_dateAddXhour_1X +# Given the empty graph +# And the traversal of +# """ +# g.inject(datetime('2023-08-02T00:00:00Z')).dateAdd(hour, -1) +# """ +# When iterated to list +# Then the result should be unordered +# | result | +# | dt[2023-08-01T23:00:00Z] | +# +# @GraphComputerVerificationInjectionNotSupported +# Scenario: g_injectXdatetimeXstrXX_dateAddXminute_10X +# Given the empty graph +# And the traversal of +# """ +# g.inject(datetime('2023-08-02T00:00:00Z')).dateAdd(minute, 10) +# """ +# When iterated to list +# Then the result should be unordered +# | result | +# | dt[2023-08-02T00:10:00Z] | +# +# @GraphComputerVerificationInjectionNotSupported +# Scenario: g_injectXdatetimeXstrXX_dateAddXsecond_20X +# Given the empty graph +# And the traversal of +# """ +# g.inject(datetime('2023-08-02T00:00:00Z')).dateAdd(second, 20) +# """ +# When iterated to list +# Then the result should be unordered +# | result | +# | dt[2023-08-02T00:00:20Z] | +# +# @GraphComputerVerificationInjectionNotSupported +# Scenario: g_injectXdatetimeXstrXX_dateAddXday_11X +# Given the empty graph +# And the traversal of +# """ +# g.inject(datetime('2023-09-06T00:00:00Z')).dateAdd(day, 11) +# """ +# When iterated to list +# Then the result should be unordered +# | result | +# | dt[2023-09-17T00:00:00Z] | diff --git a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java index 02f8936b28..e16e189800 100644 --- a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java +++ b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java @@ -533,7 +533,8 @@ public abstract class AbstractTypedCompatibilityTest extends AbstractCompatibili assertEquals(resource, recycled); } - @Test + // todo: map contains removed date type, revisit after datetime is properly implemented + // @Test public void shouldReadWriteMultiTypeMap() throws Exception { final String resourceName = "var-type-map"; @@ -557,8 +558,8 @@ public abstract class AbstractTypedCompatibilityTest extends AbstractCompatibili assertEquals(resource, recycled); } - - @Test + // todo: re-visit after datetime is properly implemented + // @Test public void shouldReadWriteMaxOffsetDateTime() throws Exception { final String resourceName = "max-offsetdatetime"; @@ -571,7 +572,8 @@ public abstract class AbstractTypedCompatibilityTest extends AbstractCompatibili assertEquals(resource, recycled); } - @Test + // todo: re-visit after datetime is properly implemented + // @Test public void shouldReadWriteMinOffsetDateTime() throws Exception { final String resourceName = "min-offsetdatetime"; diff --git a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/AbstractRoundTripTest.java b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/AbstractRoundTripTest.java index 5ac7125a0b..c1bcc66529 100644 --- a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/AbstractRoundTripTest.java +++ b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/AbstractRoundTripTest.java @@ -179,56 +179,14 @@ public abstract class AbstractRoundTripTest { new Object[] {"BigDecimalNeg", new BigDecimal("-1234567890987654321.1232132"), null}, // date+time - new Object[] {"Date", DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.US).parse("Jan 12, 1952"), null}, - new Object[] {"Timestamp", Timestamp.valueOf("2016-01-15 12:01:02"), null}, new Object[] {"Duration", Duration.ofSeconds(213123213, 400), null}, - new Object[] {"Instant", Instant.ofEpochSecond(213123213, 400), null}, - new Object[] {"LocalDate", LocalDate.of(2016, 10, 21), null}, - new Object[] {"LocalTime", LocalTime.of(12, 20, 30, 300), null}, - new Object[] {"LocalDateTime", LocalDateTime.of(2016, 10, 21, 12, 20, 30, 300), null}, - new Object[] {"MonthDay", MonthDay.of(12, 28), null}, - new Object[] {"OffsetDateTime", OffsetDateTime.of(2017, 11, 15, 12, 30, 45, 300, ZoneOffset.ofTotalSeconds(400)), null}, - new Object[] {"OffsetTime", OffsetTime.of(12, 30, 45, 300, ZoneOffset.ofTotalSeconds(400)), null}, - new Object[] {"Period", Period.of(1, 6, 15), null}, - new Object[] {"Year", Year.of(1996), null}, - new Object[] {"YearMonth", YearMonth.of(2016, 11), null}, - new Object[] {"ZonedDateTime", ZonedDateTime.of(2016, 11, 15, 12, 30, 45, 300, ZoneOffset.ofTotalSeconds(200)), null}, - new Object[] {"ZoneOffset", ZoneOffset.ofTotalSeconds(100), null}, new Object[] {"UUID", UUID.randomUUID(), null}, - new Object[] {"Traverser", new DefaultRemoteTraverser<>("marko", 100), null}, - new Object[] {"Class", GremlinLang.class, null}, new Object[] {"ByteBuffer", ByteBuffer.wrap(new byte[]{ 1, 2, 3 }), null}, - new Object[] {"InetAddressV4", InetAddress.getByName("localhost"), null}, - new Object[] {"InetAddressV6", InetAddress.getByName("::1"), null}, - new Object[] {"Lambda0", Lambda.supplier("return 1"), null}, - new Object[] {"Lambda1", Lambda.consumer("it"), null}, - new Object[] {"Lambda2", Lambda.biFunction("x,y -> x + y"), null}, - new Object[] {"LambdaN", new Lambda.UnknownArgLambda("x,y,z -> x + y + z", "gremlin-groovy", 3), null}, // enums - new Object[] {"Barrier", SackFunctions.Barrier.normSack, null}, - new Object[] {"Cardinality", VertexProperty.Cardinality.list, null}, - new Object[] {"Columns", Column.values, null}, new Object[] {"Direction", Direction.BOTH, null}, - new Object[] {"Operator", Operator.sum, null}, - new Object[] {"Operator", Operator.div, null}, - new Object[] {"Order", Order.desc, null}, - new Object[] {"Pick", Pick.any, null}, - new Object[] {"Pop", Pop.mixed, null}, - new Object[] {"Scope", Scope.global, null}, new Object[] {"T", T.label, null}, - new Object[] {"Pgt", P.gt(0), null}, - new Object[] {"Pgte", P.gte(0), null}, - new Object[] {"Pbetween", P.between(0,1), null}, - new Object[] {"Pand", P.gt(1).and(P.lt(2)), null}, - new Object[] {"Por", P.gt(1).or(P.lt(2)), null}, - new Object[] {"Pnot", P.not(P.lte(1)), null}, - new Object[] {"Pwithout", P.without(1,2,3,4,null), null}, - new Object[] {"Pinside", P.inside(0.0d, 0.6d), null}, - new Object[] {"TextPstartingWith", TextP.startingWith("mark"), null}, - new Object[] {"TextPregex", TextP.regex("^meh"), null}, - new Object[] {"TextPnotRegex", TextP.notRegex("^meh"), null}, // graph new Object[] {"ReferenceEdge", new ReferenceEdge(123, "person", new ReferenceVertex(123, "person"), new ReferenceVertex(321, "person")), null}, @@ -249,27 +207,8 @@ public abstract class AbstractRoundTripTest { new Object[] {"Graph", g.E().subgraph("k").cap("k").next(), (Consumer<Graph>) graph -> { IoTest.assertModernGraph(graph, true, false); }}, - new Object[] {"TraversalStrategyVertexProgram", new VertexProgramStrategy(Computer.compute()), (Consumer<TraversalStrategyProxy>) strategy -> { - assertEquals(VertexProgramStrategy.class, strategy.getStrategyClass()); - assertEquals("org.apache.tinkerpop.gremlin.process.computer.GraphComputer", strategy.getConfiguration().getProperty(VertexProgramStrategy.GRAPH_COMPUTER)); - }}, new Object[] {"BulkSet", bulkSet, null}, new Object[] {"Tree", tree, null}, - new Object[] {"EmptyMetrics", new MutableMetrics("idEmpty", "nameEmpty"), (Consumer<Metrics>) m -> { - assertThat(m, reflectionEquals(new MutableMetrics("idEmpty", "nameEmpty"))); - }}, - new Object[] {"Metrics", metrics, (Consumer<Metrics>) m -> { - assertThat(m, reflectionEquals(metrics, "nested", "counts")); - assertEquals(new ArrayList(metrics.getCounts().values()), new ArrayList(m.getCounts().values())); - assertThat(m.getNested(), reflectionEquals(metrics.getNested())); - }}, - new Object[] {"EmptyTraversalMetrics", emptyTraversalMetrics, (Consumer<TraversalMetrics>) m -> { - assertThat(m, reflectionEquals(emptyTraversalMetrics)); - }}, - new Object[] {"TraversalMetrics", traversalMetrics, (Consumer<TraversalMetrics>) m -> { - assertEquals(m.toString(), traversalMetrics.toString()); - assertThat(m, reflectionEquals(traversalMetrics, "stepIndexedMetrics", "positionIndexedMetrics")); - }}, // collections new Object[] {"ListSingle", list, null}, diff --git a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/binary/types/sample/SamplePersonSerializerTest.java b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/binary/types/sample/SamplePersonSerializerTest.java index 9e393a69ac..1f4924efd1 100644 --- a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/binary/types/sample/SamplePersonSerializerTest.java +++ b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/binary/types/sample/SamplePersonSerializerTest.java @@ -30,6 +30,7 @@ import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryIo; import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader; import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter; import org.apache.tinkerpop.gremlin.structure.io.binary.TypeSerializerRegistry; +import org.junit.Ignore; import org.junit.Test; import java.io.IOException; @@ -45,6 +46,8 @@ import static org.apache.tinkerpop.gremlin.util.ser.AbstractMessageSerializer.TO import static org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV4.TOKEN_CUSTOM; import static org.hamcrest.MatcherAssert.assertThat; +// todo: person contains removed date type, revisit after datetime is properly implemented +@Ignore public class SamplePersonSerializerTest { private static final ByteBufAllocator allocator = ByteBufAllocator.DEFAULT;
