Codota Logo
com.facebook.presto.spi.type
Code IndexAdd Codota to your IDE (free)

How to use com.facebook.presto.spi.type

Best Java code snippets using com.facebook.presto.spi.type (Showing top 20 results out of 504)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Charset c =
  • Codota IconString charsetName;Charset.forName(charsetName)
  • Codota IconCharset.defaultCharset()
  • Codota IconContentType contentType;contentType.getCharset()
  • Smart code suggestions by Codota
}
origin: prestodb/presto

  private static boolean convertibleToDoubleWithCast(Type type)
  {
    return type instanceof DecimalType
        || DoubleType.DOUBLE.equals(type)
        || RealType.REAL.equals(type)
        || BigintType.BIGINT.equals(type)
        || IntegerType.INTEGER.equals(type)
        || SmallintType.SMALLINT.equals(type)
        || TinyintType.TINYINT.equals(type)
        || BooleanType.BOOLEAN.equals(type);
  }
}
origin: prestodb/presto

private boolean satisfiesCoercion(boolean allowCoercion, Type fromType, TypeSignature toTypeSignature)
{
  if (allowCoercion) {
    return typeManager.canCoerce(fromType, typeManager.getType(toTypeSignature));
  }
  else {
    return fromType.getTypeSignature().equals(toTypeSignature);
  }
}
origin: prestodb/presto

@Override
public String getDisplayName()
{
  if (length == UNBOUNDED_LENGTH) {
    return getTypeSignature().getBase();
  }
  return getTypeSignature().toString();
}
origin: prestodb/presto

  @Override
  protected Type _deserialize(String value, DeserializationContext context)
  {
    return typeManager.getType(parseTypeSignature(value));
  }
}
origin: prestodb/presto

protected static SqlDecimal decimal(String decimalString)
{
  DecimalParseResult parseResult = Decimals.parseIncludeLeadingZerosInPrecision(decimalString);
  BigInteger unscaledValue;
  if (parseResult.getType().isShort()) {
    unscaledValue = BigInteger.valueOf((Long) parseResult.getObject());
  }
  else {
    unscaledValue = Decimals.decodeUnscaledValue((Slice) parseResult.getObject());
  }
  return new SqlDecimal(unscaledValue, parseResult.getType().getPrecision(), parseResult.getType().getScale());
}
origin: prestodb/presto

@Override
protected String formatOneLine()
{
  return type.getTypeSignature().toString();
}
origin: prestodb/presto

  @Override
  protected Object getGreaterValue(Object value)
  {
    // time zone doesn't matter for ordering
    return packDateTimeWithZone(unpackMillisUtc((Long) value) + 10, getTimeZoneKeyForOffset(33));
  }
}
origin: prestodb/presto

@Override
protected void writeDecimalToBlock(BigDecimal decimal, BlockBuilder blockBuilder)
{
  longDecimalType.writeSlice(blockBuilder, encodeScaledValue(decimal));
}
origin: prestodb/presto

DecimalType(int precision, int scale, Class<?> javaType)
{
  super(new TypeSignature(StandardTypes.DECIMAL, buildTypeParameters(precision, scale)), javaType);
  this.precision = precision;
  this.scale = scale;
}
origin: prestodb/presto

@Override
public String toString()
{
  return getTypeSignature().toString();
}
origin: prestodb/presto

@Override
public String getDisplayName()
{
  return getTypeSignature().toString();
}
origin: prestodb/presto

@Override
public Type getParameterizedType(String baseTypeName, List<TypeSignatureParameter> typeParameters)
{
  return getType(new TypeSignature(baseTypeName, typeParameters));
}
origin: prestodb/presto

public static int byteCountWithoutTrailingSpace(Slice slice, int offset, int length, int codePointCount)
{
  int truncatedLength = byteCount(slice, offset, length, codePointCount);
  return byteCountWithoutTrailingSpace(slice, offset, truncatedLength);
}
origin: prestodb/presto

public static DecimalType createDecimalType(int precision, int scale)
{
  if (precision <= MAX_SHORT_PRECISION) {
    return new ShortDecimalType(precision, scale);
  }
  else {
    return new LongDecimalType(precision, scale);
  }
}
origin: prestodb/presto

  @Override
  protected Type _deserialize(String value, DeserializationContext context)
  {
    return typeManager.getType(parseTypeSignature(value));
  }
}
origin: prestodb/presto

  @Override
  protected Object getGreaterValue(Object value)
  {
    // time zone doesn't matter for ordering
    return packDateTimeWithZone(unpackMillisUtc((Long) value) + 10, getTimeZoneKeyForOffset(33));
  }
}
origin: prestodb/presto

@Override
protected void writeDecimalToBlock(BigDecimal decimal, BlockBuilder blockBuilder)
{
  LONG_DECIMAL_TYPE.writeSlice(blockBuilder, encodeScaledValue(decimal));
}
origin: prestodb/presto

public static int computeTruncatedLength(Slice slice, int offset, int length, int maxCodePointCount, boolean isCharType)
{
  if (isCharType) {
    // truncate the characters and then remove the trailing white spaces
    return byteCountWithoutTrailingSpace(slice, offset, length, maxCodePointCount);
  }
  if (maxCodePointCount >= 0 && length > maxCodePointCount) {
    return byteCount(slice, offset, length, maxCodePointCount);
  }
  return length;
}
origin: prestodb/presto

  @Override
  protected Type _deserialize(String value, DeserializationContext context)
  {
    return typeManager.getType(parseTypeSignature(value));
  }
}
origin: prestodb/presto

  @Override
  protected Type _deserialize(String value, DeserializationContext context)
  {
    return typeManager.getType(parseTypeSignature(value));
  }
}
com.facebook.presto.spi.type

Most used classes

  • Type
  • VarcharType
  • TypeSignature
  • BigintType
  • TypeManager
  • DoubleType,
  • DateType,
  • TimestampType,
  • Varchars,
  • TypeSignatureParameter,
  • IntegerType,
  • VarbinaryType,
  • DecimalType,
  • Decimals,
  • NamedTypeSignature,
  • ArrayType,
  • RealType,
  • TimeZoneKey,
  • CharType
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now