How to filter timestamp column in Data Flow of Azure Data Factory

不问归期 提交于 2021-02-11 14:50:01

问题


I have timestamp column where I have written following expression to filter the column:

contact_date  >= toTimestamp('2020-01-01') && 
contact_date  <= toTimestamp('2020-12-31')

It doesn't complain about syntax but after run it doesn't filter based on date specified. Simply to say logic doesn't work. Any idea?

Date Column in Dataset:


回答1:


Please don't use toTimestamp() function. I tested and you will get null output.

I use a Filter active to filter the data. Please use the toString() and change the expression like bellow:

toString({contact_date })>= toString('2020-01-01') && toString({contact_date })<= toString('2020-12-31')

Ref my example, contact_date and output:




回答2:


I think you need to either add the hour, minute and second portions of your dates or specify an appropriate format string, as per the docs, "If the timestamp is omitted the default pattern yyyy-[M]M-[d]d hh:mm:ss[.f...] is used."




回答3:


Hi put in and operation or in () ie

    (contact_date  >= toTimestamp('2020-01-01') &&  contact_date  <= toTimestamp('2020-12-31'))

    or

     AND(contact_date  >= toTimestamp('2020-01-01') , contact_date  <= toTimestamp('2020-12-31'))


来源:https://stackoverflow.com/questions/64897642/how-to-filter-timestamp-column-in-data-flow-of-azure-data-factory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!