Hi,
My Source and target is Hive Database. I need to convert a column datatype from String to Double. I am using Run Time Column Propagation.
Using Modify stage is it possible to convert a Column from String to Double?
String to Double DataType Conversion
Moderators: chulett, rschirm, roy
No.
You need to call a transformer and convert the column from one type to another (the incoming metadata is char or varchar or whatever, the outgoing metadata is numeric type of your choice) and use the data conversion function to do this.
Modify is more generally used to add or drop columns, though it can do a few other things this is not one of them. You can use the modify to restructure the metadata from "string" to "numeric" but it wouldn't do the conversion -- you would just get the string bytes misinterpreted into numeric bytes and effectively create a random number generator.
the column you are operating on should not be RCP but exposed in the metadata. You can use modify or other tricks to expose or rename or otherwise force some column into the path that does the conversion but generally it would be best to pass it in as an exposed column -- its easier to write it that way, and its easier to understand it that way, etc.
You need to call a transformer and convert the column from one type to another (the incoming metadata is char or varchar or whatever, the outgoing metadata is numeric type of your choice) and use the data conversion function to do this.
Modify is more generally used to add or drop columns, though it can do a few other things this is not one of them. You can use the modify to restructure the metadata from "string" to "numeric" but it wouldn't do the conversion -- you would just get the string bytes misinterpreted into numeric bytes and effectively create a random number generator.
the column you are operating on should not be RCP but exposed in the metadata. You can use modify or other tricks to expose or rename or otherwise force some column into the path that does the conversion but generally it would be best to pass it in as an exposed column -- its easier to write it that way, and its easier to understand it that way, etc.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Interesting!
I saw the 'm' (for manual) on the float types and understood it to mean "use a transformer function" in the help page : https://www.ibm.com/support/knowledgece ... stage.html
so apparently I misread it. My apologies. I guess d and m mean you can do it either way, not that "manual is required". Its worded a little strangely.
I saw the 'm' (for manual) on the float types and understood it to mean "use a transformer function" in the help page : https://www.ibm.com/support/knowledgece ... stage.html
so apparently I misread it. My apologies. I guess d and m mean you can do it either way, not that "manual is required". Its worded a little strangely.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: