mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Added check for empty number of columns; improved test
This commit is contained in:
parent
8060993ca2
commit
b2961bcc31
@ -41,6 +41,7 @@ namespace ErrorCodes
|
||||
extern const int EMPTY_NESTED_TABLE;
|
||||
extern const int LOGICAL_ERROR;
|
||||
extern const int INVALID_JOIN_ON_EXPRESSION;
|
||||
extern const int EMPTY_LIST_OF_COLUMNS_QUERIED;
|
||||
}
|
||||
|
||||
NameSet removeDuplicateColumns(NamesAndTypesList & columns)
|
||||
@ -110,6 +111,10 @@ void translateQualifiedNames(ASTPtr & query, const ASTSelectQuery & select_query
|
||||
TranslateQualifiedNamesVisitor::Data visitor_data(source_columns_set, tables_with_columns);
|
||||
TranslateQualifiedNamesVisitor visitor(visitor_data, log.stream());
|
||||
visitor.visit(query);
|
||||
|
||||
/// This may happen after expansion of COLUMNS('regexp').
|
||||
if (select_query.select()->children.empty())
|
||||
throw Exception("Empty list of columns in SELECT query", ErrorCodes::EMPTY_LIST_OF_COLUMNS_QUERIED);
|
||||
}
|
||||
|
||||
bool hasArrayJoin(const ASTPtr & ast)
|
||||
|
@ -1,2 +1,24 @@
|
||||
100 10
|
||||
120 8
|
||||
0 0
|
||||
1 1
|
||||
0 0
|
||||
1 1
|
||||
0
|
||||
1
|
||||
0
|
||||
1
|
||||
0
|
||||
1
|
||||
0
|
||||
1
|
||||
0
|
||||
1
|
||||
0
|
||||
1
|
||||
0
|
||||
2
|
||||
3
|
||||
2
|
||||
4
|
||||
3
|
||||
|
@ -5,3 +5,23 @@ INSERT INTO ColumnsClauseTest VALUES (100, 10, 324), (120, 8, 23);
|
||||
SELECT COLUMNS('product.*') from ColumnsClauseTest ORDER BY product_price;
|
||||
|
||||
DROP TABLE ColumnsClauseTest;
|
||||
|
||||
SELECT number, COLUMNS('') FROM numbers(2);
|
||||
SELECT number, COLUMNS('ber') FROM numbers(2); -- It works for unanchored regular expressions.
|
||||
SELECT number, COLUMNS('x') FROM numbers(2);
|
||||
SELECT COLUMNS('') FROM numbers(2);
|
||||
|
||||
SELECT COLUMNS('x') FROM numbers(10) WHERE number > 5; -- { serverError 51 }
|
||||
|
||||
SELECT * FROM numbers(2) WHERE NOT ignore();
|
||||
SELECT * FROM numbers(2) WHERE NOT ignore(*);
|
||||
SELECT * FROM numbers(2) WHERE NOT ignore(COLUMNS('.+'));
|
||||
SELECT * FROM numbers(2) WHERE NOT ignore(COLUMNS('x'));
|
||||
SELECT COLUMNS('n') + COLUMNS('u') FROM system.numbers LIMIT 2;
|
||||
|
||||
SELECT COLUMNS('n') + COLUMNS('u') FROM (SELECT 1 AS a, 2 AS b); -- { serverError 42 }
|
||||
SELECT COLUMNS('a') + COLUMNS('b') FROM (SELECT 1 AS a, 2 AS b);
|
||||
SELECT COLUMNS('a') + COLUMNS('a') FROM (SELECT 1 AS a, 2 AS b);
|
||||
SELECT COLUMNS('b') + COLUMNS('b') FROM (SELECT 1 AS a, 2 AS b);
|
||||
SELECT COLUMNS('a|b') + COLUMNS('b') FROM (SELECT 1 AS a, 2 AS b); -- { serverError 42 }
|
||||
SELECT plus(COLUMNS('^(a|b)$')) FROM (SELECT 1 AS a, 2 AS b);
|
||||
|
Loading…
Reference in New Issue
Block a user