[SPARK-36428][SQL][FOLLOWUP] Simplify the implementation of make_timestamp
### What changes were proposed in this pull request? The implement of https://github.com/apache/spark/pull/33665 make `make_timestamp` could accepts integer type as the seconds parameter. This PR let `make_timestamp` accepts `decimal(16,6)` type as the seconds parameter and cast integer to `decimal(16,6)` is safe, so we can simplify the code. ### Why are the changes needed? Simplify `make_timestamp`. ### Does this PR introduce _any_ user-facing change? 'No'. ### How was this patch tested? New tests. Closes #33775 from beliefer/SPARK-36428-followup. Lead-authored-by: gengjiaan <gengjiaan@360.cn> Co-authored-by: Jiaan Geng <beliefer@163.com> Signed-off-by: Gengliang Wang <gengliang@apache.org>
This commit is contained in:
parent
996551fece
commit
707eefa3c7
|
@ -2557,22 +2557,16 @@ case class MakeTimestamp(
|
||||||
|
|
||||||
override def children: Seq[Expression] = Seq(year, month, day, hour, min, sec) ++ timezone
|
override def children: Seq[Expression] = Seq(year, month, day, hour, min, sec) ++ timezone
|
||||||
// Accept `sec` as DecimalType to avoid loosing precision of microseconds while converting
|
// Accept `sec` as DecimalType to avoid loosing precision of microseconds while converting
|
||||||
// them to the fractional part of `sec`.
|
// them to the fractional part of `sec`. For accepts IntegerType as `sec` and integer can be
|
||||||
|
// casted into decimal safely, we use DecimalType(16, 6) which is wider than DecimalType(10, 0).
|
||||||
override def inputTypes: Seq[AbstractDataType] =
|
override def inputTypes: Seq[AbstractDataType] =
|
||||||
Seq(IntegerType, IntegerType, IntegerType, IntegerType, IntegerType,
|
Seq(IntegerType, IntegerType, IntegerType, IntegerType, IntegerType, DecimalType(16, 6)) ++
|
||||||
TypeCollection(DecimalType(8, 6), IntegerType, NullType)) ++ timezone.map(_ => StringType)
|
timezone.map(_ => StringType)
|
||||||
override def nullable: Boolean = if (failOnError) children.exists(_.nullable) else true
|
override def nullable: Boolean = if (failOnError) children.exists(_.nullable) else true
|
||||||
|
|
||||||
override def withTimeZone(timeZoneId: String): TimeZoneAwareExpression =
|
override def withTimeZone(timeZoneId: String): TimeZoneAwareExpression =
|
||||||
copy(timeZoneId = Option(timeZoneId))
|
copy(timeZoneId = Option(timeZoneId))
|
||||||
|
|
||||||
private lazy val toDecimal = sec.dataType match {
|
|
||||||
case DecimalType() =>
|
|
||||||
(secEval: Any) => secEval.asInstanceOf[Decimal]
|
|
||||||
case IntegerType =>
|
|
||||||
(secEval: Any) => Decimal(BigDecimal(secEval.asInstanceOf[Int]), 8, 6)
|
|
||||||
}
|
|
||||||
|
|
||||||
private def toMicros(
|
private def toMicros(
|
||||||
year: Int,
|
year: Int,
|
||||||
month: Int,
|
month: Int,
|
||||||
|
@ -2585,8 +2579,6 @@ case class MakeTimestamp(
|
||||||
assert(secAndMicros.scale == 6,
|
assert(secAndMicros.scale == 6,
|
||||||
s"Seconds fraction must have 6 digits for microseconds but got ${secAndMicros.scale}")
|
s"Seconds fraction must have 6 digits for microseconds but got ${secAndMicros.scale}")
|
||||||
val unscaledSecFrac = secAndMicros.toUnscaledLong
|
val unscaledSecFrac = secAndMicros.toUnscaledLong
|
||||||
assert(secAndMicros.precision <= 8,
|
|
||||||
s"Seconds and fraction cannot have more than 8 digits but got ${secAndMicros.precision}")
|
|
||||||
val totalMicros = unscaledSecFrac.toInt // 8 digits cannot overflow Int
|
val totalMicros = unscaledSecFrac.toInt // 8 digits cannot overflow Int
|
||||||
val seconds = Math.floorDiv(totalMicros, MICROS_PER_SECOND.toInt)
|
val seconds = Math.floorDiv(totalMicros, MICROS_PER_SECOND.toInt)
|
||||||
val nanos = Math.floorMod(totalMicros, MICROS_PER_SECOND.toInt) * NANOS_PER_MICROS.toInt
|
val nanos = Math.floorMod(totalMicros, MICROS_PER_SECOND.toInt) * NANOS_PER_MICROS.toInt
|
||||||
|
@ -2627,7 +2619,7 @@ case class MakeTimestamp(
|
||||||
day.asInstanceOf[Int],
|
day.asInstanceOf[Int],
|
||||||
hour.asInstanceOf[Int],
|
hour.asInstanceOf[Int],
|
||||||
min.asInstanceOf[Int],
|
min.asInstanceOf[Int],
|
||||||
toDecimal(sec),
|
sec.asInstanceOf[Decimal],
|
||||||
zid)
|
zid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2635,7 +2627,6 @@ case class MakeTimestamp(
|
||||||
val dtu = DateTimeUtils.getClass.getName.stripSuffix("$")
|
val dtu = DateTimeUtils.getClass.getName.stripSuffix("$")
|
||||||
val zid = ctx.addReferenceObj("zoneId", zoneId, classOf[ZoneId].getName)
|
val zid = ctx.addReferenceObj("zoneId", zoneId, classOf[ZoneId].getName)
|
||||||
val d = Decimal.getClass.getName.stripSuffix("$")
|
val d = Decimal.getClass.getName.stripSuffix("$")
|
||||||
val decimalValue = ctx.freshName("decimalValue")
|
|
||||||
val failOnErrorBranch = if (failOnError) "throw e;" else s"${ev.isNull} = true;"
|
val failOnErrorBranch = if (failOnError) "throw e;" else s"${ev.isNull} = true;"
|
||||||
nullSafeCodeGen(ctx, ev, (year, month, day, hour, min, secAndNanos, timezone) => {
|
nullSafeCodeGen(ctx, ev, (year, month, day, hour, min, secAndNanos, timezone) => {
|
||||||
val zoneId = timezone.map(tz => s"$dtu.getZoneId(${tz}.toString())").getOrElse(zid)
|
val zoneId = timezone.map(tz => s"$dtu.getZoneId(${tz}.toString())").getOrElse(zid)
|
||||||
|
@ -2647,21 +2638,11 @@ case class MakeTimestamp(
|
||||||
} else {
|
} else {
|
||||||
s"${ev.value} = $dtu.localDateTimeToMicros(ldt);"
|
s"${ev.value} = $dtu.localDateTimeToMicros(ldt);"
|
||||||
}
|
}
|
||||||
val toDecimalCode = sec.dataType match {
|
|
||||||
case DecimalType() =>
|
|
||||||
s"org.apache.spark.sql.types.Decimal $decimalValue = $secAndNanos;"
|
|
||||||
case IntegerType =>
|
|
||||||
s"""
|
|
||||||
|org.apache.spark.sql.types.Decimal $decimalValue =
|
|
||||||
|$d$$.MODULE$$.apply(new java.math.BigDecimal($secAndNanos), 8, 6);
|
|
||||||
""".stripMargin
|
|
||||||
}
|
|
||||||
s"""
|
s"""
|
||||||
try {
|
try {
|
||||||
$toDecimalCode
|
org.apache.spark.sql.types.Decimal secFloor = $secAndNanos.floor();
|
||||||
org.apache.spark.sql.types.Decimal secFloor = $decimalValue.floor();
|
|
||||||
org.apache.spark.sql.types.Decimal nanosPerSec = $d$$.MODULE$$.apply(1000000000L, 10, 0);
|
org.apache.spark.sql.types.Decimal nanosPerSec = $d$$.MODULE$$.apply(1000000000L, 10, 0);
|
||||||
int nanos = (($decimalValue.$$minus(secFloor)).$$times(nanosPerSec)).toInt();
|
int nanos = (($secAndNanos.$$minus(secFloor)).$$times(nanosPerSec)).toInt();
|
||||||
int seconds = secFloor.toInt();
|
int seconds = secFloor.toInt();
|
||||||
java.time.LocalDateTime ldt;
|
java.time.LocalDateTime ldt;
|
||||||
if (seconds == 60) {
|
if (seconds == 60) {
|
||||||
|
|
|
@ -1161,18 +1161,19 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
|
||||||
withSQLConf(SQLConf.TIMESTAMP_TYPE.key -> tsType.toString) {
|
withSQLConf(SQLConf.TIMESTAMP_TYPE.key -> tsType.toString) {
|
||||||
val expected = expectedAnswer("2013-07-15 08:15:23.5")
|
val expected = expectedAnswer("2013-07-15 08:15:23.5")
|
||||||
|
|
||||||
Seq(true, false).foreach { ansi =>
|
Seq(true).foreach { ansi =>
|
||||||
withSQLConf(SQLConf.ANSI_ENABLED.key -> ansi.toString) {
|
withSQLConf(SQLConf.ANSI_ENABLED.key -> ansi.toString) {
|
||||||
var makeTimestampExpr = MakeTimestamp(
|
var makeTimestampExpr = MakeTimestamp(
|
||||||
Literal(2013), Literal(7), Literal(15), Literal(8), Literal(15),
|
Literal(2013), Literal(7), Literal(15), Literal(8), Literal(15),
|
||||||
Literal(Decimal(BigDecimal(23.5), 8, 6)), Some(Literal(ZoneId.systemDefault().getId)))
|
Literal(Decimal(BigDecimal(23.5), 16, 6)),
|
||||||
|
Some(Literal(ZoneId.systemDefault().getId)))
|
||||||
checkEvaluation(makeTimestampExpr, expected)
|
checkEvaluation(makeTimestampExpr, expected)
|
||||||
checkEvaluation(makeTimestampExpr.copy(year = Literal.create(null, IntegerType)), null)
|
checkEvaluation(makeTimestampExpr.copy(year = Literal.create(null, IntegerType)), null)
|
||||||
checkEvaluation(makeTimestampExpr.copy(month = Literal.create(null, IntegerType)), null)
|
checkEvaluation(makeTimestampExpr.copy(month = Literal.create(null, IntegerType)), null)
|
||||||
checkEvaluation(makeTimestampExpr.copy(day = Literal.create(null, IntegerType)), null)
|
checkEvaluation(makeTimestampExpr.copy(day = Literal.create(null, IntegerType)), null)
|
||||||
checkEvaluation(makeTimestampExpr.copy(hour = Literal.create(null, IntegerType)), null)
|
checkEvaluation(makeTimestampExpr.copy(hour = Literal.create(null, IntegerType)), null)
|
||||||
checkEvaluation(makeTimestampExpr.copy(min = Literal.create(null, IntegerType)), null)
|
checkEvaluation(makeTimestampExpr.copy(min = Literal.create(null, IntegerType)), null)
|
||||||
checkEvaluation(makeTimestampExpr.copy(sec = Literal.create(null, DecimalType(8, 6))),
|
checkEvaluation(makeTimestampExpr.copy(sec = Literal.create(null, DecimalType(16, 6))),
|
||||||
null)
|
null)
|
||||||
checkEvaluation(makeTimestampExpr.copy(timezone = None), expected)
|
checkEvaluation(makeTimestampExpr.copy(timezone = None), expected)
|
||||||
|
|
||||||
|
@ -1183,7 +1184,7 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
|
||||||
(makeTimestampExpr.copy(hour = Literal(25)), "Invalid value for Hour"),
|
(makeTimestampExpr.copy(hour = Literal(25)), "Invalid value for Hour"),
|
||||||
(makeTimestampExpr.copy(min = Literal(65)), "Invalid value for Min"),
|
(makeTimestampExpr.copy(min = Literal(65)), "Invalid value for Min"),
|
||||||
(makeTimestampExpr.copy(sec = Literal(Decimal(
|
(makeTimestampExpr.copy(sec = Literal(Decimal(
|
||||||
BigDecimal(70.0), 8, 6))), "Invalid value for Second")
|
BigDecimal(70.0), 16, 6))), "Invalid value for Second")
|
||||||
).foreach { entry =>
|
).foreach { entry =>
|
||||||
if (ansi) {
|
if (ansi) {
|
||||||
checkExceptionInExpression[DateTimeException](entry._1, EmptyRow, entry._2)
|
checkExceptionInExpression[DateTimeException](entry._1, EmptyRow, entry._2)
|
||||||
|
@ -1193,16 +1194,16 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
makeTimestampExpr = MakeTimestamp(Literal(2019), Literal(6), Literal(30),
|
makeTimestampExpr = MakeTimestamp(Literal(2019), Literal(6), Literal(30),
|
||||||
Literal(23), Literal(59), Literal(Decimal(BigDecimal(60.0), 8, 6)))
|
Literal(23), Literal(59), Literal(Decimal(BigDecimal(60.0), 16, 6)))
|
||||||
if (ansi) {
|
if (ansi) {
|
||||||
checkExceptionInExpression[DateTimeException](makeTimestampExpr.copy(sec = Literal(
|
checkExceptionInExpression[DateTimeException](makeTimestampExpr.copy(sec = Literal(
|
||||||
Decimal(BigDecimal(60.5), 8, 6))), EmptyRow, "The fraction of sec must be zero")
|
Decimal(BigDecimal(60.5), 16, 6))), EmptyRow, "The fraction of sec must be zero")
|
||||||
} else {
|
} else {
|
||||||
checkEvaluation(makeTimestampExpr, expectedAnswer("2019-07-01 00:00:00"))
|
checkEvaluation(makeTimestampExpr, expectedAnswer("2019-07-01 00:00:00"))
|
||||||
}
|
}
|
||||||
|
|
||||||
makeTimestampExpr = MakeTimestamp(Literal(2019), Literal(8), Literal(12), Literal(0),
|
makeTimestampExpr = MakeTimestamp(Literal(2019), Literal(8), Literal(12), Literal(0),
|
||||||
Literal(0), Literal(Decimal(BigDecimal(58.000001), 8, 6)))
|
Literal(0), Literal(Decimal(BigDecimal(58.000001), 16, 6)))
|
||||||
checkEvaluation(makeTimestampExpr, expectedAnswer("2019-08-12 00:00:58.000001"))
|
checkEvaluation(makeTimestampExpr, expectedAnswer("2019-08-12 00:00:58.000001"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1210,26 +1211,18 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
|
||||||
// non-ansi test
|
// non-ansi test
|
||||||
withSQLConf(SQLConf.ANSI_ENABLED.key -> "false") {
|
withSQLConf(SQLConf.ANSI_ENABLED.key -> "false") {
|
||||||
val makeTimestampExpr = MakeTimestamp(Literal(2019), Literal(6), Literal(30),
|
val makeTimestampExpr = MakeTimestamp(Literal(2019), Literal(6), Literal(30),
|
||||||
Literal(23), Literal(59), Literal(Decimal(BigDecimal(60.0), 8, 6)))
|
Literal(23), Literal(59), Literal(Decimal(BigDecimal(60.0), 16, 6)))
|
||||||
checkEvaluation(makeTimestampExpr.copy(sec = Literal(Decimal(BigDecimal(60.5), 8, 6))),
|
checkEvaluation(makeTimestampExpr.copy(sec = Literal(Decimal(BigDecimal(60.5), 16, 6))),
|
||||||
null)
|
null)
|
||||||
}
|
}
|
||||||
|
|
||||||
Seq(true, false).foreach { ansi =>
|
Seq(true, false).foreach { ansi =>
|
||||||
withSQLConf(SQLConf.ANSI_ENABLED.key -> ansi.toString) {
|
withSQLConf(SQLConf.ANSI_ENABLED.key -> ansi.toString) {
|
||||||
val makeTimestampExpr = MakeTimestamp(Literal(2019), Literal(8), Literal(12),
|
val makeTimestampExpr = MakeTimestamp(Literal(2019), Literal(8), Literal(12),
|
||||||
Literal(0), Literal(0), Literal(Decimal(BigDecimal(58.000001), 8, 6)))
|
Literal(0), Literal(0), Literal(Decimal(BigDecimal(58.000001), 16, 6)))
|
||||||
checkEvaluation(makeTimestampExpr, expectedAnswer("2019-08-12 00:00:58.000001"))
|
checkEvaluation(makeTimestampExpr, expectedAnswer("2019-08-12 00:00:58.000001"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Seq(true, false).foreach { ansi =>
|
|
||||||
withSQLConf(SQLConf.ANSI_ENABLED.key -> ansi.toString) {
|
|
||||||
val makeTimestampExpr = MakeTimestamp(Literal(2019), Literal(8), Literal(12),
|
|
||||||
Literal(0), Literal(0), Literal(1))
|
|
||||||
checkEvaluation(makeTimestampExpr, expectedAnswer("2019-08-12 00:00:01"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1242,20 +1235,20 @@ class DateExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper {
|
||||||
test("extract the seconds part with fraction from timestamps") {
|
test("extract the seconds part with fraction from timestamps") {
|
||||||
outstandingTimezonesIds.foreach { timezone =>
|
outstandingTimezonesIds.foreach { timezone =>
|
||||||
val timestamp = MakeTimestamp(Literal(2019), Literal(8), Literal(10),
|
val timestamp = MakeTimestamp(Literal(2019), Literal(8), Literal(10),
|
||||||
Literal(0), Literal(0), Literal(Decimal(10.123456, 8, 6)),
|
Literal(0), Literal(0), Literal(Decimal(10.123456, 16, 6)),
|
||||||
Some(Literal(timezone)), Some(timezone))
|
Some(Literal(timezone)), Some(timezone))
|
||||||
def secFrac(ts: MakeTimestamp): SecondWithFraction = SecondWithFraction(ts, Some(timezone))
|
def secFrac(ts: MakeTimestamp): SecondWithFraction = SecondWithFraction(ts, Some(timezone))
|
||||||
|
|
||||||
checkEvaluation(secFrac(timestamp), Decimal(10.123456, 8, 6))
|
checkEvaluation(secFrac(timestamp), Decimal(10.123456, 16, 6))
|
||||||
checkEvaluation(
|
checkEvaluation(
|
||||||
secFrac(timestamp.copy(sec = Literal(Decimal(59000001, 8, 6)))),
|
secFrac(timestamp.copy(sec = Literal(Decimal(59000001, 16, 6)))),
|
||||||
Decimal(59000001, 8, 6))
|
Decimal(59000001, 16, 6))
|
||||||
checkEvaluation(
|
checkEvaluation(
|
||||||
secFrac(timestamp.copy(sec = Literal(Decimal(1, 8, 6)))),
|
secFrac(timestamp.copy(sec = Literal(Decimal(1, 16, 6)))),
|
||||||
Decimal(0.000001, 8, 6))
|
Decimal(0.000001, 16, 6))
|
||||||
checkEvaluation(
|
checkEvaluation(
|
||||||
secFrac(timestamp.copy(year = Literal(10))),
|
secFrac(timestamp.copy(year = Literal(10))),
|
||||||
Decimal(10.123456, 8, 6))
|
Decimal(10.123456, 16, 6))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,9 @@ SELECT make_timestamp(1, 1, 1, 1, 1, 1);
|
||||||
SELECT make_timestamp(1, 1, 1, 1, 1, 60);
|
SELECT make_timestamp(1, 1, 1, 1, 1, 60);
|
||||||
SELECT make_timestamp(1, 1, 1, 1, 1, 61);
|
SELECT make_timestamp(1, 1, 1, 1, 1, 61);
|
||||||
SELECT make_timestamp(1, 1, 1, 1, 1, null);
|
SELECT make_timestamp(1, 1, 1, 1, 1, null);
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 59.999999);
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 99.999999);
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 999.999999);
|
||||||
|
|
||||||
-- [SPARK-31710] TIMESTAMP_SECONDS, TIMESTAMP_MILLISECONDS and TIMESTAMP_MICROSECONDS that always create timestamp_ltz
|
-- [SPARK-31710] TIMESTAMP_SECONDS, TIMESTAMP_MILLISECONDS and TIMESTAMP_MICROSECONDS that always create timestamp_ltz
|
||||||
select TIMESTAMP_SECONDS(1230219000),TIMESTAMP_SECONDS(-1230219000),TIMESTAMP_SECONDS(null);
|
select TIMESTAMP_SECONDS(1230219000),TIMESTAMP_SECONDS(-1230219000),TIMESTAMP_SECONDS(null);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-- Automatically generated by SQLQueryTestSuite
|
-- Automatically generated by SQLQueryTestSuite
|
||||||
-- Number of queries: 86
|
-- Number of queries: 89
|
||||||
|
|
||||||
|
|
||||||
-- !query
|
-- !query
|
||||||
|
@ -140,6 +140,32 @@ struct<make_timestamp(1, 1, 1, 1, 1, NULL):timestamp>
|
||||||
NULL
|
NULL
|
||||||
|
|
||||||
|
|
||||||
|
-- !query
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 59.999999)
|
||||||
|
-- !query schema
|
||||||
|
struct<make_timestamp(1, 1, 1, 1, 1, 59.999999):timestamp>
|
||||||
|
-- !query output
|
||||||
|
0001-01-01 01:01:59.999999
|
||||||
|
|
||||||
|
|
||||||
|
-- !query
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 99.999999)
|
||||||
|
-- !query schema
|
||||||
|
struct<>
|
||||||
|
-- !query output
|
||||||
|
java.time.DateTimeException
|
||||||
|
Invalid value for SecondOfMinute (valid values 0 - 59): 99
|
||||||
|
|
||||||
|
|
||||||
|
-- !query
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 999.999999)
|
||||||
|
-- !query schema
|
||||||
|
struct<>
|
||||||
|
-- !query output
|
||||||
|
java.time.DateTimeException
|
||||||
|
Invalid value for SecondOfMinute (valid values 0 - 59): 999
|
||||||
|
|
||||||
|
|
||||||
-- !query
|
-- !query
|
||||||
select TIMESTAMP_SECONDS(1230219000),TIMESTAMP_SECONDS(-1230219000),TIMESTAMP_SECONDS(null)
|
select TIMESTAMP_SECONDS(1230219000),TIMESTAMP_SECONDS(-1230219000),TIMESTAMP_SECONDS(null)
|
||||||
-- !query schema
|
-- !query schema
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-- Automatically generated by SQLQueryTestSuite
|
-- Automatically generated by SQLQueryTestSuite
|
||||||
-- Number of queries: 163
|
-- Number of queries: 166
|
||||||
|
|
||||||
|
|
||||||
-- !query
|
-- !query
|
||||||
|
@ -790,6 +790,30 @@ struct<make_timestamp(1, 1, 1, 1, 1, NULL):timestamp>
|
||||||
NULL
|
NULL
|
||||||
|
|
||||||
|
|
||||||
|
-- !query
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 59.999999)
|
||||||
|
-- !query schema
|
||||||
|
struct<make_timestamp(1, 1, 1, 1, 1, 59.999999):timestamp>
|
||||||
|
-- !query output
|
||||||
|
0001-01-01 01:01:59.999999
|
||||||
|
|
||||||
|
|
||||||
|
-- !query
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 99.999999)
|
||||||
|
-- !query schema
|
||||||
|
struct<make_timestamp(1, 1, 1, 1, 1, 99.999999):timestamp>
|
||||||
|
-- !query output
|
||||||
|
NULL
|
||||||
|
|
||||||
|
|
||||||
|
-- !query
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 999.999999)
|
||||||
|
-- !query schema
|
||||||
|
struct<make_timestamp(1, 1, 1, 1, 1, 999.999999):timestamp>
|
||||||
|
-- !query output
|
||||||
|
NULL
|
||||||
|
|
||||||
|
|
||||||
-- !query
|
-- !query
|
||||||
select TIMESTAMP_SECONDS(1230219000),TIMESTAMP_SECONDS(-1230219000),TIMESTAMP_SECONDS(null)
|
select TIMESTAMP_SECONDS(1230219000),TIMESTAMP_SECONDS(-1230219000),TIMESTAMP_SECONDS(null)
|
||||||
-- !query schema
|
-- !query schema
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-- Automatically generated by SQLQueryTestSuite
|
-- Automatically generated by SQLQueryTestSuite
|
||||||
-- Number of queries: 86
|
-- Number of queries: 89
|
||||||
|
|
||||||
|
|
||||||
-- !query
|
-- !query
|
||||||
|
@ -132,6 +132,30 @@ struct<make_timestamp(1, 1, 1, 1, 1, NULL):timestamp>
|
||||||
NULL
|
NULL
|
||||||
|
|
||||||
|
|
||||||
|
-- !query
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 59.999999)
|
||||||
|
-- !query schema
|
||||||
|
struct<make_timestamp(1, 1, 1, 1, 1, 59.999999):timestamp>
|
||||||
|
-- !query output
|
||||||
|
0001-01-01 01:01:59.999999
|
||||||
|
|
||||||
|
|
||||||
|
-- !query
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 99.999999)
|
||||||
|
-- !query schema
|
||||||
|
struct<make_timestamp(1, 1, 1, 1, 1, 99.999999):timestamp>
|
||||||
|
-- !query output
|
||||||
|
NULL
|
||||||
|
|
||||||
|
|
||||||
|
-- !query
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 999.999999)
|
||||||
|
-- !query schema
|
||||||
|
struct<make_timestamp(1, 1, 1, 1, 1, 999.999999):timestamp>
|
||||||
|
-- !query output
|
||||||
|
NULL
|
||||||
|
|
||||||
|
|
||||||
-- !query
|
-- !query
|
||||||
select TIMESTAMP_SECONDS(1230219000),TIMESTAMP_SECONDS(-1230219000),TIMESTAMP_SECONDS(null)
|
select TIMESTAMP_SECONDS(1230219000),TIMESTAMP_SECONDS(-1230219000),TIMESTAMP_SECONDS(null)
|
||||||
-- !query schema
|
-- !query schema
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-- Automatically generated by SQLQueryTestSuite
|
-- Automatically generated by SQLQueryTestSuite
|
||||||
-- Number of queries: 86
|
-- Number of queries: 89
|
||||||
|
|
||||||
|
|
||||||
-- !query
|
-- !query
|
||||||
|
@ -140,6 +140,32 @@ struct<make_timestamp(1, 1, 1, 1, 1, NULL):timestamp_ntz>
|
||||||
NULL
|
NULL
|
||||||
|
|
||||||
|
|
||||||
|
-- !query
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 59.999999)
|
||||||
|
-- !query schema
|
||||||
|
struct<make_timestamp(1, 1, 1, 1, 1, 59.999999):timestamp_ntz>
|
||||||
|
-- !query output
|
||||||
|
0001-01-01 01:01:59.999999
|
||||||
|
|
||||||
|
|
||||||
|
-- !query
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 99.999999)
|
||||||
|
-- !query schema
|
||||||
|
struct<>
|
||||||
|
-- !query output
|
||||||
|
java.time.DateTimeException
|
||||||
|
Invalid value for SecondOfMinute (valid values 0 - 59): 99
|
||||||
|
|
||||||
|
|
||||||
|
-- !query
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 999.999999)
|
||||||
|
-- !query schema
|
||||||
|
struct<>
|
||||||
|
-- !query output
|
||||||
|
java.time.DateTimeException
|
||||||
|
Invalid value for SecondOfMinute (valid values 0 - 59): 999
|
||||||
|
|
||||||
|
|
||||||
-- !query
|
-- !query
|
||||||
select TIMESTAMP_SECONDS(1230219000),TIMESTAMP_SECONDS(-1230219000),TIMESTAMP_SECONDS(null)
|
select TIMESTAMP_SECONDS(1230219000),TIMESTAMP_SECONDS(-1230219000),TIMESTAMP_SECONDS(null)
|
||||||
-- !query schema
|
-- !query schema
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
-- Automatically generated by SQLQueryTestSuite
|
-- Automatically generated by SQLQueryTestSuite
|
||||||
-- Number of queries: 86
|
-- Number of queries: 89
|
||||||
|
|
||||||
|
|
||||||
-- !query
|
-- !query
|
||||||
|
@ -132,6 +132,30 @@ struct<make_timestamp(1, 1, 1, 1, 1, NULL):timestamp_ntz>
|
||||||
NULL
|
NULL
|
||||||
|
|
||||||
|
|
||||||
|
-- !query
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 59.999999)
|
||||||
|
-- !query schema
|
||||||
|
struct<make_timestamp(1, 1, 1, 1, 1, 59.999999):timestamp_ntz>
|
||||||
|
-- !query output
|
||||||
|
0001-01-01 01:01:59.999999
|
||||||
|
|
||||||
|
|
||||||
|
-- !query
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 99.999999)
|
||||||
|
-- !query schema
|
||||||
|
struct<make_timestamp(1, 1, 1, 1, 1, 99.999999):timestamp_ntz>
|
||||||
|
-- !query output
|
||||||
|
NULL
|
||||||
|
|
||||||
|
|
||||||
|
-- !query
|
||||||
|
SELECT make_timestamp(1, 1, 1, 1, 1, 999.999999)
|
||||||
|
-- !query schema
|
||||||
|
struct<make_timestamp(1, 1, 1, 1, 1, 999.999999):timestamp_ntz>
|
||||||
|
-- !query output
|
||||||
|
NULL
|
||||||
|
|
||||||
|
|
||||||
-- !query
|
-- !query
|
||||||
select TIMESTAMP_SECONDS(1230219000),TIMESTAMP_SECONDS(-1230219000),TIMESTAMP_SECONDS(null)
|
select TIMESTAMP_SECONDS(1230219000),TIMESTAMP_SECONDS(-1230219000),TIMESTAMP_SECONDS(null)
|
||||||
-- !query schema
|
-- !query schema
|
||||||
|
|
Loading…
Reference in a new issue