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

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

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0, 2.2.0
    • Fix Version/s: 2.3.0
    • Component/s: Structured Streaming
    • Labels:
      None
    • Environment:

      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

            • Assignee:
              hyukjin.kwon Hyukjin Kwon
              Reporter:
              Robin Shao Fei Shao
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: