This commit is contained in:
Evgeniy Gatov 2014-07-31 18:19:45 +04:00
commit 5b5f91dbbc
4 changed files with 21 additions and 13 deletions

View File

@ -135,10 +135,6 @@ void ExpressionAnalyzer::analyzeAggregation()
const auto & col = block.getByName(column_name); const auto & col = block.getByName(column_name);
/// constant expressions have non-null column pointer at this stage
if (const auto is_constexpr = col.column)
continue;
NameAndTypePair key{column_name, col.type}; NameAndTypePair key{column_name, col.type};
aggregation_keys.push_back(key); aggregation_keys.push_back(key);
@ -449,7 +445,7 @@ void ExpressionAnalyzer::eliminateInjectives()
group_exprs.pop_back(); group_exprs.pop_back();
}; };
/// iterate each GROUP BY expression, eliminate injective function calls and literals /// iterate over each GROUP BY expression, eliminate injective function calls and literals
for (size_t i = 0; i < group_exprs.size(); ++i) for (size_t i = 0; i < group_exprs.size(); ++i)
{ {
if (const auto function = typeid_cast<ASTFunction*>(group_exprs[i].get())) if (const auto function = typeid_cast<ASTFunction*>(group_exprs[i].get()))
@ -473,11 +469,6 @@ void ExpressionAnalyzer::eliminateInjectives()
std::back_inserter(group_exprs), is_literal std::back_inserter(group_exprs), is_literal
); );
} }
else if (is_literal(group_exprs[i]))
{
remove_expr_at_index(i);
i -= 1;
}
} }
} }

View File

@ -13,22 +13,34 @@ if [ -t 1 ]; then # stdout - терминал.
COLOR_FAIL="\033[1;31m" COLOR_FAIL="\033[1;31m"
COLOR_UNKNOWN="\033[1;30m" COLOR_UNKNOWN="\033[1;30m"
COLOR_OK="\033[1;32m" COLOR_OK="\033[1;32m"
COLOR_SKIPPED="\033[1;34m"
else else
COLOR_RESET="" COLOR_RESET=""
COLOR_WHITE="" COLOR_WHITE=""
COLOR_FAIL="" COLOR_FAIL=""
COLOR_UNKNOWN="" COLOR_UNKNOWN=""
COLOR_OK="" COLOR_OK=""
COLOR_SKIPPED=""
fi fi
MSG_FAIL="${COLOR_WHITE}[ ${COLOR_FAIL}FAIL${COLOR_WHITE} ]${COLOR_RESET}" MSG_FAIL="${COLOR_WHITE}[ ${COLOR_FAIL}FAIL${COLOR_WHITE} ]${COLOR_RESET}"
MSG_UNKNOWN="${COLOR_WHITE}[ ${COLOR_UNKNOWN}UNKNOWN${COLOR_WHITE} ]${COLOR_RESET}" MSG_UNKNOWN="${COLOR_WHITE}[ ${COLOR_UNKNOWN}UNKNOWN${COLOR_WHITE} ]${COLOR_RESET}"
MSG_OK="${COLOR_WHITE}[ ${COLOR_OK}OK${COLOR_WHITE} ]${COLOR_RESET}" MSG_OK="${COLOR_WHITE}[ ${COLOR_OK}OK${COLOR_WHITE} ]${COLOR_RESET}"
MSG_GENERATED="${COLOR_WHITE}[ ${COLOR_UNKNOWN}GENERATED${COLOR_WHITE} ]${COLOR_RESET}" MSG_GENERATED="${COLOR_WHITE}[ ${COLOR_UNKNOWN}GENERATED${COLOR_WHITE} ]${COLOR_RESET}"
MSG_SKIPPED="${COLOR_WHITE}[ ${COLOR_SKIPPED}SKIPPED${COLOR_WHITE} ]${COLOR_RESET}"
ERRORS=0 ERRORS=0
if [ "$1" == "--zookeeper" ]; then
ZOOKEEPER=1
elif grep -q '<zookeeper' /etc/clickhouse-server/config-preprocessed.xml; then
ZOOKEEPER=1
else
ZOOKEEPER=0
fi
if [ "$1" == "--generate" ]; then if [ "$1" == "--generate" ]; then
GENERATE=1 GENERATE=1
shift shift
@ -60,13 +72,18 @@ do
continue continue
fi fi
printf "%-60s" "$test_name: "
if [ $ZOOKEEPER -eq 0 ] && (echo "$test_name" | grep -q 'zookeeper'); then
echo -e "$MSG_SKIPPED - no zookeeper"
continue
fi
result_file=$QUERIES_DIR/$dir/$test_name.result result_file=$QUERIES_DIR/$dir/$test_name.result
error_file=$QUERIES_DIR/$dir/$test_name.error error_file=$QUERIES_DIR/$dir/$test_name.error
reference_file=$QUERIES_DIR/$dir/$test_name.reference reference_file=$QUERIES_DIR/$dir/$test_name.reference
diff_file=$QUERIES_DIR/$dir/$test_name.diff diff_file=$QUERIES_DIR/$dir/$test_name.diff
printf "%-60s" "$test_name: "
if [[ "$extension" == "sql" ]]; then if [[ "$extension" == "sql" ]]; then
$CLIENT_PROGRAM < $query_file > $result_file 2> $error_file $CLIENT_PROGRAM < $query_file > $result_file 2> $error_file
ret_code=$? ret_code=$?
@ -97,7 +114,7 @@ do
# надо сгенерировать эталонный результат # надо сгенерировать эталонный результат
if [[ $GENERATE -eq 1 && ( -z "$1" || "$@" =~ "$test_name") ]]; then if [[ $GENERATE -eq 1 && ( -z "$1" || "$@" =~ "$test_name") ]]; then
cp $result_file $reference_file cp $result_file $reference_file
echo -e "$MSG_GENERATED - no reference file" echo -e "$MSG_GENERATED - generated reference file"
else else
echo -e "$MSG_UNKNOWN - no reference file (use --generate [test_name]... to create)" echo -e "$MSG_UNKNOWN - no reference file (use --generate [test_name]... to create)"
fi fi