Search code examples
hivehiveqlbeeline

in Beeline,use "create table table_name as select * from" doesn't work


in Beeline,i use "create table new_table_name as select * from exists_name" to create a new table,the table was created successfully, but there is no data.When i use the same "select * from exists_name" to create a temporary table,the temporary table has data. the Beeline version is Beeline version 3.1.0.3.1.5.0-152 by Apache Hive


Solution

  • I checked the HIVE official documents about Create Table As Select (CTAS), CTAS has these restrictions:

    1. The target table cannot be an external table.
    2. The target table cannot be a list bucketing table.

    in Beeline,when i use create table new_table_name as select * from exists_name to create a new table,it's always create an external table,maybe this reason