MCPcopy Create free account
hub / github.com/ByConity/ByConity / getAssignmentDataType

Method getAssignmentDataType

src/QueryPlan/ApplyStep.cpp:56–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56DataTypePtr 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
87QueryPipelinePtr ApplyStep::updatePipeline(QueryPipelines, const BuildQueryPipelineSettings &)
88{

Callers 1

visitApplyNodeMethod · 0.80

Calls 5

tryConvertTypeToNullableFunction · 0.85
canBecomeNullableFunction · 0.85
ExceptionClass · 0.50
nameMethod · 0.45
isNullableMethod · 0.45

Tested by

no test coverage detected