91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

如何使用scala編寫wordcount程序

發布時間:2021-12-09 09:20:18 來源:億速云 閱讀:169 作者:iii 欄目:開發技術

本篇內容介紹了“如何使用scala編寫wordcount程序”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!

直接上程序吧
一、公共類

  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  2.   <modelVersion>4.0.0</modelVersion>

  3.   <groupId>testScala</groupId>

  4.   <artifactId>testScala</artifactId>

  5.   <version>1.0</version>

  6.   <inceptionYear>2008</inceptionYear>

  7.   <properties>

  8.     <scala.version>2.11.8</scala.version>

  9.     <hadoop.version>2.6.0-cdh6.7.0</hadoop.version>

  10.     <spark.version>2.2.1</spark.version>

  11.     <mysql.version>5.1.25</mysql.version>

  12.   </properties>


  13.   <repositories>

  14.     <repository>

  15.       <id>scala-tools.org</id>

  16.       <name>Scala-Tools Maven2 Repository</name>

  17.       <url>http://scala-tools.org/repo-releases</url>

  18.     </repository>


  19.     <repository>

  20.       <id>cloudera</id>

  21.       <name>cloudera</name>

  22.       <url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>

  23.     </repository>

  24.   </repositories>


  25.   <pluginRepositories>

  26.     <pluginRepository>

  27.       <id>scala-tools.org</id>

  28.       <name>Scala-Tools Maven2 Repository</name>

  29.       <url>http://scala-tools.org/repo-releases</url>

  30.     </pluginRepository>

  31.   </pluginRepositories>


  32.   <dependencies>

  33.     <dependency>

  34.       <groupId>org.apache.spark</groupId>

  35.       <artifactId>spark-core_2.11</artifactId>

  36.       <version>${spark.version}</version>

  37.     </dependency>

  38.     <dependency>

  39.       <groupId>org.scala-lang</groupId>

  40.       <artifactId>scala-library</artifactId>

  41.       <version>${scala.version}</version>

  42.     </dependency>

  43.     <dependency>

  44.       <groupId>junit</groupId>

  45.       <artifactId>junit</artifactId>

  46.       <version>4.4</version>

  47.       <scope>test</scope>

  48.     </dependency>

  49.     <dependency>

  50.       <groupId>org.specs</groupId>

  51.       <artifactId>specs</artifactId>

  52.       <version>1.2.5</version>

  53.       <scope>test</scope>

  54.     </dependency>


  55.     <dependency>

  56.       <groupId>org.apache.hadoop</groupId>

  57.       <artifactId>hadoop-client</artifactId>

  58.       <version>${hadoop.version}</version>

  59.     </dependency>


  60.     <dependency>

  61.       <groupId>mysql</groupId>

  62.       <artifactId>mysql-connector-java</artifactId>

  63.       <version>${mysql.version}</version>

  64.     </dependency>

  65.   </dependencies>


  66.   <build>

  67.     <sourceDirectory>src/main/scala</sourceDirectory>

  68.     <testSourceDirectory>src/test/scala</testSourceDirectory>

  69.     <plugins>

  70.       <plugin>

  71.         <groupId>org.scala-tools</groupId>

  72.         <artifactId>maven-scala-plugin</artifactId>

  73.         <executions>

  74.           <execution>

  75.             <goals>

  76.               <goal>compile</goal>

  77.               <goal>testCompile</goal>

  78.             </goals>

  79.           </execution>

  80.         </executions>

  81.         <configuration>

  82.           <scalaVersion>${scala.version}</scalaVersion>

  83.           <args>

  84.             <arg>-target:jvm-1.5</arg>

  85.           </args>

  86.         </configuration>

  87.       </plugin>

  88.       <plugin>

  89.         <groupId>org.apache.maven.plugins</groupId>

  90.         <artifactId>maven-eclipse-plugin</artifactId>

  91.         <configuration>

  92.           <downloadSources>true</downloadSources>

  93.           <buildcommands>

  94.             <buildcommand>ch.epfl.lamp.sdt.core.scalabuilder</buildcommand>

  95.           </buildcommands>

  96.           <additionalProjectnatures>

  97.             <projectnature>ch.epfl.lamp.sdt.core.scalanature</projectnature>

  98.           </additionalProjectnatures>

  99.           <classpathContainers>

  100.             <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>

  101.             <classpathContainer>ch.epfl.lamp.sdt.launching.SCALA_CONTAINER</classpathContainer>

  102.           </classpathContainers>

  103.         </configuration>

  104.       </plugin>

  105.     </plugins>

  106.   </build>

  107.   <reporting>

  108.     <plugins>

  109.       <plugin>

  110.         <groupId>org.scala-tools</groupId>

  111.         <artifactId>maven-scala-plugin</artifactId>

  112.         <configuration>

  113.           <scalaVersion>${scala.version}</scalaVersion>

  114.         </configuration>

  115.       </plugin>

  116.     </plugins>

  117.   </reporting>

  118. </project>

六、測試數據
hdfs dfs -ls /ruozedata/scala
Found 3 items
-rw-r--r--   3 hadoop supergroup         24 2018-02-12 14:48 /ruozedata/scala/201802121449-1.txt
-rw-r--r--   3 hadoop supergroup         12 2018-02-12 14:48 /ruozedata/scala/201802121449-2.txt
-rw-r--r--   3 hadoop supergroup         12 2018-02-12 14:48 /ruozedata/scala/201802121449-3.txt
-----------------------------------------------------------------------------------------------------------
hdfs dfs -cat /ruozedata/scala/201802121449-1.txt
hello   world
hello   worls

hdfs dfs -cat /ruozedata/scala/201802121449-2.txt
hello   ruoze

hdfs dfs -cat /ruozedata/scala/201802121449-3.txt
ruoze   hello

七、測試結果
如何使用scala編寫wordcount程序

“如何使用scala編寫wordcount程序”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

额尔古纳市| 双柏县| 鹿邑县| 集贤县| 邢台县| 长治县| 个旧市| 阜城县| 云霄县| 长葛市| 塔城市| 临沂市| 镇远县| 海兴县| 苏尼特左旗| 汝城县| 郴州市| 南乐县| 封开县| 上高县| 都昌县| 苏尼特右旗| 黄山市| 河东区| 新源县| 东安县| 和龙市| 灵寿县| 汕尾市| 望都县| 绵阳市| 靖州| 泸溪县| 当涂县| 高清| 中方县| 汉中市| 长丰县| 沂水县| 镇安县| 精河县|