@@ -31,11 +31,10 @@ To download a copy of the source code, click "Download ZIP" on the right side of
3131
3232## Dependencies
3333* Microsoft Azure DocumentDB Java SDK 0.9.3 (com.microsoft.azure / azure-documentdb / 0.9.3)
34- </ br >
34+
3535When using Hive:
3636* OpenX Technologies JsonSerde 1.3.1-SNAPSHOT (org.openx.data / json-serde-parent / 1.3.1-SNAPSHOT)
37- </br >
38- GitHub repo [ here] ( https://github.com/rcongiu/Hive-JSON-Serde )
37+ GitHub repo can be found [ here] ( https://github.com/rcongiu/Hive-JSON-Serde )
3938
4039Please download the jars and add them to your build path.
4140
@@ -46,93 +45,78 @@ To use this client library with Azure DocumentDB, you need to first [create an a
4645###MapReduce
4746
4847#####Configuring input and output from DocumentDB Example
49- <p >
50- <d1 >
51- <dt >*// Import Hadoop Connector Classes*</dt >
52- <dt >**import** com.microsoft.azure.documentdb.Document;</dt >
53- <dt >**import** com.microsoft.azure.documentdb.hadoop.ConfigurationUtil;</dt >
54- <dt >**import** com.microsoft.azure.documentdb.hadoop.DocumentDBInputFormat;</dt >
55- <dt >**import** com.microsoft.azure.documentdb.hadoop.DocumentDBOutputFormat;</dt >
56- <dt >**import** com.microsoft.azure.documentdb.hadoop.DocumentDBWritable;</dt >
57- </d1 >
58- </p >
59- <p >
60- <d1 >
61- <dt >*// Set Configurations*</dt >
62- <dt >**Configuration** conf = new Configuration();</dt >
63- <dt >**final String** host = "*Your DocumentDB Endpoint*";</dt >
64- <dt >**final String** key = "*Your DocumentDB Primary Key*";</dt >
65- <dt >**final String** dbName = "*Your DocumentDB Database Name*";</dt >
66- <dt >**final String** inputCollNames = "*Your DocumentDB Input Collection Name[s]*";</dt >
67- <dt >**final String** outputCollNames = "*Your DocumentDB Output Collection Name[s]*";</dt >
68- <dt >**final String** query = "*Your DocumentDB Query*";</dt >
69- <br />
70- <dt >conf.set(ConfigurationUtil.DB_HOST, host);</dt >
71- <dt >conf.set(ConfigurationUtil.DB_KEY, key);</dt >
72- <dt >conf.set(ConfigurationUtil.DB_NAME, dbName);</dt >
73- <dt >conf.set(ConfigurationUtil.INPUT_COLLECTION_NAMES, inputCollNames);</dt >
74- <dt >conf.set(ConfigurationUtil.OUTPUT_COLLECTION_NAMES, outputCollNames);</dt >
75- <dt >conf.set(ConfigurationUtil.QUERY, query);</dt >
76- </d1 >
77- </p >
48+ ``` Java
49+ // Import Hadoop Connector Classes
50+ import com.microsoft.azure.documentdb.Document ;
51+ import com.microsoft.azure.documentdb.hadoop.ConfigurationUtil ;
52+ import com.microsoft.azure.documentdb.hadoop.DocumentDBInputFormat ;
53+ import com.microsoft.azure.documentdb.hadoop.DocumentDBOutputFormat ;
54+ import com.microsoft.azure.documentdb.hadoop.DocumentDBWritable ;
55+
56+ // Set Configurations
57+ Configuration conf = new Configuration ();
58+ final String host = " Your DocumentDB Endpoint" ;
59+ final String key = " Your DocumentDB Primary Key" ;
60+ final String dbName = " Your DocumentDB Database Name" ;
61+ final String inputCollNames = " Your DocumentDB Input Collection Name[s]" ;
62+ final String outputCollNames = " Your DocumentDB Output Collection Name[s]" ;
63+ final String query = " Your DocumentDB Query" ;
64+
65+ conf. set(ConfigurationUtil . DB_HOST , host);
66+ conf. set(ConfigurationUtil . DB_KEY , key);
67+ conf. set(ConfigurationUtil . DB_NAME , dbName);
68+ conf. set(ConfigurationUtil . INPUT_COLLECTION_NAMES , inputCollNames);
69+ conf. set(ConfigurationUtil . OUTPUT_COLLECTION_NAMES , outputCollNames);
70+ conf. set(ConfigurationUtil . QUERY , query);
71+ ```
7872
7973Full MapReduce sample can be found [ here] ( ) .
8074
8175###Hive
8276#####Loading data from DocumentDB Example
83- <p >
84- <d1 >
85- <dt >**CREATE EXTERNAL TABLE** *DocumentDB_Hive_Table*( *COLUMNS* ) </dt >
86- <dt >**STORED BY** 'com.microsoft.azure.documentdb.hive.DocumentDBStorageHandler' </dt >
87- <dt >tblproperties ( </dt >
88- <dd >'DocumentDB.endpoint' = '*Your DocumentDB Endpoint*', </dd >
89- <dd >'DocumentDB.key' = '*Your DocumentDB Primary Key*', </dd >
90- <dd >'DocumentDB.db' = '*Your DocumentDB Database Name*', </dd >
91- <dd >'DocumentDB.inputCollections' = '*Your DocumentDB Input Collection Name[s]*', </dd >
92- <dd >'[Optional] DocumentDB.query' = '[Optional] *Your DocumentDB Query*' );</dd >
93- </d1 >
94- </p >
77+ ``` Java
78+ CREATE EXTERNAL TABLE DocumentDB_Hive_Table( COLUMNS )
79+ STORED BY ' com.microsoft.azure.documentdb.hive.DocumentDBStorageHandler'
80+ tblproperties (
81+ ' DocumentDB.endpoint' = ' Your DocumentDB Endpoint' ,
82+ ' DocumentDB.key' = ' Your DocumentDB Primary Key' ,
83+ ' DocumentDB.db' = ' Your DocumentDB Database Name' ,
84+ ' DocumentDB.inputCollections' = ' Your DocumentDB Input Collection Name[s]' ,
85+ ' [Optional] DocumentDB.query' = ' [Optional] Your DocumentDB Query' );
86+ ```
9587
9688#####Storing data to DocumentDB Example
97- <p >
98- <d1 >
99- <dt >**CREATE EXTERNAL TABLE** *Hive_DocumentDB_Table*( *COLUMNS* )</dt >
100- <dt >**STORED BY** 'com.microsoft.azure.documentdb.hive.DocumentDBStorageHandler' </dt >
101- <dt >tblproperties ( </dt >
102- <dd >'DocumentDB.endpoint' = '*Your DocumentDB Endpoint*', </dd >
103- <dd >'DocumentDB.key' = '*Your DocumentDB Primary Key*', </dd >
104- <dd >'DocumentDB.db' = '*Your DocumentDB Database Name*', </dd >
105- <dd >'DocumentDB.outputCollections' = '*Your DocumentDB Output Collection Name[s]*' ); </dd >
106- <dt >**INSERT INTO TABLE** *Hive_DocumentDB_Table* </dt >
107- </d1 >
108- </p >
109-
89+ ``` Java
90+ CREATE EXTERNAL TABLE Hive_DocumentDB_Table( COLUMNS )
91+ STORED BY ' com.microsoft.azure.documentdb.hive.DocumentDBStorageHandler'
92+ tblproperties (
93+ ' DocumentDB.endpoint' = ' Your DocumentDB Endpoint' ,
94+ ' DocumentDB.key' = ' Your DocumentDB Primary Key' ,
95+ ' DocumentDB.db' = ' Your DocumentDB Database Name' ,
96+ ' DocumentDB.outputCollections' = ' Your DocumentDB Output Collection Name[s]' );
97+ INSERT INTO TABLE Hive_DocumentDB_Table
98+ ```
11099Full Hive sample can be found [ here] ( ) .
111100
112101###Pig
113102#####Loading data from DocumentDB Example
114- <p >
115- <d1 >
116- <dt >**LOAD** '*Your DocumentDB Endpoint*' </dt >
117- <dt >**USING** com.microsoft.azure.documentdb.hadoop.pig.DocumentDBLoader( </dt >
118- <dd >'*Your DocumentDB Primary Key*', </dd >
119- <dd >'*Your DocumentDB Database Name*',</dd >
120- <dd >'*Your DocumentDB Input Collection Name[s]*',</dd >
121- <dd >'[Optional] *Your DocumentDB SQL Query*' ); </dd >
122- </d1 >
123- </p >
103+ ``` Java
104+ LOAD ' Your DocumentDB Endpoint'
105+ USING com.microsoft.azure.documentdb.hadoop.pig. DocumentDBLoader (
106+ ' Your DocumentDB Primary Key' ,
107+ ' Your DocumentDB Database Name' ,
108+ ' Your DocumentDB Input Collection Name[s]' ,
109+ ' [Optional] Your DocumentDB SQL Query' );
110+ ```
124111
125112#####Storing data to DocumentDB Example
126- <p >
127- <d1 >
128- <dt >**STORE** *data* **INTO** '*DocumentDB Endpoint*' </dt >
129- <dt >**USING** com.microsoft.azure.documentdb.hadoop.pig.DocumentDBStorage( </dt >
130- <dd >'*DocumentDB Primary Key*',</dd >
131- <dd >'*DocumentDB Database Name*',</dd >
132- <dd >'*DocumentDB Output Collection Name[s]*' ); </dd >
133- </d1 >
134- </p >
135-
113+ ``` Java
114+ STORE data INTO ' DocumentDB Endpoint'
115+ USING com.microsoft.azure.documentdb.hadoop.pig. DocumentDBStorage (
116+ ' DocumentDB Primary Key' ,
117+ ' DocumentDB Database Name' ,
118+ ' DocumentDB Output Collection Name[s]' );
119+ ```
136120Full Pig sample can be found [ here] ( ) .
137121
138122##Remarks
@@ -155,4 +139,4 @@ If you encounter any bugs with the library please file an issue in the [Issues](
155139* [ Official Hadoop Documentation] ( http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/ClusterSetup.html )
156140* [ Azure Developer Center] ( http://azure.microsoft.com/en-us/develop/java/ )
157141* [ Azure DocumentDB Service] ( http://azure.microsoft.com/en-us/documentation/services/documentdb/ )
158- * [ Azure DocumentDB Team Blog] ( http://blogs.msdn.com/b/documentdb/ )
142+ * [ Azure DocumentDB Team Blog] ( http://blogs.msdn.com/b/documentdb/ )
0 commit comments