List:hdtList
forecast_id bigint,period_year bigint,period_num bigint,period_name string,drm_org string,ledger_id bigint,currency_code string,source_system_name string,source_record_type string,gl_source_name string,gl_source_system_name string,year string
我有一个
List: partition_columns
source_system_name, period_year
使用
列表:分区列
,我正在尝试匹配它们并在中移动相应的列
List: hdtList
结束语如下:
val (pc, notPc) = hdtList.partition(c => partition_columns.contains(c.takeWhile(x => x != ' ')))
但当我把它们打印成:
println(notPc.mkString(",") + "," + pc.mkString(","))
forecast_id bigint,period_num bigint,period_name string,drm_org string,ledger_id bigint,currency_code string,source_record_type string,gl_source_name string,gl_source_system_name string,year string,period string,period_year bigint,source_system_name string
period_year
先到先得
source_system_name
最后一个。是否有任何我可以使数据如下,以便列的顺序在
保持。
forecast_id bigint,period_num bigint,period_name string,drm_org string,ledger_id bigint,currency_code string,source_record_type string,gl_source_name string,gl_source_system_name string,year string,period string,source_system_name string,period_year bigint