Jackie-Jiang commented on a change in pull request #6728: URL: https://github.com/apache/incubator-pinot/pull/6728#discussion_r605139108
########## File path: pinot-spi/src/main/java/org/apache/pinot/spi/data/FieldSpec.java ########## @@ -398,6 +390,58 @@ public boolean isFixedWidth() { public boolean isNumeric() { return this == INT || this == LONG || this == FLOAT || this == DOUBLE; } + + /** + * Converts the given string value to the data type. Returns byte[] for BYTES. + */ + public Object convert(String value) { + try { + switch (this) { + case INT: + return Integer.valueOf(value); + case LONG: + return Long.valueOf(value); + case FLOAT: + return Float.valueOf(value); + case DOUBLE: + return Double.valueOf(value); + case STRING: + return value; + case BYTES: + return BytesUtils.toBytes(value); + default: + throw new IllegalStateException(); Review comment: This is on `DataType` level, where `isSingleValueField` is not accessible. That logic is handled within the `FieldSpec` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org