Class ArrowResultUtil


  • public class ArrowResultUtil
    extends Object
    Result utility methods specifically for Arrow format
    • Field Detail

    • Constructor Detail

      • ArrowResultUtil

        public ArrowResultUtil()
    • Method Detail

      • powerOfTen

        public static long powerOfTen​(int pow)
      • getStringFormat

        public static String getStringFormat​(int scale)
      • getDate

        public static Date getDate​(int day)
        new method to get Date from integer
        Parameters:
        day - The day to convert.
        Returns:
        Date
      • getDate

        public static Date getDate​(int day,
                                   TimeZone oldTz,
                                   TimeZone newTz)
                            throws SFException
        Method to get Date from integer using timezone offsets
        Parameters:
        day - The day to convert.
        oldTz - The old timezone.
        newTz - The new timezone.
        Returns:
        Date
        Throws:
        SFException - if date value is invalid
      • moveToTimeZone

        public static Timestamp moveToTimeZone​(Timestamp ts,
                                               TimeZone oldTZ,
                                               TimeZone newTZ)
        move the input timestamp form oldTZ to newTZ
        Parameters:
        ts - Timestamp
        oldTZ - Old timezone
        newTZ - New timezone
        Returns:
        timestamp in newTZ
      • toJavaTimestamp

        public static Timestamp toJavaTimestamp​(long epoch,
                                                int scale)
        generate Java Timestamp object
        Parameters:
        epoch - the value since epoch time
        scale - the scale of the value
        Returns:
        Timestamp
      • toJavaTimestamp

        @SnowflakeJdbcInternalApi
        public static Timestamp toJavaTimestamp​(long epoch,
                                                int scale,
                                                TimeZone sessionTimezone,
                                                boolean useSessionTimezone)
        generate Java Timestamp object
        Parameters:
        epoch - the value since epoch time
        scale - the scale of the value
        sessionTimezone - the session timezone
        useSessionTimezone - should the session timezone be used
        Returns:
        Timestamp
      • isTimestampOverflow

        public static boolean isTimestampOverflow​(long seconds)
        check whether the input seconds out of the scope of Java timestamp
        Parameters:
        seconds - long value to check
        Returns:
        true if value is out of the scope of Java timestamp.
      • createTimestamp

        public static Timestamp createTimestamp​(long seconds,
                                                int fraction,
                                                TimeZone timezone,
                                                boolean useSessionTz)
        create Java timestamp using seconds since epoch and fraction in nanoseconds For example, 1232.234 represents as epoch = 1232 and fraction = 234,000,000 For example, -1232.234 represents as epoch = -1233 and fraction = 766,000,000 For example, -0.13 represents as epoch = -1 and fraction = 870,000,000
        Parameters:
        seconds - seconds value
        fraction - fraction
        timezone - The timezone being used for the toString() formatting
        useSessionTz - boolean useSessionTz
        Returns:
        java timestamp object