Note: we only calculate Sort memory usage since sort memory usage is larger than reduce and we only care about the maximum
(inputSize int)
| 1196 | // since sort memory usage is larger than reduce |
| 1197 | // and we only care about the maximum |
| 1198 | func estimateSortReduceMemUsage(inputSize int) (memUsage int) { |
| 1199 | // dimension index vector |
| 1200 | // 4 byte for uint32 |
| 1201 | // 2 vectors for input and output |
| 1202 | memUsage += inputSize * 4 * 2 |
| 1203 | // hash vector |
| 1204 | // 8 byte for uint64 hash value |
| 1205 | // 2 vectors for input and output |
| 1206 | memUsage += inputSize * 8 * 2 |
| 1207 | // we sort dim index values as value, and hash value as key |
| 1208 | memUsage += inputSize * (8 + 4) |
| 1209 | return |
| 1210 | } |
| 1211 | |
| 1212 | // estimateScratchSpaceMemUsage calculates memory usage for an expression |
| 1213 | func estimateScratchSpaceMemUsage(exp expr.Expr, firstColumnSize int, isRoot bool) (int, int) { |
no outgoing calls
no test coverage detected