Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions java/vector/src/main/codegen/templates/FixedValueVectors.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public final class ${className} extends BaseDataValueVector implements FixedWidt
this.${typeParam.name} = ${typeParam.name};
</#list>
}

<#list typeParams as typeParam>
public ${typeParam.type} get${typeParam.name?cap_first}() {
return ${typeParam.name};
}
</#list>
<#else>
public ${className}(String name, BufferAllocator allocator) {
super(name, allocator);
Expand All @@ -80,12 +86,12 @@ public MinorType getMinorType() {

@Override
public Field getField() {
throw new UnsupportedOperationException("internal vector");
throw new UnsupportedOperationException("internal vector");
}

@Override
public FieldReader getReader(){
throw new UnsupportedOperationException("non-nullable vectors cannot be used in readers");
throw new UnsupportedOperationException("non-nullable vectors cannot be used in readers");
}

@Override
Expand Down Expand Up @@ -287,7 +293,7 @@ public void copyFrom(int fromIndex, int thisIndex, ${className} from){

public void copyFromSafe(int fromIndex, int thisIndex, ${className} from){
while(thisIndex >= getValueCapacity()) {
reAlloc();
reAlloc();
}
copyFrom(fromIndex, thisIndex, from);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ public final class ${className} extends BaseValueVector implements <#if type.maj
<#if minor.typeParams??>
<#assign typeParams = minor.typeParams?reverse>
<#list typeParams as typeParam>
private final ${typeParam.type} ${typeParam.name};
public ${typeParam.type} get${typeParam.name?cap_first}() {
return values.get${typeParam.name?cap_first}();
}
</#list>

/**
Expand Down Expand Up @@ -97,7 +99,7 @@ public final class ${className} extends BaseValueVector implements <#if type.maj
<#assign typeParams = minor.typeParams?reverse>
${minor.arrowType} arrowType = (${minor.arrowType})fieldType.getType();
<#list typeParams as typeParam>
this.${typeParam.name} = arrowType.get${typeParam.name?cap_first}();
${typeParam.type} ${typeParam.name} = arrowType.get${typeParam.name?cap_first}();
</#list>
this.values = new ${valuesName}(valuesField, allocator<#list typeParams as typeParam>, ${typeParam.name}</#list>);
<#else>
Expand Down Expand Up @@ -331,7 +333,7 @@ public void zeroVector() {

@Override
public TransferPair getTransferPair(String ref, BufferAllocator allocator, CallBack callBack) {
return getTransferPair(ref, allocator);
return getTransferPair(ref, allocator);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ public class TestDecimalVector {
}
}

private int scale = 3;

@Test
public void test() {
int precision = 10;
int scale = 3;
BufferAllocator allocator = new RootAllocator(Integer.MAX_VALUE);
NullableDecimalVector decimalVector = TestUtils.newVector(NullableDecimalVector.class, "decimal", new ArrowType.Decimal(10, scale), allocator);
try (NullableDecimalVector oldConstructor = new NullableDecimalVector("decimal", allocator, 10, scale);) {
NullableDecimalVector decimalVector = TestUtils.newVector(NullableDecimalVector.class, "decimal", new ArrowType.Decimal(precision, scale), allocator);
try (NullableDecimalVector oldConstructor = new NullableDecimalVector("decimal", allocator, precision, scale);) {
assertEquals(decimalVector.getField().getType(), oldConstructor.getField().getType());
}
assertEquals(decimalVector.getPrecision(), precision);
assertEquals(decimalVector.getScale(), scale);
decimalVector.allocateNew();
BigDecimal[] values = new BigDecimal[intValues.length];
for (int i = 0; i < intValues.length; i++) {
Expand Down