TT Bigdata TT Bigdata
首页
  • 部署专题

    • 常规安装
    • 一键部署
  • 组件专题

    • 安装指导
    • 实战 Kerberos
    • 魔改分享
  • 版本专题

    • 更新说明
    • BUG临时处理
  • 实验室

    • VIEW插件
    • JIRA速查
  • Ambari-Env

    • 环境准备
    • 开始使用
  • 组件编译

    • 专区—Ambari
    • 专区—Bigtop-官方组件
    • 专区—Bigtop-扩展组件
  • 报错解决

    • 专区—Ambari
    • 专区—Bigtop
  • 其他技巧

    • APT仓库增量更新
    • Maven镜像加速
    • Gradle镜像加速
    • Bower镜像加速
    • 虚拟环境思路
    • R环境安装+一键安装脚本
    • Ivy配置私有镜像仓库
    • Node.js 多版本共存方案
    • Ambari Web本地启动
    • Npm镜像加速
    • PostgreSQL快速安装
    • Temurin JDK 23快速安装
  • 成神之路

    • 专区—Ambari
    • 专区—Ambari-Metrics
    • 专区—Bigtop
  • 集成案例

    • Redis集成教学
    • Dolphin集成教学
    • Doris集成教学
    • 持续整理...
  • 核心代码

    • 各组件代码
    • 通用代码模板
  • 国产化&其他系统

    • Kylin V10系列
    • Rocky系列
    • Ubuntu系列
  • Grafana监控方案

    • Ambari-Metrics插件
    • Infinity插件
  • 支持&共建

    • 蓝图愿景
    • 合作共建
登陆
GitHub (opens new window)

JaneTTR

数据酿造智慧,每一滴都是沉淀!
首页
  • 部署专题

    • 常规安装
    • 一键部署
  • 组件专题

    • 安装指导
    • 实战 Kerberos
    • 魔改分享
  • 版本专题

    • 更新说明
    • BUG临时处理
  • 实验室

    • VIEW插件
    • JIRA速查
  • Ambari-Env

    • 环境准备
    • 开始使用
  • 组件编译

    • 专区—Ambari
    • 专区—Bigtop-官方组件
    • 专区—Bigtop-扩展组件
  • 报错解决

    • 专区—Ambari
    • 专区—Bigtop
  • 其他技巧

    • APT仓库增量更新
    • Maven镜像加速
    • Gradle镜像加速
    • Bower镜像加速
    • 虚拟环境思路
    • R环境安装+一键安装脚本
    • Ivy配置私有镜像仓库
    • Node.js 多版本共存方案
    • Ambari Web本地启动
    • Npm镜像加速
    • PostgreSQL快速安装
    • Temurin JDK 23快速安装
  • 成神之路

    • 专区—Ambari
    • 专区—Ambari-Metrics
    • 专区—Bigtop
  • 集成案例

    • Redis集成教学
    • Dolphin集成教学
    • Doris集成教学
    • 持续整理...
  • 核心代码

    • 各组件代码
    • 通用代码模板
  • 国产化&其他系统

    • Kylin V10系列
    • Rocky系列
    • Ubuntu系列
  • Grafana监控方案

    • Ambari-Metrics插件
    • Infinity插件
  • 支持&共建

    • 蓝图愿景
    • 合作共建
登陆
GitHub (opens new window)
  • Hadoop

  • Spark

  • Trino

  • Hudi

  • Paimon

  • Livy

  • Flink

  • Atlas

  • Superset

  • Jsvc

  • Zookeeper

  • Hive

  • Sqoop

  • Cloudbeaver

  • Bigtop-select

  • Knox

  • Hue

    • Hue 访问 Hadoop 权限问题
    • Hue 访问 Yarn 权限问题
    • Hue 访问 Impala 时间格式问题
      • 一、修复后的效果展示
      • 二、问题回溯:异常是如何出现的
      • 三、问题根因分析:时间格式假设失效
      • 四、定位修改点:query_api.py
      • 五、修复补丁
    • 生产环境下解决方案——Hue/query_api.py
  • 报错解决-Bigtop
  • Hue
JaneTTR
2025-12-24
目录

Hue 访问 Impala 时间格式问题

# 一、修复后的效果展示

在完成代码修复并重启 Hue 服务后,JobBrowser 中的 Impala 查询历史页面 已可正常展示,查询列表、时间列及筛选条件均恢复正常。

image-20251208134739750

可以看到:

  • 查询记录可正常加载
  • 提交时间字段格式正确
  • 页面不再出现异常提示

