Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 6B261200CBF for ; Sat, 24 Jun 2017 01:57:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 69F65160BF2; Fri, 23 Jun 2017 23:57:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B0566160BE5 for ; Sat, 24 Jun 2017 01:57:03 +0200 (CEST) Received: (qmail 35868 invoked by uid 500); 23 Jun 2017 23:57:02 -0000 Mailing-List: contact issues-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list issues@hive.apache.org Received: (qmail 35859 invoked by uid 99); 23 Jun 2017 23:57:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Jun 2017 23:57:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 316DD19207B for ; Fri, 23 Jun 2017 23:57:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Y1HvUYQVpfNJ for ; Fri, 23 Jun 2017 23:57:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id C6FE15FB5C for ; Fri, 23 Jun 2017 23:57:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 5D30BE070E for ; Fri, 23 Jun 2017 23:57:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 1AE2521941 for ; Fri, 23 Jun 2017 23:57:00 +0000 (UTC) Date: Fri, 23 Jun 2017 23:57:00 +0000 (UTC) From: "Gunther Hagleitner (JIRA)" To: issues@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HIVE-16937) INFORMATION_SCHEMA usability: everything is currently a string MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 23 Jun 2017 23:57:04 -0000 [ https://issues.apache.org/jira/browse/HIVE-16937?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gunther Hagleitner updated HIVE-16937: -------------------------------------- Attachment: HIVE-16937.2.patch Forgot to update jdbc_handler.q - patch .2 has that. > INFORMATION_SCHEMA usability: everything is currently a string > -------------------------------------------------------------- > > Key: HIVE-16937 > URL: https://issues.apache.org/jira/browse/HIVE-16937 > Project: Hive > Issue Type: Bug > Affects Versions: 3.0.0 > Reporter: Carter Shanklin > Assignee: Gunther Hagleitner > Attachments: HIVE-16937.1.patch, HIVE-16937.2.patch > > > HIVE-1010 adds an information schema to Hive, also taking the opportunity to expose some non-standard but valuable things like statistics in a SYS table. > A challenge I have noted with the SYS table is that all statistic counts are exposed as string types rather than numerics. > {code} > hive> show create table sys.tab_col_stats; > OK > CREATE TABLE `sys.tab_col_stats`( > `cs_id` string COMMENT 'from deserializer', > `db_name` string COMMENT 'from deserializer', > `table_name` string COMMENT 'from deserializer', > `column_name` string COMMENT 'from deserializer', > `column_type` string COMMENT 'from deserializer', > `tbl_id` string COMMENT 'from deserializer', > `long_low_value` string COMMENT 'from deserializer', > `long_high_value` string COMMENT 'from deserializer', > `double_high_value` string COMMENT 'from deserializer', > `double_low_value` string COMMENT 'from deserializer', > `big_decimal_low_value` string COMMENT 'from deserializer', > `big_decimal_high_value` string COMMENT 'from deserializer', > `num_nulls` string COMMENT 'from deserializer', > `num_distincts` string COMMENT 'from deserializer', > `avg_col_len` string COMMENT 'from deserializer', > `max_col_len` string COMMENT 'from deserializer', > `num_trues` string COMMENT 'from deserializer', > `num_falses` string COMMENT 'from deserializer', > `last_analyzed` string COMMENT 'from deserializer') > ROW FORMAT SERDE > 'org.apache.hive.storage.jdbc.JdbcSerDe' > STORED BY > 'org.apache.hive.storage.jdbc.JdbcStorageHandler' > {code} > So you might run this query to try and find the column(s) which have the most distinct values. > {code} > select > db_name, table_name, column_name > from > sys.tab_col_stats > where > num_distincts = ( select max(num_distincts) from sys.tab_col_stats ); > {code} > Unfortunately this maximum is based on string sorting so it's not likely what you really want. > It would be better to use numeric types where appropriate such as all the numbers in tab_col_stats, and most likely bigints should be used for stats like # rows, etc. -- This message was sent by Atlassian JIRA (v6.4.14#64029)