@@ -59,6 +59,12 @@ def test_select(self, dict_cursor):
5959 )
6060 ret = dict_cursor .fetchall ()
6161 assert len (ret ) == 2
62+ assert ret [1 ]["col_nested_map" ] == {
63+ "name" : "test case 3" ,
64+ "version" : 1.0 ,
65+ "list" : ["Hello" , "World" , {1 , 2 , 3 }, {"1" , "2" }, 2 ],
66+ "map" : {"str" : "Best" , "num" : 1 , "chinese" : "你好" },
67+ }
6268
6369 dict_cursor .execute (
6470 "SELECT col_ss, col_nested_list[4] FROM %s WHERE key_partition='row_1'"
@@ -68,3 +74,23 @@ def test_select(self, dict_cursor):
6874 assert len (ret ) == 2
6975 assert ret [0 ] == {"col_ss" : {"A" , "B" , "C" }}
7076 assert ret [1 ] == {"col_nested_list[4]" : {1 , 2 , 3 }}
77+
78+ def test_select_with_alias (self , dict_cursor ):
79+ dict_cursor .execute (
80+ "SELECT col_ns a, col_nested_map.version b FROM %s WHERE key_partition='row_1'"
81+ % TESTCASE05_TABLE
82+ )
83+ ret = dict_cursor .fetchall ()
84+ assert len (ret ) == 2
85+ assert ret [0 ] == {"a" : {1 , 2 , 3.3 , 4.0 }}
86+ assert ret [1 ] == {"b" : 1.0 }
87+
88+ def test_select_with_function (self , dict_cursor ):
89+ dict_cursor .execute (
90+ "SELECT SUBSTR(col_str, 0, 4) str, UPPER(col_nested_map.name) name FROM %s WHERE key_partition='row_1'"
91+ % TESTCASE05_TABLE
92+ )
93+ ret = dict_cursor .fetchall ()
94+ assert len (ret ) == 2
95+ assert ret [0 ] == {"str" : "test" }
96+ assert ret [1 ] == {"name" : "TEST CASE 3" }
0 commit comments