| 370 | } |
| 371 | |
| 372 | std::optional<bool> tryExtractConstantFromConditionNode(const QueryTreeNodePtr & condition_node) |
| 373 | { |
| 374 | const auto * constant_node = condition_node ? condition_node->as<ConstantNode>() : nullptr; |
| 375 | if (!constant_node) |
| 376 | return {}; |
| 377 | |
| 378 | const auto & value = constant_node->getValue(); |
| 379 | auto constant_type = constant_node->getResultType(); |
| 380 | constant_type = removeNullable(removeLowCardinality(constant_type)); |
| 381 | |
| 382 | auto which_constant_type = WhichDataType(constant_type); |
| 383 | if (!which_constant_type.isUInt8() && !which_constant_type.isNothing()) |
| 384 | return {}; |
| 385 | |
| 386 | if (value.isNull()) |
| 387 | return false; |
| 388 | |
| 389 | auto predicate_value = static_cast<UInt8>(value.safeGet<UInt8>()); |
| 390 | return predicate_value > 0; |
| 391 | } |
| 392 | |
| 393 | static ASTPtr convertIntoTableExpressionAST( |
| 394 | const QueryTreeNodePtr & table_expression_node, |
no test coverage detected