Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit514477f

Browse files
AbstractSerDe class rather than obsolete SerDe interface (#131)
1 parented81d45 commit514477f

File tree

5 files changed

+112
-40
lines changed

5 files changed

+112
-40
lines changed

‎hive/src/main/java/com/esri/hadoop/hive/serde/BaseJsonSerDe.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
importorg.apache.commons.logging.Log;
1212
importorg.apache.commons.logging.LogFactory;
1313
importorg.apache.hadoop.conf.Configuration;
14-
importorg.apache.hadoop.hive.serde2.SerDe;
14+
importorg.apache.hadoop.hive.serde2.AbstractSerDe;
1515
importorg.apache.hadoop.hive.serde2.SerDeException;
1616
importorg.apache.hadoop.hive.serde2.SerDeStats;
1717
importorg.apache.hadoop.hive.serde2.io.ByteWritable;
@@ -48,7 +48,7 @@
4848
importcom.esri.hadoop.shims.HiveShims;
4949

5050

51-
abstractpublicclassBaseJsonSerDeimplementsSerDe {
51+
abstractpublicclassBaseJsonSerDeextendsAbstractSerDe {
5252
staticfinalLogLOG =LogFactory.getLog(BaseJsonSerDe.class.getName());
5353

5454
staticprotectedJsonFactoryjsonFactory =newJsonFactory();

‎hive/src/test/java/com/esri/hadoop/hive/serde/JsonSerDeTestingBase.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
importorg.junit.Assert;
44
importjava.util.ArrayList;
55

6-
importorg.apache.hadoop.hive.serde2.SerDe;
6+
importorg.apache.hadoop.hive.serde2.AbstractSerDe;
77
importorg.apache.hadoop.hive.serde2.io.ByteWritable;
88
importorg.apache.hadoop.hive.serde2.io.DoubleWritable;
99
importorg.apache.hadoop.hive.serde2.io.DateWritable;
@@ -82,7 +82,7 @@ protected Object getField(String col, Object row, StructObjectInspector rowOI) {
8282
returnrowOI.getStructFieldData(row,f0);
8383
}
8484

85-
protectedObjectrunSerDe(Objectstuff,SerDejserde,StructObjectInspectorrowOI)throwsException {
85+
protectedObjectrunSerDe(Objectstuff,AbstractSerDejserde,StructObjectInspectorrowOI)throwsException {
8686
Writablejsw =jserde.serialize(stuff,rowOI);
8787
//System.err.println(jsw);
8888
returnjserde.deserialize(jsw);

‎hive/src/test/java/com/esri/hadoop/hive/serde/TestEsriJsonSerDe.java‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
importjava.util.ArrayList;
77
importjava.util.Properties;
88
importorg.apache.hadoop.conf.Configuration;
9-
importorg.apache.hadoop.hive.serde2.SerDe;
9+
importorg.apache.hadoop.hive.serde2.AbstractSerDe;
1010
importorg.apache.hadoop.hive.serde2.io.ByteWritable;
1111
importorg.apache.hadoop.hive.serde2.io.DateWritable;
1212
importorg.apache.hadoop.hive.serde2.io.ShortWritable;
@@ -47,7 +47,7 @@ public void TestIntWrite() throws Exception {
4747
Propertiesproptab =newProperties();
4848
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"num");
4949
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"int");
50-
SerDejserde =mkSerDe(proptab);
50+
AbstractSerDejserde =mkSerDe(proptab);
5151
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
5252

5353
// {"attributes":{"num":7}}
@@ -65,7 +65,7 @@ public void TestEpochWrite() throws Exception {
6565
Propertiesproptab =newProperties();
6666
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"when");
6767
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"date");
68-
SerDejserde =mkSerDe(proptab);
68+
AbstractSerDejserde =mkSerDe(proptab);
6969
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
7070

7171
// {"attributes":{"when":147147147147}}
@@ -87,7 +87,7 @@ public void TestTimeWrite() throws Exception {
8787
Propertiesproptab =newProperties();
8888
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"when");
8989
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"timestamp");
90-
SerDejserde =mkSerDe(proptab);
90+
AbstractSerDejserde =mkSerDe(proptab);
9191
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
9292

9393
// {"attributes":{"when":147147147147}}
@@ -108,7 +108,7 @@ public void TestPointWrite() throws Exception {
108108
Propertiesproptab =newProperties();
109109
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"shape");
110110
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"binary");
111-
SerDejserde =mkSerDe(proptab);
111+
AbstractSerDejserde =mkSerDe(proptab);
112112
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
113113

114114
// {"attributes":{},"geometry":{"x":15.0,"y":5.0}}
@@ -126,7 +126,7 @@ public void TestIntParse() throws Exception {
126126
Configurationconfig =newConfiguration();
127127
Textvalue =newText();
128128

129-
SerDejserde =newEsriJsonSerDe();
129+
AbstractSerDejserde =newEsriJsonSerDe();
130130
Propertiesproptab =newProperties();
131131
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"num");
132132
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"int");
@@ -151,7 +151,7 @@ public void TestDateParse() throws Exception {
151151
Configurationconfig =newConfiguration();
152152
Textvalue =newText();
153153

154-
SerDejserde =newEsriJsonSerDe();
154+
AbstractSerDejserde =newEsriJsonSerDe();
155155
Propertiesproptab =newProperties();
156156
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"when");
157157
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"date");
@@ -176,7 +176,7 @@ public void TestEpochParse() throws Exception {
176176
Configurationconfig =newConfiguration();
177177
Textvalue =newText();
178178

179-
SerDejserde =newEsriJsonSerDe();
179+
AbstractSerDejserde =newEsriJsonSerDe();
180180
Propertiesproptab =newProperties();
181181
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"when");
182182
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"date");
@@ -203,7 +203,7 @@ public void TestTimeParse() throws Exception {
203203
Configurationconfig =newConfiguration();
204204
Textvalue =newText();
205205

206-
SerDejserde =newEsriJsonSerDe();
206+
AbstractSerDejserde =newEsriJsonSerDe();
207207
Propertiesproptab =newProperties();
208208
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"when");
209209
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"timestamp");
@@ -242,7 +242,7 @@ public void TestPointParse() throws Exception {
242242
Configurationconfig =newConfiguration();
243243
Textvalue =newText();
244244

245-
SerDejserde =newEsriJsonSerDe();
245+
AbstractSerDejserde =newEsriJsonSerDe();
246246
Propertiesproptab =newProperties();
247247
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"shape");
248248
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"binary");
@@ -268,7 +268,7 @@ public void TestIntOnly() throws Exception {
268268
Propertiesproptab =newProperties();
269269
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"num");
270270
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"int");
271-
SerDejserde =mkSerDe(proptab);
271+
AbstractSerDejserde =mkSerDe(proptab);
272272
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
273273

