doris icon indicating copy to clipboard operation
doris copied to clipboard

doris can't get Decimals precision use java.sql.PreparedStatement com.mysql.jdbc.JDBC42 but mysql can get it

Open mnloveyx opened this issue 6 years ago • 1 comments

PreparedStatement preparedStatement = null; try { preparedStatement = connection.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY ); preparedStatement.setMaxRows( 1 ); ResultSetMetaData rsmd = preparedStatement.getMetaData(); } catch ( Exception e ) { throw new Exception( e ); } finally { if ( preparedStatement != null ) { try { preparedStatement.close(); } catch ( SQLException e ) { } } } rsmd.getFields

doris Decimals precision can't get it use java.sql.PreparedStatement com.mysql.jdbc.JDBC42 see

image

mysql Decimals precision

image

doris create table CREATE TABLE IF NOT EXISTS test1 ( id BIGINT NOT NULL COMMENT "", need_amt DECIMAL(16,2) replace_if_not_null NULL COMMENT "" ) ENGINE=OLAP AGGREGATE KEY(id) COMMENT "OLAP" DISTRIBUTED BY HASH(id) BUCKETS 6 PROPERTIES ( "replication_num" = "3", "in_memory" = "false", "storage_format" = "DEFAULT" );

mysql create table

CREATE TABLE test1 ( id bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', need_amt decimal(16,2) DEFAULT NULL COMMENT '', PRIMARY KEY (id) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='test'

mnloveyx avatar Jul 07 '20 07:07 mnloveyx

this because of method writeField in fe/src/main/java/org/apache/doris/mysql/MysqlSerializer.java not write the length and Decimals, could you fix this for us?

yangzhg avatar Jul 14 '20 06:07 yangzhg