提交 f12d1814 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Return NULL from ARRAY_CONTAINS(NULL, value) for better compatibility

上级 7296752c
......@@ -4155,7 +4155,7 @@ ISO_YEAR(CREATED)
ARRAY_GET(arrayExpression, indexExpression)
","
Returns one element of an array.
This method returns a string.
Returns NULL if there is no such element or array is NULL.
","
CALL ARRAY_GET(('Hello', 'World'), 2)
"
......@@ -4164,6 +4164,7 @@ CALL ARRAY_GET(('Hello', 'World'), 2)
ARRAY_LENGTH(arrayExpression)
","
Returns the length of an array.
Returns NULL if the specified array is NULL.
","
CALL ARRAY_LENGTH(('Hello', 'World'))
"
......@@ -4171,7 +4172,8 @@ CALL ARRAY_LENGTH(('Hello', 'World'))
"Functions (System)","ARRAY_CONTAINS","
ARRAY_CONTAINS(arrayExpression, value)
","
Returns a boolean true if the array contains the value.
Returns a boolean TRUE if the array contains the value or FALSE if it does not contain it.
Returns NULL if the specified array is NULL.
","
CALL ARRAY_CONTAINS(('Hello', 'World'), 'Hello')
"
......
......@@ -414,7 +414,7 @@ public class Function extends Expression implements FunctionCall {
addFunctionNotDeterministic("CURRVAL", CURRVAL,
VAR_ARGS, Value.LONG);
addFunction("ARRAY_GET", ARRAY_GET,
2, Value.STRING);
2, Value.NULL);
addFunction("ARRAY_CONTAINS", ARRAY_CONTAINS,
2, Value.BOOLEAN, false, true, true);
addFunction("CSVREAD", CSVREAD,
......@@ -1059,6 +1059,8 @@ public class Function extends Expression implements FunctionCall {
break;
}
}
} else {
result = ValueNull.INSTANCE;
}
break;
}
......
......@@ -22,7 +22,7 @@ select array_contains((null, 'two'), null);
>> TRUE
select array_contains(null, 'one');
>> FALSE
>> null
select array_contains(((1, 2), (3, 4)), (1, 2));
>> TRUE
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论