274274
addWritable(stuff,7);
@@ -289,7 +289,7 @@ public void TestPointOnly() throws Exception {
289289
Propertiesproptab =newProperties();
290290
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"shape");
291291
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"binary");
292-
SerDejserde =mkSerDe(proptab);
292+
AbstractSerDejserde =mkSerDe(proptab);
293293
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
294294

295295
//value.set("{\"attributes\":{},\"geometry\":{\"x\":15.0,\"y\":5.0}}");
@@ -312,7 +312,7 @@ public void TestIntPoint() throws Exception {
312312
Propertiesproptab =newProperties();
313313
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"num,shape");
314314
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"bigint,binary");
315-
SerDejserde =mkSerDe(proptab);
315+
AbstractSerDejserde =mkSerDe(proptab);
316316
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
317317

318318
//value.set("{\"attributes\":{\"num\":7},\"geometry\":{\"x\":15.0,\"y\":5.0}}");
@@ -339,7 +339,7 @@ public void TestNullAttr() throws Exception {
339339
Propertiesproptab =newProperties();
340340
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"num");
341341
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"int");
342-
SerDejserde =mkSerDe(proptab);
342+
AbstractSerDejserde =mkSerDe(proptab);
343343
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
344344

345345
//value.set("{\"attributes\":{\"num\":7}}");
@@ -360,7 +360,7 @@ public void TestNullGeom() throws Exception {
360360
Propertiesproptab =newProperties();
361361
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"shape");
362362
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"binary");
363-
SerDejserde =mkSerDe(proptab);
363+
AbstractSerDejserde =mkSerDe(proptab);
364364
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
365365

