MCPcopy Create free account
hub / github.com/apache/arrow / GetBooleanCasts

Function GetBooleanCasts

cpp/src/arrow/compute/kernels/scalar_cast_boolean.cc:51–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49};
50
51std::vector<std::shared_ptr<CastFunction>> GetBooleanCasts() {
52 auto func = std::make_shared<CastFunction>("cast_boolean", Type::BOOL);
53 AddCommonCasts(Type::BOOL, boolean(), func.get());
54 AddZeroCopyCast(Type::BOOL, boolean(), boolean(), func.get());
55
56 for (const auto& ty : NumericTypes()) {
57 ArrayKernelExec exec =
58 GenerateNumeric<applicator::ScalarUnary, BooleanType, IsNonZero>(*ty);
59 DCHECK_OK(func->AddKernel(ty->id(), {ty}, boolean(), exec));
60 }
61 for (const auto& ty : BaseBinaryTypes()) {
62 ArrayKernelExec exec = GenerateVarBinaryBase<applicator::ScalarUnaryNotNull,
63 BooleanType, ParseBooleanString>(*ty);
64 DCHECK_OK(func->AddKernel(ty->id(), {ty}, boolean(), exec));
65 }
66 for (const auto& ty : BinaryViewTypes()) {
67 ArrayKernelExec exec =
68 GenerateVarBinaryViewBase<applicator::ScalarUnaryNotNull, BooleanType,
69 ParseBooleanString>(*ty);
70 DCHECK_OK(func->AddKernel(ty->id(), {ty}, boolean(), exec));
71 }
72 return {func};
73}
74
75} // namespace internal
76} // namespace compute

Callers 1

InitCastTableFunction · 0.85

Calls 5

AddCommonCastsFunction · 0.85
AddZeroCopyCastFunction · 0.85
getMethod · 0.45
AddKernelMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected