【发布时间】:2017-06-30 10:24:47
【问题描述】:
我知道如何使用 Hue 在 Hive 中添加列 cmets。我特别希望评论在Hue中的几行上显示,因为它太长而无法在一行上阅读。
我创建了一个我在以前的 stackoverflow 帖子中找到的表作为示例:
CREATE TABLE test_table(
col1 INT COMMENT 'col1 one line comment',
col2 STRING COMMENT 'col2 two lines comment',
col3 STRING COMMENT 'col3 three lines comment',
col4 STRING COMMENT 'col4 very long comment that is greater than 80 chars and is likely to spill into multiple lines',
col5 STRING COMMENT 'col5 very long multi-line comment where each line is very long by itself and is likely to spill into multiple lines. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin in dolor nisl, sodales adipiscing tortor. Integer venenatis',
col6 STRING COMMENT 'This comment has a very long single word ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvzxyz123 which will not fit in a line by itself for small column widths.',
col7_NoComment STRING)
COMMENT 'table comment two lines';
这是 Hue 中的表格视图:
如您所见,cmets 没有换行符。注释不管多长,还是加在一行里。
为了在 Hue 中将其分成多行,我考虑使用“\n”字符。这是修改第 6 列注释时关联查询的结果:
ALTER TABLE test_table CHANGE COLUMN col6 col6 STRING COMMENT 'This comment has a very long single word ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvzxyz123 \n Line break here because it will not fit in a single line.'
尝试编写多行注释时在 Hue 中查看“table_test”的元数据:
如果您查看第 6 行,您可以看到应该是注释的内容被 Hue(或 Hive)解释为新列。所以现在我有 8 列,而不是 7 列。
您知道是否可以为 Hue 中显示的列添加多行注释?
【问题讨论】:
-
issues.cloudera.org/browse/HUE-4288 已报告,他们指出这可能是 Hive 问题。如果您不相信是这种情况,请更新该 jira。