Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion be/src/util/url_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ StringRef UrlParser::extract_url(StringRef url, StringRef name) {
and_pod = sub_url.find_first_of('&');
if (and_pod != -1) {
key_url = sub_url.substring(0, and_pod);
sub_url = sub_url.substring(and_pod + 1, len - and_pod);
sub_url = sub_url.substring(and_pod + 1, len - and_pod - 1);
} else {
auto end_pos = sub_url.find_first_of('#');
key_url = end_pos == -1 ? sub_url : sub_url.substring(0, end_pos);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql --
1234 4 123 3 112 3

-- !sql --
1234 4 123 3 112 3

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

suite("extract_url_parameter") {

sql """
drop table if exists extract_table;
"""
sql """
create table extract_table (
name varchar(30)
) ENGINE=OLAP
UNIQUE KEY(`name`)
DISTRIBUTED BY HASH(`name`) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
"""
sql """
insert into extract_table values ('?ada=123&bbb=112&ccc=1234')
"""

qt_sql """
select extract_url_parameter(name, 'ccc'), length(extract_url_parameter(name, 'ccc')),
extract_url_parameter(name, 'ada'), length(extract_url_parameter(name, 'ada')),
extract_url_parameter(name, 'bbb'), length(extract_url_parameter(name, 'bbb'))
from extract_table
"""

qt_sql """
select
extract_url_parameter('?ada=123&bbb=112&ccc=1234', "ccc"), length(extract_url_parameter('?ada=123&bbb=112&ccc=1234', "ccc")),
extract_url_parameter('?ada=123&bbb=112&ccc=1234', "ada"), length(extract_url_parameter('?ada=123&bbb=112&ccc=1234', "ada")),
extract_url_parameter('?ada=123&bbb=112&ccc=1234', "bbb"), length(extract_url_parameter('?ada=123&bbb=112&ccc=1234', "bbb"))
"""

sql """
drop table if exists extract_table;
"""

}
Loading