bool StorageBuffer::mayBenefitFromIndexForIn(const ASTPtr & left_in_operand) const { if (no_destination) return false; auto destination = context.getTable(destination_database, destination_table); if (destination.get() == this) throw Exception("Destination table is myself. Read will cause infinite loop.", ErrorCodes::INFINITE_LOOP); return destination->mayBenefitFromIndexForIn(left_in_operand); }
bool MergeTreeMinMaxIndex::mayBenefitFromIndexForIn(const ASTPtr & node) const { const String column_name = node->getColumnName(); for (const auto & name : columns) if (column_name == name) return true; if (const auto * func = typeid_cast<const ASTFunction *>(node.get())) if (func->arguments->children.size() == 1) return mayBenefitFromIndexForIn(func->arguments->children.front()); return false; }