[
https://issues.apache.org/jira/browse/ARROW-6930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ji Liu updated ARROW-6930:
--------------------------
Description:
There is a lot of verbosity in the construction of Arrays for testing purposes
(multiple lines of setSafe(...) or set(...).
We should start adding a utility class to make test setup clearer and more
concise, note this class should be located in arrow-vector test package and
could be used in other module’s testing by adding dependency:
{{<dependency>}}
{{<groupId>org.apache.arrow</groupId>}}
{{<artifactId>arrow-vector</artifactId>}}
{{<version>${project.version}</version>}}
{{<classifier>tests</classifier>}}
{{<type>test-jar</type>}}
{{<scope>test</scope>}}
{{</dependency>}}
Usage would be something like:
{quote}try (IntVector vector = new IntVector(“vector”, allocator)) {
ValueVectorPopulator.setVector(vector, 1, 2, null, 4, 5);
output = doSomethingWith(input);
assertThat(output).isEqualTo(expected);
}
{quote}
was:
There is a lot of verbosity in the construction of Arrays for testing purposes
(multiple lines of setSafe(...) or set(...). We should start adding some
static factory methods to make test setup clearer and more concise. A
strawman proposal for BigIntVector might look like:
static BigIntVector create(String name, BufferAllocator allocator, Long...
values).
Usage would be something like:
try (BigIntVector input = BigIntVectorCreate("sample_data", allocator, 1235L,
null, 456L),
BigIntVector expected = BigIntVectorCreate("sample_data", allocator, 1L,
null, 0L),) {
output = doSomethingWith(input);
assertThat(output).isEqualTo(expected);
}
> [Java] Create utility class for populating vector values used for test
> purpose only
> -----------------------------------------------------------------------------------
>
> Key: ARROW-6930
> URL: https://issues.apache.org/jira/browse/ARROW-6930
> Project: Apache Arrow
> Issue Type: New Feature
> Components: Java
> Reporter: Micah Kornfield
> Assignee: Ji Liu
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 11h 10m
> Remaining Estimate: 0h
>
> There is a lot of verbosity in the construction of Arrays for testing
> purposes (multiple lines of setSafe(...) or set(...).
> We should start adding a utility class to make test setup clearer and more
> concise, note this class should be located in arrow-vector test package and
> could be used in other module’s testing by adding dependency:
> {{<dependency>}}
> {{<groupId>org.apache.arrow</groupId>}}
> {{<artifactId>arrow-vector</artifactId>}}
> {{<version>${project.version}</version>}}
> {{<classifier>tests</classifier>}}
> {{<type>test-jar</type>}}
> {{<scope>test</scope>}}
> {{</dependency>}}
> Usage would be something like:
> {quote}try (IntVector vector = new IntVector(“vector”, allocator)) {
> ValueVectorPopulator.setVector(vector, 1, 2, null, 4, 5);
> output = doSomethingWith(input);
> assertThat(output).isEqualTo(expected);
> }
> {quote}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)