相关文章推荐
活泼的小蝌蚪  ·  pycharm显示no module ...·  1 年前    · 
高兴的猴子  ·  laravel-soar - 在 ...·  1 年前    · 
爱跑步的佛珠  ·  Deploy files to App ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Got exception running Sqoop: java.lang.NullPointerException using -query and --as-parquetfile

Ask Question

I am trying to import a table data from Redshift to HDFS (using Parquet format) and facing the error shown below:

15/06/25 11:05:42 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.NullPointerException
java.lang.NullPointerException
        at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:97)
        at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:478)
        at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:605)
        at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
        at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
        at org.apache.sqoop.Sqoop.main(Sqoop.java:236)

Command line query used:

sqoop import --driver "com.amazon.redshift.jdbc41.Driver" --connect "jdbc:postgresql://:5439/events" --username "username" --password "password" --query "SELECT * FROM mobile_og.pages WHERE \$CONDITIONS" --split-by anonymous_id --target-dir /user/huser/pq_mobile_og_pages_2 --as-parquetfile.

It works fine when --as-parquetfile option is removed from the above command line query.

It is confirmed to be a bug SQOOP-2571.

If you want to import all data of a table, then you can eventually run such a command:

sqoop import --driver "com.amazon.redshift.jdbc41.Driver" \
  --connect "jdbc:postgresql://:5439/events" \
  --username "username" --password "password" \
  --table mobile_og.pages \
  --split-by anonymous_id \
  --target-dir /user/huser/pq_mobile_og_pages_2 \
  --as-parquetfile

And --where is also an useful parameter. Check the user manual.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.