mkql_builtins_plus.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "mkql_builtins_decimal.h" // Y_IGNORE
  2. namespace NKikimr {
  3. namespace NMiniKQL {
  4. namespace {
  5. template<typename TInput, typename TOutput>
  6. struct TPlus : public TSimpleArithmeticUnary<TInput, TOutput, TPlus<TInput, TOutput>> {
  7. static TOutput Do(TInput val)
  8. {
  9. return +val;
  10. }
  11. #ifndef MKQL_DISABLE_CODEGEN
  12. static Value* Gen(Value* arg, const TCodegenContext&, BasicBlock*&)
  13. {
  14. return arg;
  15. }
  16. #endif
  17. };
  18. struct TDecimalPlus {
  19. static NUdf::TUnboxedValuePod Execute(const NUdf::TUnboxedValuePod& arg) {
  20. return arg;
  21. }
  22. #ifndef MKQL_DISABLE_CODEGEN
  23. static Value* Generate(Value* arg, const TCodegenContext&, BasicBlock*&)
  24. {
  25. return arg;
  26. }
  27. #endif
  28. };
  29. }
  30. void RegisterPlus(IBuiltinFunctionRegistry& registry) {
  31. RegisterUnaryNumericFunctionOpt<TPlus, TUnaryArgsOpt>(registry, "Plus");
  32. NDecimal::RegisterUnaryFunction<TDecimalPlus, TUnaryArgsOpt>(registry, "Plus");
  33. RegisterFunctionUnOpt<NUdf::TDataType<NUdf::TInterval>, NUdf::TDataType<NUdf::TInterval>, TPlus, TUnaryArgsOpt>(registry, "Plus");
  34. RegisterFunctionUnOpt<NUdf::TDataType<NUdf::TInterval64>, NUdf::TDataType<NUdf::TInterval64>, TPlus, TUnaryArgsOpt>(registry, "Plus");
  35. }
  36. } // namespace NMiniKQL
  37. } // namespace NKikimr