Hi,
It seems max(date) invoked on partitioned by date column table, looks at last (oldest) date folder
and if records found there, returns empty handed. Is this how max is implemented? This may be misleading
or am I supposed to delete an empty date folder?
When loading a hdb, it loads the partition domain as a variable.
In a date partitioned hdb, ‘date’ becomes filled with a sorted list of any available date in the root folder or any folder witnessed across the par.txt folders. This is whether all/any tables in those partition are empty or not.
running max date will thus just give you the max of that variable.
as the date variable is loaded as a sorted list of dates, then max will equal last
From your question I think you are trying to get the max date of every table where there is at least 1 row available for that table
for finding that on partitioned tables, run:
//cache partition counts per table
.Q.cn each `. .Q.pt
//get last date per table where non-zero count
q)(last date where@) each 0<.Q.pn
t | 2017.01.02
t3| 2017.01.01
HTH,
Sean
Sean,
Understood. Thus, date is a sorted list of file directories and max(date)=last dir, empty or not.
Correct, I wanted to simply find last inserted row and since I didn’t know the date, I thought max(date) was going
to magically find last inserted record.
Thank you