Uploaded image for project: 'CDAP'
  1. CDAP
  2. CDAP-12742

Cannot read csv files through Spark SqlContext in pipeline plugins

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0.0
    • Component/s: Pipeline Plugins
    • Labels:
      None
    • Release Notes:
      Fixed an issue that caused pipeline failures if a Spark plugin tried to read or write a DataFrame using csv format.
    • Rank:
      1|i008rj:

      Description

      If you try reading csv files directly using Spark's SqlContext like:

          Dataset<Row> rawTraining = sparkSession.read()
            .format("csv")
            .schema(someSchema)
            .load("somepath");
      

      the program will fail with exception:

      java.lang.ClassCastException: cannot assign instance of org.apache.commons.lang3.time.FastDateFormat to field org.apache.spark.sql.execution.datasources.csv.CSVOptions.dateFormat of type org.apache.commons.lang3.time.FastDateFormat in instance of org.apache.spark.sql.execution.datasources.csv.CSVOptions
      	at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2133) ~[na:1.8.0_77]
      

      There is some classloading problem since commons-lang3 is in spark but also in the pipeline app through cdap-formats (grok format uses it).

        Attachments

          Activity

            People

            • Assignee:
              ashau Albert Shau
              Reporter:
              ashau Albert Shau
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: