Skip to content

Commit

Permalink
Fix incorrect function output types and add other common functions. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jacques-n authored Mar 28, 2022
1 parent f64e5e1 commit e9fb703
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 7 deletions.
10 changes: 10 additions & 0 deletions extensions/functions_aggregate_generic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,13 @@ aggregate_functions:
decomposable: MANY
intermediate: i64
return: i64
- name: "count"
description: "Count a set of records (not field referenced)"
impls:
- args:
- options: [SILENT, SATURATE, ERROR]
required: false
nullability: DECLARED_OUTPUT
decomposable: MANY
intermediate: i64
return: i64
13 changes: 11 additions & 2 deletions extensions/functions_boolean.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ scalar_functions:
impls:
- args:
- value: boolean
- value: boolean
variadic:
min: 2
return: boolean
-
name: and
description: The boolean and of two values using Kleene logic.
impls:
- args:
- value: boolean
- value: boolean
variadic:
min: 2
return: boolean
-
name: xor
Expand All @@ -33,3 +35,10 @@ scalar_functions:
- value: boolean
- value: boolean
return: boolean
-
name: not
description: The not of a boolean value.
impls:
- args:
- value: boolean
return: boolean
11 changes: 11 additions & 0 deletions extensions/functions_cast.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
%YAML 1.2
---
scalar_functions:
-
name: cast
description: Cast one type to another.
impls:
- args:
- value: any1
- type: output
return: output
55 changes: 51 additions & 4 deletions extensions/functions_comparison.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,69 @@ scalar_functions:
- args:
- value: any1
- value: any1
return: BOOLEAN?
return: BOOLEAN
-
name: "equal"
description: Whether two values are equal (nulls are considered unequal).
impls:
- args:
- value: any1
- value: any1
return: BOOLEAN?
return: BOOLEAN
-
name: "is_not_distinct_from"
description: Whether two values are equal (nulls are considered equal).
impls:
- args:
- value: any1
- value: any1
return: BOOLEAN?
# TODO: add lt, gt, lte, gte, compare
return: BOOLEAN
-
name: "lt"
description: Less than
impls:
- args:
- value: any1
- value: any1
return: BOOLEAN
-
name: "gt"
description: Less than
impls:
- args:
- value: any1
- value: any1
return: BOOLEAN
-
name: "lte"
description: Less than or equal to
impls:
- args:
- value: any1
- value: any1
return: BOOLEAN
-
name: "gte"
description: Less than or equal to
impls:
- args:
- value: any1
- value: any1
return: BOOLEAN
-
name: "is_null"
description: Whether a value is null.
impls:
- args:
- value: any1
return: BOOLEAN
nullability: DECLARED_OUTPUT
-
name: "is_not_null"
description: Whether a value is not null.
impls:
- args:
- value: any1
return: BOOLEAN
nullability: DECLARED_OUTPUT

96 changes: 96 additions & 0 deletions extensions/functions_datetime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,99 @@ scalar_functions:
- value: date
- value: interval_day
return: date
-
name: "lte"
description: less than or equal to
impls:
- args:
- value: timestamp
- value: timestamp
return: boolean
- args:
- value: timestamp_tz
- value: timestamp_tz
return: boolean
- args:
- value: date
- value: date
return: boolean
- args:
- value: interval_day
- value: interval_day
return: boolean
- args:
- value: interval_year
- value: interval_year
return: boolean
-
name: "lt"
description: less than
impls:
- args:
- value: timestamp
- value: timestamp
return: boolean
- args:
- value: timestamp_tz
- value: timestamp_tz
return: boolean
- args:
- value: date
- value: date
return: boolean
- args:
- value: interval_day
- value: interval_day
return: boolean
- args:
- value: interval_year
- value: interval_year
return: boolean
-
name: "gte"
description: less than or equal to
impls:
- args:
- value: timestamp
- value: timestamp
return: boolean
- args:
- value: timestamp_tz
- value: timestamp_tz
return: boolean
- args:
- value: date
- value: date
return: boolean
- args:
- value: interval_day
- value: interval_day
return: boolean
- args:
- value: interval_year
- value: interval_year
return: boolean
-
name: "gt"
description: less than
impls:
- args:
- value: timestamp
- value: timestamp
return: boolean
- args:
- value: timestamp_tz
- value: timestamp_tz
return: boolean
- args:
- value: date
- value: date
return: boolean
- args:
- value: interval_day
- value: interval_day
return: boolean
- args:
- value: interval_year
- value: interval_year
return: boolean
32 changes: 31 additions & 1 deletion extensions/functions_string.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,34 @@ scalar_functions:
- value: "string"
- value: "string"
return: "string"
# TODO: add like, concat, substring, string specific cross type equalities.
-
name: like
description: Are two strings like each other.
impls:
- args:
- value: "varchar<L1>"
- value: "varchar<L2>"
return: "BOOLEAN"
- args:
- value: "string"
- value: "string"
return: "BOOLEAN"
-
name: substring
description: Extract a portion of a string from another string.
impls:
- args:
- value: "varchar<L1>"
- value: i32
- value: i32
return: "varchar<L1>"
- args:
- value: "string"
- value: i32
- value: i32
return: "string"
- args:
- value: "fixedchar<l1>"
- value: i32
- value: i32
return: "string"

0 comments on commit e9fb703

Please sign in to comment.