Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
neo4j
neo4j
提交
ebb387b8
N
neo4j
项目概览
neo4j
/
neo4j
10 个月 前同步成功
通知
44
Star
11765
Fork
2298
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
neo4j
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
ebb387b8
编写于
1月 29, 2014
作者:
A
Andres Taylor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes #1876 - Null nodes and properties should be ignored when SETting properties
上级
67986996
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
15 deletion
+32
-15
community/cypher/cypher-compiler-2.0/src/main/scala/org/neo4j/cypher/internal/compiler/v2_0/mutation/PropertySetAction.scala
...r/internal/compiler/v2_0/mutation/PropertySetAction.scala
+14
-15
community/cypher/cypher/CHANGES.txt
community/cypher/cypher/CHANGES.txt
+1
-0
community/cypher/cypher/src/test/scala/org/neo4j/cypher/NullAcceptanceTest.scala
.../src/test/scala/org/neo4j/cypher/NullAcceptanceTest.scala
+17
-0
未找到文件。
community/cypher/cypher-compiler-2.0/src/main/scala/org/neo4j/cypher/internal/compiler/v2_0/mutation/PropertySetAction.scala
浏览文件 @
ebb387b8
...
...
@@ -22,7 +22,6 @@ package org.neo4j.cypher.internal.compiler.v2_0.mutation
import
org.neo4j.cypher.internal.compiler.v2_0._
import
commands.expressions._
import
pipes.QueryState
import
symbols._
import
org.neo4j.graphdb.
{
Relationship
,
Node
}
import
org.neo4j.helpers.ThisShouldNotHappenError
...
...
@@ -34,23 +33,23 @@ case class PropertySetAction(prop: Property, e: Expression)
def
exec
(
context
:
ExecutionContext
,
state
:
QueryState
)
=
{
implicit
val
s
=
state
val
value
=
makeValueNeoSafe
(
e
(
context
))
val
qtx
=
state
.
query
mapExpr
(
context
)
match
{
case
(
n
:
Node
)
=>
if
(
null
==
value
)
propertyKey
.
getOptId
(
qtx
).
foreach
(
qtx
.
nodeOps
.
removeProperty
(
n
.
getId
,
_
))
else
qtx
.
nodeOps
.
setProperty
(
n
.
getId
,
propertyKey
.
getOrCreateId
(
qtx
),
value
)
case
(
r
:
Relationship
)
=>
if
(
null
==
value
)
propertyKey
.
getOptId
(
qtx
).
foreach
(
qtx
.
relationshipOps
.
removeProperty
(
r
.
getId
,
_
))
else
qtx
.
relationshipOps
.
setProperty
(
r
.
getId
,
propertyKey
.
getOrCreateId
(
qtx
),
value
)
case
_
=>
throw
new
ThisShouldNotHappenError
(
"Stefan"
,
"This should be a node or a relationship"
)
val
expr
=
mapExpr
(
context
)
if
(
expr
!=
null
)
{
val
(
id
,
ops
)
=
expr
match
{
case
(
e
:
Relationship
)
=>
(
e
.
getId
,
qtx
.
relationshipOps
)
case
(
e
:
Node
)
=>
(
e
.
getId
,
qtx
.
nodeOps
)
case
_
=>
throw
new
ThisShouldNotHappenError
(
"Stefan"
,
"This should be a node or a relationship"
)
}
makeValueNeoSafe
(
e
(
context
))
match
{
case
null
=>
propertyKey
.
getOptId
(
qtx
).
foreach
(
ops
.
removeProperty
(
id
,
_
)
)
case
value
=>
ops
.
setProperty
(
id
,
propertyKey
.
getOrCreateId
(
qtx
),
value
)
}
}
Iterator
(
context
)
}
...
...
community/cypher/cypher/CHANGES.txt
浏览文件 @
ebb387b8
...
...
@@ -4,6 +4,7 @@ o Fixes bug around MERGE inside a FOREACH inside a FOREACH
o Makes it possible to write MERGE queries with no already known parts
o Fixes problem with compiling queries with NOT expressions in them
o Fixes #1735 - Indexes and AND predicates produce wrong results
o Fixes #1876 - Null nodes and properties should be ignored when SETting properties
2.0.0-RC1
---------
...
...
community/cypher/cypher/src/test/scala/org/neo4j/cypher/NullAcceptanceTest.scala
0 → 100644
浏览文件 @
ebb387b8
package
org.neo4j.cypher
import
org.junit.Test
class
NullAcceptanceTest
extends
ExecutionEngineHelper
{
@Test
def
null_nodes_should_be_silently_ignored
()
{
// Given empty database
// When
val
result
=
execute
(
"optional match (a:DoesNotExist) set a.prop = 42 return a"
)
// Then doesn't throw
result
.
toList
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录