Dataset schema

/**
   * Returns the schema of this Dataset.
   *
   * @group basic
   * @since 1.6.0
   */
  def schema: StructType = queryExecution.analyzed.schema

QueryExecution.scala

lazy val analyzed: LogicalPlan = {
    SparkSession.setActiveSession(sparkSession)
    sparkSession.sessionState.analyzer.executeAndCheck(logical)
  }

QueryPlan.scala

lazy val schema: StructType = StructType.fromAttributes(output)

猜你喜欢

转载自blog.csdn.net/zhixingheyi_tian/article/details/84786964
今日推荐