mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Merge branch 'master' into underscore_digit_groups
This commit is contained in:
commit
8c229565b7
@ -1,4 +1,3 @@
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
#include <cstdlib>
|
||||
#include <fcntl.h>
|
||||
#include <map>
|
||||
@ -7,7 +6,6 @@
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <Common/ThreadStatus.h>
|
||||
#include <Common/scope_guard_safe.h>
|
||||
#include <boost/program_options.hpp>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <filesystem>
|
||||
@ -45,8 +43,6 @@
|
||||
|
||||
#include <Processors/Transforms/getSourceFromASTInsertQuery.h>
|
||||
|
||||
#include <Interpreters/InterpreterSetQuery.h>
|
||||
|
||||
#include <Functions/registerFunctions.h>
|
||||
#include <AggregateFunctions/registerAggregateFunctions.h>
|
||||
#include <Formats/registerFormats.h>
|
||||
@ -1180,7 +1176,7 @@ void Client::processConfig()
|
||||
|
||||
pager = config().getString("pager", "");
|
||||
|
||||
is_default_format = !config().has("vertical") && !config().has("format");
|
||||
is_default_format = !config().has("vertical") && !config().has("output-format") && !config().has("format");
|
||||
if (is_default_format && checkIfStdoutIsRegularFile())
|
||||
{
|
||||
is_default_format = false;
|
||||
@ -1189,9 +1185,13 @@ void Client::processConfig()
|
||||
format = format_from_file_name ? *format_from_file_name : "TabSeparated";
|
||||
}
|
||||
else if (config().has("vertical"))
|
||||
format = config().getString("format", "Vertical");
|
||||
{
|
||||
format = config().getString("output-format", config().getString("format", "Vertical"));
|
||||
}
|
||||
else
|
||||
format = config().getString("format", is_interactive ? "PrettyCompact" : "TabSeparated");
|
||||
{
|
||||
format = config().getString("output-format", config().getString("format", is_interactive ? "PrettyCompact" : "TabSeparated"));
|
||||
}
|
||||
|
||||
format_max_block_size = config().getUInt64("format_max_block_size",
|
||||
global_context->getSettingsRef().max_block_size);
|
||||
|
@ -819,7 +819,6 @@ void LocalServer::addOptions(OptionsDescription & options_description)
|
||||
("file,F", po::value<std::string>(), "path to file with data of the initial table (stdin if not specified)")
|
||||
|
||||
("input-format", po::value<std::string>(), "input format of the initial table data")
|
||||
("output-format", po::value<std::string>(), "default output format")
|
||||
|
||||
("logger.console", po::value<bool>()->implicit_value(true), "Log to console")
|
||||
("logger.log", po::value<std::string>(), "Log file name")
|
||||
|
@ -2892,7 +2892,9 @@ void ClientBase::init(int argc, char ** argv)
|
||||
|
||||
("suggestion_limit", po::value<int>()->default_value(10000), "Suggestion limit for how many databases, tables and columns to fetch.")
|
||||
|
||||
("format,f", po::value<std::string>(), "default output format")
|
||||
("format,f", po::value<std::string>(), "default output format (and input format for clickhouse-local)")
|
||||
("output-format", po::value<std::string>(), "default output format (this option has preference over --format)")
|
||||
|
||||
("vertical,E", "vertical output format, same as --format=Vertical or FORMAT Vertical or \\G at end of command")
|
||||
("highlight", po::value<bool>()->default_value(true), "enable or disable basic syntax highlight in interactive command line")
|
||||
|
||||
@ -2975,6 +2977,8 @@ void ClientBase::init(int argc, char ** argv)
|
||||
config().setBool("ignore-error", true);
|
||||
if (options.count("format"))
|
||||
config().setString("format", options["format"].as<std::string>());
|
||||
if (options.count("output-format"))
|
||||
config().setString("output-format", options["output-format"].as<std::string>());
|
||||
if (options.count("vertical"))
|
||||
config().setBool("vertical", true);
|
||||
if (options.count("stacktrace"))
|
||||
|
@ -32,6 +32,9 @@ const ColumnIdentifier & GlobalPlannerContext::createColumnIdentifier(const Name
|
||||
column_identifier = column.name;
|
||||
|
||||
auto [it, inserted] = column_identifiers.emplace(column_identifier);
|
||||
if (!inserted)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Column identifier {} is already registered", column_identifier);
|
||||
|
||||
assert(inserted);
|
||||
|
||||
return *it;
|
||||
|
@ -960,8 +960,14 @@ JoinTreeQueryPlan buildQueryPlanForTableExpression(QueryTreeNodePtr table_expres
|
||||
}
|
||||
else
|
||||
{
|
||||
std::shared_ptr<GlobalPlannerContext> subquery_planner_context;
|
||||
if (wrap_read_columns_in_subquery)
|
||||
subquery_planner_context = std::make_shared<GlobalPlannerContext>(nullptr, nullptr, FiltersForTableExpressionMap{});
|
||||
else
|
||||
subquery_planner_context = planner_context->getGlobalPlannerContext();
|
||||
|
||||
auto subquery_options = select_query_options.subquery();
|
||||
Planner subquery_planner(table_expression, subquery_options, planner_context->getGlobalPlannerContext());
|
||||
Planner subquery_planner(table_expression, subquery_options, subquery_planner_context);
|
||||
/// Propagate storage limits to subquery
|
||||
subquery_planner.addStorageLimits(*select_query_info.storage_limits);
|
||||
subquery_planner.buildQueryPlanIfNeeded();
|
||||
|
@ -1387,7 +1387,6 @@ class TestCase:
|
||||
self.reference_file,
|
||||
self.stdout_file,
|
||||
],
|
||||
encoding="latin-1",
|
||||
stdout=PIPE,
|
||||
universal_newlines=True,
|
||||
) as diff_proc:
|
||||
|
@ -0,0 +1,12 @@
|
||||
| x |
|
||||
|:-|
|
||||
| Hello, world |
|
||||
| x |
|
||||
|:-|
|
||||
| Hello, world |
|
||||
| x |
|
||||
|:-|
|
||||
| Hello, world |
|
||||
| x |
|
||||
|:-|
|
||||
| Hello, world |
|
16
tests/queries/0_stateless/03020_output_format_client.sh
Executable file
16
tests/queries/0_stateless/03020_output_format_client.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
# clickhouse-local has --input-format and --output-format parameters,
|
||||
# and also the --format parameter which is the default for both input and output formats, but has less preference.
|
||||
|
||||
# clickhouse-client does not have the --input-format parameter.
|
||||
# However, it accepts both --format and --output-format for convenience.
|
||||
|
||||
${CLICKHOUSE_LOCAL} --output-format Markdown --query "SELECT 'Hello, world' AS x"
|
||||
${CLICKHOUSE_CLIENT} --output-format Markdown --query "SELECT 'Hello, world' AS x"
|
||||
${CLICKHOUSE_LOCAL} --format Markdown --query "SELECT 'Hello, world' AS x"
|
||||
${CLICKHOUSE_CLIENT} --format Markdown --query "SELECT 'Hello, world' AS x"
|
Loading…
Reference in New Issue
Block a user