[
https://issues.apache.org/jira/browse/HIVE-15519?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Bharat Viswanadham updated HIVE-15519:
--------------------------------------
Description:
Hive decimal type column precision is returning as zero, even though column has
precision set.
Example: col67 decimal(18,2) precison is returning as zero for that column.
Tried with below program.
System.out.println("Opening connection");
Class.forName("org.apache.hive.jdbc.HiveDriver");
Connection con =
DriverManager.getConnection("jdbc:hive2://x.x.x.x:10000/default");
DatabaseMetaData dbMeta = con.getMetaData();
ResultSet rs = dbMeta.getColumns(null, "DEFAULT", "data_type_test",null);
while (rs.next()) {
if (rs.getString("COLUMN_NAME").equalsIgnoreCase("col48") ||
rs.getString("COLUMN_NAME").equalsIgnoreCase("col67") ||
rs.getString("COLUMN_NAME").equalsIgnoreCase("col68") ||
rs.getString("COLUMN_NAME").equalsIgnoreCase("col122")){
System.out.println(rs.getString("COLUMN_NAME") + "\t" +
rs.getString("COLUMN_SIZE") + "\t" + rs.getInt("DECIMAL_DIGITS"));
}
}
rs.close();
con.close();
} catch (Exception e) {
e.printStackTrace();
;
}
Default fetch size is 50. if any column no is under 50 with decimal type
precision is returning properly, when the column no is greater than 50,
precision is returning as zero.
was:
Hive decimal type column precision is returning as zero, even though column has
precision set.
Example: col67 decimal(18,2) precison is returning as zero for that column.
Tried with below program.
System.out.println("Opening connection");
Class.forName("org.apache.hive.jdbc.HiveDriver");
System.out.println("hi");
Connection con =
DriverManager.getConnection("jdbc:hive2://x.x.x.x:10000/default");
DatabaseMetaData dbMeta = con.getMetaData();
ResultSet rs = dbMeta.getColumns(null, "DEFAULT", "data_type_test",null);
while (rs.next()) {
if (rs.getString("COLUMN_NAME").equalsIgnoreCase("col48") ||
rs.getString("COLUMN_NAME").equalsIgnoreCase("col67") ||
rs.getString("COLUMN_NAME").equalsIgnoreCase("col68") ||
rs.getString("COLUMN_NAME").equalsIgnoreCase("col122")){
System.out.println(rs.getString("COLUMN_NAME") + "\t" +
rs.getString("COLUMN_SIZE") + "\t" + rs.getInt("DECIMAL_DIGITS"));
}
}
rs.close();
con.close();
} catch (Exception e) {
e.printStackTrace();
;
}
Default fetch size is 50. if any column no is under 50 with decimal type
precision is returning properly, when the column no is greater than 50,
precision is returning as zero.
> Hive Decimal Type column scale is returning as zero
> ---------------------------------------------------
>
> Key: HIVE-15519
> URL: https://issues.apache.org/jira/browse/HIVE-15519
> Project: Hive
> Issue Type: Bug
> Components: Hive, JDBC
> Reporter: Bharat Viswanadham
> Priority: Critical
> Attachments: data_type_test(1).txt
>
>
> Hive decimal type column precision is returning as zero, even though column
> has precision set.
> Example: col67 decimal(18,2) precison is returning as zero for that column.
> Tried with below program.
> System.out.println("Opening connection");
> Class.forName("org.apache.hive.jdbc.HiveDriver");
> Connection con =
> DriverManager.getConnection("jdbc:hive2://x.x.x.x:10000/default");
> DatabaseMetaData dbMeta = con.getMetaData();
> ResultSet rs = dbMeta.getColumns(null, "DEFAULT", "data_type_test",null);
> while (rs.next()) {
> if (rs.getString("COLUMN_NAME").equalsIgnoreCase("col48") ||
> rs.getString("COLUMN_NAME").equalsIgnoreCase("col67") ||
> rs.getString("COLUMN_NAME").equalsIgnoreCase("col68") ||
> rs.getString("COLUMN_NAME").equalsIgnoreCase("col122")){
> System.out.println(rs.getString("COLUMN_NAME") + "\t" +
> rs.getString("COLUMN_SIZE") + "\t" + rs.getInt("DECIMAL_DIGITS"));
> }
> }
> rs.close();
> con.close();
> } catch (Exception e) {
> e.printStackTrace();
> ;
> }
> Default fetch size is 50. if any column no is under 50 with decimal type
> precision is returning properly, when the column no is greater than 50,
> precision is returning as zero.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)