Skip to content

Commit

Permalink
[HIVE] Validate field extraction
Browse files Browse the repository at this point in the history
Eliminate table clash in tests
Relates #259
  • Loading branch information
costin committed Oct 3, 2014
1 parent e479bc2 commit 6c341d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -92,7 +92,7 @@ public void testMappingttl() throws Exception {
+ "id BIGINT, "
+ "name STRING, "
+ "ts STRING) "
+ tableProps("hive/artists", "'es.mapping.timestamp' = 'ts'", "'es.mapping.id' = 'id'", "'es.mapping.ttl' = '<5m>'");
+ tableProps("hive/savemeta", "'es.mapping.timestamp' = 'ts'", "'es.mapping.id' = 'id'", "'es.mapping.ttl' = '<5m>'");

String selectTest = "SELECT s.name, s.ts FROM sourcewithmetadata s";

Expand Down
Expand Up @@ -63,13 +63,13 @@ protected Object extractField(Object target) {
public void processField(Settings settings, String fl) {
Map<String, String> columnNames = HiveUtils.columnMap(settings);
// replace column name with _colX (which is what Hive uses during serialization)
fieldName = columnNames.get(getFieldName().toLowerCase(Locale.ENGLISH));
fieldName = columnNames.get(fl.toLowerCase(Locale.ENGLISH));

if (!settings.getInputAsJson() && !StringUtils.hasText(fieldName)) {
throw new EsHadoopIllegalArgumentException(
String.format(
"Cannot find field [%s] in mapping %s ; maybe a value was specified without '<','>' or there is a typo?",
getFieldName(), columnNames.keySet()));
fl, columnNames.keySet()));
}
}
}

0 comments on commit 6c341d6

Please sign in to comment.