Skip to content

Commit

Permalink
add check the rows count
Browse files Browse the repository at this point in the history
  • Loading branch information
lamberken committed May 28, 2019
1 parent d7b794f commit 5420e64
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,20 @@ object DirectSQLExample {
import carbonSession._
// 1. generate data file
cleanTestData(path)
buildTestData(path, 20, sparkSession = carbonSession)

val rows = 20;
buildTestData(path, rows, sparkSession = carbonSession)
val readPath = path

println("Running SQL on carbon files directly")
try {
// 2. run queries directly, no need to create table first
sql(s"""select * FROM carbon.`$readPath` limit 10""".stripMargin).show()

// 3. check rows count
val counts = sql(s"""select * FROM carbon.`$readPath`""".stripMargin).count()
assert(rows == counts)

} catch {
case e: Exception => throw e
} finally {
Expand Down

0 comments on commit 5420e64

Please sign in to comment.