| 1977 | } |
| 1978 | |
| 1979 | Names TableScanStep::getRequiredColumns(GetFlags flags) const |
| 1980 | { |
| 1981 | LinkedHashSet<String> result; |
| 1982 | |
| 1983 | auto add_columns_in_expr = [&](const auto & expr) { |
| 1984 | auto columns = SymbolsExtractor::extract(expr); |
| 1985 | result.insert(columns.begin(), columns.end()); |
| 1986 | }; |
| 1987 | |
| 1988 | if (flags & GetFlags::Output) |
| 1989 | result.insert(column_names.begin(), column_names.end()); |
| 1990 | |
| 1991 | if (flags & GetFlags::Prewhere) |
| 1992 | if (auto prewhere = getPrewhere()) |
| 1993 | add_columns_in_expr(prewhere); |
| 1994 | |
| 1995 | if (flags & GetFlags::BitmapIndex) |
| 1996 | { |
| 1997 | for (const auto & item : inline_expressions) |
| 1998 | { |
| 1999 | const auto * func = item.second->as<ASTFunction>(); |
| 2000 | if (func && functionCanUseBitmapIndex(*func)) |
| 2001 | add_columns_in_expr(item.second); |
| 2002 | } |
| 2003 | } |
| 2004 | |
| 2005 | return {result.begin(), result.end()}; |
| 2006 | } |
| 2007 | |
| 2008 | bool TableScanStep::hasPrewhere() const |
| 2009 | { |
no test coverage detected