2016-11-20 12:43:20 +00:00
|
|
|
#include <DB/Common/Collator.h>
|
|
|
|
#include <DB/Parsers/ASTOrderByElement.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
void ASTOrderByElement::formatImpl(const FormatSettings & settings, FormatState & state, FormatStateStacked frame) const
|
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
children.front()->formatImpl(settings, state, frame);
|
|
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "")
|
|
|
|
<< (direction == -1 ? " DESC" : " ASC")
|
|
|
|
<< (settings.hilite ? hilite_none : "");
|
2016-11-20 12:43:20 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
if (nulls_direction_was_explicitly_specified)
|
|
|
|
{
|
|
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "")
|
|
|
|
<< " NULLS "
|
|
|
|
<< (nulls_direction == direction ? "LAST" : "FIRST")
|
|
|
|
<< (settings.hilite ? hilite_none : "");
|
|
|
|
}
|
2017-03-12 12:56:59 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
if (collation)
|
|
|
|
{
|
|
|
|
settings.ostr << (settings.hilite ? hilite_keyword : "") << " COLLATE " << (settings.hilite ? hilite_none : "");
|
|
|
|
collation->formatImpl(settings, state, frame);
|
|
|
|
}
|
2016-11-20 12:43:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|