| 775 | } |
| 776 | |
| 777 | TableScanStep::TableScanStep( |
| 778 | ContextPtr context, |
| 779 | StorageID storage_id_, |
| 780 | const NamesWithAliases & column_alias_, |
| 781 | const SelectQueryInfo & query_info_, |
| 782 | size_t max_block_size_, |
| 783 | String alias_, |
| 784 | PlanHints hints_, |
| 785 | Assignments inline_expressions_, |
| 786 | std::shared_ptr<AggregatingStep> aggregation_, |
| 787 | std::shared_ptr<ProjectionStep> projection_, |
| 788 | std::shared_ptr<FilterStep> filter_, |
| 789 | std::optional<DataStream> output_stream_) |
| 790 | : ISourceStep(DataStream{}, hints_) |
| 791 | , storage_id(storage_id_) |
| 792 | , column_alias(column_alias_) |
| 793 | , query_info(query_info_) |
| 794 | , max_block_size(max_block_size_) |
| 795 | , inline_expressions(std::move(inline_expressions_)) |
| 796 | , pushdown_aggregation(std::move(aggregation_)) |
| 797 | , pushdown_projection(std::move(projection_)) |
| 798 | , pushdown_filter(std::move(filter_)) |
| 799 | , log(&Poco::Logger::get("TableScanStep")) |
| 800 | , alias(alias_) |
| 801 | { |
| 802 | bool need_create_output_stream = true; |
| 803 | const auto & table_expression = getTableExpression(*query_info.getSelectQuery(), 0); |
| 804 | if (table_expression && table_expression->table_function) |
| 805 | storage = context->getQueryContext()->executeTableFunction(table_expression->table_function); |
| 806 | else |
| 807 | { |
| 808 | if (storage_id.empty() && context->getSettingsRef().enable_prune_empty_resource) |
| 809 | { |
| 810 | LOG_DEBUG(log, "Create tableScanStep without storage"); |
| 811 | need_create_output_stream = false; |
| 812 | output_stream = output_stream_; |
| 813 | is_null_source = true; |
| 814 | } |
| 815 | else |
| 816 | { |
| 817 | storage = DatabaseCatalog::instance().getTable(storage_id, context); |
| 818 | storage_id.uuid = storage->getStorageUUID(); |
| 819 | } |
| 820 | } |
| 821 | if (need_create_output_stream) |
| 822 | formatOutputStream(context); |
| 823 | } |
| 824 | |
| 825 | void TableScanStep::formatOutputStream(ContextPtr context) |
| 826 | { |
nothing calls this directly
no test coverage detected