# 二、问题回溯:异常是如何出现的

在修复之前,访问 JobBrowser 页面时,Hue 前端资源请求均返回 200,但页面数据无法正确渲染。

Hue 后端日志中可以看到明确的异常堆栈:

[05/Dec/2025 00:50:20 -0800] access       INFO     192.168.3.116 admin - "POST /api/editor/autocomplete/default/test3/ HTTP/1.1" returned in 3835ms 200 296
[05/Dec/2025 00:50:28 -0800] access       INFO     192.168.3.116 admin - "GET /metastore/tables/default HTTP/1.1" returned in 37ms 200 42125
[05/Dec/2025 00:50:29 -0800] access       INFO     192.168.3.116 admin - "GET /static/desktop/ext/css/bootstrap-editable.0a3786b979c5.css HTTP/1.1" returned in 13ms 200 -
[05/Dec/2025 00:50:29 -0800] access       INFO     192.168.3.116 admin - "GET /static/notebook/css/notebook.14874d94c040.css HTTP/1.1" returned in 22ms 200 -
[05/Dec/2025 00:50:29 -0800] access       INFO     192.168.3.116 admin - "GET /static/beeswax/js/stats.utils.8505e7dd1d22.js HTTP/1.1" returned in 8ms 200 -
[05/Dec/2025 00:50:29 -0800] access       INFO     192.168.3.116 admin - "GET /static/metastore/css/metastore.02ebb811e438.css HTTP/1.1" returned in 17ms 200 -
[05/Dec/2025 00:50:29 -0800] access       INFO     192.168.3.116 admin - "GET /static/desktop/js/bundles/hue/tableBrowser-bundle-8c66a54b3bdb5f6ef684.25a2b4fd8225.js HTTP/1.1" returned in 13ms 200 -
[05/Dec/2025 00:50:29 -0800] access       INFO     192.168.3.116 admin - "GET /static/metastore/art/icon_metastore_48.a6dee13a6698.png HTTP/1.1" returned in 10ms 200 -
[05/Dec/2025 00:50:29 -0800] access       INFO     192.168.3.116 admin - "GET /static/beeswax/js/stats.utils.8505e7dd1d22.js HTTP/1.1" returned in 2ms 200 -
[05/Dec/2025 00:50:29 -0800] access       INFO     192.168.3.116 admin - "GET /static/desktop/js/bundles/hue/tableBrowser-bundle-8c66a54b3bdb5f6ef684.25a2b4fd8225.js HTTP/1.1" returned in 2ms 200 -
[05/Dec/2025 00:50:29 -0800] api2         ERROR    Error running <function jobs at 0x7fc1cca2f940>
Traceback (most recent call last):
  File "/usr/bigtop/current/hue/apps/jobbrowser/src/jobbrowser/api2.py", line 48, in decorator
    return func(*args, **kwargs)
  File "/usr/bigtop/current/hue/apps/jobbrowser/src/jobbrowser/api2.py", line 73, in jobs
    jobs = get_api(request.user, interface, cluster=cluster).apps(filters)
  File "/usr/bigtop/current/hue/apps/jobbrowser/src/jobbrowser/apis/query_api.py", line 83, in apps
    'apps': sorted([{
  File "/usr/bigtop/current/hue/apps/jobbrowser/src/jobbrowser/apis/query_api.py", line 99, in <listcomp>
    'submitted': datetime.strptime(job['start_time'][:-3], "%Y-%m-%d %H:%M:%S.%f").
  File "/usr/bigtop/current/hue/build/env/lib/python3.8/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/bigtop/current/hue/build/env/lib/python3.8/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '2025-12-05 16:50:16.' does not match format '%Y-%m-%d %H:%M:%S.%f'
[05/Dec/2025 00:50:29 -0800] access       INFO     192.168.3.116 admin - "POST /jobbrowser/api/jobs/queries-impala HTTP/1.1" returned in 13ms 200 106
[05/Dec/2025 00:50:29 -0800] api2         ERROR    Error running <function jobs at 0x7fc1cca2f940>
Traceback (most recent call last):
  File "/usr/bigtop/current/hue/apps/jobbrowser/src/jobbrowser/api2.py", line 48, in decorator
    return func(*args, **kwargs)
  File "/usr/bigtop/current/hue/apps/jobbrowser/src/jobbrowser/api2.py", line 73, in jobs
    jobs = get_api(request.user, interface, cluster=cluster).apps(filters)
  File "/usr/bigtop/current/hue/apps/jobbrowser/src/jobbrowser/apis/query_api.py", line 83, in apps
    'apps': sorted([{
  File "/usr/bigtop/current/hue/apps/jobbrowser/src/jobbrowser/apis/query_api.py", line 99, in <listcomp>
    'submitted': datetime.strptime(job['start_time'][:-3], "%Y-%m-%d %H:%M:%S.%f").
  File "/usr/bigtop/current/hue/build/env/lib/python3.8/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/bigtop/current/hue/build/env/lib/python3.8/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '2025-12-05 16:50:16.' does not match format '%Y-%m-%d %H:%M:%S.%f'
[05/Dec/2025 00:50:29 -0800] access       INFO     192.168.3.116 admin - "POST /jobbrowser/api/jobs/queries-impala HTTP/1.1" returned in 12ms 200 106
[05/Dec/2025 00:50:39 -0800] access       INFO     192.168.3.116 admin - "POST /jobbrowser/jobs/ HTTP/1.1" returned in 7ms 200 12
[root@dev1 logs]# vim /usr/bigtop/current/hue/apps/jobbrowser/src/jobbrowser/apis/query_api.py

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

关键特征

time data '2025-12-05 16:50:16.' does not match format '%Y-%m-%d %H:%M:%S.%f'

# 三、问题根因分析:时间格式假设失效

从异常可以直接定位到问题本质:

  • Hue JobBrowser 代码中 假定 Impala 返回的 start_time 一定包含毫秒
  • 实际 Impala 返回的时间字符串为:
2025-12-05 16:50:16.
1

该字符串具备以下特征:

项目 实际情况
时间精度 秒级
毫秒部分 缺失,仅保留 .
Hue 预期 %Y-%m-%d %H:%M:%S.%f

在这种情况下,datetime.strptime 必然抛出 ValueError,导致 JobBrowser 接口直接异常返回。

# 四、定位修改点:query_api.py

通过异常堆栈可以明确定位到问题文件:

apps/jobbrowser/src/jobbrowser/apis/query_api.py
1

对应代码位置如下图所示(时间解析相关逻辑):

image-20251226095042324

# 五、修复补丁

Subject: [PATCH] [fixed] 处理日期格式错乱问题,适配 4.11 impala
---
Index: apps/jobbrowser/src/jobbrowser/apis/query_api.py
===================================================================
diff --git a/apps/jobbrowser/src/jobbrowser/apis/query_api.py b/apps/jobbrowser/src/jobbrowser/apis/query_api.py
--- a/apps/jobbrowser/src/jobbrowser/apis/query_api.py
+++ b/apps/jobbrowser/src/jobbrowser/apis/query_api.py
@@ -96,8 +96,10 @@
-        'submitted': datetime.strptime(job['start_time'][:-3], "%Y-%m-%d %H:%M:%S.%f").
-          replace(tzinfo=pytz.utc).astimezone(localtime._get_localzone()).strftime("%Y-%m-%d %H:%M:%S.%f"),
+        'submitted': datetime.strptime(job['start_time'].split('.')[0], "%Y-%m-%d %H:%M:%S") \
+          .replace(tzinfo=pytz.utc).astimezone(localtime._get_localzone()) \
+          .strftime("%Y-%m-%d %H:%M:%S.%f"),

@@ -321,8 +323,10 @@
-      lambda app: current_ms - (time.mktime(datetime.strptime(app['start_time'][:26], '%Y-%m-%d %H:%M:%S.%f').timetuple()) * 1000)
-        < period_ms
+      lambda app: current_ms - (time.mktime(datetime.strptime(
+        app['start_time'].split('.')[0], '%Y-%m-%d %H:%M:%S'
+      ).timetuple()) * 1000)
+                < period_ms
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

修改要点

  • 统一使用 split('.') 处理毫秒缺失场景
  • 消除对字符串长度与固定格式的隐式依赖
  • 对现有逻辑影响最小,风险可控

也可以参考: 👉 生产环境下解决方案——Hue/query_api.py

#Bigtop#Hue#Impala#JobBrowser#datetime#Python
Hue 访问 Yarn 权限问题
生产环境下解决方案——Hue/query_api.py

← Hue 访问 Yarn 权限问题 生产环境下解决方案——Hue/query_api.py→

最近更新
01
xmlsectool 依赖缺失问题解析
12-24
02
webhdfs-test 依赖收敛冲突问题处理
12-24
03
Invalid keystore format 问题处理
12-24
更多文章>
Theme by Vdoing | Copyright © 2017-2025 JaneTTR | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式