sql-functions 0.1.3

A library of dialect specific SQL Functions
Documentation
---
function:
  name: if
  kind: scalar
  parameters:
    - datatype: boolean
    - datatype: $1
    - datatype: $1
  returns: 
    datatype: $1
---
function:
  name: try
  kind: scalar
  parameters:
    - datatype: $1
  returns:
    datatype: $1
---
function:
  name: current_time
  kind: scalar
  parameters: []
  returns:
    datatype: time
  special: true
---
function:
  name: current_timestamp
  kind: scalar
  parameters: []
  returns:
    datatype: timestamp
  special: true
---
function:
  name: current_timestamp
  kind: scalar
  parameters:
    - datatype: bigint
      constant: "0"
  returns:
    datatype: timestamp(0)
---
function:
  name: current_timestamp
  kind: scalar
  parameters:
    - datatype: bigint
      constant: "3"
  returns:
    datatype: timestamp(3)
---
function:
  name: current_timestamp
  kind: scalar
  parameters:
    - datatype: bigint
      constant: "6"
  returns:
    datatype: timestamp(6)
---
function:
  name: current_timestamp
  kind: scalar
  parameters:
    - datatype: bigint
      constant: "9"
  returns:
    datatype: timestamp(9)
---
function:
  name: localtime
  kind: scalar
  parameters: []
  returns:
    datatype: time
  special: true
---
function:
  name: localtimestamp
  kind: scalar
  parameters: []
  returns:
    datatype: timestamp
  special: true
---
function:
  name: localtimestamp
  kind: scalar
  parameters:
    - datatype: bigint
      constant: "0"
  returns:
    datatype: timestamp(0)
---
function:
  name: localtimestamp
  kind: scalar
  parameters:
    - datatype: bigint
      constant: "3"
  returns:
    datatype: timestamp(3)
---
function:
  name: localtimestamp
  kind: scalar
  parameters:
    - datatype: bigint
      constant: "6"
  returns:
    datatype: timestamp(6)
---
function:
  name: localtimestamp
  kind: scalar
  parameters:
    - datatype: bigint
      constant: "9"
  returns:
    datatype: timestamp(9)
---
function:
  name: current_user
  kind: scalar
  parameters: []
  returns:
    datatype: varchar
  special: true
---
function:
  name: current_catalog
  kind: scalar
  parameters: []
  returns:
    datatype: varchar
  special: true
---
function:
  name: current_schema
  kind: scalar
  parameters: []
  returns:
    datatype: varchar
  special: true
---
function:
  name: format
  kind: scalar
  parameters:
    - datatype: varchar
    - datatype: $1
  returns:
    datatype: varchar
---
function:
  name: format
  kind: scalar
  parameters:
    - datatype: varchar
    - datatype: $1
    - datatype: $2
  returns:
    datatype: varchar
---
function:
  name: format
  kind: scalar
  parameters:
    - datatype: varchar
    - datatype: $1
    - datatype: $2
    - datatype: $3
  returns:
    datatype: varchar
---
function:
  name: format
  kind: scalar
  parameters:
    - datatype: varchar
    - datatype: $1
    - datatype: $2
    - datatype: $3
    - datatype: $4
  returns:
    datatype: varchar
---
function:
  name: format
  kind: scalar
  parameters:
    - datatype: varchar
    - datatype: $1
    - datatype: $2
    - datatype: $3
    - datatype: $4
    - datatype: $5
  returns:
    datatype: varchar
---
function:
  name: reclassify
  kind: scalar
  parameters:
    - datatype: T
    - datatype: varchar
    - datatype: varchar
  returns:
    datatype: T
  description:
    "Changes the classification label of the first argument from the expected
    classifier specified by the second argument to the desired classifier
    specified by the third. The expected and desired classifiers
    must belong to the same classifier group. No other classifiers attached to
    the first argument are impacted. The function will emit a warning if the
    the first argument does not have the expected classifier"
  examples:
    - input: select reclassify(12345, 'pii.clear_text', 'pii.masked') as value;
      output: "12345"
  section: other
---
function:
  name: reclassify
  kind: scalar
  parameters:
    - datatype: T
    - datatype: varchar
  returns:
    datatype: T
  description: "Changes the classification label of the first argument
    to the desired classifier specified by the second argument. The first
    argument is expected to have one or more classifiers from the same
    classifier group as the desired classifier. All of these classifiers
    will be removed and replaced by the desired classifier. No other classifiers
    attached to the first argument will be impacted. The function will emit a warning
    if the first argument does not have a classifier from the expected classifier group"
  examples:
    - input: select reclassify(12345, 'pii.masked') as value;
      output: "12345"
  section: other
---
function:
  name: "+"
  kind: scalar
  parameters:
    - datatype: time
    - datatype: $1
  returns:
    datatype: time
  binds:
    - type-variable: $1
      datatypes:
        - interval day to second
        - interval year to month
---
function:
  name: "-"
  kind: scalar
  parameters:
    - datatype: time
    - datatype: $1
  returns:
    datatype: time
  binds:
    - type-variable: $1
      datatypes:
        - interval day to second
        - interval year to month
---
# Note: this is here because the binder maps certain types of calls to `trim` to
# `btrim`:
function:
  name: btrim
  parameters:
  - datatype: varchar
  optional-parameters: []
  returns:
    datatype: varchar
---
# Note: this is here because the binder maps certain types of calls to `trim` to
# `btrim`:
function:
  name: btrim
  parameters:
  - datatype: varchar
  - datatype: varchar
  optional-parameters: []
  returns:
    datatype: varchar
---
# Note: this is here to compat our Clickbench test suite, which is currently
# using the Datafusion version. Remove once we move Clickbench to use the Trino
# version:
function:
  name: to_timestamp_seconds
  variadic: any
  parameters:
    - datatype: $1
  optional-parameters: []
  returns:
    datatype: timestamp
  implemented-by: !datafusion
---
function:
  name: make_array
  variadic: uniform
  parameters:
    - datatype: $1
  returns:
    datatype: array<$1>
  implemented-by: !datafusion
---
function:
  name: length_array
  kind: scalar
  parameters:
    - datatype: array<$1>
  returns:
    datatype: bigint
  implemented-by: !datafusion
    udf: array_length