| 105 | } |
| 106 | |
| 107 | Block TableFunctionFormat::parseData(const ColumnsDescription & columns, const String & format_name, const ContextPtr & context) const |
| 108 | { |
| 109 | Block block; |
| 110 | for (const auto & name_and_type : columns.getAllPhysical()) |
| 111 | block.insert({name_and_type.type->createColumn(), name_and_type.type, name_and_type.name}); |
| 112 | |
| 113 | auto read_buf = std::make_unique<ReadBufferFromString>(data); |
| 114 | auto input_format = context->getInputFormat(format_name, *read_buf, block, context->getSettingsRef()[Setting::max_block_size]); |
| 115 | QueryPipelineBuilder builder; |
| 116 | builder.init(Pipe(input_format)); |
| 117 | if (columns.hasDefaults()) |
| 118 | { |
| 119 | builder.addSimpleTransform([&](const SharedHeader & header) |
| 120 | { |
| 121 | return std::make_shared<AddingDefaultsTransform>(header, columns, *input_format, context); |
| 122 | }); |
| 123 | } |
| 124 | |
| 125 | builder.setConcurrencyControl(context->getSettingsRef()[Setting::use_concurrency_control]); |
| 126 | auto pipeline = std::make_unique<QueryPipeline>(QueryPipelineBuilder::getPipeline(std::move(builder))); |
| 127 | auto reader = std::make_unique<PullingPipelineExecutor>(*pipeline); |
| 128 | |
| 129 | Blocks blocks; |
| 130 | while (reader->pull(block)) |
| 131 | blocks.push_back(std::move(block)); |
| 132 | |
| 133 | /// In case when data contains more then 1 block we combine |
| 134 | /// them all to one big block (this is considered a rare case). |
| 135 | return concatenateBlocks(blocks); |
| 136 | } |
| 137 | |
| 138 | StoragePtr TableFunctionFormat::executeImpl(const ASTPtr & /*ast_function*/, ContextPtr context, const std::string & table_name, ColumnsDescription /*cached_columns*/, bool /*is_insert_query*/) const |
| 139 | { |
nothing calls this directly
no test coverage detected