Skip to content

Commit 18fb481

Browse files
committed
enable variable substitute on test framework
1 parent bf044de commit 18fb481

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/test/TestHive.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import java.util.{Set => JavaSet}
2323
import org.apache.hadoop.hive.ql.exec.FunctionRegistry
2424
import org.apache.hadoop.hive.ql.io.avro.{AvroContainerInputFormat, AvroContainerOutputFormat}
2525
import org.apache.hadoop.hive.ql.metadata.Table
26+
import org.apache.hadoop.hive.ql.parse.VariableSubstitution
2627
import org.apache.hadoop.hive.ql.processors._
2728
import org.apache.hadoop.hive.serde2.RegexSerDe
2829
import org.apache.hadoop.hive.serde2.`lazy`.LazySimpleSerDe
@@ -153,7 +154,12 @@ class TestHiveContext(sc: SparkContext) extends HiveContext(sc) {
153154

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

157+
val vs = new VariableSubstitution()
158+
156159
protected[hive] class HiveQLQueryExecution(hql: String)
160+
extends this.SubstitutedHiveQLQueryExecution(vs.substitute(hiveconf, hql))
161+
162+
protected[hive] class SubstitutedHiveQLQueryExecution(hql: String)
157163
extends this.QueryExecution(HiveQl.parseSql(hql)) {
158164
def hiveExec(): Seq[String] = runSqlHive(hql)
159165
override def toString: String = hql + "\n" + super.toString

0 commit comments

Comments
 (0)