| 202 | |
| 203 | |
| 204 | ColumnPtr IExecutableFunction::defaultImplementationForNulls( |
| 205 | const ColumnsWithTypeAndName & args, const DataTypePtr & result_type, size_t input_rows_count, bool dry_run) const |
| 206 | { |
| 207 | if (args.empty() || !useDefaultImplementationForNulls()) |
| 208 | return nullptr; |
| 209 | |
| 210 | NullPresence null_presence = getNullPresense(args); |
| 211 | |
| 212 | if (null_presence.has_null_constant) |
| 213 | { |
| 214 | // Default implementation for nulls returns null result for null arguments, |
| 215 | // so the result type must be nullable. |
| 216 | if (!result_type->isNullable()) |
| 217 | throw Exception(ErrorCodes::LOGICAL_ERROR, |
| 218 | "Function {} with Null argument and default implementation for Nulls " |
| 219 | "is expected to return Nullable result, got {}", getName(), result_type->getName()); |
| 220 | |
| 221 | return result_type->createColumnConstWithDefaultValue(input_rows_count); |
| 222 | } |
| 223 | |
| 224 | if (null_presence.has_nullable) |
| 225 | { |
| 226 | ColumnsWithTypeAndName temporary_columns = createBlockWithNestedColumns(args); |
| 227 | auto temporary_result_type = removeNullable(result_type); |
| 228 | |
| 229 | auto res = executeWithoutLowCardinalityColumns(temporary_columns, temporary_result_type, input_rows_count, dry_run); |
| 230 | return wrapInNullable(res, args, result_type, input_rows_count); |
| 231 | } |
| 232 | |
| 233 | return nullptr; |
| 234 | } |
| 235 | |
| 236 | ColumnPtr IExecutableFunction::defaultImplementationForNothing( |
| 237 | const ColumnsWithTypeAndName & args, const DataTypePtr & result_type, size_t input_rows_count) const |
nothing calls this directly
no test coverage detected