This code should not be necessary, as MetaDataClient.dropIndex() calls dropTable() which in turn makes the following call (line 1414):
MutationPlan plan = new PostDDLCompiler(connection).compile(tableRefs, null, null, Collections.<PColumn>emptyList(), ts);
return connection.getQueryServices().updateData(plan);
I suspect the problem is that the boolean dropMetaData is true, but in this case (for indexes on views and local indexes), we want it to be false. In that case, it should do the right thing.
Try just changing line 1383 like this (and moving it into the if statement after the declaration of the table local variable):
boolean dropMetaData = table.getViewIndexId() == null && connection.getQueryServices().getProps().getBoolean(DROP_METADATA_ATTRIB, DEFAULT_DROP_METADATA);
jamestaylor
Here is the patch to delete index data on drop index.
Please review.