Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sql): fix comparing Date columns with date literals #3862

Merged
merged 38 commits into from
Oct 31, 2023

Commits on Oct 17, 2023

  1. chore(sql): implement Date comparisons

    Consider this query: `select * from tab where date = '1970-01-01'`
    
    Without these new functions QuestDB resorts to picking the overloaded
    equal function which accepts 2 longs. Why?
    1. There is no exact match for eq(Date, Date) - such function does not exist at all!
    2. The date column is `DateColumn` and the Date type can be casted to Long.
       See the overloading priority: /* 7  DATE      */, {DATE, TIMESTAMP, LONG}
    3. The second parameter is `StrConstant` and String can be also casted to Long.
       Again, the overloading priority:  /* 11 STRING    */, {STRING, CHAR, DOUBLE, LONG, INT, FLOAT, SHORT, BYTE}
    4. Hence, the function parser picks eq(Long, Long).
    
    But then the `StrFunction.getLong()` fails to parse '1970-01-01' as a long.
    It expects a simple number. It does not know it's supposed to treat the argument as a Date.
    
    The same query works if you change the column type from Date to Timestamp.
    Why? Timestamp does not rely on casting - it implements Timestamp-specific
    functions where necessary. So I copied this for Date.
    jerrinot committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    fa7cd43 View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2023

  1. support dates without any explicit timezone

    treat such timestamps as UTC
    jerrinot committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    23ca87d View commit details
    Browse the repository at this point in the history
  2. explicit and implicit String -> Date casting tries to use the same pa…

    …tterns
    
    also: more tests for Date casting
    jerrinot committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    b0f2c03 View commit details
    Browse the repository at this point in the history
  3. more tests

    jerrinot committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    ad5ed44 View commit details
    Browse the repository at this point in the history
  4. more tests

    jerrinot committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    9cd8356 View commit details
    Browse the repository at this point in the history

Commits on Oct 19, 2023

  1. Configuration menu
    Copy the full SHA
    0c9ad67 View commit details
    Browse the repository at this point in the history
  2. superfluous check removed

    jerrinot committed Oct 19, 2023
    Configuration menu
    Copy the full SHA
    7861dd3 View commit details
    Browse the repository at this point in the history
  3. test

    jerrinot committed Oct 19, 2023
    Configuration menu
    Copy the full SHA
    f954113 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2023

  1. Configuration menu
    Copy the full SHA
    2835a07 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    91824cf View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ff20138 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    319ad4e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    3a81fd4 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    0a04dda View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    531d590 View commit details
    Browse the repository at this point in the history

Commits on Oct 25, 2023

  1. Configuration menu
    Copy the full SHA
    bd82f44 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d9fabf4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    aab69a3 View commit details
    Browse the repository at this point in the history
  4. improve exception message

    marregui committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    5bd3ffd View commit details
    Browse the repository at this point in the history
  5. fix tests

    marregui committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    df50ba9 View commit details
    Browse the repository at this point in the history
  6. improve readability

    marregui committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    f268df7 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    a570817 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    41fefc2 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    ccfef4a View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    88202b3 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    a287a9c View commit details
    Browse the repository at this point in the history
  12. more improvements

    marregui committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    c11e0ef View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    242638f View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    89d8ffc View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    8f64afa View commit details
    Browse the repository at this point in the history
  16. remove debris

    marregui committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    6e1f117 View commit details
    Browse the repository at this point in the history

Commits on Oct 26, 2023

  1. Configuration menu
    Copy the full SHA
    9ff8c32 View commit details
    Browse the repository at this point in the history
  2. experiment: avoid special-casing in FunctionParser

    for =() only. for now.
    jerrinot committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    08a6963 View commit details
    Browse the repository at this point in the history

Commits on Oct 27, 2023

  1. Revert "experiment: avoid special-casing in FunctionParser"

    This reverts commit 08a6963.
    jerrinot committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    4ac28f4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1a904f5 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    bf5694c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0b6b8ad View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2023

  1. Configuration menu
    Copy the full SHA
    9797707 View commit details
    Browse the repository at this point in the history