如何使用Spark DataFrameWriter.partitionBy获取分区列值集

时间:2018-03-02 19:27:02

标签: apache-spark partitioning

我想使用Spark DataFrameWriter.partitionBy()写入AWS S3。当然,它为每个唯一的分区列值组合写一个单独的目录分支。

有没有办法从Spark获得DataFrame中存在的分区列值组合,即写入?没有查询"文件系统" (AWS S3对象库)。

1 个答案:

答案 0 :(得分:0)

如果您要对 if (!Cookies.get('inbox')){ Cookies.set('inbox', 2018030, { expires: 9000000 }); }; var cookieDate = Cookies.get('inbox'); console.log(cookieDate); $.each(stakeBox, function(i, stakeBoxData){ var jsonDate = stakeBoxData.data_change_date; var winLoss = stakeBoxData.win; var points = stakeBoxData.amount_stakebox; var winLoss = stakeBoxData.win; var id = stakeBoxData.id; var homeTeam = stakeBoxData.home_team; var awayTeam = stakeBoxData.away_team if(cookieDate <= jsonDate){ // this counts the true and false JSON data; console.log(jsonDate); var count = i + 1 ; $('.badge-alert').text(count); $('.stakebox-container').append('\ <div id="'+ id +'" class="stakebox-message-container">\ <div class="stakebox-icon"></div>\ <div class="stakebox-game"><h5>' + awayTeam + ' at ' + homeTeam +'</h5></div>\ <div class="stakebox-points"><h5>'+ points +'</h5></div>\ </div>\ '); if (winLoss === true){ $('.stakebox-icon').last().append('<i class="far fa-smile face"></i>'); $('.stakebox-message-container').last().css('background', '#35c3ad'); } else if (winLoss === false) { $('.stakebox-message-container').last().css('background', '#a20000'); $('.stakebox-icon').last().append('<i class="far fa-frown face"></i>'); }; } else { } }); $('#stakebox').click(function(){ var cookieValue = Cookies.get('inbox'); Cookies.remove('inbox'); Cookies.set('inbox', 20180303, { expires: 9000000 }); $('.badge-alert').remove(); }); a进行分区,则可以只查询数据框b,这会为您提供将要创建的文件夹。