processExpression does AST tree dfs traversal and apply root action on the root level, rootAction includes filterAction, writeToDimensionVectorAction and makeWriteToMeasureVectorAction
(exp, parentExp expr.Expr, tableScanners []*TableScanner, foreignTables []*foreignTable, stream unsafe.Pointer, device int, action rootAction)
| 460 | // processExpression does AST tree dfs traversal and apply root action on the root level, |
| 461 | // rootAction includes filterAction, writeToDimensionVectorAction and makeWriteToMeasureVectorAction |
| 462 | func (bc *oopkBatchContext) processExpression(exp, parentExp expr.Expr, tableScanners []*TableScanner, foreignTables []*foreignTable, |
| 463 | stream unsafe.Pointer, device int, action rootAction) C.InputVector { |
| 464 | switch e := exp.(type) { |
| 465 | case *expr.ParenExpr: |
| 466 | return bc.processExpression(e.Expr, e, tableScanners, foreignTables, stream, device, action) |
| 467 | case *expr.VarRef: |
| 468 | columnIndex := tableScanners[e.TableID].ColumnsByIDs[e.ColumnID] |
| 469 | var inputVector C.InputVector |
| 470 | // main table |
| 471 | if e.TableID == 0 { |
| 472 | column := bc.columns[columnIndex] |
| 473 | inputVector = makeVectorPartySliceInput(column) |
| 474 | } else { |
| 475 | var timezoneLookup unsafe.Pointer |
| 476 | var timezoneLookupDSize int |
| 477 | switch pe := parentExp.(type) { |
| 478 | case *expr.BinaryExpr: |
| 479 | if pe.Op == expr.CONVERT_TZ { |
| 480 | timezoneLookup = bc.timezoneLookupD.getPointer() |
| 481 | timezoneLookupDSize = bc.timezoneLookupDSize |
| 482 | } |
| 483 | default: |
| 484 | } |
| 485 | inputVector = makeForeignColumnInput(columnIndex, bc.foreignTableRecordIDsD[e.TableID-1].getPointer(), *foreignTables[e.TableID-1], timezoneLookup, timezoneLookupDSize) |
| 486 | } |
| 487 | |
| 488 | if action != nil { |
| 489 | action(C.Noop, stream, device, []C.InputVector{inputVector}, e) |
| 490 | return C.InputVector{} |
| 491 | } |
| 492 | return inputVector |
| 493 | case *expr.NumberLiteral, *expr.GeopointLiteral: |
| 494 | var inputVector C.InputVector |
| 495 | inputVector = makeConstantInput(e, true) |
| 496 | if action != nil { |
| 497 | action(C.Noop, stream, device, []C.InputVector{inputVector}, e) |
| 498 | return C.InputVector{} |
| 499 | } |
| 500 | return inputVector |
| 501 | case *expr.UnaryExpr: |
| 502 | inputVector := bc.processExpression(e.Expr, e, tableScanners, foreignTables, stream, device, nil) |
| 503 | functorType, exist := UnaryExprTypeToCFunctorType[e.Op] |
| 504 | if !exist { |
| 505 | functorType = C.Noop |
| 506 | } |
| 507 | |
| 508 | if action != nil { |
| 509 | action(functorType, stream, device, []C.InputVector{inputVector}, e) |
| 510 | return C.InputVector{} |
| 511 | } |
| 512 | |
| 513 | values, nulls := bc.allocateStackFrame() |
| 514 | dataType := getOutputDataType(e.Type(), 4) |
| 515 | var outputVector = makeScratchSpaceOutput(values.getPointer(), nulls.getPointer(), dataType) |
| 516 | |
| 517 | C.UnaryTransform(inputVector, outputVector, (*C.uint32_t)(bc.indexVectorD.getPointer()), |
| 518 | (C.int)(bc.size), (*C.uint32_t)(bc.baseCountD.getPointer()), (C.uint32_t)(bc.startRow), functorType, stream, C.int(device)) |
| 519 |
no test coverage detected