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

Function columnGetNested

src/Functions/FunctionHelpers.cpp:52–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52ColumnWithTypeAndName columnGetNested(const ColumnWithTypeAndName & col)
53{
54 if (col.type->isNullable())
55 {
56 const DataTypePtr & nested_type = static_cast<const DataTypeNullable &>(*col.type).getNestedType();
57
58 if (!col.column)
59 {
60 return ColumnWithTypeAndName{nullptr, nested_type, col.name};
61 }
62 else if (const auto * nullable = checkAndGetColumn<ColumnNullable>(*col.column))
63 {
64 const auto & nested_col = nullable->getNestedColumnPtr();
65 return ColumnWithTypeAndName{nested_col, nested_type, col.name};
66 }
67 else if (const auto * const_column = checkAndGetColumn<ColumnConst>(*col.column))
68 {
69 const auto * nullable_column = checkAndGetColumn<ColumnNullable>(const_column->getDataColumn());
70
71 ColumnPtr nullable_res;
72 if (nullable_column)
73 {
74 const auto & nested_col = nullable_column->getNestedColumnPtr();
75 nullable_res = ColumnConst::create(nested_col, col.column->size());
76 }
77 else
78 {
79 nullable_res = makeNullable(col.column);
80 }
81 return ColumnWithTypeAndName{ nullable_res, nested_type, col.name };
82 }
83 else
84 throw Exception("Illegal column for DataTypeNullable", ErrorCodes::ILLEGAL_COLUMN);
85 }
86 return col;
87}
88
89ColumnsWithTypeAndName createBlockWithNestedColumns(const ColumnsWithTypeAndName & columns)
90{

Callers 3

executeImplMethod · 0.85

Calls 6

getNestedTypeMethod · 0.80
createFunction · 0.70
makeNullableFunction · 0.50
ExceptionClass · 0.50
isNullableMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected