我需要读取一个具有6列的CSV文件,分别为Integer,String,String,String,Integer,Integer类型。我想使用Apache Flinks的ExecutionEnvironment.readCsvFile
方法,但是不断出现输入错误和参数错误。我目前有:
val env = ExecutionEnvironment.getExecutionEnvironment
val lines = env.readCsvFile[Integer, String, String, String, Integer, Integer]("C:/Users/zoldham/IdeaProjects/flinkpoc/Data/gun-violence-data_01-2013_03-2018.csv")
得到
Error:(43, 32) wrong number of type parameters for method readCsvFile: [T](filePath: String, lineDelimiter: String, fieldDelimiter: String, quoteCharacter: Character, ignoreFirstLine: Boolean, ignoreComments: String, lenient: Boolean, includedFields: Array[Int], pojoFields: Array[String])(implicit evidence$1: scala.reflect.ClassTag[T], implicit evidence$2: org.apache.flink.api.common.typeinfo.TypeInformation[T])org.apache.flink.api.scala.DataSet[T]
请注意,这些是第42和43行。正确的语法是什么样的?我完全无法找到任何示例作为其外观的基准。谢谢!
答案 0 :(得分:1)
您需要指定一个元组或案例类作为输入类型。请尝试以下操作:
select DATEFROMPARTS(Yr, 4, 1) [start], DATEFROMPARTS(Yr + 1, 3, 31) [end] from
(select case when DATEPART(month, getdate()) < 4 then DATEPART(year, getdate()) - 1 else DATEPART(year, getdate()) end Yr) a