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 constructing a PailSource from a PailSpec #1424

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

amazari
Copy link

@amazari amazari commented Aug 17, 2015

By allowing a PailSource to be constructed from a PailSpec, this patch gives more flexibility to client code. For example, it is is now possible to set compression and/or sizing policy.
For backward compatibility sake, it is still possible to construct a source from a PailStructure. In that case, a PailSpec is materialized using PailTap.makeSpec facility in the same manner it was previously done.

Alexandre Mazari added 2 commits August 14, 2015 17:35
Exposing a PailSpec-taking ctor give more flexibility in PailSource
construction. For example, compression and/or sizing policy can be
set.
@@ -153,7 +169,6 @@ class PailSource[T] private (rootPath: String, structure: PailStructure[T], subP
val fieldName = "pailItem"

lazy val getTap = {
val spec = PailTap.makeSpec(null, structure)
val javaSubPath = if ((subPaths == null) || (subPaths.size == 0)) null else subPaths map { _.asJava }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since the constructor setting up the null for the list is private, and we only seem to care if the path is empty or not. Can we just default subPaths to an empty list and not need to do null checking?

Alexandre Mazari added 2 commits August 18, 2015 17:32
Assertions in factory functions and sane default value
for the subPath field of PailSource remove the need for
null-checking the val when creating a Tap.
@@ -145,7 +161,7 @@ object PailSource {
}
}

class PailSource[T] private (rootPath: String, structure: PailStructure[T], subPaths: Array[List[String]] = null)(implicit conv: TupleConverter[T])
class PailSource[T] private (rootPath: String, spec: PailSpec, subPaths: Array[List[String]] = Array.empty)(implicit conv: TupleConverter[T])
extends Source with Mappable[T] {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you add with TypedSink[T]? Is there any reason why you can't write to this?

@CLAassistant
Copy link

CLAassistant commented Jul 18, 2019

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Alexandre Mazari seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

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