Skip to content

HBaseDumperBolt class not working as expected if only one column family is present. #2

Description

@vandanaAgrawal

For one column family, the execute function of 'HBaseDumperBolt' class does not behave as expected. Even if there are multipe rows to be inserted, it will insert only a single row in Hbase table. This is because value of ArrayList 'colFamilyValues' is not reset even after adding it to ArrayList 'colValues'. As a result, previous values in ArrayList 'colFamilyValues' are also getting added to 'colValues'. Currently the code snippet of execute function in 'HBaseDumperBolt' class is:


if (colFamilyNames.size() == 1) {
for (int j = 0; j < colNames.get(0).size(); j++) {
fieldValue = tuple.getValue(j).toString();
if (rowKeyCheck.equals(colNames.get(0).get(j))) {
rowKey = fieldValue;
}
colFamilyValues.add(fieldValue);
}
colValues.add(colFamilyValues);
}


As per my understanding, it should be:

if (colFamilyNames.size() == 1) {
for (int j = 0; j < colNames.get(0).size(); j++) {
fieldValue = tuple.getValue(j).toString();
if (rowKeyCheck.equals(colNames.get(0).get(j))) {
rowKey = fieldValue;
}
colFamilyValues.add(fieldValue);
}
colValues.add(colFamilyValues);
//Below reinitialization of 'colFamilyValues' missing.
colFamilyValues = new ArrayList();
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions