
    ci%             
       D   d dl Z d dlmZ d dlmZ d dlmZmZ dedefdZ	dedefd	Z
dedefd
ZdedefdZdedefdZdededefdZdedefdZdedefdZdedefdZdededededef
dZdedefdZdedefdZdedefdZdedefdZdedefdZded edefd!Zd"ed#edefd$Zd%edefd&Zd'edefd(Zdedefd)Zdedefd*Zded+edefd,Zded+edefd-Zdedefd.Z d/ed0ed1edefd2Z!d3ed4edefd5Z"	 dd4ed6edefd7Z#d8ed9edefd:Z$d;ed4edefd<Z%defd=Z&d>ed?edefd@Z'dedefdAZ(dedefdBZ)dedefdCZ*dedefdDZ+d"ed#edefdEZ,dFedGedefdHZ-dIedJedefdKZ.dedLedMedefdNZ/	 ddedOedPedefdQZ0dOedefdRZ1dedefdSZ2d"ed#edefdTZ3dedUedefdVZ4dedefdWZ5dedXedYedefdZZ6d[ededefd\Z7dedefd]Z8dedefd^Z9	 ddedOedPedefd_Z:	 ddedOedPedefd`Z;dedefdaZ<dedefdbZ=dGedefdcZ>dedefddZ?dedefdeZ@dedefdfZAdedefdgZBddhdOediedPedefdjZCdkedledefdmZDdedefdnZEdedoedefdpZFdedefdqZGdedefdrZHdedefdsZIdedefdtZJdedefduZKdedefdvZLdedefdwZMdedefdxZNdedyedefdzZOded{edefd|ZP	 ddedYed}edefd~ZQdededefdZRdedefdZS	 ddededoedefdZTdefdZUdedyedefdZVdefdZWd[ededefdZX	 ddOedPedefdZYdedefdZZdededefdZ[dedededefdZ\d>edefdZ]dedUedefdZ^	 ddededefdZ_dededefdZ`dedefdZadededefdZbdededefdZcdGedefdZddGedefdZededefdZfd'edefdZgdedefdZhdedefdZidedoedefdZjdedefdZkd>ededefdZldedefdZmdedefdZndededefdZodededefdZpdededefdZqdedefdZrdedefdZs	 dded+ededefdZtdedefdZudedefdZv	 dded+ededefdZwdedefdZxdedefdZy	 dded+ededefdZzdedefdZ{dedefdZ|dededefdZ}dededefdZ~dedefdZdedefdZdedefdZdedefdZdedefdZdedefdÄZ	 ddedYedUedefdĄZdedefdńZd'edefdƄZdedefdǄZdefdȄZdedOedefdɄZdedededefdʄZdedefd˄Zdedefd̄Zdedefd̈́Zdedefd΄ZdedefdτZdedefdЄZdedefdфZdedefd҄ZdedefdӄZdedefdԄZdedefdՄZdedefdքZdedefdׄZ	 ddedPedefd؄ZdedefdلZd>edefdڄZdedefdۄZdedefd܄Zdedefd݄ZdedefdބZd>edefd߄ZdedefdZdedefdZdedefdZdededefdZdS )    N)AnyInstrumentedExpression)ESQLBaseExpressionTypevreturnc                 |    t          | t                    st          j        |           nt	          j        |           S N)
isinstancer   jsondumpsr   _format_expr)r   s    \/var/www/html/auto_sub_bot/venv/lib/python3.11/site-packages/elasticsearch/esql/functions.py_renderr      s6     !344	&
1"1%%    numberc                 B    t          dt          |            d          S )zpReturns the absolute value.

    :param number: Numeric expression. If `null`, the function returns `null`.
    zABS()r   r   r   s    r   absr   !   $    
 "";";";";<<<r   c                 B    t          dt          |            d          S )zReturns the arccosine of `n` as an angle, expressed in radians.

    :param number: Number between -1 and 1. If `null`, the function returns `null`.
    zACOS(r   r   r   s    r   acosr   )   $    
 ""<'&//"<"<"<===r   c                 B    t          dt          |            d          S )zReturns the arcsine of the input numeric expression as an angle,
    expressed in radians.

    :param number: Number between -1 and 1. If `null`, the function returns `null`.
    zASIN(r   r   r   s    r   asinr   1   $     ""<'&//"<"<"<===r   c                 B    t          dt          |            d          S )zReturns the arctangent of the input numeric expression as an angle,
    expressed in radians.

    :param number: Numeric expression. If `null`, the function returns `null`.
    zATAN(r   r   r   s    r   atanr!   :   r   r   y_coordinatex_coordinatec                 b    t          dt          |            dt          |           d          S )a,  The angle between the positive x-axis and the ray from the origin to the
    point (x , y) in the Cartesian plane, expressed in radians.

    :param y_coordinate: y coordinate. If `null`, the function returns `null`.
    :param x_coordinate: x coordinate. If `null`, the function returns `null`.
    zATAN2(, r   r   )r"   r#   s     r   atan2r&   C   s<     "B&&BB',*?*?BBB  r   c                 B    t          dt          |            d          S )zcThe average of a numeric field.

    :param number: Expression that outputs values to average.
    zAVG(r   r   r   s    r   avgr(   Q   r   r   c                 B    t          dt          |            d          S )zmThe average over time of a numeric field.

    :param number: Expression that outputs values to average.
    zAVG_OVER_TIME(r   r   r   s    r   avg_over_timer*   Y   s$    
 ""E76??"E"E"EFFFr   stringc                 B    t          dt          |            d          S )zwReturns the bit length of a string.

    :param string: String expression. If `null`, the function returns `null`.
    zBIT_LENGTH(r   r   r+   s    r   
bit_lengthr.   a   s$    
 ""B"B"B"BCCCr   fieldbucketsfrom_toc                     t          dt          |            dt          |           dt          |           dt          |           d	          S )ab  Creates groups of values - buckets - out of a datetime or numeric input.
    The size of the buckets can either be provided directly, or chosen based on
    a recommended count and values range.

    :param field: Numeric or date expression from which to derive buckets.
    :param buckets: Target number of buckets, or desired bucket size if `from`
                    and `to` parameters are omitted.
    :param from_: Start of the range. Can be a number, a date or a date expressed
                  as a string.
    :param to: End of the range. Can be a number, a date or a date expressed as a string.
    zBUCKET(r%   r   r   )r/   r0   r1   r2   s       r   bucketr4   i   sW    " "X'%..XXGG$4$4XXXX'RT++XXX  r   c                 B    t          dt          |            d          S )zxReturns the byte length of a string.

    :param string: String expression. If `null`, the function returns `null`.
    zBYTE_LENGTH(r   r   r-   s    r   byte_lengthr6      $    
 ""C"C"C"CDDDr   
conditionsc                  b    t          dd                    d | D                        d          S )al  Accepts pairs of conditions and values. The function returns the value
    that belongs to the first condition that evaluates to `true`.  If the
    number of arguments is odd, the last argument is the default value which is
    returned when no condition matches. If the number of arguments is even, and
    no condition matches, the function returns `null`.
    zCASE(r%   c                 ,    g | ]}t          |          S  r   .0cs     r   
<listcomp>zcase.<locals>.<listcomp>   s    :::!71:::::r   r   r   join)r8   s    r   caserC      s?     ">		::z:::;;>>>  r   c                 B    t          dt          |            d          S )zyGroups text messages into categories of similarly formatted text values.

    :param field: Expression to categorize
    zCATEGORIZE(r   r   r/   s    r   
categorizerF      s$    
 ""A"A"A"ABBBr   c                 B    t          dt          |            d          S )zReturns the cube root of a number. The input can be any numeric value,
    the return value is always a double. Cube roots of infinities are null.

    :param number: Numeric expression. If `null`, the function returns `null`.
    zCBRT(r   r   r   s    r   cbrtrH      r   r   c                 B    t          dt          |            d          S )z~Round a number up to the nearest integer.

    :param number: Numeric expression. If `null`, the function returns `null`.
    zCEIL(r   r   r   s    r   ceilrJ      r   r   ipblock_xc                 b    t          dt          |            dt          |           d          S )zReturns true if the provided IP is contained in one of the provided CIDR blocks.

    :param ip: IP address of type `ip` (both IPv4 and IPv6 are supported).
    :param block_x: CIDR block to test the IP against.
    zCIDR_MATCH(r%   r   r   )rK   rL   s     r   
cidr_matchrN      s4     ""R"R"Rww?O?O"R"R"RSSSr   firstrestc                 b    t          dt          |            dt          |           d          S )zReturns the first of its arguments that is not null. If all arguments
    are null, it returns `null`.

    :param first: Expression to evaluate.
    :param rest: Other expression to evaluate.
    z	COALESCE(r%   r   r   rO   rP   s     r   coalescerS      2     ""Pgenn"P"P"P"P"PQQQr   stringsc                  b    t          dd                    d | D                        d          S )z!Concatenates two or more strings.zCONCAT(r%   c                 .    g | ]}t          |           S r;   r<   )r>   ss     r   r@   zconcat.<locals>.<listcomp>   s     >>>

_>>>r   r   rA   )rU   s    r   concatrY      s=    !B$))>>g>>>??BBB  r   anglec                 B    t          dt          |            d          S )zuReturns the cosine of an angle.

    :param angle: An angle, in radians. If `null`, the function returns `null`.
    zCOS(r   r   rZ   s    r   cosr]      $    
 "":":":":;;;r   c                 B    t          dt          |            d          S )zReturns the hyperbolic cosine of a number.

    :param number: Numeric expression. If `null`, the function returns `null`.
    zCOSH(r   r   r   s    r   coshr`      r   r   c                 B    t          dt          |            d          S )zReturns the total number (count) of input values.

    :param field: Expression that outputs values to be counted. If omitted,
                  equivalent to `COUNT(*)` (the number of rows).
    zCOUNT(r   r   rE   s    r   countrb      s$     ""<75>>"<"<"<===r   	precisionc                 b    t          dt          |            dt          |           d          S )av  Returns the approximate number of distinct values.

    :param field: Column or literal for which to count the number of distinct values.
    :param precision: Precision threshold. The maximum supported value is 40000. Thresholds
                      above this number will have the same effect as a threshold of 40000.
                      The default value is 3000.
    zCOUNT_DISTINCT(r%   r   r   r/   rc   s     r   count_distinctrf      s:     "A'%..AAGI,>,>AAA  r   c                 b    t          dt          |            dt          |           d          S )a3  The count of distinct values over time for a field.

    :param field:
    :param precision: Precision threshold. The maximum supported value is 40000. Thresholds
                      above this number will have the same effect as a threshold of 40000. The
                      default value is 3000.
    zCOUNT_DISTINCT_OVER_TIME(r%   r   r   re   s     r   count_distinct_over_timerh      s:     "KGENNKKgi6H6HKKK  r   c                 B    t          dt          |            d          S )z=The count over time value of a field.

    :param field:
    zCOUNT_OVER_TIME(r   r   rE   s    r   count_over_timerj      $    
 ""FWU^^"F"F"FGGGr   unitstart_timestampend_timestampc           
          t          dt          |            dt          |           dt          |           d          S )av  Subtracts the `startTimestamp` from the `endTimestamp` and returns the
    difference in multiples of `unit`. If `startTimestamp` is later than the
    `endTimestamp`, negative values are returned.

    :param unit: Time difference unit
    :param start_timestamp: A string representing a start timestamp
    :param end_timestamp: A string representing an end timestamp
    z
DATE_DIFF(r%   r   r   )rl   rm   rn   s      r   	date_diffrp     sJ     "[WT]][[go&>&>[['-BXBX[[[  r   	date_partdatec                 b    t          dt          |            dt          |           d          S )aO  Extracts parts of a date, like year, month, day, hour.

    :param date_part: Part of the date to extract.  Can be:
        `aligned_day_of_week_in_month`, `aligned_day_of_week_in_year`,
        `aligned_week_of_month`, `aligned_week_of_year`, `ampm_of_day`,
        `clock_hour_of_ampm`, `clock_hour_of_day`, `day_of_month`, `day_of_week`,
        `day_of_year`, `epoch_day`, `era`, `hour_of_ampm`, `hour_of_day`,
        `instant_seconds`, `micro_of_day`, `micro_of_second`, `milli_of_day`,
        `milli_of_second`, `minute_of_day`, `minute_of_hour`, `month_of_year`,
        `nano_of_day`, `nano_of_second`, `offset_seconds`, `proleptic_month`,
        `second_of_day`, `second_of_minute`, `year`, or `year_of_era`. If `null`,
        the function returns `null`.
    :param date: Date expression. If `null`, the function returns `null`.
    zDATE_EXTRACT(r%   r   r   )rq   rr   s     r   date_extractrt     s:    " ">	**>>gdmm>>>  r   date_formatc                     |0t          dt          |           dt          |            d          S t          dt          |            d          S )ag  Returns a string representation of a date, in the provided format.

    :param date_format: Date format (optional).  If no format is specified, the
                        `yyyy-MM-dd'T'HH:mm:ss.SSSZ` format is used. If `null`, the
                        function returns `null`.
    :param date: Date expression. If `null`, the function returns `null`.
    NzDATE_FORMAT(r%   r   r   )rr   ru   s     r   ru   ru   +  sb     %C7;//CC74==CCC
 
 	
 &&EWT]]&E&E&EFFFr   date_patterndate_stringc                 b    t          dt          |            dt          |           d          S )aC  Returns a date by parsing the second argument using the format specified
    in the first argument.

    :param date_pattern: The date format. If `null`, the function returns `null`.
    :param date_string: Date expression as a string. If `null` or an empty
                        string, the function returns `null`.
    zDATE_PARSE(r%   r   r   )rw   rx   s     r   
date_parserz   >  s<     "Fgl++FFw{/C/CFFF  r   intervalc                 b    t          dt          |            dt          |           d          S )zRounds down a date to the closest interval since epoch, which starts at `0001-01-01T00:00:00Z`.

    :param interval: Interval; expressed using the timespan literal syntax.
    :param date: Date expression
    zDATE_TRUNC(r%   r   r   )r{   rr   s     r   
date_truncr}   M  s4     ""U0A0A"U"UWT]]"U"U"UVVVr   c                       t          d          S )u   Returns Euler’s number).zE()r   r;   r   r   er   X  s    !%(((r   strsuffixc                 b    t          dt          |            dt          |           d          S )zReturns a boolean that indicates whether a keyword string ends with
    another string.

    :param str: String expression. If `null`, the function returns `null`.
    :param suffix: String expression. If `null`, the function returns `null`.
    z
ENDS_WITH(r%   r   r   )r   r   s     r   	ends_withr   ]  s2     ""Qws||"Q"Qwv"Q"Q"QRRRr   c                 B    t          dt          |            d          S )zReturns the value of e raised to the power of the given number.

    :param number: Numeric expression. If `null`, the function returns `null`.
    zEXP(r   r   r   s    r   expr   g  r   r   c                 B    t          dt          |            d          S )znThe earliest value of a field, where recency determined by the
    `@timestamp` field.

    :param field:
    zFIRST_OVER_TIME(r   r   rE   s    r   first_over_timer   o  s$     ""FWU^^"F"F"FGGGr   c                 B    t          dt          |            d          S )zRound a number down to the nearest integer.

    :param number: Numeric expression. If `null`, the function returns `null`.
    zFLOOR(r   r   r   s    r   floorr   x  $    
 ""=76??"="="=>>>r   c                 B    t          dt          |            d          S )zADecode a base64 string.

    :param string: A base64 string.
    zFROM_BASE64(r   r   r-   s    r   from_base64r     r7   r   c                 b    t          dt          |            dt          |           d          S )zReturns the maximum value from multiple columns. This is similar to
    `MV_MAX` except it is intended to run on multiple columns at once.

    :param first: First of the columns to evaluate.
    :param rest: The rest of the columns to evaluate.
    z	GREATEST(r%   r   r   rR   s     r   greatestr     rT   r   	algorithminputc                 b    t          dt          |            dt          |           d          S )zComputes the hash of the input using various algorithms such as MD5,
    SHA, SHA-224, SHA-256, SHA-384, SHA-512.

    :param algorithm: Hash algorithm to use.
    :param input: Input to hash.
    zHASH(r%   r   r   )r   r   s     r   hashr     s4     ""Q')*<*<"Q"Q"Q"Q"QRRRr   number1number2c                 .    t          d|  d| d          S )a>  Returns the hypotenuse of two numbers. The input can be any numeric
    values, the return value is always a double. Hypotenuses of infinities are null.

    :param number1: Numeric expression. If `null`, the function returns `null`.
    :param number2: Numeric expression. If `null`, the function returns `null`.
    zHYPOT(r%   r   r   )r   r   s     r   hypotr     s&     ""@7"@"@g"@"@"@AAAr   prefix_length_v4prefix_length_v6c           	      N    t          dt          |            d| d| d          S )zTruncates an IP to a given prefix length.

    :param ip: IP address of type `ip` (both IPv4 and IPv6 are supported).
    :param prefix_length_v4: Prefix length for IPv4 addresses.
    :param prefix_length_v6: Prefix length for IPv6 addresses.
    z
IP_PREFIX(r%   r   r   )rK   r   r   s      r   	ip_prefixr     s<     "KWR[[KK$4KK8HKKK  r   queryoptionsc           
          |@t          dt          |            dt          |           dt          |           d          S t          dt          |            dt          |           d          S )a  Finds the k nearest vectors to a query vector, as measured by a
    similarity metric. knn function finds nearest vectors through approximate
    search on indexed dense_vectors.

    :param field: Field that the query will target.
    :param query: Vector value to find top nearest neighbours for.
    :param options: (Optional) kNN additional options as function named parameters.
    NzKNN(r%   r   r   r/   r   r   s      r   knnr     s~     %J75>>JJWU^^JJww7G7GJJJ
 
 	
 &&PWU^^&P&Pwu~~&P&P&PQQQr   c                 B    t          dt          |            d          S )zPerforms a KQL query. Returns true if the provided KQL query string
    matches the row.

    :param query: Query string in KQL query string format.
    zKQL(r   r   )r   s    r   kqlr     s$     "":":":":;;;r   c                 B    t          dt          |            d          S )zlThe latest value of a field, where recency determined by the
    `@timestamp` field.

    :param field:
    zLAST_OVER_TIME(r   r   rE   s    r   last_over_timer     s$     ""EGENN"E"E"EFFFr   c                 b    t          dt          |            dt          |           d          S )zReturns the minimum value from multiple columns. This is similar to
    `MV_MIN` except it is intended to run on multiple columns at once.

    :param first: First of the columns to evaluate.
    :param rest: The rest of the columns to evaluate.
    zLEAST(r%   r   r   rR   s     r   leastr     s2     ""M75>>"M"MWT]]"M"M"MNNNr   lengthc                 b    t          dt          |            dt          |           d          S )zReturns the substring that extracts *length* chars from *string*
    starting from the left.

    :param string: The string from which to return a substring.
    :param length: The number of characters to return.
    zLEFT(r%   r   r   r+   r   s     r   leftr     s2     ""O'&//"O"OWV__"O"O"OPPPr   c                 B    t          dt          |            d          S )z}Returns the character length of a string.

    :param string: String expression. If `null`, the function returns `null`.
    zLENGTH(r   r   r-   s    r   r   r     s$    
 "">GFOO">">">???r   	substringstartc           
          t          dt          |            dt          |           dt          |           d          S )aH  Returns an integer that indicates the position of a keyword substring
    within another string. Returns `0` if the substring cannot be found. Note
    that string positions start from `1`.

    :param string: An input string
    :param substring: A substring to locate in the input string
    :param start: The start index
    zLOCATE(r%   r   r   )r+   r   r   s      r   locater     sH     "L'&//LLWY%7%7LL75>>LLL  r   basec                 b    t          dt          |            dt          |           d          S )a  Returns the logarithm of a value to a base. The input can be any numeric
    value, the return value is always a double.  Logs of zero, negative
    numbers, and base of one return `null` as well as a warning.

    :param base: Base of logarithm. If `null`, the function returns `null`. If
                 not provided, this function returns the natural logarithm (base e) of a value.
    :param number: Numeric expression. If `null`, the function returns `null`.
    zLOG(r%   r   r   )r   r   s     r   logr     s2     ""L"L"L'&//"L"L"LMMMr   c                 B    t          dt          |            d          S )a  Returns the logarithm of a value to base 10. The input can be any
    numeric value, the return value is always a double.  Logs of 0 and negative
    numbers return `null` as well as a warning.

    :param number: Numeric expression. If `null`, the function returns `null`.
    zLOG10(r   r   r   s    r   log10r     s$     ""=76??"="="=>>>r   c                 B    t          dt          |            d          S )z~Removes leading whitespaces from a string.

    :param string: String expression. If `null`, the function returns `null`.
    zLTRIM(r   r   r-   s    r   ltrimr     r   r   c           
          |@t          dt          |            dt          |           dt          |           d          S t          dt          |            dt          |           d          S )a^  Use `MATCH` to perform a match query on the specified field. Using
    `MATCH` is equivalent to using the `match` query in the Elasticsearch Query DSL.

    :param field: Field that the query will target.
    :param query: Value to find in the provided field.
    :param options: (Optional) Match additional options as function named parameters.
    NzMATCH(r%   r   r   r   s      r   matchr   %  s~     %LWU^^LLwu~~LL9I9ILLL
 
 	
 &&Rwu~~&R&R&R&R&RSSSr   c           
          |@t          dt          |            dt          |           dt          |           d          S t          dt          |            dt          |           d          S )a  Use `MATCH_PHRASE` to perform a `match_phrase` on the specified field.
    Using `MATCH_PHRASE` is equivalent to using the `match_phrase` query in the
    Elasticsearch Query DSL.

    :param field: Field that the query will target.
    :param query: Value to find in the provided field.
    :param options: (Optional) MatchPhrase additional options as function named parameters.
    NzMATCH_PHRASE(r%   r   r   r   s      r   match_phraser   7  s     %SGENNSSgennSS@P@PSSS
 
 	
 &?GENN??genn???
 
 	
r   c                 B    t          dt          |            d          S )z5The maximum value of a field.

    :param field:
    zMAX(r   r   rE   s    r   maxr   L  r^   r   c                 B    t          dt          |            d          S )z?The maximum over time value of a field.

    :param field:
    zMAX_OVER_TIME(r   r   rE   s    r   max_over_timer   T  $    
 ""D75>>"D"D"DEEEr   c                 B    t          dt          |            d          S )zJComputes the MD5 hash of the input.

    :param input: Input to hash.
    zMD5(r   r   r   s    r   md5r   \  r^   r   c                 B    t          dt          |            d          S )zThe value that is greater than half of all values and less than half of
    all values, also known as the 50% `PERCENTILE`.

    :param number: Expression that outputs values to calculate the median of.
    zMEDIAN(r   r   r   s    r   medianr   d  $     "">GFOO">">">???r   c                 B    t          dt          |            d          S )u  Returns the median absolute deviation, a measure of variability. It is a
    robust statistic, meaning that it is useful for describing data that may
    have outliers, or may not be normally distributed. For such data it can be
    more descriptive than standard deviation.  It is calculated as the median
    of each data point’s deviation from the median of the entire sample. That
    is, for a random variable `X`, the median absolute deviation is
    `median(|median(X) - X|)`.

    :param number:
    zMEDIAN_ABSOLUTE_DEVIATION(r   r   r   s    r   median_absolute_deviationr   m  s$     ""Qwv"Q"Q"QRRRr   c                 B    t          dt          |            d          S )z5The minimum value of a field.

    :param field:
    zMIN(r   r   rE   s    r   minr   {  r^   r   c                 B    t          dt          |            d          S )z?The minimum over time value of a field.

    :param field:
    zMIN_OVER_TIME(r   r   rE   s    r   min_over_timer     r   r   )r   fieldsc          
      &   |Pt          dt          |            dd                    d |D                        dt          |           d          S t          dt          |            dd                    d |D                        d          S )a  Use `MULTI_MATCH` to perform a multi-match query on the specified field.
    The multi_match query builds on the match query to allow multi-field queries.

    :param query: Value to find in the provided fields.
    :param fields: Fields to use for matching
    :param options: (Optional) Additional options for MultiMatch, passed as function
                    named parameters
    NzMULTI_MATCH(r%   c                 ,    g | ]}t          |          S r;   r<   r=   s     r   r@   zmulti_match.<locals>.<listcomp>      7S7S7Sq

7S7S7Sr   r   c                 ,    g | ]}t          |          S r;   r<   r=   s     r   r@   zmulti_match.<locals>.<listcomp>  r   r   )r   r   rB   )r   r   r   s      r   multi_matchr     s     %k75>>kkTYY7S7SF7S7S7S-T-TkkX_`gXhXhkkk
 
 	
 &W75>>WWTYY7S7SF7S7S7S-T-TWWW
 
 	
r   field1field2c                 .    t          d|  d| d          S )zZConcatenates values of two multi-value fields.

    :param field1:
    :param field2:
    z
