private int calculateExpressionBasedUpdateSize ( final UpdateItemRequest request ) { if ( request == null || request . getUpdateExpression ( ) == null ) { throw new IllegalArgumentException ( "request did not use update expression" ) ; } int size = calculateItemSizeInBytes ( request . getKey ( ) ) ; for ( AttributeValue value : request . getExpressionAttributeValues ( ) . values ( ) ) { size += calculateAttributeSizeInBytes ( value ) ; } return size ; }
This method calculates a lower bound of the size of a new item created with UpdateItem UpdateExpression . It does not account for the size of the attribute names of the document paths in the attribute names map and it assumes that the UpdateExpression only uses the SET action to assign to top - level attributes .