Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Neo4jsource
Commits
402a6dd9
Commit
402a6dd9
authored
7 years ago
by
fickludd
Committed by
Johan Teleman
7 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Fix bug with slot allocation of foreach with missing type information
parent
11e17e7b
4.4
3.4
3.5
4.0
4.1
4.2
4.2-pipelined
4.3
5.0
5.1
5.2
akollegger-patch-1
issue-management-update
revert-12892-feature/upd
5.2.0
5.1.0
5.0.0
4.4.14
4.4.13
4.4.12
4.4.11
4.4.10
4.4.9
4.4.8
4.4.7
4.4.6
4.4.5
4.4.4
4.4.3
4.4.2
4.4.1
4.4.0
4.4.0-alpha01
4.3.21
4.3.20
4.3.19
4.3.18
4.3.17
4.3.16
4.3.15
4.3.14
4.3.13
4.3.12
4.3.11
4.3.10
4.3.9
4.3.8
4.3.7
4.3.6
4.3.5
4.3.4
4.3.3
4.3.2
4.3.1
4.3.0
4.2.19
4.2.18
4.2.17
4.2.16
4.2.15
4.2.14
4.2.13
4.2.12
4.2.11
4.2.10
4.2.9
4.2.8
4.2.7
4.2.6
4.2.5
4.2.4
4.2.3
4.2.2
4.2.1
4.2.0
4.1.12
4.1.11
4.1.10
4.1.9
4.1.8
4.1.7
4.1.6
4.1.5
4.1.4
4.1.3
4.1.2
4.1.1
4.1.0
4.1.0-alpha01
4.0.12
4.0.11
4.0.10
4.0.9
4.0.8
4.0.7
4.0.6
4.0.5
4.0.4
4.0.3
4.0.2
4.0.1
4.0.0
4.0.0-rc01
4.0.0-beta03mr03
4.0.0-beta02
4.0.0-beta01
4.0.0-alpha10
4.0.0-alpha09mr02
4.0.0-alpha08
4.0.0-alpha07mr01
4.0.0-alpha06
4.0.0-alpha05
4.0.0-alpha04
4.0.0-alpha03
4.0.0-alpha02
4.0.0-alpha01
3.5.35
3.5.34
3.5.33
3.5.32
3.5.31
3.5.30
3.5.29
3.5.28
3.5.27
3.5.26
3.5.25
3.5.24
3.5.23
3.5.22
3.5.21
3.5.20
3.5.19
3.5.18
3.5.17
3.5.16
3.5.15
3.5.14
3.5.13
3.5.12
3.5.11
3.5.9
3.5.8
3.5.7
3.5.6
3.5.5
3.5.4
3.5.3
3.5.2
3.5.1
3.5.0
3.5.0-rc01
3.5.0-beta03
3.5.0-beta02
3.5.0-beta01
3.5.0-alpha09
3.5.0-alpha08
3.5.0-alpha07
3.5.0-alpha06
3.5.0-alpha05
3.5.0-alpha04
3.4.18
3.4.17
3.4.16
3.4.15
3.4.14
3.4.13
3.4.12
3.4.11
3.4.10
3.4.9
3.4.8
3.4.7
3.4.6
3.4.5
3.4.4
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
community/cypher/frontend-3.4/src/main/scala/org/neo4j/cypher/internal/frontend/v3_4/semantics/SemanticTable.scala
+1
-2
...pher/internal/frontend/v3_4/semantics/SemanticTable.scala
enterprise/cypher/acceptance-spec-suite/src/test/scala/org/neo4j/internal/cypher/acceptance/ForeachAcceptanceTest.scala
+14
-0
...4j/internal/cypher/acceptance/ForeachAcceptanceTest.scala
enterprise/cypher/physical-planning/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_4/runtime/SlotAllocation.scala
+7
-7
.../internal/compatibility/v3_4/runtime/SlotAllocation.scala
with
22 additions
and
9 deletions
+22
-9
community/cypher/frontend-3.4/src/main/scala/org/neo4j/cypher/internal/frontend/v3_4/semantics/SemanticTable.scala
+
1
-
2
View file @
402a6dd9
...
...
@@ -51,8 +51,7 @@ class SemanticTable(
throw
new
InternalException
(
s
"Did not find any type information for variable $s"
,
e
)
}
def
getActualTypeFor
(
expr
:
Expression
)
:
TypeSpec
=
types
.
getOrElse
(
expr
,
throw
new
InternalException
(
s
"Did not find any type information for expression $expr"
)).
actual
def
getActualTypeFor
(
expr
:
Expression
)
:
Option
[
TypeSpec
]
=
types
.
get
(
expr
).
map
(
_
.
actual
)
def
containsNode
(
expr
:
String
)
:
Boolean
=
types
.
exists
{
case
(
v
@Variable
(
name
),
_
)
=>
name
==
expr
&&
isNode
(
v
)
// NOTE: Profiling showed that checking node type last is better
...
...
This diff is collapsed.
Click to expand it.
enterprise/cypher/acceptance-spec-suite/src/test/scala/org/neo4j/internal/cypher/acceptance/ForeachAcceptanceTest.scala
+
14
-
0
View file @
402a6dd9
...
...
@@ -201,4 +201,18 @@ class ForeachAcceptanceTest extends ExecutionEngineFunSuite with CypherCompariso
TestConfiguration
(
Versions
(
Versions
.
V3_1
,
Versions
.
V3_3
),
Planners
.
Cost
,
Runtimes
.
Default
)
failWithError
(
config
,
query
,
List
(
"Expected to find a node at"
))
}
test
(
"should FOREACH over nodes in path"
)
{
val
a
=
createNode
()
val
b
=
createNode
()
relate
(
a
,
b
)
val
query
=
"""MATCH p = ()-->()
|FOREACH (n IN nodes(p) | SET n.marked = true)"""
.
stripMargin
val
result
=
executeWith
(
Configs
.
Interpreted
-
Configs
.
Cost2_3
,
query
)
assertStats
(
result
,
propertiesWritten
=
2
)
}
}
This diff is collapsed.
Click to expand it.
enterprise/cypher/physical-planning/src/main/scala/org/neo4j/cypher/internal/compatibility/v3_4/runtime/SlotAllocation.scala
+
7
-
7
View file @
402a6dd9
...
...
@@ -58,7 +58,7 @@ object SlotAllocation {
argumentSizes
:
ArgumentSizes
)
/**
* Allocate slot for every operator in the logical plan tree
{@code
lp
}
.
* Allocate slot for every operator in the logical plan tree
`
lp
`
.
*
* @param lp the logical plan to process.
* @return the slot configurations of every operator.
...
...
@@ -245,7 +245,7 @@ object SlotAllocation {
}
/**
* Compute the slot configuration of a leaf logical plan operator
{@code
lp
}
.
* Compute the slot configuration of a leaf logical plan operator
`
lp
`
.
*
* @param lp the operator to compute slots for.
* @param nullable true if new slots are nullable
...
...
@@ -290,7 +290,7 @@ object SlotAllocation {
}
/**
* Compute the slot configuration of a single source logical plan operator
{@code
lp
}
.
* Compute the slot configuration of a single source logical plan operator
`
lp
`
.
*
* @param lp the operator to compute slots for.
* @param nullable true if new slots are nullable
...
...
@@ -502,7 +502,7 @@ object SlotAllocation {
}
/**
* Compute the slot configuration of a branching logical plan operator
{@code
lp
}
.
* Compute the slot configuration of a branching logical plan operator
`
lp
`
.
*
* @param lp the operator to compute slots for.
* @param nullable true if new slots are nullable
...
...
@@ -655,9 +655,9 @@ object SlotAllocation {
case
ForeachApply
(
_
,
_
,
variableName
,
listExpression
)
=>
// The slot for the iteration variable of foreach needs to be available as an argument on the rhs of the apply
// so we allocate it on the lhs (even though its value will not be needed after the foreach is done)
val
t
ypeSpec
=
semanticTable
.
getActualTypeFor
(
listExpression
)
val
listOfNodes
=
t
ypeSpec
.
contains
(
ListType
(
CTNode
))
val
listOfRels
=
t
ypeSpec
.
contains
(
ListType
(
CTRelationship
))
val
maybeT
ypeSpec
=
semanticTable
.
getActualTypeFor
(
listExpression
)
val
listOfNodes
=
maybeT
ypeSpec
.
exists
(
_
.
contains
(
ListType
(
CTNode
))
)
val
listOfRels
=
maybeT
ypeSpec
.
exists
(
_
.
contains
(
ListType
(
CTRelationship
))
)
(
listOfNodes
,
listOfRels
)
match
{
case
(
true
,
false
)
=>
lhs
.
newLong
(
variableName
,
true
,
CTNode
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help