A node for handling an array that is discovered to have all null elements. It is referred to as a TerminalNode because traversal of nodes will not continue it when generating rep/def levels. However, there could be many nested children elements beyond it in the Array that is being processed.
| 239 | // rep/def levels. However, there could be many nested children |
| 240 | // elements beyond it in the Array that is being processed. |
| 241 | class AllNullsTerminalNode { |
| 242 | public: |
| 243 | explicit AllNullsTerminalNode(int16_t def_level, int16_t rep_level = kLevelNotSet) |
| 244 | : def_level_(def_level), rep_level_(rep_level) {} |
| 245 | void SetRepLevelIfNull(int16_t rep_level) { rep_level_ = rep_level; } |
| 246 | IterationResult Run(const ElementRange& range, PathWriteContext* context) { |
| 247 | int64_t size = range.Size(); |
| 248 | RETURN_IF_ERROR(FillRepLevels(size, rep_level_, context)); |
| 249 | return context->AppendDefLevels(size, def_level_); |
| 250 | } |
| 251 | |
| 252 | private: |
| 253 | int16_t def_level_; |
| 254 | int16_t rep_level_; |
| 255 | }; |
| 256 | |
| 257 | // Handles the case where all remaining arrays until the leaf have no nulls |
| 258 | // (and are not interrupted by lists). Unlike AllNullsTerminalNode this is |
no outgoing calls
no test coverage detected