Apache Flink:InvalidProgramException:无法编译表程序

时间:2017-11-30 00:15:41

标签: scala apache-flink flink-streaming

我有一个带有Avro对象的DataStream的简单程序,我想从中提取单个String字段。我将DataStream转换为Table并运行一个简单投影的查询。

val kinesisConsumer = new FlinkKinesisConsumer(streamName, new UnifiedEventDeserializationSchema, consumerConfig)
val env = StreamExecutionEnvironment.getExecutionEnvironment
implicit val typeInfo = TypeInformation.of(classOf[UnifiedEvent])
val kinesisStream = env.addSource(kinesisConsumer)
val tableEnv = TableEnvironment.getTableEnvironment(env)
tableEnv.registerDataStream("table1", kinesisStream);
val query = "SELECT nd_key FROM table1"
val result = tableEnv.sql(query)
tableEnv.toAppendStream[org.apache.avro.util.Utf8](result).print()
env.execute()

当我执行程序时,我得到以下异常:

  

11/29/2017 16:07:36来源:Custom Source - >从:   (accepted_cohort_id,admin_id,after_submission,amount_paid,   anonymous_id,application_id,atom_key,bd_group_key,biz_geo,   braavos_purchase_id,category,cohort_id,concept_key,concept_rank,   context,context_campaign,context_experiment,coupon_code,   course_key,course_rank,cta_destination,cta_location,cta_message,   cta_type,currency,decision_group_id,device_browser,device_os,   device_os_version,device_type,duration,evaluation_id,event_type,   fin_geo,in_collaboration_with,lab_id,lab_rank,label,lesson_key,   lesson_rank,locale,max_pause_duration,message,message_id,   module_key,module_rank,nd_key,nd_unit_id,nd_unit_rank,   new_cohort_id,notification_id,num_concepts_completed,   num_interactions,num_lessons_completed,old_cohort_id,part_key,   part_rank,pause_duration,pause_reason,payment_plan,   payment_provider,points_earned,points_possible,price,price_sheet,   product_key,product_type,provider_charge_id,provider_refund_id,   quiz_type,referrer,refund_amount,requested_cohort_id,结果,   scholarship_group_key,search_term,skill_level,subscription_id,   suspension_length,suspension_reason,技术,时间戳,   total_concepts,total_lessons,total_time_sec,type,unenroll_reason,   user_id,user_locale,user_response,variant,version,workspace_id,   workspace_session,workspace_type) - >选择:(nd_key) - > to:Utf8 - >   接收器:未命名(5/8)切换到FAILED   org.apache.flink.api.common.InvalidProgramException:表程序   无法编译。这是一个错误。请提出问题。在   org.apache.flink.table.codegen.Compiler $ class.compile(Compiler.scala:36)     在   org.apache.flink.table.runtime.CRowOutputMapRunner.compile(CRowOutputMapRunner.scala:33)     在   org.apache.flink.table.runtime.CRowOutputMapRunner.open(CRowOutputMapRunner.scala:48)     在   org.apache.flink.api.common.functions.util.FunctionUtils.openFunction(FunctionUtils.java:36)     在   org.apache.flink.streaming.api.operators.AbstractUdfStreamOperator.open(AbstractUdfStreamOperator.java:111)     在   org.apache.flink.streaming.runtime.tasks.StreamTask.openAllOperators(StreamTask.java:376)     在   org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:253)     在org.apache.flink.runtime.taskmanager.Task.run(Task.java:702)at   java.lang.Thread.run(Thread.java:748)引起:   org.codehaus.commons.compiler.CompileException:第790行,第15列:   不能从类型" java.lang.CharSequence"中进行赋值转换。   输入" org.apache.avro.util.Utf8"在   org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:11672)     在   org.codehaus.janino.UnitCompiler.assignmentConversion(UnitCompiler.java:10528)     在org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2534)     在   org.codehaus.janino.UnitCompiler.access $ 2600(UnitCompiler.java:212)     在   org.codehaus.janino.UnitCompiler $ 6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1459)     在   org.codehaus.janino.UnitCompiler $ 6.visitLocalVariableDeclarationStatement(UnitCompiler.java:1443)     在   org.codehaus.janino.Java $ LocalVariableDeclarationStatement.accept(Java.java:3348)     在org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1443)     在   org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:1523)     在org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:3052)     在   org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1313)     在   org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:1286)     在org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:785)     在org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:436)     在org.codehaus.janino.UnitCompiler.access $ 400(UnitCompiler.java:212)     在   org.codehaus.janino.UnitCompiler $ 2.visitPackageMemberClassDeclaration(UnitCompiler.java:390)     在   org.codehaus.janino.UnitCompiler $ 2.visitPackageMemberClassDeclaration(UnitCompiler.java:385)     在   org.codehaus.janino.Java $ PackageMemberClassDeclaration.accept(Java.java:1405)     在org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:385)     在   org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:357)     在org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:234)     在   org.codehaus.janino.SimpleCompiler.compileToClassLoader(SimpleCompiler.java:446)     在org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:213)     在org.codehaus.janino.SimpleCompiler.cook(SimpleCompiler.java:204)     在org.codehaus.commons.compiler.Cookable.cook(Cookable.java:80)at   org.codehaus.commons.compiler.Cookable.cook(Cookable.java:75)at   org.apache.flink.table.codegen.Compiler $ class.compile(Compiler.scala:33)     ......还有8个

0 个答案:

没有答案