GreptimeTeam / greptimedb

An Open-Source, Cloud-Native, Unified Time Series Database for Metrics, Events, and Logs with SQL/PromQL supported. Available on GreptimeCloud.
https://greptime.com/
Apache License 2.0
4k stars 289 forks source link

chore: bump datafusion version to fix `last_value` regression #4169

Closed MichaelScofield closed 4 weeks ago

MichaelScofield commented 4 weeks ago

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

... to the datafusion commit with PR https://github.com/apache/datafusion/pull/10783.

Now last_value with string arg works:

mysql> select last_value('3');
+-----------------------+
| last_value(Utf8("3")) |
+-----------------------+
| 3                     |
+-----------------------+
1 row in set (0.04 sec)

Also fix #4096 :

mysql> CREATE TABLE monitor (
    ->   host STRING,
    ->   ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP() TIME INDEX,
    ->   cpu FLOAT64 DEFAULT 0,
    ->   memory FLOAT64,
    ->   PRIMARY KEY(host)) ENGINE=mito;
Query OK, 0 rows affected (0.04 sec)

mysql> INSERT INTO monitor
    -> VALUES
    ->     ("127.0.0.1", 1, 0.5, 0.9),
    ->     ("127.0.0.2", 2, 0.6, 0.8),
    ->     ("127.0.0.3", 3, 0.7, 0.7),
    ->     ("127.0.0.4", 4, 0.8, 0.6),
    ->     ("127.0.0.4", 5, 0.9, 0.5),
    ->     ("127.0.0.5", 6, 1.0, 0.4);
Query OK, 6 rows affected (0.01 sec)

mysql> select last_value(cpu order by ts) from monitor;
+--------------------------------------------------------------+
| last_value(monitor.cpu) ORDER BY [monitor.ts ASC NULLS LAST] |
+--------------------------------------------------------------+
|                                                            1 |
+--------------------------------------------------------------+
1 row in set (0.05 sec)

mysql> select first_value(cpu order by ts) from monitor;
+---------------------------------------------------------------+
| first_value(monitor.cpu) ORDER BY [monitor.ts ASC NULLS LAST] |
+---------------------------------------------------------------+
|                                                           0.5 |
+---------------------------------------------------------------+
1 row in set (0.03 sec)

Checklist

killme2008 commented 4 weeks ago

It's better to add a sqlness test to https://github.com/GreptimeTeam/greptimedb/blob/main/tests/cases/standalone/common/function/expression.sql

codecov[bot] commented 4 weeks ago

Codecov Report

Attention: Patch coverage is 40.90909% with 26 lines in your changes missing coverage. Please review.

Project coverage is 84.83%. Comparing base (22d1268) to head (b52ec05).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #4169 +/- ## ========================================== - Coverage 85.16% 84.83% -0.33% ========================================== Files 1020 1020 Lines 179630 179635 +5 ========================================== - Hits 152976 152392 -584 - Misses 26654 27243 +589 ```
fengjiachun commented 4 weeks ago

This PR also fixed #4096