MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / validateFilter

Function validateFilter

src/Analyzer/ValidationUtils.cpp:38–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36{
37
38void validateFilter(const QueryTreeNodePtr & filter_node, std::string_view exception_place_message, const QueryTreeNodePtr & query_node)
39{
40 DataTypePtr filter_node_result_type;
41 try
42 {
43 filter_node_result_type = filter_node->getResultType();
44 }
45 catch (const DB::Exception &e)
46 {
47 if (e.code() != ErrorCodes::UNSUPPORTED_METHOD)
48 e.rethrow();
49 }
50
51 if (!filter_node_result_type)
52 throw Exception(ErrorCodes::UNEXPECTED_EXPRESSION,
53 "Unexpected expression '{}' in filter in {}. In query {}",
54 filter_node->formatASTForErrorMessage(),
55 exception_place_message,
56 query_node->formatASTForErrorMessage());
57
58 if (!filter_node_result_type->canBeUsedInBooleanContext())
59 throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER,
60 "Invalid type for filter in {}: {}. In query {}",
61 exception_place_message,
62 filter_node_result_type->getName(),
63 query_node->formatASTForErrorMessage());
64}
65
66}
67

Callers 1

validateFiltersFunction · 0.85

Calls 7

ExceptionClass · 0.50
getResultTypeMethod · 0.45
codeMethod · 0.45
rethrowMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected