在hive中显示最近创建的空表时出现 "error: list index out of range"

sxissh06  于 2021-04-06  发布在  Hive
关注(0)|答案(1)|浏览(856)


我使用virtual box运行cloudera v5.4.2-0.我按照在线课程的说明使用以下hiveql创建一个空表。

create table sales_all_years (RowID smallint, OrderID int, OrderDate date, OrderMonthYear date, Quantity int, Quote float, DiscountPct float, Rate float, SaleAmount float, CustomerName string, CompanyName string, Sector string, Industry string, City string, ZipCode string, State string, Region string, ProjectCompleteDate date, DaystoComplete int, ProductKey string, ProductCategory string, ProductSubCategory string, Consultant string, Manager string, HourlyWage float, RowCount int, WageMargin float)
partitioned by (yr int) -- partitioning
row format serde 'com.bizo.hive.serde.csv.CSVSerde'
stored as textfile;

我做了一点实验,意识到表的分区导致了这个错误,但我无法找出原因。

dxpyg8gm

dxpyg8gm1#

可能是 "com.bizo.hive.serde.csv.CSVSerde "的问题,尝试用不同的serde创建表,例如

ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES (
   "separatorChar" = ",",
   "quoteChar"     = "'",
   "escapeChar"    = "\\"
)  
STORED AS TEXTFILE

或只在文本文件中加入相应的分隔符

ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE

相关问题