提交 e9ea838c 编写于 作者: A Alexey Milovidov

Merge branch 'master' of github.com:yandex/ClickHouse

......@@ -240,6 +240,8 @@ void ColumnNullable::getPermutation(bool reverse, size_t limit, int null_directi
if (!limit)
limit = end_idx;
else
limit = std::min(end_idx, limit);
while (read_idx < limit && !isNullAt(res[read_idx]))
{
......@@ -271,7 +273,7 @@ void ColumnNullable::getPermutation(bool reverse, size_t limit, int null_directi
}
else
{
/// Shift all NULL values to the begin.
/// Shift all NULL values to the beginning.
ssize_t read_idx = res.size() - 1;
ssize_t write_idx = res.size() - 1;
......
......@@ -83,6 +83,11 @@ Block MergeSortingBlockInputStream::readImpl()
removeConstantsFromSortDescription(sample_block, description);
}
/// If there were only const columns in sort description, then there is no need to sort.
/// Return the blocks as is.
if (description.empty())
return block;
removeConstantsFromBlock(block);
blocks.push_back(block);
......
......@@ -20,3 +20,5 @@ SET max_block_size = 5;
SELECT nullIf(number, number % 3 = 0 ? number : 0) AS x, number AS y FROM (SELECT * FROM system.numbers LIMIT 10) ORDER BY x, y;
SELECT nullIf(number, number % 3 = 0 ? number : 0) AS x, number AS y FROM (SELECT * FROM system.numbers LIMIT 10) ORDER BY x DESC, y;
SELECT x FROM (SELECT toNullable(number) AS x FROM system.numbers LIMIT 3) ORDER BY x DESC LIMIT 10
......@@ -51,7 +51,14 @@ check "$url$session&session_timeout=3600" "$select" "Exception" 0 "3600 second t
check "$url$session&session_timeout=60" "$select" "Exception" 0 "60 second timeout not accepted."
check $url$session "$select" "7777777" 1 "Failed to reuse session."
check "$url$session&user=readonly&session_check=1" "$select" "Exception.*Session not found" 1 "Session is accessable for another user."
# Workaround here
# TODO: move the test to integration test or add readonly user to test environment
if [[ -z `request "$url?user=readonly" "SELECT ''"` ]]; then
# We have readonly user
check "$url$session&user=readonly&session_check=1" "$select" "Exception.*Session not found" 1 "Session is accessable for another user."
else
check "$url$session&user=readonly&session_check=1" "$select" "Exception.*Unknown user*" 1 "Session is accessable for unknown user."
fi
create_temporary_table $url$session
check $url$session "$select_from_temporary_table" "Hello" 1 "Failed to reuse a temporary table for session."
......
SELECT * FROM (SELECT 1 AS x, 2 AS y) ORDER BY x;
SELECT * FROM (SELECT x FROM (SELECT 2 AS x, arrayJoin([1,2,3]))) ORDER BY x;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册