github.com/apache/beam/sdks/v2@v2.48.2/python/apache_beam/transforms/cy_combiners.pxd (about)

     1  #
     2  # Licensed to the Apache Software Foundation (ASF) under one or more
     3  # contributor license agreements.  See the NOTICE file distributed with
     4  # this work for additional information regarding copyright ownership.
     5  # The ASF licenses this file to You under the Apache License, Version 2.0
     6  # (the "License"); you may not use this file except in compliance with
     7  # the License.  You may obtain a copy of the License at
     8  #
     9  #    http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  #
    17  
    18  cimport cython
    19  from libc.stdint cimport int64_t, INT64_MIN, INT64_MAX
    20  
    21  cdef double _NEG_INF, _POS_INF, _NAN
    22  
    23  
    24  cdef class CountAccumulator(object):
    25    cdef readonly int64_t value
    26    cpdef add_input(self, unused_element)
    27    @cython.locals(accumulator=CountAccumulator)
    28    cpdef merge(self, accumulators)
    29  
    30  
    31  cdef class SumInt64Accumulator(object):
    32    cdef readonly int64_t value
    33    cpdef add_input(self, int64_t element)
    34    @cython.locals(accumulator=SumInt64Accumulator)
    35    cpdef merge(self, accumulators)
    36  
    37  cdef class MinInt64Accumulator(object):
    38    cdef readonly int64_t value
    39    cpdef add_input(self, int64_t element)
    40    @cython.locals(accumulator=MinInt64Accumulator)
    41    cpdef merge(self, accumulators)
    42  
    43  
    44  cdef class MaxInt64Accumulator(object):
    45    cdef readonly int64_t value
    46    cpdef add_input(self, int64_t element)
    47    @cython.locals(accumulator=MaxInt64Accumulator)
    48    cpdef merge(self, accumulators)
    49  
    50  
    51  cdef class MeanInt64Accumulator(object):
    52    cdef readonly int64_t sum
    53    cdef readonly int64_t count
    54    cpdef add_input(self, int64_t element)
    55    @cython.locals(accumulator=MeanInt64Accumulator)
    56    cpdef merge(self, accumulators)
    57  
    58  
    59  cdef class DistributionInt64Accumulator(object):
    60    cdef readonly int64_t sum
    61    cdef readonly int64_t count
    62    cdef readonly int64_t min
    63    cdef readonly int64_t max
    64    cpdef add_input(self, int64_t element)
    65    @cython.locals(accumulator=DistributionInt64Accumulator)
    66    cpdef merge(self, accumulators)
    67  
    68  
    69  cdef class SumDoubleAccumulator(object):
    70    cdef readonly double value
    71    cpdef add_input(self, double element)
    72    @cython.locals(accumulator=SumDoubleAccumulator)
    73    cpdef merge(self, accumulators)
    74  
    75  
    76  cdef class MinDoubleAccumulator(object):
    77    cdef readonly double value
    78    cpdef add_input(self, double element)
    79    @cython.locals(accumulator=MinDoubleAccumulator)
    80    cpdef merge(self, accumulators)
    81  
    82  
    83  cdef class MaxDoubleAccumulator(object):
    84    cdef readonly double value
    85    cpdef add_input(self, double element)
    86    @cython.locals(accumulator=MaxDoubleAccumulator)
    87    cpdef merge(self, accumulators)
    88  
    89  
    90  cdef class MeanDoubleAccumulator(object):
    91    cdef readonly double sum
    92    cdef readonly int64_t count
    93    cpdef add_input(self, double element)
    94    @cython.locals(accumulator=MeanDoubleAccumulator)
    95    cpdef merge(self, accumulators)
    96  
    97  
    98  cdef class AllAccumulator(object):
    99    cdef readonly bint value
   100    cpdef add_input(self, bint element)
   101    @cython.locals(accumulator=AllAccumulator)
   102    cpdef merge(self, accumulators)
   103  
   104  
   105  cdef class AnyAccumulator(object):
   106    cdef readonly bint value
   107    cpdef add_input(self, bint element)
   108    @cython.locals(accumulator=AnyAccumulator)
   109    cpdef merge(self, accumulators)
   110  
   111  
   112  cdef class ComparableValue(object):
   113    cdef readonly object value, _less_than_fn, _comparable_value
   114    cdef readonly bint requires_hydration
   115    cpdef hydrate(self, object less_than_fn, object key_fn)
   116