yaooqinn opened a new pull request #26702: [PARK-30070][SQL] Support datetimes 
predicate - overlaps
URL: https://github.com/apache/spark/pull/26702
 
 
   ### What changes were proposed in this pull request?
   ```scala
    * The operator `OVERLAPS` determines whether or not two chronological 
periods overlap in time. A
    * chronological period is specified by a pair of datetimes (starting and 
ending).
    *
    * If the length of the period is greater than 0, then the period consists 
of all points of time
    * greater than or equal to the lower endpoint, and less than the upper 
endpoint,
    * a.k.a [lower, upper).
    *
    * If the length of the period is equal to 0, then the period consists of a 
single point in time,
    * the lower endpoint, a.k.a [lower, lower].
    *
    * Two periods overlap if they have at least one point in common.
   ```
   
   ```sql
   postgres=# select (cast(a as timestamp), cast(b as timestamp)) overlaps 
(cast(c as timestamp), cast(d as timestamp)) from (values
    ('2011-11-11', '2011-11-11', '2011-11-11', '2011-11-11'),
    ('2011-11-10', '2011-11-11', '2011-11-11', '2011-11-12'),
    ('2011-11-11', '2011-11-10', '2011-11-11', '2011-11-12'),
    ('2011-11-11', '2011-11-10', '2011-11-12', '2011-11-11'),
    ('2011-11-10', '2011-11-11', '2011-11-12', '2011-11-13'),
    ('2011-11-10', '2011-11-20', '2011-11-11', '2011-11-19'),
    ('2011-11-11', '2011-11-19', '2011-11-10', '2011-11-20')) t(a,b,c,d);
    overlaps
   ----------
    t
    f
    f
    f
    f
    t
    t
   (7 rows)
   ```
   
   Checked PostgreSQL, it support datetimes in pairs but without support for 
datetime + interval, so I decide we support the former and leave the latter to 
a followup.
   
   ### Why are the changes needed?
   
   ANSI support FeatureID: F053
   
   Better PostgreSQL feature parity too.
   
   
   ### Does this PR introduce any user-facing change?
   
   Yes, add a datetime predicate.
   
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some 
test cases that check the changes thoroughly including negative and positive 
cases if possible.
   If it was tested in a way different from regular unit tests, please clarify 
how you tested step by step, ideally copy and paste-able, so that other 
reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why 
it was difficult to add.
   -->
   add ut

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to