26
26
import nl .basjes .parse .core .exceptions .MissingDissectorsException ;
27
27
import org .apache .hadoop .conf .Configuration ;
28
28
import org .apache .hadoop .hive .serde .serdeConstants ;
29
- import org .apache .hadoop .hive .serde2 .AbstractDeserializer ;
29
+ import org .apache .hadoop .hive .serde2 .AbstractSerDe ;
30
30
import org .apache .hadoop .hive .serde2 .SerDeException ;
31
31
import org .apache .hadoop .hive .serde2 .SerDeStats ;
32
32
import org .apache .hadoop .hive .serde2 .objectinspector .ObjectInspector ;
101
101
// RegexSerDe.INPUT_REGEX, RegexSerDe.OUTPUT_FORMAT_STRING,
102
102
// RegexSerDe.INPUT_REGEX_CASE_SENSITIVE
103
103
//})
104
- public class ApacheHttpdlogDeserializer extends AbstractDeserializer {
104
+ public class ApacheHttpdlogDeserializer extends AbstractSerDe {
105
105
private static final Logger LOG = LoggerFactory .getLogger (ApacheHttpdlogDeserializer .class );
106
106
private static final String FIELD = "field:" ;
107
107
@@ -134,19 +134,18 @@ static class ColumnToGetterMapping {
134
134
private final List <ColumnToGetterMapping > columnToGetterMappings = new ArrayList <>();
135
135
136
136
@ Override
137
- public void initialize (Configuration conf , Properties props )
138
- throws SerDeException {
137
+ public void initialize (Configuration conf , Properties tableProperties , Properties partitionProperties ) throws SerDeException {
139
138
140
139
boolean usable = true ;
141
140
linesInput = 0 ;
142
141
linesBad = 0 ;
143
142
144
- String logformat = props .getProperty ("logformat" );
143
+ String logformat = tableProperties .getProperty ("logformat" );
145
144
146
145
Map <String , Set <String >> typeRemappings = new HashMap <>();
147
146
List <Dissector > additionalDissectors = new ArrayList <>();
148
147
149
- for (Map .Entry <Object , Object > property : props .entrySet ()){
148
+ for (Map .Entry <Object , Object > property : tableProperties .entrySet ()){
150
149
String key = (String )property .getKey ();
151
150
152
151
if (key .startsWith (MAP_FIELD )) {
@@ -192,8 +191,8 @@ public void initialize(Configuration conf, Properties props)
192
191
// List<String> fieldList;
193
192
int numColumns ;
194
193
195
- String columnNameProperty = props .getProperty (serdeConstants .LIST_COLUMNS );
196
- String columnTypeProperty = props .getProperty (serdeConstants .LIST_COLUMN_TYPES );
194
+ String columnNameProperty = tableProperties .getProperty (serdeConstants .LIST_COLUMNS );
195
+ String columnTypeProperty = tableProperties .getProperty (serdeConstants .LIST_COLUMN_TYPES );
197
196
List <String > columnNames = Arrays .asList (columnNameProperty .split ("," ));
198
197
List <TypeInfo > columnTypes = TypeInfoUtils .getTypeInfosFromTypeString (columnTypeProperty );
199
198
assert columnNames .size () == columnTypes .size ();
@@ -211,7 +210,7 @@ public void initialize(Configuration conf, Properties props)
211
210
String columnName = columnNames .get (columnNr );
212
211
TypeInfo columnType = columnTypes .get (columnNr );
213
212
214
- String fieldValue = props .getProperty (FIELD + columnName );
213
+ String fieldValue = tableProperties .getProperty (FIELD + columnName );
215
214
216
215
if (fieldValue == null ) {
217
216
LOG .error ("MUST have Field value for column \" {}\" ." , columnName );
@@ -315,6 +314,11 @@ public Object deserialize(Writable writable) throws SerDeException {
315
314
return row ;
316
315
}
317
316
317
+ @ Override
318
+ public Class <? extends Writable > getSerializedClass () {
319
+ return null ; // This is NOT a Serializer, ONLY a Deserializer!
320
+ }
321
+
318
322
@ Override
319
323
public SerDeStats getSerDeStats () {
320
324
return new SerDeStats ();
0 commit comments