You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The implementation of Re2Extract and Re2ExtractAll has a bug, that it might consider a mismatched group as MATCHED empty string "" rather than MISMATCHED std::nullopt.
For example, in the function calling: regexp_extract("rat cat\nbat dog", "ra(.)|blah(.)(.)", 2).
In this case, for group 2 the result must be std::nullopt because no substring would match pattern blah(.).
But the current implementation would mistake the matching of group 1 ra(.) as a empty match case for group 2, and thus return a empty matching, which is wrong.
System information
Velox System Info v0.0.2
Commit: b7ed8c7
CMake Version: 3.28.3
System: Linux-5.15.0-92-generic
Arch: x86_64
C++ Compiler: /usr/bin/c++
C++ Compiler Version: 11.4.0
C Compiler: /usr/bin/cc
C Compiler Version: 11.4.0
CMake Prefix Path: /usr/local;/usr;/;/usr/local/lib/python3.10/dist-packages/cmake/data;/usr/local;/usr/X11R6;/usr/pkg;/opt
Relevant logs
The text was updated successfully, but these errors were encountered:
Summary:
The implementation of Re2Extract has a bug, that it might consider a mismatched group as MATCHED empty string "" rather than MISMATCHED std::nullopt.
For example, in the function calling: regexp_extract("rat cat\nbat dog", "ra(.)|blah(.)(.)", 2).
In this case, for group 2 the result must be std::nullopt because no substring would match pattern `blah(.)`.
But the current implementation would mistake the matching of group 1 `ra(.)` as a empty match case for group 2, and thus return a empty matching, which is wrong.
See detailed description in #12119.
This PR fix this bug in Re2Extract implementation.
Also note that this bug behavior exists in Re2ExtractAll as well, but this PR doesn't modify in Re2ExtractAll because existing UTs of Re2ExtractAll already rely on this behavior.
Pull Request resolved: #12109
Reviewed By: kgpai
Differential Revision: D68334118
Pulled By: kagamiori
fbshipit-source-id: 5824102903760c0459af64a6fe62dd195c5f1928
Bug description
The implementation of Re2Extract and Re2ExtractAll has a bug, that it might consider a mismatched group as MATCHED empty string "" rather than MISMATCHED std::nullopt.
For example, in the function calling: regexp_extract("rat cat\nbat dog", "ra(.)|blah(.)(.)", 2).
In this case, for group 2 the result must be std::nullopt because no substring would match pattern blah(.).
But the current implementation would mistake the matching of group 1 ra(.) as a empty match case for group 2, and thus return a empty matching, which is wrong.
System information
Velox System Info v0.0.2
Commit: b7ed8c7
CMake Version: 3.28.3
System: Linux-5.15.0-92-generic
Arch: x86_64
C++ Compiler: /usr/bin/c++
C++ Compiler Version: 11.4.0
C Compiler: /usr/bin/cc
C Compiler Version: 11.4.0
CMake Prefix Path: /usr/local;/usr;/;/usr/local/lib/python3.10/dist-packages/cmake/data;/usr/local;/usr/X11R6;/usr/pkg;/opt
Relevant logs
The text was updated successfully, but these errors were encountered: