| 274 | } |
| 275 | |
| 276 | std::shared_ptr<ScalarFunction> MakeIsNanFunction(std::string name, FunctionDoc doc) { |
| 277 | auto func = std::make_shared<ScalarFunction>(name, Arity::Unary(), std::move(doc)); |
| 278 | |
| 279 | AddFloatValidityKernel<FloatType, IsNanOperator>(float32(), func.get()); |
| 280 | AddFloatValidityKernel<DoubleType, IsNanOperator>(float64(), func.get()); |
| 281 | AddFloatValidityKernel<HalfFloatType, IsNanOperator>(float16(), func.get()); |
| 282 | |
| 283 | for (const auto& ty : IntTypes()) { |
| 284 | DCHECK_OK(func->AddKernel({InputType(ty->id())}, boolean(), ConstBoolExec<false>)); |
| 285 | } |
| 286 | DCHECK_OK(func->AddKernel({InputType(Type::NA)}, boolean(), ConstBoolExec<false>)); |
| 287 | DCHECK_OK( |
| 288 | func->AddKernel({InputType(Type::DECIMAL128)}, boolean(), ConstBoolExec<false>)); |
| 289 | DCHECK_OK( |
| 290 | func->AddKernel({InputType(Type::DECIMAL256)}, boolean(), ConstBoolExec<false>)); |
| 291 | DCHECK_OK( |
| 292 | func->AddKernel({InputType(Type::DURATION)}, boolean(), ConstBoolExec<false>)); |
| 293 | |
| 294 | return func; |
| 295 | } |
| 296 | |
| 297 | Status TrueUnlessNullExec(KernelContext* ctx, const ExecSpan& batch, ExecResult* out) { |
| 298 | // Set all bits in the output's value bitmap to true |