2018-06-27 16:34:11 +00:00
|
|
|
#include <Parsers/ASTAsterisk.h>
|
|
|
|
#include <IO/WriteBuffer.h>
|
2020-11-09 16:05:40 +00:00
|
|
|
#include <IO/Operators.h>
|
2018-06-27 16:34:11 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
ASTPtr ASTAsterisk::clone() const
|
|
|
|
{
|
|
|
|
auto clone = std::make_shared<ASTAsterisk>(*this);
|
|
|
|
clone->cloneChildren();
|
Get rid of useless std::move to get NRVO
http://eel.is/c++draft/class.copy.elision#:constructor,copy,elision
Some quote:
> Speaking of RVO, return std::move(w); prohibits it. It means "use move constructor or fail to compile", whereas return w; means "use RVO, and if you can't, use move constructor, and if you can't, use copy constructor, and if you can't, fail to compile."
There is one exception to this rule:
```cpp
Block FilterBlockInputStream::removeFilterIfNeed(Block && block)
{
if (block && remove_filter)
block.erase(static_cast<size_t>(filter_column));
return std::move(block);
}
```
because references are not eligible for NRVO, which is another rule "always move rvalue references and forward universal references" that takes precedence.
2018-08-27 14:04:22 +00:00
|
|
|
return clone;
|
2018-06-27 16:34:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ASTAsterisk::appendColumnName(WriteBuffer & ostr) const { ostr.write('*'); }
|
|
|
|
|
2020-08-29 05:33:46 +00:00
|
|
|
void ASTAsterisk::formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
|
2018-06-27 16:34:11 +00:00
|
|
|
{
|
|
|
|
settings.ostr << "*";
|
2022-04-19 17:22:04 +00:00
|
|
|
|
|
|
|
/// Format column transformers
|
2020-08-29 05:33:46 +00:00
|
|
|
for (const auto & child : children)
|
|
|
|
{
|
|
|
|
settings.ostr << ' ';
|
|
|
|
child->formatImpl(settings, state, frame);
|
|
|
|
}
|
2018-06-27 16:34:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|