You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Dominik Wosiński (Jira)" <ji...@apache.org> on 2019/11/05 20:27:00 UTC

[jira] [Updated] (FLINK-14617) Dataset Parquet ClassCastException for SpecificRecord

     [ https://issues.apache.org/jira/browse/FLINK-14617?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dominik Wosiński updated FLINK-14617:
-------------------------------------
    Description: 
The following code runs smoothly when the _executionEnvironment_ is instance of _StreamExecutionEnvironment_:
{code:java}
val filePaths = //some links to s3 files
val job = Job.getInstance()
AvroReadSupport.setAvroDataSupplier(job.getConfiguration, classOf[AvroDataSupplierWithTimestampConversion])
val avroParquetInputFormat = new AvroParquetInputFormat[GpsPointDTO]()
val hadoopInputFormat = new HadoopInputFormat[Void, GpsPointDTO](avroParquetInputFormat, classOf[Void], classOf[GpsPointDTO], job)
FileInputFormat.addInputPaths(job, filePaths.head)
executionEnvironment.createInput(hadoopInputFormat).map(_._2).print(){code}
But when the _ExecutionEnvironment_ is used instead of _StreamExecutionEnviroment,_ then the code throws the: 
{code:java}
Caused by: java.lang.ClassCastException: class org.apache.avro.generic.GenericData$Record cannot be cast to class com.company.GpsPointDTO (org.apache.avro.generic.GenericData$Record and com.company.GpsPointDTO are in unnamed module of loader 'app'){code}
I don't think this is the expected behavior. 
f

  was:
The following code runs smoothly when the _executionEnvironment_ is instance of _StreamExecutionEnvironment_:
{code:java}
val job = Job.getInstance()
AvroReadSupport.setAvroDataSupplier(job.getConfiguration, classOf[AvroDataSupplierWithTimestampConversion])
val avroParquetInputFormat = new AvroParquetInputFormat[GpsPointDTO]()
val hadoopInputFormat = new HadoopInputFormat[Void, GpsPointDTO](avroParquetInputFormat, classOf[Void], classOf[GpsPointDTO], job)
FileInputFormat.addInputPaths(job, filePaths.head)
executionEnvironment.createInput(hadoopInputFormat).map(_._2).print(){code}
But when the _ExecutionEnvironment_ is used instead of _StreamExecutionEnviroment,_ then the code throws the: 
{code:java}
Caused by: java.lang.ClassCastException: class org.apache.avro.generic.GenericData$Record cannot be cast to class com.company.GpsPointDTO (org.apache.avro.generic.GenericData$Record and com.company.GpsPointDTO are in unnamed module of loader 'app'){code}
I don't think this is the expected behavior. 


> Dataset Parquet ClassCastException for SpecificRecord
> -----------------------------------------------------
>
>                 Key: FLINK-14617
>                 URL: https://issues.apache.org/jira/browse/FLINK-14617
>             Project: Flink
>          Issue Type: Bug
>    Affects Versions: 1.8.0
>         Environment: {code:java}
>  {code}
>            Reporter: Dominik Wosiński
>            Priority: Major
>
> The following code runs smoothly when the _executionEnvironment_ is instance of _StreamExecutionEnvironment_:
> {code:java}
> val filePaths = //some links to s3 files
> val job = Job.getInstance()
> AvroReadSupport.setAvroDataSupplier(job.getConfiguration, classOf[AvroDataSupplierWithTimestampConversion])
> val avroParquetInputFormat = new AvroParquetInputFormat[GpsPointDTO]()
> val hadoopInputFormat = new HadoopInputFormat[Void, GpsPointDTO](avroParquetInputFormat, classOf[Void], classOf[GpsPointDTO], job)
> FileInputFormat.addInputPaths(job, filePaths.head)
> executionEnvironment.createInput(hadoopInputFormat).map(_._2).print(){code}
> But when the _ExecutionEnvironment_ is used instead of _StreamExecutionEnviroment,_ then the code throws the: 
> {code:java}
> Caused by: java.lang.ClassCastException: class org.apache.avro.generic.GenericData$Record cannot be cast to class com.company.GpsPointDTO (org.apache.avro.generic.GenericData$Record and com.company.GpsPointDTO are in unnamed module of loader 'app'){code}
> I don't think this is the expected behavior. 
> f



--
This message was sent by Atlassian Jira
(v8.3.4#803005)