在 shell 脚本中使用 Beeline 而不是 hive
Beeline usage instead of hive in shell script
在我的 shell 脚本中,我使用此查询来获取列 ID 的 last_value。
last_val=`beeline -e "select nvl(max(id),0) from testing.1_test"`
结果是
+----------+--+
| _c0 |
+----------+--+
| 3380901 |
+----------+--+
现在我想将这个值作为变量传递 ${last_val}
当我回显时 ${last_val}
我想要 3380901
但我正在接收
+----------+--+
| _c0 |
+----------+--+
| 3380901 |
+----------+--+
如何回显 3380901
.
当我像下面那样使用配置单元选项时,我得到了我想要的
last_val=`hive -e "select nvl(max(id),0) from testing.1_test"`
echo ${last_val}
给了我 3380901
请告诉我该怎么做?
last_val=`beeline --showHeader=false --outputformat=tsv2 -e "select nvl(max(id),0) from testing.1_test"`
在我的 shell 脚本中,我使用此查询来获取列 ID 的 last_value。
last_val=`beeline -e "select nvl(max(id),0) from testing.1_test"`
结果是
+----------+--+
| _c0 |
+----------+--+
| 3380901 |
+----------+--+
现在我想将这个值作为变量传递 ${last_val}
当我回显时 ${last_val}
我想要 3380901
但我正在接收
+----------+--+
| _c0 |
+----------+--+
| 3380901 |
+----------+--+
如何回显 3380901
.
当我像下面那样使用配置单元选项时,我得到了我想要的
last_val=`hive -e "select nvl(max(id),0) from testing.1_test"`
echo ${last_val}
给了我 3380901
请告诉我该怎么做?
last_val=`beeline --showHeader=false --outputformat=tsv2 -e "select nvl(max(id),0) from testing.1_test"`