ProcessQuery processes the compiled query and executes it on GPU.
(memStore memstore.MemStore)
| 46 | |
| 47 | // ProcessQuery processes the compiled query and executes it on GPU. |
| 48 | func (qc *AQLQueryContext) ProcessQuery(memStore memstore.MemStore) { |
| 49 | defer func() { |
| 50 | if r := recover(); r != nil { |
| 51 | // find out exactly what the error was and set err |
| 52 | switch x := r.(type) { |
| 53 | case string: |
| 54 | qc.Error = utils.StackError(nil, x) |
| 55 | case error: |
| 56 | qc.Error = utils.StackError(x, "Panic happens when processing query") |
| 57 | default: |
| 58 | qc.Error = utils.StackError(nil, "Panic happens when processing query %v", x) |
| 59 | } |
| 60 | utils.GetLogger().Error("Releasing device memory after panic") |
| 61 | qc.Release() |
| 62 | } |
| 63 | }() |
| 64 | |
| 65 | qc.cudaStreams[0] = cgoutils.CreateCudaStream(qc.Device) |
| 66 | qc.cudaStreams[1] = cgoutils.CreateCudaStream(qc.Device) |
| 67 | qc.OOPK.currentBatch.device = qc.Device |
| 68 | qc.OOPK.LiveBatchStats = oopkQueryStats{ |
| 69 | Name2Stage: make(map[stageName]*oopkStageSummaryStats), |
| 70 | } |
| 71 | qc.OOPK.ArchiveBatchStats = oopkQueryStats{ |
| 72 | Name2Stage: make(map[stageName]*oopkStageSummaryStats), |
| 73 | } |
| 74 | |
| 75 | previousBatchExecutor := NewDummyBatchExecutor() |
| 76 | |
| 77 | start := utils.Now() |
| 78 | for joinTableID, join := range qc.Query.Joins { |
| 79 | qc.prepareForeignTable(memStore, joinTableID, join) |
| 80 | if qc.Error != nil { |
| 81 | return |
| 82 | } |
| 83 | } |
| 84 | qc.reportTiming(qc.cudaStreams[0], &start, prepareForeignTableTiming) |
| 85 | |
| 86 | qc.prepareTimezoneTable(memStore) |
| 87 | if qc.Error != nil { |
| 88 | return |
| 89 | } |
| 90 | |
| 91 | // prepare geo intersection |
| 92 | if qc.OOPK.geoIntersection != nil { |
| 93 | shapeExists := qc.prepareForGeoIntersect(memStore) |
| 94 | if qc.Error != nil { |
| 95 | return |
| 96 | } |
| 97 | if !shapeExists { |
| 98 | // if no shape exist and geo check for point in shape |
| 99 | // no need to continue processing batch |
| 100 | if qc.OOPK.geoIntersection.inOrOut { |
| 101 | return |
| 102 | } |
| 103 | // if no shape exist and geo check for point not in shape |
| 104 | // no need to do geo intersection |
| 105 | qc.OOPK.geoIntersection = nil |
no test coverage detected