2015-04-09 20 views
10

ben resmi belgelere örnekler almak bile, ÖrneğinFlink Scala API "yeterli argümanlar değil"

Apache Flink Scala API kullanarak sorun yaşıyorum, scala derleyici bana derleme hataları ton verir.

Kodu:

object TestFlink { 

    def main(args: Array[String]) { 
    val env = ExecutionEnvironment.getExecutionEnvironment 
    val text = env.fromElements(
     "Who's there?", 
     "I think I hear them. Stand, ho! Who's there?") 

    val counts = text.flatMap { _.toLowerCase.split("\\W+") filter { _.nonEmpty } } 
     .map { (_, 1) } 
     .groupBy(0) 
     .sum(1) 

    counts.print() 

    env.execute("Scala WordCount Example") 
    } 
} 

Scala IDE hattı için aşağıdaki çıkışı val text = env.fromElements

Multiple markers at this line 
    - not enough arguments for method fromElements: (implicit evidence$14: scala.reflect.ClassTag[String], implicit evidence$15: 
    org.apache.flink.api.common.typeinfo.TypeInformation[String])org.apache.flink.api.scala.DataSet[String]. Unspecified value parameter evidence$15. 
    - could not find implicit value for evidence parameter of type org.apache.flink.api.common.typeinfo.TypeInformation[String] 
    - could not find implicit value for evidence parameter of type org.apache.flink.api.common.typeinfo.TypeInformation[String] 
    - not enough arguments for method fromElements: (implicit evidence$14: scala.reflect.ClassTag[String], implicit evidence$15: 
    org.apache.flink.api.common.typeinfo.TypeInformation[String])org.apache.flink.api.scala.DataSet[String]. Unspecified value parameter evidence$15. 

O değil sadece fromElements yöntemi: Bir dosyadan okuma ve daha sonra basit bir şey yapmaya bile ds.map(r => r) olarak, çok benzer bir şey olsun

Multiple markers at this line 
    - not enough arguments for method map: (implicit evidence$4: org.apache.flink.api.common.typeinfo.TypeInformation[K], implicit 
    evidence$5: scala.reflect.ClassTag[K])org.apache.flink.api.scala.DataSet[K]. Unspecified value parameters evidence$4, evidence$5. 
    - could not find implicit value for evidence parameter of type org.apache.flink.api.common.typeinfo.TypeInformation[K] 
    - could not find implicit value for evidence parameter of type org.apache.flink.api.common.typeinfo.TypeInformation[K] 
    - not enough arguments for method map: (implicit evidence$4: org.apache.flink.api.common.typeinfo.TypeInformation[K], implicit 
    evidence$5: scala.reflect.ClassTag[K])org.apache.flink.api.scala.DataSet[K]. Unspecified value parameters evidence$4, evidence$5. 

Flink'in iki versiyonunu denedim: Maven Central'dan 0.8.1 ve github deposundan en taze olanı. Ben Windows 7, scala 2.10.4, jdk 1.7.0_25 koşuyorum

Scala IDE sürümü yanlış yapıyorum Eclipse 4.3.0

üstünde 3.0.3-20140327-1716-tür güvenli olduğundan ?

cevap

19

Sen koduna şu ithalat eklemek gerekir:

import org.apache.flink.api.scala._ 

Sonra örnek çalışır.

+1

Teşekkürler Robert. Açıklanan problemleri çözerken, hala jenerik parametrelerle ilgili başka sorunlarım var. Http://stackoverflow.com/questions/29542214 –

+0

adresine buradan bir göz atabilir misiniz? Soruyu ilettim ...;) –

İlgili konular