Spark SQL中的递归CTE [英] recursive cte in spark SQL

查看:1051
本文介绍了Spark SQL中的递归CTE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

; WITH  Hierarchy as 
        (
            select distinct PersonnelNumber
            , Email
            , ManagerEmail 
            from dimstage
            union all
            select e.PersonnelNumber
            , e.Email           
            , e.ManagerEmail 
            from dimstage  e
            join Hierarchy as  h on e.Email = h.ManagerEmail
        )
        select * from Hierarchy

您能在SPARK SQL中实现同样的效果吗?

Can you help acheive the same in SPARK SQL

推荐答案

使用SPARK SQL不可能做到这一点.存在WITH子句,但不支持CONNECT BY,例如ORACLE或DB2中的递归.

This is not possible using SPARK SQL. The WITH clause exists, but not for CONNECT BY like in, say, ORACLE, or recursion in DB2.

这篇关于Spark SQL中的递归CTE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