| 172 | } |
| 173 | |
| 174 | void FieldReference::evalSpecialFormSimplified( |
| 175 | const SelectivityVector& rows, |
| 176 | EvalCtx& context, |
| 177 | VectorPtr& result) { |
| 178 | ExceptionContextSetter exceptionContext( |
| 179 | {[](BoltException::Type /*exceptionType*/, auto* expr) { |
| 180 | return static_cast<Expr*>(expr)->toString(); |
| 181 | }, |
| 182 | this}); |
| 183 | VectorPtr input; |
| 184 | const RowVector* row; |
| 185 | if (inputs_.empty()) { |
| 186 | row = context.row(); |
| 187 | } else { |
| 188 | BOLT_CHECK_EQ(inputs_.size(), 1); |
| 189 | inputs_[0]->evalSimplified(rows, context, input); |
| 190 | BaseVector::flattenVector(input); |
| 191 | row = input->as<RowVector>(); |
| 192 | BOLT_CHECK(row); |
| 193 | } |
| 194 | auto index = row->type()->asRow().getChildIdx(field_); |
| 195 | if (index_ == -1) { |
| 196 | index_ = index; |
| 197 | } else { |
| 198 | BOLT_CHECK_EQ(index_, index); |
| 199 | } |
| 200 | |
| 201 | LocalSelectivityVector nonNullRowsHolder(*context.execCtx()); |
| 202 | const SelectivityVector* nonNullRows = &rows; |
| 203 | if (row->mayHaveNulls()) { |
| 204 | nonNullRowsHolder.get(rows); |
| 205 | nonNullRowsHolder->deselectNulls(row->rawNulls(), rows.begin(), rows.end()); |
| 206 | nonNullRows = nonNullRowsHolder.get(); |
| 207 | if (!nonNullRows->hasSelections()) { |
| 208 | addNulls(rows, row->rawNulls(), context, result); |
| 209 | return; |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | auto& child = row->childAt(index_); |
| 214 | context.ensureWritable(rows, type_, result); |
| 215 | result->copy(child.get(), *nonNullRows, nullptr, context.isFinalSelection()); |
| 216 | if (row->mayHaveNulls()) { |
| 217 | addNulls(rows, row->rawNulls(), context, result); |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | std::string FieldReference::toString(bool recursive) const { |
| 222 | std::stringstream out; |
nothing calls this directly
no test coverage detected