执行sqoop报错 Unrecognized argument

具体错误如下:

25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: --delete-target-dir
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: -m
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: 1
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: --split-by
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: id
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: --input-null-string
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: \\N
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: --input-null-non-string
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: \\N
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: --null-string
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: \\N
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: --null-non-string
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: \\N
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: --as-textfile
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: --fields-terminated-by
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: \001
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument: --hive-delims-replacement
25/04/15 12:16:39 ERROR tool.BaseSqoopTool: Unrecognized argument:

报错信息表明 Sqoop 无法识别某些参数,实际原因是参数书写格式不正确,尤其是参数与参数值之间缺少必要的空格。以下是详细分析和改正建议:

此错误指明整个字符串被当作了一个参数,而不是把 --target-dir 和目录路径分开处理。这通常是由于缺少空格引起的。

其他错误(如 -m 1, --split-by id 等)也是由于在参数与其值之间没有按照预期格式分隔,或参数顺序不当导致参数解析出错。

注意 –query 参数中的问题

使用 --query 时需注意两点:

  • 必须包含 \$CONDITIONS 字符串,否则 Sqoop 无法生成分割条件。在你的查询里,应将条件追加上 AND \$CONDITIONS
  • 例如: sqlCopyEdit--query "SELECT * FROM bigdata_iot_day WHERE day = '2025-03-24' AND \$CONDITIONS" 这里的 \$CONDITIONS 会在实际执行时被 Sqoop 替换为分片条件。
    注:在某些 shell 环境中可能需要对 $ 进行转义或者引用,确保在执行时 Sqoop 接收到正确字符串。

关注公众号“大模型全栈程序员”回复“小程序”获取1000个小程序打包源码。更多免费资源在http://www.gitweixin.com/?p=2627

发表评论

邮箱地址不会被公开。 必填项已用*标注