@@ -37,6 +37,8 @@ public class TestSelect extends SparkCatalogTestBase {
3737 private int scanEventCount = 0 ;
3838 private ScanEvent lastScanEvent = null ;
3939
40+ private final String binaryTableName = tableName ("binary_table" );
41+
4042 public TestSelect (String catalogName , String implementation , Map <String , String > config ) {
4143 super (catalogName , implementation , config );
4244
@@ -49,8 +51,11 @@ public TestSelect(String catalogName, String implementation, Map<String, String>
4951
5052 @ Before
5153 public void createTables () {
52- sql ("CREATE TABLE %s (id bigint, data string, float float, binary binary) USING iceberg" , tableName );
53- sql ("INSERT INTO %s VALUES (1, 'a', 1.0, X''), (2, 'b', 2.0, X'11'), (3, 'c', float('NaN'), X'1111')" , tableName );
54+ sql ("CREATE TABLE %s (id bigint, data string, float float) USING iceberg" , tableName );
55+ sql ("INSERT INTO %s VALUES (1, 'a', 1.0), (2, 'b', 2.0), (3, 'c', float('NaN'))" , tableName );
56+
57+ sql ("CREATE TABLE %s (id bigint, binary binary) USING iceberg" , binaryTableName );
58+ sql ("INSERT INTO %s VALUES (1, X''), (2, X'11'), (3, X'1111')" , binaryTableName );
5459
5560 this .scanEventCount = 0 ;
5661 this .lastScanEvent = null ;
@@ -59,21 +64,20 @@ public void createTables() {
5964 @ After
6065 public void removeTables () {
6166 sql ("DROP TABLE IF EXISTS %s" , tableName );
67+ sql ("DROP TABLE IF EXISTS %s" , binaryTableName );
6268 }
6369
6470 @ Test
6571 public void testSelect () {
6672 List <Object []> expected = ImmutableList .of (
67- row (1L , "a" , 1.0F , new byte []{}),
68- row (2L , "b" , 2.0F , new byte []{0x11 }),
69- row (3L , "c" , Float .NaN , new byte []{0x11 , 0x11 }));
73+ row (1L , "a" , 1.0F ), row (2L , "b" , 2.0F ), row (3L , "c" , Float .NaN ));
7074
7175 assertEquals ("Should return all expected rows" , expected , sql ("SELECT * FROM %s" , tableName ));
7276 }
7377
7478 @ Test
7579 public void testSelectRewrite () {
76- List <Object []> expected = ImmutableList .of (row (3L , "c" , Float .NaN , new byte []{ 0x11 , 0x11 } ));
80+ List <Object []> expected = ImmutableList .of (row (3L , "c" , Float .NaN ));
7781
7882 assertEquals ("Should return all expected rows" , expected ,
7983 sql ("SELECT * FROM %s where float = float('NaN')" , tableName ));
@@ -125,9 +129,9 @@ public void testMetadataTables() {
125129
126130 @ Test
127131 public void testFilterBinary () {
128- List <Object []> expected = ImmutableList .of (row (3L , "c" , Float . NaN , new byte []{0x11 , 0x11 }));
132+ List <Object []> expected = ImmutableList .of (row (3L , new Byte []{0x11 , 0x11 }));
129133
130134 assertEquals ("Should return all expected rows" , expected ,
131- sql ("SELECT * FROM %s where binary > X'1101'" , tableName ));
135+ sql ("SELECT * FROM %s where binary > X'1101'" , binaryTableName ));
132136 }
133137}
0 commit comments