[ 
https://issues.apache.org/jira/browse/PHOENIX-1273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14146557#comment-14146557
 ] 

James Taylor commented on PHOENIX-1273:
---------------------------------------

This looks good, JM. The only thing I'd add is one more test where the pattern 
is retrieved from a column, like this. Tweak your UPSERT statement in your test 
to add a dynamic column PATTERN and set the value to a valid pattern to use in 
ILIKE.
{code}
+        // Insert all rows at ts
+        String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ ts;
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn = DriverManager.getConnection(url, props);
+        // Add dynamic column for pattern to use in test below
+        PreparedStatement stmt = conn.prepareStatement("upsert into 
PTSDB(INST,HOST,DATE,VALUE,PATTERN VARCHAR) VALUES (?, ?, ?, 0.5, 'xy_a%')");
{code}

Use your dynamic column to get the pattern. Note that this could just as well 
have been done with one of the statically defined columns.
{code}
+        stmt.setDate(3, D1);
+            // Test 6
+            statement = conn.prepareStatement("SELECT INST FROM PTSDB(PATTERN 
VARCHAR) WHERE INST ILIKE PATTERN");
+            rs = statement.executeQuery();
+
+            assertTrue(rs.next());
+            assertEquals("xyza", rs.getString(1));
+
+            assertTrue(rs.next());
+            assertEquals("xyzab", rs.getString(1));
+
+            assertFalse(rs.next());
+
{code}

> Phoenix should provide ILIKE keyword
> ------------------------------------
>
>                 Key: PHOENIX-1273
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1273
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.2
>            Reporter: Jean-Marc Spaggiari
>            Assignee: Jean-Marc Spaggiari
>            Priority: Minor
>         Attachments: PHOENIX-1273-v1.patch, PHOENIX-1273-v2.patch, 
> PHOENIX-1273-v3.patch, PHOENIX-1273-v4.patch, PHOENIX-1273.patch
>
>
> Phoenix provides LIKE keyword but not ILIKE which is a case insensitive LIKE. 
> Goal of this patch is to add this keyword.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to