用于配置错误的配置单元查询的bash脚本

时间:2014-03-14 06:13:46

标签: sql bash hive

我正在尝试执行包含配置单元查询的bashcript。但是,当我执行脚本时,它显示找不到raw_datacentral表。我已经在蜂巢中有这些表。下面是bash脚本。请提出错误的建议。

#!/bin/bash
hive -e 
        "CREATE TEMPORARY FUNCTION rowSequence AS 'com.hive.udf.UDFRowSequence'; "
hive -e "
        create table staging (id String,speed String,time String,time_id int);"
hive -e "
        insert into table staging select marker.marker.id,
     marker.marker.speed ,
     marker.marker.time as time,
     rowSequence() as time_id
     from raw_data
     lateral view explode (raw_data.markers.marker)marker as marker;"
hive -e "
        create table processed (plc string,direction string,table int,speed string,time_id string,day int);"
hive -e "
        insert into table processed select c.plc,c.direction,c.table,t.speed as speed,t.time_id,0 from central c JOIN staging t ON (t.id = c.boxno);"

1 个答案:

答案 0 :(得分:0)

包括使用[databasename]

例如..

  

hive -e“use dummy_database; create table staging(id String,speed   String,time String,time_id int);“

     

hive -e“使用dummy_database;插入表分段选择   marker.marker.id,            marker.marker.speed,        marker.marker.time作为时间,        rowSequence()as time_id        来自raw_data        侧视图将(raw_data.markers.marker)标记作为标记;“