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

Allow users to configure fetch and batch size for jdbc reads and writes #1314

Merged
merged 2 commits into from
Aug 21, 2018

Conversation

syodage
Copy link
Contributor

@syodage syodage commented Aug 21, 2018

Fixes #1311

@codecov-io
Copy link

codecov-io commented Aug 21, 2018

Codecov Report

Merging #1314 into nio will decrease coverage by 0.06%.
The diff coverage is 60%.

Impacted file tree graph

@@            Coverage Diff             @@
##              nio    #1314      +/-   ##
==========================================
- Coverage   81.73%   81.67%   -0.07%     
==========================================
  Files         146      146              
  Lines        4244     4250       +6     
  Branches      373      313      -60     
==========================================
+ Hits         3469     3471       +2     
- Misses        775      779       +4
Impacted Files Coverage Δ
...src/main/scala/com/spotify/scio/jdbc/package.scala 100% <100%> (ø) ⬆️
.../main/scala/com/spotify/scio/jdbc/nio/JdbcIO.scala 23.25% <33.33%> (-2.39%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update caee7a8...b444ff9. Read the comment docs.

Copy link
Contributor

@nevillelyh nevillelyh left a comment

Choose a reason for hiding this comment

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

Can you PR against nio branch instead since we're gonna promote that into master soon.

@syodage syodage changed the base branch from master to nio August 21, 2018 17:17
@syodage syodage changed the base branch from nio to master August 21, 2018 17:24
@syodage syodage changed the base branch from master to nio August 21, 2018 17:28
@syodage
Copy link
Contributor Author

syodage commented Aug 21, 2018

@nevillelyh Done!

@@ -65,7 +65,8 @@ package object jdbc {
case class JdbcReadOptions[T](connectionOptions: JdbcConnectionOptions,
query: String,
statementPreparator: PreparedStatement => Unit = null,
rowMapper: ResultSet => T) extends JdbcIoOptions
rowMapper: ResultSet => T,
fetchSize: Option[Int] = None) extends JdbcIoOptions
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of requiring the user to wrap Int in Some here, what about use Int directly with a default of -1, which skips setting the fetch size?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1, yes agree.

Copy link
Contributor

@nevillelyh nevillelyh left a comment

Choose a reason for hiding this comment

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

LGTM except the minor API design choice.

package object jdbc {

type JdbcIO[T] = jdbc.nio.JdbcIO[T]
val JdbcIO = jdbc.nio.JdbcIO

private[jdbc] val USE_BEAM_DEFAULT_BATCH_SIZE = -1L
Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't go crazy as de-magic-fy these since -1 is a pretty common pattern but that's just me ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thought it is more informative what actually -1 means here.

@syodage syodage merged commit f5481c8 into nio Aug 21, 2018
@syodage syodage deleted the shameera/jdbc-io-configs branch August 21, 2018 20:58
nevillelyh pushed a commit that referenced this pull request Aug 24, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
nevillelyh pushed a commit that referenced this pull request Aug 28, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
nevillelyh pushed a commit that referenced this pull request Aug 30, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
nevillelyh pushed a commit that referenced this pull request Aug 30, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
nevillelyh pushed a commit that referenced this pull request Aug 31, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
nevillelyh pushed a commit that referenced this pull request Sep 5, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
nevillelyh pushed a commit that referenced this pull request Sep 5, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
nevillelyh pushed a commit that referenced this pull request Sep 5, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
nevillelyh pushed a commit that referenced this pull request Sep 6, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
nevillelyh pushed a commit that referenced this pull request Sep 7, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
nevillelyh pushed a commit that referenced this pull request Sep 11, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
nevillelyh pushed a commit that referenced this pull request Sep 12, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
nevillelyh pushed a commit that referenced this pull request Sep 13, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
nevillelyh pushed a commit that referenced this pull request Sep 13, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
nevillelyh pushed a commit that referenced this pull request Sep 14, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
nevillelyh pushed a commit that referenced this pull request Sep 14, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
nevillelyh pushed a commit that referenced this pull request Sep 17, 2018
…es (#1314)

* Allow users to configure fetch and batch size for jdbc read and write

* clean the api a bit
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.

3 participants