Returns the type for the hash table row. Build side keys first, then dependent build side columns.
| 50 | // Returns the type for the hash table row. Build side keys first, |
| 51 | // then dependent build side columns. |
| 52 | RowTypePtr makeTableType( |
| 53 | const RowType* type, |
| 54 | const std::vector<std::shared_ptr<const core::FieldAccessTypedExpr>>& keys, |
| 55 | const std::shared_ptr<const core::HashJoinNode>& joinNode) { |
| 56 | std::vector<std::string> names; |
| 57 | std::vector<TypePtr> types; |
| 58 | std::unordered_set<column_index_t> keyChannels(keys.size()); |
| 59 | names.reserve(type->size()); |
| 60 | types.reserve(type->size()); |
| 61 | for (const auto& key : keys) { |
| 62 | auto channel = type->getChildIdx(key->name()); |
| 63 | names.emplace_back(type->nameOf(channel)); |
| 64 | types.emplace_back(type->childAt(channel)); |
| 65 | keyChannels.insert(channel); |
| 66 | } |
| 67 | if (!canDropDuplicates(joinNode)) { |
| 68 | // For left semi and anti join with no extra filter, hash table does not |
| 69 | // store dependent columns. |
| 70 | for (auto i = 0; i < type->size(); ++i) { |
| 71 | if (keyChannels.find(i) == keyChannels.end()) { |
| 72 | names.emplace_back(type->nameOf(i)); |
| 73 | types.emplace_back(type->childAt(i)); |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | return ROW(std::move(names), std::move(types)); |
| 78 | } |
| 79 | |
| 80 | // Copy values from 'rows' of 'table' according to 'projections' in |
| 81 | // 'result'. Reuses 'result' children where possible. |
no test coverage detected