| 54 | } |
| 55 | |
| 56 | DataTypePtr ApplyStep::getAssignmentDataType() const |
| 57 | { |
| 58 | switch (subquery_type) |
| 59 | { |
| 60 | case ApplyStep::SubqueryType::IN: { |
| 61 | auto * arguments = assignment.second->children[0]->as<ASTExpressionList>(); |
| 62 | auto argument_name = arguments->children[0]->as<ASTIdentifier>()->name(); |
| 63 | for (const auto & column : input_streams[0].header) |
| 64 | if (column.name == argument_name) |
| 65 | return column.type->isNullable() ? JoinCommon::tryConvertTypeToNullable(std::make_shared<DataTypeUInt8>()) : std::make_shared<DataTypeUInt8>(); |
| 66 | throw Exception("Unknown data type for column " + argument_name, ErrorCodes::LOGICAL_ERROR); |
| 67 | } |
| 68 | case ApplyStep::SubqueryType::EXISTS: { |
| 69 | return std::make_shared<DataTypeUInt8>(); |
| 70 | } |
| 71 | case ApplyStep::SubqueryType::SCALAR: { |
| 72 | for (const auto & column : input_streams[1].header) |
| 73 | if (column.name == assignment.first) |
| 74 | return JoinCommon::canBecomeNullable(column.type) ? JoinCommon::tryConvertTypeToNullable(column.type) : column.type; |
| 75 | throw Exception("Unknown data type for column " + assignment.first, ErrorCodes::LOGICAL_ERROR); |
| 76 | } |
| 77 | case ApplyStep::SubqueryType::QUANTIFIED_COMPARISON: { |
| 78 | auto argument_name = assignment.second->children[0]->as<ASTIdentifier>()->name(); |
| 79 | for (const auto & column : input_streams[0].header) |
| 80 | if (column.name == argument_name) |
| 81 | return column.type->isNullable() ? JoinCommon::tryConvertTypeToNullable(std::make_shared<DataTypeUInt8>()) : std::make_shared<DataTypeUInt8>(); |
| 82 | throw Exception("Unknown data type for column " + argument_name, ErrorCodes::LOGICAL_ERROR); |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | QueryPipelinePtr ApplyStep::updatePipeline(QueryPipelines, const BuildQueryPipelineSettings &) |
| 88 | { |
no test coverage detected