shell - 为什么我的直线自动化脚本没有将数据加载到历史配置单元表?
问题描述
我有一个 shell 脚本,它可以自动执行 beeline 实用程序来执行以下操作:
截断登台表 将数据加载到登台表追加历史表。
到目前为止,一切都很好。我的代码是截断数据并将数据加载到声明表中,但它没有将任何数据附加到历史表中。因为当我发出命令“ select count(*) from history_tbl
”时。我在直线中得到 0 条记录。
+------+--+
| _c0 |
+------+--+
| 0 |
+------+--+
令人惊讶的是,当我执行“ select * from history_tbl;
”时,我会看到实际数据
| "601809196400"|2018-09-19|"default"|"19"|2018-09-24 08:07:36|0.181156|0.514380|0.033541|0.171328|0.035591|0.064005|0|"df"|
"SYSTEM"|"A3"|"LT40"|"OTH"|"1_1day"|"TRADE"|"NA"|"Z_S"|"40-55"|"M"|"2"|0|"8_14"|0|"N"|"Unilateral
| left knee"|""|"SYSTEM"|142|0|0.400000|"UN"|1|"9111"|"6"|"S"|53|"M"|23700.000000|"N"|13|"M"||"rico
"|"zuba"|"BY "|"chris
"|"2023-07-30"|0|"PR" | NULL| NULL| NUL| NULL| NULL | NU
我真的对这个特征感到困惑。
下面是shell脚本。
#!/bin/bash
timestamp=$(date +%Y-%m-%d-%H:%M:%S:%N)
number=$RANDOM
unix_time=$(date +%Y-%m-%d-%H:%M:%S)
cd path to script
export BEELINE_PREFIX='"jdbc:hive2://server:port,server:port,server:port/;serviceDiscoveryMode=zookeeper;zookeeperNamespace=hiveserver2;principal=hive/server@hello.COM"'
beeline -u $BEELINE_PREFIX -e "use next;"
echo "truncating the staging table tbl..."
beeline -u $BEELINE_PREFIX -e "TRUNCATE TABLE next.tbl;"
echo "Loading the data in staging table tbl"
beeline -u $BEELINE_PREFIX -e "LOAD DATA LOCAL INPATH '/path/tbl' INTO TABLE next.tbl;"
echo "Appending the data into history table HIST_tbl.."
beeline -u $BEELINE_PREFIX -e "insert into table next.HIST_tbl select *,'$unix_time','$number' from next.tbl;"
解决方案
推荐阅读
- cmake - 在 Ubuntu 上安装和附加 Make?
- python - ValueError:通过 X 的项目数量错误,位置暗示 Y
- android - 引起:java.lang.IllegalArgumentException:没有注入器工厂绑定到类
- python - tensorfow serving 是否计划支持python api?
- java - FirebaseInstaceId、InstanceIdResult 已弃用
- javascript - 等待异步函数阻塞主线程
- python - browsermob 是否适用于原生 android 应用程序?
- codeigniter-3 - ci中的基本url方法
- sql-server-2012 - 将 SQL Server 2012 Enterprise MDF/NDF 迁移到 SQL Server 2016 Standard
- r - 如何使用极坐标自定义 echarts4r 条形图的颜色?