| 50 | } |
| 51 | |
| 52 | ColumnWithTypeAndName 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 | |
| 89 | ColumnsWithTypeAndName createBlockWithNestedColumns(const ColumnsWithTypeAndName & columns) |
| 90 | { |
no test coverage detected