mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Fix 'Unknown executor' when reading from stdin in clickhouse local
This commit is contained in:
parent
2e61f2bb99
commit
e19bf218f6
@ -130,6 +130,11 @@ void applySettingsOverridesForLocal(ContextMutablePtr context)
|
||||
context->setSettings(settings);
|
||||
}
|
||||
|
||||
LocalServer::LocalServer()
|
||||
{
|
||||
is_local = true;
|
||||
}
|
||||
|
||||
Poco::Util::LayeredConfiguration & LocalServer::getClientConfiguration()
|
||||
{
|
||||
return config();
|
||||
|
@ -23,7 +23,7 @@ namespace DB
|
||||
class LocalServer : public ClientApplicationBase, public Loggers
|
||||
{
|
||||
public:
|
||||
LocalServer() = default;
|
||||
LocalServer();
|
||||
|
||||
void initialize(Poco::Util::Application & self) override;
|
||||
|
||||
|
@ -1748,7 +1748,8 @@ void ClientBase::sendData(Block & sample, const ColumnsDescription & columns_des
|
||||
}
|
||||
else if (!is_interactive)
|
||||
{
|
||||
sendDataFromStdin(sample, columns_description_for_query, parsed_query);
|
||||
if (!is_local)
|
||||
sendDataFromStdin(sample, columns_description_for_query, parsed_query);
|
||||
}
|
||||
else
|
||||
throw Exception(ErrorCodes::NO_DATA_TO_INSERT, "No data to insert");
|
||||
|
@ -263,6 +263,8 @@ protected:
|
||||
bool is_interactive = false; /// Use either interactive line editing interface or batch mode.
|
||||
bool delayed_interactive = false;
|
||||
|
||||
bool is_local = false; /// clickhouse-local, otherwise clickhouse-client
|
||||
|
||||
bool echo_queries = false; /// Print queries before execution in batch mode.
|
||||
bool ignore_error = false; /// In case of errors, don't print error message, continue to next query. Only applicable for non-interactive mode.
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
# foo
|
||||
# foo (pipe)
|
||||
foo
|
||||
# foo (file)
|
||||
foo
|
||||
# !foo
|
||||
# bar
|
||||
|
@ -4,17 +4,28 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CUR_DIR"/../shell_config.sh
|
||||
|
||||
tmp_file="$CUR_DIR/$CLICKHOUSE_DATABASE.txt"
|
||||
echo '# foo'
|
||||
tmp_file="$CUR_DIR/03031_$CLICKHOUSE_DATABASE.txt"
|
||||
tmp_input="$CUR_DIR/03031_${CLICKHOUSE_DATABASE}_in.txt"
|
||||
|
||||
echo '# foo (pipe)'
|
||||
$CLICKHOUSE_LOCAL --engine_file_truncate_on_insert=1 -q "insert into function file('$tmp_file', 'LineAsString', 'x String') select * from input('x String') format LineAsString" <<<foo
|
||||
cat "$tmp_file"
|
||||
|
||||
echo '# foo (file)'
|
||||
echo 'foo' > "$tmp_input"
|
||||
$CLICKHOUSE_LOCAL --engine_file_truncate_on_insert=1 -q "insert into function file('$tmp_file', 'LineAsString', 'x String') select * from input('x String') format LineAsString" <"$tmp_input"
|
||||
cat "$tmp_file"
|
||||
|
||||
echo '# !foo'
|
||||
$CLICKHOUSE_LOCAL --engine_file_truncate_on_insert=1 -q "insert into function file('$tmp_file', 'LineAsString', 'x String') select * from input('x String') where x != 'foo' format LineAsString" <<<foo
|
||||
cat "$tmp_file"
|
||||
|
||||
echo '# bar'
|
||||
$CLICKHOUSE_LOCAL --engine_file_truncate_on_insert=1 -q "insert into function file('$tmp_file', 'LineAsString', 'x String') select y from input('x String, y String') format TSV" <<<$'foo\tbar'
|
||||
cat "$tmp_file"
|
||||
|
||||
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'
|
||||
cat "$tmp_file"
|
||||
rm -f "${tmp_file:?}"
|
||||
|
||||
rm -f "${tmp_file:?}" "${tmp_input:?}"
|
||||
|
Loading…
Reference in New Issue
Block a user