A Schema Parsing Error Is Reported When You Create a Hive Table Using CTAS
Currently, DLI supports the Hive syntax for creating tables of the TEXTFILE, SEQUENCEFILE, RCFILE, ORC, AVRO, PARQUET, and CARBON file types. If the file format specified for creating a table in the CTAS is AVRO and digits are directly used as the input of the query statement (SELECT), for example, if the query is CREATE TABLE tb_avro STORED AS AVRO AS SELECT 1, a schema parsing exception is reported.
Description: If the column name is not specified, the content after SELECT is used as both the column name and inserted value. However, the column name of the AVRO table cannot be a digit. As a result, an error is reported, indicating that the schema fails to be parsed.
Solution: You can use CREATE TABLE tb_avro STORED AS AVRO AS SELECT 1 AS colName to specify the column name or set the storage format to a format other than AVRO.
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.