use of org.apache.calcite.avatica.util.Cursor.Accessor in project calcite-avatica by apache.
the class StructImplTest method testStructAccessor.
@Test
public void testStructAccessor() throws Exception {
// Create rows based on the inputValues data
List<List<Object>> rows = new ArrayList<>();
for (Object o : columnInputBundle.inputValues) {
rows.add(Collections.singletonList(o));
}
try (Cursor cursor = new ListIteratorCursor(rows.iterator())) {
List<Accessor> accessors = cursor.createAccessors(Collections.singletonList(columnInputBundle.metaData), Unsafe.localCalendar(), null);
Accessor accessor = accessors.get(0);
int i = 0;
while (cursor.next()) {
Struct s = accessor.getObject(Struct.class);
Object[] expectedStructAttributes = columnInputBundle.expectedValues.get(i).getAttributes();
Object[] actualStructAttributes = s.getAttributes();
assertArrayEquals(expectedStructAttributes, actualStructAttributes);
i++;
}
}
}
Aggregations