[jira] [Commented] (CALCITE-1052) Phoenix queryserver sends result set in response to the wrong request when there are concurrent requests

2016-01-20 Thread Kevin Liew (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-1052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15109047#comment-15109047
 ] 

Kevin Liew commented on CALCITE-1052:
-

We upgraded our test servers to Phoenix 4.7.0 on Calcite 1.5 and we can no 
longer reproduce this bug using the 4.7.0 thin client, though we will have to 
upgrade our driver to use the latest Avatica protocol. Thanks

> Phoenix queryserver sends result set in response to the wrong request when 
> there are concurrent requests
> 
>
> Key: CALCITE-1052
> URL: https://issues.apache.org/jira/browse/CALCITE-1052
> Project: Calcite
>  Issue Type: Bug
>  Components: avatica
>Reporter: Kevin Liew
>Assignee: Josh Elser
>Priority: Critical
>  Labels: phoenix, queryserver
> Attachments: phoenix-root-server.log, test.zip
>
>
> Create two tables
> {code:sql}
> DROP TABLE IF EXISTS SEN.VARCHAR_TABLE;
> CREATE TABLE IF NOT EXISTS SEN.VARCHAR_TABLE(
>   KeyColumn VARCHAR(255) PRIMARY KEY,
>   Column1 VARCHAR(510));
> UPSERT INTO SEN.VARCHAR_TABLE VALUES ('One','1');
> {code}
> {code:sql}
> DROP TABLE IF EXISTS SEN.INTEGER_TABLE;
> CREATE TABLE IF NOT EXISTS SEN.INTEGER_TABLE(
>   KeyColumn VARCHAR(255) PRIMARY KEY,
>   Column1 INTEGER);
> UPSERT INTO SEN.INTEGER_TABLE VALUES ('Two',2);
> {code}
> Running these two programs results in several crashes. 
> 1. select a varchar by parameterized statement resulting in
> SELECT Column1 FROM SEN.VARCHAR_TABLE WHERE KeyColumn = 'One'
> {code:java}
> import java.sql.Connection;
> import java.sql.DriverManager;
> import java.sql.ResultSet;
> import java.sql.SQLException;
> import java.sql.PreparedStatement;
> import java.sql.Statement;
> public class Hello_World {
>   public static void main(String[] args) throws SQLException {
>   try {
> Class.forName("org.apache.phoenix.queryserver.client.Driver");
> } catch (ClassNotFoundException e) {
> System.out.println("Where is your PhoenixDriver");
> e.printStackTrace();
> return;
> }
>   Connection conn = 
> DriverManager.getConnection("jdbc:phoenix:thin:url=http://192.168.222.52:8765;);
>   conn.setAutoCommit(true);
>   String sqlStmt = "SELECT Column1 FROM SEN.VARCHAR_TABLE WHERE 
> KeyColumn = ?";
>   System.out.println("SQL Statement:\n\t" + sqlStmt);
>   
>   while(true)
>   {
>   ResultSet rset = null;
>   
>   //Statement stmt = conn.createStatement();
>   PreparedStatement stmt = conn.prepareStatement(sqlStmt);
>   stmt.setString(1, "One");
>   ResultSet rs = stmt.executeQuery();
>   
>   while (rs.next()) {
>   String column1 = rs.getString("column1");
>   if (!column1.equals("1"))
>   {
>   System.out.println(column1);
>   }
>   }
>   }
>   
> //conn.close();
>   }
>   
> }
> {code}
> 2. select an integer by parameterized statement resulting in
> SELECT Column1 FROM SEN.INTEGER_TABLE WHERE KeyColumn = 'Two'
> {code:java}
> import java.sql.Connection;
> import java.sql.DriverManager;
> import java.sql.ResultSet;
> import java.sql.SQLException;
> import java.sql.PreparedStatement;
> import java.sql.Statement;
> public class Hello_World {
>   public static void main(String[] args) throws SQLException {
>   try {
> Class.forName("org.apache.phoenix.queryserver.client.Driver");
> } catch (ClassNotFoundException e) {
> System.out.println("Where is your PhoenixDriver");
> e.printStackTrace();
> return;
> }
>   Connection conn = 
> DriverManager.getConnection("jdbc:phoenix:thin:url=http://192.168.222.52:8765;);
>   conn.setAutoCommit(true);
>   
>   String sqlStmt = "SELECT Column1 FROM SEN.INTEGER_TABLE WHERE 
> KeyColumn = ?";
>   System.out.println("SQL Statement:\n\t" + sqlStmt);
>   
>   while(true)
>   {
>   ResultSet rset = null;
>   
>   //Statement stmt = conn.createStatement();
>   PreparedStatement stmt = conn.prepareStatement(sqlStmt);
>   stmt.setString(1, "Two");
>   ResultSet rs = stmt.executeQuery();
>   
>   while (rs.next()) {
>   int column1 = rs.getInt("column1");
>   

[jira] [Created] (CALCITE-1062) Allowing SqlOperator to be overridden in validation

2016-01-20 Thread Sean Hsuan-Yi Chu (JIRA)
Sean Hsuan-Yi Chu created CALCITE-1062:
--

 Summary: Allowing SqlOperator to be overridden in validation
 Key: CALCITE-1062
 URL: https://issues.apache.org/jira/browse/CALCITE-1062
 Project: Calcite
  Issue Type: Improvement
  Components: core
Reporter: Sean Hsuan-Yi Chu
Assignee: Sean Hsuan-Yi Chu


Calcite allows function to be overridden at validation step. To be more 
specific, users can provide their SqlOperatorTable, and, at validation step, 
their SqlOperatorTable will be called (method: lookupOperatorOverloads) to get 
a overriding function.  However, so far, SqlOperator (e.g., +, - , *, etc.) 
does not have this mechanism yet. 

Since other systems (e.g., Apache Drill) would have more flexible type-checks 
for SqlOperator's operands, this mechanism is necessary for those systems to 
pass through the validation step.



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