apache-spark - SparkSQL:在 Transform Lambda 中使用 SQL
问题描述
我无法访问 Spark SQL 转换函数的内联 SQL 命令中的 lambda 变量。
我不想爆炸并执行连接。我希望执行内联连接以获取电子邮件的值。
错误。
AnalysisException: cannot resolve '`y.email`' given input columns: [lkp.id, lkp.display_name, lkp.email_address, lkp.uuid]
代码。
transform (
x.license_admin,
y -> struct (
get_uuid(lower(trim(y.email))) as email,
( select coalesce(lkp.uuid, get_uuid(lower(trim(y.email))))
from lkp_uuid_email_map lkp
where lkp.email_address = lower(trim(y.email))
) as email_02,
generic_hash(y.first_name) as first_name
)
) as license_admin,
列模式
|-- order_line_items: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- additional_notes: string (nullable = true)
| | |-- amount: double (nullable = true)
| | |-- discounts: array (nullable = true)
| | | |-- element: struct (containsNull = true)
| | | | |-- discount_amount: double (nullable = true)
| | | | |-- discount_percentage: string (nullable = true)
| | | | |-- discount_reason: string (nullable = true)
| | |-- id: string (nullable = true)
| | |-- license_admin: array (nullable = true)
| | | |-- element: struct (containsNull = true)
| | | | |-- email: string (nullable = true)
| | | | |-- first_name: string (nullable = true)
| | | | |-- last_name: string (nullable = true)
| | | | |-- license_admin_id: string (nullable = true)
提前致谢。
解决方案
推荐阅读
- python - 如何在python中重新排列列表
- ios - 无法在 iOS 上运行 react-native-unimodules
- sparql - SPARQLWrapper 不能使 CONSTRUCT 查询返回 XML 以外的其他查询
- jquery - 单击子菜单时,我想将类添加到父菜单
- excel - VBA在运行脚本时不刷新数据,只有在
- python-3.x - 如何从 Python pod 中访问 kube-apiserver?
- c# - 将查询字符串传递给 HttpRequestMessage
- angularjs - 过滤 JSON 数组
- javascript - 在 React JS 中使用 key 属性
- android - 通过 Safe Args 将数据传回之前的 Fragment。这怎么可能?