Commit d42725f0 authored by Sascha Peukert's avatar Sascha Peukert
Browse files

Fix dedup regex pattern

This will fix neo4j/neo4j-java-driver#416
parent 5cf72157
Showing with 9 additions and 1 deletion
+9 -1
......@@ -28,7 +28,7 @@ import org.neo4j.cypher.internal.frontend.v3_1.SemanticDirection
object PlanDescriptionArgumentSerializer {
private val SEPARATOR = ", "
private val UNNAMED_PATTERN = """ (UNNAMED|FRESHID|AGGREGATION)(\d+)""".r
private val DEDUP_PATTERN = """ (.+)@\d+""".r
private val DEDUP_PATTERN = """ ([^\s]+)@\d+""".r
def serialize(arg: Argument): AnyRef = {
arg match {
......
......@@ -62,4 +62,12 @@ class PlanDescriptionArgumentSerializerTests extends CypherFunSuite {
serialize(LegacyExpressions(Map("1" -> Literal(42), "2" -> Literal(56)))) should equal(
"{1 : Literal(42), 2 : Literal(56)}")
}
test("serialize something that includes a regex should work") {
val value = "GenericCase(Vector((any( x@40 in n.values where x@40 =~ Literal(^T-?\\d+$)),SubstringFunction(ContainerIndex(FilterFunction(n.values, x@106, x@106 =~ Literal(^T-?\\d+$)),Literal(0)),Literal(1),None))),Some(Literal(1))) == {p0}"
serialize(KeyNames(Seq(value))) should equal (
"GenericCase(Vector((any(x in n.values where x =~ Literal(^T-?\\d+$)),SubstringFunction(ContainerIndex(FilterFunction(n.values,x,x =~ Literal(^T-?\\d+$)),Literal(0)),Literal(1),None))),Some(Literal(1))) == {p0}"
)
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment