Skip to Content
Presto实战
book

Presto实战

by Matt Fuller, Manfred Moser, Martin Traverso
March 2021
Intermediate to advanced
265 pages
6h 50m
Chinese
Posts & Telecom Press
Content preview from Presto实战
170
9
输出值的转换,用
->
隔开:
x -> x + 1
(x, y) -> x + y
x -> IF(x > 0, x, -x)
x -> x+1 (x, y) -> x + y x -> IF(x > 0, x, -x)
其他常用到
lambda
表达式的函数有
transform
filter
reduce
array_sort
none_match
any_match
all_match
等。
让我们看下面这个例子:
SELECT zip_with(ARRAY[1, 2, 6, 2, 5],
ARRAY[3, 4, 2, 5, 7],
(x, y) -> x + y);
[4, 6, 8, 7, 12]
如你所见,
lambda
表达式很简单但功能强大。它将两个数组中相同位置的元素相加,用
结果创建一个新的数组。简单来说,对两个数组同时进行迭代,每次迭代时都会调用该函
数,而无须编写代码来循环遍历数组数据结构。
9.21
 地理空间函数
Presto
所支持的
SQL
超出了标准
SQL
的范围,它包括了地理空间分析领域的一系列重要
函数。与其他支持的
SQL
特性一样
Presto
在这方面与其他工具的相关标准和使用方法尽
量保持一致。
地理空间函数
方面,
Presto
使用
ST_
前缀支持
SQL/MM
规范和开放地理空间信息联盟
OGC
)的
OpenGIS
规范。
因为对地理空间的
SQL
支持内容很多,所以本节只对此进行粗略的介绍。
Presto
支持众多的构造器从数据源处来创建地理空间对象:
•
ST_GeometryFromText(varchar) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

大数据项目管理:从规划到实现

大数据项目管理:从规划到实现

Ted Malaska, Jonathan Seidman
Google系统架构解密: 构建安全可靠的系统

Google系统架构解密: 构建安全可靠的系统

Heather Adkins, Betsy Beyer, Paul Blankinship, Piotr Lewandowski, Ana Oprea, Adam Stubblefield

Publisher Resources

ISBN: 9787115560056