Databricks 上的 SQL 编程.pdf

编号:167499 PDF 42页 695.03KB 下载积分:VIP专享
下载报告请您先登录!

Databricks 上的 SQL 编程.pdf

1、2024 Databricks Inc.All rights reservedSQL SQL PROGRAMMING IN PROGRAMMING IN DATABRICKSDATABRICKSSerge Rielau&Milan StefanovicSerge Rielau&Milan StefanovicJune 2024June 202412024 Databricks Inc.All rights reserved Sorting Sorting-your wayyour waySorting points by distance using LAMBDA and SQL UDFSor

2、ting strings,properly(Sneak peek!)Short handsShort handsGROUP BY,ORDER BYSELECT*-unleashed VariablesVariablesSQL Session VariablesWhat about identifiers?ScriptingScriptingEXECUTE IMMEDIATESQL/PSM:Its like SQL,but scripted(Sneak peek!)2AgendaAgenda2024 Databricks Inc.All rights reserved Task“Sort an

3、array of points by distance from(0,0)”Need a custom sort orderarray_sort()for sortinglambda function for the math Hide complexity in a SQL UDF3Sorting Sorting-Your wayYour wayQuicksort and custom sort expressionsQuicksort and custom sort expressions2024 Databricks Inc.All rights reserved Can be pass

4、ed to a number of builtin map/array functions Operates on each element,value of the map/arrayp-expr(p)(p,.)-expr(p,.)p:One or more identifiers,as required by the host function.expr(p,.):A simple(no subqueries,or SQL UDF)expression using p.Result must comply with expectations of the host function.4LA

5、MBDA functionsLAMBDA functionsAnonymous function with one or more named parameters2024 Databricks Inc.All rights reserved SELECTSELECT array_sort(array(5,2,8,1,3),(a,b)-a-b)ASAS sorted;=1,2,3,5,8Sorting Distancesd=sqrt(x*x+y*y)d1 d2 x1*x1+y1*y1 0=a blambda(a,b)0=a bdxy2024 Databricks Inc.All rights

6、reserved SELECTSELECT array_sort(points,(p1,p2)-(p1.x*p1.x+p1.y*p1.y)-(p2.x*p2.x+p2.y*p2.y)ASAS pointsFROMFROM point_arrays;=,6Sorting by distanceSorting by distancelambda(p1,p2)0 (x1*x1+y1*y1)(x2*x2+y2*y2)lambda(p1,p2)0 (x1*x1+y1*y1)(x2*x2+y2*y2)dxy2024 Databricks Inc.All rights reserved Stored in

友情提示

1、下载报告失败解决办法
2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
4、本站报告下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。

本文(Databricks 上的 SQL 编程.pdf)为本站 (张5G) 主动上传,三个皮匠报告文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三个皮匠报告文库(点击联系客服),我们立即给予删除!

温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。
客服
商务合作
小程序
服务号
折叠