Question
help!
public class Test0001 {
public static class ForyRowData {
public boolean fBool;
public byte fTiny;
public short fSmall;
public int fInt1;
public long fBigint;
public float fFloat;
public double fDouble;
public String fString;
public byte[] fBinary;
public int fDate;
public Long fTimestamp;
public long fDecimalRaw;
public int fDecimalScale;
public int fInt2;
}
public static void main() {
Fory fory = Fory.builder().withLanguage(Language.XLANG).build();
RowEncoder<ForyRowData> foryEncoder = Encoders.bean(ForyRowData.class,fory);
ForyRowData frd = new ForyRowData();
frd.fBool = false;
frd.fTiny = 1;
frd.fSmall = 2;
frd.fInt1 = 3;
frd.fBigint = 4L;
frd.fFloat = 5.0f;
frd.fDouble = 6.0;
frd.fString = "asdasd";
frd.fBinary = new byte[]{1,2,3};
frd.fDate = 7;
frd.fTimestamp = 8L;
frd.fDecimalRaw = 9L;
frd.fDecimalScale = 10;
frd.fInt2 = 15;
BinaryRow bnyRow = foryEncoder.toRow(frd);
System.out.println("p 0 = " + bnyRow.getBoolean(0));
System.out.println("p 7 = " + bnyRow.getString(7));
System.out.println("p 13 = " + bnyRow.getInt32(13));
}
}
get result:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: arraycopy: last source index 1084227584 out of bounds for byte[240]
at java.base/java.lang.System.arraycopy(Native Method)
at org.apache.fory.memory.MemoryBuffer.get(MemoryBuffer.java:322)
at org.apache.fory.format.row.binary.UnsafeTrait.getBinary(UnsafeTrait.java:138)
at org.apache.fory.format.row.binary.BinaryRow.getBinary(BinaryRow.java:63)
at org.apache.fory.format.row.binary.UnsafeTrait.getString(UnsafeTrait.java:121)
at org.apache.fory.format.row.binary.BinaryRow.getString(BinaryRow.java:63)
also,if i disable getString,
p 0 = true //correct
p 13 = 1 // not correct
did i miss something?
Question
help!
get result:
also,if i disable getString,
did i miss something?