| 153 | } |
| 154 | |
| 155 | void QueryNormalizer::visit(ASTFunction & node, ASTPtr & ast, Data & data) |
| 156 | { |
| 157 | String & func_name = node.name; |
| 158 | |
| 159 | /// Special cases for count function. |
| 160 | String func_name_lowercase = Poco::toLower(func_name); |
| 161 | if (endsWith(func_name_lowercase, "vcfunnelopt")) |
| 162 | { |
| 163 | // TODO |
| 164 | // /// reuse funnel_old_rule setting for skipping repeat event in Finder case |
| 165 | // if (data.settings.funnel_old_rule) |
| 166 | // { |
| 167 | // func_name = func_name + "Skip"; |
| 168 | // } |
| 169 | } |
| 170 | #if 0 //TODO |
| 171 | else if (func_name_lowercase == "sumdistinct") |
| 172 | { |
| 173 | /// replace sumDistinc with internal implementation uniqSum; |
| 174 | func_name = "uniqSum"; |
| 175 | } |
| 176 | else if (func_name_lowercase == "partitionstatus") |
| 177 | { |
| 178 | String old_col_name_or_alias = node.getAliasOrColumnName(); |
| 179 | |
| 180 | ASTs & args = node.arguments->children; |
| 181 | if (args.size() != 3) |
| 182 | throw Exception("Function partitionStatus only accept three arguments.", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); |
| 183 | |
| 184 | size_t arg_num = 0; |
| 185 | args[arg_num] = evaluateConstantExpressionOrIdentifierAsLiteral(args[arg_num], data.context); |
| 186 | String database_name = args[arg_num]->as<ASTLiteral &>().value.safeGet<String>(); |
| 187 | |
| 188 | ++arg_num; |
| 189 | args[arg_num] = evaluateConstantExpressionOrIdentifierAsLiteral(args[arg_num], data.context); |
| 190 | String table_name = args[arg_num]->as<ASTLiteral &>().value.safeGet<String>(); |
| 191 | |
| 192 | ++arg_num; |
| 193 | |
| 194 | auto partition = std::make_shared<ASTPartition>(); |
| 195 | size_t fields_count; |
| 196 | String fields_str; |
| 197 | |
| 198 | String partition_name = args[arg_num]->getColumnName(); |
| 199 | |
| 200 | const auto * tuple_ast = args[arg_num]->as<ASTFunction>(); |
| 201 | if (tuple_ast && tuple_ast->name == "tuple") |
| 202 | { |
| 203 | const auto * arguments_ast = tuple_ast->arguments->as<ASTExpressionList>(); |
| 204 | if (arguments_ast) |
| 205 | fields_count = arguments_ast->children.size(); |
| 206 | else |
| 207 | fields_count = 0; |
| 208 | |
| 209 | auto left_paren = partition_name.data(); |
| 210 | auto right_paren = partition_name.data() + partition_name.size(); |
| 211 | |
| 212 | while (left_paren != right_paren && *left_paren != '(') |
nothing calls this directly
no test coverage detected