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 708E3200D56 for ; Tue, 12 Dec 2017 17:51:09 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 6EE38160C00; Tue, 12 Dec 2017 16:51:09 +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 B40D0160BE7 for ; Tue, 12 Dec 2017 17:51:08 +0100 (CET) Received: (qmail 40903 invoked by uid 500); 12 Dec 2017 16:51:07 -0000 Mailing-List: contact dev-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 dev@hive.apache.org Received: (qmail 40885 invoked by uid 99); 12 Dec 2017 16:51:07 -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; Tue, 12 Dec 2017 16:51:07 +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 282CA180336 for ; Tue, 12 Dec 2017 16:51:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[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 acEh6FkUHqJX for ; Tue, 12 Dec 2017 16:51:06 +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 2125B5F489 for ; Tue, 12 Dec 2017 16:51:05 +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 754B1E093C for ; Tue, 12 Dec 2017 16:51:04 +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 A5E71212F5 for ; Tue, 12 Dec 2017 16:51:01 +0000 (UTC) Date: Tue, 12 Dec 2017 16:51:00 +0000 (UTC) From: "Hui Huang (JIRA)" To: dev@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (HIVE-18265) desc formatted/extended or show create table can not fully display the result when field or table comment contains tab character MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 12 Dec 2017 16:51:09 -0000 Hui Huang created HIVE-18265: -------------------------------- Summary: desc formatted/extended or show create table can not fully display the result when field or table comment contains tab character Key: HIVE-18265 URL: https://issues.apache.org/jira/browse/HIVE-18265 Project: Hive Issue Type: Bug Components: CLI Affects Versions: 3.0.0 Reporter: Hui Huang Assignee: Hui Huang Fix For: 3.0.0 Here are some examples: create table test_comment (id1 string comment 'full_\tname1', id2 string comment 'full_\tname2', id3 string comment 'full_\tname3') stored as textfile; When execute `show create table test_comment`, we can see the following content in the console, {quote} createtab_stmt CREATE TABLE `test_comment`( `id1` string COMMENT 'full_ `id2` string COMMENT 'full_ `id3` string COMMENT 'full_ ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' STORED AS INPUTFORMAT 'org.apache.hadoop.mapred.TextInputFormat' OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' LOCATION 'hdfs://xxx/user/huanghui/warehouse/huanghuitest.db/test_comment' TBLPROPERTIES ( 'transient_lastDdlTime'='1513095570') {quote} And the output of `desc formatted table ` is a little similar, {quote} col_name data_type comment \# col_name data_type comment id1 string full_ id2 string full_ id3 string full_ \# Detailed Table Information (ignore)... {quote} When execute `desc extended test_comment`, the problem is more obvious, {quote} col_name data_type comment id1 string full_ id2 string full_ id3 string full_ Detailed Table Information Table(tableName:test_comment, dbName:huanghuitest, owner:huanghui, createTime:1513095570, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:id1, type:string, comment:full_ name1), FieldSchema(name:id2, type:string, comment:full_ {quote} *the rest of the content is lost*. The content is not really lost, it's just can not display normal. Because hive store the result in LazyStruct, and LazyStruct use '\t' as field separator: {code:java} // LazyStruct.java#parse() // Go through all bytes in the byte[] while (fieldByteEnd <= structByteEnd) { if (fieldByteEnd == structByteEnd || bytes[fieldByteEnd] == separator) { // Reached the end of a field? if (lastColumnTakesRest && fieldId == fields.length - 1) { fieldByteEnd = structByteEnd; } startPosition[fieldId] = fieldByteBegin; fieldId++; if (fieldId == fields.length || fieldByteEnd == structByteEnd) { // All fields have been parsed, or bytes have been parsed. // We need to set the startPosition of fields.length to ensure we // can use the same formula to calculate the length of each field. // For missing fields, their starting positions will all be the same, // which will make their lengths to be -1 and uncheckedGetField will // return these fields as NULLs. for (int i = fieldId; i <= fields.length; i++) { startPosition[i] = fieldByteEnd + 1; } break; } fieldByteBegin = fieldByteEnd + 1; fieldByteEnd++; {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)