You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the PMML specification, it is permitted for string values to contain trailing whitespace. So, "that was a stupid decision" and "that was a stupid decision " should be considered equal when comparing them using the built-in equals function.
The problem has two sides to it. First, the trailing whitespace may be contained in user input values. Second, the trailing whitespace may be contained inside PMML documents (eg. <Constant>value </Constant>).
It's easy to deal with user input, as the InputField#prepare(Object) values should simply remove the whitespace. It is much more difficult to do anything about PMML documents as the JPMML-Evaluator library is not allowed to modify the in-memory org.dmg.pmml.PMML class model object as it pleases.
One workaround would be to implement a visitor (eg. org.jpmml.model.visitors.StringValueNormalizer), which traverses and fixes the PMML class model object before the JPMML-Evaluator library gets to see it.
It would be stupid to implement "does the string value contain trailing WS?"-check around every string operation - it's computationally too costly to be performing it with 99.99% PMML documents that contain proper string values.
The text was updated successfully, but these errors were encountered:
According to the PMML specification, it is permitted for string values to contain trailing whitespace. So,
"that was a stupid decision"
and"that was a stupid decision "
should be considered equal when comparing them using the built-inequals
function.The problem has two sides to it. First, the trailing whitespace may be contained in user input values. Second, the trailing whitespace may be contained inside PMML documents (eg.
<Constant>value </Constant>
).It's easy to deal with user input, as the
InputField#prepare(Object)
values should simply remove the whitespace. It is much more difficult to do anything about PMML documents as the JPMML-Evaluator library is not allowed to modify the in-memoryorg.dmg.pmml.PMML
class model object as it pleases.One workaround would be to implement a visitor (eg.
org.jpmml.model.visitors.StringValueNormalizer
), which traverses and fixes the PMML class model object before the JPMML-Evaluator library gets to see it.It would be stupid to implement "does the string value contain trailing WS?"-check around every string operation - it's computationally too costly to be performing it with 99.99% PMML documents that contain proper string values.
The text was updated successfully, but these errors were encountered: