我創建了實木複合地板文件,然後嘗試將其導入Impala表。Impala +實木複合地板文件
我創建的表如下:
CREATE EXTERNAL TABLE `user_daily` (
`user_id` BIGINT COMMENT 'User ID',
`master_id` BIGINT,
`walletAgency` BOOLEAN,
`zone_id` BIGINT COMMENT 'Zone ID',
`day` STRING COMMENT 'The stats are aggregated for single days',
`clicks` BIGINT COMMENT 'The number of clicks',
`impressions` BIGINT COMMENT 'The number of impressions',
`avg_position` BIGINT COMMENT 'The average position * 100',
`money` BIGINT COMMENT 'The cost of the clicks, in hellers',
`web_id` BIGINT COMMENT 'Web ID',
`discarded_clicks` BIGINT COMMENT 'Number of discarded clicks from column "clicks"',
`impression_money` BIGINT COMMENT 'The cost of the impressions, in hellers'
)
PARTITIONED BY (
year BIGINT,
month BIGINT
)
STORED AS PARQUET
LOCATION '/warehouse/impala/contextstat.db/user_daily/';
然後我有複製文件與此架構:
parquet-tools schema user_daily/year\=2016/month\=8/part-r-00001-fd77e1cd-c824-4ebd-9328-0aca5a168d11.snappy.parquet
message spark_schema {
optional int32 user_id;
optional int32 web_id (INT_16);
optional int32 zone_id;
required int32 master_id;
required boolean walletagency;
optional int64 impressions;
optional int64 clicks;
optional int64 money;
optional int64 avg_position;
optional double impression_money;
required binary day (UTF8);
}
,然後當我嘗試看到
SELECT * FROM user_daily;
我的條目獲得
File 'hdfs://.../warehouse/impala/contextstat.db/user_daily/year=2016/month=8/part-r-00000-fd77e1cd-c824-4ebd-9328-0aca5a168d11.snappy.parquet'
has an incompatible Parquet schema for column 'contextstat.user_daily.user_id'.
Column type: BIGINT, Parquet schema:
optional int32 user_id [i:0 d:1 r:0]
你知道如何解決這個問題嗎?我認爲BIGINT和int_32是一樣的。我應該改變桌子的方案還是改變鑲木地板的文件?
不幸的是,這種解決方案不是我所需要的。有一些表格結構顯示在上面,我想堅持解決方案,我改變地板文件。順便說一句:我嘗試了......發生下一個錯誤:錯誤:AnalysisException:不支持的邏輯parquet類型INT_16(原始類型爲INT32)字段web_id' – United121
錯誤消息顯示沒有可以在表定義中指定的類型這將與Parquet文件包含的內容兼容。如果您想堅持表定義並更改Parquet模式,那麼只需將'int32'的所有實例更改爲'int64'並刪除'(INT_16)'部分。 – Zoltan
但是我怎樣才能從該方案中刪除'(INT_16)'部分?它在調用'parquet-tools scheme'並顯示已經存在的文件後顯示?有沒有辦法在現有的文件中進行更改? – United121