Skip to content
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Modify the ArrayType NULL value test
  • Loading branch information
Chandresh committed Jan 21, 2020
commit 8e257abd11fb2b21e7a3a678b5979688ae694332
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,46 @@ class ArrayTypeNULLValue extends SnappySQLJob {
/**
* Test : NULL value in Complex Type column.
*/

/**
* Test Case 1 : ArrayType Column is last column in the table.
*/
snc.sql("create schema st")
snc.sql("create table if not exists st.Student" +
"(rollno int,name String, adminDate Array<Date>) using column")
snc.sql("insert into st.Student select 1, 'ABC', null")
snc.sql("insert into st.Student select 2,'XYZ',Array('2020-01-21')")
val resultDF1 = snc.sql("select * from st.Student")
val resultSet1 = resultDF1.collectAsList()
pw.println("ResultSet1 : ")
pw.println("ResultSet1 where ArrayType column is last : ")
pw.println(resultSet1)
snc.sql("drop table st.Student")
// Place the Array Type column in between some data types.

/**
* Test Case 2 : ArrayType Column is between (say middle) the other data types in the table.
*/
snc.sql("create table if not exists st.Student" +
"(rollno int,adminDate Array<Date>,time TimeStamp, class int) using column")
snc.sql("insert into st.Student select 1,Array('2020-01-21'), current_timestamp(),5")
snc.sql("insert into st.Student select 1,null,null,6")
val resultDF2 = snc.sql("select * from st.Student")
val resultSet2 = resultDF2.collectAsList()
pw.println("ResultSet2 : ")
pw.println("ResultSet2 where ArrayType column is in middle : ")
pw.println(resultSet2)
snc.sql("drop table st.Student")

/**
* Test Case 3: ArrayType Column is the first column in the table.
*/
snc.sql("create table if not exists st.Student" +
"(Total Array<Double>,name String, rollno int) using column")
snc.sql("insert into st.Student select Array(25.6),'AAA',10")
snc.sql("insert into st.Student select null,'BBB',20")
val resultDF3 = snc.sql("select * from st.Student")
val resultSet3 = resultDF3.collectAsList()
pw.println("ResultSet3 where ArrayType column is First :")
pw.println(resultSet3)
snc.sql("drop table st.Student")
snc.sql("drop schema st")
pw.println("Inserting NULL value in ArrayType column check OK")
pw.flush()
Expand Down