You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
894 B

def pit_col_at_date(table_name, col_name, date, report_period_list, code_partition_id){
source_table = loadTable("dfs://pit_stock_ts", table_name);
m_nDate = take(date, size(report_period_list));
report_period = report_period_list;
query_table = table(report_period, m_nDate);
query_table_exp = select code, report_period, m_nDate from ej(source_table, query_table, `report_period) where partition(code, code_partition_id);
col_list = ['code', 'report_period', 'appear_in_period', 'appear_at_date', col_name]
from_tbl = <ej(source_table, query_table_exp, `code`report_period)>
where_conditions = [<partition(code, code_partition_id)>]
source_table_part = sql(select=col_list, from=from_tbl, where=where_conditions);
return select * from aj(query_table_exp, source_table_part, `report_period`m_nDate, `report_period`appear_at_date)
}
addFunctionView(pit_col_at_date)