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
Describe the bug
We ran into a problem when running queries that do not explicitly mention some dimension(s). We found out that, while handling these dimensions, an Expr::Wildcard is created. This in itself is not a problem, but may become one when the type_coercion and unwrap_cast_in_comparison optimization rules call the display_name method on this expression, which is not allowed because the create_name method called inside display_name does not support Expr::Wildcard.
To go a bit more into detail, the optimize_internal methods from type_coercion and unwrap_cast_in_comparison call the rewrite_preserving_name function from datafusion/optimizer/src/utils.rs, which just rewrites an expression while keeping its name unchanged. It calls name_for_alias, which gets the name of an expression by calling display_name, which in turn gives rise to the warnings.
This only prevents the type_coercion and unwrap_cast_in_comparison optimization rules from being applied to the schema dimensions we are not considering, so should not be a problem, but gives rise to some annoying warnings during query execution.
To Reproduce
This behavior can be recovered by running queries where one or several cube dimensions are not explicitly mentioned, giving rise to Expr::Wildcards. When trying to apply the optimization rules type_coercion and unwrap_cast_in_comparison , the following output is obtained:
WARN datafusion_optimizer::optimizer: Skipping optimizer rule 'type_coercion' due to unexpected error: Internal error: Create name does not support wildcard.
WARN datafusion_optimizer::optimizer: Skipping optimizer rule 'unwrap_cast_in_comparison' due to unexpected error: Internal error: Create name does not support wildcard.
Expected behavior
We expect the query to run with no warnings at all, and let the optimization rules be applied to all the sub-plans (even if it is not required for query execution). To do that, we must find a way to allow to rewrite an expression of type Expr::Wildcard without calling display_name(), since this will give rise to the above mentioned error message originating from create_name(). A simple workaround could be, in the name_for_alias function, to consider separately the case in which the expression is of type Expr::Wildcard, and make sure it is given a reasonable name (e.g. "*") instead of calling display_name(). Another solution could be to introduce the change directly in create_name(), by modifying the action in case Expr::Wildcard is found.
The text was updated successfully, but these errors were encountered:
Describe the bug
We ran into a problem when running queries that do not explicitly mention some dimension(s). We found out that, while handling these dimensions, an
Expr::Wildcard
is created. This in itself is not a problem, but may become one when thetype_coercion
andunwrap_cast_in_comparison
optimization rules call thedisplay_name
method on this expression, which is not allowed because thecreate_name
method called insidedisplay_name
does not supportExpr::Wildcard
.To go a bit more into detail, the
optimize_internal
methods fromtype_coercion
andunwrap_cast_in_comparison
call therewrite_preserving_name
function fromdatafusion/optimizer/src/utils.rs
, which just rewrites an expression while keeping its name unchanged. It callsname_for_alias
, which gets the name of an expression by callingdisplay_name
, which in turn gives rise to the warnings.This only prevents the
type_coercion
andunwrap_cast_in_comparison
optimization rules from being applied to the schema dimensions we are not considering, so should not be a problem, but gives rise to some annoying warnings during query execution.To Reproduce
This behavior can be recovered by running queries where one or several cube dimensions are not explicitly mentioned, giving rise to
Expr::Wildcard
s. When trying to apply the optimization rulestype_coercion
andunwrap_cast_in_comparison
, the following output is obtained:Expected behavior
We expect the query to run with no warnings at all, and let the optimization rules be applied to all the sub-plans (even if it is not required for query execution). To do that, we must find a way to allow to rewrite an expression of type
Expr::Wildcard
without callingdisplay_name()
, since this will give rise to the above mentioned error message originating fromcreate_name()
. A simple workaround could be, in thename_for_alias
function, to consider separately the case in which the expression is of typeExpr::Wildcard
, and make sure it is given a reasonable name (e.g. "*") instead of callingdisplay_name()
. Another solution could be to introduce the change directly increate_name()
, by modifying the action in caseExpr::Wildcard
is found.The text was updated successfully, but these errors were encountered: