@Override public void convertType(byte[] data, int start, int length, DataOutput out) throws IOException { long targetValue = convertType(data, start); out.writeByte(ATypeTag.BIGINT.serialize()); out.writeLong(targetValue); }
public static int getNumberOfItems(byte[] serOrderedList, int offset) { if (serOrderedList[offset] == ATypeTag.ARRAY.serialize()) { // 6 = tag (1) + itemTag (1) + list size (4) return AInt32SerializerDeserializer.getInt(serOrderedList, offset + 6); } else { return -1; } }
public static int getStartSize(byte[] data, int start) { if (getIntervalTimeType(data, start) == ATypeTag.DATETIME.serialize()) { return Long.BYTES; } else { return Integer.BYTES; } }
public boolean isTyped() { if (getType() != ATypeTag.ANY.serialize()) { return true; } return false; }
public static int getNumberOfItems(byte[] serOrderedList, int offset) { if (serOrderedList[offset] == ATypeTag.MULTISET.serialize()) { // 6 = tag (1) + itemTag (1) + list size (4) return AInt32SerializerDeserializer.getInt(serOrderedList, offset + 6); } else { return -1; } }
@Override public void convertType(byte[] data, int start, int length, DataOutput out) throws IOException { int targetValue = convertType(data, start); out.writeByte(ATypeTag.INTEGER.serialize()); out.writeInt(targetValue); }
@Override public void convertType(byte[] data, int start, int length, DataOutput out) throws IOException { double sourceValue = DoublePointable.getDouble(data, start); byte targetValue = convert(sourceValue); out.writeByte(ATypeTag.TINYINT.serialize()); out.writeByte(targetValue); }
@Override public void convertType(byte[] data, int start, int length, DataOutput out) throws IOException { float sourceValue = FloatPointable.getFloat(data, start); byte targetValue = convert(sourceValue); out.writeByte(ATypeTag.TINYINT.serialize()); out.writeByte(targetValue); }
@Override public void convertType(byte[] data, int start, int length, DataOutput out) throws IOException { double sourceValue = DoublePointable.getDouble(data, start); float targetValue = convert(sourceValue); out.writeByte(ATypeTag.FLOAT.serialize()); out.writeFloat(targetValue); }
@Override public void convertType(byte[] data, int start, int length, DataOutput out) throws IOException { float sourceValue = FloatPointable.getFloat(data, start); short targetValue = convert(sourceValue); out.writeByte(ATypeTag.SMALLINT.serialize()); out.writeShort(targetValue); }
@Override public void convertType(byte[] data, int start, int length, DataOutput out) throws IOException { double sourceValue = DoublePointable.getDouble(data, start); short targetValue = convert(sourceValue); out.writeByte(ATypeTag.SMALLINT.serialize()); out.writeShort(targetValue); }
protected void parseString(char[] buffer, int begin, int length, DataOutput out) throws HyracksDataException { try { out.writeByte(ATypeTag.STRING.serialize()); untaggedStringSerde.serialize(buffer, begin, length, out); } catch (IOException e) { throw new ParseException(e); } } }
/** * Serialize the field with a type tag * * @param dataOutput * @throws IOException */ default void serialize(DataOutput dataOutput) throws IOException { dataOutput.writeByte(getType().serialize()); serializeValue(dataOutput); }
@Override public void convertType(byte[] data, int start, int length, DataOutput out) throws IOException { double targetValue = convertType(data, start); out.writeByte(ATypeTag.DOUBLE.serialize()); DoubleSerializerDeserializer.write(targetValue, out); }
public void writeItem(int itemIndex, DataOutput dos) throws IOException { int itemOffset = getItemOffset(itemIndex); int itemLength = getItemLength(itemOffset); if (itemsAreSelfDescribing()) { ++itemLength; } else { dos.writeByte(itemType.serialize()); } dos.write(listBytes, itemOffset, itemLength); }
public static void serializeTag(IAObject instance, DataOutput out) throws HyracksDataException { IAType t = instance.getType(); ATypeTag tag = t.getTypeTag(); try { out.writeByte(tag.serialize()); } catch (IOException e) { throw HyracksDataException.create(e); } }
public void getItemValue(AbstractCollectionType inputType, int index, DataOutput dOut) throws IOException { if (getType() != ATypeTag.ANY.serialize()) { dOut.writeByte(getType()); } dOut.write(bytes, getItemOffset(inputType, index), getItemSize(inputType, index)); } }
public static long getIntervalEnd(byte[] data, int start) { if (getIntervalTimeType(data, start) == ATypeTag.DATETIME.serialize()) { return LongPointable.getLong(data, getIntervalEndOffset(data, start)); } else { return IntegerPointable.getInteger(data, getIntervalEndOffset(data, start)); } }
public static long getIntervalStart(byte[] data, int start) { if (getIntervalTimeType(data, start) == ATypeTag.DATETIME.serialize()) { return LongPointable.getLong(data, getIntervalStartOffset(data, start)); } else { return IntegerPointable.getInteger(data, getIntervalStartOffset(data, start)); } }
private int compareStringWithArg(ATypeTag typeTag2, IPointable arg1, IPointable arg2) throws HyracksDataException { if (typeTag2 == ATypeTag.STRING) { return strBinaryComp.compare(arg1.getByteArray(), arg1.getStartOffset(), arg1.getLength() - 1, arg2.getByteArray(), arg2.getStartOffset(), arg2.getLength() - 1); } throw new IncompatibleTypeException(sourceLoc, COMPARISON, ATypeTag.SERIALIZED_STRING_TYPE_TAG, typeTag2.serialize()); }