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

Exception while converting RDD to DataFrame

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Invalid
    • 2.3.0
    • None
    • Java API, Spark Core, SQL
    • None
    • Important

    Description

      I tried to fetch data from MongoDB and got the following exception while converting the RDD to DF.

      -----------------Code --------------
      SparkSession spark = sparkSessionBuilder.appName("VendorProcessor")
      .config("spark.mongodb.input.uri","myMongoUrl")
      .config("spark.mongodb.output.uri","myMongoUrl")
      .getOrCreate();

      JavaSparkContext jsc = new JavaSparkContext(spark.sparkContext());
      JavaMongoRDD<Document> rdd = MongoSpark.load(jsc);
      Dataset<Row> rbkp = rdd.toDF();
      ------------------ OR ------------------------

      DataFrameReader dfr = spark.read()
      .format("com.mongodb.spark.sql")
      .option("floatAsBigDecimal", "true");
      Dataset<Row> rbkp = dfr.load();

      --------------------

       

      Attachments

        1. SparkJiraData.txt
          0.5 kB
          SHAILENDRA SHAHANE
        2. MongoSparkTest.java
          1 kB
          SHAILENDRA SHAHANE
        3. SparkMongoException.txt
          13 kB
          SHAILENDRA SHAHANE

        Activity

          People

            Unassigned Unassigned
            shahaness SHAILENDRA SHAHANE
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: