| 588 | } |
| 589 | |
| 590 | PreparedJoinStorage tryGetStorageInTableJoin(const QueryTreeNodePtr & table_expression, const PlannerContextPtr & planner_context) |
| 591 | { |
| 592 | StoragePtr storage; |
| 593 | |
| 594 | if (auto * table_node = table_expression->as<TableNode>()) |
| 595 | storage = table_node->getStorage(); |
| 596 | else if (auto * table_function = table_expression->as<TableFunctionNode>()) |
| 597 | storage = table_function->getStorage(); |
| 598 | else |
| 599 | return {}; |
| 600 | |
| 601 | PreparedJoinStorage result; |
| 602 | const auto & table_expression_data = planner_context->getTableExpressionDataOrThrow(table_expression); |
| 603 | result.column_mapping = table_expression_data.getColumnIdentifierToColumnName(); |
| 604 | |
| 605 | result.storage_join = std::dynamic_pointer_cast<StorageJoin>(storage); |
| 606 | if (result.storage_join) |
| 607 | return result; |
| 608 | |
| 609 | auto storage_dictionary = std::dynamic_pointer_cast<StorageDictionary>(storage); |
| 610 | if (storage_dictionary && storage_dictionary->getDictionary()->getSpecialKeyType() != DictionarySpecialKeyType::Range) |
| 611 | { |
| 612 | result.storage_key_value = std::dynamic_pointer_cast<const IKeyValueEntity>(storage_dictionary->getDictionary()); |
| 613 | return result; |
| 614 | } |
| 615 | |
| 616 | result.storage_key_value = std::dynamic_pointer_cast<IKeyValueEntity>(storage); |
| 617 | if (result.storage_key_value) |
| 618 | return result; |
| 619 | |
| 620 | return {}; |
| 621 | } |
| 622 | |
| 623 | } |
no test coverage detected