-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathurl.html
155 lines (133 loc) · 7.24 KB
/
url.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>6.18. URL Functions — Presto 0.204 Documentation</title>
<link rel="stylesheet" href="../_static/presto.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.204',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="top" title="Presto 0.204 Documentation" href="../index.html" />
<link rel="up" title="6. Functions and Operators" href="../functions.html" />
<link rel="next" title="6.19. Geospatial Functions" href="geospatial.html" />
<link rel="prev" title="6.17. Map Functions and Operators" href="map.html" />
</head>
<body role="document">
<div class="header">
<h1 class="heading"><a href="../index.html">
<span>Presto 0.204 Documentation</span></a></h1>
<h2 class="heading"><span>6.18. URL Functions</span></h2>
</div>
<div class="topnav">
<p class="nav">
<span class="left">
« <a href="map.html">6.17. Map Functions and Operators</a>
</span>
<span class="right">
<a href="geospatial.html">6.19. Geospatial Functions</a> »
</span>
</p>
</div>
<div class="content">
<div class="section" id="url-functions">
<h1>6.18. URL Functions</h1>
<div class="section" id="extraction-functions">
<h2>Extraction Functions</h2>
<p>The URL extraction functions extract components from HTTP URLs
(or any valid URIs conforming to <span class="target" id="index-0"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc2396.html"><strong>RFC 2396</strong></a>).
The following syntax is supported:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>[protocol:][//host[:port]][path][?query][#fragment]
</pre></div>
</div>
<p>The extracted components do not contain URI syntax separators
such as <code class="docutils literal"><span class="pre">:</span></code> or <code class="docutils literal"><span class="pre">?</span></code>.</p>
<dl class="function">
<dt id="url_extract_fragment">
<code class="descname">url_extract_fragment</code><span class="sig-paren">(</span><em>url</em><span class="sig-paren">)</span> → varchar</dt>
<dd><p>Returns the fragment identifier from <code class="docutils literal"><span class="pre">url</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="url_extract_host">
<code class="descname">url_extract_host</code><span class="sig-paren">(</span><em>url</em><span class="sig-paren">)</span> → varchar</dt>
<dd><p>Returns the host from <code class="docutils literal"><span class="pre">url</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="url_extract_parameter">
<code class="descname">url_extract_parameter</code><span class="sig-paren">(</span><em>url</em>, <em>name</em><span class="sig-paren">)</span> → varchar</dt>
<dd><p>Returns the value of the first query string parameter named <code class="docutils literal"><span class="pre">name</span></code>
from <code class="docutils literal"><span class="pre">url</span></code>. Parameter extraction is handled in the typical manner
as specified by <span class="target" id="index-1"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc1866.html#section-8.2.1"><strong>RFC 1866#section-8.2.1</strong></a>.</p>
</dd></dl>
<dl class="function">
<dt id="url_extract_path">
<code class="descname">url_extract_path</code><span class="sig-paren">(</span><em>url</em><span class="sig-paren">)</span> → varchar</dt>
<dd><p>Returns the path from <code class="docutils literal"><span class="pre">url</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="url_extract_port">
<code class="descname">url_extract_port</code><span class="sig-paren">(</span><em>url</em><span class="sig-paren">)</span> → bigint</dt>
<dd><p>Returns the port number from <code class="docutils literal"><span class="pre">url</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="url_extract_protocol">
<code class="descname">url_extract_protocol</code><span class="sig-paren">(</span><em>url</em><span class="sig-paren">)</span> → varchar</dt>
<dd><p>Returns the protocol from <code class="docutils literal"><span class="pre">url</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="url_extract_query">
<code class="descname">url_extract_query</code><span class="sig-paren">(</span><em>url</em><span class="sig-paren">)</span> → varchar</dt>
<dd><p>Returns the query string from <code class="docutils literal"><span class="pre">url</span></code>.</p>
</dd></dl>
</div>
<div class="section" id="encoding-functions">
<h2>Encoding Functions</h2>
<dl class="function">
<dt id="url_encode">
<code class="descname">url_encode</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span> → varchar</dt>
<dd><p>Escapes <code class="docutils literal"><span class="pre">value</span></code> by encoding it so that it can be safely included in
URL query parameter names and values:</p>
<ul class="simple">
<li>Alphanumeric characters are not encoded.</li>
<li>The characters <code class="docutils literal"><span class="pre">.</span></code>, <code class="docutils literal"><span class="pre">-</span></code>, <code class="docutils literal"><span class="pre">*</span></code> and <code class="docutils literal"><span class="pre">_</span></code> are not encoded.</li>
<li>The ASCII space character is encoded as <code class="docutils literal"><span class="pre">+</span></code>.</li>
<li>All other characters are converted to UTF-8 and the bytes are encoded
as the string <code class="docutils literal"><span class="pre">%XX</span></code> where <code class="docutils literal"><span class="pre">XX</span></code> is the uppercase hexadecimal
value of the UTF-8 byte.</li>
</ul>
</dd></dl>
<dl class="function">
<dt id="url_decode">
<code class="descname">url_decode</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span> → varchar</dt>
<dd><p>Unescapes the URL encoded <code class="docutils literal"><span class="pre">value</span></code>.
This function is the inverse of <a class="reference internal" href="#url_encode" title="url_encode"><code class="xref py py-func docutils literal"><span class="pre">url_encode()</span></code></a>.</p>
</dd></dl>
</div>
</div>
</div>
<div class="bottomnav">
<p class="nav">
<span class="left">
« <a href="map.html">6.17. Map Functions and Operators</a>
</span>
<span class="right">
<a href="geospatial.html">6.19. Geospatial Functions</a> »
</span>
</p>
</div>
<div class="footer" role="contentinfo">
</div>
</body>
</html>