Sqoop reports an error can’t parse input data: ‘\ n’
Problem Description: use sqoop to push the data in hive to Oracle. The program reports an error: can’t parse input data: ‘\ n’
. Null value cannot be recognized when derivative.
The reason for this exception is that when the table in hive is a partitioned table, the added fields do not use cascade, such as:
alter table app.suntest_user add columns(name string comment 'name') cascade
When does not use the cascade keyword, hive does not update the history partition definition, resulting in differences between the columns in the table and the target table when transmitting history data.
For example:
False table suntest_ User created partition M08 in August, added a name column in September, and created partition M09, and added a name column to the table definition in the target database (Oracle). There is no problem exporting M09 partition data through the sqoop script, but an error will be reported when exporting M08 data: can’t parse input data: ‘\ n’
Solution:
You can rebuild the partition in August , or create a table for derivatives. The following is a table creation statement.
----- Create a table corresponding to the partition and use the temporary derivative
create table app.test_suntest_user as
select id,name from app.suntest_user where partition_month='M08'
----Rebuild partition statement
--Rename partition
alter table app.suntest_user partition (partition_month='M08') rename to partition (partition_month='M08bak');
--New Partition
insert overwrite table app.suntest_user partition(partition_month='M08')
select id ,name from app.suntest_user where partition_month='M08bak';
The sqoop statement is as follows:
sqoop export --connect "jdbc:oracle:thin:@**********" \
--username "abc" \
--password "123" \
--input-null-string '\\N' --input-null-non-string '\\N' \
--table "SUNTEST_USER" \
--export-dir /user/hive/warehouse/app/test_suntest_user\
--input-fields-terminated-by '\001' \
Read More:
- How to Solve Angular Error: error NG8002: Can‘t bind to ‘ngModel‘ since it isn‘t a known property of ‘input‘.
- Sqoop exports hive data to MySQL Error [How to Solve]
- [Solved] Vscode Katex Error: ParseError: KaTeX Parse Error: Can‘t Use Function ‘$‘ In Math Mode At Position …
- Sqoop connection gbase data error [How to Solve]
- [Solved] MYSQLD: Can‘t create directory ‘/usr/local/mysql/data/’(Errcode:2 -No such file or directory)
- PHP Parse error: syntax error, unexpected ‘class‘ (T_CLASS), expecting identifier (T_STRING)
- [Solved] npm Error: Can‘t find Python executable “python“, you can set the PYTHON env variable.
- [Solved] Canal Error: CanalParseException: column size is not match,parse row data failed
- JSON parse error: Can not deserialize instance of java.lang.String out of START_OBJECT token
- [Solved] Error: Can‘t locate revision identified by ‘xxx‘
- [Solved] MindSpore Error: StridedSlice operator does not support input of uint8 data type on Ascend hardware
- [Solved] Yolox Run Error: can‘t find starting number
- [Solved] redis Error: Can‘t save in background fork Cannot allocate memory
- [Solved] Markdown Edit Formula Error: ParseError: KaTeX parse error: {align} can be used only in display mode
- [Solved] Error dropping database (can‘t rmdir “emos“ errno: 39)
- Module not found: Error: Can‘t resolve ‘sass-loader‘
- [Solved] SyntaxError:JSON.parse:unexpected character at line 1 column 1 of the JSON data
- [Solved] Adb Shell Monkey Warning: can‘t create log.txt, Read-only file system
- [Solved] spark sql Error: Can‘t zip RDDs with unequal numbers of partitions
- Module not found: Error: Can‘t resolve ‘sass-loader‘ in…