1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
val selectedCols= "audio_lang,category_name,duration,end_time,first_show_time,origin_time,owner_code,owner_name,phone_no,program_title,region,res_name,res_type,resolution,sm_name,station_name,terminal_no,vod_cat_tags,vod_title"
val selectedColsArr = selectedCols.split(",")
val firstCol = selectedColsArr(0).trim
val tailCols = selectedColsArr.slice(1, selectedColsArr.length).map(_.trim)
val esDf = allExistTables.map { x => val index = x.split("/")(0) spark.esDF(index, defaultQuery, options) }.reduce((x1, x2) => x1.select(firstCol, tailCols: _*).union(x2.select(firstCol, tailCols: _*)) )
esDf.printSchema()
esDf.count()
esDf.select("terminal_no", "phone_no").show(10, false)
|