Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import java.util.{Set => JavaSet}
import org.apache.hadoop.hive.ql.exec.FunctionRegistry
import org.apache.hadoop.hive.ql.io.avro.{AvroContainerInputFormat, AvroContainerOutputFormat}
import org.apache.hadoop.hive.ql.metadata.Table
import org.apache.hadoop.hive.ql.parse.VariableSubstitution
import org.apache.hadoop.hive.ql.processors._
import org.apache.hadoop.hive.serde2.RegexSerDe
import org.apache.hadoop.hive.serde2.`lazy`.LazySimpleSerDe
Expand Down Expand Up @@ -153,8 +154,13 @@ class TestHiveContext(sc: SparkContext) extends HiveContext(sc) {

val describedTable = "DESCRIBE (\\w+)".r

val vs = new VariableSubstitution()

// we should substitute variables in hql to pass the text to parseSql() as a parameter.
// Hive parser need substituted text. HiveContext.sql() does this but return a DataFrame,
// while we need a logicalPlan so we cannot reuse that.
protected[hive] class HiveQLQueryExecution(hql: String)
extends this.QueryExecution(HiveQl.parseSql(hql)) {
extends this.QueryExecution(HiveQl.parseSql(vs.substitute(hiveconf, hql))) {
def hiveExec(): Seq[String] = runSqlHive(hql)
override def toString: String = hql + "\n" + super.toString
}
Expand Down