fix null pointer of TreeRewriterResult::storage_snapshot (#35439)

This commit is contained in:
李扬 2022-03-20 15:07:58 -05:00 committed by GitHub
parent 9fb50422ce
commit d28981e0e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -751,7 +751,7 @@ void TreeOptimizer::apply(ASTPtr & query, TreeRewriterResult & result,
if (settings.convert_query_to_cnf)
converted_to_cnf = convertQueryToCNF(select_query);
if (converted_to_cnf && settings.optimize_using_constraints)
if (converted_to_cnf && settings.optimize_using_constraints && result.storage_snapshot)
{
optimizeWithConstraints(select_query, result.aliases, result.source_columns_set,
tables_with_columns, result.storage_snapshot->metadata, settings.optimize_append_index);