MV_APPEND(r%   r   r   )r   r   s     r   	mv_appendr     s&     ""Bv"B"B"B"B"BCCCr   c                 B    t          dt          |            d          S )zConverts a multivalued field into a single valued field containing the
    average of all of the values.

    :param number: Multivalue expression.
    zMV_AVG(r   r   r   s    r   mv_avgr     r   r   delimc                 b    t          dt          |            dt          |           d          S )zConverts a multivalued string expression into a single valued column
    containing the concatenation of all values separated by a delimiter.

    :param string: Multivalue expression.
    :param delim: Delimiter.
    z
MV_CONCAT(r%   r   r   r+   r   s     r   	mv_concatr     s2     ""Swv"S"S'%.."S"S"STTTr   c                 B    t          dt          |            d          S )zConverts a multivalued expression into a single valued column containing
    a count of the number of values.

    :param field: Multivalue expression.
    z	MV_COUNT(r   r   rE   s    r   mv_countr     s$     ""?genn"?"?"?@@@r   c                 B    t          dt          |            d          S )z`Remove duplicate values from a multivalued field.

    :param field: Multivalue expression.
    z
MV_DEDUPE(r   r   rE   s    r   	mv_deduper     s$    
 ""@wu~~"@"@"@AAAr   c                 B    t          dt          |            d          S )zConverts a multivalued expression into a single valued column containing
    the first value. This is most useful when reading from a function that
    emits multivalued columns in a known order like `SPLIT`.

    :param field: Multivalue expression.
    z	MV_FIRST(r   r   rE   s    r   mv_firstr     s$     ""?genn"?"?"?@@@r   c                 B    t          dt          |            d          S )zConverts a multivalue expression into a single valued column containing
    the last value. This is most useful when reading from a function that emits
    multivalued columns in a known order like `SPLIT`.

    :param field: Multivalue expression.
    zMV_LAST(r   r   rE   s    r   mv_lastr     s$     "">WU^^">">">???r   c                 B    t          dt          |            d          S )zConverts a multivalued expression into a single valued column containing
    the maximum value.

    :param field: Multivalue expression.
    zMV_MAX(r   r   rE   s    r   mv_maxr     $     ""=GENN"="="=>>>r   c                 B    t          dt          |            d          S )zConverts a multivalued field into a single valued field containing the
    median value.

    :param number: Multivalue expression.
    z
MV_MEDIAN(r   r   r   s    r   	mv_medianr     s$     ""Awv"A"A"ABBBr   c                 B    t          dt          |            d          S )ud  Converts a multivalued field into a single valued field containing the
    median absolute deviation.  It is calculated as the median of each data
    point’s deviation from the median of the entire sample. That is, for a
    random variable `X`, the median absolute deviation is `median(|median(X) - X|)`.

    :param number: Multivalue expression.
    zMV_MEDIAN_ABSOLUTE_DEVIATION(r   r   r   s    r   mv_median_absolute_deviationr     s$     ""T'&//"T"T"TUUUr   c                 B    t          dt          |            d          S )zConverts a multivalued expression into a single valued column containing
    the minimum value.

    :param field: Multivalue expression.
    zMV_MIN(r   r   rE   s    r   mv_minr     r   r   
percentilec                 b    t          dt          |            dt          |           d          S )aX  Converts a multivalued field into a single valued field containing the
    value at which a certain percentage of observed values occur.

    :param number: Multivalue expression.
    :param percentile: The percentile to calculate. Must be a number between 0
                       and 100. Numbers out of range will return a null instead.
    zMV_PERCENTILE(r%   r   r   r   r   s     r   mv_percentiler     s:     "BBBGJ,?,?BBB  r   pc                 b    t          dt          |            dt          |           d          S )u  Converts a multivalued expression into a single-valued column by
    multiplying every element on the input list by its corresponding term in
    P-Series and computing the sum.

    :param number: Multivalue expression.
    :param p: It is a constant number that represents the *p* parameter in the
              P-Series. It impacts every element’s contribution to the weighted sum.
    zMV_PSERIES_WEIGHTED_SUM(r%   r   r   )r   r   s     r   mv_pseries_weighted_sumr     s8     "C76??CCgajjCCC  r   endc           
          |@t          dt          |            dt          |           dt          |           d          S t          dt          |            dt          |           d          S )a  Returns a subset of the multivalued field using the start and end index
    values. This is most useful when reading from a function that emits
    multivalued columns in a known order like `SPLIT` or `MV_SORT`.

    :param field: Multivalue expression. If `null`, the function returns `null`.
    :param start: Start position. If `null`, the function returns `null`. The
                  start argument can be negative. An index of -1 is used to specify
                  the last value in the list.
    :param end: End position(included). Optional; if omitted, the position at
                `start` is returned. The end argument can be negative. An index of -1
                is used to specify the last value in the list.
    Nz	MV_SLICE(r%   r   r   )r/   r   r   s      r   mv_slicer   &  s{     %KKK'%..KKGCLLKKK
 
 	
 &&U'%..&U&UGENN&U&U&UVVVr   orderc                 b    t          dt          |            dt          |           d          S )zSorts a multivalued field in lexicographical order.

    :param field: Multivalue expression. If `null`, the function returns `null`.
    :param order: Sort order. The valid options are ASC and DESC, the default is ASC.
    zMV_SORT(r%   r   r   )r/   r   s     r   mv_sortr   =  s2     ""PWU^^"P"Pwu~~"P"P"PQQQr   c                 B    t          dt          |            d          S )zConverts a multivalued field into a single valued field containing the
    sum of all of the values.

    :param number: Multivalue expression.
    zMV_SUM(r   r   r   s    r   mv_sumr   F  r   r   string1string2c           
      ~    |&t          d|  d| dt          |           d          S t          d|  d| d          S )a  Combines the values from two multivalued fields with a delimiter that
    joins them together.

    :param string1: Multivalue expression.
    :param string2: Multivalue expression.
    :param delim: Delimiter. Optional; if omitted, `,` is used as a default delimiter.
    NzMV_ZIP(r%   r   r   )r   r   r   s      r   mv_zipr   O  s\     %&W&W&W7&W&Wgenn&W&W&WXXX%&E&E&E7&E&E&EFFFr   c                       t          d          S )zReturns current date and time.zNOW()r   r;   r   r   nowr   _      !'***r   c                 b    t          dt          |            dt          |           d          S )a	  Returns the value at which a certain percentage of observed values
    occur. For example, the 95th percentile is the value which is greater than
    95% of the observed values and the 50th percentile is the `MEDIAN`.

    :param number:
    :param percentile:
    zPERCENTILE(r%   r   r   r   s     r   r   r   d  s:     "?gfoo??)<)<???  r   c                       t          d          S )uD   Returns Pi, the ratio of a circle’s circumference to its diameter.zPI()r   r;   r   r   pir  s  s    !&)))r   exponentc                 b    t          dt          |            dt          |           d          S )a   Returns the value of `base` raised to the power of `exponent`.

    :param base: Numeric expression for the base. If `null`, the function returns `null`.
    :param exponent: Numeric expression for the exponent. If `null`, the function returns `null`.
    zPOW(r%   r   r   )r   r  s     r   powr  x  s4     ""N"N"N'(:K:K"N"N"NOOOr   c                     |0t          dt          |            dt          |           d          S t          dt          |            d          S )a  Performs a query string query. Returns true if the provided query string
    matches the row.

    :param query: Query string in Lucene query string format.
    :param options: (Optional) Additional options for Query String as function named
                    parameters.
    NzQSTR(r%   r   r   )r   r   s     r   qstrr	    sZ     %&Sgenn&S&S@P@P&S&S&STTT%&?genn&?&?&?@@@r   c                 B    t          dt          |            d          S )z4The rate of a counter field.

    :param field:
    zRATE(r   r   rE   s    r   rater    $    
 "";'%..";";";<<<r   c                 b    t          dt          |            dt          |           d          S )zReturns a string constructed by concatenating `string` with itself the
    specified `number` of times.

    :param string: String expression.
    :param number: Number times to repeat.
    zREPEAT(r%   r   r   )r+   r   s     r   repeatr    s2     ""QGFOO"Q"Qwv"Q"Q"QRRRr   regex
new_stringc           
          t          dt          |            dt          |           dt          |           d          S )zThe function substitutes in the string `str` any match of the regular
    expression `regex` with the replacement string `newStr`.

    :param string: String expression.
    :param regex: Regular expression.
    :param new_string: Replacement string.
    zREPLACE(r%   r   r   )r+   r  r  s      r   replacer    sH     "N76??NNgennNN
8K8KNNN  r   c                 B    t          dt          |            d          S )zReturns a new string representing the input string in reverse order.

    :param str: String expression. If `null`, the function returns `null`.
    zREVERSE(r   r   r   s    r   reverser    s$    
 ""<WS\\"<"<"<===r   c                 b    t          dt          |            dt          |           d          S )zReturn the substring that extracts *length* chars from *str* starting
    from the right.

    :param string: The string from which to returns a substring.
    :param length: The number of characters to return.
    zRIGHT(r%   r   r   r   s     r   rightr    s2     ""P76??"P"Pgfoo"P"P"PQQQr   decimalsc                     |0t          dt          |            dt          |           d          S t          dt          |            d          S )a  Rounds a number to the specified number of decimal places. Defaults to
    0, which returns the nearest integer. If the precision is a negative
    number, rounds to the number of digits left of the decimal point.

    :param number: The numeric value to round. If `null`, the function returns `null`.
    :param decimals: The number of decimal places to round to. Defaults to 0. If
                     `null`, the function returns `null`.
    NzROUND(r%   r   r   )r   r  s     r   roundr    sZ     %&Vwv&V&V'(BSBS&V&V&VWWW%&Awv&A&A&ABBBr   pointsc                 b    t          dt          |            dt          |           d          S )zRounds down to one of a list of fixed points.

    :param field: The numeric value to round. If `null`, the function returns `null`.
    :param points: Remaining rounding points. Must be constants.
    z	ROUND_TO(r%   r   r   )r/   r  s     r   round_tor    s2     ""Rgenn"R"R"R"R"RSSSr   c                 B    t          dt          |            d          S )zRemoves trailing whitespaces from a string.

    :param string: String expression. If `null`, the function returns `null`.
    zRTRIM(r   r   r-   s    r   rtrimr    r   r   limitc                 b    t          dt          |            dt          |           d          S )zCollects sample values for a field.

    :param field: The field to collect sample values for.
    :param limit: The maximum number of values to collect.
    zSAMPLE(r%   r   r   )r/   r   s     r   sampler"    s2     ""OGENN"O"Ogenn"O"O"OPPPr   dscale_factorc                 b    t          dt          |            dt          |           d          S )a  Returns the result of `d * 2 ^ scaleFactor`, Similar to Java's `scalb`
    function. Result is rounded as if performed by a single correctly rounded
    floating-point multiply to a member of the double value set.

    :param d: Numeric expression for the multiplier. If `null`, the function
              returns `null`.
    :param scale_factor: Numeric expression for the scale factor. If `null`, the
                         function returns `null`.
    zSCALB(r%   r   r   )r#  r$  s     r   scalbr&    s4     ""Q71::"Q"Q9N9N"Q"Q"QRRRr   c                 B    t          dt          |            d          S )zKComputes the SHA1 hash of the input.

    :param input: Input to hash.
    zSHA1(r   r   r   s    r   sha1r(    r  r   c                 B    t          dt          |            d          S )zMComputes the SHA256 hash of the input.

    :param input: Input to hash.
    zSHA256(r   r   r   s    r   sha256r*    s$    
 ""=GENN"="="=>>>r   c                 B    t          dt          |            d          S )zReturns the sign of the given number. It returns `-1` for negative
    numbers, `0` for `0` and `1` for positive numbers.

    :param number: Numeric expression. If `null`, the function returns `null`.
    zSIGNUM(r   r   r   s    r   signumr,    r   r   c                 B    t          dt          |            d          S )zsReturns the sine of an angle.

    :param angle: An angle, in radians. If `null`, the function returns `null`.
    zSIN(r   r   r\   s    r   sinr.    r^   r   c                 B    t          dt          |            d          S )z}Returns the hyperbolic sine of a number.

    :param number: Numeric expression. If `null`, the function returns `null`.
    zSINH(r   r   r   s    r   sinhr0    r   r   c                 B    t          dt          |            d          S )z^Returns a string made of `number` spaces.

    :param number: Number of spaces in result.
    zSPACE(r   r   r   s    r   spacer2  %  r   r   c                 b    t          dt          |            dt          |           d          S )zSplit a single valued string into multiple strings.

    :param string: String expression. If `null`, the function returns `null`.
    :param delim: Delimiter. Only single byte delimiters are currently supported.
    zSPLIT(r%   r   r   r   s     r   splitr4  -  s2     ""O76??"O"Ogenn"O"O"OPPPr   c                 B    t          dt          |            d          S )a  Returns the square root of a number. The input can be any numeric value,
    the return value is always a double. Square roots of negative numbers and
    infinities are null.

    :param number: Numeric expression. If `null`, the function returns `null`.
    zSQRT(r   r   r   s    r   sqrtr6  6  s$     ""<'&//"<"<"<===r   prefixc                 b    t          dt          |            dt          |           d          S )zReturns a boolean that indicates whether a keyword string starts with
    another string.

    :param str: String expression. If `null`, the function returns `null`.
    :param prefix: String expression. If `null`, the function returns `null`.
    zSTARTS_WITH(r%   r   r   )r   r7  s     r   starts_withr9  @  s2     ""S"S"S"S"S"STTTr   c                 B    t          dt          |            d          S )zNThe population standard deviation of a numeric field.

    :param number:
    zSTD_DEV(r   r   r   s    r   std_devr;  J  s$    
 ""?WV__"?"?"?@@@r   c                 B    t          dt          |            d          S )zeCalculate the spatial centroid over a field with spatial point geometry type.

    :param field:
    zST_CENTROID_AGG(r   r   rE   s    r   st_centroid_aggr=  R  rk   r   geom_ageom_bc                 b    t          dt          |            dt          |           d          S )a  Returns whether the first geometry contains the second geometry. This is
    the inverse of the ST_WITHIN function.

    :param geom_a: Expression of type `geo_point`, `cartesian_point`,
                   `geo_shape` or `cartesian_shape`. If `null`, the function returns
                   `null`.
    :param geom_b: Expression of type `geo_point`, `cartesian_point`, `geo_shape`
                   or `cartesian_shape`. If `null`, the function returns `null`. The
                   second parameter must also have the same coordinate system as the
                   first. This means it is not possible to combine `geo_*` and
                   `cartesian_*` parameters.
    zST_CONTAINS(r%   r   r   r>  r?  s     r   st_containsrB  Z  2     ""V"V"VGFOO"V"V"VWWWr   c                 b    t          dt          |            dt          |           d          S )u  Returns whether the two geometries or geometry columns are disjoint.
    This is the inverse of the ST_INTERSECTS function. In mathematical terms:
    ST_Disjoint(A, B) ⇔ A ⋂ B = ∅

    :param geom_a: Expression of type `geo_point`, `cartesian_point`,
                   `geo_shape` or `cartesian_shape`. If `null`, the function returns
                   `null`.
    :param geom_b: Expression of type `geo_point`, `cartesian_point`, `geo_shape`
                   or `cartesian_shape`. If `null`, the function returns `null`. The
                   second parameter must also have the same coordinate system as the
                   first. This means it is not possible to combine `geo_*` and
                   `cartesian_*` parameters.
    zST_DISJOINT(r%   r   r   rA  s     r   st_disjointrE  l  s2      ""V"V"VGFOO"V"V"VWWWr   c                 b    t          dt          |            dt          |           d          S )a  Computes the distance between two points. For cartesian geometries, this
    is the pythagorean distance in the same units as the original coordinates.
    For geographic geometries, this is the circular distance along the great
    circle in meters.

    :param geom_a: Expression of type `geo_point` or `cartesian_point`. If
                   `null`, the function returns `null`.
    :param geom_b: Expression of type `geo_point` or `cartesian_point`. If
                   `null`, the function returns `null`. The second parameter must
                   also have the same coordinate system as the first. This means it
                   is not possible to combine `geo_point` and `cartesian_point` parameters.
    zST_DISTANCE(r%   r   r   rA  s     r   st_distancerG    rC  r   geometryc                 B    t          dt          |            d          S )zDetermines the minimum bounding box of the supplied geometry.

    :param geometry: Expression of type `geo_point`, `geo_shape`,
                     `cartesian_point` or `cartesian_shape`. If `null`, the function
                     returns `null`.
    zST_ENVELOPE(r   r   )rH  s    r   st_enveloperJ    s&     ""E1B1B"E"E"EFFFr   c                 B    t          dt          |            d          S )zCalculate the spatial extent over a field with geometry type. Returns a
    bounding box for all values of the field.

    :param field:
    zST_EXTENT_AGG(r   r   rE   s    r   st_extent_aggrL    $     ""D75>>"D"D"DEEEr   boundsc           
          |@t          dt          |            dt          |           dt          |           d          S t          dt          |            dt          |           d          S )a  Calculates the `geohash` of the supplied geo_point at the specified
    precision. The result is long encoded. Use ST_GEOHASH_TO_STRING to convert
    the result to a string.  These functions are related to the `geo_grid`
    query and the `geohash_grid` aggregation.

    :param geometry: Expression of type `geo_point`. If `null`, the function
                     returns `null`.
    :param precision: Expression of type `integer`. If `null`, the function
                      returns `null`. Valid values are between 1 and 12.
    :param bounds: Optional bounds to filter the grid tiles, a `geo_shape` of
                   type `BBOX`. Use `ST_ENVELOPE` if the `geo_shape` is of any
                   other type.
    NzST_GEOHASH(r%   r   r   rH  rc   rN  s      r   
st_geohashrQ          %W'(++WWwy/A/AWWWV__WWW
 
 	
 &D'(++DDwy/A/ADDD
 
 	
r   grid_idc                 B    t          dt          |            d          S )zConverts an input value representing a geohash grid-ID in string format
    into a long.

    :param grid_id: Input geohash grid-id. The input can be a single- or
                    multi-valued column or an expression.
    zST_GEOHASH_TO_LONG(r   r   rS  s    r   st_geohash_to_longrV    &     ""K8H8H"K"K"KLLLr   c                 B    t          dt          |            d          S )zConverts an input value representing a geohash grid-ID in long format
    into a string.

    :param grid_id: Input geohash grid-id. The input can be a single- or
                    multi-valued column or an expression.
    zST_GEOHASH_TO_STRING(r   r   rU  s    r   st_geohash_to_stringrY    &     ""M'':J:J"M"M"MNNNr   c           
          |@t          dt          |            dt          |           dt          |           d          S t          dt          |            dt          |           d          S )a  Calculates the `geohex`, the H3 cell-id, of the supplied geo_point at
    the specified precision. The result is long encoded. Use
    ST_GEOHEX_TO_STRING to convert the result to a string.  These functions are
    related to the `geo_grid` query and the `geohex_grid` aggregation.

    :param geometry: Expression of type `geo_point`. If `null`, the function
                     returns `null`.
    :param precision: Expression of type `integer`. If `null`, the function
                      returns `null`. Valid values are between 0 and 15.
    :param bounds: Optional bounds to filter the grid tiles, a `geo_shape` of
                   type `BBOX`. Use `ST_ENVELOPE` if the `geo_shape`
                   is of any other type.
    Nz
ST_GEOHEX(r%   r   r   rP  s      r   	st_geohexr\    s      %V**VVgi.@.@VVGFOOVVV
 
 	
 &C**CCgi.@.@CCC
 
 	
r   c                 B    t          dt          |            d          S )zConverts an input value representing a geohex grid-ID in string format
    into a long.

    :param grid_id: Input geohex grid-id. The input can be a single- or
                    multi-valued column or an expression.
    zST_GEOHEX_TO_LONG(r   r   rU  s    r   st_geohex_to_longr^    s&     ""Jww7G7G"J"J"JKKKr   c                 B    t          dt          |            d          S )zConverts an input value representing a Geohex grid-ID in long format
    into a string.

    :param grid_id: Input Geohex grid-id. The input can be a single- or
                    multi-valued column or an expression.
    zST_GEOHEX_TO_STRING(r   r   rU  s    r   st_geohex_to_stringr`    s&     ""L9I9I"L"L"LMMMr   c           
          |@t          dt          |            dt          |           dt          |           d          S t          dt          |            dt          |           d          S )a  Calculates the `geotile` of the supplied geo_point at the specified
    precision. The result is long encoded. Use ST_GEOTILE_TO_STRING to convert
    the result to a string.  These functions are related to the `geo_grid`
    query and the `geotile_grid` aggregation.

    :param geometry: Expression of type `geo_point`. If `null`, the function
                     returns `null`.
    :param precision: Expression of type `integer`. If `null`, the function
                      returns `null`. Valid values are between 0 and 29.
    :param bounds: Optional bounds to filter the grid tiles, a `geo_shape` of
                   type `BBOX`. Use `ST_ENVELOPE` if the `geo_shape` is of any
                   other type.
    NzST_GEOTILE(r%   r   r   rP  s      r   
st_geotilerb     rR  r   c                 B    t          dt          |            d          S )zConverts an input value representing a geotile grid-ID in string format
    into a long.

    :param grid_id: Input geotile grid-id. The input can be a single- or
                    multi-valued column or an expression.
    zST_GEOTILE_TO_LONG(r   r   rU  s    r   st_geotile_to_longrd    rW  r   c                 B    t          dt          |            d          S )zConverts an input value representing a geotile grid-ID in long format
    into a string.

    :param grid_id: Input geotile grid-id. The input can be a single- or
                    multi-valued column or an expression.
    zST_GEOTILE_TO_STRING(r   r   rU  s    r   st_geotile_to_stringrf  $  rZ  r   c                 b    t          dt          |            dt          |           d          S )uS  Returns true if two geometries intersect. They intersect if they have
    any point in common, including their interior points (points along lines or
    within polygons). This is the inverse of the ST_DISJOINT function. In
    mathematical terms: ST_Intersects(A, B) ⇔ A ⋂ B ≠ ∅

    :param geom_a: Expression of type `geo_point`, `cartesian_point`,
                   `geo_shape` or `cartesian_shape`. If `null`, the function returns
                   `null`.
    :param geom_b: Expression of type `geo_point`, `cartesian_point`, `geo_shape`
                   or `cartesian_shape`. If `null`, the function returns `null`. The
                   second parameter must also have the same coordinate system as the
                   first. This means it is not possible to combine `geo_*` and
                   `cartesian_*` parameters.
    zST_INTERSECTS(r%   r   r   rA  s     r   st_intersectsrh  .  s8    " ">>>GFOO>>>  r   c                 b    t          dt          |            dt          |           d          S )a  Returns whether the first geometry is within the second geometry. This
    is the inverse of the ST_CONTAINS function.

    :param geom_a: Expression of type `geo_point`, `cartesian_point`,
                   `geo_shape` or `cartesian_shape`. If `null`, the function returns
                   `null`.
    :param geom_b: Expression of type `geo_point`, `cartesian_point`, `geo_shape`
                   or `cartesian_shape`. If `null`, the function returns `null`. The
                   second parameter must also have the same coordinate system as the
                   first. This means it is not possible to combine `geo_*` and
                   `cartesian_*` parameters.
    z
ST_WITHIN(r%   r   r   rA  s     r   	st_withinrj  D  s2     ""Twv"T"T'&//"T"T"TUUUr   pointc                 B    t          dt          |            d          S )a  Extracts the `x` coordinate from the supplied point. If the points is of
    type `geo_point` this is equivalent to extracting the `longitude` value.

    :param point: Expression of type `geo_point` or `cartesian_point`. If
                  `null`, the function returns `null`.
    zST_X(r   r   rk  s    r   st_xrn  T  $     "";'%..";";";<<<r   c                 B    t          dt          |            d          S )ar  Extracts the maximum value of the `x` coordinates from the supplied
    geometry. If the geometry is of type `geo_point` or `geo_shape` this is
    equivalent to extracting the maximum `longitude` value.

    :param point: Expression of type `geo_point`, `geo_shape`, `cartesian_point`
                  or `cartesian_shape`. If `null`, the function returns `null`.
    zST_XMAX(r   r   rm  s    r   st_xmaxrq  ^  $     "">WU^^">">">???r   c                 B    t          dt          |            d          S )ar  Extracts the minimum value of the `x` coordinates from the supplied
    geometry. If the geometry is of type `geo_point` or `geo_shape` this is
    equivalent to extracting the minimum `longitude` value.

    :param point: Expression of type `geo_point`, `geo_shape`, `cartesian_point`
                  or `cartesian_shape`. If `null`, the function returns `null`.
    zST_XMIN(r   r   rm  s    r   st_xminrt  i  rr  r   c                 B    t          dt          |            d          S )a  Extracts the `y` coordinate from the supplied point. If the points is of
    type `geo_point` this is equivalent to extracting the `latitude` value.

    :param point: Expression of type `geo_point` or `cartesian_point`. If
                  `null`, the function returns `null`.
    zST_Y(r   r   rm  s    r   st_yrv  t  ro  r   c                 B    t          dt          |            d          S )aq  Extracts the maximum value of the `y` coordinates from the supplied
    geometry. If the geometry is of type `geo_point` or `geo_shape` this is
    equivalent to extracting the maximum `latitude` value.

    :param point: Expression of type `geo_point`, `geo_shape`, `cartesian_point`
                  or `cartesian_shape`. If `null`, the function returns `null`.
    zST_YMAX(r   r   rm  s    r   st_ymaxrx  ~  rr  r   c                 B    t          dt          |            d          S )aq  Extracts the minimum value of the `y` coordinates from the supplied
    geometry. If the geometry is of type `geo_point` or `geo_shape` this is
    equivalent to extracting the minimum `latitude` value.

    :param point: Expression of type `geo_point`, `geo_shape`, `cartesian_point`
                  or `cartesian_shape`. If `null`, the function returns `null`.
    zST_YMIN(r   r   rm  s    r   st_yminrz    rr  r   c           
          |@t          dt          |            dt          |           dt          |           d          S t          dt          |            dt          |           d          S )ag  Returns a substring of a string, specified by a start position and an
    optional length.

    :param string: String expression. If `null`, the function returns `null`.
    :param start: Start position.
    :param length: Length of the substring from the start position. Optional; if
                   omitted, all positions after `start` are returned.
    Nz
SUBSTRING(r%   r   r   )r+   r   r   s      r   r   r     s|     %PPPGENNPPgfooPPP
 
 	
 &&W76??&W&Wgenn&W&W&WXXXr   c                 B    t          dt          |            d          S )z9The sum of a numeric expression.

    :param number:
    zSUM(r   r   r   s    r   sumr}    r   r   c                 B    t          dt          |            d          S )zvReturns the tangent of an angle.

    :param angle: An angle, in radians. If `null`, the function returns `null`.
    zTAN(r   r   r\   s    r   tanr    r^   r   c                 B    t          dt          |            d          S )zReturns the hyperbolic tangent of a number.

    :param number: Numeric expression. If `null`, the function returns `null`.
    zTANH(r   r   r   s    r   tanhr    r   r   c                       t          d          S )u>   Returns the ratio of a circle’s circumference to its radius.zTAU()r   r;   r   r   taur    r  r   c                 b    t          dt          |            dt          |           d          S )zPerforms a Term query on the specified field. Returns true if the
    provided term matches the row.

    :param field: Field that the query will target.
    :param query: Term you wish to find in the provided field.
    zTERM(r%   r   r   )r/   r   s     r   termr    s2     ""M'%.."M"MGENN"M"M"MNNNr   c           
          t          dt          |            dt          |           dt          |           d          S )a  Collects the top values for a field. Includes repeated values.

    :param field: The field to collect the top values for.
    :param limit: The maximum number of values to collect.
    :param order: The order to calculate the top values. Either `asc` or `desc`.
    zTOP(r%   r   r   )r/   r   r   s      r   topr    sF     "Dwu~~DDDD75>>DDD  r   c                 B    t          dt          |            d          S )zEncode a numeric to an aggregate_metric_double.

    :param number: Input value. The input can be a single- or multi-valued
                   column or an expression.
    zTO_AGGREGATE_METRIC_DOUBLE(r   r   r   s    r   to_aggregate_metric_doubler    s$     ""R"R"R"RSSSr   c                 B    t          dt          |            d          S )zFEncode a string to a base64 string.

    :param string: A string.
    z
TO_BASE64(r   r   r-   s    r   	to_base64r    s$    
 ""Awv"A"A"ABBBr   c                 B    t          dt          |            d          S )a  Converts an input value to a boolean value. A string value of `true`
    will be case-insensitive converted to the Boolean `true`. For anything
    else, including the empty string, the function will return `false`. The
    numerical value of `0` will be converted to `false`, anything else will be
    converted to `true`.

    :param field: Input value. The input can be a single- or multi-valued column
                  or an expression.
    zTO_BOOLEAN(r   r   rE   s    r   
to_booleanr    s$     ""A"A"A"ABBBr   c                 B    t          dt          |            d          S )a  Converts an input value to a `cartesian_point` value. A string will only
    be successfully converted if it respects the WKT Point format.

    :param field: Input value. The input can be a single- or multi-valued column
                  or an expression.
    zTO_CARTESIANPOINT(r   r   rE   s    r   to_cartesianpointr    $     ""Hwu~~"H"H"HIIIr   c                 B    t          dt          |            d          S )a   Converts an input value to a `cartesian_shape` value. A string will only
    be successfully converted if it respects the WKT format.

    :param field: Input value. The input can be a single- or multi-valued column
                  or an expression.
    zTO_CARTESIANSHAPE(r   r   rE   s    r   to_cartesianshaper    r  r   c                 B    t          dt          |            d          S )zConverts an input value into a `date_period` value.

    :param field: Input value. The input is a valid constant date period expression.
    zTO_DATEPERIOD(r   r   rE   s    r   to_dateperiodr    r   r   c                 B    t          dt          |            d          S )uM  Converts an input value to a date value. A string will only be
    successfully converted if it’s respecting the format
    `yyyy-MM-dd'T'HH:mm:ss.SSS'Z'`. To convert dates in other formats, use `DATE_PARSE`.

    :param field: Input value. The input can be a single- or multi-valued column
                  or an expression.
    zTO_DATETIME(r   r   rE   s    r   to_datetimer    s$     ""B"B"B"BCCCr   c                 B    t          dt          |            d          S )zConverts an input to a nanosecond-resolution date value (aka date_nanos).

    :param field: Input value. The input can be a single- or multi-valued column
                  or an expression.
    zTO_DATE_NANOS(r   r   rE   s    r   to_date_nanosr  !  rM  r   c                 B    t          dt          |            d          S )zConverts a number in radians to degrees).

    :param number: Input value. The input can be a single- or multi-valued
                   column or an expression.
    zTO_DEGREES(r   r   r   s    r   
to_degreesr  *  $     ""B"B"B"BCCCr   c                 B    t          dt          |            d          S )ax  Converts an input value to a double value. If the input parameter is of
    a date type, its value will be interpreted as milliseconds since the Unix
    epoch, converted to double. Boolean `true` will be converted to double
    `1.0`, `false` to `0.0`.

    :param field: Input value. The input can be a single- or multi-valued column
                  or an expression.
    z
TO_DOUBLE(r   r   rE   s    r   	to_doubler  3  s$     ""@wu~~"@"@"@AAAr   c                 B    t          dt          |            d          S )a   Converts an input value to a `geo_point` value. A string will only be
    successfully converted if it respects the WKT Point format.

    :param field: Input value. The input can be a single- or multi-valued column
                  or an expression.
    zTO_GEOPOINT(r   r   rE   s    r   to_geopointr  ?  $     ""B"B"B"BCCCr   c                 B    t          dt          |            d          S )zConverts an input value to a `geo_shape` value. A string will only be
    successfully converted if it respects the WKT format.

    :param field: Input value. The input can be a single- or multi-valued column
                  or an expression.
    zTO_GEOSHAPE(r   r   rE   s    r   to_geoshaper  I  r  r   c                 B    t          dt          |            d          S )ax  Converts an input value to an integer value. If the input parameter is
    of a date type, its value will be interpreted as milliseconds since the
    Unix epoch, converted to integer. Boolean `true` will be converted to
    integer `1`, `false` to `0`.

    :param field: Input value. The input can be a single- or multi-valued column
                  or an expression.
    zTO_INTEGER(r   r   rE   s    r   
to_integerr  S  s$     ""A"A"A"ABBBr   c                     |0t          dt          |            dt          |           d          S t          dt          |            d          S )zConverts an input string to an IP value.

    :param field: Input value. The input can be a single- or multi-valued column
                  or an expression.
    :param options: (Optional) Additional options.
    NzTO_IP(r%   r   r   )r/   r   s     r   to_ipr  _  sZ     %&Twu~~&T&TAQAQ&T&T&TUUU%&@wu~~&@&@&@AAAr   c                 B    t          dt          |            d          S )an  Converts an input value to a long value. If the input parameter is of a
    date type, its value will be interpreted as milliseconds since the Unix
    epoch, converted to long. Boolean `true` will be converted to long `1`,
    `false` to `0`.

    :param field: Input value. The input can be a single- or multi-valued column
                  or an expression.
    zTO_LONG(r   r   rE   s    r   to_longr  n  s$     "">WU^^">">">???r   c                 B    t          dt          |            d          S )a  Returns a new string representing the input string converted to lower case.

    :param str: String expression. If `null`, the function returns `null`. The
                input can be a single-valued column or expression, or a multi-valued
                column or expression.
    z	TO_LOWER(r   r   r  s    r   to_lowerr  z  $     ""=gcll"="="=>>>r   c                 B    t          dt          |            d          S )zConverts a number in degrees) to radians.

    :param number: Input value. The input can be a single- or multi-valued
                   column or an expression.
    zTO_RADIANS(r   r   r   s    r   
to_radiansr    r  r   c                 B    t          dt          |            d          S )zConverts an input value into a string.

    :param field: Input value. The input can be a single- or multi-valued column
                  or an expression.
    z
TO_STRING(r   r   rE   s    r   	to_stringr    s$     ""@wu~~"@"@"@AAAr   c                 B    t          dt          |            d          S )zConverts an input value into a `time_duration` value.

    :param field: Input value. The input is a valid constant time duration expression.
    zTO_TIMEDURATION(r   r   rE   s    r   to_timedurationr    rk   r   c                 B    t          dt          |            d          S )a  Converts an input value to an unsigned long value. If the input
    parameter is of a date type, its value will be interpreted as milliseconds
    since the Unix epoch, converted to unsigned long. Boolean `true` will be
    converted to unsigned long `1`, `false` to `0`.

    :param field: Input value. The input can be a single- or multi-valued column
                  or an expression.
    zTO_UNSIGNED_LONG(r   r   rE   s    r   to_unsigned_longr    s$     ""Ggenn"G"G"GHHHr   c                 B    t          dt          |            d          S )a  Returns a new string representing the input string converted to upper case.

    :param str: String expression. If `null`, the function returns `null`. The
                input can be a single-valued column or expression, or a multi-valued
                column or expression.
    z	TO_UPPER(r   r   r  s    r   to_upperr    r  r   c                 B    t          dt          |            d          S )zConverts an input string to a version value.

    :param field: Input value. The input can be a single- or multi-valued column
                  or an expression.
    zTO_VERSION(r   r   rE   s    r   
to_versionr    s$     ""A"A"A"ABBBr   c                 B    t          dt          |            d          S )zRemoves leading and trailing whitespaces from a string.

    :param string: String expression. If `null`, the function returns `null`.
    zTRIM(r   r   r-   s    r   trimr    r   r   c                 B    t          dt          |            d          S )u   Returns unique values as a multivalued field. The order of the returned
    values isn’t guaranteed. If you need the values returned in order use `MV_SORT`.

    :param field:
    zVALUES(r   r   rE   s    r   valuesr    r   r   weightc                 b    t          dt          |            dt          |           d          S )z|The weighted average of a numeric expression.

    :param number: A numeric value.
    :param weight: A numeric weight.
    zWEIGHTED_AVG(r%   r   r   )r   r  s     r   weighted_avgr    s2     ""W'&//"W"WWV__"W"W"WXXXr   r   )r   typingr   elasticsearch.dsl.document_baser   elasticsearch.esql.esqlr   r   r   r   r   r   r   r!   r&   r(   r*   r.   r4   r6   rC   rF   rH   rJ   rN   rS   rY   r]   r`   rb   rf   rh   rj   rp   rt   ru   rz   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r	  r  r  r  r  r  r  r  r  r"  r&  r(  r*  r,  r.  r0  r2  r4  r6  r9  r;  r=  rB  rE  rG  rJ  rL  rQ  rV  rY  r\  r^  r`  rb  rd  rf  rh  rj  rn  rq  rt  rv  rx  rz  r   r}  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r;   r   r   <module>r     s  $        B B B B B B < < < < < < < <s s    = =#9 = = = => >$: > > > >> >$: > > > >> >$: > > > > 0>   = =#9 = = = =G. G-C G G G GD~ D*@ D D D D  		
    ,E E+A E E E E	n 	)? 	 	 	 	Cn C)? C C C C> >$: > > > >> >$: > > > >T> TN T?U T T T TRN R. R=S R R R R^ (>    <~ <"8 < < < <> >$: > > > >> >$: > > > >&4   &4   H> H.D H H H H
+9JX    %3   0 #'G G
GG G G G G& /=   WW$2WW W W W)! ) ) ) )
S> S> S>T S S S S= =#9 = = = =H> H.D H H H H?. ?%; ? ? ? ?E E+A E E E ERN R. R=S R R R RSN S> S>T S S S SB> BN B?U B B B B$ % 	   " MQR RR"0R;IRR R R R&<~ <"8 < < < <G. G-C G G G GO O~ O:P O O O OQ Q Q<R Q Q Q Q@> @&< @ @ @ @'5>L    	Nn 	Nn 	N9O 	N 	N 	N 	N?. ?%; ? ? ? ??. ?%; ? ? ? ? MQT TT"0T;ITT T T T& MQ
 

"0
;I

 
 
 
*<~ <"8 < < < <F F,B F F F F<~ <"8 < < < <@> @&< @ @ @ @Sn S9O S S S S<~ <"8 < < < <F F,B F F F F OS
 
 

$2
=K

 
 
 
*Dn Dn DAW D D D D@> @&< @ @ @ @Un U^ U@V U U U UAN A'= A A A AB^ B(> B B B BAN A'= A A A A@> @&< @ @ @ @?. ?%; ? ? ? ?Cn C)? C C C CV V<R V V V V?. ?%; ? ? ? ?(6   -   " IMW WW"0W7EWW W W W.R> R. R=S R R R R@> @&< @ @ @ @ OSG GG&4G=KGG G G G +# + + + +
(6   *" * * * *
Pn P P;Q P P P P 6:A AA$2AA A A A = =#9 = = = =S> S> S>T S S S S#1?M   > >$: > > > >R. R. R=S R R R R 8<C CC&4CC C C C"TN TN T?U T T T T?. ?%; ? ? ? ?Q. Q Q<R Q Q Q Q
S^ 
S> 
S>T 
S 
S 
S 
S= =#9 = = = =?. ?%; ? ? ? ?@> @&< @ @ @ @<~ <"8 < < < <> >$: > > > >?. ?%; ? ? ? ?Q. Q Q<R Q Q Q Q> >$: > > > >U^ U^ U@V U U U UAN A'= A A A AH> H.D H H H HXX$2XX X X X$XX$2XX X X X&XX$2XX X X X$G. G-C G G G GF F,B F F F F SW
 

)7
AO

 
 
 
4M M3I M M M MO. O5K O O O O SW
 

)7
AO

 
 
 
4L~ L2H L L L LN N4J N N N N SW
 

)7
AO

 
 
 
4M M3I M M M MO. O5K O O O O$2   ,Vn Vn VAW V V V V = =#9 = = = =@> @&< @ @ @ @@> @&< @ @ @ @= =#9 = = = =@> @&< @ @ @ @@> @&< @ @ @ @ MQY YY#1Y;IYY Y Y Y&= =#9 = = = =<~ <"8 < < < <> >$: > > > >+# + + + +
O O~ O:P O O O O"09G   T~ T:P T T T TCn C)? C C C C
Cn 
C)? 
C 
C 
C 
CJ^ J0F J J J JJ^ J0F J J J JF F,B F F F FD~ D*@ D D D DF F,B F F F FD~ D*@ D D D D	B^ 	B(> 	B 	B 	B 	BD~ D*@ D D D DD~ D*@ D D D D	Cn 	C)? 	C 	C 	C 	C 6:B BB$2BB B B B	@> 	@&< 	@ 	@ 	@ 	@?. ?%; ? ? ? ?D~ D*@ D D D DB^ B(> B B B BH> H.D H H H H	IN 	I/E 	I 	I 	I 	I?. ?%; ? ? ? ?Cn C)? C C C C> >$: > > > >?. ?%; ? ? ? ?YY$2YY Y Y Y Y Yr   