You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
auto constant_value_ast = std::make_shared<ASTLiteral>(getValue());
207
158
208
159
// Add cast if constant was created as a result of constant folding.
209
160
// Constant folding may lead to type transformation and literal on shard
210
161
// may have a different type.
211
-
if (source_expression != nullptr || requiresCastCall(constant_value_ast->value.getType(), applyVisitor(FieldToDataType(), constant_value_ast->value), getResultType()))
162
+
163
+
auto requires_cast = [this]() {
164
+
constauto & [_, type] = getValueNameAndType();
165
+
returnrequiresCastCall(type, getResultType());
166
+
};
167
+
168
+
if (source_expression != nullptr || requires_cast())
212
169
{
213
170
/// For some types we cannot just get a field from a column, because it can loose type information during serialization/deserialization of the literal.
214
171
/// For example, DateTime64 will return Field with Decimal64 and we won't be able to parse it to DateTine64 back in some cases.
215
172
/// Also for Dynamic and Object types we can loose types information, so we need to create a Field carefully.
0 commit comments