366366
//value.set("{\"attributes\":{},\"geometry\":{\"x\":15.0,\"y\":5.0}}");
@@ -382,7 +382,7 @@ public void TestColumnTypes() throws Exception {
382382
Propertiesproptab =newProperties();
383383
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"flag,num1,num2,text");
384384
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"boolean,tinyint,smallint,string");
385-
SerDejserde =mkSerDe(proptab);
385+
AbstractSerDejserde =mkSerDe(proptab);
386386
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
387387

388388
// {"attributes":{"flag":false,"num":"5","text":"Point(15.0 5.0)"}}
@@ -430,7 +430,7 @@ public void LegacyName() throws Exception {
430430
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "num,shape");
431431
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES, "bigint,binary");
432432
Configuration config = new Configuration();
433-
SerDe jserde = new JsonSerde();
433+
AbstractSerDe jserde = new JsonSerde();
434434
jserde.initialize(config, proptab);
435435
StructObjectInspector rowOI = (StructObjectInspector)jserde.getObjectInspector();
436436
@@ -453,9 +453,9 @@ public void LegacyName() throws Exception {
453453
}
454454
* */
455455

456-
privateSerDemkSerDe(Propertiesproptab)throwsException {
456+
privateAbstractSerDemkSerDe(Propertiesproptab)throwsException {
457457
Configurationconfig =newConfiguration();
458-
SerDejserde =newEsriJsonSerDe();
458+
AbstractSerDejserde =newEsriJsonSerDe();
459459
jserde.initialize(config,proptab);
460460
returnjserde;
461461
}

‎hive/src/test/java/com/esri/hadoop/hive/serde/TestGeoJsonSerDe.java‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
importjava.util.Properties;
88
importjava.util.TimeZone;
99
importorg.apache.hadoop.conf.Configuration;
10-
importorg.apache.hadoop.hive.serde2.SerDe;
10+
importorg.apache.hadoop.hive.serde2.AbstractSerDe;
1111
importorg.apache.hadoop.hive.serde2.io.DateWritable;
1212
importorg.apache.hadoop.hive.serde2.objectinspector.StructField;
1313
importorg.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
@@ -40,7 +40,7 @@ public void TestIntWrite() throws Exception {
4040
Propertiesproptab =newProperties();
4141
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"num");
4242
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"int");
43-
SerDejserde =mkSerDe(proptab);
43+
AbstractSerDejserde =mkSerDe(proptab);
4444
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
4545

4646
// {"properties":{"num":7}}
@@ -58,7 +58,7 @@ public void TestEpochWrite() throws Exception {
5858
Propertiesproptab =newProperties();
5959
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"when");
6060
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"date");
61-
SerDejserde =mkSerDe(proptab);
61+
AbstractSerDejserde =mkSerDe(proptab);
6262
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
6363

6464
// {"properties":{"when":147147147147}}
@@ -80,7 +80,7 @@ public void TestPointWrite() throws Exception {
8080
Propertiesproptab =newProperties();
8181
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"shape");
8282
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"binary");
83-
SerDejserde =mkSerDe(proptab);
83+
AbstractSerDejserde =mkSerDe(proptab);
8484
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
8585

