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

Function executeSubQueryWithOneRow

src/Interpreters/executeSubQuery.cpp:89–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89Block executeSubQueryWithOneRow(const String & query, ContextMutablePtr query_context, bool internal, bool tolerate_multi_rows)
90{
91 modifyQueryContext(query_context, internal);
92
93 Block block;
94 std::exception_ptr exception;
95 auto thread = ThreadFromGlobalPool([query_context = std::move(query_context), &query, internal, tolerate_multi_rows, &block, &exception]() {
96 try
97 {
98 CurrentThread::QueryScope query_scope{query_context};
99 {
100 auto block_io = executeQuery(query, query_context, internal);
101
102 auto input_stream = block_io.getInputStream();
103 input_stream->readPrefix();
104 block = input_stream->read();
105
106 if (!tolerate_multi_rows && block.rows() != 1)
107 throw Exception(ErrorCodes::TOO_MANY_ROWS, "Unexcepted block");
108
109 while (const auto & tmp_block = input_stream->read())
110 {
111 if (tmp_block.rows() > 0)
112 throw Exception(ErrorCodes::TOO_MANY_ROWS, "Unexcepted block");
113 }
114
115 input_stream->readSuffix();
116
117 block_io.onFinish();
118 }
119 }
120 catch (...)
121 {
122 exception = constructException(query_context);
123 }
124 });
125 thread.join();
126
127 if (exception)
128 std::rethrow_exception(exception);
129
130 return block;
131}
132
133void executeSubQuery(const String & query, ContextMutablePtr query_context, std::function<void(Block &)> proc_block, bool internal)
134{

Callers 7

collectTableMethod · 0.85
collectFirstStepMethod · 0.85
collectSecondStepMethod · 0.85
firstCollectStepMethod · 0.85
collectSecondStepMethod · 0.85
collectExtendedStatsMethod · 0.85
executeImplMethod · 0.85

Calls 12

modifyQueryContextFunction · 0.85
constructExceptionFunction · 0.85
getInputStreamMethod · 0.80
executeQueryFunction · 0.70
ExceptionClass · 0.70
readPrefixMethod · 0.45
readMethod · 0.45
rowsMethod · 0.45
readSuffixMethod · 0.45
onFinishMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected