0

Scala noob here.

I'm integrating a webcrawler that uses cascading internally (bixo). So i've been investing some time in porting an example they provide (see here) line by line.

So far I'm making little progress, and one thing I'm stuck with is at the sinkMap, basically a Map of cascading Taps.

I written that line as:

val sinkMap: Map[String, Tap] = Map[String, Tap]()

and that particular line is throwing me

[ant:scalac] /home/matias/.../Crawler.scala:18: error: class Tap takes type parameters
[ant:scalac]     val sinkMap: Map[String, Tap] = Map[String, Tap]()
[ant:scalac]                              ^
[ant:scalac] /home/matias/.../Crawler.scala:18: error: class Tap takes type parameters
[ant:scalac]     val sinkMap: Map[String, Tap] = Map[String, Tap]()
[ant:scalac]                                                 ^

I programming by coincidence here. But I'm certain the above code should work as I expect...

Any pointer is welcome.

tutuca
  • 3,444
  • 6
  • 32
  • 54

1 Answers1

3

According to the documentation the Tap class requires three type parameters, so you need to specify them in your map type.

e.g. Map[String, Tap[Scheme, BasePath, SinkMode]]

Lee
  • 142,018
  • 20
  • 234
  • 287
  • Sorry for the nooby question, but: Where did you get that from? I can't find a reference to BasePath in that doc. – tutuca Apr 02 '14 at 18:30
  • Also, is there a better (shorter) way to deal with all this? – tutuca Apr 02 '14 at 18:33
  • @tutuca - `BasePath` comes from the [sinkMap](https://github.com/bixo/bixo/blob/master/examples/src/main/java/bixo/examples/crawl/DemoCrawlWorkflow.java#L211) example you linked to in your question. I looked at the parameters of the `platform.makeTap` call to figure out the types. As for making it shorter, I'm not sure you can. The java examples omit them by referring to the raw types and then suppressing the warning at the top of the function. I don't know if there's a way to omit type arguments in the same way in Scala. – Lee Apr 02 '14 at 18:50