Yaqiong created HIVE-11753: ------------------------------ Summary: DatabaseMetadata.getColumn returns precision 0 for varchar/decimal Key: HIVE-11753 URL: https://issues.apache.org/jira/browse/HIVE-11753 Project: Hive Issue Type: Bug Components: JDBC Affects Versions: 0.14.0 Reporter: Yaqiong
I hit same error as HIVE-5847 and HIVE-10933. JDBC version is hive-jdbc-0.14.0.2.2.4.2-2-standalone.jar. My test program as below: /*************************************** test.java **********************************************/ import java.sql.SQLException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.sql.DriverManager; import java.lang.*; import java.sql.DatabaseMetaData; import java.sql.ResultSetMetaData; public class test { private static String driverName = "org.apache.hive.jdbc.HiveDriver"; /** * @param args * @throws SQLException */ public static void main(String[] args) throws SQLException { try { Class.forName(driverName); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); System.exit(1); } //replace "hive" here with the name of the user the queries should run as Connection con = DriverManager.getConnection("jdbc:hive2://<hive_server_address>:10001/default", "hadoop", ""); Statement stmt = con.createStatement(); String tableName = "test"; stmt.execute("drop table if exists " + tableName); stmt.execute("create table " + tableName + " (key varchar(10)) row format delimited fields terminated by '\t'"); ResultSet res = con.getMetaData().getColumns(null, "default", "test", null); while (res.next()) { System.out.println("COLUMN_NAME: " + res.getString(4)); System.out.println("COLUMN_PRECISION: " + res.getString(7)); } } } Resutl ------------------ COLUMN_NAME: key COLUMN_PRECISION: null -- This message was sent by Atlassian JIRA (v6.3.4#6332)