有沒有一種方法可以使用SerDe創建一個Hive外部表,其位置指向Azure存儲,這樣可以使數據使用最少數量的Blob。例如,如果插入10000條記錄,我希望它創建100個頁面blob,每個100行記錄,而不是10000個,每個記錄1條記錄。我正在從blob序列化,所以更少的blob將需要更少的時間。什麼是蜂巢中最優化的格式?具有Azure Blob存儲的Hive外部表
-1
A
回答
0
首先,有一種方法可以使用Serde和localtion指向Azure Blob存儲創建Hive外部表,但不直接,請參閱下面的HiveQL部分Create Hive database and tables
。
create database if not exists <database name>;
CREATE EXTERNAL TABLE if not exists <database name>.<table name>
(
field1 string,
field2 int,
field3 float,
field4 double,
...,
fieldN string
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '<field separator>' lines terminated by '<line separator>'
STORED AS TEXTFILE LOCATION '<storage location>' TBLPROPERTIES("skip.header.line.count"="1");
並重點解釋以下內容<storage location>
。
<storage location>
:所述Azure存儲位置來保存蜂房表的數據。如果您未指定LOCATION,則缺省情況下,數據庫和表將存儲在Hive集羣的默認容器中的hive/warehouse /目錄中。如果要指定存儲位置,則存儲位置必須位於數據庫和表的默認容器內。此位置必須以「wasb:///<directory 1>/
」或「wasb:///<directory 1>/<directory 2>/
」等格式的相對於羣集默認容器的位置引用。執行查詢後,將在默認容器內創建相關目錄。
因此,這意味着您可以通過協議,該協議要求hadoop-azure
庫,支持Azure存儲Hadoop的HDFS的訪問對蜂巢訪問Azure的Blob存儲位置。如果您的Hadoop Hadoop未部署在Azure上,則需要參考Hadoop官方文檔Hadoop Azure Support: Azure Blob Storage
進行配置。
對於使用serde,它取決於您使用的文件格式,如orc文件格式,hql代碼使用OrcSerde
,如下所示。
CREATE EXTERNAL TABLE IF NOT EXSISTS <table name> (<column_name column_type>, ...)
ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
STORED AS ORC
LOCATION '<orcfile path>'
對於第二種,最佳格式是Hive中的ORC File Format
。
相關問題
- 1. 在Blob存儲在Azure的SQL(不Azure的SQL DW)外部表
- 2. Azure Blob存儲列表Blob
- 3. Impala創建外部表,由Hive存儲
- 4. 刪除內部Hive表不會刪除底層Azure Blob存儲的內容
- 5. Azure的Blob存儲
- 6. Azure blob存儲 - blob策略
- 7. Azure DocumentDB和Azure Blob存儲
- 8. Azure blob存儲SAS
- 9. node.js azure存儲blob
- 10. 在Azure的Blob存儲
- 11. Azure的Blob存儲下載
- 12. Interupting從Azure的Blob存儲
- 13. asp.net的Windows Azure Blob存儲
- 14. 存儲在Azure的Blob存儲
- 15. Azure表存儲增量備份到Azure存儲Blob
- 16. 面向具有sFTP服務的Azure存儲blob
- 17. Azure存儲將Blob分析到表中
- 18. Azure Blob不存儲PDF
- 19. CNAME與Azure Blob存儲
- 20. 上傳到azure blob存儲
- 21. Azure存儲Blob -com.microsoft.azure.storage.core.Utility錯誤
- 22. Azure blob存儲和安全
- 23. Appassure和Azure Blob存儲
- 24. ImageResizer與Azure Blob存儲Azurewebsites
- 25. 流星和Azure Blob存儲
- 26. Azure blob存儲;派生列
- 27. Azure blob存儲和CDN
- 28. Azure Blob存儲打印所有文件
- 29. Azure Blob存儲和Azure驅動器
- 30. 緩存到Azure的Blob存儲