diff --git a/src/Functions/URL/cutURLParameter.cpp b/src/Functions/URL/cutURLParameter.cpp index 4655606fbc3..34ca4ebb2d2 100644 --- a/src/Functions/URL/cutURLParameter.cpp +++ b/src/Functions/URL/cutURLParameter.cpp @@ -159,7 +159,6 @@ public: auto field = col_const_array->getData()[j]; cutURL(res_chars, field.get()); } - } res_data.resize(res_offset + res_chars.size()); memcpySmallAllowReadWriteOverflow15(&res_data[res_offset], &res_chars[0], res_chars.size()); @@ -169,7 +168,6 @@ public: prev_offset = cur_offset; } } - }; REGISTER_FUNCTION(CutURLParameter) diff --git a/tests/queries/0_stateless/02483_cuturlparameter_with_arrays.reference b/tests/queries/0_stateless/02483_cuturlparameter_with_arrays.reference new file mode 100644 index 00000000000..738d8f3078b --- /dev/null +++ b/tests/queries/0_stateless/02483_cuturlparameter_with_arrays.reference @@ -0,0 +1,2 @@ +http://bigmir.net/?a=b&c=d http://bigmir.net/?c=d http://bigmir.net/? http://bigmir.net/?a=b http://bigmir.net/?c=d# http://bigmir.net/?a# http://bigmir.net/?a&c=d# http://bigmir.net/?a=b&c=d#e=f http://bigmir.net/?c=d#e http://bigmir.net/?a=b#e http://bigmir.net/?a=b&c=d#e http://bigmir.net/?a=b&c=d#test?g=h http://bigmir.net/?a=b&c=d#test?e=f //bigmir.net/?a=b&c=d //bigmir.net/?c=d //bigmir.net/? //bigmir.net/?c=d# //bigmir.net/?a&c=d#e=f //bigmir.net/?a#e=f //bigmir.net/?a&c=d# //bigmir.net/?a=b#e=f //bigmir.net/?#e //bigmir.net/?c=d#e //bigmir.net/?a=b#e&g=h //bigmir.net/?a=b&c=d#e //bigmir.net/?a=b&c=d#test?g=h //bigmir.net/?a=b&c=d#test?e=f +http://bigmir.net/?a=b&c=d http://bigmir.net/?c=d http://bigmir.net/? http://bigmir.net/?a=b http://bigmir.net/?c=d# http://bigmir.net/?a# http://bigmir.net/?a&c=d# http://bigmir.net/?a=b&c=d#e=f http://bigmir.net/?c=d#e http://bigmir.net/?a=b#e http://bigmir.net/?a=b&c=d#e http://bigmir.net/?a=b&c=d#test?g=h http://bigmir.net/?a=b&c=d#test?e=f //bigmir.net/?a=b&c=d //bigmir.net/?c=d //bigmir.net/? //bigmir.net/?c=d# //bigmir.net/?a&c=d#e=f //bigmir.net/?a#e=f //bigmir.net/?a&c=d# //bigmir.net/?a=b#e=f //bigmir.net/?#e //bigmir.net/?c=d#e //bigmir.net/?a=b#e&g=h //bigmir.net/?a=b&c=d#e //bigmir.net/?a=b&c=d#test?g=h //bigmir.net/?a=b&c=d#test?e=f diff --git a/tests/queries/0_stateless/02483_cuturlparameter_with_arrays.sql b/tests/queries/0_stateless/02483_cuturlparameter_with_arrays.sql new file mode 100644 index 00000000000..73c889664ca --- /dev/null +++ b/tests/queries/0_stateless/02483_cuturlparameter_with_arrays.sql @@ -0,0 +1,57 @@ +SELECT + cutURLParameter('http://bigmir.net/?a=b&c=d', []), + cutURLParameter('http://bigmir.net/?a=b&c=d', ['a']), + cutURLParameter('http://bigmir.net/?a=b&c=d', ['a', 'c']), + cutURLParameter('http://bigmir.net/?a=b&c=d', ['c']), + cutURLParameter('http://bigmir.net/?a=b&c=d#e=f', ['a', 'e']), + cutURLParameter('http://bigmir.net/?a&c=d#e=f', ['c', 'e']), + cutURLParameter('http://bigmir.net/?a&c=d#e=f', ['e']), + cutURLParameter('http://bigmir.net/?a=b&c=d#e=f&g=h', ['b', 'g']), + cutURLParameter('http://bigmir.net/?a=b&c=d#e', ['a', 'e']), + cutURLParameter('http://bigmir.net/?a=b&c=d#e&g=h', ['c', 'g']), + cutURLParameter('http://bigmir.net/?a=b&c=d#e&g=h', ['e', 'g']), + cutURLParameter('http://bigmir.net/?a=b&c=d#test?e=f&g=h', ['test', 'e']), + cutURLParameter('http://bigmir.net/?a=b&c=d#test?e=f&g=h', ['test', 'g']), + cutURLParameter('//bigmir.net/?a=b&c=d', []), + cutURLParameter('//bigmir.net/?a=b&c=d', ['a']), + cutURLParameter('//bigmir.net/?a=b&c=d', ['a', 'c']), + cutURLParameter('//bigmir.net/?a=b&c=d#e=f', ['a', 'e']), + cutURLParameter('//bigmir.net/?a&c=d#e=f', ['a']), + cutURLParameter('//bigmir.net/?a&c=d#e=f', ['a', 'c']), + cutURLParameter('//bigmir.net/?a&c=d#e=f', ['a', 'e']), + cutURLParameter('//bigmir.net/?a=b&c=d#e=f&g=h', ['c', 'g']), + cutURLParameter('//bigmir.net/?a=b&c=d#e', ['a', 'c']), + cutURLParameter('//bigmir.net/?a=b&c=d#e', ['a', 'e']), + cutURLParameter('//bigmir.net/?a=b&c=d#e&g=h', ['c', 'e']), + cutURLParameter('//bigmir.net/?a=b&c=d#e&g=h', ['e', 'g']), + cutURLParameter('//bigmir.net/?a=b&c=d#test?e=f&g=h', ['test', 'e']), + cutURLParameter('//bigmir.net/?a=b&c=d#test?e=f&g=h', ['test', 'g']); + +SELECT + cutURLParameter(materialize('http://bigmir.net/?a=b&c=d'), []), + cutURLParameter(materialize('http://bigmir.net/?a=b&c=d'), ['a']), + cutURLParameter(materialize('http://bigmir.net/?a=b&c=d'), ['a', 'c']), + cutURLParameter(materialize('http://bigmir.net/?a=b&c=d'), ['c']), + cutURLParameter(materialize('http://bigmir.net/?a=b&c=d#e=f'), ['a', 'e']), + cutURLParameter(materialize('http://bigmir.net/?a&c=d#e=f'), ['c', 'e']), + cutURLParameter(materialize('http://bigmir.net/?a&c=d#e=f'), ['e']), + cutURLParameter(materialize('http://bigmir.net/?a=b&c=d#e=f&g=h'), ['b', 'g']), + cutURLParameter(materialize('http://bigmir.net/?a=b&c=d#e'), ['a', 'e']), + cutURLParameter(materialize('http://bigmir.net/?a=b&c=d#e&g=h'), ['c', 'g']), + cutURLParameter(materialize('http://bigmir.net/?a=b&c=d#e&g=h'), ['e', 'g']), + cutURLParameter(materialize('http://bigmir.net/?a=b&c=d#test?e=f&g=h'), ['test', 'e']), + cutURLParameter(materialize('http://bigmir.net/?a=b&c=d#test?e=f&g=h'), ['test', 'g']), + cutURLParameter(materialize('//bigmir.net/?a=b&c=d'), []), + cutURLParameter(materialize('//bigmir.net/?a=b&c=d'), ['a']), + cutURLParameter(materialize('//bigmir.net/?a=b&c=d'), ['a', 'c']), + cutURLParameter(materialize('//bigmir.net/?a=b&c=d#e=f'), ['a', 'e']), + cutURLParameter(materialize('//bigmir.net/?a&c=d#e=f'), ['a']), + cutURLParameter(materialize('//bigmir.net/?a&c=d#e=f'), ['a', 'c']), + cutURLParameter(materialize('//bigmir.net/?a&c=d#e=f'), ['a', 'e']), + cutURLParameter(materialize('//bigmir.net/?a=b&c=d#e=f&g=h'), ['c', 'g']), + cutURLParameter(materialize('//bigmir.net/?a=b&c=d#e'), ['a', 'c']), + cutURLParameter(materialize('//bigmir.net/?a=b&c=d#e'), ['a', 'e']), + cutURLParameter(materialize('//bigmir.net/?a=b&c=d#e&g=h'), ['c', 'e']), + cutURLParameter(materialize('//bigmir.net/?a=b&c=d#e&g=h'), ['e', 'g']), + cutURLParameter(materialize('//bigmir.net/?a=b&c=d#test?e=f&g=h'), ['test', 'e']), + cutURLParameter(materialize('//bigmir.net/?a=b&c=d#test?e=f&g=h'), ['test', 'g']);