Member since
09-28-2023
3
Posts
0
Kudos Received
0
Solutions
10-09-2023
04:05 AM
Hi, Can anyone help please?
... View more
09-29-2023
01:02 AM
My best regards to you, Diana. I'll just keep waiting for help from those experts, or there must be any action from me? Leopoldo Fernandes Portugal
... View more
09-28-2023
07:23 AM
Impala version : impalad version 2.12.0-cdh5.16.2 As shown above, I have two tables; Customer table and Calendar Table, wich columns I describe below: Customer Table: [Customer] : Customer ID [Date] : Creation date [Num_Days] : Number of working days to calculate the [next_wkday] in the query result. Calendar Table: [civil_util] : when (1) -> workday; when (0) -> non working day I need to get the query_result with the three columns of Customer Table and a calculated date [next_wkday], representing the number of working days [Num_Days] after the Creation date, jumping the zeros in the [civil_util] column. The query below calculates the [next_wkday] using the Lead() function. But is not a solution because the offset parameter must be a constant, and we need to use the [Num_Days] value for each Creation Date: select *,
Lead (to_date(ref_date),5) OVER (ORDER BY to_date(ref_date)) AS next_wkday,
datediff(Lead (to_date(ref_date),5) OVER (ORDER BY
to_date(ref_date)),ref_date) as days_diff
from cd_estruturais.calendario_datas
where
ref_date >= to_date(now())
and civil_util = 1
limit 1 So, we need to find another solution. I need to say, for performance puposes, that the Customer table has 4 billion records approximatly. Can anyone help please?
... View more
Labels:
- Labels:
-
Apache Hive
-
Apache Impala