drill 表&&视图使用

1.  table 
 
  1. create table table_name as select * from storage_name.dbname.tablename
 
2. view
 
  1. create view view_name as select * from storage_name.dbname.tablename
 
3. 注意问题
 
如果需要进行存储,对应的storage 必须是可写的,不然会提示错误。
比如:默认的dfs 配置
  1. "root":{
  2. "location":"/",
  3. "writable":false,
  4. "defaultInputFormat":null
  5. },
  6. "tmp":{
  7. "location":"/tmp",
  8. "writable":true,
  9. "defaultInputFormat":null
  10. }
  11. },
只能在dfs.tmp 下进行view table 创建,其他地方不行
hadoop 类似如下:
 
  1. "root":{
  2. "location":"/",
  3. "writable":false,
  4. "defaultInputFormat":null
  5. },
  6. "userapps":{
  7. "location":"/userapps",
  8. "writable":true,
  9. "defaultInputFormat":null
  10. },
  11. "tmp":{
  12. "location":"/tmp",
  13. "writable":true,
  14. "defaultInputFormat":null
  15. }
其中userapps 是自己手工创建的同时设置可写,这样查询分析的数据就可以存储到hadoop ,
方便后期的查询,归档。
原文地址:https://www.cnblogs.com/rongfengliang/p/6940912.html