Paramvir Singh created HIVE-29059:
-------------------------------------
Summary: SHOW CREATE TABLE ignores all strings after tab character
Key: HIVE-29059
URL: https://issues.apache.org/jira/browse/HIVE-29059
Project: Hive
Issue Type: Bug
Affects Versions: 4.0.1
Reporter: Paramvir Singh
Repro sceanrio
1. Create an external table and insert some data into it
{code:java}
create external table if not exists mytable
(MY_COL1 string, MY_COL2 string, MY_COL3 string)
row format delimited
fields terminated by ',';
INSERT INTO TABLE mytable VALUES
('5', '5', '5'),
('6', '6', '6');
{code}
2. Use a hql file to create a view, e.g.
{code:java}
cat h.sql
create view mytable_v as select * from mytable where my_col1 = 1; --> Note
here after my_col there is a tab character (not space character)
beeline -u "jdbc:hive2://$(hostname -f):10000/default" -n hadoop -f h.sql
{code}
3. Run SHOW CREATE VIEW. Everything after the tab character is ignored
{code:java}
0: jdbc:hive2://ip-172-31-45-90.us-west-2.com> show create table mytable_v;
INFO : Compiling
command(queryId=hive_20250702091216_491b1456-84ef-4789-aad6-20d2c0161599): show
create table mytable_v
INFO : Semantic Analysis Completed (retrial = false)
INFO : Created Hive schema:
Schema(fieldSchemas:[FieldSchema(name:createtab_stmt, type:string, comment:from
deserializer)], properties:null)
INFO : Completed compiling
command(queryId=hive_20250702091216_491b1456-84ef-4789-aad6-20d2c0161599); Time
taken: 0.043 seconds
INFO : Concurrency mode is disabled, not creating a lock manager
INFO : Executing
command(queryId=hive_20250702091216_491b1456-84ef-4789-aad6-20d2c0161599): show
create table mytable_v
INFO : Starting task [Stage-0:DDL] in serial mode
INFO : Completed executing
command(queryId=hive_20250702091216_491b1456-84ef-4789-aad6-20d2c0161599); Time
taken: 0.092 seconds
+----------------------------------------------------+
| createtab_stmt |
+----------------------------------------------------+
| CREATE VIEW `mytable_v` AS select `mytable`.`my_col1`, `mytable`.`my_col2`,
`mytable`.`my_col3` from `default`.`mytable` where `mytable`.`my_col1` |
+----------------------------------------------------+
1 row selected (0.332 seconds)
{code}
4. However query the view still works,
{code:java}
select * from mytable_v;
+--------------------+--------------------+--------------------+
| mytable_v.my_col1 | mytable_v.my_col2 | mytable_v.my_col3 |
+--------------------+--------------------+--------------------+
| 1 | 1 | 1 |
+--------------------+--------------------+--------------------+
{code}
In TBLS table in metastore, it still has the full view creation query, with
my_col1 = 1
--
This message was sent by Atlassian Jira
(v8.20.10#820010)