Also fix 'Input initializer is not set' in another query

This commit is contained in:
Michael Kolupaev 2024-10-25 08:24:30 +00:00
parent e19bf218f6
commit 9cf7247bcc
3 changed files with 7 additions and 2 deletions

View File

@ -121,8 +121,7 @@ StoragePtr InterpreterInsertQuery::getTable(ASTInsertQuery & query)
if (current_context->getSettingsRef()[Setting::allow_experimental_analyzer]) if (current_context->getSettingsRef()[Setting::allow_experimental_analyzer])
{ {
InterpreterSelectQueryAnalyzer interpreter_select(query.select, current_context, select_query_options); header_block = InterpreterSelectQueryAnalyzer::getSampleBlock(query.select, current_context, select_query_options);
header_block = interpreter_select.getSampleBlock();
} }
else else
{ {

View File

@ -7,3 +7,5 @@ foo
bar bar
# defaults # defaults
bam bam
# inferred destination table structure
foo

View File

@ -28,4 +28,8 @@ echo '# defaults'
$CLICKHOUSE_LOCAL --input_format_tsv_empty_as_default=1 --engine_file_truncate_on_insert=1 -q "insert into function file('$tmp_file', 'LineAsString', 'x String') select y from input('x String, y String DEFAULT \\'bam\\'') format TSV" <<<$'foo\t' $CLICKHOUSE_LOCAL --input_format_tsv_empty_as_default=1 --engine_file_truncate_on_insert=1 -q "insert into function file('$tmp_file', 'LineAsString', 'x String') select y from input('x String, y String DEFAULT \\'bam\\'') format TSV" <<<$'foo\t'
cat "$tmp_file" cat "$tmp_file"
echo '# inferred destination table structure'
$CLICKHOUSE_LOCAL --engine_file_truncate_on_insert=1 -q "insert into function file('$tmp_file', 'TSV') select * from input('x String') format LineAsString" <"$tmp_input"
cat "$tmp_file"
rm -f "${tmp_file:?}" "${tmp_input:?}" rm -f "${tmp_file:?}" "${tmp_input:?}"