Fix more tests.

This commit is contained in:
Nikolai Kochetov 2023-05-30 18:51:18 +00:00
parent 8cec00dd6e
commit c740328426
3 changed files with 20 additions and 6 deletions

View File

@ -1420,11 +1420,14 @@ FutureSetPtr ActionsMatcher::makeSet(const ASTFunction & node, Data & data, bool
return data.prepared_sets->addFromStorage(set_key, storage_set->getSet());
}
// std::cerr << ".... checking for " << identifier->getColumnName() << std::endl;
if (auto tmp_table = data.getContext()->findExternalTable(identifier->getColumnName()))
if (!data.getContext()->isGlobalContext())
{
external_table_set = tmp_table->future_set;
// std::cerr << "Found " << reinterpret_cast<const void *>(tmp_table.get()) << " " << reinterpret_cast<const void *>(external_table_set.get()) << std::endl;
// std::cerr << ".... checking for " << identifier->getColumnName() << std::endl;
if (auto tmp_table = data.getContext()->findExternalTable(identifier->getColumnName()))
{
external_table_set = tmp_table->future_set;
// std::cerr << "Found " << reinterpret_cast<const void *>(tmp_table.get()) << " " << reinterpret_cast<const void *>(external_table_set.get()) << std::endl;
}
}
}

View File

@ -90,6 +90,8 @@ public:
in_second_argument_node_type == QueryTreeNodeType::UNION)
{
auto set_key = PreparedSetKey::forSubquery(in_second_argument->getTreeHash());
if (sets.getFuture(set_key))
return;
auto subquery_options = select_query_options.subquery();
Planner subquery_planner(

View File

@ -1236,6 +1236,15 @@ static void buildIndexes(
if (!indexes->use_skip_indexes)
return;
const SelectQueryInfo * info = &query_info;
std::optional<SelectQueryInfo> info_copy;
if (settings.allow_experimental_analyzer)
{
info_copy.emplace(query_info);
info_copy->filter_actions_dag = filter_actions_dag;
info = &*info_copy;
}
UsefulSkipIndexes skip_indexes;
using Key = std::pair<String, size_t>;
std::map<Key, size_t> merged;
@ -1249,14 +1258,14 @@ static void buildIndexes(
if (inserted)
{
skip_indexes.merged_indices.emplace_back();
skip_indexes.merged_indices.back().condition = index_helper->createIndexMergedCondition(query_info, metadata_snapshot);
skip_indexes.merged_indices.back().condition = index_helper->createIndexMergedCondition(*info, metadata_snapshot);
}
skip_indexes.merged_indices[it->second].addIndex(index_helper);
}
else
{
auto condition = index_helper->createIndexCondition(query_info, context);
auto condition = index_helper->createIndexCondition(*info, context);
if (!condition->alwaysUnknownOrTrue())
skip_indexes.useful_indices.emplace_back(index_helper, condition);
}