mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
parent
1dc565cd22
commit
4223b82fb4
@ -601,7 +601,9 @@ ASTPtr ASTFunction::clone() const
|
||||
|
||||
void ASTFunction::updateTreeHashImpl(SipHash & hash_state) const
|
||||
{
|
||||
ASTWithAlias::updateTreeHashImpl(hash_state);
|
||||
hash_state.update(name.size());
|
||||
hash_state.update(name);
|
||||
IAST::updateTreeHashImpl(hash_state);
|
||||
}
|
||||
|
||||
template <typename Container>
|
||||
|
@ -87,11 +87,6 @@ void ASTIdentifier::setShortName(const String & new_name)
|
||||
semantic->table = table;
|
||||
}
|
||||
|
||||
void ASTIdentifier::updateTreeHashImpl(SipHash & hash_state) const
|
||||
{
|
||||
ASTWithAlias::updateTreeHashImpl(hash_state);
|
||||
}
|
||||
|
||||
const String & ASTIdentifier::name() const
|
||||
{
|
||||
if (children.empty())
|
||||
@ -252,7 +247,7 @@ void ASTTableIdentifier::resetTable(const String & database_name, const String &
|
||||
void ASTTableIdentifier::updateTreeHashImpl(SipHash & hash_state) const
|
||||
{
|
||||
hash_state.update(uuid);
|
||||
ASTIdentifier::updateTreeHashImpl(hash_state);
|
||||
IAST::updateTreeHashImpl(hash_state);
|
||||
}
|
||||
|
||||
String getIdentifierName(const IAST * ast)
|
||||
|
@ -47,8 +47,6 @@ public:
|
||||
const String & shortName() const { return name_parts.back(); }
|
||||
const String & name() const;
|
||||
|
||||
void updateTreeHashImpl(SipHash & hash_state) const override;
|
||||
|
||||
void restoreTable(); // TODO(ilezhankin): get rid of this
|
||||
std::shared_ptr<ASTTableIdentifier> createTable() const; // returns |nullptr| if identifier is not table.
|
||||
|
||||
|
@ -10,6 +10,13 @@
|
||||
namespace DB
|
||||
{
|
||||
|
||||
void ASTLiteral::updateTreeHashImpl(SipHash & hash_state) const
|
||||
{
|
||||
const char * prefix = "Literal_";
|
||||
hash_state.update(prefix, strlen(prefix));
|
||||
applyVisitor(FieldVisitorHash(hash_state), value);
|
||||
}
|
||||
|
||||
ASTPtr ASTLiteral::clone() const
|
||||
{
|
||||
auto res = std::make_shared<ASTLiteral>(*this);
|
||||
@ -17,11 +24,6 @@ ASTPtr ASTLiteral::clone() const
|
||||
return res;
|
||||
}
|
||||
|
||||
void ASTLiteral::updateTreeHashImpl(SipHash & hash_state) const
|
||||
{
|
||||
ASTWithAlias::updateTreeHashImpl(hash_state);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
@ -23,9 +23,4 @@ void ASTQueryParameter::appendColumnNameImpl(WriteBuffer & ostr) const
|
||||
writeString(name, ostr);
|
||||
}
|
||||
|
||||
void ASTQueryParameter::updateTreeHashImpl(SipHash & hash_state) const
|
||||
{
|
||||
ASTWithAlias::updateTreeHashImpl(hash_state);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,8 +21,6 @@ public:
|
||||
|
||||
ASTPtr clone() const override { return std::make_shared<ASTQueryParameter>(*this); }
|
||||
|
||||
void updateTreeHashImpl(SipHash & hash_state) const override;
|
||||
|
||||
protected:
|
||||
void formatImplWithoutAlias(const FormatSettings & settings, FormatState &, FormatStateStacked) const override;
|
||||
void appendColumnNameImpl(WriteBuffer & ostr) const override;
|
||||
|
@ -55,7 +55,7 @@ void ASTSubquery::updateTreeHashImpl(SipHash & hash_state) const
|
||||
{
|
||||
if (!cte_name.empty())
|
||||
hash_state.update(cte_name);
|
||||
ASTWithAlias::updateTreeHashImpl(hash_state);
|
||||
IAST::updateTreeHashImpl(hash_state);
|
||||
}
|
||||
|
||||
String ASTSubquery::getAliasOrColumnName() const
|
||||
|
@ -14,7 +14,7 @@ class ASTSubquery : public ASTWithAlias
|
||||
public:
|
||||
// Stored the name when the subquery is defined in WITH clause. For example:
|
||||
// WITH (SELECT 1) AS a SELECT * FROM a AS b; cte_name will be `a`.
|
||||
String cte_name;
|
||||
std::string cte_name;
|
||||
|
||||
/** Get the text that identifies this element. */
|
||||
String getID(char) const override { return "Subquery"; }
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <Parsers/ASTWithAlias.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
#include <IO/Operators.h>
|
||||
#include <Common/SipHash.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -43,12 +42,6 @@ void ASTWithAlias::formatImpl(const FormatSettings & settings, FormatState & sta
|
||||
}
|
||||
}
|
||||
|
||||
void ASTWithAlias::updateTreeHashImpl(SipHash & hash_state) const
|
||||
{
|
||||
hash_state.update(alias);
|
||||
IAST::updateTreeHashImpl(hash_state);
|
||||
}
|
||||
|
||||
void ASTWithAlias::appendColumnName(WriteBuffer & ostr) const
|
||||
{
|
||||
if (prefer_alias_to_column_name && !alias.empty())
|
||||
|
@ -27,12 +27,10 @@ public:
|
||||
void setAlias(const String & to) override { alias = to; }
|
||||
|
||||
/// Calls formatImplWithoutAlias, and also outputs an alias. If necessary, encloses the entire expression in brackets.
|
||||
void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const final;
|
||||
void formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const override final;
|
||||
|
||||
virtual void formatImplWithoutAlias(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const = 0;
|
||||
|
||||
void updateTreeHashImpl(SipHash & hash_state) const override;
|
||||
|
||||
protected:
|
||||
virtual void appendColumnNameImpl(WriteBuffer & ostr) const = 0;
|
||||
};
|
||||
|
@ -1,24 +0,0 @@
|
||||
-- Bug 56258: Check literals (ASTLiteral)
|
||||
Row 1:
|
||||
──────
|
||||
10: 10
|
||||
Row 1:
|
||||
──────
|
||||
x: 10
|
||||
2
|
||||
-- Bug 56258: Check functions (ASTFunction)
|
||||
Row 1:
|
||||
──────
|
||||
toUInt64(42): 42
|
||||
Row 1:
|
||||
──────
|
||||
x: 42
|
||||
2
|
||||
-- Bug 56258: Check identifiers (ASTIdentifier)
|
||||
Row 1:
|
||||
──────
|
||||
c: 1
|
||||
Row 1:
|
||||
──────
|
||||
x: 1
|
||||
2
|
@ -1,39 +0,0 @@
|
||||
-- Tags: no-parallel
|
||||
-- Tag no-parallel: Messes with internal cache
|
||||
|
||||
-- Test for Bug 56258
|
||||
|
||||
SYSTEM DROP QUERY CACHE;
|
||||
|
||||
SELECT '-- Bug 56258: Check literals (ASTLiteral)';
|
||||
|
||||
SELECT 10 FORMAT Vertical SETTINGS use_query_cache = 1;
|
||||
SELECT 10 AS x FORMAT Vertical SETTINGS use_query_cache = 1;
|
||||
|
||||
SELECT count(*) FROM system.query_cache;
|
||||
|
||||
SYSTEM DROP QUERY CACHE;
|
||||
|
||||
SELECT '-- Bug 56258: Check functions (ASTFunction)';
|
||||
|
||||
SELECT toUInt64(42) FORMAT Vertical SETTINGS use_query_cache = 1;
|
||||
SELECT toUInt64(42) AS x FORMAT Vertical SETTINGS use_query_cache = 1;
|
||||
|
||||
SELECT count(*) FROM system.query_cache;
|
||||
|
||||
SYSTEM DROP QUERY CACHE;
|
||||
|
||||
SELECT '-- Bug 56258: Check identifiers (ASTIdentifier)';
|
||||
|
||||
DROP TABLE IF EXISTS tab;
|
||||
|
||||
CREATE TABLE tab(c UInt64) ENGINE = Memory AS SELECT 1;
|
||||
|
||||
SELECT c FROM tab FORMAT Vertical SETTINGS use_query_cache = 1;
|
||||
SELECT c AS x FROM tab FORMAT Vertical SETTINGS use_query_cache = 1;
|
||||
|
||||
SELECT count(*) FROM system.query_cache;
|
||||
|
||||
DROP TABLE tab;
|
||||
|
||||
SYSTEM DROP QUERY CACHE;
|
Loading…
Reference in New Issue
Block a user