PDataType implements DataType<T>, Comparable<PDataType<?>> { public int getResultSetSqlType() { return this.sqlType; } protected  PDataType(String sqlTypeName, int sqlType, Class clazz, PDataCodec codec, int ordinal); @Deprecated static PDataType[] values(); @Deprecated int ordinal(); @Override Class<T> encodedClass(); boolean isCastableTo(PDataType targetType); final PDataCodec getCodec(); boolean isBytesComparableWith(PDataType otherType); int estimateByteSize(Object o); Integer getMaxLength(Object o); Integer getScale(Object o); Integer estimateByteSizeFromLength(Integer length); final String getSqlTypeName(); final int getSqlType(); final Class getJavaClass(); boolean isArrayType(); final int compareTo(byte[] lhs, int lhsOffset, int lhsLength, SortOrder lhsSortOrder,
      byte[] rhs, int rhsOffset, int rhsLength, SortOrder rhsSortOrder,
      PDataType rhsType); static boolean isDoubleOrFloat(PDataType type); @Override boolean equals(Object o); static boolean equalsAny(PDataType lhs, PDataType... rhs); boolean isCoercibleTo(PDataType targetType); boolean isComparableTo(PDataType targetType); boolean isCoercibleTo(PDataType targetType, Object value); boolean isSizeCompatible(ImmutableBytesWritable ptr, Object value, PDataType srcType,
      Integer maxLength, Integer scale, Integer desiredMaxLength, Integer desiredScale); int compareTo(byte[] b1, byte[] b2); final int compareTo(ImmutableBytesWritable ptr1, ImmutableBytesWritable ptr2); final int compareTo(byte[] ba1, int offset1, int length1, SortOrder so1, byte[] ba2,
      int offset2, int length2, SortOrder so2); final int compareTo(ImmutableBytesWritable ptr1, SortOrder ptr1SortOrder,
      ImmutableBytesWritable ptr2, SortOrder ptr2SortOrder, PDataType type2); int compareTo(Object lhs, Object rhs); final boolean isNull(byte[] value); byte[] toBytes(Object object, SortOrder sortOrder); void coerceBytes(ImmutableBytesWritable ptr, Object o, PDataType actualType,
      Integer actualMaxLength, Integer actualScale, SortOrder actualModifier,
      Integer desiredMaxLength, Integer desiredScale, SortOrder expectedModifier); final void coerceBytes(ImmutableBytesWritable ptr, PDataType actualType,
      SortOrder actualModifier, SortOrder expectedModifier); final void coerceBytes(ImmutableBytesWritable ptr, PDataType actualType,
      SortOrder actualModifier,
      SortOrder expectedModifier, Integer desiredMaxLength); @Override boolean isNullable(); abstract Integer getByteSize(); @Override int encodedLength(T val); @Override int skip(PositionedByteRange pbr); @Override boolean isOrderPreserving(); @Override boolean isSkippable(); @Override Order getOrder(); abstract boolean isFixedWidth(); abstract int compareTo(Object lhs, Object rhs, PDataType rhsType); @Override int compareTo(PDataType<?> other); abstract int toBytes(Object object, byte[] bytes, int offset); @Override int encode(PositionedByteRange pbr, T val); @Override String toString(); abstract byte[] toBytes(Object object); abstract Object toObject(String value); abstract Object toObject(Object object, PDataType actualType); abstract Object toObject(byte[] bytes, int offset, int length, PDataType actualType,
      SortOrder sortOrder, Integer maxLength, Integer scale); @Override T decode(PositionedByteRange pbr); abstract Object getSampleValue(Integer maxLength, Integer arrayLength); final Object getSampleValue(); final Object getSampleValue(Integer maxLength); final Object toObject(byte[] bytes, int offset, int length, PDataType actualType,
      SortOrder sortOrder); final Object toObject(byte[] bytes, int offset, int length, PDataType actualType); final Object toObject(ImmutableBytesWritable ptr, PDataType actualType); final Object toObject(ImmutableBytesWritable ptr, PDataType actualType,
      SortOrder sortOrder); final Object toObject(ImmutableBytesWritable ptr, PDataType actualType,
      SortOrder sortOrder, Integer maxLength, Integer scale); final Object toObject(ImmutableBytesWritable ptr, SortOrder sortOrder, Integer maxLength,
      Integer scale); final Object toObject(ImmutableBytesWritable ptr); final Object toObject(ImmutableBytesWritable ptr, SortOrder sortOrder); final Object toObject(byte[] bytes, int offset, int length); final Object toObject(byte[] bytes); final Object toObject(byte[] bytes, SortOrder sortOrder); final Object toObject(byte[] bytes, SortOrder sortOrder, PDataType actualType); static PDataType fromSqlTypeName(String sqlTypeName); static int sqlArrayType(String sqlTypeName); static PDataType fromTypeId(int typeId); String getJavaClassName(); byte[] getJavaClassNameBytes(); byte[] getSqlTypeNameBytes(); int getResultSetSqlType(); KeyRange getKeyRange(byte[] point); final String toStringLiteral(ImmutableBytesWritable ptr, Format formatter); final String toStringLiteral(byte[] b, Format formatter); String toStringLiteral(byte[] b, int offset, int length, Format formatter); String toStringLiteral(Object o, Format formatter); PhoenixArrayFactory getArrayFactory(); static PhoenixArray instantiatePhoenixArray(PDataType actualType, Object[] elements); KeyRange getKeyRange(byte[] lowerRange, boolean lowerInclusive, byte[] upperRange,
      boolean upperInclusive); static PDataType fromLiteral(Object value); int getNanos(ImmutableBytesWritable ptr, SortOrder sortOrder); long getMillis(ImmutableBytesWritable ptr, SortOrder sortOrder); Object pad(Object object, Integer maxLength); void pad(ImmutableBytesWritable ptr, Integer maxLength); static PDataType arrayBaseType(PDataType arrayType); static final int MAX_PRECISION; static final int MIN_DECIMAL_AVG_SCALE; static final MathContext DEFAULT_MATH_CONTEXT; static final int DEFAULT_SCALE; static final byte[] FALSE_BYTES; static final byte[] TRUE_BYTES; static final byte[] NULL_BYTES; final static Integer ZERO; final static Integer INT_PRECISION; final static Integer LONG_PRECISION; final static Integer SHORT_PRECISION; final static Integer BYTE_PRECISION; static final int ARRAY_TYPE_BASE; static final String ARRAY_TYPE_SUFFIX; }
