Writable value = input.get(columnKey); Object rowVal;
for (String level : StringUtils.tokenize(esAlias, ".")) { reuse.set(level); result = ((MapWritable) result).get(reuse); if (result == null) { break;
public String getService() { return partitionMap.get(SERVICE).toString(); }
public String getServer() { return partitionMap.get(SERVER).toString(); }
@Override public long getMessageSize() { Text key = new Text("message.size"); if (this.partitionMap.containsKey(key)) return ((LongWritable) this.partitionMap.get(key)).get(); else return 1024; //default estimated size }
metaData.put(key, oldMetaData.get(key));
/** * Get a value for partitions * @return the value for the given key */ public Writable get(Writable key) { return partitionMap.get(key); }
/** * Get a value for partitions * @return the value for the given key */ public Writable get(Writable key) { return partitionMap.get(key); }
/** * Get a value for partitions * @return the value for the given key */ public Writable get(Writable key) { return partitionMap.get(key); }
public String getService() { return partitionMap.get(SERVICE).toString(); }
public List<String> getStringList(Text key) { TextArrayWritable list = (TextArrayWritable) map.get(key); return (list == null ? null : list.toStringList()); }
@Override public long getMessageSize() { Text key = new Text("message.size"); if (this.partitionMap.containsKey(key)) return ((LongWritable) this.partitionMap.get(key)).get(); else return 1024; //default estimated size }
private void receiveSyncedItemFactorizedValues( BSPPeer<Text, VectorWritable, Text, VectorWritable, MapWritable> peer) throws IOException { MapWritable msg = new MapWritable(); Text itemId = null; // messages are arriving take them while ((msg = peer.getCurrentMessage()) != null) { itemId = (Text) msg.get(OnlineCF.Settings.MSG_ITEM_MATRIX); itemsMatrix.put(itemId.toString(), (VectorWritable)msg.get(OnlineCF.Settings.MSG_VALUE)); } }
public Text getText(String skey) { key.set(skey); TextArrayWritable value = (TextArrayWritable) map.get(key); return (value != null ? (Text) value.get()[0] : null); }
private void receiveSyncedItemFactorizedValues( BSPPeer<Text, VectorWritable, Text, VectorWritable, MapWritable> peer) throws IOException { MapWritable msg = new MapWritable(); Text itemId = null; // messages are arriving take them while ((msg = peer.getCurrentMessage()) != null) { itemId = (Text) msg.get(OnlineCF.Settings.MSG_ITEM_MATRIX); itemsMatrix.put(itemId.toString(), (VectorWritable)msg.get(OnlineCF.Settings.MSG_VALUE)); } }
@Override public long getMessageSize() { Text key = new Text("message.size"); if (this.partitionMap.containsKey(key)) return ((LongWritable) this.partitionMap.get(key)).get(); else return 1024; //default estimated size }
private String addFieldValuesToRow(String row, MapWritable mapw, String columnName) { Object valueObj = mapw.get(new Text(columnName)); row += valueObj.toString() + "|"; return row; }
private String addFieldValuesToRow(String row, MapWritable mapw, String columnName) { Object valueObj = mapw.get(new Text(columnName)); row += valueObj.toString() + "|"; return row; }
private static Map<Object, Object> convertMap(MapWritable input, Map.Entry<Schema, Schema> mapSchema) throws IOException { Schema keySchema = mapSchema.getKey(); if (!keySchema.isCompatible(Schema.of(Schema.Type.STRING))) { throw new IOException("Complex key type not supported: " + keySchema); } Schema valueSchema = mapSchema.getValue(); Map<Object, Object> result = new HashMap<>(); for (Writable key : input.keySet()) { result.put(convertWritables(key, keySchema), convertWritables(input.get(key), valueSchema)); } return result; }
public static StructuredRecord convertToRecord(MapWritable input, Schema schema) throws IOException { StructuredRecord.Builder builder = StructuredRecord.builder(schema); for (Schema.Field field : schema.getFields()) { try { builder.set(field.getName(), convertWritables(input.get(new Text(field.getName())), field.getSchema())); } catch (Exception e) { throw(new IOException(String.format("Type exception for field %s: %s", field.getName(), e.getMessage()))); } } return builder.build(); }