简体   繁体   English

如何使用本地输入文件在本地模式下运行烫伤测试

[英]how to run scalding test in local mode with local input file

Scalding has a great utility to run an integration test for the job flow. Scalding 有一个很好的实用程序来运行工作流的集成测试。 In this way the inputs and outputs are the in-memory buffer这样,输入和输出就是内存缓冲区

val input = List("0" -> "This a a day")
val expectedOutput = List(("This", 1),("a", 2),("day", 1))
 JobTest(classOf[WordCountJob].getName)
  .arg("input", "input-data")
  .arg("output", "output-data")
  .source(TextLine("input-data"), input)
  .sink(Tsv("output-data")) {
  buffer: mutable.Buffer[(String, Int)] => {
    buffer should equal(expectedOutput)
  }
}.run

How can I transfare/write another code that will read input and write output to the real local file?如何转换/编写另一个代码来读取输入并将 output 写入真正的本地文件? Like FileTap/LFS in cascading - and not an in-memory approach像级联中的 FileTap/LFS - 而不是内存中的方法

You might check out HadoopPlatformJobTest and the TypedParquetTupleTest.scala example which uses a local mini-cluster.您可以查看使用本地小型集群的 HadoopPlatformJobTest 和TypedParquetTupleTest.scala示例。

This unit test writes to a "MiniLocalCLuster" - While it's not directly a file, but accessible via reading the local minicluster with Hadoop filesystem.此单元测试写入“MiniLocalCLuster” - 虽然它不是直接文件,但可以通过使用 Hadoop 文件系统读取本地 minicluster 来访问。

Given you local file scenario, maybe you can copies the files with local reads to the mini-HDFS.给定本地文件场景,也许您可以将具有本地读取的文件复制到 mini-HDFS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM