code: function krillPrimValidateFieldType(fieldtypes, pred, key)
  {
  	var field, constant, actual_type, field_type;
  
  	field = pred[key][0];
  	constant = pred[key][1];
  	actual_type = typeof (constant);
  
  	if (krillOps[key].types &&
  	    krillOps[key].types.indexOf(actual_type) == -1)
  		throw (new VError('predicate %j: operator "%s" cannot be ' +
  		    'applied to fields of type "%s"', pred, key, actual_type));
  
  	if (fieldtypes === null)
  		return;
  
  	if (!(field in fieldtypes))
  		throw (new VError('predicate %j: field "%s" is not defined',
  		    pred, field));
  	field_type = fieldtypes[field];
  	if (field_type != actual_type)
  		throw (new VError('predicate %j: field "%s" value ("%j") ' +
  		    'expected "%s", but got "%s"', pred, field, constant,
  		    field_type, actual_type));
  
  }
docs: /*
  This function assumes that we have a syntactically valid object. We now go
  through and do checks to validate that fields are used appropriately given
  their types (as specified in "fieldtypes").
  
  Input:
  - fieldtypes: valid fields for the metric and their types
  - pred: The relational predicate to validate
  - key: The key that we are interested in validating