flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Till Rohrmann <trohrm...@apache.org>
Subject Re: Discarding header from CSV file
Date Wed, 27 Apr 2016 08:42:08 GMT
Hi Nirmalya,

I tried to reproduce your problem but was not successful. For me it worked
to read a csv file and file in the values in to case classes. Could you
maybe compile an example program with sample input to reproduce your


On Wed, Apr 27, 2016 at 5:51 AM, nsengupta <sengupta.nirmalya@gmail.com>

> Chiwan and other Flinksters, I am stuck with the following. Somehow, I am
> an unable to spot the error, if any! Please help. *I have this case class*:
> case class BuildingInformation(buildingID: Int, buildingManager: Int,
> buildingAge: Int, productID: String, country: String) *I intend to read
> from a CSV file which has a one-line header*:
> BuildingID,BuildingMgr,BuildingAge,HVACproduct,Country *I attempt to read
> the file in this manner*: private def readBuildingInfo(env:
> ExecutionEnvironment, inputPath: String) = { env.readCsvFile
> [BuildingInformation] ( inputPath, ignoreFirstLine = true, pojoFields =
> Array("buildingID","buildingManager","buildingAge","productID","country") )
> } *Then, I use this function in the driver's main()*: val envDefault =
> ExecutionEnvironment.getExecutionEnvironment val buildings =
> readBuildingInfo(envDefault,"./SensorFiles/building.csv").collect().toList
> The 'buildings' list is always *empty*! I fail to figure out, why! I have
> checked that the path of the CSV file is correct and accessible. Also, I
> can read the same stuff by following the usual method of reading as a
> text-line, parsing the commas and creating the POJOs (case-classes). --
> Nirmalya
> ------------------------------
> View this message in context: Re: Discarding header from CSV file
> <http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Discarding-header-from-CSV-file-tp6474p6477.html>
> Sent from the Apache Flink User Mailing List archive. mailing list archive
> <http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/> at
> Nabble.com.

View raw message