Jonas Traub created FLINK-2642:
----------------------------------

             Summary: Scala Table API crashes when executing word count example
                 Key: FLINK-2642
                 URL: https://issues.apache.org/jira/browse/FLINK-2642
             Project: Flink
          Issue Type: Bug
          Components: Table API
         Environment: current master (0.10)
            Reporter: Jonas Traub


I tried to run the examples provided in the documentation of Flink's Table API. 
Unfortunately, the Scala word count example provided in the 
[documentation|https://ci.apache.org/projects/flink/flink-docs-master/libs/table.html]
 doesn't work and does not give a meaningful exception.
(Other examples work fine)

Here my code:
{code:java}
package org.apache.flink.examples.scala

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

object WordCount {

  def main(args: Array[String]): Unit = {

    // set up execution environment
    val env = ExecutionEnvironment.getExecutionEnvironment

    case class WC(word: String, count: Int)
    val input = env.fromElements(WC("hello", 1), WC("hello", 1), WC("ciao", 1))
    val expr = input.toTable
    val result = expr.groupBy('word).select('word, 'count.sum as 
'count).toDataSet[WC]
    result.print()
  }

}
{code}

Here the thrown exception:
{code}
Exception in thread "main" 
org.apache.flink.runtime.client.JobExecutionException: Job execution failed.
        at 
org.apache.flink.runtime.jobmanager.JobManager$$anonfun$handleMessage$1.applyOrElse(JobManager.scala:414)
        at 
scala.runtime.AbstractPartialFunction$mcVL$sp.apply$mcVL$sp(AbstractPartialFunction.scala:33)
        at 
scala.runtime.AbstractPartialFunction$mcVL$sp.apply(AbstractPartialFunction.scala:33)
        at 
scala.runtime.AbstractPartialFunction$mcVL$sp.apply(AbstractPartialFunction.scala:25)
        at 
org.apache.flink.runtime.LeaderSessionMessageFilter$$anonfun$receive$1.applyOrElse(LeaderSessionMessageFilter.scala:36)
        at 
scala.runtime.AbstractPartialFunction$mcVL$sp.apply$mcVL$sp(AbstractPartialFunction.scala:33)
        at 
scala.runtime.AbstractPartialFunction$mcVL$sp.apply(AbstractPartialFunction.scala:33)
        at 
scala.runtime.AbstractPartialFunction$mcVL$sp.apply(AbstractPartialFunction.scala:25)
        at 
org.apache.flink.runtime.LogMessages$$anon$1.apply(LogMessages.scala:33)
        at 
org.apache.flink.runtime.LogMessages$$anon$1.apply(LogMessages.scala:28)
        at scala.PartialFunction$class.applyOrElse(PartialFunction.scala:118)
        at 
org.apache.flink.runtime.LogMessages$$anon$1.applyOrElse(LogMessages.scala:28)
        at akka.actor.Actor$class.aroundReceive(Actor.scala:465)
        at 
org.apache.flink.runtime.jobmanager.JobManager.aroundReceive(JobManager.scala:104)
        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
        at akka.actor.ActorCell.invoke(ActorCell.scala:487)
        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:254)
        at akka.dispatch.Mailbox.run(Mailbox.scala:221)
        at akka.dispatch.Mailbox.exec(Mailbox.scala:231)
        at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
        at 
scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
        at 
scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
        at 
scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.lang.Exception: The user defined 'open(Configuration)' method 
in class org.apache.flink.api.table.runtime.ExpressionSelectFunction caused an 
exception: null
        at 
org.apache.flink.runtime.operators.RegularPactTask.openUserCode(RegularPactTask.java:1368)
        at 
org.apache.flink.runtime.operators.chaining.ChainedMapDriver.openTask(ChainedMapDriver.java:47)
        at 
org.apache.flink.runtime.operators.RegularPactTask.openChainedTasks(RegularPactTask.java:1408)
        at 
org.apache.flink.runtime.operators.DataSourceTask.invoke(DataSourceTask.java:142)
        at org.apache.flink.runtime.taskmanager.Task.run(Task.java:581)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
        at 
org.apache.flink.api.table.codegen.IndentStringContext$$anonfun$j$2.apply(Indenter.scala:30)
        at 
org.apache.flink.api.table.codegen.IndentStringContext$$anonfun$j$2.apply(Indenter.scala:23)
        at 
scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
        at 
scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
        at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
        at 
scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
        at 
org.apache.flink.api.table.codegen.IndentStringContext.j(Indenter.scala:23)
        at 
org.apache.flink.api.table.codegen.GenerateSelect.generateInternal(GenerateSelect.scala:55)
        at 
org.apache.flink.api.table.codegen.GenerateSelect.generateInternal(GenerateSelect.scala:32)
        at 
org.apache.flink.api.table.codegen.ExpressionCodeGenerator.generate(ExpressionCodeGenerator.scala:66)
        at 
org.apache.flink.api.table.runtime.ExpressionSelectFunction.open(ExpressionSelectFunction.scala:46)
        at 
org.apache.flink.api.common.functions.util.FunctionUtils.openFunction(FunctionUtils.java:33)
        at 
org.apache.flink.runtime.operators.RegularPactTask.openUserCode(RegularPactTask.java:1366)
        ... 5 more
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to