Flink-stream-demo:类型不匹配。找到:datastream.DataStream需要的源:scala.DataStream

时间:2018-11-09 09:34:22

标签: flink-streaming

我在https://github.com/dataArtisans/flink-streaming-demo中下载了Flink-stream-demo的代码

此示例中的Flink版本为0.10。因此,我尝试修复代码以使其与FLINK 1.6.2兼容。

我遇到了以下无法修复的错误:

Error:(72, 52) type mismatch;
found   : org.apache.flink.streaming.api.datastream.DataStreamSource[com.dataartisans.flink_demo.datatypes.TaxiRide]
required: org.apache.flink.streaming.api.scala.DataStream[com.dataartisans.flink_demo.datatypes.TaxiRide]
val rides: DataStream[TaxiRide] = env.addSource(new TaxiRideSource(

我认为这是导入包问题,但我无法解决。 SlidingArrivalCount.scala的标头是

import com.dataartisans.flink_demo.datatypes.{TaxiRide, GeoPoint}
import com.dataartisans.flink_demo.sinks.ElasticsearchUpsertSink
import com.dataartisans.flink_demo.sources.TaxiRideSource
import com.dataartisans.flink_demo.utils.{DemoStreamEnvironment,NycGeoUtils}
import org.apache.flink.streaming.api.TimeCharacteristic
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment
import org.apache.flink.streaming.api.scala._
import org.apache.flink.streaming.api.windowing.time.Time
import org.apache.flink.streaming.api.windowing.windows.TimeWindow
import org.apache.flink.util.Collector

SourceFunction的标头是:

import com.dataartisans.flink_demo.datatypes.TaxiRide
import org.apache.flink.streaming.api.functions.source.SourceFunction
import org.apache.flink.streaming.api.functions.source.SourceFunction.SourceContext

错误代码是

val env: StreamExecutionEnvironment = DemoStreamEnvironment.env
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime)

// Define the data source
val rides: DataStream[TaxiRide] = env.addSource(new TaxiRideSource(
  data, maxServingDelay, servingSpeedFactor))

0 个答案:

没有答案