@ConstantFunction(name = "url_extract_parameter", argTypes = {VARCHAR, VARCHAR}, returnType = VARCHAR)
    public static ConstantOperator urlExtractParameter(ConstantOperator url, ConstantOperator parameter) {
        List<NameValuePair> parametersAndValues = null;
        try {
            parametersAndValues = URLEncodedUtils.parse(new URI(url.getVarchar()), Charset.forName("UTF-8"));
            String parameterName = parameter.getVarchar();
            for (NameValuePair nv : parametersAndValues) {
                if (nv.getName().equals(parameterName)) {
                    return ConstantOperator.createVarchar(nv.getValue());
                }
            }
        } catch (URISyntaxException e) {
            return ConstantOperator.createNull(Type.VARCHAR);
        }
        return ConstantOperator.createNull(Type.VARCHAR);
    }
@Test
    public void testUrlExtractParameter() {
        assertEquals("100", ScalarOperatorFunctions.urlExtractParameter(
                new ConstantOperator("https://starrocks.com/doc?k1=100&k2=3", Type.VARCHAR),
                new ConstantOperator("k1", Type.VARCHAR)
        ).getVarchar());
        assertEquals(ScalarOperatorFunctions.urlExtractParameter(
                        new ConstantOperator("1234i5", Type.VARCHAR),
                        new ConstantOperator("k1", Type.VARCHAR)),
                ConstantOperator.createNull(Type.VARCHAR));
        assertEquals(ScalarOperatorFunctions.urlExtractParameter(
                        new ConstantOperator("https://starrocks.com/doc?k1=100&k2=3", Type.VARCHAR),
                        new ConstantOperator("k3", Type.VARCHAR)),
                ConstantOperator.createNull(Type.VARCHAR));
    }