Guest User

Untitled

a guest
Jan 19th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. /**
  2. *
  3. */
  4. private static final long serialVersionUID = 269187228897275370L;
  5. private List<Map<String, String>> extractedIdentifiers;
  6.  
  7.  
  8.  
  9. public EnrichmentIdentifiersBuilder(List<Map<String, String>> extractedIdentifiers) {
  10. //super();
  11. this.extractedIdentifiers = extractedIdentifiers;
  12. }
  13.  
  14.  
  15.  
  16. public void addIdentifiers(DataFrame identifiers)
  17. {
  18. final List<String> parameters=Arrays.asList(identifiers.schema().fieldNames());
  19.  
  20.  
  21. identifiers.foreach(new MyFunction<Row, BoxedUnit>() {
  22.  
  23.  
  24. /**
  25. *
  26. */
  27. private static final long serialVersionUID = 1L;
  28.  
  29. @Override
  30. public BoxedUnit apply(Row line)
  31. {
  32. for (int i = 0; i < parameters.size(); i++)
  33. {
  34.  
  35. Map<String, String> identifier= new HashMap<>();
  36. identifier.put(parameters.get(i), line.getString(i));
  37. extractedIdentifiers.add(identifier);
  38. }
  39.  
  40. return BoxedUnit.UNIT;
  41. }
  42. });
  43.  
  44. }
Add Comment
Please, Sign In to add comment