<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # Scalding 解釋器 原文鏈接 : [http://zeppelin.apache.org/docs/0.7.2/interpreter/scalding.html](http://zeppelin.apache.org/docs/0.7.2/interpreter/scalding.html) 譯文鏈接 : [http://www.apache.wiki/pages/viewpage.action?pageId=10030908](http://www.apache.wiki/pages/viewpage.action?pageId=10030908) 貢獻者 : [片刻](/display/~jiangzhonglian) [ApacheCN](/display/~apachecn) [Apache中文網](/display/~apachechina) [Scalding](https://github.com/twitter/scalding)是一個用于編寫MapReduce工作的開源Scala庫。 ## 構建Scalding 解釋器 您必須首先通過啟用**燙傷**配置文件來構建Scalding解釋器,如下所示: ``` mvn clean package -Pscalding -DskipTests? ``` ## 啟用Scalding 解釋器 在筆記本電腦,使用Scalding解釋器,點擊**齒輪**圖標,選擇Scalding,并創下**保存**。 ![](https://img.kancloud.cn/be/4e/be4ef7af657b337a9fd653e71d2923d0_216x89.jpg) ![](https://img.kancloud.cn/f6/49/f6493c2c26d94e6d1bf71e138b284198_261x252.jpg) ## 配置解釋器 Scalding解釋器有兩種模式: * 本地 * HDFS 在本地模式下,您可以訪問本地服務器上的文件,并在本地完成Scalding轉換。 在hdfs模式下,您可以訪問HDFS中的文件,并且燙印轉換將以hadoop map-reduce作業運行。 Zeppelin配有預配置的Scalding解釋器在本地模式。 要在hdfs模式下運行Scalding解釋器,您必須執行以下操作: **使用ZEPPELIN_CLASSPATH_OVERRIDES設置類路徑** 在conf /?_zeppelin env.sh中,您必須將ZEPPELIN_?CLASSPATH_OVERRIDES?_設置_為“hadoop classpath”的內容,以及使用您的燙傷命令所需的自定義jar文件的目錄。 **設置Scalding復制的參數** 默認參數為:“--local --repl” 對于hdfs模式,您需要添加:“--hdfs --repl” 如果要添加自定義jar,則需要添加:“-libjars directory /?_:directory /_?” 對于reducer估計,您需要添加以下內容:“-Dscalding.reducer.estimator.classes = com.twitter.scalding.reducer_estimation.InputSizeReducerEstimator” **設置max.open.instances** 如果要控制最大數量的打開解釋器,您必須為note選項選擇“scoped”解釋器,并設置max.open.instances參數。 ## 測試解釋器 ### 本地模式 例如,通過使用“?[愛麗絲夢游仙境”](https://gist.github.com/johnynek/a47699caa62f4f38a3e2)教程,我們將計算單詞(當然!),并繪制書中前十個單詞的圖形。 ``` %scalding import scala.io.Source // Get the Alice in Wonderland book from gutenberg.org: val alice = Source.fromURL("http://www.gutenberg.org/files/11/11.txt").getLines val aliceLineNum = alice.zipWithIndex.toList val alicePipe = TypedPipe.from(aliceLineNum) // Now get a list of words for the book: val aliceWords = alicePipe.flatMap { case (text, _) => text.split("\\s+").toList } // Now lets add a count for each word: val aliceWithCount = aliceWords.filterNot(_.equals("")).map { word => (word, 1L) } // let's sum them for each word: val wordCount = aliceWithCount.group.sum print ("Here are the top 10 words\n") val top10 = wordCount .groupAll .sortBy { case (word, count) => -count } .take(10) top10.dump ``` ``` %scalding val table = "words\t count\n" + top10.toIterator.map{case (k, (word, count)) => s"$word\t$count"}.mkString("\n") print("%table " + table) ? ``` 如果您點擊餅圖的圖標,您應該可以看到如下圖表:? ![](https://img.kancloud.cn/58/06/5806ca7a4d687e17837c4390de5ec381_566x194.jpg) ### HDFS模式 **測試模式** ``` %scalding mode ? ``` 此命令應打印: ``` res4: com.twitter.scalding.Mode = Hdfs(true,Configuration: core-default.xml, core-site.xml, mapred-default.xml, mapred-site.xml, yarn-default.xml, yarn-site.xml, hdfs-default.xml, hdfs-site.xml)? ``` **測試HDFS讀取** ``` val testfile = TypedPipe.from(TextLine("/user/x/testfile")) testfile.dump ? ``` 此命令應打印hdfs文件/user/x/testfile?的內容。 **測試**map-reduce job**** ``` val testfile = TypedPipe.from(TextLine("/user/x/testfile")) val a = testfile.groupAll.size.values a.toList ? ``` 該命令應該創建一個map reduce作業。 ## 未來的工作 * 更好的用戶反饋(hadoop url,進度更新) * 能夠取消工作 * 能夠動態加載jar而不重新啟動解釋器 * 多用戶可擴展性(在不同服務器上運行燙傷解釋器)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看