Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-17969

I think it's user unfriendly to process standard json file with DataFrame

    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.0.1
    • Fix Version/s: None
    • Component/s: SQL
    • Labels:
      None

      Description

      Currently, with DataFrame API, we can't load standard json file directly, maybe we can provide an override method to process this, the logic is as below:
      ```
      val df = spark.sparkContext.wholeTextFiles("data/test.json")
      val json_rdd = df.map( x => x.toString.replaceAll("
      s+","")).map

      { x => val index = x.indexOf(',') x.substring(index + 1, x.length - 1) }


      val json_df = spark.read.json(json_rdd)
      ```

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                codlife Jianfei Wang
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: