public class SqlTimestamp extends Object implements Comparable<SqlTimestamp>
This class is composite of a millisecond and nanoOfMillisecond. The millisecond part holds the integral second and the milli-of-second. The nanoOfMillisecond holds the nano-of-millisecond, which should between 0 - 999_999.
| 限定符和类型 | 方法和说明 |
|---|---|
int |
compareTo(SqlTimestamp that) |
boolean |
equals(Object obj) |
static SqlTimestamp |
fromEpochMillis(long millisecond)
Obtains an instance of
SqlTimestamp from a millisecond. |
static SqlTimestamp |
fromEpochMillis(long millisecond,
int nanoOfMillisecond)
Obtains an instance of
SqlTimestamp from a millisecond and a nanoOfMillisecond. |
static SqlTimestamp |
fromInstant(java.time.Instant instant)
Obtains an instance of
SqlTimestamp from an instance of Instant. |
static SqlTimestamp |
fromLocalDateTime(java.time.LocalDateTime dateTime)
Obtains an instance of
SqlTimestamp from an instance of LocalDateTime. |
static SqlTimestamp |
fromTimestamp(Timestamp ts)
Obtains an instance of
SqlTimestamp from an instance of Timestamp. |
long |
getMillisecond() |
int |
getNanoOfMillisecond() |
int |
hashCode() |
static boolean |
isCompact(int precision)
Apache Calcite and Flink's planner use the number of milliseconds since epoch to represent a
Timestamp type compactly if the number of digits of fractional seconds is between 0 - 3.
|
static SqlTimestamp |
readTimestampFieldFromSegments(org.apache.flink.core.memory.MemorySegment[] segments,
int baseOffset,
long offsetAndNanos)
Obtains an instance of
SqlTimestamp from underlying MemorySegment. |
java.time.Instant |
toInstant()
Convert this
SqlTimestamp object to a Instant. |
java.time.LocalDateTime |
toLocalDateTime()
Convert this
SqlTimestamp object to a LocalDateTime. |
String |
toString() |
Timestamp |
toTimestamp()
Convert this
SqlTimestmap object to a Timestamp. |
public int compareTo(SqlTimestamp that)
compareTo 在接口中 Comparable<SqlTimestamp>public long getMillisecond()
public int getNanoOfMillisecond()
public static SqlTimestamp fromEpochMillis(long millisecond)
SqlTimestamp from a millisecond.
This returns a SqlTimestamp with the specified millisecond.
The nanoOfMillisecond field will be set to zero.
millisecond - the number of milliseconds since January 1, 1970, 00:00:00 GMT
A negative number is the number of milliseconds before
January 1, 1970, 00:00:00 GMTSqlTimestamppublic static SqlTimestamp fromEpochMillis(long millisecond, int nanoOfMillisecond)
SqlTimestamp from a millisecond and a nanoOfMillisecond.
This returns a SqlTimestamp with the specified millisecond and nanoOfMillisecond.
millisecond - the number of milliseconds since January 1, 1970, 00:00:00 GMT
A negative number is the number of milliseconds before
January 1, 1970, 00:00:00 GMTnanoOfMillisecond - the nanosecond within the millisecond, from 0 to 999,999SqlTimestamppublic Timestamp toTimestamp()
SqlTimestmap object to a Timestamp.Timestamppublic static SqlTimestamp fromTimestamp(Timestamp ts)
SqlTimestamp from an instance of Timestamp.
This returns a SqlTimestamp with the specified Timestamp.
ts - an instance of TimestampSqlTimestamppublic java.time.LocalDateTime toLocalDateTime()
SqlTimestamp object to a LocalDateTime.LocalDateTimepublic static SqlTimestamp fromLocalDateTime(java.time.LocalDateTime dateTime)
SqlTimestamp from an instance of LocalDateTime.
This returns a SqlTimestamp with the specified LocalDateTime.
dateTime - an instance of LocalDateTimeSqlTimestamppublic java.time.Instant toInstant()
SqlTimestamp object to a Instant.Instantpublic static SqlTimestamp fromInstant(java.time.Instant instant)
SqlTimestamp from an instance of Instant.
This returns a SqlTimestmap with the specified Instant.
instant - an instance of InstantSqlTimestamppublic static boolean isCompact(int precision)
precision - the number of digits of fractional secondspublic static SqlTimestamp readTimestampFieldFromSegments(org.apache.flink.core.memory.MemorySegment[] segments, int baseOffset, long offsetAndNanos)
SqlTimestamp from underlying MemorySegment.segments - the underlying MemorySegmentsbaseOffset - the base offset of current instance of SqlTimestampoffsetAndNanos - the offset of millseconds part and nanosecondsSqlTimestampCopyright © 2014–2020 The Apache Software Foundation. All rights reserved.