ClassCastException in Dynamic Schema

Seven Stars

ClassCastException in Dynamic Schema


I am trying to use tSetDynamicSchema to check the dynamic schema definition feature of Talend.

I have defined the following schema metadata in a CSV file which the job reads using tFileInputDelimited and passes on the read data to tSetDynamicSchema.


The job then tries to read the input file (another CSV file) using tFileInputPositional component where I have specified the tSetDynamicSchema  as the existing dynamic.

The data read from tFileInputPositional is then printed on the console using tLogRow and then written to a database table.

However I am getting the following error when running the job:

Exception in component tLogRow_1
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date
	at routines.system.DynamicUtils.formatDate(
	at routines.system.Dynamic.toString(
	at routines.system.Dynamic.toString(
	at java.lang.String.valueOf(Unknown Source)
	at etl_dev.testdynamicschema_0_1.testDynamicSchema.tFileInputPositional_1Process(
	at etl_dev.testdynamicschema_0_1.testDynamicSchema.tFileInputDelimited_1Process(
	at etl_dev.testdynamicschema_0_1.testDynamicSchema.runJobInTOS(
	at etl_dev.testdynamicschema_0_1.testDynamicSchema.main(
[FATAL]: etl_dev.testdynamicschema_0_1.testDynamicSchema - tLogRow_1 java.lang.String cannot be cast to java.util.Date

I know it is because I have defined the datatype for CREATE_DATE field as id_Date. I would like to know if there is any other way to specify DateTime datatype for a column for tSetDynamicSchema.

Seven Stars

Re: ClassCastException in Dynamic Schema

Another addition is that when I changed the datatype of the CREATE_DATE field to id_String, I did not get any error.

However all the data read from the file was written to a single (first) column of the database table. How can I make the job output the data read to the correct columns?

Attaching a screenshot of the job I have createdDynamicSchema.png


Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.