mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
fix optimize_redundant_functions_in_order_by
This commit is contained in:
parent
85283b3944
commit
601d633690
@ -5,6 +5,7 @@
|
||||
#include <Parsers/ASTIdentifier.h>
|
||||
#include <Parsers/ASTOrderByElement.h>
|
||||
#include <Parsers/ASTSelectQuery.h>
|
||||
#include <Parsers/ASTExpressionList.h>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
@ -75,7 +76,8 @@ public:
|
||||
|
||||
static bool needChildVisit(const ASTPtr & node, const ASTPtr &)
|
||||
{
|
||||
return node->as<ASTFunction>();
|
||||
/// Visit functions and their arguments, that are stored in ASTExpressionList.
|
||||
return node->as<ASTFunction>() || node->as<ASTExpressionList>();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
SELECT
|
||||
msg,
|
||||
toDateTime(intDiv(ms, 1000)) AS time
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
\'hello\' AS msg,
|
||||
toUInt64(t) * 1000 AS ms
|
||||
FROM generateRandom(\'t DateTime\')
|
||||
LIMIT 10
|
||||
)
|
||||
ORDER BY
|
||||
msg ASC,
|
||||
time ASC
|
11
tests/queries/0_stateless/01593_functions_in_order_by.sql
Normal file
11
tests/queries/0_stateless/01593_functions_in_order_by.sql
Normal file
@ -0,0 +1,11 @@
|
||||
EXPLAIN SYNTAX
|
||||
SELECT msg, toDateTime(intDiv(ms, 1000)) AS time
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
'hello' AS msg,
|
||||
toUInt64(t) * 1000 AS ms
|
||||
FROM generateRandom('t DateTime')
|
||||
LIMIT 10
|
||||
)
|
||||
ORDER BY msg, time;
|
Loading…
Reference in New Issue
Block a user