zoukankan      html  css  js  c++  java
  • hive 查询注意问题

    1)对于hive内置的列,不是自己建的,在查询的时候需要添加反引号` 比如:`_mt_message`,别在这里犯错误,

    (2)南京的_mt_message是json的格式,所以可以直接使用:get_json_object(`_mt_message`,'$.Flag')

    南京的:

    代码块
     
     
     
     
     
     
    {"EngineId":"90927395","GPSBrand":"伴车星","OwnerName":"南京壹健汽车租赁有限公司","FeePrintId":"757012490408","VehicleNo":"苏A88H7J","Address":320100,"GPSModel":"ET02D","TransDateStart":20170703,"CheckState":"1","GPSInstallDate":20151113,"TransAgency":"南京市道路运输管理局","FuelType":"A","CertifyDateB":20170703,"FixState":"1","CertifyDateA":20181228,"CompanyId":"33030009","FareType":"222-c-1-1","VehicleType":"小型汽车","RegisterDate":20180911,"TransArea":"南京","Flag":2,"Seats":5,"Brand":"荣威","PhotoId":"https://p0.meituan.net/dache/238553418911c6fb51cfa160211199222613832.jpg@1500h?token=1.1545927117.dache.a605eb5b9dfbf5c0ccaf6ea2ba4a8a01","CommercialType":1,"driverId":195139349,"VehicleColor":"白色","State":0,"Model":"i6","UpdateTime":20181228000337,"PlateColor":"1","VIN":"50D65D3FF6C241192","EngineDisplace":"1600","TransDateStop":20210701}
     

    但是上海的不是:

    代码块
     
     
     
     
     
     
    3 shanghai{"EngineId":"90927395","GPSBrand":"伴车星","OwnerName":"南京壹健汽车租赁有限公司","FeePrintId":"757012490408","VehicleNo":"苏A88H7J","Address":320100,"GPSModel":"ET02D","TransDateStart":20170703,"CheckState":"1","GPSInstallDate":20151113,"TransAgency":"南京市道路运输管理局","FuelType":"A","CertifyDateB":20170703,"FixState":"1","CertifyDateA":20181228,"CompanyId":"33030009","FareType":"222-c-1-1","VehicleType":"小型汽车","RegisterDate":20180911,"TransArea":"南京","Flag":2,"Seats":5,"Brand":"荣威","PhotoId":"https://p0.meituan.net/dache/238553418911c6fb51cfa160211199222613832.jpg@1500h?token=1.1545927117.dache.a605eb5b9dfbf5c0ccaf6ea2ba4a8a01","CommercialType":1,"driverId":195139349,"VehicleColor":"白色","State":0,"Model":"i6","UpdateTime":20181228000337,"PlateColor":"1","VIN":"50D65D3FF6C241192","EngineDisplace":"1600","TransDateStop":20210701}
     

    所以上海的在查询的话应该先截取,然后在get_json_object();

    如下:

    代码块
     
     
     
     
     
     
     select get_json_object(substr(`_mt_message`,11),'$.PhotoId') from log.qcs_regulation_shanghai where dt='20181228' and msgtype='baseInfoVehicle'   
     
     
     
     
     
     
     
    select * from log.qcs_regulation_shanghai where dt='20181120' limit 10;
     

    查询南京订单成功上传数据总量

  • 相关阅读:
    PowerDesigner 找不到Identity列的解决方法
    C# DataTable 和List之间相互转换的方法
    解决Win8无法升级.NET Framework 3.5.1 提示错误0x800F0906
    C#虚方法和抽象方法区别
    VS自带WCF测试客户端
    asp.net读取Excel数据
    输出用户的IP地址,并且判断用户的IP地址是否在192.168.1.100 --- 192.168.1.150之间
    验证电子邮箱正则表达式
    用PHP实现冒泡排序将数组$a=array()按照从小到大的方式排序
    打开a.txt文件在文件中最前面加上hello
  • 原文地址:https://www.cnblogs.com/aspirant/p/10197281.html
Copyright © 2011-2022 走看看