spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Himasha de Silva <himasha...@gmail.com>
Subject [Spark SQL]: Dataset<Row> can not map into Dataset<Integer> in java
Date Fri, 08 Dec 2017 05:11:59 GMT
Hi,

 I'm trying to map a Dataset<Row> that read from csv files into a
Dataset<Integer>.
But it gives some errors. Can anyone please help me to figure it out?

Dataset<Row> t_en_data = session.read().option("header","true")
        .option("inferSchema","true")
        .csv("J:\\csv_path\\T_EN");

Dataset<Integer> mappedDataset = t_en_data
        .map((MapFunction<Row, Integer>) row
->row.<Integer>getAs("Duration"), Encoders.INT());
mappedDataset.show(false);


error - https://gist.github.com/anonymous/614a1746162dd12bb0b810add85deda2

Thanks
-- 

Himasha De Silva

Mime
View raw message