Help Center/ Data Lake Insight/ FAQs/ Problems Related to SQL Jobs/ Job O&M Errors/ Why Is a Schema Parsing Error Reported When I Create a Hive Table Using CTAS?
Updated on 2023-05-19 GMT+08:00

Why Is a Schema Parsing Error Reported When I Create a Hive Table Using CTAS?

Currently, DLI supports the Hive syntax for creating tables of the TEXTFILE, SEQUENCEFILE, RCFILE, ORC, AVRO, and PARQUET 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.

If the column name is not specified, the content after SELECT is used as both the column name and inserted value. The column name of the AVRO table cannot be a digit. Otherwise, an error will be 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.