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

the schema of socket/rate source can not be set.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.1.0, 2.2.0
    • 2.3.0
    • Structured Streaming
    • None
    • Win7,spark 2.1.0

    Description

      The schema set for DataStreamReader can not work. The code is shown as below:
      val line = ss.readStream.format("socket")
      .option("ip",xxx)
      .option("port",xxx)
      .schema( StructField("name",StringType)::StructField("area",StringType)::Nil)
      .load
      line.printSchema

      The printSchema prints:
      root

      --value:String(nullable=true)

      According to the code, it should print the schema set by schema().

      Suggestion from Michael Armbrust:
      throw an exception saying that you can't set schema here.

      Attachments

        Activity

          People

            gurwls223 Hyukjin Kwon
            Robin Shao Fei Shao
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: