ChinmaySKulkarni commented on a change in pull request #486: PHOENIX-5173: LIKE 
and ILIKE statements return empty result list for …
URL: https://github.com/apache/phoenix/pull/486#discussion_r276897214
 
 

 ##########
 File path: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/LikeExpressionIT.java
 ##########
 @@ -430,4 +430,26 @@ public void testParameterizedLikeExpression() throws 
Exception {
         rs = select.executeQuery();
         assertFalse(rs.next());
     }
+
+    @Test
+    public void testLikeExpression5173() throws Exception {
+
+        try (Connection conn = DriverManager.getConnection(getUrl())) {
+            conn.setAutoCommit(true);
+            String table = generateUniqueName();
+            final String createTable = "CREATE TABLE "
+                    + table + " (ID BIGINT NOT NULL PRIMARY KEY, USER_NAME 
VARCHAR(255))";
+            conn.createStatement().execute(createTable);
+            final String upsertTable = "UPSERT INTO " + table + " VALUES(1, 
'Some Name')";
+            conn.createStatement().executeUpdate(upsertTable);
+            String likeSelect = "SELECT * FROM " + table + " WHERE USER_NAME 
LIKE 'Some Name'";
+            ResultSet rs = conn.createStatement().executeQuery(likeSelect);
+            assertTrue(rs.next());
+            assertFalse(rs.next());
+            String iLikeSelect = "SELECT * FROM " + table + " WHERE USER_NAME 
ILIKE 'soMe nAme'";
+            rs = conn.createStatement().executeQuery(iLikeSelect);
+            assertTrue(rs.next());
+            assertFalse(rs.next());
 
 Review comment:
   nit: close the `ResultSet`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to