|
17 | 17 |
|
18 | 18 | package org.apache.carbondata.spark.testsuite.allqueries
|
19 | 19 |
|
| 20 | +import java.sql.Timestamp |
| 21 | + |
20 | 22 | import org.apache.spark.sql.{Row, SaveMode}
|
21 | 23 | import org.apache.spark.sql.test.util.QueryTest
|
22 | 24 | import org.scalatest.BeforeAndAfterAll
|
@@ -73,6 +75,33 @@ class AllDataTypesTestCase extends QueryTest with BeforeAndAfterAll {
|
73 | 75 | }
|
74 | 76 | }
|
75 | 77 |
|
| 78 | + test("insert data with from_unixtime(0) and query") { |
| 79 | + sql("drop table if exists time_carbon1") |
| 80 | + sql("drop table if exists time_parquet") |
| 81 | + sql("create table if not exists time_carbon1(time1 timestamp) stored as carbondata") |
| 82 | + sql("create table if not exists time_parquet(time1 timestamp) stored as parquet") |
| 83 | + sql("insert into time_carbon1 select from_unixtime(0)") |
| 84 | + sql("insert into time_parquet select from_unixtime(0)") |
| 85 | + sql("insert into time_carbon1 select from_unixtime(123456)") |
| 86 | + sql("insert into time_parquet select from_unixtime(123456)") |
| 87 | + checkAnswer(sql("select * from time_carbon1"), |
| 88 | + sql("select * from time_parquet")) |
| 89 | + sql("drop table if exists time_carbon1") |
| 90 | + sql("drop table if exists time_parquet") |
| 91 | + } |
| 92 | + |
| 93 | + test("insert data with empty/null and query") { |
| 94 | + sql("drop table if exists time_carbon2") |
| 95 | + sql("create table if not exists time_carbon2(time1 timestamp) stored as carbondata") |
| 96 | + sql("insert into time_carbon2 select null") |
| 97 | + checkAnswer(sql("select count(*) from time_carbon2"), Seq(Row(1))) |
| 98 | + checkAnswer(sql("select * from time_carbon2"), Seq(Row(null))) |
| 99 | + sql("insert into time_carbon2 select ''") |
| 100 | + checkAnswer(sql("select count(*) from time_carbon2"), Seq(Row(2))) |
| 101 | + checkAnswer(sql("select * from time_carbon2"), Seq(Row(null), Row(null))) |
| 102 | + sql("drop table if exists time_carbon2") |
| 103 | + } |
| 104 | + |
76 | 105 | // Test-24
|
77 | 106 | test("select channelsId, sum(channelsId+ 10) Total from Carbon_automation_test group by channelsId order by Total") {
|
78 | 107 | checkAnswer(
|
|
0 commit comments