I have a table that contains a column named time_created representing a date: 2014-02-19 23:49:59.998557. Now I need to generate a new table that consists of year, month, day and quarter columns.(For analysis purpose).

For example, 2014-02-19 23:49:59.998557 should be converted to:

year| month | day | quarter

2014 | 2 | 19 | Q1

How can I do that using Kettle? Thanks!

有帮助吗?

解决方案 2

Use a calculator step to generate the four fields you need (year, month,..). For each field use your timestamp as Field A and choose the appropriate calculation (e.g. Year of date A). You will need to work around the quarter field to prepend a Q (calculation = set field to constant value A ). You can do this in the same calculator step, using the remove feature to get rid of your Q field.

其他提示

Or use the select values step.. this can make copies of fields then you simply specify the format mask for the date to string conversion in the meta tab. Potentially more flexible too..

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top