我做了一个算法,我得到了许多名称逻辑和数字后缀的列,我需要做coalesce但我不知道如何应用coalesce不同数量的列.
例:
|id|logic_01|logic_02|logic_03|
|1 | null |a |null |
|2 | null |b |null |
|3 | c | null |null |
|4 | null | null |d |
Run Code Online (Sandbox Code Playgroud)
响应:
|id|logic|
|1 | a |
|2 | b |
|3 | c |
|4 | d |
Run Code Online (Sandbox Code Playgroud)
另一个例子:
|id|logic_01|logic_02|logic_03|logic_04|
|1 | null |a |null |null |
|2 | null | null |null |b |
|3 | c | null |null |null | …Run Code Online (Sandbox Code Playgroud) null scala user-defined-functions apache-spark apache-spark-sql
我理解为BiFunction的合同,其函数方法为apply(T t,U u),它接受两个参数.但事实是,我不明白使用它的优点.你能帮帮我吗?