Skip to content

Consider support date and timestamp comparison and minus operator #1852

@xd1313113

Description

@xd1313113

Description

  • consider supporting date and timestamp comparison and minus operator.
  • We need to cast internally from date to timestamp or timestamp to date to do comparison. However, different cast may lead different result. We need to have a discussion how to implement it.
partiql ▶ cast (date '2000-01-01' as timestamp) >= timestamp '2000-01-01 10:00:00.000'
   | 

=== RESULT ===
false

OK!
partiql ▶ date '2000-01-01' >= cast (timestamp '2000-01-01 10:00:00.000' as date)
   | 

=== RESULT ===
true

OK!

To Reproduce

Steps to reproduce the behavior:

partiql ▶ date '2000-01-02' > timestamp '2000-01-01 01:00:00.000'
   | 
w: [semantic] Undefined function "gt"(DATE, TIMESTAMP(6)).

=== RESULT ===
missing

OK!
partiql ▶ date '2000-01-02' - timestamp '2000-01-01 01:00:00.000'
   | 
w: [semantic] Undefined function "minus"(DATE, TIMESTAMP(6)).

=== RESULT ===
missing

Expected Behavior

  • < A clear and concise description of what you expected to happen. >

Additional Context

  • Java version: XXX
  • PartiQL version: XXX
  • Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions