You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by HyukjinKwon <gi...@git.apache.org> on 2017/07/10 06:11:07 UTC

[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

GitHub user HyukjinKwon opened a pull request:

    https://github.com/apache/spark/pull/18581

    [SPARK-21289][SQL][ML] Supports custom line separator for all text-based datasources

    ## What changes were proposed in this pull request?
    
    This PR proposes to add `lineSep` option for a configurable line separator in text-based datasources, LibSVM, JSON, CSV and Text.
    
    For writing out in CSV, I didn't document this. It looks there is a bug related with this in Univocity parser - `https://github.com/uniVocity/univocity-parsers/issues/170`.
    
    ## How was this patch tested?
    
    Unit tests in `LibSVMRelationSuite.scala`, `CSVSuite.scala`, `JsonSuite.scala`, `TextSuite.scala` and `python/pyspark/sql/tests.py`


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/HyukjinKwon/spark linesep

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/18581.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #18581
    
----
commit 585a3999e5415d093d114b66c015d1f03302fbe6
Author: hyukjinkwon <gu...@gmail.com>
Date:   2017-07-09T06:25:51Z

    [SPARK-21289] Adds lineSep option for all text-based datasources

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #79446 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79446/testReport)** for PR 18581 at commit [`eb77c98`](https://github.com/apache/spark/commit/eb77c98a32a6418f30c72de538c6ff129b4ed9a4).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/81170/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r134954909
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/source/libsvm/LibSVMOptions.scala ---
    @@ -41,11 +41,15 @@ private[libsvm] class LibSVMOptions(@transient private val parameters: CaseInsen
         case o => throw new IllegalArgumentException(s"Invalid value `$o` for parameter " +
           s"`$VECTOR_TYPE`. Expected types are `sparse` and `dense`.")
       }
    +
    +  val lineSeparator: Option[String] = parameters.get(LINE_SEPARATOR)
    +  lineSeparator.foreach(s => require(s.nonEmpty, s"'$LINE_SEPARATOR' cannot be an empty string."))
     }
     
     private[libsvm] object LibSVMOptions {
       val NUM_FEATURES = "numFeatures"
       val VECTOR_TYPE = "vectorType"
       val DENSE_VECTOR_TYPE = "dense"
       val SPARSE_VECTOR_TYPE = "sparse"
    +  val LINE_SEPARATOR = "lineSep"
    --- End diff --
    
    I actually meant `sep` here:
    
    https://github.com/apache/spark/blob/3c0c2d09ca89c6b6247137823169db17847dfae3/sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala#L488-L489
    
    and was thinking of matching the name ..


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by maropu <gi...@git.apache.org>.
Github user maropu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r126585940
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/source/libsvm/LibSVMOptions.scala ---
    @@ -41,11 +41,15 @@ private[libsvm] class LibSVMOptions(@transient private val parameters: CaseInsen
         case o => throw new IllegalArgumentException(s"Invalid value `$o` for parameter " +
           s"`$VECTOR_TYPE`. Expected types are `sparse` and `dense`.")
       }
    +
    +  val lineSeparator: Option[String] = parameters.get(LINE_SEPARATOR)
    --- End diff --
    
    Also, if we support one or two characters only,  I feel we better explicitly throw an exception for more than two characters here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/81165/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [WIP][SPARK-21289][SQL][ML] Supports custom line separat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r134941485
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala ---
    @@ -32,7 +32,9 @@ import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
      * in that file.
      */
     class HadoopFileLinesReader(
    -    file: PartitionedFile, conf: Configuration) extends Iterator[Text] with Closeable {
    +    file: PartitionedFile,
    +    lineSeparator: Option[String],
    --- End diff --
    
    The problem is `LineRecordReader()` here. I think probably we could do `LineRecordReader(null)` to express both `\r\n` and `\n` but I am not sure if we should use `null` to express these.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81059 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81059/testReport)** for PR 18581 at commit [`3555e5d`](https://github.com/apache/spark/commit/3555e5dafa85dcee404599c78b17cbb97b1709f0).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by maropu <gi...@git.apache.org>.
Github user maropu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r126457856
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/source/libsvm/LibSVMOptions.scala ---
    @@ -41,11 +41,15 @@ private[libsvm] class LibSVMOptions(@transient private val parameters: CaseInsen
         case o => throw new IllegalArgumentException(s"Invalid value `$o` for parameter " +
           s"`$VECTOR_TYPE`. Expected types are `sparse` and `dense`.")
       }
    +
    +  val lineSeparator: Option[String] = parameters.get(LINE_SEPARATOR)
    --- End diff --
    
    yea, ok. But I couldn't just imagine an usecase to use more than three characters. It's okay to me that we'll follow committers decisions on this. Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r134890823
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVSuite.scala ---
    @@ -1195,4 +1196,46 @@ class CSVSuite extends QueryTest with SharedSQLContext with SQLTestUtils {
           .csv(Seq("10u12").toDS())
         checkAnswer(results, Row(null))
       }
    +
    +  test("SPARK-21289: Support line separator") {
    +    Seq(false, true).foreach { multiLine =>
    +      // Read
    +      Seq("a,b|1,\"a\nd\"|1,f|", "a,b|1,\"a\nd\"|1,f").foreach { lines =>
    +        withTempPath { path =>
    +          Files.write(path.toPath, lines.getBytes(StandardCharsets.UTF_8))
    +          val df = spark.read
    +            .option("multiLine", multiLine)
    +            .option("lineSep", "|")
    --- End diff --
    
    Sure, let me give a try.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/81150/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    retest this please


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [WIP][SPARK-21289][SQL][ML] Supports custom line separat...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Let me leave this as a WIP. Will be back after having some talk with Univocity author.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    I guess we need few more tests about CSV and changes. Let me leave this out in the documentation here for now.
    
    Few more test cases should be about writing out with a custom line separator
    
    ```
    ["a\n\na", "\nb"]
    ```
    
    and reading in value without quotes with a custom line separator
    
    ```
    a\n\na,\nb
    ```
    
    which currently do not work with the current state. We need `setNormalizedNewline` in this case but it looks this is limited to single character for now.
    
    I can make a follow-up later if we are all fine with leaving this documentation out.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r154606263
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/source/libsvm/LibSVMRelationSuite.scala ---
    @@ -184,4 +184,54 @@ class LibSVMRelationSuite extends SparkFunSuite with MLlibTestSparkContext {
           spark.sql("DROP TABLE IF EXISTS libsvmTable")
         }
       }
    +
    +  def testLineSeparator(lineSep: String): Unit = {
    +    test(s"SPARK-21289: Support line separator - lineSep: '$lineSep'") {
    +      val data = Seq(
    +        "1.0 1:1.0 3:2.0 5:3.0", "0.0", "0.0", "0.0 2:4.0 4:5.0 6:6.0").mkString(lineSep)
    +      val dataWithTrailingLineSep = s"$data$lineSep"
    +
    +      Seq(data, dataWithTrailingLineSep).foreach { lines =>
    +        val path0 = new File(tempDir.getCanonicalPath, "write0")
    +        val path1 = new File(tempDir.getCanonicalPath, "write1")
    +        try {
    +          // Read
    +          java.nio.file.Files.write(path0.toPath, lines.getBytes(StandardCharsets.UTF_8))
    --- End diff --
    
    To differenciate with google's `Files` explicitly above. Not a big deal.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81153 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81153/testReport)** for PR 18581 at commit [`18b2684`](https://github.com/apache/spark/commit/18b268457fa0124d1c3c484ee02210ee674a9466).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    What you see is what you get. It's not yet finished. See also https://github.com/apache/spark/pull/20877#issuecomment-429182740


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/81059/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/81164/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r126589618
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/source/libsvm/LibSVMOptions.scala ---
    @@ -41,11 +41,15 @@ private[libsvm] class LibSVMOptions(@transient private val parameters: CaseInsen
         case o => throw new IllegalArgumentException(s"Invalid value `$o` for parameter " +
           s"`$VECTOR_TYPE`. Expected types are `sparse` and `dense`.")
       }
    +
    +  val lineSeparator: Option[String] = parameters.get(LINE_SEPARATOR)
    --- End diff --
    
    `compression` is also there for many datasources. Probably, let me try to open up a discussion about tying up those later.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81060 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81060/testReport)** for PR 18581 at commit [`47e8d37`](https://github.com/apache/spark/commit/47e8d3761681611a9ee6d50d6c812babd395dace).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81036 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81036/testReport)** for PR 18581 at commit [`87bb599`](https://github.com/apache/spark/commit/87bb59985cb19e9f6ad311d61b6d9998a4aa4e10).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79446/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r134958987
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala ---
    @@ -32,7 +32,9 @@ import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
      * in that file.
      */
     class HadoopFileLinesReader(
    -    file: PartitionedFile, conf: Configuration) extends Iterator[Text] with Closeable {
    +    file: PartitionedFile,
    +    lineSeparator: Option[String],
    --- End diff --
    
    Do you mean we should use `\n` to represent those newline variants? Would you mind if I ask the source of your quotation?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79522/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by maropu <gi...@git.apache.org>.
Github user maropu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r126589978
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/source/libsvm/LibSVMOptions.scala ---
    @@ -41,11 +41,15 @@ private[libsvm] class LibSVMOptions(@transient private val parameters: CaseInsen
         case o => throw new IllegalArgumentException(s"Invalid value `$o` for parameter " +
           s"`$VECTOR_TYPE`. Expected types are `sparse` and `dense`.")
       }
    +
    +  val lineSeparator: Option[String] = parameters.get(LINE_SEPARATOR)
    --- End diff --
    
    ok, thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r155146548
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/source/libsvm/LibSVMRelationSuite.scala ---
    @@ -184,4 +184,54 @@ class LibSVMRelationSuite extends SparkFunSuite with MLlibTestSparkContext {
           spark.sql("DROP TABLE IF EXISTS libsvmTable")
         }
       }
    +
    +  def testLineSeparator(lineSep: String): Unit = {
    +    test(s"SPARK-21289: Support line separator - lineSep: '$lineSep'") {
    +      val data = Seq(
    +        "1.0 1:1.0 3:2.0 5:3.0", "0.0", "0.0", "0.0 2:4.0 4:5.0 6:6.0").mkString(lineSep)
    +      val dataWithTrailingLineSep = s"$data$lineSep"
    +
    +      Seq(data, dataWithTrailingLineSep).foreach { lines =>
    +        val path0 = new File(tempDir.getCanonicalPath, "write0")
    +        val path1 = new File(tempDir.getCanonicalPath, "write1")
    +        try {
    +          // Read
    +          java.nio.file.Files.write(path0.toPath, lines.getBytes(StandardCharsets.UTF_8))
    +          val df = spark.read
    +            .option("lineSep", lineSep)
    +            .format("libsvm")
    +            .load(path0.getAbsolutePath)
    +
    +          assert(df.columns(0) == "label")
    +          assert(df.columns(1) == "features")
    +          val row1 = df.first()
    +          assert(row1.getDouble(0) == 1.0)
    +          val v = row1.getAs[SparseVector](1)
    +          assert(v == Vectors.sparse(6, Seq((0, 1.0), (2, 2.0), (4, 3.0))))
    +
    --- End diff --
    
    Here we change how to deal with each line in iteration. I think both comparing single line or repeated multiple lines are fine. I think many tests here already test only first line?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/81166/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r135305729
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala ---
    @@ -32,7 +32,9 @@ import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
      * in that file.
      */
     class HadoopFileLinesReader(
    -    file: PartitionedFile, conf: Configuration) extends Iterator[Text] with Closeable {
    +    file: PartitionedFile,
    +    lineSeparator: Option[String],
    --- End diff --
    
    I saw a discussion in the Impala. https://issues.apache.org/jira/browse/IMPALA-1578
     
    > When the line delimiter is '\n', any of the follow sequences will count as a delimiter: "\n", "\r\n", or "\r". Accepting a single "\r" is pretty strange, but that's what Hive does so we emulate this behavior.
    
    Could you check whether Hive is behaving like this?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r155141551
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/source/libsvm/LibSVMRelationSuite.scala ---
    @@ -184,4 +184,54 @@ class LibSVMRelationSuite extends SparkFunSuite with MLlibTestSparkContext {
           spark.sql("DROP TABLE IF EXISTS libsvmTable")
         }
       }
    +
    +  def testLineSeparator(lineSep: String): Unit = {
    +    test(s"SPARK-21289: Support line separator - lineSep: '$lineSep'") {
    +      val data = Seq(
    +        "1.0 1:1.0 3:2.0 5:3.0", "0.0", "0.0", "0.0 2:4.0 4:5.0 6:6.0").mkString(lineSep)
    +      val dataWithTrailingLineSep = s"$data$lineSep"
    +
    +      Seq(data, dataWithTrailingLineSep).foreach { lines =>
    +        val path0 = new File(tempDir.getCanonicalPath, "write0")
    +        val path1 = new File(tempDir.getCanonicalPath, "write1")
    +        try {
    +          // Read
    +          java.nio.file.Files.write(path0.toPath, lines.getBytes(StandardCharsets.UTF_8))
    +          val df = spark.read
    +            .option("lineSep", lineSep)
    +            .format("libsvm")
    +            .load(path0.getAbsolutePath)
    +
    +          assert(df.columns(0) == "label")
    +          assert(df.columns(1) == "features")
    +          val row1 = df.first()
    +          assert(row1.getDouble(0) == 1.0)
    +          val v = row1.getAs[SparseVector](1)
    +          assert(v == Vectors.sparse(6, Seq((0, 1.0), (2, 2.0), (4, 3.0))))
    +
    --- End diff --
    
    The following test only include checking `df` and `readbackDF` equality. But, it seems we also need test the whole loaded `df` and raw file content equality.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Let me cc @gatorsmile and @maropu who I believe are interested in this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by ash211 <gi...@git.apache.org>.
Github user ash211 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r126534985
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/source/libsvm/LibSVMOptions.scala ---
    @@ -41,11 +41,15 @@ private[libsvm] class LibSVMOptions(@transient private val parameters: CaseInsen
         case o => throw new IllegalArgumentException(s"Invalid value `$o` for parameter " +
           s"`$VECTOR_TYPE`. Expected types are `sparse` and `dense`.")
       }
    +
    +  val lineSeparator: Option[String] = parameters.get(LINE_SEPARATOR)
    --- End diff --
    
    I've seen datasets that have multi-character delimiters of more than 2 characters.  Specifically `|~|`
    
    So yes there is a use case, but it's a long tail one.  I'd be happy to get this progress of up to 2 characters and work towards 3+ in a future PR


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r155151425
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/source/libsvm/LibSVMRelationSuite.scala ---
    @@ -184,4 +184,54 @@ class LibSVMRelationSuite extends SparkFunSuite with MLlibTestSparkContext {
           spark.sql("DROP TABLE IF EXISTS libsvmTable")
         }
       }
    +
    +  def testLineSeparator(lineSep: String): Unit = {
    +    test(s"SPARK-21289: Support line separator - lineSep: '$lineSep'") {
    +      val data = Seq(
    +        "1.0 1:1.0 3:2.0 5:3.0", "0.0", "0.0", "0.0 2:4.0 4:5.0 6:6.0").mkString(lineSep)
    +      val dataWithTrailingLineSep = s"$data$lineSep"
    +
    +      Seq(data, dataWithTrailingLineSep).foreach { lines =>
    +        val path0 = new File(tempDir.getCanonicalPath, "write0")
    +        val path1 = new File(tempDir.getCanonicalPath, "write1")
    +        try {
    +          // Read
    +          java.nio.file.Files.write(path0.toPath, lines.getBytes(StandardCharsets.UTF_8))
    +          val df = spark.read
    +            .option("lineSep", lineSep)
    +            .format("libsvm")
    +            .load(path0.getAbsolutePath)
    +
    +          assert(df.columns(0) == "label")
    +          assert(df.columns(1) == "features")
    +          val row1 = df.first()
    +          assert(row1.getDouble(0) == 1.0)
    +          val v = row1.getAs[SparseVector](1)
    +          assert(v == Vectors.sparse(6, Seq((0, 1.0), (2, 2.0), (4, 3.0))))
    +
    --- End diff --
    
    OK, let me update it. It's easy to change anyway.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #79465 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79465/testReport)** for PR 18581 at commit [`4592b5b`](https://github.com/apache/spark/commit/4592b5bd00f4fd02a329bb3fac616e338421ee7b).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #79440 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79440/testReport)** for PR 18581 at commit [`585a399`](https://github.com/apache/spark/commit/585a3999e5415d093d114b66c015d1f03302fbe6).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81164 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81164/testReport)** for PR 18581 at commit [`9b1bf10`](https://github.com/apache/spark/commit/9b1bf108e61f6af69331a5d4052b53a47d34bf71).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81034 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81034/testReport)** for PR 18581 at commit [`f357573`](https://github.com/apache/spark/commit/f35757331e527b3e13d8e2ca314cad2e48f7eb16).
     * This patch **fails to build**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by beickhoff <gi...@git.apache.org>.
Github user beickhoff commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    @HyukjinKwon, is there another PR to handle CSV?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81036 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81036/testReport)** for PR 18581 at commit [`87bb599`](https://github.com/apache/spark/commit/87bb59985cb19e9f6ad311d61b6d9998a4aa4e10).
     * This patch **fails SparkR unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r135403225
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala ---
    @@ -32,7 +32,9 @@ import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
      * in that file.
      */
     class HadoopFileLinesReader(
    -    file: PartitionedFile, conf: Configuration) extends Iterator[Text] with Closeable {
    +    file: PartitionedFile,
    +    lineSeparator: Option[String],
    --- End diff --
    
    I was thinking `\n` means the first case of your comment above as it is set by the user explicitly. So, I thought If it is not given, it covers three cases of newlines by default. If we use `\n` to deal with three cases above, wouldn't we are unable to cover, the arguably corner case of only handling `\n`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/81034/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #79455 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79455/testReport)** for PR 18581 at commit [`fdd624f`](https://github.com/apache/spark/commit/fdd624f2f2cc937af0c356353648fb83270f9468).
     * This patch **fails PySpark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r154598540
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/source/libsvm/LibSVMRelationSuite.scala ---
    @@ -184,4 +184,54 @@ class LibSVMRelationSuite extends SparkFunSuite with MLlibTestSparkContext {
           spark.sql("DROP TABLE IF EXISTS libsvmTable")
         }
       }
    +
    +  def testLineSeparator(lineSep: String): Unit = {
    +    test(s"SPARK-21289: Support line separator - lineSep: '$lineSep'") {
    +      val data = Seq(
    +        "1.0 1:1.0 3:2.0 5:3.0", "0.0", "0.0", "0.0 2:4.0 4:5.0 6:6.0").mkString(lineSep)
    +      val dataWithTrailingLineSep = s"$data$lineSep"
    +
    +      Seq(data, dataWithTrailingLineSep).foreach { lines =>
    +        val path0 = new File(tempDir.getCanonicalPath, "write0")
    +        val path1 = new File(tempDir.getCanonicalPath, "write1")
    +        try {
    +          // Read
    +          java.nio.file.Files.write(path0.toPath, lines.getBytes(StandardCharsets.UTF_8))
    +          val df = spark.read
    +            .option("lineSep", lineSep)
    +            .format("libsvm")
    +            .load(path0.getAbsolutePath)
    +
    +          assert(df.columns(0) == "label")
    +          assert(df.columns(1) == "features")
    +          val row1 = df.first()
    +          assert(row1.getDouble(0) == 1.0)
    +          val v = row1.getAs[SparseVector](1)
    +          assert(v == Vectors.sparse(6, Seq((0, 1.0), (2, 2.0), (4, 3.0))))
    +
    --- End diff --
    
    So here you only test the first line ? 
    Why not use df.collect() to test every line ?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r126606327
  
    --- Diff: python/pyspark/sql/readwriter.py ---
    @@ -234,6 +234,8 @@ def json(self, path, schema=None, primitivesAsString=None, prefersDecimal=None,
                                     default value, ``yyyy-MM-dd'T'HH:mm:ss.SSSXXX``.
             :param multiLine: parse one record, which may span multiple lines, per file. If None is
                               set, it uses the default value, ``false``.
    +        :param lineSep: defines the line separator that should be used for parsing. If None is
    +                        set, it uses the default value, ``\\r\\n`` or ``\\n``.
    --- End diff --
    
    It has a different value for reading and writing individually. I tried to not change both. So, the related pointers for JSON read should be ...
    
    https://github.com/apache/spark/pull/18581/files#diff-5ac20b8d75a20117deaa9ba4af814090R142 for data
    
    https://github.com/apache/spark/pull/18581/files#diff-5ac20b8d75a20117deaa9ba4af814090R132 for schema inference.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by maropu <gi...@git.apache.org>.
Github user maropu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r126460521
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala ---
    @@ -628,6 +630,12 @@ class DataFrameReader private[sql](sparkSession: SparkSession) extends Logging {
        *   spark.read().text("/path/to/spark/README.md")
        * }}}
        *
    +   * You can set the following text-specific options to deal with text files:
    +   * <ul>
    +   * <li>`lineSep` (default is `\r\n` or `\n`): defines the line separator that should
    --- End diff --
    
    Or, how about using a platform-dependent separator in writing cases? If we keep the existing behaviour, I feel at least we better document more about it here. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81166 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81166/testReport)** for PR 18581 at commit [`08233e6`](https://github.com/apache/spark/commit/08233e654072b1f117926b813459f3e2bf6b8a55).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/83168/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r155141609
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/source/libsvm/LibSVMRelationSuite.scala ---
    @@ -184,4 +184,54 @@ class LibSVMRelationSuite extends SparkFunSuite with MLlibTestSparkContext {
           spark.sql("DROP TABLE IF EXISTS libsvmTable")
         }
       }
    +
    +  def testLineSeparator(lineSep: String): Unit = {
    +    test(s"SPARK-21289: Support line separator - lineSep: '$lineSep'") {
    +      val data = Seq(
    +        "1.0 1:1.0 3:2.0 5:3.0", "0.0", "0.0", "0.0 2:4.0 4:5.0 6:6.0").mkString(lineSep)
    +      val dataWithTrailingLineSep = s"$data$lineSep"
    +
    +      Seq(data, dataWithTrailingLineSep).foreach { lines =>
    +        val path0 = new File(tempDir.getCanonicalPath, "write0")
    +        val path1 = new File(tempDir.getCanonicalPath, "write1")
    +        try {
    +          // Read
    +          java.nio.file.Files.write(path0.toPath, lines.getBytes(StandardCharsets.UTF_8))
    +          val df = spark.read
    +            .option("lineSep", lineSep)
    +            .format("libsvm")
    +            .load(path0.getAbsolutePath)
    +
    +          assert(df.columns(0) == "label")
    +          assert(df.columns(1) == "features")
    +          val row1 = df.first()
    +          assert(row1.getDouble(0) == 1.0)
    +          val v = row1.getAs[SparseVector](1)
    +          assert(v == Vectors.sparse(6, Seq((0, 1.0), (2, 2.0), (4, 3.0))))
    --- End diff --
    
    so I prefer to keep consistent with others.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by maropu <gi...@git.apache.org>.
Github user maropu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r126442576
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/source/libsvm/LibSVMOptions.scala ---
    @@ -41,11 +41,15 @@ private[libsvm] class LibSVMOptions(@transient private val parameters: CaseInsen
         case o => throw new IllegalArgumentException(s"Invalid value `$o` for parameter " +
           s"`$VECTOR_TYPE`. Expected types are `sparse` and `dense`.")
       }
    +
    +  val lineSeparator: Option[String] = parameters.get(LINE_SEPARATOR)
    --- End diff --
    
    We need multi-characters for the separator? Hive assumes a single character in `LINES TERMINATED BY` https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTableCreate/Drop/TruncateTable


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #79442 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79442/testReport)** for PR 18581 at commit [`eb77c98`](https://github.com/apache/spark/commit/eb77c98a32a6418f30c72de538c6ff129b4ed9a4).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #84531 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/84531/testReport)** for PR 18581 at commit [`265dd48`](https://github.com/apache/spark/commit/265dd48ce16fd62058f4515a9e91c67942b45ed7).
     * This patch **fails due to an unknown error code, -9**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [WIP][SPARK-21289][SQL][ML] Supports custom line separat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #79455 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79455/testReport)** for PR 18581 at commit [`fdd624f`](https://github.com/apache/spark/commit/fdd624f2f2cc937af0c356353648fb83270f9468).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r154605874
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/source/libsvm/LibSVMRelationSuite.scala ---
    @@ -184,4 +184,54 @@ class LibSVMRelationSuite extends SparkFunSuite with MLlibTestSparkContext {
           spark.sql("DROP TABLE IF EXISTS libsvmTable")
         }
       }
    +
    +  def testLineSeparator(lineSep: String): Unit = {
    +    test(s"SPARK-21289: Support line separator - lineSep: '$lineSep'") {
    +      val data = Seq(
    +        "1.0 1:1.0 3:2.0 5:3.0", "0.0", "0.0", "0.0 2:4.0 4:5.0 6:6.0").mkString(lineSep)
    +      val dataWithTrailingLineSep = s"$data$lineSep"
    +
    +      Seq(data, dataWithTrailingLineSep).foreach { lines =>
    +        val path0 = new File(tempDir.getCanonicalPath, "write0")
    +        val path1 = new File(tempDir.getCanonicalPath, "write1")
    +        try {
    +          // Read
    +          java.nio.file.Files.write(path0.toPath, lines.getBytes(StandardCharsets.UTF_8))
    +          val df = spark.read
    +            .option("lineSep", lineSep)
    +            .format("libsvm")
    +            .load(path0.getAbsolutePath)
    +
    +          assert(df.columns(0) == "label")
    +          assert(df.columns(1) == "features")
    +          val row1 = df.first()
    +          assert(row1.getDouble(0) == 1.0)
    +          val v = row1.getAs[SparseVector](1)
    +          assert(v == Vectors.sparse(6, Seq((0, 1.0), (2, 2.0), (4, 3.0))))
    --- End diff --
    
    I'd like to ask why actually. I had some discussion about this and ended up without conclusion. The doc says `===` is preferred but the actual error messages are even clear with `==` sometimes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r134814393
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala ---
    @@ -32,7 +32,9 @@ import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
      * in that file.
      */
     class HadoopFileLinesReader(
    -    file: PartitionedFile, conf: Configuration) extends Iterator[Text] with Closeable {
    +    file: PartitionedFile,
    +    lineSeparator: Option[String],
    --- End diff --
    
    This should not be optional.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79455/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by don4of4 <gi...@git.apache.org>.
Github user don4of4 commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Was this finished and merged in?  I see https://issues.apache.org/jira/browse/SPARK-21289 is still open.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #84538 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/84538/testReport)** for PR 18581 at commit [`265dd48`](https://github.com/apache/spark/commit/265dd48ce16fd62058f4515a9e91c67942b45ed7).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r135403087
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala ---
    @@ -32,7 +32,9 @@ import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
      * in that file.
      */
     class HadoopFileLinesReader(
    -    file: PartitionedFile, conf: Configuration) extends Iterator[Text] with Closeable {
    +    file: PartitionedFile,
    +    lineSeparator: Option[String],
    --- End diff --
    
    It sounds like Hive's behavior is reasonable. For most external users, `\n` means a new line. Thus, it should match any of these three options: `LF`, `CR+LF` and `CR`. WDYT?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/84531/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    cc @cloud-fan, could you take a look please when you have some time?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r134949533
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala ---
    @@ -32,7 +32,9 @@ import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
      * in that file.
      */
     class HadoopFileLinesReader(
    -    file: PartitionedFile, conf: Configuration) extends Iterator[Text] with Closeable {
    +    file: PartitionedFile,
    +    lineSeparator: Option[String],
    --- End diff --
    
    > When the line delimiter is '\n', any of the follow sequences will count as a delimiter: "\n", "\r\n", or "\r".
    
    Could you check whether this is true here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r135405534
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala ---
    @@ -32,7 +32,9 @@ import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
      * in that file.
      */
     class HadoopFileLinesReader(
    -    file: PartitionedFile, conf: Configuration) extends Iterator[Text] with Closeable {
    +    file: PartitionedFile,
    +    lineSeparator: Option[String],
    --- End diff --
    
    OK. Will change this but I should say this way looks incorrect to me and this behaviour should be discussed and possibly updated in the near future.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Thanks! 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r126462234
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala ---
    @@ -628,6 +630,12 @@ class DataFrameReader private[sql](sparkSession: SparkSession) extends Logging {
        *   spark.read().text("/path/to/spark/README.md")
        * }}}
        *
    +   * You can set the following text-specific options to deal with text files:
    +   * <ul>
    +   * <li>`lineSep` (default is `\r\n` or `\n`): defines the line separator that should
    --- End diff --
    
    It sounds tricky but I guess we don't want a platform-dependent one - [SPARK-18076](https://issues.apache.org/jira/browse/SPARK-18076). Up to my knowledge, `LineRecordReader` should cover both `\r\n` and `\n`.  I will try to improve this documentation when cleaning other comments together if we are okay with this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r154606499
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/source/libsvm/LibSVMRelationSuite.scala ---
    @@ -184,4 +184,54 @@ class LibSVMRelationSuite extends SparkFunSuite with MLlibTestSparkContext {
           spark.sql("DROP TABLE IF EXISTS libsvmTable")
         }
       }
    +
    +  def testLineSeparator(lineSep: String): Unit = {
    +    test(s"SPARK-21289: Support line separator - lineSep: '$lineSep'") {
    +      val data = Seq(
    +        "1.0 1:1.0 3:2.0 5:3.0", "0.0", "0.0", "0.0 2:4.0 4:5.0 6:6.0").mkString(lineSep)
    +      val dataWithTrailingLineSep = s"$data$lineSep"
    +
    +      Seq(data, dataWithTrailingLineSep).foreach { lines =>
    +        val path0 = new File(tempDir.getCanonicalPath, "write0")
    +        val path1 = new File(tempDir.getCanonicalPath, "write1")
    +        try {
    +          // Read
    +          java.nio.file.Files.write(path0.toPath, lines.getBytes(StandardCharsets.UTF_8))
    +          val df = spark.read
    +            .option("lineSep", lineSep)
    +            .format("libsvm")
    +            .load(path0.getAbsolutePath)
    +
    +          assert(df.columns(0) == "label")
    +          assert(df.columns(1) == "features")
    +          val row1 = df.first()
    +          assert(row1.getDouble(0) == 1.0)
    +          val v = row1.getAs[SparseVector](1)
    +          assert(v == Vectors.sparse(6, Seq((0, 1.0), (2, 2.0), (4, 3.0))))
    +
    --- End diff --
    
    Why not just test the first line?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r134950477
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/source/libsvm/LibSVMOptions.scala ---
    @@ -41,11 +41,15 @@ private[libsvm] class LibSVMOptions(@transient private val parameters: CaseInsen
         case o => throw new IllegalArgumentException(s"Invalid value `$o` for parameter " +
           s"`$VECTOR_TYPE`. Expected types are `sparse` and `dense`.")
       }
    +
    +  val lineSeparator: Option[String] = parameters.get(LINE_SEPARATOR)
    +  lineSeparator.foreach(s => require(s.nonEmpty, s"'$LINE_SEPARATOR' cannot be an empty string."))
     }
     
     private[libsvm] object LibSVMOptions {
       val NUM_FEATURES = "numFeatures"
       val VECTOR_TYPE = "vectorType"
       val DENSE_VECTOR_TYPE = "dense"
       val SPARSE_VECTOR_TYPE = "sparse"
    +  val LINE_SEPARATOR = "lineSep"
    --- End diff --
    
    Either `lineDelimiter` or `lineSeparator` looks fine. 
    
    In the future, we could also support field delimiters.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/81060/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [WIP][SPARK-21289][SQL][ML] Supports custom line separat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #79448 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79448/testReport)** for PR 18581 at commit [`eb77c98`](https://github.com/apache/spark/commit/eb77c98a32a6418f30c72de538c6ff129b4ed9a4).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    I will definitely open a JIRA to discussion further. Thank you for your head-up.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81150 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81150/testReport)** for PR 18581 at commit [`18b2684`](https://github.com/apache/spark/commit/18b268457fa0124d1c3c484ee02210ee674a9466).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/84538/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81170 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81170/testReport)** for PR 18581 at commit [`41369cf`](https://github.com/apache/spark/commit/41369cf26fcdd20708168a78c0ca35b614f83f77).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r135415452
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala ---
    @@ -32,7 +32,9 @@ import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
      * in that file.
      */
    --- End diff --
    
    Add `@parameter`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #79522 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79522/testReport)** for PR 18581 at commit [`974357b`](https://github.com/apache/spark/commit/974357bced9238c041a7d6411fe2bb40b9e96aa0).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r134955456
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/source/libsvm/LibSVMOptions.scala ---
    @@ -41,11 +41,15 @@ private[libsvm] class LibSVMOptions(@transient private val parameters: CaseInsen
         case o => throw new IllegalArgumentException(s"Invalid value `$o` for parameter " +
           s"`$VECTOR_TYPE`. Expected types are `sparse` and `dense`.")
       }
    +
    +  val lineSeparator: Option[String] = parameters.get(LINE_SEPARATOR)
    +  lineSeparator.foreach(s => require(s.nonEmpty, s"'$LINE_SEPARATOR' cannot be an empty string."))
     }
     
     private[libsvm] object LibSVMOptions {
       val NUM_FEATURES = "numFeatures"
       val VECTOR_TYPE = "vectorType"
       val DENSE_VECTOR_TYPE = "dense"
       val SPARSE_VECTOR_TYPE = "sparse"
    +  val LINE_SEPARATOR = "lineSep"
    --- End diff --
    
    Just for history, it was `delimiter` but renamed to `sep`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r134932083
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala ---
    @@ -32,7 +32,9 @@ import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
      * in that file.
      */
     class HadoopFileLinesReader(
    -    file: PartitionedFile, conf: Configuration) extends Iterator[Text] with Closeable {
    +    file: PartitionedFile,
    +    lineSeparator: Option[String],
    --- End diff --
    
    We do not know what is the default line separator?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81164 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81164/testReport)** for PR 18581 at commit [`9b1bf10`](https://github.com/apache/spark/commit/9b1bf108e61f6af69331a5d4052b53a47d34bf71).
     * This patch **fails to build**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Sure, thanks.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r135381676
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala ---
    @@ -32,7 +32,9 @@ import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
      * in that file.
      */
     class HadoopFileLinesReader(
    -    file: PartitionedFile, conf: Configuration) extends Iterator[Text] with Closeable {
    +    file: PartitionedFile,
    +    lineSeparator: Option[String],
    --- End diff --
    
    Thanks for clarifying it. Here is my investigation:
    
    > When the line delimiter is '\n', any of the follow sequences will count as a delimiter: "\n", "\r\n", or "\r"
    
    With this input:
    
    ```
    a\nb\r\nc\rd
    ```
    
    Case with `\n`:
    
    ```sql
    CREATE EXTERNAL TABlE tbl(value STRING)
    ROW FORMAT DELIMITED LINES TERMINATED BY '\n'
    STORED AS TEXTFILE LOCATION '...';
    ```
    
    ```sql
    SELECT value FROM tbl;
    ```
    
    produced
    
    ```
    a
    b
    c
    d
    ```
    
    This looks incorrect. I _guess_ `\n` is not being set and it looks working as the default behaviour in `LineRecordReader`.
    
    
    > Accepting a single "\r" is pretty strange, but that's what Hive does so we emulate this behavior.
    
    Case with `\r`:
    
    ```sql
    CREATE EXTERNAL TABlE tbl(value STRING) 
    ROW FORMAT DELIMITED LINES TERMINATED BY '\r'
    STORED AS TEXTFILE LOCATION '...';
    ```
    
    produced
    
    ```
    FAILED: SemanticException 2:41 LINES TERMINATED BY only supports newline '\n' right now. Error encountered near token ''\r''
    ...
    org.apache.hadoop.hive.ql.parse.SemanticException: 2:41 LINES TERMINATED BY only supports newline '\n' right now. Error encountered near token ''\r''
    ```
    
    This looks related with https://issues.apache.org/jira/browse/HIVE-5999
    
    and these lines:
    
    https://github.com/apache/hive/blob/696be9f52dfc6fb59c24de19726b4460100fc9ba/ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java#L198-L203
    
    if I am not mistaken.
    
    I am curious how this case was tested in the JIRA. If this test used `textinputformat.record.delimiter`, then, this seems Hadoop's property, which is basically the same thing as what I am doing here.
    
    
    > Is Hive using Hadoop's LineRecordReader?
    
    In the case above, the input format was `org.apache.hadoop.mapred.TextInputFormat`, which uses `LineRecordReader`. 
    
    > How does Hive support it?
    
    It looks Hive tries to support it by `LINES TERMINATED BY '\r'` https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTableCreate/Drop/TruncateTable. I could not find other (formal) ways.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r154594381
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/source/libsvm/LibSVMRelationSuite.scala ---
    @@ -184,4 +184,54 @@ class LibSVMRelationSuite extends SparkFunSuite with MLlibTestSparkContext {
           spark.sql("DROP TABLE IF EXISTS libsvmTable")
         }
       }
    +
    +  def testLineSeparator(lineSep: String): Unit = {
    +    test(s"SPARK-21289: Support line separator - lineSep: '$lineSep'") {
    +      val data = Seq(
    +        "1.0 1:1.0 3:2.0 5:3.0", "0.0", "0.0", "0.0 2:4.0 4:5.0 6:6.0").mkString(lineSep)
    +      val dataWithTrailingLineSep = s"$data$lineSep"
    +
    +      Seq(data, dataWithTrailingLineSep).foreach { lines =>
    +        val path0 = new File(tempDir.getCanonicalPath, "write0")
    +        val path1 = new File(tempDir.getCanonicalPath, "write1")
    +        try {
    +          // Read
    +          java.nio.file.Files.write(path0.toPath, lines.getBytes(StandardCharsets.UTF_8))
    --- End diff --
    
    Why not import this ? `java.nio.file.Files`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [WIP][SPARK-21289][SQL][ML] Supports custom line separat...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    retest this please


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Nope not yet, I will try to make it within the next release soon.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r155146209
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/source/libsvm/LibSVMRelationSuite.scala ---
    @@ -184,4 +184,54 @@ class LibSVMRelationSuite extends SparkFunSuite with MLlibTestSparkContext {
           spark.sql("DROP TABLE IF EXISTS libsvmTable")
         }
       }
    +
    +  def testLineSeparator(lineSep: String): Unit = {
    +    test(s"SPARK-21289: Support line separator - lineSep: '$lineSep'") {
    +      val data = Seq(
    +        "1.0 1:1.0 3:2.0 5:3.0", "0.0", "0.0", "0.0 2:4.0 4:5.0 6:6.0").mkString(lineSep)
    +      val dataWithTrailingLineSep = s"$data$lineSep"
    +
    +      Seq(data, dataWithTrailingLineSep).foreach { lines =>
    +        val path0 = new File(tempDir.getCanonicalPath, "write0")
    +        val path1 = new File(tempDir.getCanonicalPath, "write1")
    +        try {
    +          // Read
    +          java.nio.file.Files.write(path0.toPath, lines.getBytes(StandardCharsets.UTF_8))
    +          val df = spark.read
    +            .option("lineSep", lineSep)
    +            .format("libsvm")
    +            .load(path0.getAbsolutePath)
    +
    +          assert(df.columns(0) == "label")
    +          assert(df.columns(1) == "features")
    +          val row1 = df.first()
    +          assert(row1.getDouble(0) == 1.0)
    +          val v = row1.getAs[SparseVector](1)
    +          assert(v == Vectors.sparse(6, Seq((0, 1.0), (2, 2.0), (4, 3.0))))
    --- End diff --
    
    OK but let me use `==`. Seems it's used in the test cases of this file. 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    @HyukjinKwon Could you address the conflicts? Then, I will review it 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r135346452
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala ---
    @@ -32,7 +32,9 @@ import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
      * in that file.
      */
     class HadoopFileLinesReader(
    -    file: PartitionedFile, conf: Configuration) extends Iterator[Text] with Closeable {
    +    file: PartitionedFile,
    +    lineSeparator: Option[String],
    --- End diff --
    
    Is Hive using Hadoop's `LineRecordReader`? How does Hive support it?
    
    If possible, we always try to behave the same like Hive.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/81036/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81060 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81060/testReport)** for PR 18581 at commit [`47e8d37`](https://github.com/apache/spark/commit/47e8d3761681611a9ee6d50d6c812babd395dace).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by WeichenXu123 <gi...@git.apache.org>.
Github user WeichenXu123 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r154594735
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/source/libsvm/LibSVMRelationSuite.scala ---
    @@ -184,4 +184,54 @@ class LibSVMRelationSuite extends SparkFunSuite with MLlibTestSparkContext {
           spark.sql("DROP TABLE IF EXISTS libsvmTable")
         }
       }
    +
    +  def testLineSeparator(lineSep: String): Unit = {
    +    test(s"SPARK-21289: Support line separator - lineSep: '$lineSep'") {
    +      val data = Seq(
    +        "1.0 1:1.0 3:2.0 5:3.0", "0.0", "0.0", "0.0 2:4.0 4:5.0 6:6.0").mkString(lineSep)
    +      val dataWithTrailingLineSep = s"$data$lineSep"
    +
    +      Seq(data, dataWithTrailingLineSep).foreach { lines =>
    +        val path0 = new File(tempDir.getCanonicalPath, "write0")
    +        val path1 = new File(tempDir.getCanonicalPath, "write1")
    +        try {
    +          // Read
    +          java.nio.file.Files.write(path0.toPath, lines.getBytes(StandardCharsets.UTF_8))
    +          val df = spark.read
    +            .option("lineSep", lineSep)
    +            .format("libsvm")
    +            .load(path0.getAbsolutePath)
    +
    +          assert(df.columns(0) == "label")
    +          assert(df.columns(1) == "features")
    +          val row1 = df.first()
    +          assert(row1.getDouble(0) == 1.0)
    +          val v = row1.getAs[SparseVector](1)
    +          assert(v == Vectors.sparse(6, Seq((0, 1.0), (2, 2.0), (4, 3.0))))
    --- End diff --
    
    Use `===` instead of `==`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [WIP][SPARK-21289][SQL][ML] Supports custom line separat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #79440 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79440/testReport)** for PR 18581 at commit [`585a399`](https://github.com/apache/spark/commit/585a3999e5415d093d114b66c015d1f03302fbe6).
     * This patch **fails due to an unknown error code, -9**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    gentle ping @gatorsmile


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #84538 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/84538/testReport)** for PR 18581 at commit [`265dd48`](https://github.com/apache/spark/commit/265dd48ce16fd62058f4515a9e91c67942b45ed7).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/81153/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by maropu <gi...@git.apache.org>.
Github user maropu commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    yea, thanks for pinging me! I'll check and comment on it later.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r126604695
  
    --- Diff: python/pyspark/sql/readwriter.py ---
    @@ -234,6 +234,8 @@ def json(self, path, schema=None, primitivesAsString=None, prefersDecimal=None,
                                     default value, ``yyyy-MM-dd'T'HH:mm:ss.SSSXXX``.
             :param multiLine: parse one record, which may span multiple lines, per file. If None is
                               set, it uses the default value, ``false``.
    +        :param lineSep: defines the line separator that should be used for parsing. If None is
    +                        set, it uses the default value, ``\\r\\n`` or ``\\n``.
    --- End diff --
    
    seems the default value is always `\n`? https://github.com/apache/spark/pull/18581/files#diff-059fbd7487f6bec7cbd8a57f21f8c8c5R48


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79465/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81166 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81166/testReport)** for PR 18581 at commit [`08233e6`](https://github.com/apache/spark/commit/08233e654072b1f117926b813459f3e2bf6b8a55).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81153 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81153/testReport)** for PR 18581 at commit [`18b2684`](https://github.com/apache/spark/commit/18b268457fa0124d1c3c484ee02210ee674a9466).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81170 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81170/testReport)** for PR 18581 at commit [`41369cf`](https://github.com/apache/spark/commit/41369cf26fcdd20708168a78c0ca35b614f83f77).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by maropu <gi...@git.apache.org>.
Github user maropu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r126462682
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala ---
    @@ -628,6 +630,12 @@ class DataFrameReader private[sql](sparkSession: SparkSession) extends Logging {
        *   spark.read().text("/path/to/spark/README.md")
        * }}}
        *
    +   * You can set the following text-specific options to deal with text files:
    +   * <ul>
    +   * <li>`lineSep` (default is `\r\n` or `\n`): defines the line separator that should
    --- End diff --
    
    ok, thanks! 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r134888579
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/source/libsvm/LibSVMOptions.scala ---
    @@ -41,11 +41,15 @@ private[libsvm] class LibSVMOptions(@transient private val parameters: CaseInsen
         case o => throw new IllegalArgumentException(s"Invalid value `$o` for parameter " +
           s"`$VECTOR_TYPE`. Expected types are `sparse` and `dense`.")
       }
    +
    +  val lineSeparator: Option[String] = parameters.get(LINE_SEPARATOR)
    +  lineSeparator.foreach(s => require(s.nonEmpty, s"'$LINE_SEPARATOR' cannot be an empty string."))
     }
     
     private[libsvm] object LibSVMOptions {
       val NUM_FEATURES = "numFeatures"
       val VECTOR_TYPE = "vectorType"
       val DENSE_VECTOR_TYPE = "dense"
       val SPARSE_VECTOR_TYPE = "sparse"
    +  val LINE_SEPARATOR = "lineSep"
    --- End diff --
    
    This name came after `sep` in CSV which resembled R. Do you prefer `separator` and `lineSeparator`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by maropu <gi...@git.apache.org>.
Github user maropu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r126444751
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala ---
    @@ -628,6 +630,12 @@ class DataFrameReader private[sql](sparkSession: SparkSession) extends Logging {
        *   spark.read().text("/path/to/spark/README.md")
        * }}}
        *
    +   * You can set the following text-specific options to deal with text files:
    +   * <ul>
    +   * <li>`lineSep` (default is `\r\n` or `\n`): defines the line separator that should
    --- End diff --
    
    How about explicitly setting `\n` by default along with writing cases?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    It looks like this line separator has to be handled by each data source individually, can we start with, e.g., json, and then csv, text, etc.? Then we can have smaller PRs that would be easier to review.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon closed the pull request at:

    https://github.com/apache/spark/pull/18581


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #79465 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79465/testReport)** for PR 18581 at commit [`4592b5b`](https://github.com/apache/spark/commit/4592b5bd00f4fd02a329bb3fac616e338421ee7b).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #79522 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79522/testReport)** for PR 18581 at commit [`974357b`](https://github.com/apache/spark/commit/974357bced9238c041a7d6411fe2bb40b9e96aa0).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r135403912
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala ---
    @@ -32,7 +32,9 @@ import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
      * in that file.
      */
     class HadoopFileLinesReader(
    -    file: PartitionedFile, conf: Configuration) extends Iterator[Text] with Closeable {
    +    file: PartitionedFile,
    +    lineSeparator: Option[String],
    --- End diff --
    
    So far, following Hive is the safest. If users complain about it, we can behave differently from Hive with a new SQLConf.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r134889031
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala ---
    @@ -32,7 +32,9 @@ import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
      * in that file.
      */
     class HadoopFileLinesReader(
    -    file: PartitionedFile, conf: Configuration) extends Iterator[Text] with Closeable {
    +    file: PartitionedFile,
    +    lineSeparator: Option[String],
    --- End diff --
    
    Could you elaborate why? `LineRecordReader` without this works differently, covering newline variants by default. I don't know which string I should give for `LineRecordReader` constructor if this is not optional.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [WIP][SPARK-21289][SQL][ML] Supports custom line separat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #79446 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79446/testReport)** for PR 18581 at commit [`eb77c98`](https://github.com/apache/spark/commit/eb77c98a32a6418f30c72de538c6ff129b4ed9a4).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #79448 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79448/testReport)** for PR 18581 at commit [`eb77c98`](https://github.com/apache/spark/commit/eb77c98a32a6418f30c72de538c6ff129b4ed9a4).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r126454493
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala ---
    @@ -628,6 +630,12 @@ class DataFrameReader private[sql](sparkSession: SparkSession) extends Logging {
        *   spark.read().text("/path/to/spark/README.md")
        * }}}
        *
    +   * You can set the following text-specific options to deal with text files:
    +   * <ul>
    +   * <li>`lineSep` (default is `\r\n` or `\n`): defines the line separator that should
    --- End diff --
    
    I was thinking in that way. However, this appears a default behaviour from Hadoop's `LineRecordReader`. I am worried of a behaviour change (e.g., I guess Windows users get affected by this) .


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [WIP][SPARK-21289][SQL][ML] Supports custom line separat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #79442 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79442/testReport)** for PR 18581 at commit [`eb77c98`](https://github.com/apache/spark/commit/eb77c98a32a6418f30c72de538c6ff129b4ed9a4).
     * This patch **fails due to an unknown error code, -9**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81165 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81165/testReport)** for PR 18581 at commit [`cbed415`](https://github.com/apache/spark/commit/cbed41534ff7a6a7219542ec282fcee4bdf67a67).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79448/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81034 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81034/testReport)** for PR 18581 at commit [`f357573`](https://github.com/apache/spark/commit/f35757331e527b3e13d8e2ca314cad2e48f7eb16).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by maropu <gi...@git.apache.org>.
Github user maropu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r126585768
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/source/libsvm/LibSVMOptions.scala ---
    @@ -41,11 +41,15 @@ private[libsvm] class LibSVMOptions(@transient private val parameters: CaseInsen
         case o => throw new IllegalArgumentException(s"Invalid value `$o` for parameter " +
           s"`$VECTOR_TYPE`. Expected types are `sparse` and `dense`.")
       }
    +
    +  val lineSeparator: Option[String] = parameters.get(LINE_SEPARATOR)
    --- End diff --
    
    Could we put this option in a single place for these formats? I feel putting this option in each format looks a little messy...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    I opened https://github.com/apache/spark/pull/20727 for text datasource.
    
    @cloud-fan, other text-based sources depend on text datasource in schema inference path so I made a fix for text datasource first. Please check out if that makes sense when you are available.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    retest this please


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #83168 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83168/testReport)** for PR 18581 at commit [`a240973`](https://github.com/apache/spark/commit/a240973cbb56d27b1e5ca8b00ceb45d2bf8018a2).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #84531 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/84531/testReport)** for PR 18581 at commit [`265dd48`](https://github.com/apache/spark/commit/265dd48ce16fd62058f4515a9e91c67942b45ed7).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r134817030
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVSuite.scala ---
    @@ -1195,4 +1196,46 @@ class CSVSuite extends QueryTest with SharedSQLContext with SQLTestUtils {
           .csv(Seq("10u12").toDS())
         checkAnswer(results, Row(null))
       }
    +
    +  test("SPARK-21289: Support line separator") {
    +    Seq(false, true).foreach { multiLine =>
    +      // Read
    +      Seq("a,b|1,\"a\nd\"|1,f|", "a,b|1,\"a\nd\"|1,f").foreach { lines =>
    +        withTempPath { path =>
    +          Files.write(path.toPath, lines.getBytes(StandardCharsets.UTF_8))
    +          val df = spark.read
    +            .option("multiLine", multiLine)
    +            .option("lineSep", "|")
    --- End diff --
    
    The test case should be a function. We can pass different separators and verify whether it returns the expected results.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r135316064
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala ---
    @@ -32,7 +32,9 @@ import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
      * in that file.
      */
     class HadoopFileLinesReader(
    -    file: PartitionedFile, conf: Configuration) extends Iterator[Text] with Closeable {
    +    file: PartitionedFile,
    +    lineSeparator: Option[String],
    --- End diff --
    
    I am willing to do so but I am curious of the purpose of checking so. Do you want some test cases about this concern? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81150 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81150/testReport)** for PR 18581 at commit [`18b2684`](https://github.com/apache/spark/commit/18b268457fa0124d1c3c484ee02210ee674a9466).
     * This patch **fails due to an unknown error code, -9**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #83168 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/83168/testReport)** for PR 18581 at commit [`a240973`](https://github.com/apache/spark/commit/a240973cbb56d27b1e5ca8b00ceb45d2bf8018a2).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [WIP][SPARK-21289][SQL][ML] Supports custom line separat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r134813986
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/source/libsvm/LibSVMOptions.scala ---
    @@ -41,11 +41,15 @@ private[libsvm] class LibSVMOptions(@transient private val parameters: CaseInsen
         case o => throw new IllegalArgumentException(s"Invalid value `$o` for parameter " +
           s"`$VECTOR_TYPE`. Expected types are `sparse` and `dense`.")
       }
    +
    +  val lineSeparator: Option[String] = parameters.get(LINE_SEPARATOR)
    +  lineSeparator.foreach(s => require(s.nonEmpty, s"'$LINE_SEPARATOR' cannot be an empty string."))
     }
     
     private[libsvm] object LibSVMOptions {
       val NUM_FEATURES = "numFeatures"
       val VECTOR_TYPE = "vectorType"
       val DENSE_VECTOR_TYPE = "dense"
       val SPARSE_VECTOR_TYPE = "sparse"
    +  val LINE_SEPARATOR = "lineSep"
    --- End diff --
    
    Please use the full name.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [WIP][SPARK-21289][SQL][ML] Supports custom line separat...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #79441 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79441/testReport)** for PR 18581 at commit [`a5410e5`](https://github.com/apache/spark/commit/a5410e52f71cae83025724e70791c6a7d4277432).
     * This patch **fails due to an unknown error code, -9**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [WIP][SPARK-21289][SQL][ML] Supports custom line separat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79442/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [WIP][SPARK-21289][SQL][ML] Supports custom line separat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79440/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Will clean up soon.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by maropu <gi...@git.apache.org>.
Github user maropu commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Looks good to support an user-specified separator for CSV. As you suggested in the JIRA, I also feel we better file a JIRA for deprecate `encoding` supports in CSV and start to discuss there.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81165 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81165/testReport)** for PR 18581 at commit [`cbed415`](https://github.com/apache/spark/commit/cbed41534ff7a6a7219542ec282fcee4bdf67a67).
     * This patch **fails to build**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r126453938
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/source/libsvm/LibSVMOptions.scala ---
    @@ -41,11 +41,15 @@ private[libsvm] class LibSVMOptions(@transient private val parameters: CaseInsen
         case o => throw new IllegalArgumentException(s"Invalid value `$o` for parameter " +
           s"`$VECTOR_TYPE`. Expected types are `sparse` and `dense`.")
       }
    +
    +  val lineSeparator: Option[String] = parameters.get(LINE_SEPARATOR)
    --- End diff --
    
    Yea, actually in case of Univocity, it requires 2 characters:
    
    ```
    CsvWriterSettings settings = new CsvWriterSettings();
    settings.getFormat().setLineSeparator("aaa");
    ```
    
    ```
    Exception in thread "main" java.lang.IllegalArgumentException: Invalid line separator. Up to 2 characters are expected. Got 3 characters.
    	at com.univocity.parsers.common.Format.setLineSeparator(Format.java:121)
    	at com.univocity.parsers.common.Format.setLineSeparator(Format.java:109)
    ```
    
    I don't see a reason to restrict this for now. At least, I can provide an usecase with Windows -`\r\n`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #79441 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79441/testReport)** for PR 18581 at commit [`a5410e5`](https://github.com/apache/spark/commit/a5410e52f71cae83025724e70791c6a7d4277432).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    **[Test build #81059 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/81059/testReport)** for PR 18581 at commit [`3555e5d`](https://github.com/apache/spark/commit/3555e5dafa85dcee404599c78b17cbb97b1709f0).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18581: [SPARK-21289][SQL][ML] Supports custom line separ...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18581#discussion_r135403070
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala ---
    @@ -32,7 +32,9 @@ import org.apache.hadoop.mapreduce.task.TaskAttemptContextImpl
      * in that file.
      */
     class HadoopFileLinesReader(
    -    file: PartitionedFile, conf: Configuration) extends Iterator[Text] with Closeable {
    +    file: PartitionedFile,
    +    lineSeparator: Option[String],
    --- End diff --
    
    **\n = LF:**    
    > Multics, Unix and Unix-like systems (Linux, macOS, FreeBSD, AIX, Xenix, etc.), BeOS, Amiga, RISC OS, and others[1]
    
    **\r\n CR+LF:** 
    > Microsoft Windows, DOS (MS-DOS, PC DOS, etc.), DEC TOPS-10, RT-11, CP/M, MP/M, Atari TOS, OS/2, Symbian OS, Palm OS, Amstrad CPC, and most other early non-Unix and non-IBM operating systems
    
    **\r = CR:**    
    > Commodore 8-bit machines, Acorn BBC, ZX Spectrum, TRS-80, Apple II family, Oberon, the classic Mac OS, MIT Lisp Machine and OS-9


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [WIP][SPARK-21289][SQL][ML] Supports custom line separat...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79441/
    Test FAILed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18581: [SPARK-21289][SQL][ML] Supports custom line separator fo...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18581
  
    Sure, will try to separate this. Will update my PRs soon roughly within this week.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org