Trying to Convert Tuple[Boolean,Row] to [Row]

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Trying to Convert Tuple[Boolean,Row] to [Row]

sri hari kali charan Tummala
Hi All, 

I am trying to convert a Tuple[Boolean,Row] to Row using map function, I am getting this error asking me for InferedR , what is InferedR in FLink?
  val mymapFunction: MapFunction[tuple.Tuple2[Boolean, Row],AnyVal] =
new MapFunction[tuple.Tuple2[Boolean, Row],AnyVal]() {
override def map(t: tuple.Tuple2[Boolean, Row]): Row = {
t.f1
}
/*override def map(t: tuple.Tuple2[Boolean, Row], collector: Collector[Object]): Unit = {
collector.collect(t.f1)
}
*/
}
tEnv.toRetractStream(table, classOf[org.apache.flink.types.Row]).map(mymapFunction)
.writeAsCsv("/Users/kalit_000/Downloads/FlinkStreamAndSql/src/main/resources/csvOut8",
FileSystem.WriteMode.OVERWRITE,"\n","|")
and when I try to I get a different type of error.

Error:(143, 74) type mismatch;
 found   : org.apache.flink.api.common.functions.MapFunction[org.apache.flink.api.java.tuple.Tuple2[scala.Boolean,org.apache.flink.types.Row],AnyVal]
 required: org.apache.flink.api.common.functions.MapFunction[org.apache.flink.api.java.tuple.Tuple2[java.lang.Boolean,org.apache.flink.types.Row],?]
    tEnv.toRetractStream(table, classOf[org.apache.flink.types.Row]).map(mymapFunction)



--
Thanks & Regards
Sri Tummala


Screen Shot 2019-07-16 at 2.05.10 PM.png (28K) Download Attachment
Screen Shot 2019-07-16 at 2.06.04 PM.png (55K) Download Attachment