Skip to content

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

Closed

Description

@mnloveyx

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'

Activity

  1. changed the title [-]doris can't get Decimals precision use com.mysql.jdbc.JDBC42 but mysql can get it [/-] [+]doris can't get Decimals precision use java.sql.PreparedStatement com.mysql.jdbc.JDBC42 but mysql can get it [/+] on Jul 7, 2020
  2. added
    kind/fixCategorizes issue or PR as related to a bug.
    on Jul 13, 2020
  3. yangzhg commented on Jul 14, 2020

    @yangzhg
    Member

    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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stalekind/fixCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions