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

[SPARK-4186] add binaryFiles and binaryRecords in Python #3078

Closed
wants to merge 6 commits into from

Conversation

davies
Copy link
Contributor

@davies davies commented Nov 3, 2014

add binaryFiles() and binaryRecords() in Python

binaryFiles(self, path, minPartitions=None):
    :: Developer API ::

    Read a directory of binary files from HDFS, a local file system
    (available on all nodes), or any Hadoop-supported file system URI
    as a byte array. Each file is read as a single record and returned
    in a key-value pair, where the key is the path of each file, the
    value is the content of each file.

    Note: Small files are preferred, large file is also allowable, but
    may cause bad performance.

binaryRecords(self, path, recordLength):
    Load data from a flat binary file, assuming each record is a set of numbers
    with the specified numerical format (see ByteBuffer), and the number of
    bytes per record is constant.

    :param path: Directory to the input data files
    :param recordLength: The length at which to split the records

@davies
Copy link
Contributor Author

davies commented Nov 3, 2014

cc @mateiz

@SparkQA
Copy link

SparkQA commented Nov 3, 2014

Test build #22823 has started for PR 3078 at commit bb22442.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Nov 3, 2014

Test build #22823 has finished for PR 3078 at commit bb22442.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22823/
Test FAILed.

@SparkQA
Copy link

SparkQA commented Nov 3, 2014

Test build #509 has started for PR 3078 at commit bb22442.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Nov 3, 2014

Test build #509 has finished for PR 3078 at commit bb22442.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 4, 2014

Test build #22842 has started for PR 3078 at commit 5ceaa8a.

  • This patch merges cleanly.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22841/
Test FAILed.

@SparkQA
Copy link

SparkQA commented Nov 4, 2014

Test build #510 has started for PR 3078 at commit 5ceaa8a.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Nov 4, 2014

Test build #22842 has finished for PR 3078 at commit 5ceaa8a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22842/
Test PASSed.

@SparkQA
Copy link

SparkQA commented Nov 4, 2014

Test build #510 has finished for PR 3078 at commit 5ceaa8a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 4, 2014

Test build #22868 has started for PR 3078 at commit 24e84b6.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Nov 4, 2014

Test build #22868 timed out for PR 3078 at commit 24e84b6 after a configured wait of 120m.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22868/
Test FAILed.

@SparkQA
Copy link

SparkQA commented Nov 4, 2014

Test build #511 has started for PR 3078 at commit 24e84b6.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Nov 4, 2014

Test build #511 has finished for PR 3078 at commit 24e84b6.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class ExecutorActor(executorId: String) extends Actor with ActorLogReceive with Logging
    • case class GetActorSystemHostPortForExecutor(executorId: String) extends ToBlockManagerMaster
    • case class Params(
    • class VectorUDT(UserDefinedType):
    • class NullType(PrimitiveType):
    • class UserDefinedType(DataType):
    • // in some cases, such as when a class is enclosed in an object (in which case
    • case class ScalaUdfBuilder[T: TypeTag](f: AnyRef)
    • abstract class UserDefinedType[UserType] extends DataType with Serializable
    • public abstract class UserDefinedType<UserType> extends DataType implements Serializable

@@ -396,6 +396,34 @@ def wholeTextFiles(self, path, minPartitions=None, use_unicode=True):
return RDD(self._jsc.wholeTextFiles(path, minPartitions), self,
PairDeserializer(UTF8Deserializer(use_unicode), UTF8Deserializer(use_unicode)))

def binaryFiles(self, path, minPartitions=None):
"""
:: Developer API ::
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be DeveloperAPI I think, it should just be experimental (and same with the binaryRecords method). Maybe the labels are wrong in the Java and Scala API; if so do you mind changing them?

@mateiz
Copy link
Contributor

mateiz commented Nov 5, 2014

Looks good, I just noticed one weird thing in the docs (probably an issue in the Java/Scala docs but we might as well fix those too).

@SparkQA
Copy link

SparkQA commented Nov 5, 2014

Test build #22961 has started for PR 3078 at commit cd0bdbd.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Nov 6, 2014

Test build #22961 has finished for PR 3078 at commit cd0bdbd.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22961/
Test PASSed.

@mateiz
Copy link
Contributor

mateiz commented Nov 6, 2014

Looks good, thanks!

@asfgit asfgit closed this in b41a39e Nov 6, 2014
asfgit pushed a commit that referenced this pull request Nov 6, 2014
add binaryFiles() and binaryRecords() in Python
```
binaryFiles(self, path, minPartitions=None):
    :: Developer API ::

    Read a directory of binary files from HDFS, a local file system
    (available on all nodes), or any Hadoop-supported file system URI
    as a byte array. Each file is read as a single record and returned
    in a key-value pair, where the key is the path of each file, the
    value is the content of each file.

    Note: Small files are preferred, large file is also allowable, but
    may cause bad performance.

binaryRecords(self, path, recordLength):
    Load data from a flat binary file, assuming each record is a set of numbers
    with the specified numerical format (see ByteBuffer), and the number of
    bytes per record is constant.

    :param path: Directory to the input data files
    :param recordLength: The length at which to split the records
```

Author: Davies Liu <[email protected]>

Closes #3078 from davies/binary and squashes the following commits:

cd0bdbd [Davies Liu] Merge branch 'master' of github.com:apache/spark into binary
3aa349b [Davies Liu] add experimental notes
24e84b6 [Davies Liu] Merge branch 'master' of github.com:apache/spark into binary
5ceaa8a [Davies Liu] Merge branch 'master' of github.com:apache/spark into binary
1900085 [Davies Liu] bugfix
bb22442 [Davies Liu] add binaryFiles and binaryRecords in Python

(cherry picked from commit b41a39e)
Signed-off-by: Matei Zaharia <[email protected]>
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.

4 participants