@Test public void testGetResultSetSqlType() { assertEquals(Types.INTEGER, PInteger.INSTANCE.getResultSetSqlType()); assertEquals(Types.INTEGER, PUnsignedInt.INSTANCE.getResultSetSqlType()); assertEquals(Types.BIGINT, PLong.INSTANCE.getResultSetSqlType()); assertEquals(Types.BIGINT, PUnsignedLong.INSTANCE.getResultSetSqlType()); assertEquals(Types.SMALLINT, PSmallint.INSTANCE.getResultSetSqlType()); assertEquals(Types.SMALLINT, PUnsignedSmallint.INSTANCE.getResultSetSqlType()); assertEquals(Types.TINYINT, PTinyint.INSTANCE.getResultSetSqlType()); assertEquals(Types.TINYINT, PUnsignedTinyint.INSTANCE.getResultSetSqlType()); assertEquals(Types.FLOAT, PFloat.INSTANCE.getResultSetSqlType()); assertEquals(Types.FLOAT, PUnsignedFloat.INSTANCE.getResultSetSqlType()); assertEquals(Types.DOUBLE, PDouble.INSTANCE.getResultSetSqlType()); assertEquals(Types.DOUBLE, PUnsignedDouble.INSTANCE.getResultSetSqlType()); assertEquals(Types.DATE, PDate.INSTANCE.getResultSetSqlType()); assertEquals(Types.DATE, PUnsignedDate.INSTANCE.getResultSetSqlType()); assertEquals(Types.TIME, PTime.INSTANCE.getResultSetSqlType()); assertEquals(Types.TIME, PUnsignedTime.INSTANCE.getResultSetSqlType()); assertEquals(Types.TIMESTAMP, PTimestamp.INSTANCE.getResultSetSqlType()); assertEquals(Types.TIMESTAMP, PUnsignedTimestamp.INSTANCE.getResultSetSqlType()); for (PDataType dataType : PDataType.values()) { if (dataType.isArrayType()) { assertEquals("Wrong datatype for " + dataType, Types.ARRAY, dataType.getResultSetSqlType()); } } }