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

[BEAM-11585] Select.flattenedSchema doesn't flatten nested array fields #14354

Merged
merged 6 commits into from Apr 6, 2021

Conversation

Amar3tto
Copy link
Contributor

@Amar3tto Amar3tto commented Mar 29, 2021

Fixed Select.flattenedSchema() for nested array fields.

Test case:

Row[] transactions {
  String bank,
  Double purchaseAmount
}
->
String[] transactions_bank,
Double[] transactions_purchaseAmount

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

Post-Commit Tests Status (on master branch)

Lang SDK ULR Dataflow Flink Samza Spark Twister2
Go --- --- Build Status --- Build Status ---
Java Build Status Build Status Build Status
Build Status
Build Status
Build Status
Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status
Build Status
Build Status
Build Status
Python Build Status
Build Status
Build Status
--- Build Status
Build Status
Build Status
Build Status
Build Status
--- Build Status ---
XLang Build Status --- Build Status Build Status --- Build Status ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website Whitespace Typescript
Non-portable Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status Build Status Build Status
Portable --- Build Status --- --- --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@Amar3tto
Copy link
Contributor Author

retest this please

Copy link
Contributor

@KhaninArtur KhaninArtur left a comment

Choose a reason for hiding this comment

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

Everything is looking great! Just one suggestion to add an extended test description

@Test
@Category(NeedsRunner.class)
public void testFlatSchemaWithArrayNestedField() {

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add a description for this test, I suppose, this way we can provide a much better understanding to interested people. E.g. describe nested schema and expected flattened version of this schema.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@Amar3tto
Copy link
Contributor Author

Amar3tto commented Apr 1, 2021

retest this please

@pabloem
Copy link
Member

pabloem commented Apr 1, 2021

Run Java PreCommit

@pabloem
Copy link
Member

pabloem commented Apr 1, 2021

thanks @Amar3tto @KhaninArtur - is this ready for review/merge?

@TheNeuralBit could you review once it's ready? : )

@TheNeuralBit
Copy link
Member

Sure, @Amar3tto please let me know when you're ready for a review.

@Amar3tto Amar3tto marked this pull request as ready for review April 2, 2021 08:39
@Amar3tto
Copy link
Contributor Author

Amar3tto commented Apr 2, 2021

@TheNeuralBit please review

Copy link
Member

@TheNeuralBit TheNeuralBit left a comment

Choose a reason for hiding this comment

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

Thanks this looks good at first glance. Could you add some test-cases for edge cases, e.g. I'm curious if we handle:

Row[] transactions {
  String[] banks,
  Double purchaseAmount
}
->
String[][] transactions_banks,
Double[] transactions_purchaseAmount

and:

Row[] transactions {
  Row[] banks {
    String name
    String address
  },
  Double purchaseAmount
}
->
String[][] transactions_banks_name,
String[][] transactions_banks_address,
Double[] transactions_purchaseAmount

@Amar3tto
Copy link
Contributor Author

Amar3tto commented Apr 5, 2021

Thanks this looks good at first glance. Could you add some test-cases for edge cases, e.g. I'm curious if we handle:

Row[] transactions {
  String[] banks,
  Double purchaseAmount
}
->
String[][] transactions_banks,
Double[] transactions_purchaseAmount

and:

Row[] transactions {
  Row[] banks {
    String name
    String address
  },
  Double purchaseAmount
}
->
String[][] transactions_banks_name,
String[][] transactions_banks_address,
Double[] transactions_purchaseAmount

Done, handled both cases.

Copy link
Member

@TheNeuralBit TheNeuralBit left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@TheNeuralBit TheNeuralBit merged commit 1641aae into apache:master Apr 6, 2021
@TheNeuralBit
Copy link
Member

@Amar3tto consider adding this to CHANGES.md for 2.30.0 as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants