Github user codlife commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15511#discussion_r83616031
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala ---
    @@ -240,16 +240,35 @@ class DataFrameReader private[sql](sparkSession: 
SparkSession) extends Logging {
     
       /**
        * Loads a JSON file (one object per line) and returns the result as a 
[[DataFrame]].
    +   * With param isStandard we can load multi-lines json object directly.
        * See the documentation on the overloaded `json()` method with varargs 
for more details.
        *
        * @since 1.4.0
        */
    -  def json(path: String): DataFrame = {
    +
    +  def json(path: String, isStandard: Boolean = false ): DataFrame = {
         // This method ensures that calls that explicit need single argument 
works, see SPARK-16009
    -    json(Seq(path): _*)
    +    if (!isStandard) {
    +      json(Seq(path): _*)
    +    } else {
    +      val jsonRDD = sparkSession.sparkContext.wholeTextFiles(path)
    +        .map(line => line.toString().replaceAll("\\s+", ""))
    +        .map { jsonLine =>
    +          val index = jsonLine.indexOf(",")
    --- End diff --
    
    maybe this code is bad, I just want to get the json contents
    such as: ("filename",json_contents)


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to