8686
// {"properties":{},"geometry":{"type":"Point","coordinates":[15.0,5.0]}}
@@ -98,7 +98,7 @@ public void TestIntParse() throws Exception {
9898
Configurationconfig =newConfiguration();
9999
Textvalue =newText();
100100

101-
SerDejserde =newGeoJsonSerDe();
101+
AbstractSerDejserde =newGeoJsonSerDe();
102102
Propertiesproptab =newProperties();
103103
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"num");
104104
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"int");
@@ -122,7 +122,7 @@ public void TestDateParse() throws Exception {
122122
Configurationconfig =newConfiguration();
123123
Textvalue =newText();
124124

125-
SerDejserde =newGeoJsonSerDe();
125+
AbstractSerDejserde =newGeoJsonSerDe();
126126
Propertiesproptab =newProperties();
127127
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"when");
128128
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"date");
@@ -147,7 +147,7 @@ public void TestEpochParse() throws Exception {
147147
Configurationconfig =newConfiguration();
148148
Textvalue =newText();
149149

150-
SerDejserde =newGeoJsonSerDe();
150+
AbstractSerDejserde =newGeoJsonSerDe();
151151
Propertiesproptab =newProperties();
152152
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"when");
153153
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"date");
@@ -174,7 +174,7 @@ public void TestPointParse() throws Exception {
174174
Configurationconfig =newConfiguration();
175175
Textvalue =newText();
176176

177-
SerDejserde =newGeoJsonSerDe();
177+
AbstractSerDejserde =newGeoJsonSerDe();
178178
Propertiesproptab =newProperties();
179179
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"shape");
180180
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"binary");
@@ -200,7 +200,7 @@ public void TestIntOnly() throws Exception { // Is this valid for GeoJSON?
200200
Propertiesproptab =newProperties();
201201
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"num");
202202
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"int");
203-
SerDejserde =mkSerDe(proptab);
203+
AbstractSerDejserde =mkSerDe(proptab);
204204
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
205205

206206
//value.set("{\"properties\":{\"num\":7}}");
@@ -221,7 +221,7 @@ public void TestPointOnly() throws Exception {
221221
Propertiesproptab =newProperties();
222222
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"shape");
223223
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"binary");
224-
SerDejserde =mkSerDe(proptab);
224+
AbstractSerDejserde =mkSerDe(proptab);
225225
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
226226

227227
//value.set("{\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[15.0,5.0]}}");
@@ -244,7 +244,7 @@ public void TestIntPoint() throws Exception {
244244
Propertiesproptab =newProperties();
245245
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"num,shape");
246246
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"bigint,binary");
247-
SerDejserde =mkSerDe(proptab);
247+
AbstractSerDejserde =mkSerDe(proptab);
248248
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
249249

250250
// value.set("{\"properties\":{\"num\":7},\"geometry\":{\"type\":\"Point\",\"coordinates\":[15.0,5.0]}}");
@@ -271,7 +271,7 @@ public void TestNullAttr() throws Exception {
271271
Propertiesproptab =newProperties();
272272
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"num");
273273
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"int");
274-
SerDejserde =mkSerDe(proptab);
274+
AbstractSerDejserde =mkSerDe(proptab);
275275
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
276276

277277
//value.set("{\"properties\":{\"num\":7}}");
@@ -292,7 +292,7 @@ public void TestNullGeom() throws Exception {
292292
Propertiesproptab =newProperties();
293293
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS,"shape");
294294
proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES,"binary");
295-
SerDejserde =mkSerDe(proptab);
295+
AbstractSerDejserde =mkSerDe(proptab);
296296
StructObjectInspectorrowOI = (StructObjectInspector)jserde.getObjectInspector();
297297

298298
//value.set("{\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[15.0,5.0]}}");
@@ -309,9 +309,9 @@ public void TestNullGeom() throws Exception {
309309
}
310310

311311

312-
privateSerDemkSerDe(Propertiesproptab)throwsException {
312+
privateAbstractSerDemkSerDe(Propertiesproptab)throwsException {
313313
Configurationconfig =newConfiguration();
314-
SerDejserde =newGeoJsonSerDe();
314+
AbstractSerDejserde =newGeoJsonSerDe();
315315
jserde.initialize(config,proptab);
316316
returnjserde;
317317
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp