Change datatypes dynamically of every column
Hello everybody,
Need help creating a pipeline. The data am working on looks like below:
Header
Datatype
Data
Data
Data
This is a CSV file so every column comes as a string. I want to create a pipeline which will look at the first row and change the datatype of that particular column using mapper.
My thought was to initially find only columns in the form of a table(group) and pass one by one as a parameter into a mapper placed within a pipeline execute. The mapper within the pipeline will have something similar to group[1].contains(‘date’)?Date.parse(_parameter):group[1].contains(‘char’)?_parameter:group[1].contains(‘char’)?_parameter:parseInt(_parameter)
Can anyone help me how to bring out only column names as an array/table so that I can try out my logic.
(OR) if you have any other easier method to do this, then can you please share.
Thanks,
Sunil