Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVRO-3660: [JAVA] Use data generator with RandomData #2526

Merged

Conversation

opwvhk
Copy link
Contributor

@opwvhk opwvhk commented Sep 26, 2023

What is the purpose of the change

Update the RandomData generator to use GenericData (or subclasses). This allows to generate GenericRecord, SpecificRecord and reflected records as random data.

Jira issue: AVRO-3660

Verifying this change

This change adds a test case:

  • org.apache.avro.util.TestRandomData

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

Using `GenericData` (or subclasses) with `RandomData` allows to generate
`GenericRecord`, `SpecificRecord` and reflected records as random data.
@opwvhk opwvhk requested a review from clesaec September 26, 2023 14:58
@github-actions github-actions bot added the Java Pull Requests for Java binding label Sep 26, 2023
public void setUp() throws Exception {
file = Files.createTempFile("randomData", ".avro").toFile();
seed = System.currentTimeMillis();
count = new Random().nextInt(50) + 75;

Check warning

Code scanning / CodeQL

Random used only once

Random object created and used only once.
Copy link
Contributor

@clesaec clesaec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@opwvhk opwvhk merged commit 3cdc34e into apache:master Sep 27, 2023
@opwvhk opwvhk deleted the AVRO-3660-Use-data-generator-with-RandomData branch September 27, 2023 10:52
@opwvhk opwvhk restored the AVRO-3660-Use-data-generator-with-RandomData branch December 12, 2023 13:45
@opwvhk opwvhk deleted the AVRO-3660-Use-data-generator-with-RandomData branch December 12, 2023 13:46
RanbirK pushed a commit to RanbirK/avro that referenced this pull request May 13, 2024
Using `GenericData` (or subclasses) with `RandomData` allows to generate
`GenericRecord`, `SpecificRecord` and reflected records as random data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java Pull Requests for Java binding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants