|
24 | 24 | import static org.hamcrest.CoreMatchers.instanceOf; |
25 | 25 | import static org.hamcrest.MatcherAssert.assertThat; |
26 | 26 | import static org.junit.jupiter.api.Assertions.assertArrayEquals; |
| 27 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 28 | +import static org.junit.jupiter.api.Assertions.assertNull; |
27 | 29 | import static org.junit.jupiter.api.Assertions.assertThrows; |
28 | 30 | import static org.mockito.Mockito.when; |
29 | 31 |
|
|
46 | 48 | import org.apache.arrow.vector.DateMilliVector; |
47 | 49 | import org.apache.arrow.vector.TimeMilliVector; |
48 | 50 | import org.apache.arrow.vector.TimeStampVector; |
| 51 | +import org.apache.arrow.vector.VarCharVector; |
| 52 | +import org.apache.arrow.vector.ViewVarCharVector; |
49 | 53 | import org.apache.arrow.vector.util.Text; |
50 | 54 | import org.junit.jupiter.api.BeforeEach; |
51 | 55 | import org.junit.jupiter.api.Test; |
@@ -695,4 +699,26 @@ public void testShouldGetObjectClassReturnString() { |
695 | 699 | final Class<?> clazz = accessor.getObjectClass(); |
696 | 700 | assertThat(clazz, equalTo(String.class)); |
697 | 701 | } |
| 702 | + |
| 703 | + @Test |
| 704 | + public void testViewVarcharVector() throws Exception { |
| 705 | + try (VarCharVector varCharVector = |
| 706 | + new VarCharVector("", rootAllocatorTestExtension.getRootAllocator()); |
| 707 | + ViewVarCharVector viewVarCharVector = |
| 708 | + new ViewVarCharVector("", rootAllocatorTestExtension.getRootAllocator())) { |
| 709 | + varCharVector.allocateNew(1); |
| 710 | + viewVarCharVector.allocateNew(1); |
| 711 | + |
| 712 | + ArrowFlightJdbcVarCharVectorAccessor varCharVectorAccessor = |
| 713 | + new ArrowFlightJdbcVarCharVectorAccessor(varCharVector, () -> 0, (boolean wasNull) -> {}); |
| 714 | + ArrowFlightJdbcVarCharVectorAccessor viewVarcharVectorAccessor = |
| 715 | + new ArrowFlightJdbcVarCharVectorAccessor( |
| 716 | + viewVarCharVector, () -> 0, (boolean wasNull) -> {}); |
| 717 | + assertNull(viewVarcharVectorAccessor.getString()); |
| 718 | + |
| 719 | + varCharVector.set(0, new Text("looooong_string")); |
| 720 | + viewVarCharVector.set(0, new Text("looooong_string")); |
| 721 | + assertEquals(varCharVectorAccessor.getString(), viewVarcharVectorAccessor.getString()); |
| 722 | + } |
| 723 | + } |
698 | 724 | } |
0 commit comments