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

Enhance integration test suite #676

Merged
merged 11 commits into from
May 26, 2022
Merged

Enhance integration test suite #676

merged 11 commits into from
May 26, 2022

Conversation

kparwal
Copy link
Contributor

@kparwal kparwal commented Feb 17, 2022

Add datatype conversion integration test suite and implementation for PostgreSQL.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@kparwal kparwal changed the title Add datatype conversion integration test suite Enhance integration test suite Feb 17, 2022
@kparwal kparwal marked this pull request as ready for review February 17, 2022 21:41
@kparwal kparwal force-pushed the add-integ-suite branch 2 times, most recently from cfd2427 to 3fee8d9 Compare February 18, 2022 16:47
@kparwal kparwal force-pushed the add-integ-suite branch 2 times, most recently from 5ab2639 to 6b58cdc Compare March 15, 2022 21:50
@kparwal kparwal force-pushed the add-integ-suite branch 2 times, most recently from 056dc10 to fef127f Compare April 22, 2022 19:39
// Remove the column-header row
rows.remove(0);
}
List<Double> values = new ArrayList<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comment here as earlier about using .map() instead of .forEach() for these kinds of situations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure i understand the difference. rows in practice has just one value. turning it into a stream just to run map seems more roundabout.

Copy link
Contributor

@henrymai henrymai May 24, 2022

Choose a reason for hiding this comment

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

I don't feel strongly as to whether or not you should change this, which is why I approved the pull request in addition to leaving the comments before.

But if you're wondering about the reasoning:

Its a declarative vs imperative style (where declarative is preferred when possible).

More formally this (creating the list and then looping through it to add to it) is an antipattern called ITM (initialize then modify): https://www.youtube.com/watch?v=VV9vwFsaQ6U

In scala a .map() is always used for situations like this instead (just transforming one collection into another) vs a .foreach() which is meant for side effecting operations: https://stackoverflow.com/a/44042773

The youtube link above is mostly about c++ (although he has examples in python as well) and stackoverflow link is on scala, so its not a concept that is isolated to any single language.

It only seems roundabout because its not something that most Java developers are used to (unless they started with Java 8 and beyond), but this is also why they added all of this stuff to Java.

EDIT:

Also my original comment was about .map() vs .foreach() in general, I did not take into consideration that there was only a single element in the List, because a .foreach() was being used in the diff.

For the situations where one knows that the resulting List only comprises of a single or few elements, then one can just use List.of(<element>) instead of using a .foreach() or .map()

henrymai
henrymai previously approved these changes May 13, 2022
Copy link
Contributor

@henrymai henrymai left a comment

Choose a reason for hiding this comment

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

Looks good to me other than the small comments on:

  • map() instead forEach()
  • Map.of() instead of Guava builder
  • List.of() instead of the Guava's ImmutableList.of()

@kparwal kparwal merged commit c5a0729 into master May 26, 2022
henrymai added a commit that referenced this pull request Jun 1, 2022
Ddb connector with extractor and GeneratedRowWriter (#704)
Fix for Sql Server partition issue (#707)
Corrected athena-snowflake.yaml description
adding option for VPC config on elasticsearch connector
Bigquery metadata pagination implementation && fixed bigquery table casesensitive issue
BigQuery IAM  role & policies changes in template file
Fix a small typo in README.md
Fix log4j logger configurations
Enhance integration test suite (#676)
henrymai added a commit that referenced this pull request Jun 1, 2022
Ddb connector with extractor and GeneratedRowWriter (#704)
Fix for Sql Server partition issue (#707)
Corrected athena-snowflake.yaml description
adding option for VPC config on elasticsearch connector
Bigquery metadata pagination implementation && fixed bigquery table casesensitive issue
BigQuery IAM  role & policies changes in template file
Fix a small typo in README.md
Fix log4j logger configurations
Enhance integration test suite (#676)
@burhan94 burhan94 deleted the add-integ-suite branch September 12, 2023 16:34
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.

2 participants