2021-05-21 18:48:19 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Interpreters/InDepthNodeVisitor.h>
|
2021-05-21 23:22:22 +00:00
|
|
|
#include <Storages/StorageInMemoryMetadata.h>
|
2021-05-21 18:48:19 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2021-11-26 17:21:54 +00:00
|
|
|
class ASTFunction;
|
|
|
|
|
2021-05-21 18:48:19 +00:00
|
|
|
/// Rewrites functions to subcolumns, if possible, to reduce amount of read data.
|
|
|
|
/// E.g. 'length(arr)' -> 'arr.size0', 'col IS NULL' -> 'col.null'
|
|
|
|
class RewriteFunctionToSubcolumnData
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
using TypeToVisit = ASTFunction;
|
2021-05-24 12:57:03 +00:00
|
|
|
void visit(ASTFunction & function, ASTPtr & ast) const;
|
2021-05-21 18:48:19 +00:00
|
|
|
|
2021-05-21 23:22:22 +00:00
|
|
|
StorageMetadataPtr metadata_snapshot;
|
2021-05-21 18:48:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
using RewriteFunctionToSubcolumnMatcher = OneTypeMatcher<RewriteFunctionToSubcolumnData>;
|
|
|
|
using RewriteFunctionToSubcolumnVisitor = InDepthNodeVisitor<RewriteFunctionToSubcolumnMatcher, true>;
|
|
|
|
|
|
|
|
}
|