Categories: String
PARSE_URL
Returns the specified part of the URL or the value for the specified QUERY key.
Syntax
PARSE_URL(urlToParse VARCHAR, urlPartToExtract STRING [, queryKeyToExtract STRING]) → STRING
- urlToParse: Input URL to parse.
- urlPartToExtract: String that specifies the part of the URL to extract. Available values are HOST, PATH, QUERY, REF, PROTOCOL, AUTHORITY, FILE, and USERINFO.
- queryKeyToExtract (optional): Optional QUERY key to extract. If specified and the given QUERY key is found, the QUERY key value is returned. Otherwise, returns null.
Examples
PARSE_URL exampleSELECT parse_url('http://dremio.com/path/p1.php?query=1', 'QUERY')
-- query=1
SELECT parse_url('http://dremio.com/path/p1.php?query=1&k1=v1', 'QUERY', 'k1')
-- v1
SELECT parse_url('http://dremio.com/path/p1.php?query=1&k1=v1', 'QUERY', 'k2')
-- null