hive建表报错 FAILED: ParseException line 3:22 mismatched input ‘<EOF>‘ expecting StringLiteral near ‘by‘

这篇具有很好参考价值的文章主要介绍了hive建表报错 FAILED: ParseException line 3:22 mismatched input ‘<EOF>‘ expecting StringLiteral near ‘by‘。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

错误

hive建表报错
FAILED: ParseException line 3:22 mismatched input ‘’ expecting StringLiteral near ‘by’ in table row format’s field separator

详细错误

hive mismatched input expecting <eof>,大数据技术与原理——hadoop,hive,hadoop,大数据

建表语句

hive> create external table if not exists epidemicStatisticsData(dateRange string, numberOfAsymptomaticPeople int, cumulativeNumberOfConfirmedCases int, cumulativeNumberOfPeopleCured int, cumulativeNumberOfDeaths int)
    > row format delimited
    > fields terminated by ';'
    > stored as textfile
    > location '/usr/data/epidemicStatisticsData.txt';

终端报错

MismatchedTokenException(-1!=332)
	at org.antlr.runtime.BaseRecognizer.recoverFromMismatchedToken(BaseRecognizer.java:617)
	at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:115)
	at org.apache.hadoop.hive.ql.parse.HiveParser.tableRowFormatFieldIdentifier(HiveParser.java:36442)
	at org.apache.hadoop.hive.ql.parse.HiveParser.rowFormatDelimited(HiveParser.java:35352)
	at org.apache.hadoop.hive.ql.parse.HiveParser.tableRowFormat(HiveParser.java:35636)
	at org.apache.hadoop.hive.ql.parse.HiveParser.createTableStatement(HiveParser.java:5398)
	at org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2763)
	at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1756)
	at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1178)
	at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:204)
	at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:404)
	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:329)
	at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1158)
	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1253)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1084)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1072)
	at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:232)
	at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:183)
	at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:399)
	at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:776)
	at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:714)
	at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:641)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.hadoop.util.RunJar.run(RunJar.java:226)
	at org.apache.hadoop.util.RunJar.main(RunJar.java:141)
FAILED: ParseException line 3:22 mismatched input '<EOF>' expecting StringLiteral near 'by' in table row format's field separator

解决方案

更改建表语句中

fields terminated by ';'

fields terminated by '\073'

错误原因

由于笔者的hdfs文件中不同字段是通过分号分隔, 因此

fields terminated by ';'

但对于特殊字符,为避免产生歧义,hive 语法规定需通过asc码值对特殊字符进行转义
';'对应asc码值为'\073'
即改为

fields terminated by '\073'

对于其他字符对应的asc码值
ASCII码值表

原创不易
转载请标明出处
如果对你有所帮助 别忘啦点赞支持哈
hive mismatched input expecting <eof>,大数据技术与原理——hadoop,hive,hadoop,大数据文章来源地址https://www.toymoban.com/news/detail-528902.html

到了这里,关于hive建表报错 FAILED: ParseException line 3:22 mismatched input ‘<EOF>‘ expecting StringLiteral near ‘by‘的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Hive 建表客户端报错 missing EOF at “/“

    在创建表时,我使用的是idea客户端,报了如下错误 org.apache.hadoop.hive.ql.parse.ParseException:line 6:48 missing EOF at ‘/’ near ‘)’ 原本sql如下: 后来把sql中的注释去掉以后,或者把注释开头替换成 – 此异常便可以解决。

    2024年02月08日
    浏览(42)
  • git clone 遇到了 early EOF index-pack failed 问题

    由于仓库包含了很多文件,仓库过大,导致clone的时候一直报错: 注意:过程中需要耐心等待,如果遇到失败,可以多尝试几遍。 压缩目标仓库文件 compression 是压缩的意思,从 clone 的终端输出就知道,服务器会压缩目标文件,然后传输到客户端,客户端再解压。取值为 [-

    2024年02月08日
    浏览(47)
  • frpc篇---frpc客户端连接会提示 login to server failed: EOF

    1.frpc客户端连接会提示 login to server failed: EOF 2.解决办法

    2024年02月13日
    浏览(29)
  • 在docker里使用gpu的解决方案(镜像内安装驱动使用nvidia-smi后显示Failed to initialize NVML: Driver/library version mismatch)

    要么在docker环境内安装nvidia-driver 但容易和外面的版本不一致导致各种报错version mismatch之类的 不如使用nvidia-docker,这是一个nVidia官方为了方便在docker镜像容器内使用gpu做的包: 1. 保证docker环境内没有nvidia驱动程序,防止后续配置出现驱动版本不一致的情况         找到你要

    2024年01月21日
    浏览(31)
  • 二百零九、Hive——with嵌套语句报错:hadoop.hive.ql.parse.SemanticException: Line 2:5 Ambiguous table alias ‘t2‘

    在Hive的with嵌套语句时,HQL报错Line 2:5 Ambiguous table alias \\\'t2\\\' org.apache.hadoop.hive.ql.parse.SemanticException: Line 2:5 Ambiguous table alias \\\'t2\\\' 看报错提示,Ambiguous table alias \\\'t2\\\',似乎是with嵌套子语句命名t2报错,但是我试了很多其他命名,都报类似的错误,如果大家知道原因的话还望告知,谢

    2024年01月20日
    浏览(34)
  • 【elsctic】elsctic kerberos status line [HTTP/1.1 401 Unauthorized] authenticate failed!

    elsctic远程认证kerberos集群 我同事的正常,但是我的不正常 我的配置信息如下

    2023年04月10日
    浏览(28)
  • HIVE SQL cannot recognize input near ‘(‘ ‘select‘ ‘uid‘ in joinSource

    报错信息: cannot recognize input near \\\'(\\\' \\\'select\\\' \\\'uid\\\' in joinSource 网上查到有说是因为子查询没有起别名,自查没有这个问题 后来发现是在注释里使用了\\\',场景类似这样 把这段注释移动到代码最顶部依然报错,怀疑是\\\'导致的,删除后就成功运行了 没有查到关于hive sql 里 注释中使

    2024年02月12日
    浏览(46)
  • ubuntu22.04安装MySQL、Hive及Hive连接MySQL操作

    这篇文章主要讲述的是ubuntu22.04上数据仓库Hive的安装和使用 建议按照文章实践前稍微通读下全文 相关命令: sudo apt-get install mysql-server sudo apt-get install mysql-client 在终端中输入 sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf 修改mysql的配置文件 [mysqld]之后,任意新建一行,添加文本 skip-gr

    2024年02月11日
    浏览(32)
  • Hive(22):Select查询数据之基础查询

    1 语法树 table_reference指示查询的输入。它可以是普通物理表,视图,join查询结果或子查询结果。 表名和列名不区分大小写。 2 案例:美国Covid-19新冠select查询 下面来准备一下语法测试环境,在附件资料中有一份数据文件《us-covid19-counties.dat》,里面记录了2021-01-28美国各个县

    2024年02月16日
    浏览(27)
  • flink创建表报错

    提示:这里可以添加本文要记录的大概内容: 例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。 提示:以下是本篇文章正文内容,下面案例可供参考 执行报错信息为: SQL parse failed .Lexic

    2024年01月21日
    浏览(22)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包