博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Apache Kylin 2.3 样例分析
阅读量:2388 次
发布时间:2019-05-10

本文共 4354 字,大约阅读时间需要 14 分钟。

网上没有找到Apache Kylin 2.3相关的样子,只好参考Apache Kylin 1.x 相关例子,但是运行报错。只好自己慢慢排查,下面做个记录。

select sum(price) as total_price  from kylin_sales kswhere ks.part_dt between '2013-12-01' and '2013-12-31'

这里写图片描述

select sum(price) as total_price  from kylin_sales kswhere ks.part_dt between '2013-12-01' and '2013-12-31' and ks.region = 'Shanghai'

错误信息

From line 2, column 63 to line 2, column 68: Column 'REGION' not found in table 'KS' while executing SQL: "select sum(price) as total_price from kylin_sales ks where ks.part_dt between '2013-12-01' and '2013-12-31' and ks.region = 'Shanghai'"

查看日志

[root@node1 logs]# vi kylin.log
Message: From line 2, column 81 to line 2, column 86: Column 'REGION' not found in table 'KYLIN_SALES'while executing SQL: "select sum(price) as total_price  from kylin_sales  where kylin_sales.part_dt between '2013-12-01' and '2013-12-31' and kylin_sales.region = 'Shanghai' LIMIT 50000"==========================[QUERY]===============================2018-05-31 09:17:44,366 ERROR [http-bio-7070-exec-1] controller.BasicController:61 :org.apache.kylin.rest.exception.InternalErrorException: From line 2, column 81 to line 2, column 86: Column 'REGION' not found in table 'KYLIN_SALES'while executing SQL: "select sum(price) as total_price  from kylin_sales  where kylin_sales.part_dt between '2013-12-01' and '2013-12-31' and kylin_sales.region = 'Shanghai' LIMIT 50000"        at org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:474)        at org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:390)        at org.apache.kylin.rest.controller.QueryController.query(QueryController.java:86)        at sun.reflect.GeneratedMethodAccessor178.invoke(Unknown Source)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)        at java.lang.reflect.Method.invoke(Method.java:498)        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)

通过日志分析可知,kylin_sales数据表不存在region字段。

查看表结构,确实没有region字段,已经更名为ops_region

hive> desc  kylin_sales ;OKtrans_id                bigint                                      part_dt                 date                    Order Date          lstg_format_name        string                  Order Transaction Typeleaf_categ_id           bigint                  Category ID         lstg_site_id            int                     Site ID             slr_segment_cd          smallint                                    price                   decimal(19,4)           Order Price         item_count              bigint                  Number of Purchased Goodsseller_id               bigint                  Seller ID           buyer_id                bigint                  Buyer ID            ops_user_id             string                  System User ID      ops_region              string                  System User Region  Time taken: 1.693 seconds, Fetched: 12 row(s)hive>

重新执行

select sum(price) as total_price  from kylin_sales kswhere ks.part_dt between '2013-12-01' and '2013-12-31' and ks.ops_region = 'Shanghai'

这里写图片描述

其他例子

select count(distinct seller_id) as total_sellers from kylin_sales

这里写图片描述

select seller_id, sum(price) as total_price from kylin_sales group by seller_id order by sum(price) desc

这里写图片描述

select count(*) as order_amount from kylin_sales where lstg_site_id = 0

这里写图片描述

你可能感兴趣的文章
Angular4中调用js代码
查看>>
JAVA8-用lamda表达式和增强版Comparator进行排序
查看>>
spring boot 2.0 使用Hikari连接池——号称java平台最快的,替换druid
查看>>
GnuPG Java Wrapper API - Sample code
查看>>
HTTP Cache 总结及Nginx Cache配置
查看>>
基于现有 TensorFlow 模型构建 Android 应用
查看>>
Building an Ionic OCR App with Tesseract
查看>>
Spring boot with Apache Hive
查看>>
使用awr来诊断数据库性能问题
查看>>
exp-00056 exp-00000 导出终止失败的处理
查看>>
Linux中两块device的minor number相同而造成RAC不能启动的问题
查看>>
DM7修改数据库参数
查看>>
Oracle ASM Partnership and Status Table
查看>>
Oracle 12CR2 Oracle Restart - ASM Startup fails with PRCR-1079
查看>>
In-Memory Column Store
查看>>
Oracle 12C ASM asmcmd amdu_extract
查看>>
Oracle AMDU- ASM Metadata Dump Utility
查看>>
C/C++程序中的profile
查看>>
一个更好的Post process结构,三角形代替四边形。
查看>>
利用Vertex shader实现Point Sprites
查看>>