| 31 | } |
| 32 | |
| 33 | void ExternalResultDescription::init(const Block & sample_block_) |
| 34 | { |
| 35 | sample_block = sample_block_; |
| 36 | |
| 37 | types.reserve(sample_block.columns()); |
| 38 | |
| 39 | for (auto & elem : sample_block) |
| 40 | { |
| 41 | /// If default value for column was not provided, use default from data type. |
| 42 | if (elem.column->empty()) |
| 43 | elem.column = elem.type->createColumnConstWithDefaultValue(1)->convertToFullColumnIfConst(); |
| 44 | |
| 45 | bool is_nullable = elem.type->isNullable(); |
| 46 | DataTypePtr type_not_nullable = removeNullable(elem.type); |
| 47 | const IDataType * type = type_not_nullable.get(); |
| 48 | |
| 49 | if (dynamic_cast<const DataTypePointName *>(type->getCustomName())) |
| 50 | { |
| 51 | types.emplace_back(ValueType::vtPoint, is_nullable); |
| 52 | continue; |
| 53 | } |
| 54 | |
| 55 | WhichDataType which(type); |
| 56 | |
| 57 | if (which.isUInt8()) |
| 58 | types.emplace_back(ValueType::vtUInt8, is_nullable); |
| 59 | else if (which.isUInt16()) |
| 60 | types.emplace_back(ValueType::vtUInt16, is_nullable); |
| 61 | else if (which.isUInt32()) |
| 62 | types.emplace_back(ValueType::vtUInt32, is_nullable); |
| 63 | else if (which.isUInt64()) |
| 64 | types.emplace_back(ValueType::vtUInt64, is_nullable); |
| 65 | else if (which.isInt8()) |
| 66 | types.emplace_back(ValueType::vtInt8, is_nullable); |
| 67 | else if (which.isInt16()) |
| 68 | types.emplace_back(ValueType::vtInt16, is_nullable); |
| 69 | else if (which.isInt32()) |
| 70 | types.emplace_back(ValueType::vtInt32, is_nullable); |
| 71 | else if (which.isInt64()) |
| 72 | types.emplace_back(ValueType::vtInt64, is_nullable); |
| 73 | else if (which.isInt256()) |
| 74 | types.emplace_back(ValueType::vtInt256, is_nullable); |
| 75 | else if (which.isFloat32()) |
| 76 | types.emplace_back(ValueType::vtFloat32, is_nullable); |
| 77 | else if (which.isFloat64()) |
| 78 | types.emplace_back(ValueType::vtFloat64, is_nullable); |
| 79 | else if (which.isString()) |
| 80 | types.emplace_back(ValueType::vtString, is_nullable); |
| 81 | else if (which.isDate()) |
| 82 | types.emplace_back(ValueType::vtDate, is_nullable); |
| 83 | else if (which.isDate32()) |
| 84 | types.emplace_back(ValueType::vtDate32, is_nullable); |
| 85 | else if (which.isDateTime()) |
| 86 | types.emplace_back(ValueType::vtDateTime, is_nullable); |
| 87 | else if (which.isUUID()) |
| 88 | types.emplace_back(ValueType::vtUUID, is_nullable); |
| 89 | else if (which.isEnum8()) |
| 90 | types.emplace_back(ValueType::vtEnum8, is_nullable); |
nothing calls this directly
no test coverage detected