Skip to content

Commit

Permalink
Support for non-u64 types for Window Bound (#3916)
Browse files Browse the repository at this point in the history
* Support for non u64 values inside window frames

* timestamp handling is added

* get_rank removed

* Tidy up datetime arithmetic, get rid of unwraps

* new test for validity, during window frame creation is added

* window_bound is changed to Expr (#6)

* give fixed commit hash as dependency

* remove locked flag

* Simplify some frame bound conversion functions

* Make things work the new sqlparser

* Upgrade sqlparser version to 0.26

* Minor changes

* type coercion for window frames moved to the optimizer.

Co-authored-by: Mehmet Ozan Kabak <[email protected]>
  • Loading branch information
mustafasrepo and ozankabak authored Oct 26, 2022
1 parent 4e29835 commit 3940e36
Show file tree
Hide file tree
Showing 29 changed files with 926 additions and 695 deletions.
146 changes: 102 additions & 44 deletions datafusion-cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion datafusion/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ pyarrow = ["pyo3", "arrow/pyarrow"]
[dependencies]
apache-avro = { version = "0.14", default-features = false, features = ["snappy"], optional = true }
arrow = { version = "25.0.0", default-features = false }
chrono = { version = "0.4", default-features = false }
cranelift-module = { version = "0.89.0", optional = true }
object_store = { version = "0.5.0", default-features = false, optional = true }
ordered-float = "3.0"
parquet = { version = "25.0.0", default-features = false, optional = true }
pyo3 = { version = "0.17.1", optional = true }
sqlparser = "0.25"
sqlparser = "0.26"
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use chrono::Datelike;

/// Returns true if the year is a leap-year, as naively defined in the Gregorian calendar.
#[inline]
pub(crate) fn is_leap_year(year: i32) -> bool {
fn is_leap_year(year: i32) -> bool {
year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)
}

Expand All @@ -49,7 +49,7 @@ fn normalise_day(year: i32, month: u32, day: u32) -> u32 {

/// Shift a date by the given number of months.
/// Ambiguous month-ends are shifted backwards as necessary.
pub(crate) fn shift_months<D: Datelike>(date: D, months: i32) -> D {
pub fn shift_months<D: Datelike>(date: D, months: i32) -> D {
let mut year = date.year() + (date.month() as i32 + months) / 12;
let mut month = (date.month() as i32 + months) % 12;
let mut day = date.day();
Expand Down
Loading

0 comments on commit 3940e36

Please sign in to comment.