Support Questions

Find answers, ask questions, and share your expertise

impala query, parameter LowerCaseResultSetColumnName can not work

Explorer

sql1

 

select nick_name as nickName from customer where tenant_id = 29 and id in (:ids)

the column label in resultSetColumnMeta is nickName

 

 

sql2

 

select nick_name as nickName from customer where tenant_id = 29 and id in (:ids) limit 10

the column label in resultSetColumnMeta is nickname

 

 

I use NamedParameterJdbcTemplate to execute query and set LowerCaseResultSetColumnName 0!

 

 

12 REPLIES 12

Guru
Sorry, but what's the issue here? What's the error?

Explorer

column label in result set should not be lowercase while set LowerCaseResultSetColumnName to 0

Guru
Hi,

Sorry, but your question is really not clear, as you are not giving context. You should have mentioned that you are using Impala JDBC driver.

Secondly, sql1 returned lowercase "nickname", but sql2 returned with uppercase "nickName", which query you used setting LowerCaseResultSetColumnName and which one returned correct result?

Please provide more information with context around your question, otherwise it is difficult to understand what you are really after.

Cheers
Eric

Explorer

1. I use impala-jdbc

2. I set LowerCaseResultSetColumnName for all query, and the result of sql2 is correct.

 

the url setting:

spring.datasource.url=jdbc:impala://localhost:21050/cdp_prod;SocketTimeout=5;LowerCaseResultSetColumnName=0

execute sql1:

String sql = "select nick_name as nickName from customer where tenant_id = 29 and id in (:ids)";
MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource();

List<Long> ids = new ArrayList<>();
ids.add(484599978900144160l);
ids.add(484599978900144159l);

sqlParameterSource.addValue("ids", ids);
List<Map<String, Object>> customers = namedJdbcTemplate.queryForList(sql, sqlParameterSource);

execute sql2:

String sql = "select nick_name as nickName from customer where tenant_id = 29 and id in (:ids) limit 10";
MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource();

List<Long> ids = new ArrayList<>();
ids.add(484599978900144160l);
ids.add(484599978900144159l);

sqlParameterSource.addValue("ids", ids);
List<Map<String, Object>> customers = namedJdbcTemplate.queryForList(sql, sqlParameterSource);

Guru
Thanks

That's pretty clear now.

Can you confirm the version of Impala JDBC driver you are using? Have you tried the latest version to see if the behaviour is the same?

Cheers

Explorer

I am not sure. May be 

impala-jdbc:1.0.0

 

How can I get new version impala jdbc driver?

 

I can not found in maven repo

Guru
Latest driver can be found here:

https://www.cloudera.com/downloads/connectors/impala/jdbc/2-6-12.html

Suggest you to try a few different versions to see if it is bug in the earlier versions.

Thanks
Eric

Explorer

Sorry, the version of impala jdbc is 2.5.41.1061

 

I think it is not so early

Guru
What do you mean by "not so early", did you mean by "not so easy"?

You should be able to test out to confirm if it is version issue.

Cheers
Eric

Explorer

I am sorry to reply so late. I have update my impala-connector to latest 2.6.12, but the problem still exists.

 

spring.datasource.url=jdbc:impala://localhost:9012/test;SocketTimeout=300;LowerCaseResultSetColumnName=0
spring.datasource.driverClassName=com.cloudera.impala.jdbc41.Driver

 

Explorer

The parameter LowerCaseResultSetColumnName also can not work while using latest ImpalaJDBC41.jar

New Contributor

Hi 

 

Can you please try with alias names, actually this is not working without alias in Query

 

e.g.,

 

select col_a AS COL_A from SAMPLE_TABLE; 

 

this works!