Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package com.facebook.presto.type;
 
 
 import static com.facebook.presto.metadata.OperatorType.BETWEEN;
 import static com.facebook.presto.metadata.OperatorType.CAST;
 import static com.facebook.presto.metadata.OperatorType.EQUAL;
 import static com.facebook.presto.metadata.OperatorType.GREATER_THAN;
 import static com.facebook.presto.metadata.OperatorType.GREATER_THAN_OR_EQUAL;
 import static com.facebook.presto.metadata.OperatorType.HASH_CODE;
 import static com.facebook.presto.metadata.OperatorType.LESS_THAN;
 import static com.facebook.presto.metadata.OperatorType.LESS_THAN_OR_EQUAL;
 import static com.facebook.presto.metadata.OperatorType.NOT_EQUAL;
 import static com.facebook.presto.spi.type.DateTimeEncoding.unpackMillisUtc;
 import static com.facebook.presto.util.DateTimeUtils.printTimeWithTimeZone;
 import static java.nio.charset.StandardCharsets.UTF_8;
 
 public final class TimeWithTimeZoneOperators
 {
     private TimeWithTimeZoneOperators()
     {
     }
 
     public static boolean equal(@SqlType(.long left, @SqlType(.long right)
     {
         return unpackMillisUtc(left) == unpackMillisUtc(right);
     }
 
     public static boolean notEqual(@SqlType(.long left, @SqlType(.long right)
     {
         return unpackMillisUtc(left) != unpackMillisUtc(right);
     }
 
     public static boolean lessThan(@SqlType(.long left, @SqlType(.long right)
     {
         return unpackMillisUtc(left) < unpackMillisUtc(right);
     }
 
     public static boolean lessThanOrEqual(@SqlType(.long left, @SqlType(.long right)
     {
         return unpackMillisUtc(left) <= unpackMillisUtc(right);
     }
 
     public static boolean greaterThan(@SqlType(.long left, @SqlType(.long right)
     {
         return unpackMillisUtc(left) > unpackMillisUtc(right);
     }
 
     public static boolean greaterThanOrEqual(@SqlType(.long left, @SqlType(.long right)
     {
         return unpackMillisUtc(left) >= unpackMillisUtc(right);
     }
 
     public static boolean between(@SqlType(.long value, @SqlType(.long min, @SqlType(.long max)
     {
         return unpackMillisUtc(min) <= unpackMillisUtc(value) && unpackMillisUtc(value) <= unpackMillisUtc(max);
     }
 
     public static long castToTime(ConnectorSession session, @SqlType(.long value)
     {
         return unpackMillisUtc(value);
     }
 
     public static long castToTimestamp(@SqlType(.long value)
    {
        return unpackMillisUtc(value);
    }
    public static long castToTimestampWithTimeZone(@SqlType(.long value)
    {
        return value;
    }
    public static Slice castToSlice(@SqlType(.long value)
    {
        return Slices.copiedBuffer(printTimeWithTimeZone(value), );
    }
    public static long hashCode(@SqlType(.long value)
    {
        long millis = unpackMillisUtc(value);
        return (int) (millis ^ (millis >>> 32));
    }
New to GrepCode? Check out our FAQ X