Skip to content

Commit bba1bf0

Browse files
committed
CDM-36 using isAssignableFrom rather than equals
1 parent 7eb1231 commit bba1bf0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/datastax/cdm/cql/statement/AbstractTargetUpsertStatement.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,13 @@ protected void checkBindInputs(Integer ttl, Long writeTime, Object explodeMapKey
153153
if (FeatureFactory.isEnabled(explodeMapFeature)) {
154154
if (null==explodeMapKey)
155155
throw new RuntimeException("ExplodeMap is enabled, but no map key was provided");
156-
else if (!(explodeMapKey.getClass().equals(explodeMapFeature.getMigrateDataType(ExplodeMap.Property.KEY_COLUMN_TYPE).getTypeClass())))
157-
throw new RuntimeException("ExplodeMap is enabled, but the map key type provided "+explodeMapKey.getClass().getName()+" is not of the expected type "+explodeMapFeature.getMigrateDataType(ExplodeMap.Property.KEY_COLUMN_TYPE).getTypeClass().getName());
156+
else if (!explodeMapFeature.getMigrateDataType(ExplodeMap.Property.KEY_COLUMN_TYPE).getTypeClass().isAssignableFrom(explodeMapKey.getClass()))
157+
throw new RuntimeException("ExplodeMap is enabled, but the map key type provided "+explodeMapKey.getClass().getName()+" is not compatible with "+explodeMapFeature.getMigrateDataType(ExplodeMap.Property.KEY_COLUMN_TYPE).getTypeClass().getName());
158158

159159
if (null==explodeMapValue)
160160
throw new RuntimeException("ExplodeMap is enabled, but no map value was provided");
161-
else if (!(explodeMapValue.getClass().equals(explodeMapFeature.getMigrateDataType(ExplodeMap.Property.VALUE_COLUMN_TYPE).getTypeClass())))
162-
throw new RuntimeException("ExplodeMap is enabled, but the map value type provided "+explodeMapValue.getClass().getName()+" is not of the expected type "+explodeMapFeature.getMigrateDataType(ExplodeMap.Property.VALUE_COLUMN_TYPE).getTypeClass().getName());
161+
else if (!explodeMapFeature.getMigrateDataType(ExplodeMap.Property.VALUE_COLUMN_TYPE).getTypeClass().isAssignableFrom(explodeMapValue.getClass()))
162+
throw new RuntimeException("ExplodeMap is enabled, but the map value type provided "+explodeMapValue.getClass().getName()+" is not compatible with "+explodeMapFeature.getMigrateDataType(ExplodeMap.Property.VALUE_COLUMN_TYPE).getTypeClass().getName());
163163
}
164164
}
165165

0 commit comments

Comments
 (0)