hive字段关键字问题处理

最近在xxl_job部署shell调度任务时,发现在编写Hql时,对一些使用关键字命名的字段无法解析,按开发规范,字段命名不应该有关键字,但是数据来源是第三方,无法修改,需要通过flume对从kafka的数据到hdfs上,数据是json格式,所以需要对关键字字段进行处理,最初是通过 `,',",'," 都无法识别,最后对通过转义字符解决了,解决方法如下:

具体报错如下:

bash 复制代码
2023-10-23 11:42:52 [com.xxl.job.core.thread.JobThread#run]-[133]-[xxl-job, JobThread-14-1698032572739] 
----------- xxl-job job execute start -----------
----------- Param:
2023-10-23 11:42:52 [com.xxl.job.core.handler.impl.ScriptJobHandler#execute]-[80]-[xxl-job, JobThread-14-1698032572739] ----------- script file:/data/applogs/xxl-job/jobhandler/gluesource/14_1698032568000.sh -----------
xxl-job: hello shell
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/hdp/3.1.4.0-315/hive/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/3.1.4.0-315/hadoop/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Connecting to 
Connected to: Apache Hive (version 3.1.0.3.1.4.0-315)
Driver: Hive JDBC (version 3.1.0.3.1.4.0-315)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Error: Error while compiling statement: FAILED: ParseException line 4:70 cannot recognize input near 'local' ',' 'type' in select expression (state=42000,code=40000)
Good bye!
2023-10-23 11:42:59 [com.xxl.job.core.thread.JobThread#run]-[179]-[xxl-job, JobThread-14-1698032572739] 
----------- xxl-job job execute end(finish) -----------
----------- Result: handleCode=200, handleMsg = null
2023-10-23 11:42:59 [com.xxl.job.core.thread.TriggerCallbackThread#callbackLog]-[197]-[xxl-job, executor TriggerCallbackThread] 
----------- xxl-job job callback finish.
2023-10-23 11:43:35 [com.xxl.job.core.thread.JobThread#run]-[194]-[xxl-job, JobThread-14-1698032572739] 
----------- JobThread toStop, stopReason:change job source or glue type, and terminate the old job thread.
2023-10-23 11:43:35 [com.xxl.job.core.thread.JobThread#run]-[204]-[xxl-job, JobThread-14-1698032572739] 
----------- JobThread Exception:java.lang.InterruptedException
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2014)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2088)
	at java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467)
	at com.xxl.job.core.thread.JobThread.run(JobThread.java:114)

----------- xxl-job job execute end(error) -----------

比如需要对local,type关键字进行转义,转义规则如下:

\`local\`,\`type\`

问题解决。

相关推荐
xerthwis13 小时前
Hadoop:大数据世界的“古老基石”与“沉默的共生者”
大数据·人工智能·hadoop
yumgpkpm16 小时前
Cloudera CDH5|CDH6|CDP7.1.7|CDP7.3|CMP 7.3的产品优势分析(在华为鲲鹏 ARM 麒麟KylinOS、统信UOS)
大数据·人工智能·hadoop·深度学习·spark·transformer·cloudera
ghgxm52016 小时前
EXCEL使用VBA代码实现按条件查询数据库--简单实用
开发语言·数据仓库·笔记·excel·数据库开发
yumgpkpm16 小时前
Hadoop如何用Flink支持实时数据分析需求
大数据·hadoop·分布式·hdfs·flink·kafka·cloudera
喻师傅2 天前
Hive 中 NULL 值在逻辑判断中的“陷阱”(踩坑复盘)
数据仓库·hive·hadoop
涤生大数据2 天前
放弃Canal后,我们用Flink CDC实现了99.99%的数据一致性
大数据·数据仓库·flink·大数据开发·flink cdc·数据开发·实时数据
jinxinyuuuus2 天前
订阅指挥中心:数据可移植性、Schema设计与用户数据主权
数据仓库·人工智能
老徐电商数据笔记2 天前
技术复盘第四篇:Kimball维度建模在电商场景的实战应用
大数据·数据仓库·技术面试
LF3_2 天前
Centos7,单机搭建Hadoop3.3.6伪分布式集群
大数据·hadoop·伪分布式
程序员小羊!3 天前
数仓数据基线,在不借助平台下要怎么做?
大数据·数据仓库