Extra Data after Last Expected Column:hawq建外表load数据报错

妖狐艹你老母 2022-06-01 23:14 316阅读 0赞

背景:使用sqoop import 才oracle抽数据入HDFS后,通过pxf建立hawq外表,查询数据报错

解决思路:1、从报错上看应该是数据源分割后字段数比目标表字段多,且pgadmin3里报错还出现源数据异常的一条记录,去源头oracle查看对应的记录,发现地段内部包含分隔符。

2、重新执行sqoop import 并用 “ \t “分隔,问题解决。

Loading Data from a Flat File “ERROR: Extra Data after Last Expected Column”

Chloe Jackson

March 23, 2017 16:26

Environment
















 Product  Version
 Pivotal Greenplum  4.2.x
 OS  All Supported OS

Symptom

Loading data from flat files result in the following error message:

  1. ERROR: extra data after last expected column

Cause

You will encounter this error if your source data has more columns than the target table.

Resolution

You must ensure that the source data and table columns align.

Example:

-- Target table

  1. ddata=# \d emp
  2. Table "public.emp"
  3. Column " Type " Modifiers
  4. --------+---------+-----------
  5. id " integer "
  6. dept " integer "
  7. role " integer "
  8. Distributed by: (id)

-- Source data file

  1. $ cat /tmp/load.dat
  2. 1"2"3"4
  3. 1"2"3"4
  4. 1"2"3"4
  5. 1"2"3"4
  6. 1"2"3"4
  7. 1"2"3"4

--Error

  1. ddata=# copy emp from '/tmp/load.dat' with delimiter as '"';
  2. ERROR: extra data after last expected column (seg0 sdw1:55001
  3. pid=12476)
  4. CONTEXT: COPY emp, line 1: "1"2"3"4"

As can be seen from the example above, the source data file has one more column than the target table, resulting in the error described above.

官方给出的解决方案如下:

发表评论

表情:
评论列表 (有 0 条评论,316人围观)

还没有评论,来说两句吧...

相关阅读