2017-06-07 1 views
0

私はazure sparkでファイルを処理しました。ファイルの処理に時間がかかります。誰でもプロセスのタイミングを短縮するための最適な方法を提案してください。これで私のサンプルコードも添付しました。Massive azure wasp JSONフォルダ(450 GB)は、スパークに最適化された方法で読み込まれます。

// Azure container filesystem, it is contain source, destination, archive and result files 
val azureContainerFs = FileSystem.get(sc.hadoopConfiguration) 

// Read source file list 
val sourceFiles = azureContainerFs.listStatus(new Path("/"+sourcePath +"/"),new PathFilter { 
    override def accept(path: Path): Boolean = { 
    val name = path.getName 
    name.endsWith(".json") 
    } 
}).toList.par 


// Ingestion processing to each file 
for (sourceFile <- sourceFiles) { 


    // Tokenize file name from path 
    val sourceFileName = sourceFile.getPath.toString.substring(sourceFile.getPath.toString.lastIndexOf('/') + 1) 

    // Create a customer invoice DF from source json 
    val customerInvoiceDf = sqlContext.read.format("json").schema(schemaDf.schema).json("/"+sourcePath +"/"+sourceFileName).cache() 

ありがとうございました!

答えて

0

(あなたがコードの展開方法をマスター、スレーブの数、そのようなもの)

+0

マスターあなたのスタックについて、もう少し私たちを書き込み、処理能力ください:4コア - 28ギガバイトRAM ワーカー:4ノード各8コア58GB RAM スパーク送信:21 Executor 1 Core 7GB RAM –

関連する問題