This is an automated email from the ASF dual-hosted git repository.
agrove pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 12b473b08b Change input for `to_timestamp` function to be seconds
rather than nanoseconds, add `to_timestamp_nanos` (#7844)
12b473b08b is described below
commit 12b473b08bfc7f64f67b977ffb2252ac09a502ab
Author: comphead <[email protected]>
AuthorDate: Thu Oct 26 07:29:32 2023 -0700
Change input for `to_timestamp` function to be seconds rather than
nanoseconds, add `to_timestamp_nanos` (#7844)
* Change input for `to_timestamp` function
* docs
* fix examples
* output `to_timestamp` signature as ns
---
datafusion/core/tests/sql/expr.rs | 18 +++++-----
datafusion/core/tests/sql/timestamp.rs | 2 +-
datafusion/expr/src/built_in_function.rs | 17 +++++++++
datafusion/expr/src/expr_fn.rs | 6 ++++
.../src/simplify_expressions/expr_simplifier.rs | 2 +-
.../physical-expr/src/datetime_expressions.rs | 11 +++++-
datafusion/physical-expr/src/functions.rs | 42 +++++++++++++++++-----
datafusion/proto/proto/datafusion.proto | 1 +
datafusion/proto/src/generated/pbjson.rs | 3 ++
datafusion/proto/src/generated/prost.rs | 3 ++
datafusion/proto/src/logical_plan/from_proto.rs | 7 +++-
datafusion/proto/src/logical_plan/to_proto.rs | 1 +
datafusion/sqllogictest/test_files/timestamps.slt | 29 +++++++++++----
docs/source/user-guide/sql/scalar_functions.md | 20 ++++++++---
14 files changed, 130 insertions(+), 32 deletions(-)
diff --git a/datafusion/core/tests/sql/expr.rs
b/datafusion/core/tests/sql/expr.rs
index 1995a04015..7d41ad4a88 100644
--- a/datafusion/core/tests/sql/expr.rs
+++ b/datafusion/core/tests/sql/expr.rs
@@ -639,7 +639,7 @@ async fn test_uuid_expression() -> Result<()> {
async fn test_extract_date_part() -> Result<()> {
test_expression!("date_part('YEAR', CAST('2000-01-01' AS DATE))",
"2000.0");
test_expression!(
- "EXTRACT(year FROM to_timestamp('2020-09-08T12:00:00+00:00'))",
+ "EXTRACT(year FROM timestamp '2020-09-08T12:00:00+00:00')",
"2020.0"
);
test_expression!("date_part('QUARTER', CAST('2000-01-01' AS DATE))",
"1.0");
@@ -686,35 +686,35 @@ async fn test_extract_date_part() -> Result<()> {
"12.0"
);
test_expression!(
- "EXTRACT(second FROM
to_timestamp('2020-09-08T12:00:12.12345678+00:00'))",
+ "EXTRACT(second FROM timestamp '2020-09-08T12:00:12.12345678+00:00')",
"12.12345678"
);
test_expression!(
- "EXTRACT(millisecond FROM
to_timestamp('2020-09-08T12:00:12.12345678+00:00'))",
+ "EXTRACT(millisecond FROM timestamp
'2020-09-08T12:00:12.12345678+00:00')",
"12123.45678"
);
test_expression!(
- "EXTRACT(microsecond FROM
to_timestamp('2020-09-08T12:00:12.12345678+00:00'))",
+ "EXTRACT(microsecond FROM timestamp
'2020-09-08T12:00:12.12345678+00:00')",
"12123456.78"
);
test_expression!(
- "EXTRACT(nanosecond FROM
to_timestamp('2020-09-08T12:00:12.12345678+00:00'))",
+ "EXTRACT(nanosecond FROM timestamp
'2020-09-08T12:00:12.12345678+00:00')",
"1.212345678e10"
);
test_expression!(
- "date_part('second',
to_timestamp('2020-09-08T12:00:12.12345678+00:00'))",
+ "date_part('second', timestamp '2020-09-08T12:00:12.12345678+00:00')",
"12.12345678"
);
test_expression!(
- "date_part('millisecond',
to_timestamp('2020-09-08T12:00:12.12345678+00:00'))",
+ "date_part('millisecond', timestamp
'2020-09-08T12:00:12.12345678+00:00')",
"12123.45678"
);
test_expression!(
- "date_part('microsecond',
to_timestamp('2020-09-08T12:00:12.12345678+00:00'))",
+ "date_part('microsecond', timestamp
'2020-09-08T12:00:12.12345678+00:00')",
"12123456.78"
);
test_expression!(
- "date_part('nanosecond',
to_timestamp('2020-09-08T12:00:12.12345678+00:00'))",
+ "date_part('nanosecond', timestamp
'2020-09-08T12:00:12.12345678+00:00')",
"1.212345678e10"
);
diff --git a/datafusion/core/tests/sql/timestamp.rs
b/datafusion/core/tests/sql/timestamp.rs
index ada66503a1..a18e6831b6 100644
--- a/datafusion/core/tests/sql/timestamp.rs
+++ b/datafusion/core/tests/sql/timestamp.rs
@@ -742,7 +742,7 @@ async fn test_arrow_typeof() -> Result<()> {
"+-----------------------------------------------------------------------+",
"|
arrow_typeof(date_trunc(Utf8(\"microsecond\"),to_timestamp(Int64(61)))) |",
"+-----------------------------------------------------------------------+",
- "| Timestamp(Nanosecond, None)
|",
+ "| Timestamp(Second, None)
|",
"+-----------------------------------------------------------------------+",
];
assert_batches_eq!(expected, &actual);
diff --git a/datafusion/expr/src/built_in_function.rs
b/datafusion/expr/src/built_in_function.rs
index 16554133d8..9edee7649f 100644
--- a/datafusion/expr/src/built_in_function.rs
+++ b/datafusion/expr/src/built_in_function.rs
@@ -266,6 +266,8 @@ pub enum BuiltinScalarFunction {
ToTimestampMillis,
/// to_timestamp_micros
ToTimestampMicros,
+ /// to_timestamp_nanos
+ ToTimestampNanos,
/// to_timestamp_seconds
ToTimestampSeconds,
/// from_unixtime
@@ -444,6 +446,7 @@ impl BuiltinScalarFunction {
BuiltinScalarFunction::ToTimestamp => Volatility::Immutable,
BuiltinScalarFunction::ToTimestampMillis => Volatility::Immutable,
BuiltinScalarFunction::ToTimestampMicros => Volatility::Immutable,
+ BuiltinScalarFunction::ToTimestampNanos => Volatility::Immutable,
BuiltinScalarFunction::ToTimestampSeconds => Volatility::Immutable,
BuiltinScalarFunction::Translate => Volatility::Immutable,
BuiltinScalarFunction::Trim => Volatility::Immutable,
@@ -755,6 +758,7 @@ impl BuiltinScalarFunction {
BuiltinScalarFunction::ToTimestamp => Ok(Timestamp(Nanosecond,
None)),
BuiltinScalarFunction::ToTimestampMillis =>
Ok(Timestamp(Millisecond, None)),
BuiltinScalarFunction::ToTimestampMicros =>
Ok(Timestamp(Microsecond, None)),
+ BuiltinScalarFunction::ToTimestampNanos =>
Ok(Timestamp(Nanosecond, None)),
BuiltinScalarFunction::ToTimestampSeconds => Ok(Timestamp(Second,
None)),
BuiltinScalarFunction::FromUnixtime => Ok(Timestamp(Second, None)),
BuiltinScalarFunction::Now => {
@@ -995,6 +999,18 @@ impl BuiltinScalarFunction {
],
self.volatility(),
),
+ BuiltinScalarFunction::ToTimestampNanos => Signature::uniform(
+ 1,
+ vec![
+ Int64,
+ Timestamp(Nanosecond, None),
+ Timestamp(Microsecond, None),
+ Timestamp(Millisecond, None),
+ Timestamp(Second, None),
+ Utf8,
+ ],
+ self.volatility(),
+ ),
BuiltinScalarFunction::ToTimestampSeconds => Signature::uniform(
1,
vec![
@@ -1431,6 +1447,7 @@ fn aliases(func: &BuiltinScalarFunction) -> &'static
[&'static str] {
BuiltinScalarFunction::ToTimestampMillis => &["to_timestamp_millis"],
BuiltinScalarFunction::ToTimestampMicros => &["to_timestamp_micros"],
BuiltinScalarFunction::ToTimestampSeconds => &["to_timestamp_seconds"],
+ BuiltinScalarFunction::ToTimestampNanos => &["to_timestamp_nanos"],
BuiltinScalarFunction::FromUnixtime => &["from_unixtime"],
// hashing functions
diff --git a/datafusion/expr/src/expr_fn.rs b/datafusion/expr/src/expr_fn.rs
index 5368a2d8a2..5a60c2470c 100644
--- a/datafusion/expr/src/expr_fn.rs
+++ b/datafusion/expr/src/expr_fn.rs
@@ -834,6 +834,12 @@ scalar_expr!(
date,
"converts a string to a `Timestamp(Microseconds, None)`"
);
+scalar_expr!(
+ ToTimestampNanos,
+ to_timestamp_nanos,
+ date,
+ "converts a string to a `Timestamp(Nanoseconds, None)`"
+);
scalar_expr!(
ToTimestampSeconds,
to_timestamp_seconds,
diff --git a/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs
b/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs
index cb3f13a51e..04fdcca0a9 100644
--- a/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs
+++ b/datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs
@@ -1501,7 +1501,7 @@ mod tests {
test_evaluate(expr, lit("foobarbaz"));
// Check non string arguments
- // to_timestamp("2020-09-08T12:00:00+00:00") -->
timestamp(1599566400000000000i64)
+ // to_timestamp("2020-09-08T12:00:00+00:00") -->
timestamp(1599566400i64)
let expr =
call_fn("to_timestamp",
vec![lit("2020-09-08T12:00:00+00:00")]).unwrap();
test_evaluate(expr, lit_timestamp_nano(1599566400000000000i64));
diff --git a/datafusion/physical-expr/src/datetime_expressions.rs
b/datafusion/physical-expr/src/datetime_expressions.rs
index 5cf1c21df5..bb8720cb8d 100644
--- a/datafusion/physical-expr/src/datetime_expressions.rs
+++ b/datafusion/physical-expr/src/datetime_expressions.rs
@@ -154,6 +154,15 @@ pub fn to_timestamp_micros(args: &[ColumnarValue]) ->
Result<ColumnarValue> {
)
}
+/// to_timestamp_nanos SQL function
+pub fn to_timestamp_nanos(args: &[ColumnarValue]) -> Result<ColumnarValue> {
+ handle::<TimestampNanosecondType, _, TimestampNanosecondType>(
+ args,
+ string_to_timestamp_nanos_shim,
+ "to_timestamp_nanos",
+ )
+}
+
/// to_timestamp_seconds SQL function
pub fn to_timestamp_seconds(args: &[ColumnarValue]) -> Result<ColumnarValue> {
handle::<TimestampSecondType, _, TimestampSecondType>(
@@ -962,7 +971,7 @@ mod tests {
let mut string_builder = StringBuilder::with_capacity(2, 1024);
let mut ts_builder = TimestampNanosecondArray::builder(2);
- string_builder.append_value("2020-09-08T13:42:29.190855Z");
+ string_builder.append_value("2020-09-08T13:42:29.190855");
ts_builder.append_value(1599572549190855000);
string_builder.append_null();
diff --git a/datafusion/physical-expr/src/functions.rs
b/datafusion/physical-expr/src/functions.rs
index f23b45e26a..8422862043 100644
--- a/datafusion/physical-expr/src/functions.rs
+++ b/datafusion/physical-expr/src/functions.rs
@@ -74,15 +74,20 @@ pub fn create_physical_expr(
// so we don't have to pay a per-array/batch cost.
BuiltinScalarFunction::ToTimestamp => {
Arc::new(match input_phy_exprs[0].data_type(input_schema) {
- Ok(DataType::Int64) | Ok(DataType::Timestamp(_, None)) => {
- |col_values: &[ColumnarValue]| {
- cast_column(
- &col_values[0],
- &DataType::Timestamp(TimeUnit::Nanosecond, None),
- None,
- )
- }
- }
+ Ok(DataType::Int64) => |col_values: &[ColumnarValue]| {
+ cast_column(
+ &col_values[0],
+ &DataType::Timestamp(TimeUnit::Second, None),
+ None,
+ )
+ },
+ Ok(DataType::Timestamp(_, None)) => |col_values:
&[ColumnarValue]| {
+ cast_column(
+ &col_values[0],
+ &DataType::Timestamp(TimeUnit::Nanosecond, None),
+ None,
+ )
+ },
Ok(DataType::Utf8) => datetime_expressions::to_timestamp,
other => {
return internal_err!(
@@ -129,6 +134,25 @@ pub fn create_physical_expr(
}
})
}
+ BuiltinScalarFunction::ToTimestampNanos => {
+ Arc::new(match input_phy_exprs[0].data_type(input_schema) {
+ Ok(DataType::Int64) | Ok(DataType::Timestamp(_, None)) => {
+ |col_values: &[ColumnarValue]| {
+ cast_column(
+ &col_values[0],
+ &DataType::Timestamp(TimeUnit::Nanosecond, None),
+ None,
+ )
+ }
+ }
+ Ok(DataType::Utf8) => datetime_expressions::to_timestamp_nanos,
+ other => {
+ return internal_err!(
+ "Unsupported data type {other:?} for function
to_timestamp_nanos"
+ );
+ }
+ })
+ }
BuiltinScalarFunction::ToTimestampSeconds => Arc::new({
match input_phy_exprs[0].data_type(input_schema) {
Ok(DataType::Int64) | Ok(DataType::Timestamp(_, None)) => {
diff --git a/datafusion/proto/proto/datafusion.proto
b/datafusion/proto/proto/datafusion.proto
index f4ab582593..9b6a0448f8 100644
--- a/datafusion/proto/proto/datafusion.proto
+++ b/datafusion/proto/proto/datafusion.proto
@@ -620,6 +620,7 @@ enum ScalarFunction {
ArrayEmpty = 115;
ArrayPopBack = 116;
StringToArray = 117;
+ ToTimestampNanos = 118;
}
message ScalarFunctionNode {
diff --git a/datafusion/proto/src/generated/pbjson.rs
b/datafusion/proto/src/generated/pbjson.rs
index e9e2fd0c04..3eeb060f8d 100644
--- a/datafusion/proto/src/generated/pbjson.rs
+++ b/datafusion/proto/src/generated/pbjson.rs
@@ -19772,6 +19772,7 @@ impl serde::Serialize for ScalarFunction {
Self::ArrayEmpty => "ArrayEmpty",
Self::ArrayPopBack => "ArrayPopBack",
Self::StringToArray => "StringToArray",
+ Self::ToTimestampNanos => "ToTimestampNanos",
};
serializer.serialize_str(variant)
}
@@ -19901,6 +19902,7 @@ impl<'de> serde::Deserialize<'de> for ScalarFunction {
"ArrayEmpty",
"ArrayPopBack",
"StringToArray",
+ "ToTimestampNanos",
];
struct GeneratedVisitor;
@@ -20059,6 +20061,7 @@ impl<'de> serde::Deserialize<'de> for ScalarFunction {
"ArrayEmpty" => Ok(ScalarFunction::ArrayEmpty),
"ArrayPopBack" => Ok(ScalarFunction::ArrayPopBack),
"StringToArray" => Ok(ScalarFunction::StringToArray),
+ "ToTimestampNanos" => Ok(ScalarFunction::ToTimestampNanos),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
diff --git a/datafusion/proto/src/generated/prost.rs
b/datafusion/proto/src/generated/prost.rs
index 1c821708a9..d18bacfb3b 100644
--- a/datafusion/proto/src/generated/prost.rs
+++ b/datafusion/proto/src/generated/prost.rs
@@ -2465,6 +2465,7 @@ pub enum ScalarFunction {
ArrayEmpty = 115,
ArrayPopBack = 116,
StringToArray = 117,
+ ToTimestampNanos = 118,
}
impl ScalarFunction {
/// String value of the enum field names used in the ProtoBuf definition.
@@ -2591,6 +2592,7 @@ impl ScalarFunction {
ScalarFunction::ArrayEmpty => "ArrayEmpty",
ScalarFunction::ArrayPopBack => "ArrayPopBack",
ScalarFunction::StringToArray => "StringToArray",
+ ScalarFunction::ToTimestampNanos => "ToTimestampNanos",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
@@ -2714,6 +2716,7 @@ impl ScalarFunction {
"ArrayEmpty" => Some(Self::ArrayEmpty),
"ArrayPopBack" => Some(Self::ArrayPopBack),
"StringToArray" => Some(Self::StringToArray),
+ "ToTimestampNanos" => Some(Self::ToTimestampNanos),
_ => None,
}
}
diff --git a/datafusion/proto/src/logical_plan/from_proto.rs
b/datafusion/proto/src/logical_plan/from_proto.rs
index c87882ca72..26bd0163d0 100644
--- a/datafusion/proto/src/logical_plan/from_proto.rs
+++ b/datafusion/proto/src/logical_plan/from_proto.rs
@@ -54,7 +54,8 @@ use datafusion_expr::{
random, regexp_match, regexp_replace, repeat, replace, reverse, right,
round, rpad,
rtrim, sha224, sha256, sha384, sha512, signum, sin, sinh, split_part, sqrt,
starts_with, strpos, substr, substring, tan, tanh, to_hex,
to_timestamp_micros,
- to_timestamp_millis, to_timestamp_seconds, translate, trim, trunc, upper,
uuid,
+ to_timestamp_millis, to_timestamp_nanos, to_timestamp_seconds, translate,
trim,
+ trunc, upper, uuid,
window_frame::regularize,
AggregateFunction, Between, BinaryExpr, BuiltInWindowFunction,
BuiltinScalarFunction,
Case, Cast, Expr, GetFieldAccess, GetIndexedField, GroupingSet,
@@ -521,6 +522,7 @@ impl From<&protobuf::ScalarFunction> for
BuiltinScalarFunction {
ScalarFunction::Substr => Self::Substr,
ScalarFunction::ToHex => Self::ToHex,
ScalarFunction::ToTimestampMicros => Self::ToTimestampMicros,
+ ScalarFunction::ToTimestampNanos => Self::ToTimestampNanos,
ScalarFunction::ToTimestampSeconds => Self::ToTimestampSeconds,
ScalarFunction::Now => Self::Now,
ScalarFunction::CurrentDate => Self::CurrentDate,
@@ -1592,6 +1594,9 @@ pub fn parse_expr(
ScalarFunction::ToTimestampMicros => {
Ok(to_timestamp_micros(parse_expr(&args[0], registry)?))
}
+ ScalarFunction::ToTimestampNanos => {
+ Ok(to_timestamp_nanos(parse_expr(&args[0], registry)?))
+ }
ScalarFunction::ToTimestampSeconds => {
Ok(to_timestamp_seconds(parse_expr(&args[0], registry)?))
}
diff --git a/datafusion/proto/src/logical_plan/to_proto.rs
b/datafusion/proto/src/logical_plan/to_proto.rs
index 125ced032e..687b73cfc8 100644
--- a/datafusion/proto/src/logical_plan/to_proto.rs
+++ b/datafusion/proto/src/logical_plan/to_proto.rs
@@ -1522,6 +1522,7 @@ impl TryFrom<&BuiltinScalarFunction> for
protobuf::ScalarFunction {
BuiltinScalarFunction::Substr => Self::Substr,
BuiltinScalarFunction::ToHex => Self::ToHex,
BuiltinScalarFunction::ToTimestampMicros =>
Self::ToTimestampMicros,
+ BuiltinScalarFunction::ToTimestampNanos => Self::ToTimestampNanos,
BuiltinScalarFunction::ToTimestampSeconds =>
Self::ToTimestampSeconds,
BuiltinScalarFunction::Now => Self::Now,
BuiltinScalarFunction::CurrentDate => Self::CurrentDate,
diff --git a/datafusion/sqllogictest/test_files/timestamps.slt
b/datafusion/sqllogictest/test_files/timestamps.slt
index fea61b076e..e186aa12f7 100644
--- a/datafusion/sqllogictest/test_files/timestamps.slt
+++ b/datafusion/sqllogictest/test_files/timestamps.slt
@@ -217,7 +217,7 @@ SELECT to_timestamp_micros(ts) FROM ts_data_secs LIMIT 3
# to nanos
query P
-SELECT to_timestamp(ts) FROM ts_data_secs LIMIT 3
+SELECT to_timestamp_nanos(ts) FROM ts_data_secs LIMIT 3
----
2020-09-08T13:42:29
2020-09-08T12:42:29
@@ -244,7 +244,7 @@ SELECT to_timestamp_seconds(ts) FROM ts_data_micros LIMIT 3
2020-09-08T11:42:29
-# Original column is micros, convert to nanos and check timestamp
+# Original column is micros, convert to seconds and check timestamp
query P
SELECT to_timestamp(ts) FROM ts_data_micros LIMIT 3
@@ -266,7 +266,7 @@ SELECT from_unixtime(ts / 1000000000) FROM ts_data LIMIT 3;
# to_timestamp
query I
-SELECT COUNT(*) FROM ts_data_nanos where ts >
to_timestamp('2020-09-08T12:00:00+00:00')
+SELECT COUNT(*) FROM ts_data_nanos where ts > timestamp
'2020-09-08T12:00:00+00:00'
----
2
@@ -375,7 +375,7 @@ set datafusion.optimizer.skip_failed_rules = true
query P
select to_timestamp(a) from (select to_timestamp(1) as a) A;
----
-1970-01-01T00:00:00.000000001
+1970-01-01T00:00:01
# cast_to_timestamp_seconds_twice
query P
@@ -383,7 +383,6 @@ select to_timestamp_seconds(a) from (select
to_timestamp_seconds(1) as a)A
----
1970-01-01T00:00:01
-
# cast_to_timestamp_millis_twice
query P
select to_timestamp_millis(a) from (select to_timestamp_millis(1) as a)A;
@@ -396,11 +395,17 @@ select to_timestamp_micros(a) from (select
to_timestamp_micros(1) as a)A;
----
1970-01-01T00:00:00.000001
+# cast_to_timestamp_nanos_twice
+query P
+select to_timestamp_nanos(a) from (select to_timestamp_nanos(1) as a)A;
+----
+1970-01-01T00:00:00.000000001
+
# to_timestamp_i32
query P
select to_timestamp(cast (1 as int));
----
-1970-01-01T00:00:00.000000001
+1970-01-01T00:00:01
# to_timestamp_micros_i32
query P
@@ -408,6 +413,12 @@ select to_timestamp_micros(cast (1 as int));
----
1970-01-01T00:00:00.000001
+# to_timestamp_nanos_i32
+query P
+select to_timestamp_nanos(cast (1 as int));
+----
+1970-01-01T00:00:00.000000001
+
# to_timestamp_millis_i32
query P
select to_timestamp_millis(cast (1 as int));
@@ -1776,3 +1787,9 @@ query B
SELECT TIMESTAMPTZ '2020-01-01 00:00:00Z' = TIMESTAMP '2020-01-01'
----
true
+
+# verify to_timestamp edge cases to be in sync with postgresql
+query PPPPP
+SELECT to_timestamp(null), to_timestamp(-62125747200), to_timestamp(0),
to_timestamp(1926632005177), to_timestamp(1926632005)
+----
+NULL 0001-04-25T00:00:00 1970-01-01T00:00:00 +63022-07-16T12:59:37
2031-01-19T23:33:25
diff --git a/docs/source/user-guide/sql/scalar_functions.md
b/docs/source/user-guide/sql/scalar_functions.md
index d5717b9c21..b7426baea3 100644
--- a/docs/source/user-guide/sql/scalar_functions.md
+++ b/docs/source/user-guide/sql/scalar_functions.md
@@ -1218,6 +1218,7 @@ regexp_replace(str, regexp, replacement, flags)
- [to_timestamp_millis](#to_timestamp_millis)
- [to_timestamp_micros](#to_timestamp_micros)
- [to_timestamp_seconds](#to_timestamp_seconds)
+- [to_timestamp_nanos](#to_timestamp_nanos)
- [from_unixtime](#from_unixtime)
### `now`
@@ -1390,10 +1391,10 @@ extract(field FROM source)
### `to_timestamp`
-Converts a value to RFC3339 nanosecond timestamp format
(`YYYY-MM-DDT00:00:00.000000000Z`).
+Converts a value to RFC3339 nanosecond timestamp format
(`YYYY-MM-DDT00:00:00Z`).
Supports timestamp, integer, and unsigned integer types as input.
-Integers and unsigned integers are parsed as Unix nanosecond timestamps and
-return the corresponding RFC3339 nanosecond timestamp.
+Integers and unsigned integers are parsed as Unix second timestamps and
+return the corresponding RFC3339 timestamp.
```
to_timestamp(expression)
@@ -1428,7 +1429,18 @@ Integers and unsigned integers are parsed as Unix
nanosecond timestamps and
return the corresponding RFC3339 timestamp.
```
-to_timestamp_micros(expression)
+to_timestamp_nanos(expression)
+```
+
+### `to_timestamp_nanos`
+
+Converts a value to RFC3339 nanosecond timestamp format
(`YYYY-MM-DDT00:00:00.000000000Z`).
+Supports timestamp, integer, and unsigned integer types as input.
+Integers and unsigned integers are parsed as Unix nanosecond timestamps and
+return the corresponding RFC3339 timestamp.
+
+```
+to_timestamp_nanos(expression)
```
#### Arguments