deniskuzZ commented on code in PR #5336:
URL: https://github.com/apache/hive/pull/5336#discussion_r1703906807
##########
jdbc/src/test/org/apache/hive/jdbc/TestHiveBaseResultSet.java:
##########
@@ -240,6 +245,56 @@ public void testGetBooleanStringTrue() throws SQLException
{
Assert.assertFalse(resultSet.wasNull());
}
+ /**
+ * HIVE-28358 getClob(int) != null
+ */
+ @Test
+ public void testGetClobString() throws SQLException, IOException {
+ FieldSchema fieldSchema = new FieldSchema();
+ fieldSchema.setType("varchar(64)");
+
+ List<FieldSchema> fieldSchemas = Arrays.asList(fieldSchema);
+ TableSchema schema = new TableSchema(fieldSchemas);
+
+ HiveBaseResultSet resultSet = Mockito.mock(HiveBaseResultSet.class);
+ resultSet.row = new Object[] {"ABC"};
+
+ when(resultSet.getSchema()).thenReturn(schema);
+ when(resultSet.getString(1)).thenCallRealMethod();
+ when(resultSet.getClob(1)).thenCallRealMethod();
+ when(resultSet.wasNull()).thenCallRealMethod();
+
+ Clob clob = resultSet.getClob(1);
+ try (Reader clobReader = clob.getCharacterStream())
+ {
+ Assert.assertEquals("ABC", new
BufferedReader(clobReader).lines().collect(Collectors.joining(System.lineSeparator())));
+ }
+ Assert.assertFalse(resultSet.wasNull());
+ }
+
+ /**
+ * HIVE-28358 getClob(int) == null
+ */
+ @Test
+ public void testGetClobNull() throws SQLException {
+ FieldSchema fieldSchema = new FieldSchema();
+ fieldSchema.setType("varchar(64)");
+
+ List<FieldSchema> fieldSchemas = Arrays.asList(fieldSchema);
+ TableSchema schema = new TableSchema(fieldSchemas);
+
+ HiveBaseResultSet resultSet = Mockito.mock(HiveBaseResultSet.class);
Review Comment:
else LGTM
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]