本文整理汇总了Scala中org.apache.spark.sql.execution.SQLExecution类的典型用法代码示例。如果您正苦于以下问题:Scala SQLExecution类的具体用法?Scala SQLExecution怎么用?Scala SQLExecution使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SQLExecution类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: KarpsStubs
//设置package包名称以及导入依赖的类
package org.apache.spark.sql
import org.apache.spark.SparkContext
import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder
import org.apache.spark.sql.catalyst.expressions.Expression
import org.apache.spark.sql.execution.{QueryExecution, SQLExecution}
object KarpsStubs {
def withExecutionId[T](sc: SparkContext, executionId: String)(body: => T): T= {
SQLExecution.withExecutionId(sc, executionId)(body)
}
def withNewExecutionId[T](
sparkSession: SparkSession,
queryExecution: QueryExecution)(body: => T): T = {
SQLExecution.withNewExecutionId(sparkSession, queryExecution)(body)
}
def getBoundEncoder(df: DataFrame): ExpressionEncoder[Row] = {
df.exprEnc.resolveAndBind(df.logicalPlan.output,
df.sparkSession.sessionState.analyzer)
}
def getExpression(c: Column): Expression = c.expr
def makeColumn(exp: Expression): Column = Column.apply(exp)
}