我有一个spark.sql对象,其中包含几个变量。
import com.github.nscala_time.time.Imports.LocalDate
val first_date = new LocalDate(2020, 4, 1)
val second_date = new LocalDate(2020, 4, 7)
val mydf = spark.sql(s"""
select *
from tempView
where timestamp between '{0}' and '{1}'
""".format(start_date.toString, end_date.toString))
I want to print out mydf
because I ran mydf.count
and got 0 as the outcome.
I ran mydf
and got back mydf: org.apache.spark.sql.DataFrame = [column: type]
I also tried println(mydf)
and it didn't return the query.
There is this related question, but it does not have the answer.
如何打印查询?