热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

shcca175problem03evolveavroschema.sh

本文由编程笔记#小编为大家整理,主要介绍了sh cca175-problem-03-evolve-avro-schema.sh相关的知识,希望对你有一定的参考价值。
本文由编程笔记#小编为大家整理,主要介绍了sh cca175-problem-03-evolve-avro-schema.sh相关的知识,希望对你有一定的参考价值。




use retail;
select * from orders_avro as X where X.order_date in (
select inner.order_date from (
select Y.order_date, count(1) as total_orders
from orders_avro as Y
group by Y.order_date
order by total_orders desc, Y.order_date desc
limit 1
) i
);
// Evolve Avro Schema
// 1. Get schema file
hadoop fs -get /user/hive/schemas/order/orders.avsc
// 2. Open schema file
gedit orders.avsc
// 3. Edit schema file
{
"type" : "record",
"name" : "orders",
"doc" : "Sqoop import of orders",
"fields" : [ {
"name" : "order_id",
"type" : [ "null", "int" ],
"default" : null,
"columnName" : "order_id",
"sqlType" : "4"
}, {
"name" : "order_date",
"type" : [ "null", "long" ],
"default" : null,
"columnName" : "order_date",
"sqlType" : "93"
}, {
"name" : "order_customer_id",
"type" : [ "null", "int" ],
"default" : null,
"columnName" : "order_customer_id",
"sqlType" : "4"
},{
"name" : "order_style",
"type" : [ "null", "string" ],
"default" : null,
"columnName" : "order_style",
"sqlType" : "12"
}, {
"name" : "order_zone",
"type" : [ "null", "int" ],
"default" : null,
"columnName" : "order_zone",
"sqlType" : "4"
}, {
"name" : "order_status",
"type" : [ "null", "string" ],
"default" : null,
"columnName" : "order_status",
"sqlType" : "12"
} ],
"tableName" : "orders"
}
// 3. copy modified schema file to HDFS again
hadoop fs -copyFromLocal -f orders.avsc /user/hive/schemas/order/orders.avsc


推荐阅读
author-avatar
mobiledu2502902777
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有