MCPcopy Create free account
hub / github.com/ByConity/ByConity / defaultImplementationForNulls

Method defaultImplementationForNulls

src/Functions/IFunction.cpp:204–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202
203
204ColumnPtr 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
236ColumnPtr IExecutableFunction::defaultImplementationForNothing(
237 const ColumnsWithTypeAndName & args, const DataTypePtr & result_type, size_t input_rows_count) const

Callers

nothing calls this directly

Calls 11

getNullPresenseFunction · 0.85
removeNullableFunction · 0.85
wrapInNullableFunction · 0.85
getNameFunction · 0.70
ExceptionClass · 0.50
emptyMethod · 0.45
isNullableMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected