Skip to content

Commit

Permalink
feat: support window functions (#224)
Browse files Browse the repository at this point in the history
Co-authored-by: Jacques Nadeau <jacques@apache.org>
  • Loading branch information
weijietong and jacques-n authored Jul 25, 2022
1 parent b8fb06a commit 4b2072a
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
56 changes: 56 additions & 0 deletions extensions/functions_arithmetic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -362,3 +362,59 @@ aggregate_functions:
decomposable: MANY
intermediate: fp64?
return: fp64?
window_functions:
- name: "row_number"
description: "the number of the current row within its partition."
impls:
- args: []
nullability: DECLARED_OUTPUT
decomposable: NONE
return: i64?
window_type: PARTITION
- name: "rank"
description: "the rank of the current row, with gaps."
impls:
- args: []
nullability: DECLARED_OUTPUT
decomposable: NONE
return: i64?
window_type: PARTITION
- name: "dense_rank"
description: "the rank of the current row, without gaps."
impls:
- args: []
nullability: DECLARED_OUTPUT
decomposable: NONE
return: i64?
window_type: PARTITION
- name: "percent_rank"
description: "the relative rank of the current row."
impls:
- args: []
nullability: DECLARED_OUTPUT
decomposable: NONE
return: fp64?
window_type: PARTITION
- name: "cume_dist"
description: "the cumulative distribution."
impls:
- args: []
nullability: DECLARED_OUTPUT
decomposable: NONE
return: fp64?
window_type: PARTITION
- name: "ntile"
description: "Return an integer ranging from 1 to the argument value,dividing the partition as equally as possible."
impls:
- args:
- value: i32
nullability: DECLARED_OUTPUT
decomposable: NONE
return: i32?
window_type: PARTITION
- args:
- value: i64
nullability: DECLARED_OUTPUT
decomposable: NONE
return: i64?
window_type: PARTITION
7 changes: 6 additions & 1 deletion text/simple_extensions_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ properties:
type: array
items:
$ref: "#/$defs/aggregateFunction"
window_functions:
type: array
items:
$ref: "#/$defs/windowFunction"

$defs:
type:
Expand Down Expand Up @@ -220,6 +224,7 @@ $defs:
$ref: "#/$defs/maxset"
decomposable:
$ref: "#/$defs/decomposable"

windowFunction:
type: object
additionalProperties: false
Expand All @@ -235,7 +240,7 @@ $defs:
items:
type: object
additionalProperties: false
required: [ intermediate, return ]
required: [ return ]
properties:
args:
$ref: "#/$defs/arguments"
Expand Down

0 comments on commit 4b2072a

Please sign in to comment.