You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Sumanta Gh <su...@tcs.com> on 2014/03/31 14:40:39 UTC

Exception during executing query on dynamic column using JDBC

Hi 
When I run this query [1] from sqlline, it works fine.
But using JDBC prepared statements, I get following error [2].
The column "speed" is a dynamic column and I want to filter rows based on 
it's value.

[1] SELECT * FROM test ("speed" DECIMAL) WHERE "speed" < 90;
[2] Caused by: org.springframework.dao.DataIntegrityViolationException: 
PreparedStatementCallback; SQL [SELECT * FROM test("speed" DECIMAL) WHERE 
"speed"<? ]; ERROR 203 (22005): Type mismatch. DECIMAL and CHAR for 
com.salesforce.phoenix.parse.LessThanParseNode[speed, :1]; nested 
exception is com.salesforce.phoenix.schema.TypeMismatchException: ERROR 
203 (22005): Type mismatch. DECIMAL and CHAR for 
com.salesforce.phoenix.parse.LessThanParseNode[speed, :1]
        at 
org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(
SQLStateSQLExceptionTranslator.java:100)
        at 
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(
AbstractFallbackSQLExceptionTranslator.java:73)
        at 
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(
AbstractFallbackSQLExceptionTranslator.java:81)
        at 
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(
AbstractFallbackSQLExceptionTranslator.java:81)
        at org.springframework.jdbc.core.JdbcTemplate.execute(
JdbcTemplate.java:658)
        at org.springframework.jdbc.core.JdbcTemplate.query(
JdbcTemplate.java:693)
        at org.springframework.jdbc.core.JdbcTemplate.query(
JdbcTemplate.java:725)
        at org.springframework.jdbc.core.JdbcTemplate.query(
JdbcTemplate.java:735)
        at org.springframework.jdbc.core.JdbcTemplate.query(
JdbcTemplate.java:785)
        at com.ripsac.sos.dao.hbase.impl.ObservationDAOHbaseImpl.findAll(
ObservationDAOHbaseImpl.java:72)
        ... 28 more
Caused by: com.salesforce.phoenix.schema.TypeMismatchException: ERROR 203 
(22005): Type mismatch. DECIMAL and CHAR for 
com.salesforce.phoenix.parse.LessThanParseNode[speed, :1]
        at 
com.salesforce.phoenix.compile.ExpressionCompiler.checkComparability(
ExpressionCompiler.java:156)
        at 
com.salesforce.phoenix.compile.ExpressionCompiler.checkComparability(
ExpressionCompiler.java:190)
        at com.salesforce.phoenix.compile.ExpressionCompiler.visitLeave(
ExpressionCompiler.java:204)

Regards
Sumanta Ghosh
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



Re: Exception during executing query on dynamic column using JDBC

Posted by Sumanta Gh <su...@tcs.com>.
If I use normal SQL statements instead of prepared statements, the JDBC 
code works. 

Regards
Sumanta Ghosh




From:
Sumanta Gh <su...@tcs.com>
To:
user@phoenix.incubator.apache.org
Date:
31-03-2014 18:11
Subject:
Exception during executing query on dynamic column using JDBC



Hi 
When I run this query [1] from sqlline, it works fine. 
But using JDBC prepared statements, I get following error [2]. 
The column "speed" is a dynamic column and I want to filter rows based on 
it's value. 

[1] SELECT * FROM test ("speed" DECIMAL) WHERE "speed" < 90; 
[2] Caused by: org.springframework.dao.DataIntegrityViolationException: 
PreparedStatementCallback; SQL [SELECT * FROM test("speed" DECIMAL) WHERE 
"speed"<? ]; ERROR 203 (22005): Type mismatch. DECIMAL and CHAR for 
com.salesforce.phoenix.parse.LessThanParseNode[speed, :1]; nested 
exception is com.salesforce.phoenix.schema.TypeMismatchException: ERROR 
203 (22005): Type mismatch. DECIMAL and CHAR for 
com.salesforce.phoenix.parse.LessThanParseNode[speed, :1] 
        at 
org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(
SQLStateSQLExceptionTranslator.java:100) 
        at 
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(
AbstractFallbackSQLExceptionTranslator.java:73) 
        at 
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(
AbstractFallbackSQLExceptionTranslator.java:81) 
        at 
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(
AbstractFallbackSQLExceptionTranslator.java:81) 
        at org.springframework.jdbc.core.JdbcTemplate.execute(
JdbcTemplate.java:658) 
        at org.springframework.jdbc.core.JdbcTemplate.query(
JdbcTemplate.java:693) 
        at org.springframework.jdbc.core.JdbcTemplate.query(
JdbcTemplate.java:725) 
        at org.springframework.jdbc.core.JdbcTemplate.query(
JdbcTemplate.java:735) 
        at org.springframework.jdbc.core.JdbcTemplate.query(
JdbcTemplate.java:785) 
        at com.ripsac.sos.dao.hbase.impl.ObservationDAOHbaseImpl.findAll(
ObservationDAOHbaseImpl.java:72) 
        ... 28 more 
Caused by: com.salesforce.phoenix.schema.TypeMismatchException: ERROR 203 
(22005): Type mismatch. DECIMAL and CHAR for 
com.salesforce.phoenix.parse.LessThanParseNode[speed, :1] 
        at 
com.salesforce.phoenix.compile.ExpressionCompiler.checkComparability(
ExpressionCompiler.java:156) 
        at 
com.salesforce.phoenix.compile.ExpressionCompiler.checkComparability(
ExpressionCompiler.java:190) 
        at com.salesforce.phoenix.compile.ExpressionCompiler.visitLeave(
ExpressionCompiler.java:204) 

Regards
Sumanta Ghosh
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you