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

Method executeImpl

src/Functions/nullIf.cpp:47–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45 }
46
47 ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr & result_type, size_t input_rows_count) const override
48 {
49 /// nullIf(col1, col2) == if(col1 = col2, NULL, col1)
50
51 auto equals_func = FunctionFactory::instance().get("equals", context)->build(arguments);
52 auto eq_res = equals_func->execute(arguments, equals_func->getResultType(), input_rows_count);
53
54 ColumnsWithTypeAndName if_columns
55 {
56 {eq_res, equals_func->getResultType(), ""},
57 {result_type->createColumnConstWithDefaultValue(input_rows_count), result_type, "NULL"},
58 arguments[0],
59 };
60
61 auto func_if = FunctionFactory::instance().get("if", context)->build(if_columns);
62 auto if_res = func_if->execute(if_columns, result_type, input_rows_count);
63
64 return makeNullable(std::move(if_res));
65 }
66};
67
68}

Callers

nothing calls this directly

Calls 6

getResultTypeMethod · 0.80
makeNullableFunction · 0.50
buildMethod · 0.45
getMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected