Search in sources :

Example 1 with VerificationException

use of com.yahoo.vespa.indexinglanguage.expressions.VerificationException in project vespa by vespa-engine.

the class SimpleDocumentAdapter method tryOutputType.

@Override
public void tryOutputType(Expression exp, String fieldName, DataType valueType) {
    Field field = output.getDataType().getField(fieldName);
    if (field == null) {
        throw new VerificationException(exp, "Field '" + fieldName + "' not found.");
    }
    DataType fieldType = field.getDataType();
    if (!fieldType.isAssignableFrom(valueType)) {
        throw new VerificationException(exp, "Can not assign " + valueType.getName() + " to field '" + fieldName + "' which is " + fieldType.getName() + ".");
    }
}
Also used : Field(com.yahoo.document.Field) VerificationException(com.yahoo.vespa.indexinglanguage.expressions.VerificationException) DataType(com.yahoo.document.DataType)

Aggregations

DataType (com.yahoo.document.DataType)1 Field (com.yahoo.document.Field)1 VerificationException (com.yahoo.vespa.indexinglanguage.expressions.VerificationException)1