#include #include #include #include #include #include #include #include #include #include #include #include using namespace DB; int main(int, char **) try { Context context = Context::createGlobal(); context.makeGlobalContext(); Settings settings = context.getSettings(); context.setPath("./"); loadMetadata(context); Names column_names; column_names.push_back("WatchID"); StoragePtr table = context.getTable("default", "hits6"); QueryProcessingStage::Enum stage = table->getQueryProcessingStage(context); BlockInputStreams streams = table->read(column_names, {}, context, stage, settings.max_block_size, settings.max_threads); for (size_t i = 0, size = streams.size(); i < size; ++i) streams[i] = std::make_shared(streams[i]); BlockInputStreamPtr stream = std::make_shared(streams, nullptr, settings.max_threads); stream = std::make_shared(stream, 10, 0); WriteBufferFromFileDescriptor wb(STDERR_FILENO); Block sample = table->getSampleBlock(); BlockOutputStreamPtr out = context.getOutputFormat("TabSeparated", wb, sample); copyData(*stream, *out); return 0; } catch (const Exception & e) { std::cerr << e.what() << ", " << e.displayText() << std::endl << std::endl << "Stack trace:" << std::endl << e.getStackTraceString(); return 1; }