2015-04-09 10 views
10

मैं मुसीबतों अपाचे Flink स्काला एपीआई का उपयोग करFlink स्काला एपीआई "नहीं पर्याप्त तर्क"

उदाहरण के लिए हो रही है, यहां तक ​​कि जब मैं आधिकारिक दस्तावेज से उदाहरण लेते हैं, स्केला संकलक मुझे संकलन त्रुटियों के टन देता है।

कोड:

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") 
    } 
} 

स्काला आईडीई लाइन के लिए निम्नलिखित आउटपुट 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. 

यह बस नहीं fromElements विधि: भले ही मैं एक फ़ाइल से पढ़ने और फिर के रूप में सरल कुछ करने की कोशिश ds.map(r => r) के रूप में, मुझे कुछ बहुत ही समान मिलता है

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. 

मैंने फ्लिंक के दो संस्करणों की कोशिश की: मैवेन सेंट्रल से 0.8.1 और जिथब रिपोजिटरी से सबसे ताजा एक।

मैं विंडोज 7, स्केला 2.10.4, JDK 1.7.0_25 चल रहा हूँ, स्काला आईडीई संस्करण ग्रहण 4.3.0

मैं गलत क्या कर रहा हूँ के शीर्ष पर 3.0.3-20140327-1716-typesafe है ?

उत्तर

19

आप अपने कोड में निम्न आयात जोड़ने की जरूरत:

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

तो उदाहरण के काम करता है।

+1

धन्यवाद रॉबर्ट। हालांकि यह वर्णित समस्याओं को हल करता है, लेकिन मुझे अभी भी जेनेरिक पैरामीटर के साथ अन्य समस्याएं हैं। क्या आप यहां एक फॉलो-अप देख सकते हैं http://stackoverflow.com/questions/29542214 –

+0

मैंने प्रश्न अग्रेषित किया ...;) –

संबंधित मुद्दे