This depends on #25093. Once the internal last cache has been set up and implements Datafusion's TableProvider, we can create the User-Defined Table Function (UDTF) implementation using Datafusion's TableFunctionImpl trait.
The API for this function should look like so:
last_cache(table_name, [cache_name])
table_name: the table in the database that has the last cache
cache_name (optional): if there are multiple last caches for a table, the name of the last cache must be passed
So, its usage would look like so
SELECT * FROM last_cache('cpu')
SELECT time, usage FROM last_cache('cpu', 'cpu_usage_cache')
The last cache can be combined with predicates to operate on keys used in the last cache:
SELECT * FROM last_cache('mem') WHERE host = 'us-east'
Getting this to work may require some upstream changes to influxdb3_core to extend the IOxSessionContext with the UDTF.
This depends on #25093. Once the internal last cache has been set up and implements Datafusion's
TableProvider
, we can create the User-Defined Table Function (UDTF) implementation using Datafusion'sTableFunctionImpl
trait.The API for this function should look like so:
table_name
: the table in the database that has the last cachecache_name
(optional): if there are multiple last caches for a table, the name of the last cache must be passedSo, its usage would look like so
The last cache can be combined with predicates to operate on keys used in the last cache:
Getting this to work may require some upstream changes to
influxdb3_core
to extend theIOxSessionContext
with the UDTF.