[
https://issues.apache.org/jira/browse/IMPALA-13256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17869056#comment-17869056
]
Wenzhe Zhou commented on IMPALA-13256:
--------------------------------------
Interface org.apache.impala.extdatasource.jdbc.dao.DatabaseAccessor is ported
from Hive JDBC storage handler. The function
[getTotalNumberOfRecords()|https://github.com/apache/impala/blob/master/fe/src/main/java/org/apache/impala/extdatasource/jdbc/dao/DatabaseAccessor.java#L27C7-L27C30]
is defined with return data type as int. We need to change the return data
type to long.
Implementation
[GenericJdbcDatabaseAccessor.getTotalNumberOfRecords()|https://github.com/apache/impala/blob/master/fe/src/main/java/org/apache/impala/extdatasource/jdbc/dao/GenericJdbcDatabaseAccessor.java#L74-L106]
is need to be changed to return number of rows as long data type.
[JdbcDataSource.totalNumberOfRecords_|https://github.com/apache/impala/blob/master/fe/src/main/java/org/apache/impala/extdatasource/jdbc/JdbcDataSource.java#L96-L97]
is already defined as long.
> SQLDataException in external JDBC table query request
> -----------------------------------------------------
>
> Key: IMPALA-13256
> URL: https://issues.apache.org/jira/browse/IMPALA-13256
> Project: IMPALA
> Issue Type: Sub-task
> Reporter: YifanZhang
> Assignee: Pranav Yogi Lodha
> Priority: Major
>
> Logs from impala coordinator node:
> {code}
> I0726 21:15:51.142773 3202116 GenericJdbcDatabaseAccessor.java:86]
> b34bb1ec996a2df9:a00f489200000000] Query to execute is [SELECT COUNT(*) FROM
> (SELECT * FROM test_table) tmptable]
> E0726 21:15:51.287364 3202116 GenericJdbcDatabaseAccessor.java:101]
> b34bb1ec996a2df9:a00f489200000000] Caught exception while trying to get the
> number of records
> Java exception follows:
> java.sql.SQLDataException: Value '3379400792' is outside of valid range for
> type java.lang.Integer
> at
> com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:114)
> at
> com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
> at
> com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
> at
> com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
> at
> com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
> at
> com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:92)
> at
> com.mysql.cj.jdbc.result.ResultSetImpl.getObject(ResultSetImpl.java:1431)
> at com.mysql.cj.jdbc.result.ResultSetImpl.getInt(ResultSetImpl.java:830)
> at
> org.apache.commons.dbcp2.DelegatingResultSet.getInt(DelegatingResultSet.java:623)
> at
> org.apache.commons.dbcp2.DelegatingResultSet.getInt(DelegatingResultSet.java:623)
> at
> org.apache.impala.extdatasource.jdbc.dao.GenericJdbcDatabaseAccessor.getTotalNumberOfRecords(GenericJdbcDatabaseAccessor.java:92)
> at
> org.apache.impala.extdatasource.jdbc.JdbcDataSource.buildQueryAndExecute(JdbcDataSource.java:335)
> at
> org.apache.impala.extdatasource.jdbc.JdbcDataSource.open(JdbcDataSource.java:157)
> at
> org.apache.impala.extdatasource.ExternalDataSourceExecutor.open(ExternalDataSourceExecutor.java:274)
> at
> org.apache.impala.extdatasource.ExternalDataSourceExecutor.open(ExternalDataSourceExecutor.java:217)
> Caused by: com.mysql.cj.exceptions.NumberOutOfRange: Value '3379400792' is
> outside of valid range for type java.lang.Integer
> at
> com.mysql.cj.result.IntegerValueFactory.createFromLong(IntegerValueFactory.java:62)
> at
> com.mysql.cj.result.IntegerValueFactory.createFromLong(IntegerValueFactory.java:44)
> at
> com.mysql.cj.protocol.a.MysqlTextValueDecoder.decodeInt8(MysqlTextValueDecoder.java:126)
> at
> com.mysql.cj.protocol.result.AbstractResultsetRow.decodeAndCreateReturnValue(AbstractResultsetRow.java:113)
> at
> com.mysql.cj.protocol.result.AbstractResultsetRow.getValueFromBytes(AbstractResultsetRow.java:243)
> at
> com.mysql.cj.protocol.a.result.ByteArrayRow.getValue(ByteArrayRow.java:91)
> at
> com.mysql.cj.jdbc.result.ResultSetImpl.getObject(ResultSetImpl.java:1324)
> ... 8 more {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]