-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathbinary.html
193 lines (162 loc) · 9.03 KB
/
binary.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!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.10. Binary Functions and Operators — Presto 0.192 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.192',
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.192 Documentation" href="../index.html" />
<link rel="up" title="6. Functions and Operators" href="../functions.html" />
<link rel="next" title="6.11. JSON Functions and Operators" href="json.html" />
<link rel="prev" title="6.9. Regular Expression Functions" href="regexp.html" />
</head>
<body role="document">
<div class="header">
<h1 class="heading"><a href="../index.html">
<span>Presto 0.192 Documentation</span></a></h1>
<h2 class="heading"><span>6.10. Binary Functions and Operators</span></h2>
</div>
<div class="topnav">
<p class="nav">
<span class="left">
« <a href="regexp.html">6.9. Regular Expression Functions</a>
</span>
<span class="right">
<a href="json.html">6.11. JSON Functions and Operators</a> »
</span>
</p>
</div>
<div class="content">
<div class="section" id="binary-functions-and-operators">
<h1>6.10. Binary Functions and Operators</h1>
<div class="section" id="binary-operators">
<h2>Binary Operators</h2>
<p>The <code class="docutils literal"><span class="pre">||</span></code> operator performs concatenation.</p>
</div>
<div class="section" id="binary-functions">
<h2>Binary Functions</h2>
<dl class="function">
<dt>
<code class="descname">length</code><span class="sig-paren">(</span><em>binary</em><span class="sig-paren">)</span> → bigint</dt>
<dd><p>Returns the length of <code class="docutils literal"><span class="pre">binary</span></code> in bytes.</p>
</dd></dl>
<dl class="function">
<dt>
<code class="descname">concat</code><span class="sig-paren">(</span><em>binary1</em>, <em>...</em>, <em>binaryN</em><span class="sig-paren">)</span> → varbinary</dt>
<dd><p>Returns the concatenation of <code class="docutils literal"><span class="pre">binary1</span></code>, <code class="docutils literal"><span class="pre">binary2</span></code>, <code class="docutils literal"><span class="pre">...</span></code>, <code class="docutils literal"><span class="pre">binaryN</span></code>.
This function provides the same functionality as the
SQL-standard concatenation operator (<code class="docutils literal"><span class="pre">||</span></code>).</p>
</dd></dl>
<dl class="function">
<dt id="to_base64">
<code class="descname">to_base64</code><span class="sig-paren">(</span><em>binary</em><span class="sig-paren">)</span> → varchar</dt>
<dd><p>Encodes <code class="docutils literal"><span class="pre">binary</span></code> into a base64 string representation.</p>
</dd></dl>
<dl class="function">
<dt id="from_base64">
<code class="descname">from_base64</code><span class="sig-paren">(</span><em>string</em><span class="sig-paren">)</span> → varbinary</dt>
<dd><p>Decodes binary data from the base64 encoded <code class="docutils literal"><span class="pre">string</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="to_base64url">
<code class="descname">to_base64url</code><span class="sig-paren">(</span><em>binary</em><span class="sig-paren">)</span> → varchar</dt>
<dd><p>Encodes <code class="docutils literal"><span class="pre">binary</span></code> into a base64 string representation using the URL safe alphabet.</p>
</dd></dl>
<dl class="function">
<dt id="from_base64url">
<code class="descname">from_base64url</code><span class="sig-paren">(</span><em>string</em><span class="sig-paren">)</span> → varbinary</dt>
<dd><p>Decodes binary data from the base64 encoded <code class="docutils literal"><span class="pre">string</span></code> using the URL safe alphabet.</p>
</dd></dl>
<dl class="function">
<dt id="to_hex">
<code class="descname">to_hex</code><span class="sig-paren">(</span><em>binary</em><span class="sig-paren">)</span> → varchar</dt>
<dd><p>Encodes <code class="docutils literal"><span class="pre">binary</span></code> into a hex string representation.</p>
</dd></dl>
<dl class="function">
<dt id="from_hex">
<code class="descname">from_hex</code><span class="sig-paren">(</span><em>string</em><span class="sig-paren">)</span> → varbinary</dt>
<dd><p>Decodes binary data from the hex encoded <code class="docutils literal"><span class="pre">string</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="to_big_endian_64">
<code class="descname">to_big_endian_64</code><span class="sig-paren">(</span><em>bigint</em><span class="sig-paren">)</span> → varbinary</dt>
<dd><p>Encodes <code class="docutils literal"><span class="pre">bigint</span></code> in a 64-bit 2’s complement big endian format.</p>
</dd></dl>
<dl class="function">
<dt id="from_big_endian_64">
<code class="descname">from_big_endian_64</code><span class="sig-paren">(</span><em>binary</em><span class="sig-paren">)</span> → bigint</dt>
<dd><p>Decodes <code class="docutils literal"><span class="pre">bigint</span></code> value from a 64-bit 2’s complement big endian <code class="docutils literal"><span class="pre">binary</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="to_ieee754_32">
<code class="descname">to_ieee754_32</code><span class="sig-paren">(</span><em>real</em><span class="sig-paren">)</span> → varbinary</dt>
<dd><p>Encodes <code class="docutils literal"><span class="pre">real</span></code> in a 32-bit big-endian binary according to IEEE 754 single-precision floating-point format.</p>
</dd></dl>
<dl class="function">
<dt id="to_ieee754_64">
<code class="descname">to_ieee754_64</code><span class="sig-paren">(</span><em>double</em><span class="sig-paren">)</span> → varbinary</dt>
<dd><p>Encodes <code class="docutils literal"><span class="pre">double</span></code> in a 64-bit big-endian binary according to IEEE 754 double-precision floating-point format.</p>
</dd></dl>
<dl class="function">
<dt id="crc32">
<code class="descname">crc32</code><span class="sig-paren">(</span><em>binary</em><span class="sig-paren">)</span> → bigint</dt>
<dd><p>Computes the CRC-32 of <code class="docutils literal"><span class="pre">binary</span></code>. For general purpose hashing, use
<a class="reference internal" href="#xxhash64" title="xxhash64"><code class="xref py py-func docutils literal"><span class="pre">xxhash64()</span></code></a>, as it is much faster and produces a better quality hash.</p>
</dd></dl>
<dl class="function">
<dt id="md5">
<code class="descname">md5</code><span class="sig-paren">(</span><em>binary</em><span class="sig-paren">)</span> → varbinary</dt>
<dd><p>Computes the md5 hash of <code class="docutils literal"><span class="pre">binary</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="sha1">
<code class="descname">sha1</code><span class="sig-paren">(</span><em>binary</em><span class="sig-paren">)</span> → varbinary</dt>
<dd><p>Computes the sha1 hash of <code class="docutils literal"><span class="pre">binary</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="sha256">
<code class="descname">sha256</code><span class="sig-paren">(</span><em>binary</em><span class="sig-paren">)</span> → varbinary</dt>
<dd><p>Computes the sha256 hash of <code class="docutils literal"><span class="pre">binary</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="sha512">
<code class="descname">sha512</code><span class="sig-paren">(</span><em>binary</em><span class="sig-paren">)</span> → varbinary</dt>
<dd><p>Computes the sha512 hash of <code class="docutils literal"><span class="pre">binary</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="xxhash64">
<code class="descname">xxhash64</code><span class="sig-paren">(</span><em>binary</em><span class="sig-paren">)</span> → varbinary</dt>
<dd><p>Computes the xxhash64 hash of <code class="docutils literal"><span class="pre">binary</span></code>.</p>
</dd></dl>
</div>
</div>
</div>
<div class="bottomnav">
<p class="nav">
<span class="left">
« <a href="regexp.html">6.9. Regular Expression Functions</a>
</span>
<span class="right">
<a href="json.html">6.11. JSON Functions and Operators</a> »
</span>
</p>
</div>
<div class="footer" role="contentinfo">
</div>
</body>
</html>