A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.greptime.com/reference/sql/functions/overview/ below:

Functions | GreptimeDB Documentation

Functions Datafusion Functions

Since GreptimeDB's query engine is built based on Apache Arrow DataFusion, GreptimeDB inherits all built-in functions in DataFusion. These functions include:

To find all the DataFusion functions, please refer to DataFusion Functions.

arrow_cast

arrow_cast function is from DataFusion's arrow_cast. It's illustrated as:

arrow_cast(expression, datatype)

Where the datatype can be any valid Arrow data type in this list. The four timestamp types are:

(Notice that the None means the timestamp is timezone naive)

GreptimeDB Functions String Functions

DataFusion String Function.

GreptimeDB provides:

For details, read the Query Logs.

Math Functions

DataFusion Math Function.

GreptimeDB provides:

SELECT CLAMP(10, 0, 1);

+
| clamp(Int64(10),Int64(0),Int64(1)) |
+
| 1 |
+
SELECT CLAMP(0.5, 0, 1)

+
| clamp(Float64(0.5),Int64(0),Int64(1)) |
+
| 0.5 |
+
SELECT mod(18, 4);

+
| mod(Int64(18),Int64(4)) |
+
| 2 |
+
Date and Time Functions

DataFusion Time and Date Function. GreptimeDB provides:

date_add
SELECT date_add('2023-12-06'::DATE, '3 month 5 day');
+----------------------------------------------------+
| date_add(Utf8("2023-12-06"),Utf8("3 month 5 day")) |
+----------------------------------------------------+
| 2024-03-11 |
+----------------------------------------------------+
data_sub
SELECT date_sub('2023-12-06 07:39:46.222'::TIMESTAMP_MS, '5 day'::INTERVAL);
+-----------------------------------------------------------------------------------------------------------------------------------------+
| date_sub(arrow_cast(Utf8("2023-12-06 07:39:46.222"),Utf8("Timestamp(Millisecond, None)")),IntervalMonthDayNano("92233720368547758080")) |
+-----------------------------------------------------------------------------------------------------------------------------------------+
| 2023-12-01 07:39:46.222000 |
+-----------------------------------------------------------------------------------------------------------------------------------------+
date_format
SELECT date_format('2023-12-06 07:39:46.222'::TIMESTAMP, '%Y-%m-%d %H:%M:%S:%3f');
+-----------------------------------------------------------------------------------------------------------------------------+
| date_format(arrow_cast(Utf8("2023-12-06 07:39:46.222"),Utf8("Timestamp(Millisecond, None)")),Utf8("%Y-%m-%d %H:%M:%S:%3f")) |
+-----------------------------------------------------------------------------------------------------------------------------+
| 2023-12-06 07:39:46:222 |
+-----------------------------------------------------------------------------------------------------------------------------+

Supported specifiers refer to the chrono::format::strftime module.

to_unixtime
select to_unixtime('2023-03-01T06:35:02Z');
+-------------------------------------------+
| to_unixtime(Utf8("2023-03-01T06:35:02Z")) |
+-------------------------------------------+
| 1677652502 |
+-------------------------------------------+
select to_unixtime('2023-03-01'::date);
+---------------------------------+
| to_unixtime(Utf8("2023-03-01")) |
+---------------------------------+
| 1677628800 |
+---------------------------------+
timezone
+------------+
| timezone() |
+------------+
| UTC |
+------------+
System Functions
 SELECT isnull(1);

+
| isnull(Int64(1)) |
+
| 0 |
+
SELECT isnull(NULL);

+
| isnull(NULL) |
+
| 1 |
+
select database();

+
| database() |
+
| public |
+
Admin Functions

GreptimeDB provides ADMIN statement to run the administration functions, please refer to ADMIN reference.

JSON Functions

GreptimeDB provide functions for jsons. Learn more about these functions

Geospatial Functions

GreptimeDB provide functions for geo-index, trajectory analytics. Learn more about these functions

Vector Functions

GreptimeDB supports vector functions for vector operations, such as distance calculation, similarity measurement, etc. Learn more about these functions

Approximate Functions

GreptimeDB supports some approximate functions for data analysis, such as approximate count distinct(hll), approximate quantile(uddsketch), etc. Learn more about these functions


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4