1. 程式人生 > 其它 >impala 查詢 parquet出錯:型別不匹配

impala 查詢 parquet出錯:型別不匹配

現象

  1. HUE 查詢parquet表報錯,錯誤如下
Bad status for request TFetchResultsReq(fetchType=0, operationHandle=TOperationHandle(hasResultSet=True, modifiedRowCount=None, operationType=0, operationId=THandleIdentifier(secret='\xe8=#\xc1\xdb\xe3D_\x00\x00\x00\x00\x9al\xfd%', guid='\xe8=#\xc1\xdb\xe3D_\x00\x00\x00\x00\x9al\xfd%')), orientation=4, maxRows=100): TFetchResultsResp(status=TStatus(errorCode=None, errorMessage="File 'hdfs://nameservice1/user/hive/warehouse/xxx.db/xxx/dt=2022-05-27/xxx.parquet' has an incompatible Parquet schema for column 'xx.xx.cartype'. Column type: STRING, Parquet schema:\noptional double s1000 [i:1 d:1 r:0]\n", sqlState='HY000', infoMessages=None, statusCode=3), results=None, hasMoreRows=None)

解決思路

  1. 找到 jira地址如下:
https://issues.apache.org/jira/browse/IMPALA-779
  1. 確認解決方案
    查詢前 set 引數即可,
set PARQUET_FALLBACK_SCHEMA_RESOLUTION=name;
select * from parquet_table limit 10;
  1. 永久解決方案
    impala 配置中找到 query option 選項,並設定:
PARQUET_FALLBACK_SCHEMA_RESOLUTION=name