tbl = loadTable("dfs://hft_stock_ts", 'KLinePartitioned') // TODO: m_nDate filter in where clause need to be replaced by group by total_vol = select code, m_nDate, sum(m_nVolume) as total_vol from tbl where m_nDate=2015.01.05 group by code tail_vol = select code, m_nDate, sum(m_nVolume) as tail_vol from tbl where m_nDate=2015.01.05 and m_nTime>=14:30:00 group by code select code, m_nDate, tail_vol/total_val as tail_vol_ratio from ej(total_val, tail_vol, `code`m_nDate)