Some minor fixes

This commit is contained in:
Ivan Lezhankin 2021-04-12 20:19:46 +03:00
parent 3da3250bfd
commit b559e45d93
12 changed files with 44 additions and 23 deletions

View File

@ -467,7 +467,6 @@ std::vector<TableNeededColumns> normalizeColumnNamesExtractNeeded(
for (ASTIdentifier * ident : identifiers) for (ASTIdentifier * ident : identifiers)
{ {
bool got_alias = aliases.count(ident->name()); bool got_alias = aliases.count(ident->name());
bool allow_ambiguous = got_alias; /// allow ambiguous column overridden by an alias bool allow_ambiguous = got_alias; /// allow ambiguous column overridden by an alias
@ -478,14 +477,10 @@ std::vector<TableNeededColumns> normalizeColumnNamesExtractNeeded(
if (got_alias) if (got_alias)
{ {
auto alias = aliases.find(ident->name())->second; auto alias = aliases.find(ident->name())->second;
auto alias_table = IdentifierSemantic::getTableName(alias->ptr()); bool alias_equals_column_name = alias->ptr()->getColumnNameWithoutAlias() == ident->getColumnNameWithoutAlias();
bool alias_equals_column_name = false; // FIXME: check test 01600_multiple_left_joins_with_aliases
if ((!ident->isShort() && alias->ptr()->getColumnNameWithoutAlias() == ident->getColumnNameWithoutAlias()) // || (alias_table == IdentifierSemantic::getTableName(ident->ptr())
|| (alias_table == IdentifierSemantic::getTableName(ident->ptr()) // && ident->shortName() == alias->as<ASTIdentifier>()->shortName()))
&& ident->shortName() == alias->as<ASTIdentifier>()->shortName()))
{
alias_equals_column_name = true;
}
if (!alias_equals_column_name) if (!alias_equals_column_name)
throw Exception("Alias clashes with qualified column '" + ident->name() + "'", ErrorCodes::AMBIGUOUS_COLUMN_NAME); throw Exception("Alias clashes with qualified column '" + ident->name() + "'", ErrorCodes::AMBIGUOUS_COLUMN_NAME);
} }

View File

@ -79,7 +79,6 @@ void ASTIdentifier::setShortName(const String & new_name)
name_parts = {new_name}; name_parts = {new_name};
bool special = semantic->special; bool special = semantic->special;
//how about keep the semantic info here, such as table
auto table = semantic->table; auto table = semantic->table;
*semantic = IdentifierSemanticImpl(); *semantic = IdentifierSemanticImpl();

View File

@ -246,7 +246,8 @@ bool ParserCompoundIdentifier::parseImpl(Pos & pos, ASTPtr & node, Expected & ex
if (table_name_with_optional_uuid) if (table_name_with_optional_uuid)
{ {
assert(parts.size() <= 2); if (parts.size() > 2)
return false;
if (s_uuid.ignore(pos, expected)) if (s_uuid.ignore(pos, expected))
{ {

View File

@ -87,3 +87,5 @@ select 5 = windowFunnel(10000)(timestamp, event = 1000, event = 1001, event = 10
select 2 = windowFunnel(10000, 'strict_increase')(timestamp, event = 1000, event = 1001, event = 1002, event = 1003, event = 1004) from funnel_test_strict_increase; select 2 = windowFunnel(10000, 'strict_increase')(timestamp, event = 1000, event = 1001, event = 1002, event = 1003, event = 1004) from funnel_test_strict_increase;
select 3 = windowFunnel(10000)(timestamp, event = 1004, event = 1004, event = 1004) from funnel_test_strict_increase; select 3 = windowFunnel(10000)(timestamp, event = 1004, event = 1004, event = 1004) from funnel_test_strict_increase;
select 1 = windowFunnel(10000, 'strict_increase')(timestamp, event = 1004, event = 1004, event = 1004) from funnel_test_strict_increase; select 1 = windowFunnel(10000, 'strict_increase')(timestamp, event = 1004, event = 1004, event = 1004) from funnel_test_strict_increase;
drop table funnel_test_strict_increase;

View File

@ -31,7 +31,7 @@ echo "Binary representation:"
hexdump -C $BINARY_FILE_PATH hexdump -C $BINARY_FILE_PATH
echo echo
(cd $SCHEMADIR && protoc --decode Message 00825_protobuf_format_no_length_delimiter.proto) < $BINARY_FILE_PATH (cd $SCHEMADIR && $PROTOC_BINARY --decode Message 00825_protobuf_format_no_length_delimiter.proto) < $BINARY_FILE_PATH
# Check the input in the ProtobufSingle format. # Check the input in the ProtobufSingle format.
echo echo

View File

@ -1,5 +1,5 @@
drop table if exists test_num; drop table if exists test_enum;
create table test_enum (c Nullable(Enum16('A' = 1, 'B' = 2))) engine Log; create table test_enum (c Nullable(Enum16('A' = 1, 'B' = 2))) engine Log;
insert into test_enum values (1), (NULL); insert into test_enum values (1), (NULL);
select * from test_enum; select * from test_enum;
drop table if exists test_num; drop table if exists test_enum;

View File

@ -1,2 +1,3 @@
create table dist_01756 (dummy UInt8) ENGINE = Distributed('test_cluster_two_shards', 'system', 'one', dummy); create table dist_01756 (dummy UInt8) ENGINE = Distributed('test_cluster_two_shards', 'system', 'one', dummy);
select ignore(1), * from dist_01756 where 0 settings optimize_skip_unused_shards=1, force_optimize_skip_unused_shards=1 select ignore(1), * from dist_01756 where 0 settings optimize_skip_unused_shards=1, force_optimize_skip_unused_shards=1
drop table dist_01756;

View File

@ -9,7 +9,7 @@ CREATE TABLE tt6
`status` String `status` String
) )
ENGINE = Distributed('test_shard_localhost', '', 'tt6', rand()); ENGINE = Distributed('test_shard_localhost', currentDatabase(), 'tt6', rand());
INSERT INTO tt6 VALUES (1, 1, 1, 1, 'ok'); -- { serverError 581 } INSERT INTO tt6 VALUES (1, 1, 1, 1, 'ok'); -- { serverError 581 }

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# The protobuf compiler protoc doesn't support encoding or decoding length-delimited protobuf message. # The protobuf compiler protoc doesn't support encoding or decoding length-delimited protobuf message.
# To do that this script has been written. # To do that this script has been written.
import argparse import argparse
import os.path import os.path
@ -69,7 +69,8 @@ def decode(input, output, format_schema):
msg = input.read(sz) msg = input.read(sz)
if len(msg) < sz: if len(msg) < sz:
raise EOFError('Unexpected end of file') raise EOFError('Unexpected end of file')
with subprocess.Popen(["protoc", protoc = os.getenv('PROTOC_BINARY', 'protoc')
with subprocess.Popen([protoc,
"--decode", format_schema.message_type, format_schema.schemaname], "--decode", format_schema.message_type, format_schema.schemaname],
cwd=format_schema.schemadir, cwd=format_schema.schemadir,
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
@ -98,7 +99,8 @@ def encode(input, output, format_schema):
if line.startswith(b"MESSAGE #") or len(line) == 0: if line.startswith(b"MESSAGE #") or len(line) == 0:
break break
msg += line msg += line
with subprocess.Popen(["protoc", protoc = os.getenv('PROTOC_BINARY', 'protoc')
with subprocess.Popen([protoc,
"--encode", format_schema.message_type, format_schema.schemaname], "--encode", format_schema.message_type, format_schema.schemaname],
cwd=format_schema.schemadir, cwd=format_schema.schemadir,
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
@ -155,7 +157,7 @@ if __name__ == "__main__":
group.add_argument('--decode_and_check', action='store_true', help='The same as --decode, and the utility will then encode ' group.add_argument('--decode_and_check', action='store_true', help='The same as --decode, and the utility will then encode '
' the decoded data back to the binary form to check that the result of that encoding is the same as the input was.') ' the decoded data back to the binary form to check that the result of that encoding is the same as the input was.')
args = parser.parse_args() args = parser.parse_args()
custom_input_file = None custom_input_file = None
custom_output_file = None custom_output_file = None
try: try:

View File

@ -1,5 +1,3 @@
import pytest
import difflib import difflib
import os import os
import random import random
@ -7,6 +5,8 @@ import string
import subprocess import subprocess
import sys import sys
import pytest
SKIP_LIST = [ SKIP_LIST = [
# these couple of tests hangs everything # these couple of tests hangs everything
@ -33,7 +33,7 @@ SKIP_LIST = [
"01057_http_compression_prefer_brotli", "01057_http_compression_prefer_brotli",
"01080_check_for_error_incorrect_size_of_nested_column", "01080_check_for_error_incorrect_size_of_nested_column",
"01083_expressions_in_engine_arguments", "01083_expressions_in_engine_arguments",
# "01086_odbc_roundtrip", "01086_odbc_roundtrip",
"01088_benchmark_query_id", "01088_benchmark_query_id",
"01098_temporary_and_external_tables", "01098_temporary_and_external_tables",
"01099_parallel_distributed_insert_select", "01099_parallel_distributed_insert_select",
@ -76,8 +76,13 @@ SKIP_LIST = [
"01599_multiline_input_and_singleline_comments", # expect-test "01599_multiline_input_and_singleline_comments", # expect-test
"01601_custom_tld", "01601_custom_tld",
"01610_client_spawn_editor", # expect-test "01610_client_spawn_editor", # expect-test
"01674_unicode_asan",
"01676_clickhouse_client_autocomplete", # expect-test (partially) "01676_clickhouse_client_autocomplete", # expect-test (partially)
"01683_text_log_deadlock", # secure tcp "01683_text_log_deadlock", # secure tcp
"01684_ssd_cache_dictionary_simple_key",
"01747_executable_pool_dictionary_implicit_key.sql",
"01747_join_view_filter_dictionary",
"01748_dictionary_table_dot",
] ]
@ -121,7 +126,8 @@ def run_shell(bin_prefix, server, database, path, reference, replace_map=None):
'CLICKHOUSE_PORT_HTTP': str(server.http_port), 'CLICKHOUSE_PORT_HTTP': str(server.http_port),
'CLICKHOUSE_PORT_INTERSERVER': str(server.inter_port), 'CLICKHOUSE_PORT_INTERSERVER': str(server.inter_port),
'CLICKHOUSE_TMP': server.tmp_dir, 'CLICKHOUSE_TMP': server.tmp_dir,
'CLICKHOUSE_CONFIG_CLIENT': server.client_config 'CLICKHOUSE_CONFIG_CLIENT': server.client_config,
'PROTOC_BINARY': os.path.abspath(os.path.join(os.path.dirname(bin_prefix), '..', 'contrib', 'protobuf', 'protoc')), # FIXME: adhoc solution
} }
shell = subprocess.Popen([path], env=env, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) shell = subprocess.Popen([path], env=env, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result, error = shell.communicate() result, error = shell.communicate()

View File

@ -289,6 +289,19 @@ ServerThread.DEFAULT_SERVER_CONFIG = \
</replica> </replica>
</shard> </shard>
</test_cluster_with_incorrect_pw> </test_cluster_with_incorrect_pw>
<test_cluster_one_shard_two_replicas>
<shard>
<replica>
<host>127.0.0.1</host>
<port>{tcp_port}</port>
</replica>
<replica>
<host>127.0.0.2</host>
<port>{tcp_port}</port>
</replica>
</shard>
</test_cluster_one_shard_two_replicas>
</remote_servers> </remote_servers>
<storage_configuration> <storage_configuration>

View File

@ -107,6 +107,8 @@ MYSQL_CLIENT_OPT0+=" --user ${MYSQL_CLIENT_CLICKHOUSE_USER} "
export MYSQL_CLIENT_OPT="${MYSQL_CLIENT_OPT0:-} ${MYSQL_CLIENT_OPT:-}" export MYSQL_CLIENT_OPT="${MYSQL_CLIENT_OPT0:-} ${MYSQL_CLIENT_OPT:-}"
export MYSQL_CLIENT=${MYSQL_CLIENT:="$MYSQL_CLIENT_BINARY ${MYSQL_CLIENT_OPT:-}"} export MYSQL_CLIENT=${MYSQL_CLIENT:="$MYSQL_CLIENT_BINARY ${MYSQL_CLIENT_OPT:-}"}
export PROTOC_BINARY=${PROTOC_BINARY:="protoc"}
function clickhouse_client_removed_host_parameter() function clickhouse_client_removed_host_parameter()
{ {
# removing only `--host=value` and `--host value` (removing '-hvalue' feels to dangerous) with python regex. # removing only `--host=value` and `--host value` (removing '-hvalue' feels to dangerous) with python regex.