This is an automated email from the ASF dual-hosted git repository.
zclll pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 67073096225 [Fix](url) fix wrong result in function parse_url (#56429)
67073096225 is described below
commit 67073096225554147ab58e99b7f13c49e5da3305
Author: linrrarity <[email protected]>
AuthorDate: Thu Sep 25 17:25:02 2025 +0800
[Fix](url) fix wrong result in function parse_url (#56429)
1. wrong ans of `PORT` in BE && FE fold constant:
Before:
```text
mysql> SELECT
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'PORT');
+------------------------------------------------------------------------+
| PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'PORT') |
+------------------------------------------------------------------------+
| mple.com:8080 |
+------------------------------------------------------------------------+
mysql> SELECT
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'PORT');
+--------------------------------------------------------------------------+
| PARSE_URL('http://user:[email protected]/path?query=string#frag', 'PORT')
|
+--------------------------------------------------------------------------+
| -1 |
+--------------------------------------------------------------------------+
```
After:
```text
mysql> SELECT
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'PORT');
+------------------------------------------------------------------------+
| PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'PORT') |
+------------------------------------------------------------------------+
| 8080 |
+------------------------------------------------------------------------+
mysql> SELECT
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'PORT');
+--------------------------------------------------------------------------+
| PARSE_URL('http://user:[email protected]/path?query=string#frag', 'PORT')
|
+--------------------------------------------------------------------------+
| NULL |
+--------------------------------------------------------------------------+
```
---
2. wrong ans of `PATH` in FE fold constant
Before:
```text
mysql> SELECT PARSE_URL('invalid-url', 'PATH');
+----------------------------------+
| PARSE_URL('invalid-url', 'PATH') |
+----------------------------------+
| invalid-url |
+----------------------------------+
```
After:
```text
mysql> SELECT PARSE_URL('invalid-url', 'PATH');
+----------------------------------+
| PARSE_URL('invalid-url', 'PATH') |
+----------------------------------+
| NULL |
+----------------------------------+
```
---
be/src/util/url_parser.cpp | 2 +-
.../functions/executable/StringArithmetic.java | 9 +-
.../data/nereids_function_p0/scalar_function/P.out | 360 +++++++++++++++++++++
.../nereids_function_p0/scalar_function/P.groovy | 122 +++++++
.../fold_constant_string_arithmatic.groovy | 26 +-
5 files changed, 504 insertions(+), 15 deletions(-)
diff --git a/be/src/util/url_parser.cpp b/be/src/util/url_parser.cpp
index c51291fd15f..ee29a4138bf 100644
--- a/be/src/util/url_parser.cpp
+++ b/be/src/util/url_parser.cpp
@@ -200,7 +200,7 @@ bool UrlParser::parse_url(const StringRef& url, UrlPart
part, StringRef* result)
return false;
}
- StringRef port_start_str = protocol_end.substring(end_pos +
_s_colon.size);
+ StringRef port_start_str = host_start.substring(end_pos +
_s_colon.size);
int32_t port_end_pos = _s_slash_search.search(&port_start_str);
//if '/' not found, try to find '?'
if (port_end_pos < 0) {
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
index a3975637d09..e04d4eca2b4 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/StringArithmetic.java
@@ -877,6 +877,9 @@ public class StringArithmetic {
throw new RuntimeException(e);
}
StringBuilder sb = new StringBuilder();
+ if (uri.getScheme() == null) {
+ return new NullLiteral(first.getDataType());
+ }
switch (second.getValue().toUpperCase()) {
case "PROTOCOL":
String scheme = uri.getScheme();
@@ -936,7 +939,11 @@ public class StringArithmetic {
sb.append(query); // e.g., param1=value1¶m2=value2
break;
case "PORT":
- sb.append(uri.getPort());
+ int port = uri.getPort();
+ if (port == -1) {
+ return new NullLiteral(first.getDataType());
+ }
+ sb.append(port);
break;
case "USERINFO":
String userInfo = uri.getUserInfo();
diff --git a/regression-test/data/nereids_function_p0/scalar_function/P.out
b/regression-test/data/nereids_function_p0/scalar_function/P.out
index 7fc20a43bda..cbb11858133 100644
--- a/regression-test/data/nereids_function_p0/scalar_function/P.out
+++ b/regression-test/data/nereids_function_p0/scalar_function/P.out
@@ -1,4 +1,364 @@
-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !parse_url_host_1 --
+www.example.com
+
+-- !parse_url_cast_1 --
+www.example.com
+
+-- !parse_url_query_1 --
+query=abc
+
+-- !parse_url_query_2 --
+query=こんにちは
+
+-- !parse_url_query_3 --
+query=a'
+
+-- !parse_url_query_4 --
+\N
+
+-- !parse_url_protocol_1 --
+http
+
+-- !parse_url_protocol_2 --
+http
+
+-- !parse_url_protocol_3 --
+http
+
+-- !parse_url_host_2 --
+example.com
+
+-- !parse_url_host_3 --
+example.com
+
+-- !parse_url_host_4 --
+example.com
+
+-- !parse_url_path_1 --
+
+
+-- !parse_url_path_2 --
+/path/to/resource
+
+-- !parse_url_path_3 --
+/path/to/resource
+
+-- !parse_url_path_4 --
+/path/to/resource
+
+-- !parse_url_query_5 --
+query=string
+
+-- !parse_url_query_6 --
+query=string
+
+-- !parse_url_query_7 --
+query=string
+
+-- !parse_url_authority_1 --
+user:[email protected]
+
+-- !parse_url_authority_2 --
+user:[email protected]
+
+-- !parse_url_authority_3 --
+user:[email protected]
+
+-- !parse_url_file_1 --
+/path/to/resource
+
+-- !parse_url_file_2 --
+/path/to/resource
+
+-- !parse_url_file_3 --
+/path/to/resource
+
+-- !parse_url_userinfo_1 --
+user:pwd
+
+-- !parse_url_userinfo_2 --
+user:pwd
+
+-- !parse_url_userinfo_3 --
+user:pwd
+
+-- !parse_url_port_1 --
+8080
+
+-- !parse_url_port_2 --
+8080
+
+-- !parse_url_port_3 --
+8080
+
+-- !parse_url_invalid_1 --
+\N
+
+-- !parse_url_invalid_2 --
+\N
+
+-- !parse_url_invalid_3 --
+\N
+
+-- !parse_url_empty_1 --
+\N
+
+-- !parse_url_null_1 --
+\N
+
+-- !parse_url_https_1 --
+https
+
+-- !parse_url_ftp_1 --
+ftp
+
+-- !parse_url_fragment_1 --
+query=1
+
+-- !parse_url_authority_4 --
+user:[email protected]
+
+-- !parse_url_file_4 --
+/path/to/resource
+
+-- !parse_url_userinfo_4 --
+user:pwd
+
+-- !parse_url_port_4 --
+8080
+
+-- !parse_url_query_8 --
+query=string&another=param
+
+-- !parse_url_userinfo_5 --
+user:pwd
+
+-- !parse_url_userinfo_6 --
+user:pwd
+
+-- !parse_url_userinfo_7 --
+user:pwd
+
+-- !parse_url_path_5 --
+/path/to/resource
+
+-- !parse_url_path_6 --
+/path/to/resource
+
+-- !parse_url_path_7 --
+/path/to/resource
+
+-- !parse_url_query_9 --
+query=string
+
+-- !parse_url_query_10 --
+query=string
+
+-- !parse_url_query_11 --
+query=string
+
+-- !parse_url_port_5 --
+8080
+
+-- !parse_url_port_6 --
+8080
+
+-- !parse_url_port_7 --
+8080
+
+-- !parse_url_path_8 --
+/path/to/resource
+
+-- !parse_url_path_9 --
+/path/to/resource
+
+-- !parse_url_path_10 --
+/path/to/resource
+
+-- !parse_url_query_12 --
+\N
+
+-- !parse_url_query_13 --
+\N
+
+-- !parse_url_query_14 --
+\N
+
+-- !parse_url_authority_5 --
+example.com
+
+-- !parse_url_authority_6 --
+example.com
+
+-- !parse_url_authority_7 --
+example.com
+
+-- !parse_url_file_5 --
+/path/to/resource
+
+-- !parse_url_file_6 --
+/path/to/resource
+
+-- !parse_url_file_7 --
+/path/to/resource
+
+-- !parse_url_query_15 --
+query=string&another=param
+
+-- !parse_url_query_16 --
+query=string&another=param
+
+-- !parse_url_query_17 --
+query=string&another=param
+
+-- !parse_url_userinfo_8 --
+user:pwd
+
+-- !parse_url_protocol_4 --
+https
+
+-- !parse_url_host_5 --
+hostname
+
+-- !parse_url_path_11 --
+/path
+
+-- !parse_url_ref_1 --
+frag
+
+-- !parse_url_authority_8 --
+user:[email protected]
+
+-- !parse_url_file_8 --
+/path?query=string
+
+-- !parse_url_userinfo_9 --
+user:pwd
+
+-- !parse_url_port_8 --
+8080
+
+-- !parse_url_query_18 --
+query=string
+
+-- !parse_url_protocol_5 --
+http
+
+-- !parse_url_host_6 --
+www.test.com
+
+-- !parse_url_path_12 --
+/path
+
+-- !parse_url_ref_2 --
+frag
+
+-- !parse_url_authority_9 --
+user:[email protected]
+
+-- !parse_url_file_9 --
+/path?query=string
+
+-- !parse_url_userinfo_10 --
+user:pwd
+
+-- !parse_url_port_9 --
+\N
+
+-- !parse_url_query_19 --
+query=string
+
+-- !parse_url_empty_2 --
+\N
+
+-- !parse_url_null_2 --
+\N
+
+-- !parse_url_invalid_4 --
+\N
+
+-- !parse_url_host_7 --
+www.test.com
+
+-- !parse_url_protocol_6 --
+https
+
+-- !parse_url_userinfo_11 --
+username:password
+
+-- !parse_url_port_10 --
+8080
+
+-- !parse_url_query_20 --
+query=string
+
+-- !parse_url_ref_3 --
+fragment
+
+-- !parse_url_authority_10 --
+user:[email protected]
+
+-- !parse_url_file_10 --
+/path/to/file
+
+-- !parse_url_path_13 --
+/
+
+-- !parse_url_protocol_7 --
+http
+
+-- !parse_url_host_8 --
+www.test.com
+
+-- !parse_url_path_14 --
+/path/to/file
+
+-- !parse_url_ref_4 --
+fragment
+
+-- !parse_url_authority_11 --
+user:[email protected]:8080
+
+-- !parse_url_file_11 --
+/path/to/file?query=string
+
+-- !parse_url_userinfo_12 --
+user:pwd
+
+-- !parse_url_port_11 --
+8080
+
+-- !parse_url_query_21 --
+query=string
+
+-- !parse_url_protocol_8 --
+http
+
+-- !parse_url_host_9 --
+www.test.com
+
+-- !parse_url_path_15 --
+/path/to/file
+
+-- !parse_url_ref_5 --
+fragment
+
+-- !parse_url_authority_12 --
+user:[email protected]:8080
+
+-- !parse_url_file_12 --
+/path/to/file?query=string
+
+-- !parse_url_userinfo_13 --
+user:pwd
+
+-- !parse_url_port_12 --
+8080
+
+-- !parse_url_query_22 --
+query=string
+
-- !sql_pwd --
*23AE809DDACAF96AF0FD78ED04B6A265E05AA257
diff --git
a/regression-test/suites/nereids_function_p0/scalar_function/P.groovy
b/regression-test/suites/nereids_function_p0/scalar_function/P.groovy
index e721fc4e579..40d04a40c52 100644
--- a/regression-test/suites/nereids_function_p0/scalar_function/P.groovy
+++ b/regression-test/suites/nereids_function_p0/scalar_function/P.groovy
@@ -16,6 +16,128 @@
// under the License.
suite("nereids_scalar_fn_P") {
+ qt_parse_url_host_1 """select
parse_url('http://www.example.com/path?query=abc', 'HOST')"""
+ qt_parse_url_cast_1 """select
parse_url(cast('http://www.example.com/path?query=abc' as string), cast('HOST'
as string))"""
+ qt_parse_url_query_1 """select
parse_url('http://www.example.com/path?query=abc', 'QUERY')"""
+ qt_parse_url_query_2 """select
parse_url('http://www.example.com/path?query=こんにちは', 'QUERY')"""
+ qt_parse_url_query_3 """select
parse_url("http://www.example.com/path?query=a\b\'", 'QUERY')"""
+ qt_parse_url_query_4 """select
parse_url("http://www.example.com/path.query=a\b\'", 'QUERY')"""
+ qt_parse_url_protocol_1 """select PARSE_URL('http://example.com',
'PROTOCOL')"""
+ qt_parse_url_protocol_2 """select PARSE_URL('http://example.com',
'protocol')"""
+ qt_parse_url_protocol_3 """select PARSE_URL('http://example.com',
'Protocol')"""
+ qt_parse_url_host_2 """select PARSE_URL('http://example.com', 'HOST')"""
+ qt_parse_url_host_3 """select PARSE_URL('http://example.com', 'host')"""
+ qt_parse_url_host_4 """select PARSE_URL('http://example.com', 'Host')"""
+ qt_parse_url_path_1 """select PARSE_URL('http://example.com', 'PATH')"""
+ qt_parse_url_path_2 """select
PARSE_URL('http://example.com/path/to/resource', 'path')"""
+ qt_parse_url_path_3 """select
PARSE_URL('http://example.com/path/to/resource', 'Path')"""
+ qt_parse_url_path_4 """select
PARSE_URL('http://example.com/path/to/resource', 'PATH')"""
+ qt_parse_url_query_5 """select
PARSE_URL('http://example.com/path/to/resource?query=string', 'QUERY')"""
+ qt_parse_url_query_6 """select
PARSE_URL('http://example.com/path/to/resource?query=string', 'query')"""
+ qt_parse_url_query_7 """select
PARSE_URL('http://example.com/path/to/resource?query=string', 'Query')"""
+ qt_parse_url_authority_1 """select
PARSE_URL('http://user:[email protected]', 'AUTHORITY')"""
+ qt_parse_url_authority_2 """select
PARSE_URL('http://user:[email protected]', 'authority')"""
+ qt_parse_url_authority_3 """select
PARSE_URL('http://user:[email protected]', 'Authority')"""
+ qt_parse_url_file_1 """select
PARSE_URL('http://user:[email protected]/path/to/resource', 'FILE')"""
+ qt_parse_url_file_2 """select
PARSE_URL('http://user:[email protected]/path/to/resource', 'file')"""
+ qt_parse_url_file_3 """select
PARSE_URL('http://user:[email protected]/path/to/resource', 'File')"""
+ qt_parse_url_userinfo_1 """select
PARSE_URL('http://user:[email protected]/path/to/resource', 'USERINFO')"""
+ qt_parse_url_userinfo_2 """select
PARSE_URL('http://user:[email protected]/path/to/resource', 'userinfo')"""
+ qt_parse_url_userinfo_3 """select
PARSE_URL('http://user:[email protected]/path/to/resource', 'UserInfo')"""
+ qt_parse_url_port_1 """select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'PORT')"""
+ qt_parse_url_port_2 """select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'port')"""
+ qt_parse_url_port_3 """select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'Port')"""
+ qt_parse_url_invalid_1 """select PARSE_URL('invalid-url', 'PROTOCOL')"""
+ qt_parse_url_invalid_2 """select PARSE_URL('invalid-url', 'HOST')"""
+ qt_parse_url_invalid_3 """select PARSE_URL('invalid-url', 'PATH')"""
+ qt_parse_url_empty_1 """select PARSE_URL('', 'PROTOCOL')"""
+ qt_parse_url_null_1 """select PARSE_URL(null, 'PROTOCOL')"""
+ qt_parse_url_https_1 """select PARSE_URL('https://example.com',
'PROTOCOL')"""
+ qt_parse_url_ftp_1 """select PARSE_URL('ftp://example.com',
'PROTOCOL')"""
+ qt_parse_url_fragment_1 """select
PARSE_URL('http://example.com/path?query=1#fragment', 'QUERY')"""
+ qt_parse_url_authority_4 """select
PARSE_URL('http://user:[email protected]/path/to/resource', 'AUTHORITY')"""
+ qt_parse_url_file_4 """select
PARSE_URL('http://user:[email protected]/path/to/resource', 'FILE')"""
+ qt_parse_url_userinfo_4 """select
PARSE_URL('http://user:[email protected]/path/to/resource', 'USERINFO')"""
+ qt_parse_url_port_4 """select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'PORT')"""
+ qt_parse_url_query_8 """select
PARSE_URL('http://example.com/path/to/resource?query=string&another=param',
'QUERY')"""
+ qt_parse_url_userinfo_5 """select
PARSE_URL('http://user:[email protected]', 'USERINFO')"""
+ qt_parse_url_userinfo_6 """select
PARSE_URL('http://user:[email protected]', 'userinfo')"""
+ qt_parse_url_userinfo_7 """select
PARSE_URL('http://user:[email protected]', 'UserInfo')"""
+ qt_parse_url_path_5 """select
PARSE_URL('http://user:[email protected]/path/to/resource', 'PATH')"""
+ qt_parse_url_path_6 """select
PARSE_URL('http://user:[email protected]/path/to/resource', 'path')"""
+ qt_parse_url_path_7 """select
PARSE_URL('http://user:[email protected]/path/to/resource', 'Path')"""
+ qt_parse_url_query_9 """select
PARSE_URL('http://user:[email protected]/path/to/resource?query=string',
'QUERY')"""
+ qt_parse_url_query_10 """select
PARSE_URL('http://user:[email protected]/path/to/resource?query=string',
'query')"""
+ qt_parse_url_query_11 """select
PARSE_URL('http://user:[email protected]/path/to/resource?query=string',
'Query')"""
+ qt_parse_url_port_5 """select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'PORT')"""
+ qt_parse_url_port_6 """select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'port')"""
+ qt_parse_url_port_7 """select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'Port')"""
+ qt_parse_url_path_8 """select
PARSE_URL('http://example.com/path/to/resource#fragment', 'PATH')"""
+ qt_parse_url_path_9 """select
PARSE_URL('http://example.com/path/to/resource#fragment', 'path')"""
+ qt_parse_url_path_10 """select
PARSE_URL('http://example.com/path/to/resource#fragment', 'Path')"""
+ qt_parse_url_query_12 """select
PARSE_URL('http://example.com/path/to/resource#fragment', 'QUERY')"""
+ qt_parse_url_query_13 """select
PARSE_URL('http://example.com/path/to/resource#fragment', 'query')"""
+ qt_parse_url_query_14 """select
PARSE_URL('http://example.com/path/to/resource#fragment', 'Query')"""
+ qt_parse_url_authority_5 """select
PARSE_URL('http://example.com/path/to/resource#fragment', 'AUTHORITY')"""
+ qt_parse_url_authority_6 """select
PARSE_URL('http://example.com/path/to/resource#fragment', 'authority')"""
+ qt_parse_url_authority_7 """select
PARSE_URL('http://example.com/path/to/resource#fragment', 'Authority')"""
+ qt_parse_url_file_5 """select
PARSE_URL('http://example.com/path/to/resource#fragment', 'FILE')"""
+ qt_parse_url_file_6 """select
PARSE_URL('http://example.com/path/to/resource#fragment', 'file')"""
+ qt_parse_url_file_7 """select
PARSE_URL('http://example.com/path/to/resource#fragment', 'File')"""
+ qt_parse_url_query_15 """select
PARSE_URL('http://user:[email protected]/path/to/resource?query=string&another=param#fragment',
'QUERY')"""
+ qt_parse_url_query_16 """select
PARSE_URL('http://user:[email protected]/path/to/resource?query=string&another=param#fragment',
'query')"""
+ qt_parse_url_query_17 """select
PARSE_URL('http://user:[email protected]/path/to/resource?query=string&another=param#fragment',
'Query')"""
+ qt_parse_url_userinfo_8 """select
PARSE_URL('http://user:[email protected]?a=b', 'USERINFO')"""
+ qt_parse_url_protocol_4 """select
PARSE_URL('https://www.example.com/path/to/file?query=string#fragment',
'protocol')"""
+ qt_parse_url_host_5 """select
PARSE_URL('ftp://username:password@hostname:21/path/to/file', 'Host')"""
+ qt_parse_url_path_11 """select
PARSE_URL('http://example.com:8080/path?query=string#frag', 'path')"""
+ qt_parse_url_ref_1 """select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'ref')"""
+ qt_parse_url_authority_8 """select
PARSE_URL('http://user:[email protected]/path?query=string#frag',
'AUTHORITY')"""
+ qt_parse_url_file_8 """select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'file')"""
+ qt_parse_url_userinfo_9 """select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'USERINFO')"""
+ qt_parse_url_port_8 """select
PARSE_URL('http://user:[email protected]:8080/path?query=string#frag',
'port')"""
+ qt_parse_url_query_18 """select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'QUERY')"""
+ qt_parse_url_protocol_5 """select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'Protocol')"""
+ qt_parse_url_host_6 """select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'host')"""
+ qt_parse_url_path_12 """select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'Path')"""
+ qt_parse_url_ref_2 """select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'Ref')"""
+ qt_parse_url_authority_9 """select
PARSE_URL('http://user:[email protected]/path?query=string#frag',
'Authority')"""
+ qt_parse_url_file_9 """select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'File')"""
+ qt_parse_url_userinfo_10 """select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'Userinfo')"""
+ qt_parse_url_port_9 """select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'Port')"""
+ qt_parse_url_query_19 """select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'Query')"""
+ qt_parse_url_empty_2 """select PARSE_URL('', 'HOST')"""
+ qt_parse_url_null_2 """select PARSE_URL(null, 'HOST')"""
+ qt_parse_url_invalid_4 """select PARSE_URL('not a url', 'HOST')"""
+ qt_parse_url_host_7 """select PARSE_URL('http://www.test.com',
'HOST')"""
+ qt_parse_url_protocol_6 """select PARSE_URL('https://www.test.com',
'protocol')"""
+ qt_parse_url_userinfo_11 """select
PARSE_URL('ftp://username:password@hostname/path/to/file', 'userinfo')"""
+ qt_parse_url_port_10 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file', 'port')"""
+ qt_parse_url_query_20 """select
PARSE_URL('http://www.test.com/path/to/file?query=string', 'query')"""
+ qt_parse_url_ref_3 """select
PARSE_URL('http://www.test.com/path/to/file#fragment', 'ref')"""
+ qt_parse_url_authority_10 """select
PARSE_URL('http://user:[email protected]/path/to/file', 'authority')"""
+ qt_parse_url_file_10 """select
PARSE_URL('http://www.test.com/path/to/file', 'file')"""
+ qt_parse_url_path_13 """select PARSE_URL('http://www.test.com/',
'path')"""
+ qt_parse_url_protocol_7 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'protocol')"""
+ qt_parse_url_host_8 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'host')"""
+ qt_parse_url_path_14 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'path')"""
+ qt_parse_url_ref_4 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'ref')"""
+ qt_parse_url_authority_11 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'authority')"""
+ qt_parse_url_file_11 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'file')"""
+ qt_parse_url_userinfo_12 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'userinfo')"""
+ qt_parse_url_port_11 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'port')"""
+ qt_parse_url_query_21 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'query')"""
+ qt_parse_url_protocol_8 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'PROTOcol')"""
+ qt_parse_url_host_9 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'HOST')"""
+ qt_parse_url_path_15 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'PATH')"""
+ qt_parse_url_ref_5 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'REF')"""
+ qt_parse_url_authority_12 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'AUTHORITY')"""
+ qt_parse_url_file_12 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'FILE')"""
+ qt_parse_url_userinfo_13 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'USERINFO')"""
+ qt_parse_url_port_12 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'PORT')"""
+ qt_parse_url_query_22 """select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'QUERY')"""
+
+
sql 'use regression_test_nereids_function_p0'
sql 'set enable_nereids_planner=true'
sql 'set enable_fallback_to_original_planner=false'
diff --git
a/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy
b/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy
index 997ac3f9037..48914b59ef8 100644
---
a/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy
+++
b/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_string_arithmatic.groovy
@@ -644,12 +644,12 @@ suite("fold_constant_string_arithmatic") {
testFoldConst("select
PARSE_URL('http://user:[email protected]/path/to/resource', 'USERINFO')")
testFoldConst("select
PARSE_URL('http://user:[email protected]/path/to/resource', 'userinfo')")
testFoldConst("select
PARSE_URL('http://user:[email protected]/path/to/resource', 'UserInfo')")
-// testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'PORT')")
-// testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'port')")
-// testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'Port')")
+ testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'PORT')")
+ testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'port')")
+ testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'Port')")
testFoldConst("select PARSE_URL('invalid-url', 'PROTOCOL')")
testFoldConst("select PARSE_URL('invalid-url', 'HOST')")
-// testFoldConst("select PARSE_URL('invalid-url', 'PATH')")
+ testFoldConst("select PARSE_URL('invalid-url', 'PATH')")
testFoldConst("select PARSE_URL('', 'PROTOCOL')")
testFoldConst("select PARSE_URL(null, 'PROTOCOL')")
testFoldConst("select PARSE_URL('https://example.com', 'PROTOCOL')")
@@ -658,7 +658,7 @@ suite("fold_constant_string_arithmatic") {
testFoldConst("select
PARSE_URL('http://user:[email protected]/path/to/resource', 'AUTHORITY')")
testFoldConst("select
PARSE_URL('http://user:[email protected]/path/to/resource', 'FILE')")
testFoldConst("select
PARSE_URL('http://user:[email protected]/path/to/resource', 'USERINFO')")
-// testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'PORT')")
+ testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'PORT')")
testFoldConst("select
PARSE_URL('http://example.com/path/to/resource?query=string&another=param',
'QUERY')")
testFoldConst("select
PARSE_URL('http://example.com/path/to/resource?query=string&another=param',
'QUERY')")
testFoldConst("select
PARSE_URL('http://example.com/path/to/resource?query=string&another=param',
'QUERY')")
@@ -671,9 +671,9 @@ suite("fold_constant_string_arithmatic") {
testFoldConst("select
PARSE_URL('http://user:[email protected]/path/to/resource?query=string',
'QUERY')")
testFoldConst("select
PARSE_URL('http://user:[email protected]/path/to/resource?query=string',
'query')")
testFoldConst("select
PARSE_URL('http://user:[email protected]/path/to/resource?query=string',
'Query')")
-// testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'PORT')")
-// testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'port')")
-// testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'Port')")
+ testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'PORT')")
+ testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'port')")
+ testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/resource', 'Port')")
testFoldConst("select
PARSE_URL('http://example.com/path/to/resource#fragment', 'PATH')")
testFoldConst("select
PARSE_URL('http://example.com/path/to/resource#fragment', 'path')")
testFoldConst("select
PARSE_URL('http://example.com/path/to/resource#fragment', 'Path')")
@@ -697,7 +697,7 @@ suite("fold_constant_string_arithmatic") {
testFoldConst("select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'AUTHORITY')")
testFoldConst("select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'file')")
testFoldConst("select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'USERINFO')")
-// testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path?query=string#frag', 'port')")
+ testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path?query=string#frag', 'port')")
testFoldConst("select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'QUERY')")
testFoldConst("select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'Protocol')")
testFoldConst("select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'host')")
@@ -706,7 +706,7 @@ suite("fold_constant_string_arithmatic") {
testFoldConst("select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'Authority')")
testFoldConst("select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'File')")
testFoldConst("select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'Userinfo')")
-// testFoldConst("select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'Port')")
+ testFoldConst("select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'Port')")
testFoldConst("select
PARSE_URL('http://user:[email protected]/path?query=string#frag', 'Query')")
testFoldConst("select PARSE_URL('', 'HOST')")
testFoldConst("select PARSE_URL(null, 'HOST')")
@@ -714,7 +714,7 @@ suite("fold_constant_string_arithmatic") {
testFoldConst("select PARSE_URL('http://www.test.com', 'HOST')")
testFoldConst("select PARSE_URL('https://www.test.com', 'protocol')")
testFoldConst("select
PARSE_URL('ftp://username:password@hostname/path/to/file', 'userinfo')")
-// testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/file', 'port')")
+ testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/file', 'port')")
testFoldConst("select
PARSE_URL('http://www.test.com/path/to/file?query=string', 'query')")
testFoldConst("select
PARSE_URL('http://www.test.com/path/to/file#fragment', 'ref')")
testFoldConst("select
PARSE_URL('http://user:[email protected]/path/to/file', 'authority')")
@@ -727,7 +727,7 @@ suite("fold_constant_string_arithmatic") {
testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'authority')")
testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'file')")
testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'userinfo')")
-// testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'port')")
+ testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'port')")
testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'query')")
testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'PROTOcol')")
testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'HOST')")
@@ -736,7 +736,7 @@ suite("fold_constant_string_arithmatic") {
testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'AUTHORITY')")
testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'FILE')")
testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'USERINFO')")
-// testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'PORT')")
+ testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'PORT')")
testFoldConst("select
PARSE_URL('http://user:[email protected]:8080/path/to/file?query=string#fragment',
'QUERY')")
// position
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]