Skip to content

Commit 65faebb

Browse files
authored
Add 'last_cache' and 'distinct_cache' SQL functions (#5828)
* add last_value and distinct_value sql functions * fixed cache function names
1 parent a3f06ce commit 65faebb

File tree

4 files changed

+95
-5
lines changed

4 files changed

+95
-5
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: SQL cache functions
3+
list_title: Cache functions
4+
description: >
5+
Retrieve cached data from {{< product-name >}} caches.
6+
menu:
7+
influxdb3_core:
8+
name: Cache
9+
parent: sql-functions
10+
weight: 311
11+
12+
source: /shared/sql-reference/functions/cache.md
13+
---
14+
15+
<!--
16+
The content for this page is at /content/shared/sql-reference/functions/cache.md
17+
-->
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: SQL cache functions
3+
list_title: Cache functions
4+
description: >
5+
Retrieve cached data from {{< product-name >}} caches.
6+
menu:
7+
influxdb3_enterprise:
8+
name: Cache
9+
parent: sql-functions
10+
weight: 311
11+
12+
source: /shared/sql-reference/functions/cache.md
13+
---
14+
15+
<!--
16+
The content for this page is at /content/shared/sql-reference/functions/cache.md
17+
-->

content/shared/influxdb3-sample-data/sample-data.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ to
2525

2626
##### Schema
2727

28-
- home <em style="opacity: .5">(measurement)</em>
28+
- home <em style="opacity: .5">(table)</em>
2929
- **tags**:
3030
- room
3131
- Kitchen
@@ -208,7 +208,7 @@ to
208208

209209
##### Schema
210210

211-
- home_actions <em style="opacity: .5">(measurement)</em>
211+
- home_actions <em style="opacity: .5">(table)</em>
212212
- **tags**:
213213
- room
214214
- Kitchen
@@ -336,7 +336,7 @@ series use cases that involve seasonality.
336336

337337
##### Schema
338338

339-
- weather <em style="opacity: .5">(measurement)</em>
339+
- weather <em style="opacity: .5">(table)</em>
340340
- **tags**:
341341
- location
342342
- Concord
@@ -430,7 +430,7 @@ The Bitcoin price sample dataset provides Bitcoin prices from
430430

431431
##### Schema
432432

433-
- bitcoin <em style="opacity: .5">(measurement)</em>
433+
- bitcoin <em style="opacity: .5">(table)</em>
434434
- **tags**:
435435
- code
436436
- EUR
@@ -518,7 +518,7 @@ transformation functions.
518518

519519
##### Schema
520520

521-
- numbers <em style="opacity: .5">(measurement)</em>
521+
- numbers <em style="opacity: .5">(table)</em>
522522
- **fields**
523523
- a <em style="opacity: .5">(float between -1 and 1)</em>
524524
- b <em style="opacity: .5">(float between -3 and 3)</em>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
The {{< product-name >}} SQL implementation supports the following functions
3+
that return data from {{< product-name >}} caches.
4+
5+
- [distinct_cache](#distinct_cache)
6+
- [last_cache](#last_cache)
7+
8+
## distinct_cache
9+
10+
Returns data from an {{< product-name >}} distinct value cache.
11+
12+
```sql
13+
distinct_cache(table_name, cache_name)
14+
```
15+
16+
#### Arguments
17+
18+
- **table_name**: Name of the table associated with the distinct value cache
19+
_(formatted as a string literal)_.
20+
- **datatype**: Name of the the distinct value cache to query
21+
_(formatted as a string literal)_.
22+
23+
{{< expand-wrapper >}}
24+
{{% expand "View `distinct_cache` query example" %}}
25+
26+
```sql
27+
SELECT * FROM distinct_cache('example_table', 'exampleCacheName')
28+
```
29+
30+
{{% /expand %}}
31+
{{< /expand-wrapper >}}
32+
33+
## last_cache
34+
35+
Returns data from an {{< product-name >}} last value cache.
36+
37+
```sql
38+
last_cache(table_name, cache_name)
39+
```
40+
41+
#### Arguments
42+
43+
- **table_name**: Name of the table associated with the last value cache
44+
_(formatted as a string literal)_.
45+
- **datatype**: Name of the the last value cache to query
46+
_(formatted as a string literal)_.
47+
48+
{{< expand-wrapper >}}
49+
{{% expand "View `last_cache` query example" %}}
50+
51+
```sql
52+
SELECT * FROM last_cache('example_table', 'exampleCacheName')
53+
```
54+
55+
{{% /expand %}}
56+
{{< /expand-wrapper >}}

0 commit comments

Comments
 (0)