You can translate the question and the replies:

to_date function from denodo cannot be delegated to HIVE

Hi, I am getting warning as to_date cannot be delegated while trying to find the difference between two dates in denodo with source as HIVE The logic I have used in denodo as: getdaysbetween(to_date('yyyy-MM-dd', table1.start_dt), to_date('yyyy-MM-dd', table2.start_dt)) Denodo to_date has two parameters where as HIve supports one parameter: Denodo: to_date('yyyy-MM-dd', table1.start_dt) HIVE: to_date(table1.start_dt) How to solve the delegation issue without wriring custom functions? Can we write any logics within denodo where we can find the date difference with source as HIVE. Awaiting for your reply.
user
03-04-2018 03:16:51 -0400

3 Answers

Hi, Even though Hive and Denodo Platform support 'to_date' function, their functionality will differ in both the platform. In Hive, the to_date function has only one input parameter which is of type 'Timestamp' and it is used to extract the date part from the timestamp value. Whereas, the 'to_date' function of Denodo Platform will convert a date format value of text field type into a date type field value. Hence, I would create a custom function in Denodo Platform to implement the 'to_date' function that is supported by Hive data source. After creating the custom function, I would delegate this function from Virtual DataPort server to the Hive data source by performing the following steps in Virtual DataPort Administration Tool: 1. Go to [Source Configuration](https://community.denodo.com/docs/html/browse/6.0/vdp/administration/creating_views/importing_data_sources_and_creating_base_views/data_source_configuration_properties#data-source-configuration-properties) option under Configuration tab of the data source. 1. Check the parameter 'Delegate scalar functions list' and add the developed custom function to its functions list, so that the function could be delegated. 1. Save the changes. After doing the above steps, I was able to delegate the to_date function to Hive data source. You could refer to [Developing Custom Functions](https://community.denodo.com/docs/html/browse/6.0/vdp/developer/developing_extensions/developing_custom_functions/developing_custom_functions#developing-custom-functions) section of Virtual Data Port Developer Guide for information about how to create a custom function. Hope this helps!
Denodo Team
04-04-2018 03:05:14 -0400
I think the issue here is not the to_date function but the getdaysbetween function as it is not being delegated to hive. You can create a custom datediff function in Denodo where you can specify how the function will be pushed down to hive, something like @CustomExecutor(implementation=true, delegationPatterns={@com.denodo.common.custom.annotations.DelegationPattern(databaseName="hive", pattern="DATEDIFF($0,$1)")})
user
 Edited on: 09-06-2020 11:13:22 -0400
we are on V7, not sure which denodo version you are on but did you try to_localdate() as it does the delegation to hive.
user
09-10-2020 19:21:03 -0400
You must sign in to add an answer. If you do not have an account, you can register here