Skip to content

Commit

Permalink
Enforce type check for function arguments in preimage optimization
Browse files Browse the repository at this point in the history
Date/Date32/DateTime/DateTime64 columns are required for arguments
of time converters, such as toYear and toYYYYMM.
  • Loading branch information
ZhiguoZh committed Jul 24, 2023
1 parent b88fc42 commit 9ff409f
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -91,6 +91,9 @@ class OptimizeDateOrDateTimeConverterWithPreimageVisitor : public InDepthQueryTr
const auto * column_id = func_node->getArguments().getNodes()[0]->as<ColumnNode>();
if (!column_id) return;

const auto * column_type = column_id->getColumnType().get();
if (!isDateOrDate32(column_type) && !isDateTime(column_type) && !isDateTime64(column_type)) return;

const auto & converter = FunctionFactory::instance().tryGet(func_node->getFunctionName(), getContext());
if (!converter) return;

Expand Down

0 comments on commit 9ff409f

Please sign in to comment.