Merge branch 'master' into storage-dictionary

This commit is contained in:
Nikolai Kochetov 2017-06-09 11:38:23 +03:00
commit b872751c5e
7 changed files with 28 additions and 2 deletions

View File

@ -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;

View File

@ -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);

View File

@ -114,3 +114,6 @@
\N 3
\N 6
\N 9
2
1
0

View File

@ -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

View File

@ -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."

View File

@ -0,0 +1,4 @@
1 2
2
2
2

View File

@ -0,0 +1,3 @@
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;