[
https://issues.apache.org/jira/browse/PHOENIX-2314?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15798821#comment-15798821
]
James Taylor commented on PHOENIX-2314:
---------------------------------------
The code change in ExpressionCompiler is fine, but the test isn't testing the
code path you changed (the test passes without your change to
ExpressionCompiler). You'd need to bind the parameter to null and you'd expect
to get no rows back in that case. Also, you can't make the methods in the IT
class static as then we wouldn't be able to run the methods in parallel:
{code}
public class LikeExpressionIT extends ParallelStatsDisabledIT {
- private String tableName;
+ private static String tableName;
- @Before
- public void initTable() throws Exception {
+ @BeforeClass
+ public static void initTable() throws Exception {
tableName = generateUniqueName();
Connection conn = null;
PreparedStatement stmt = null;
@@ -58,7 +59,7 @@ public class LikeExpressionIT extends ParallelStatsDisabledIT
{
insertRow(conn, "321n7-App-2-", 32);
}
- private void insertRow(Connection conn, String k, int i) throws
SQLException {
+ private static void insertRow(Connection conn, String k, int i) throws
SQLException {
PreparedStatement stmt = conn.prepareStatement(
"UPSERT INTO " + tableName + " VALUES (?, ?)");
stmt.setString(1, k);
{code}
I'm not convinced this is testing the actual issue, though. You should add a
similar test with a parameterized LIKE query in QueryServerBasicsIT (but with
the parameter bound as with your current test).
> Cannot prepare parameterized statement with a 'like' predicate
> --------------------------------------------------------------
>
> Key: PHOENIX-2314
> URL: https://issues.apache.org/jira/browse/PHOENIX-2314
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.5.2
> Environment: Using Fiddler or cURL to communicate with a Phoenix
> 4.5.2 queryserver using Avatica wire protocol
> Reporter: Kevin Liew
> Assignee: Kevin Liew
> Labels: avatica, phoenix
> Fix For: 4.10.0, 4.8.3
>
> Attachments: PHOENIX-2314.patch
>
>
> *POST*
> {noformat}
> request: { "request":"prepare",
> "connectionId":"1646a1b9-334e-4a21-ade8-47c3d0c8e5a3", "sql":"select * from
> emp where first_name like ?", "maxRowCount":-1 }
> Host: 192.168.203.156:8765
> Content-Length: 0
> {noformat}
> _select * from emp where first_name like ?_
> *RESPONSE*
> {noformat}
> HTTP/1.1 500 org.apache.phoenix.schema.TypeMismatchException: ERROR 203
> (22005): Type mismatch. BOOLEAN for null
> Date: Wed, 07 Oct 2015 22:42:26 GMT
> Cache-Control: must-revalidate,no-cache,no-store
> Content-Type: text/html; charset=ISO-8859-1
> Content-Length: 368
> Connection: close
> Server: Jetty(9.2.z-SNAPSHOT)
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
> <title>Error 500 </title>
> </head>
> <body>
> <h2>HTTP ERROR: 500</h2>
> <p>Problem accessing /. Reason:
> <pre> org.apache.phoenix.schema.TypeMismatchException: ERROR 203 (22005):
> Type mismatch. BOOLEAN for null</pre></p>
> <hr /><i><small>Powered by Jetty://</small></i>
> </body>
> </html>
> {noformat}
> _org.apache.phoenix.schema.TypeMismatchException: ERROR 203 (22005): Type
> mismatch. BOOLEAN for null_
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)