diff options
author | Jon Bratseth <bratseth@verizonmedia.com> | 2020-01-09 13:49:42 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@verizonmedia.com> | 2020-01-09 13:49:42 +0100 |
commit | d35770c1126af16301feb3ed3ef23410a417453c (patch) | |
tree | 701418d275bf5caf9ffa0ab5f23226f9c85d2aa9 /processing | |
parent | e19542f74d4692729ef744b74f5ef0d0715c111f (diff) |
Treat rank features as tensors (or doubles)
The purpose of this is to prepare to disallow rank feature
strings (which can't be parsed to doubles or tensors)
on Vespa 8. Currently, such strings will be converted to
numbers by hashing them during evaluation, but this is not
useful (as the hash can be computed before setting if desired),
and leads to confusion when a feature is intended set from
a tensor string but ends up as a hash due to missing type
information in the configuration.
Changes:
- Parse numeric rank features into doubles as soon as possible
- Deprecate the methods accessing rank features as strings
- Allow double features to be accessible as tensors
Diffstat (limited to 'processing')
-rw-r--r-- | processing/src/main/java/com/yahoo/processing/request/Properties.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/processing/src/main/java/com/yahoo/processing/request/Properties.java b/processing/src/main/java/com/yahoo/processing/request/Properties.java index 250e7214881..095a0e51ce0 100644 --- a/processing/src/main/java/com/yahoo/processing/request/Properties.java +++ b/processing/src/main/java/com/yahoo/processing/request/Properties.java @@ -411,8 +411,8 @@ public class Properties implements Cloneable { if (value == null) return defaultValue; - if (value instanceof Integer) - return (Integer) value; + if (value instanceof Number) + return ((Number)value).intValue(); String stringValue = value.toString(); if (stringValue.isEmpty()) @@ -420,7 +420,7 @@ public class Properties implements Cloneable { return Integer.valueOf(stringValue); } catch (IllegalArgumentException e) { - throw new NumberFormatException("Not a valid integer"); + throw new NumberFormatException("'" + value + "' is not a valid integer"); } } |