http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDateArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDateArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDateArray.java index 764401c..a07418c 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDateArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDateArray.java @@ -17,93 +17,78 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; -import org.apache.phoenix.schema.SortOrder; - -import java.sql.Types; import java.sql.Date; -public class PDateArray extends PArrayDataType<Date[]> { - - public static final PDateArray INSTANCE = new PDateArray(); - - private PDateArray() { - super("DATE ARRAY", PDataType.ARRAY_TYPE_BASE + PDate.INSTANCE.getSqlType(), PhoenixArray.class, - null, 40); - } +import org.apache.phoenix.schema.SortOrder; - @Override - public boolean isArrayType() { - return true; - } +public class PDateArray extends PArrayDataType<Date[]> { - @Override - public boolean isFixedWidth() { - return false; - } + public static final PDateArray INSTANCE = new PDateArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PDateArray() { + super("DATE ARRAY", PDataType.ARRAY_TYPE_BASE + PDate.INSTANCE.getSqlType(), PhoenixArray.class, + null, 40); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PDate.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, Integer scale) { - return toObject(bytes, offset, length, PDate.INSTANCE, sortOrder, maxLength, scale, - PDate.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PDate.INSTANCE, sortOrder); } - PhoenixArray pArr = (PhoenixArray) value; - Object[] dateArr = (Object[]) pArr.array; - for (Object i : dateArr) { - if (!super.isCoercibleTo(PDate.INSTANCE, i)) { - return false; - } + + @Override + public Object toObject(byte[] bytes, int offset, int length, + PDataType actualType, SortOrder sortOrder, Integer maxLength, Integer scale) { + return toObject(bytes, offset, length, PDate.INSTANCE, sortOrder, maxLength, scale, + PDate.INSTANCE); } - return true; - } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); + } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale,SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { + return true; + } + PhoenixArray pArr = (PhoenixArray) value; + Object[] dateArr = (Object[]) pArr.array; + for (Object i : dateArr) { + if (!super.isCoercibleTo(PDate.INSTANCE, i)) { + return false; + } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PDate.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PDate.INSTANCE, arrayLength, maxLength); + } }
http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDecimalArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDecimalArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDecimalArray.java index 6874ac3..101546a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDecimalArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDecimalArray.java @@ -17,94 +17,72 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; -import org.apache.phoenix.schema.SortOrder; - import java.math.BigDecimal; -import java.sql.Types; - -public class PDecimalArray extends PArrayDataType<BigDecimal[]> { - - public static final PDecimalArray INSTANCE = new PDecimalArray(); - private PDecimalArray() { - super("DECIMAL ARRAY", PDataType.ARRAY_TYPE_BASE + PDecimal.INSTANCE.getSqlType(), - PhoenixArray.class, null, 35); - } +import org.apache.phoenix.schema.SortOrder; - @Override - public boolean isArrayType() { - return true; - } +public class PDecimalArray extends PArrayDataType<BigDecimal[]> { - @Override - public boolean isFixedWidth() { - return false; - } + public static final PDecimalArray INSTANCE = new PDecimalArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PDecimalArray() { + super("DECIMAL ARRAY", PDataType.ARRAY_TYPE_BASE + PDecimal.INSTANCE.getSqlType(), PhoenixArray.class, null, 35); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PDecimal.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, - Integer scale) { - return toObject(bytes, offset, length, PDecimal.INSTANCE, sortOrder, maxLength, scale, - PDecimal.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale, SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PDecimal.INSTANCE, sortOrder); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public Object toObject(byte[] bytes, int offset, int length, PDataType actualType, SortOrder sortOrder, + Integer maxLength, Integer scale) { + return toObject(bytes, offset, length, PDecimal.INSTANCE, sortOrder, maxLength, scale, PDecimal.INSTANCE); } - PhoenixArray pArr = (PhoenixArray) value; - Object[] decimalArr = (Object[]) pArr.array; - for (Object i : decimalArr) { - if (!super.isCoercibleTo(PDecimal.INSTANCE, i)) { - return false; - } + + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); } - return true; - } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { return true; } + PhoenixArray pArr = (PhoenixArray)value; + Object[] decimalArr = (Object[])pArr.array; + for (Object i : decimalArr) { + if (!super.isCoercibleTo(PDecimal.INSTANCE, i)) { return false; } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PDecimal.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PDecimal.INSTANCE, arrayLength, maxLength); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDoubleArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDoubleArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDoubleArray.java index 7ecec61..d585229 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDoubleArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PDoubleArray.java @@ -17,92 +17,76 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.phoenix.schema.SortOrder; -import java.sql.Types; - public class PDoubleArray extends PArrayDataType<double[]> { - public static final PDoubleArray INSTANCE = new PDoubleArray(); - - private PDoubleArray() { - super("DOUBLE ARRAY", PDataType.ARRAY_TYPE_BASE + PDouble.INSTANCE.getSqlType(), - PhoenixArray.class, null, 34); - } - - @Override - public boolean isArrayType() { - return true; - } - - @Override - public boolean isFixedWidth() { - return false; - } + public static final PDoubleArray INSTANCE = new PDoubleArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PDoubleArray() { + super("DOUBLE ARRAY", PDataType.ARRAY_TYPE_BASE + PDouble.INSTANCE.getSqlType(), + PhoenixArray.class, null, 34); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PDouble.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, Integer scale) { - return toObject(bytes, offset, length, PDouble.INSTANCE, sortOrder, maxLength, scale, - PDouble.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PDouble.INSTANCE, sortOrder); } - PhoenixArray.PrimitiveDoublePhoenixArray pArr = (PhoenixArray.PrimitiveDoublePhoenixArray) value; - double[] doubleArr = (double[]) pArr.array; - for (double i : doubleArr) { - if (!super.isCoercibleTo(PDouble.INSTANCE, i)) { - return false; - } + + @Override + public Object toObject(byte[] bytes, int offset, int length, + PDataType actualType, SortOrder sortOrder, Integer maxLength, Integer scale) { + return toObject(bytes, offset, length, PDouble.INSTANCE, sortOrder, maxLength, scale, + PDouble.INSTANCE); } - return true; - } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale, SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); + } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { + return true; + } + PhoenixArray.PrimitiveDoublePhoenixArray pArr = (PhoenixArray.PrimitiveDoublePhoenixArray) value; + double[] doubleArr = (double[]) pArr.array; + for (double i : doubleArr) { + if (!super.isCoercibleTo(PDouble.INSTANCE, i)) { + return false; + } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PDouble.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PDouble.INSTANCE, arrayLength, maxLength); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PFloatArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PFloatArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PFloatArray.java index 5e8ddb3..6005c3e 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PFloatArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PFloatArray.java @@ -17,93 +17,77 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.phoenix.schema.SortOrder; -import java.sql.Types; - public class PFloatArray extends PArrayDataType<float[]> { - public static final PFloatArray INSTANCE = new PFloatArray(); - - private PFloatArray() { - super("FLOAT ARRAY", PDataType.ARRAY_TYPE_BASE + PFloat.INSTANCE.getSqlType(), - PhoenixArray.class, null, 33); - } - - @Override - public boolean isArrayType() { - return true; - } - - @Override - public boolean isFixedWidth() { - return false; - } + public static final PFloatArray INSTANCE = new PFloatArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PFloatArray() { + super("FLOAT ARRAY", PDataType.ARRAY_TYPE_BASE + PFloat.INSTANCE.getSqlType(), + PhoenixArray.class, null, 33); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PFloat.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, - Integer scale) { - return toObject(bytes, offset, length, PFloat.INSTANCE, sortOrder, maxLength, scale, - PFloat.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PFloat.INSTANCE, sortOrder); } - PhoenixArray.PrimitiveFloatPhoenixArray pArr = (PhoenixArray.PrimitiveFloatPhoenixArray) value; - float[] floatArr = (float[]) pArr.array; - for (float i : floatArr) { - if (!super.isCoercibleTo(PFloat.INSTANCE, i)) { - return false; - } + + @Override + public Object toObject(byte[] bytes, int offset, int length, + PDataType actualType, SortOrder sortOrder, Integer maxLength, + Integer scale) { + return toObject(bytes, offset, length, PFloat.INSTANCE, sortOrder, maxLength, scale, + PFloat.INSTANCE); } - return true; - } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); + } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale, SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { + return true; + } + PhoenixArray.PrimitiveFloatPhoenixArray pArr = (PhoenixArray.PrimitiveFloatPhoenixArray) value; + float[] floatArr = (float[]) pArr.array; + for (float i : floatArr) { + if (!super.isCoercibleTo(PFloat.INSTANCE, i)) { + return false; + } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PFloat.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PFloat.INSTANCE, arrayLength, maxLength); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PIntegerArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PIntegerArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PIntegerArray.java index 28a5c4c..b317cfe 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PIntegerArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PIntegerArray.java @@ -17,93 +17,77 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.phoenix.schema.SortOrder; -import java.sql.Types; - public class PIntegerArray extends PArrayDataType<int[]> { - public static final PIntegerArray INSTANCE = new PIntegerArray(); - - private PIntegerArray() { - super("INTEGER ARRAY", PDataType.ARRAY_TYPE_BASE + PInteger.INSTANCE.getSqlType(), - PhoenixArray.class, null, 24); - } - - @Override - public boolean isArrayType() { - return true; - } - - @Override - public boolean isFixedWidth() { - return false; - } + public static final PIntegerArray INSTANCE = new PIntegerArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PIntegerArray() { + super("INTEGER ARRAY", PDataType.ARRAY_TYPE_BASE + PInteger.INSTANCE.getSqlType(), + PhoenixArray.class, null, 24); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PInteger.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, - Integer scale) { - return toObject(bytes, offset, length, PInteger.INSTANCE, sortOrder, maxLength, scale, - PInteger.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale, SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PInteger.INSTANCE, sortOrder); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public Object toObject(byte[] bytes, int offset, int length, + PDataType actualType, SortOrder sortOrder, Integer maxLength, + Integer scale) { + return toObject(bytes, offset, length, PInteger.INSTANCE, sortOrder, maxLength, scale, + PInteger.INSTANCE); } - PhoenixArray.PrimitiveIntPhoenixArray pArr = (PhoenixArray.PrimitiveIntPhoenixArray) value; - int[] intArr = (int[]) pArr.array; - for (int i : intArr) { - if (!super.isCoercibleTo(PInteger.INSTANCE, i)) { - return false; - } + + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); } - return true; - } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { + return true; + } + PhoenixArray.PrimitiveIntPhoenixArray pArr = (PhoenixArray.PrimitiveIntPhoenixArray) value; + int[] intArr = (int[]) pArr.array; + for (int i : intArr) { + if (!super.isCoercibleTo(PInteger.INSTANCE, i)) { + return false; + } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PInteger.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PInteger.INSTANCE, arrayLength, maxLength); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PLongArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PLongArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PLongArray.java index 0670792..aef6437 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PLongArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PLongArray.java @@ -17,93 +17,77 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.phoenix.schema.SortOrder; -import java.sql.Types; - public class PLongArray extends PArrayDataType<long[]> { - public static final PLongArray INSTANCE = new PLongArray(); - - private PLongArray() { - super("BIGINT ARRAY", PDataType.ARRAY_TYPE_BASE + PLong.INSTANCE.getSqlType(), - PhoenixArray.class, null, 30); - } - - @Override - public boolean isArrayType() { - return true; - } - - @Override - public boolean isFixedWidth() { - return false; - } + public static final PLongArray INSTANCE = new PLongArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PLongArray() { + super("BIGINT ARRAY", PDataType.ARRAY_TYPE_BASE + PLong.INSTANCE.getSqlType(), + PhoenixArray.class, null, 30); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PLong.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, - Integer scale) { - return toObject(bytes, offset, length, PLong.INSTANCE, sortOrder, maxLength, scale, - PLong.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PLong.INSTANCE, sortOrder); } - PhoenixArray.PrimitiveLongPhoenixArray pArr = (PhoenixArray.PrimitiveLongPhoenixArray) value; - long[] longArr = (long[]) pArr.array; - for (long i : longArr) { - if (!super.isCoercibleTo(PLong.INSTANCE, i)) { - return false; - } + + @Override + public Object toObject(byte[] bytes, int offset, int length, + PDataType actualType, SortOrder sortOrder, Integer maxLength, + Integer scale) { + return toObject(bytes, offset, length, PLong.INSTANCE, sortOrder, maxLength, scale, + PLong.INSTANCE); } - return true; - } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); + } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale, SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { + return true; + } + PhoenixArray.PrimitiveLongPhoenixArray pArr = (PhoenixArray.PrimitiveLongPhoenixArray) value; + long[] longArr = (long[]) pArr.array; + for (long i : longArr) { + if (!super.isCoercibleTo(PLong.INSTANCE, i)) { + return false; + } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PLong.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PLong.INSTANCE, arrayLength, maxLength); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PSmallintArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PSmallintArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PSmallintArray.java index 98da723..aea4384 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PSmallintArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PSmallintArray.java @@ -17,93 +17,77 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.phoenix.schema.SortOrder; -import java.sql.Types; - public class PSmallintArray extends PArrayDataType<short[]> { - public static final PSmallintArray INSTANCE = new PSmallintArray(); - - private PSmallintArray() { - super("SMALLINT ARRAY", PDataType.ARRAY_TYPE_BASE + PSmallint.INSTANCE.getSqlType(), - PhoenixArray.class, null, 31); - } - - @Override - public boolean isArrayType() { - return true; - } - - @Override - public boolean isFixedWidth() { - return false; - } + public static final PSmallintArray INSTANCE = new PSmallintArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PSmallintArray() { + super("SMALLINT ARRAY", PDataType.ARRAY_TYPE_BASE + PSmallint.INSTANCE.getSqlType(), + PhoenixArray.class, null, 31); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PSmallint.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, - Integer scale) { - return toObject(bytes, offset, length, PSmallint.INSTANCE, sortOrder, maxLength, scale, - PSmallint.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PSmallint.INSTANCE, sortOrder); } - PhoenixArray.PrimitiveShortPhoenixArray pArr = (PhoenixArray.PrimitiveShortPhoenixArray) value; - short[] shortArr = (short[]) pArr.array; - for (short i : shortArr) { - if (!super.isCoercibleTo(PSmallint.INSTANCE, i)) { - return false; - } + + @Override + public Object toObject(byte[] bytes, int offset, int length, + PDataType actualType, SortOrder sortOrder, Integer maxLength, + Integer scale) { + return toObject(bytes, offset, length, PSmallint.INSTANCE, sortOrder, maxLength, scale, + PSmallint.INSTANCE); } - return true; - } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); + } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale, SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { + return true; + } + PhoenixArray.PrimitiveShortPhoenixArray pArr = (PhoenixArray.PrimitiveShortPhoenixArray) value; + short[] shortArr = (short[]) pArr.array; + for (short i : shortArr) { + if (!super.isCoercibleTo(PSmallint.INSTANCE, i)) { + return false; + } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PSmallint.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PSmallint.INSTANCE, arrayLength, maxLength); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimeArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimeArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimeArray.java index e0a7655..c19fd71 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimeArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimeArray.java @@ -17,94 +17,79 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; -import org.apache.phoenix.schema.SortOrder; - import java.sql.Time; -import java.sql.Types; - -public class PTimeArray extends PArrayDataType<Time[]> { - - public static final PTimeArray INSTANCE = new PTimeArray(); - private PTimeArray() { - super("TIME ARRAY", PDataType.ARRAY_TYPE_BASE + PTime.INSTANCE.getSqlType(), PhoenixArray.class, - null, 38); - } +import org.apache.phoenix.schema.SortOrder; - @Override - public boolean isArrayType() { - return true; - } +public class PTimeArray extends PArrayDataType<Time[]> { - @Override - public boolean isFixedWidth() { - return false; - } + public static final PTimeArray INSTANCE = new PTimeArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PTimeArray() { + super("TIME ARRAY", PDataType.ARRAY_TYPE_BASE + PTime.INSTANCE.getSqlType(), PhoenixArray.class, + null, 38); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PTime.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, - Integer scale) { - return toObject(bytes, offset, length, PTime.INSTANCE, sortOrder, maxLength, scale, - PTime.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PTime.INSTANCE, sortOrder); } - PhoenixArray pArr = (PhoenixArray) value; - Object[] timeArr = (Object[]) pArr.array; - for (Object i : timeArr) { - if (!super.isCoercibleTo(PTime.INSTANCE, i)) { - return false; - } + + @Override + public Object toObject(byte[] bytes, int offset, int length, + PDataType actualType, SortOrder sortOrder, Integer maxLength, + Integer scale) { + return toObject(bytes, offset, length, PTime.INSTANCE, sortOrder, maxLength, scale, + PTime.INSTANCE); } - return true; - } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); + } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale, SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { + return true; + } + PhoenixArray pArr = (PhoenixArray) value; + Object[] timeArr = (Object[]) pArr.array; + for (Object i : timeArr) { + if (!super.isCoercibleTo(PTime.INSTANCE, i)) { + return false; + } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PTime.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PTime.INSTANCE, arrayLength, maxLength); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestampArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestampArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestampArray.java index d44bda9..562f139 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestampArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTimestampArray.java @@ -17,93 +17,79 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; -import org.apache.phoenix.schema.SortOrder; +import java.sql.Timestamp; -import java.sql.*; +import org.apache.phoenix.schema.SortOrder; public class PTimestampArray extends PArrayDataType<Timestamp[]> { - public static final PTimestampArray INSTANCE = new PTimestampArray(); - - private PTimestampArray() { - super("TIMESTAMP ARRAY", PDataType.ARRAY_TYPE_BASE + PTimestamp.INSTANCE.getSqlType(), - PhoenixArray.class, null, 36); - } - - @Override - public boolean isArrayType() { - return true; - } - - @Override - public boolean isFixedWidth() { - return false; - } + public static final PTimestampArray INSTANCE = new PTimestampArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PTimestampArray() { + super("TIMESTAMP ARRAY", PDataType.ARRAY_TYPE_BASE + PTimestamp.INSTANCE.getSqlType(), + PhoenixArray.class, null, 36); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PTimestamp.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, - Integer scale) { - return toObject(bytes, offset, length, PTimestamp.INSTANCE, sortOrder, maxLength, scale, - PTimestamp.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PTimestamp.INSTANCE, sortOrder); } - PhoenixArray pArr = (PhoenixArray) value; - Object[] timeStampArr = (Object[]) pArr.array; - for (Object i : timeStampArr) { - if (!super.isCoercibleTo(PTimestamp.INSTANCE, i)) { - return false; - } + + @Override + public Object toObject(byte[] bytes, int offset, int length, + PDataType actualType, SortOrder sortOrder, Integer maxLength, + Integer scale) { + return toObject(bytes, offset, length, PTimestamp.INSTANCE, sortOrder, maxLength, scale, + PTimestamp.INSTANCE); } - return true; - } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); + } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale, SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { + return true; + } + PhoenixArray pArr = (PhoenixArray) value; + Object[] timeStampArr = (Object[]) pArr.array; + for (Object i : timeStampArr) { + if (!super.isCoercibleTo(PTimestamp.INSTANCE, i)) { + return false; + } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PTimestamp.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PTimestamp.INSTANCE, arrayLength, maxLength); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTinyintArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTinyintArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTinyintArray.java index e0b300d..7ffaeb1 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTinyintArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PTinyintArray.java @@ -17,93 +17,77 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.phoenix.schema.SortOrder; -import java.sql.Types; - public class PTinyintArray extends PArrayDataType<byte[]> { - public static final PTinyintArray INSTANCE = new PTinyintArray(); - - private PTinyintArray() { - super("TINYINT ARRAY", PDataType.ARRAY_TYPE_BASE + PTinyint.INSTANCE.getSqlType(), - PhoenixArray.class, null, 32); - } - - @Override - public boolean isArrayType() { - return true; - } - - @Override - public boolean isFixedWidth() { - return false; - } + public static final PTinyintArray INSTANCE = new PTinyintArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PTinyintArray() { + super("TINYINT ARRAY", PDataType.ARRAY_TYPE_BASE + PTinyint.INSTANCE.getSqlType(), + PhoenixArray.class, null, 32); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PTinyint.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, - Integer scale) { - return toObject(bytes, offset, length, PTinyint.INSTANCE, sortOrder, maxLength, scale, - PTinyint.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale, SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PTinyint.INSTANCE, sortOrder); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public Object toObject(byte[] bytes, int offset, int length, + PDataType actualType, SortOrder sortOrder, Integer maxLength, + Integer scale) { + return toObject(bytes, offset, length, PTinyint.INSTANCE, sortOrder, maxLength, scale, + PTinyint.INSTANCE); } - PhoenixArray.PrimitiveBytePhoenixArray pArr = (PhoenixArray.PrimitiveBytePhoenixArray) value; - byte[] byteArr = (byte[]) pArr.array; - for (byte i : byteArr) { - if (!super.isCoercibleTo(PTinyint.INSTANCE, i)) { - return false; - } + + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); } - return true; - } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { + return true; + } + PhoenixArray.PrimitiveBytePhoenixArray pArr = (PhoenixArray.PrimitiveBytePhoenixArray) value; + byte[] byteArr = (byte[]) pArr.array; + for (byte i : byteArr) { + if (!super.isCoercibleTo(PTinyint.INSTANCE, i)) { + return false; + } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PTinyint.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PTinyint.INSTANCE, arrayLength, maxLength); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDateArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDateArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDateArray.java index 859c93b..b2e173a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDateArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDateArray.java @@ -17,94 +17,74 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; -import org.apache.phoenix.schema.SortOrder; - -import java.sql.Types; import java.util.Date; -public class PUnsignedDateArray extends PArrayDataType<Date> { - - public static final PUnsignedDateArray INSTANCE = new PUnsignedDateArray(); - - private PUnsignedDateArray() { - super("UNSIGNED_DATE ARRAY", PDataType.ARRAY_TYPE_BASE + PUnsignedDate.INSTANCE.getSqlType(), - PhoenixArray.class, null, 41); - } +import org.apache.phoenix.schema.SortOrder; - @Override - public boolean isArrayType() { - return true; - } +public class PUnsignedDateArray extends PArrayDataType<Date> { - @Override - public boolean isFixedWidth() { - return false; - } + public static final PUnsignedDateArray INSTANCE = new PUnsignedDateArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PUnsignedDateArray() { + super("UNSIGNED_DATE ARRAY", PDataType.ARRAY_TYPE_BASE + PUnsignedDate.INSTANCE.getSqlType(), + PhoenixArray.class, null, 41); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PUnsignedDate.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, - Integer scale) { - return toObject(bytes, offset, length, PUnsignedDate.INSTANCE, sortOrder, maxLength, - scale, PUnsignedDate.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PUnsignedDate.INSTANCE, sortOrder); } - PhoenixArray pArr = (PhoenixArray) value; - Object[] dateArr = (Object[]) pArr.array; - for (Object i : dateArr) { - if (!super.isCoercibleTo(PUnsignedDate.INSTANCE, i)) { - return false; - } + + @Override + public Object toObject(byte[] bytes, int offset, int length, PDataType actualType, SortOrder sortOrder, + Integer maxLength, Integer scale) { + return toObject(bytes, offset, length, PUnsignedDate.INSTANCE, sortOrder, maxLength, scale, + PUnsignedDate.INSTANCE); } - return true; - } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); + } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale, SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { return true; } + PhoenixArray pArr = (PhoenixArray)value; + Object[] dateArr = (Object[])pArr.array; + for (Object i : dateArr) { + if (!super.isCoercibleTo(PUnsignedDate.INSTANCE, i)) { return false; } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PUnsignedDate.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PUnsignedDate.INSTANCE, arrayLength, maxLength); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDoubleArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDoubleArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDoubleArray.java index 50c69bf..be16178 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDoubleArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedDoubleArray.java @@ -17,96 +17,80 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.phoenix.schema.SortOrder; -import java.sql.Types; - public class PUnsignedDoubleArray extends PArrayDataType<double[]> { - public static final PUnsignedDoubleArray INSTANCE = new PUnsignedDoubleArray(); - - private PUnsignedDoubleArray() { - super("UNSIGNED_DOUBLE ARRAY", PDataType.ARRAY_TYPE_BASE + PUnsignedDouble.INSTANCE.getSqlType(), - PhoenixArray.class, null, 47); - } - - @Override - public boolean isArrayType() { - return true; - } - - @Override - public boolean isFixedWidth() { - return false; - } + public static final PUnsignedDoubleArray INSTANCE = new PUnsignedDoubleArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PUnsignedDoubleArray() { + super("UNSIGNED_DOUBLE ARRAY", PDataType.ARRAY_TYPE_BASE + PUnsignedDouble.INSTANCE.getSqlType(), + PhoenixArray.class, null, 47); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PUnsignedDouble.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, - Integer scale) { - return toObject(bytes, offset, length, PUnsignedDouble.INSTANCE, sortOrder, maxLength, - scale, PUnsignedDouble.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale, SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PUnsignedDouble.INSTANCE, sortOrder); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public Object toObject(byte[] bytes, int offset, int length, + PDataType actualType, SortOrder sortOrder, Integer maxLength, + Integer scale) { + return toObject(bytes, offset, length, PUnsignedDouble.INSTANCE, sortOrder, maxLength, + scale, PUnsignedDouble.INSTANCE); } - PhoenixArray pArr = (PhoenixArray) value; - Object[] doubleArr = (Object[]) pArr.array; - for (Object i : doubleArr) { - if (!super.isCoercibleTo(PUnsignedDouble.INSTANCE, i) && (!super.isCoercibleTo( - PUnsignedTimestamp.INSTANCE, i)) - && (!super.isCoercibleTo(PUnsignedTime.INSTANCE, i)) && (!super - .isCoercibleTo(PUnsignedDate.INSTANCE, i))) { - return false; - } + + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); } - return true; - } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { + return true; + } + PhoenixArray pArr = (PhoenixArray) value; + Object[] doubleArr = (Object[]) pArr.array; + for (Object i : doubleArr) { + if (!super.isCoercibleTo(PUnsignedDouble.INSTANCE, i) && (!super.isCoercibleTo( + PUnsignedTimestamp.INSTANCE, i)) + && (!super.isCoercibleTo(PUnsignedTime.INSTANCE, i)) && (!super + .isCoercibleTo(PUnsignedDate.INSTANCE, i))) { + return false; + } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PUnsignedDouble.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PUnsignedDouble.INSTANCE, arrayLength, maxLength); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedFloatArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedFloatArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedFloatArray.java index db9d075..bc1e1fb 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedFloatArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedFloatArray.java @@ -17,93 +17,77 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.phoenix.schema.SortOrder; -import java.sql.Types; - public class PUnsignedFloatArray extends PArrayDataType<float[]> { - public static final PUnsignedFloatArray INSTANCE = new PUnsignedFloatArray(); - - private PUnsignedFloatArray() { - super("UNSIGNED_FLOAT ARRAY", PDataType.ARRAY_TYPE_BASE + PUnsignedFloat.INSTANCE.getSqlType(), - PhoenixArray.class, null, 46); - } - - @Override - public boolean isArrayType() { - return true; - } - - @Override - public boolean isFixedWidth() { - return false; - } + public static final PUnsignedFloatArray INSTANCE = new PUnsignedFloatArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PUnsignedFloatArray() { + super("UNSIGNED_FLOAT ARRAY", PDataType.ARRAY_TYPE_BASE + PUnsignedFloat.INSTANCE.getSqlType(), + PhoenixArray.class, null, 46); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PUnsignedFloat.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, - Integer scale) { - return toObject(bytes, offset, length, PUnsignedFloat.INSTANCE, sortOrder, maxLength, - scale, PUnsignedFloat.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PUnsignedFloat.INSTANCE, sortOrder); } - PhoenixArray pArr = (PhoenixArray) value; - Object[] floatArr = (Object[]) pArr.array; - for (Object i : floatArr) { - if (!super.isCoercibleTo(PUnsignedFloat.INSTANCE, i)) { - return false; - } + + @Override + public Object toObject(byte[] bytes, int offset, int length, + PDataType actualType, SortOrder sortOrder, Integer maxLength, + Integer scale) { + return toObject(bytes, offset, length, PUnsignedFloat.INSTANCE, sortOrder, maxLength, + scale, PUnsignedFloat.INSTANCE); } - return true; - } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); + } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale, SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { + return true; + } + PhoenixArray pArr = (PhoenixArray) value; + Object[] floatArr = (Object[]) pArr.array; + for (Object i : floatArr) { + if (!super.isCoercibleTo(PUnsignedFloat.INSTANCE, i)) { + return false; + } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PUnsignedFloat.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PUnsignedFloat.INSTANCE, arrayLength, maxLength); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedIntArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedIntArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedIntArray.java index 11e5f10..3d430e4 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedIntArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedIntArray.java @@ -17,93 +17,77 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.phoenix.schema.SortOrder; -import java.sql.Types; - public class PUnsignedIntArray extends PArrayDataType<int[]> { - public static final PUnsignedIntArray INSTANCE = new PUnsignedIntArray(); - - private PUnsignedIntArray() { - super("UNSIGNED_INT ARRAY", PDataType.ARRAY_TYPE_BASE + PUnsignedInt.INSTANCE.getSqlType(), - PhoenixArray.class, null, 43); - } - - @Override - public boolean isArrayType() { - return true; - } - - @Override - public boolean isFixedWidth() { - return false; - } + public static final PUnsignedIntArray INSTANCE = new PUnsignedIntArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PUnsignedIntArray() { + super("UNSIGNED_INT ARRAY", PDataType.ARRAY_TYPE_BASE + PUnsignedInt.INSTANCE.getSqlType(), + PhoenixArray.class, null, 43); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PUnsignedInt.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, - Integer scale) { - return toObject(bytes, offset, length, PUnsignedInt.INSTANCE, sortOrder, maxLength, - scale, PUnsignedInt.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PUnsignedInt.INSTANCE, sortOrder); } - PhoenixArray pArr = (PhoenixArray) value; - Object[] intArr = (Object[]) pArr.array; - for (Object i : intArr) { - if (!super.isCoercibleTo(PUnsignedInt.INSTANCE, i)) { - return false; - } + + @Override + public Object toObject(byte[] bytes, int offset, int length, + PDataType actualType, SortOrder sortOrder, Integer maxLength, + Integer scale) { + return toObject(bytes, offset, length, PUnsignedInt.INSTANCE, sortOrder, maxLength, + scale, PUnsignedInt.INSTANCE); } - return true; - } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); + } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale, SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { + return true; + } + PhoenixArray pArr = (PhoenixArray) value; + Object[] intArr = (Object[]) pArr.array; + for (Object i : intArr) { + if (!super.isCoercibleTo(PUnsignedInt.INSTANCE, i)) { + return false; + } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PUnsignedInt.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PUnsignedInt.INSTANCE, arrayLength, maxLength); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedLongArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedLongArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedLongArray.java index dcbe210..2a7c5ef 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedLongArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedLongArray.java @@ -17,93 +17,77 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.phoenix.schema.SortOrder; -import java.sql.Types; - public class PUnsignedLongArray extends PArrayDataType<long[]> { - public static final PUnsignedLongArray INSTANCE = new PUnsignedLongArray(); - - private PUnsignedLongArray() { - super("UNSIGNED_LONG ARRAY", PDataType.ARRAY_TYPE_BASE + PUnsignedLong.INSTANCE.getSqlType(), - PhoenixArray.class, null, 42); - } - - @Override - public boolean isArrayType() { - return true; - } - - @Override - public boolean isFixedWidth() { - return false; - } + public static final PUnsignedLongArray INSTANCE = new PUnsignedLongArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PUnsignedLongArray() { + super("UNSIGNED_LONG ARRAY", PDataType.ARRAY_TYPE_BASE + PUnsignedLong.INSTANCE.getSqlType(), + PhoenixArray.class, null, 42); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PUnsignedLong.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, - Integer scale) { - return toObject(bytes, offset, length, PUnsignedLong.INSTANCE, sortOrder, maxLength, - scale, PUnsignedLong.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PUnsignedLong.INSTANCE, sortOrder); } - PhoenixArray pArr = (PhoenixArray) value; - Object[] longArr = (Object[]) pArr.array; - for (Object i : longArr) { - if (!super.isCoercibleTo(PUnsignedLong.INSTANCE, i)) { - return false; - } + + @Override + public Object toObject(byte[] bytes, int offset, int length, + PDataType actualType, SortOrder sortOrder, Integer maxLength, + Integer scale) { + return toObject(bytes, offset, length, PUnsignedLong.INSTANCE, sortOrder, maxLength, + scale, PUnsignedLong.INSTANCE); } - return true; - } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); + } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale, SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { + return true; + } + PhoenixArray pArr = (PhoenixArray) value; + Object[] longArr = (Object[]) pArr.array; + for (Object i : longArr) { + if (!super.isCoercibleTo(PUnsignedLong.INSTANCE, i)) { + return false; + } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PUnsignedLong.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PUnsignedLong.INSTANCE, arrayLength, maxLength); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedSmallintArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedSmallintArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedSmallintArray.java index 36823c2..f481efb 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedSmallintArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedSmallintArray.java @@ -17,94 +17,78 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.phoenix.schema.SortOrder; -import java.sql.Types; - public class PUnsignedSmallintArray extends PArrayDataType<short[]> { - public static final PUnsignedSmallintArray INSTANCE = new PUnsignedSmallintArray(); - - private PUnsignedSmallintArray() { - super("UNSIGNED_SMALLINT ARRAY", - PDataType.ARRAY_TYPE_BASE + PUnsignedSmallint.INSTANCE.getSqlType(), PhoenixArray.class, - null, 44); - } - - @Override - public boolean isArrayType() { - return true; - } - - @Override - public boolean isFixedWidth() { - return false; - } + public static final PUnsignedSmallintArray INSTANCE = new PUnsignedSmallintArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PUnsignedSmallintArray() { + super("UNSIGNED_SMALLINT ARRAY", + PDataType.ARRAY_TYPE_BASE + PUnsignedSmallint.INSTANCE.getSqlType(), PhoenixArray.class, + null, 44); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PUnsignedSmallint.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, - Integer scale) { - return toObject(bytes, offset, length, PUnsignedSmallint.INSTANCE, sortOrder, maxLength, - scale, PUnsignedSmallint.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PUnsignedSmallint.INSTANCE, sortOrder); } - PhoenixArray pArr = (PhoenixArray) value; - Object[] shortArr = (Object[]) pArr.array; - for (Object i : shortArr) { - if (!super.isCoercibleTo(PUnsignedSmallint.INSTANCE, i)) { - return false; - } + + @Override + public Object toObject(byte[] bytes, int offset, int length, + PDataType actualType, SortOrder sortOrder, Integer maxLength, + Integer scale) { + return toObject(bytes, offset, length, PUnsignedSmallint.INSTANCE, sortOrder, maxLength, + scale, PUnsignedSmallint.INSTANCE); } - return true; - } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); + } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale, SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { + return true; + } + PhoenixArray pArr = (PhoenixArray) value; + Object[] shortArr = (Object[]) pArr.array; + for (Object i : shortArr) { + if (!super.isCoercibleTo(PUnsignedSmallint.INSTANCE, i)) { + return false; + } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PUnsignedSmallint.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PUnsignedSmallint.INSTANCE, arrayLength, maxLength); + } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2620a80c/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedTimeArray.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedTimeArray.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedTimeArray.java index 9d7584b..0851d48 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedTimeArray.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/types/PUnsignedTimeArray.java @@ -17,93 +17,79 @@ */ package org.apache.phoenix.schema.types; -import org.apache.hadoop.hbase.io.ImmutableBytesWritable; -import org.apache.phoenix.schema.SortOrder; +import java.sql.Time; -import java.sql.*; +import org.apache.phoenix.schema.SortOrder; public class PUnsignedTimeArray extends PArrayDataType<Time[]> { - public static final PUnsignedTimeArray INSTANCE = new PUnsignedTimeArray(); - - private PUnsignedTimeArray() { - super("UNSIGNED_TIME ARRAY", PDataType.ARRAY_TYPE_BASE + PUnsignedTime.INSTANCE.getSqlType(), - PhoenixArray.class, null, 39); - } - - @Override - public boolean isArrayType() { - return true; - } - - @Override - public boolean isFixedWidth() { - return false; - } + public static final PUnsignedTimeArray INSTANCE = new PUnsignedTimeArray(); - @Override - public int compareTo(Object lhs, Object rhs, PDataType rhsType) { - return compareTo(lhs, rhs); - } + private PUnsignedTimeArray() { + super("UNSIGNED_TIME ARRAY", PDataType.ARRAY_TYPE_BASE + PUnsignedTime.INSTANCE.getSqlType(), + PhoenixArray.class, null, 39); + } - @Override - public Integer getByteSize() { - return null; - } + @Override + public boolean isArrayType() { + return true; + } - @Override - public byte[] toBytes(Object object) { - return toBytes(object, SortOrder.ASC); - } + @Override + public boolean isFixedWidth() { + return false; + } - @Override - public byte[] toBytes(Object object, SortOrder sortOrder) { - return toBytes(object, PUnsignedTime.INSTANCE, sortOrder); - } + @Override + public int compareTo(Object lhs, Object rhs, PDataType rhsType) { + return compareTo(lhs, rhs); + } - @Override - public Object toObject(byte[] bytes, int offset, int length, - PDataType actualType, SortOrder sortOrder, Integer maxLength, - Integer scale) { - return toObject(bytes, offset, length, PUnsignedTime.INSTANCE, sortOrder, maxLength, - scale, PUnsignedTime.INSTANCE); - } + @Override + public Integer getByteSize() { + return null; + } - @Override - public boolean isCoercibleTo(PDataType targetType) { - return isCoercibleTo(targetType, this); - } + @Override + public byte[] toBytes(Object object) { + return toBytes(object, SortOrder.ASC); + } - @Override - public boolean isCoercibleTo(PDataType targetType, Object value) { - if (value == null) { - return true; + @Override + public byte[] toBytes(Object object, SortOrder sortOrder) { + return toBytes(object, PUnsignedTime.INSTANCE, sortOrder); } - PhoenixArray pArr = (PhoenixArray) value; - Object[] timeArr = (Object[]) pArr.array; - for (Object i : timeArr) { - if (!super.isCoercibleTo(PUnsignedTime.INSTANCE, i)) { - return false; - } + + @Override + public Object toObject(byte[] bytes, int offset, int length, + PDataType actualType, SortOrder sortOrder, Integer maxLength, + Integer scale) { + return toObject(bytes, offset, length, PUnsignedTime.INSTANCE, sortOrder, maxLength, + scale, PUnsignedTime.INSTANCE); } - return true; - } - @Override - public void coerceBytes(ImmutableBytesWritable ptr, Object object, PDataType actualType, - Integer maxLength, Integer scale, SortOrder actualModifer, Integer desiredMaxLength, - Integer desiredScale, SortOrder desiredModifier) { - coerceBytes(ptr, object, actualType, maxLength, scale, desiredMaxLength, desiredScale, - this, actualModifer, desiredModifier); - } + @Override + public boolean isCoercibleTo(PDataType targetType) { + return isCoercibleTo(targetType, this); + } - @Override - public int getResultSetSqlType() { - return Types.ARRAY; - } + @Override + public boolean isCoercibleTo(PDataType targetType, Object value) { + if (value == null) { + return true; + } + PhoenixArray pArr = (PhoenixArray) value; + Object[] timeArr = (Object[]) pArr.array; + for (Object i : timeArr) { + if (!super.isCoercibleTo(PUnsignedTime.INSTANCE, i)) { + return false; + } + } + return true; + } - @Override - public Object getSampleValue(Integer maxLength, Integer arrayLength) { - return getSampleValue(PUnsignedTime.INSTANCE, arrayLength, maxLength); - } + @Override + public Object getSampleValue(Integer maxLength, Integer arrayLength) { + return getSampleValue(PUnsignedTime.INSTANCE, arrayLength, maxLength); + } }
