Parse frame subclauses of window functions.
| 2289 | |
| 2290 | // Parse frame subclauses of window functions. |
| 2291 | void WindowSourceNode::parseWindow(thread_db* tdbb, CompilerScratch* csb) |
| 2292 | { |
| 2293 | SET_TDBB(tdbb); |
| 2294 | |
| 2295 | SSHORT context; |
| 2296 | Window& window = windows.add(); |
| 2297 | window.stream = PAR_context(csb, &context); |
| 2298 | window.frameExtent = WindowClause::FrameExtent::createDefault(*tdbb->getDefaultPool()); |
| 2299 | |
| 2300 | UCHAR verb, count; |
| 2301 | |
| 2302 | while ((verb = csb->csb_blr_reader.getByte()) != blr_end) |
| 2303 | { |
| 2304 | switch (verb) |
| 2305 | { |
| 2306 | case blr_window_win_partition: |
| 2307 | count = csb->csb_blr_reader.getByte(); |
| 2308 | |
| 2309 | if (count != 0) |
| 2310 | { |
| 2311 | window.group = PAR_sort_internal(tdbb, csb, false, count); |
| 2312 | window.regroup = PAR_sort_internal(tdbb, csb, false, count); |
| 2313 | } |
| 2314 | |
| 2315 | break; |
| 2316 | |
| 2317 | case blr_window_win_order: |
| 2318 | count = csb->csb_blr_reader.getByte(); |
| 2319 | |
| 2320 | if (count != 0) |
| 2321 | window.order = PAR_sort_internal(tdbb, csb, true, count); |
| 2322 | |
| 2323 | break; |
| 2324 | |
| 2325 | case blr_window_win_map: |
| 2326 | window.map = parseMap(tdbb, csb, window.stream, false); |
| 2327 | break; |
| 2328 | |
| 2329 | case blr_window_win_extent_unit: |
| 2330 | window.frameExtent->unit = (WindowClause::FrameExtent::Unit) |
| 2331 | csb->csb_blr_reader.getByte(); |
| 2332 | |
| 2333 | switch (window.frameExtent->unit) |
| 2334 | { |
| 2335 | case WindowClause::FrameExtent::Unit::RANGE: |
| 2336 | case WindowClause::FrameExtent::Unit::ROWS: |
| 2337 | break; |
| 2338 | |
| 2339 | default: |
| 2340 | PAR_syntax_error(csb, "blr_window_win_extent_unit"); |
| 2341 | } |
| 2342 | |
| 2343 | break; |
| 2344 | |
| 2345 | case blr_window_win_exclusion: |
| 2346 | //// TODO: CORE-5338 - write code for execution. |
| 2347 | PAR_error(csb, |
| 2348 | Arg::Gds(isc_wish_list) << |
no test coverage detected