Skip to content

Commit 881841f

Browse files
string representation for ASTLiteral of DateTime and DateTime64
1 parent 194e56b commit 881841f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Analyzer/ConstantNode.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,11 @@ ASTPtr ConstantNode::toASTImpl(const ConvertToASTOptions & options) const
203203
auto constant_value_ast = std::make_shared<ASTLiteral>(getValue());
204204

205205
if (!options.add_cast_for_constants)
206+
{
207+
if (WhichDataType(constant_value_type->getTypeId()).isDateTimeOrDateTime64())
208+
return std::make_shared<ASTLiteral>(getFieldFromColumnForASTLiteral(constant_value.getColumn(), 0, constant_value.getType()));
206209
return constant_value_ast;
210+
}
207211

208212
// Add cast if constant was created as a result of constant folding.
209213
// Constant folding may lead to type transformation and literal on shard

0 commit comments

Comments
 (0)