千家信息网

如何使用scala编写wordcount程序

发表于:2025-02-02 作者:千家信息网编辑
千家信息网最后更新 2025年02月02日,本篇内容介绍了"如何使用scala编写wordcount程序"的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有
千家信息网最后更新 2025年02月02日如何使用scala编写wordcount程序

本篇内容介绍了"如何使用scala编写wordcount程序"的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

直接上程序吧
一、公共类


  1. 4.0.0

  2. testScala

  3. testScala

  4. 1.0

  5. 2008


  6. 2.11.8

  7. 2.6.0-cdh6.7.0

  8. 2.2.1

  9. 5.1.25





  10. scala-tools.org

  11. Scala-Tools Maven2 Repository

  12. http://scala-tools.org/repo-releases




  13. cloudera

  14. cloudera

  15. https://repository.cloudera.com/artifactory/cloudera-repos/






  16. scala-tools.org

  17. Scala-Tools Maven2 Repository

  18. http://scala-tools.org/repo-releases






  19. org.apache.spark

  20. spark-core_2.11

  21. ${spark.version}



  22. org.scala-lang

  23. scala-library

  24. ${scala.version}



  25. junit

  26. junit

  27. 4.4

  28. test



  29. org.specs

  30. specs

  31. 1.2.5

  32. test




  33. org.apache.hadoop

  34. hadoop-client

  35. ${hadoop.version}




  36. mysql

  37. mysql-connector-java

  38. ${mysql.version}





  39. src/main/scala

  40. src/test/scala



  41. org.scala-tools

  42. maven-scala-plugin




  43. compile

  44. testCompile





  45. ${scala.version}


  46. -target:jvm-1.5





  47. org.apache.maven.plugins

  48. maven-eclipse-plugin


  49. true


  50. ch.epfl.lamp.sdt.core.scalabuilder



  51. ch.epfl.lamp.sdt.core.scalanature



  52. org.eclipse.jdt.launching.JRE_CONTAINER

  53. ch.epfl.lamp.sdt.launching.SCALA_CONTAINER









  54. org.scala-tools

  55. maven-scala-plugin


  56. ${scala.version}





六、测试数据
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程序"的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注网站,小编将为大家输出更多高质量的实用文章!

0