[
https://issues.apache.org/jira/browse/CALCITE-5699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17722050#comment-17722050
]
Evgeny Stanilovsky edited comment on CALCITE-5699 at 5/12/23 7:23 AM:
----------------------------------------------------------------------
Probably i need to append such a tests into Sql Logic Tests, let me know if it
so (probably already exist some flow i.e. pure code fix in calcite and parallel
new tests into Sql Logic or smth. else .. i just dont know how to synchronize 2
repo in such a case).
Fix proposal: _NotImplementor_ for now is not inherit implementor _NullPolicy :_
{noformat}
private NotImplementor(AbstractRexCallImplementor implementor) {
super(null, false);
this.implementor = implementor;
}{noformat}
If we change this behavior
AbstractRexCallImplementor#getCondition will call:
Expressions.foldOr(argIsNullList) and correct further Expression (check code in
AbstractRexCallImplementor#genValueStatement ->final Expression
valueExpression) like :
{noformat}
literal_isNull || literal_isNull0 ? (Boolean) null :
Boolean.valueOf(!org.apache.calcite.runtime.SqlFunctions.posixRegex(literal_value
== null ? (String) null : literal_value.toString(), literal_value0,
true)){noformat}
instead of:
{noformat}
false ? (Boolean) null :
Boolean.valueOf(!org.apache.calcite.runtime.SqlFunctions.posixRegex(literal_value
== null ? (String) null : literal_value.toString(), literal_value0,
true)){noformat}
was (Author: zstan):
Probably i need to append such a tests into Sql Logic Tests, let me know if it
so (probably already exist some flow i.e. pure code fix in calcite and parallel
new tests into Sql Logic or smth. else .. i just dont know how to synchronize 2
repo in such a case).
Fix proposal: _NotImplementor_ for now is not inherit implementor _NullPolicy :_
{noformat}
private NotImplementor(AbstractRexCallImplementor implementor) {
super(null, false);
this.implementor = implementor;
}{noformat}
If we change this behavior
AbstractRexCallImplementor#getCondition will call:
Expressions.foldOr(argIsNullList) and correct further Expression (check code in
AbstractRexCallImplementor#genValueStatement) like :
{noformat}
literal_isNull || literal_isNull0 ? (Boolean) null :
Boolean.valueOf(!org.apache.calcite.runtime.SqlFunctions.posixRegex(literal_value
== null ? (String) null : literal_value.toString(), literal_value0,
true)){noformat}
instead of:
{noformat}
false ? (Boolean) null :
Boolean.valueOf(!org.apache.calcite.runtime.SqlFunctions.posixRegex(literal_value
== null ? (String) null : literal_value.toString(), literal_value0,
true)){noformat}
> Posix regex expressions failed while NOT operator is executed with null
> literals.
> ---------------------------------------------------------------------------------
>
> Key: CALCITE-5699
> URL: https://issues.apache.org/jira/browse/CALCITE-5699
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.34.0
> Reporter: Evgeny Stanilovsky
> Assignee: Evgeny Stanilovsky
> Priority: Major
> Labels: pull-request-available
>
> Operations like :
> {noformat}
> SELECT null !~ 'ab[cd]'
> SELECT 'abcd' !~ null
> SELECT null !~ null
> SELECT null !~* 'ab[cd]'
> SELECT 'abcd' !~* null
> SELECT null !~* null{noformat}
> is not possible for now, NPE is raised :
> {noformat}
> Caused by: java.lang.NullPointerException
> at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1770)
> at java.base/java.util.regex.Matcher.reset(Matcher.java:416)
> at java.base/java.util.regex.Matcher.<init>(Matcher.java:253)
> at java.base/java.util.regex.Pattern.matcher(Pattern.java:1134)
> at
> org.apache.calcite.runtime.SqlFunctions.posixRegex(SqlFunctions.java:864){noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)