ClassWriter prefixes columns with names that correspond to Java reserved
words with '_'. For example, 'public' becomes '_public'. Later, when
we attempt to look up the column in the Hive schema via HCatalog, the
aliased column doesn't exist (assuming we've created a Hive schema that
exactly mirrors the schema of the source DB).

This patch coarsely removes prefixed underscores. A potential
improvement would be to check that the column name indeed is a Java
reserved word.
This commit is contained in:
Ben Eddy 2017-03-14 17:38:57 -07:00
Родитель c0c5a81723
Коммит a44bed8896
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -166,7 +166,7 @@ public class SqoopHCatImportHelper {
for (Map.Entry<String, Object> entry : fieldMap.entrySet()) {
String key = entry.getKey();
Object val = entry.getValue();
String hfn = key.toLowerCase();
String hfn = key.toLowerCase().replaceFirst("^_", "");
boolean skip = false;
if (staticPartitionKeys != null && staticPartitionKeys.length > 0) {
for (int i = 0; i < staticPartitionKeys.length; ++i) {