Search in sources :

Example 11 with DataType

use of com.yahoo.document.DataType in project vespa by vespa-engine.

the class GetVarExpression method doVerify.

@Override
protected void doVerify(VerificationContext context) {
    DataType input = context.getVariable(varName);
    if (input == null) {
        throw new VerificationException(this, "Variable '" + varName + "' not found.");
    }
    context.setValue(input);
}
Also used : DataType(com.yahoo.document.DataType)

Example 12 with DataType

use of com.yahoo.document.DataType in project vespa by vespa-engine.

the class SwitchExpression method doVerify.

@Override
protected void doVerify(VerificationContext context) {
    DataType input = context.getValue();
    if (input == null) {
        throw new VerificationException(this, "Expected " + DataType.STRING.getName() + " input, got null.");
    }
    if (input != DataType.STRING) {
        throw new VerificationException(this, "Expected " + DataType.STRING.getName() + " input, got " + input.getName() + ".");
    }
    for (Expression exp : cases.values()) {
        context.setValue(input).execute(exp);
    }
    context.setValue(input).execute(defaultExp);
    context.setValue(input);
}
Also used : DataType(com.yahoo.document.DataType)

Example 13 with DataType

use of com.yahoo.document.DataType in project vespa by vespa-engine.

the class InputExpression method doVerify.

@Override
protected void doVerify(VerificationContext context) {
    DataType val = context.getInputType(this, fieldName);
    if (val == null) {
        throw new VerificationException(this, "Field '" + fieldName + "' not found.");
    }
    context.setValue(val);
}
Also used : DataType(com.yahoo.document.DataType)

Example 14 with DataType

use of com.yahoo.document.DataType in project vespa by vespa-engine.

the class SelectInputExpression method doVerify.

@Override
protected void doVerify(VerificationContext context) {
    DataType input = context.getValue();
    for (Pair<String, Expression> entry : cases) {
        DataType val = context.getInputType(this, entry.getFirst());
        if (val == null) {
            throw new VerificationException(this, "Field '" + entry.getFirst() + "' not found.");
        }
        context.setValue(val).execute(entry.getSecond());
    }
    context.setValue(input);
}
Also used : DataType(com.yahoo.document.DataType)

Example 15 with DataType

use of com.yahoo.document.DataType in project vespa by vespa-engine.

the class StatementExpression method requiredInputType.

@Override
public DataType requiredInputType() {
    for (Expression exp : this) {
        DataType type = exp.requiredInputType();
        if (type != null) {
            return type;
        }
        type = exp.createdOutputType();
        if (type != null) {
            return null;
        }
    }
    return null;
}
Also used : DataType(com.yahoo.document.DataType)

Aggregations

DataType (com.yahoo.document.DataType)62 ArrayDataType (com.yahoo.document.ArrayDataType)20 MapDataType (com.yahoo.document.MapDataType)19 Field (com.yahoo.document.Field)17 StructDataType (com.yahoo.document.StructDataType)17 WeightedSetDataType (com.yahoo.document.WeightedSetDataType)17 ReferenceDataType (com.yahoo.document.ReferenceDataType)13 PositionDataType (com.yahoo.document.PositionDataType)12 CollectionDataType (com.yahoo.document.CollectionDataType)11 FieldValue (com.yahoo.document.datatypes.FieldValue)11 TensorDataType (com.yahoo.document.TensorDataType)10 DocumentType (com.yahoo.document.DocumentType)9 StructuredDataType (com.yahoo.document.StructuredDataType)7 CollectionFieldValue (com.yahoo.document.datatypes.CollectionFieldValue)6 SDField (com.yahoo.searchdefinition.document.SDField)6 MapFieldValue (com.yahoo.document.datatypes.MapFieldValue)5 TemporaryStructuredDataType (com.yahoo.document.TemporaryStructuredDataType)4 AnnotationReferenceDataType (com.yahoo.document.annotation.AnnotationReferenceDataType)4 IntegerFieldValue (com.yahoo.document.datatypes.IntegerFieldValue)4 StringFieldValue (com.yahoo.document.datatypes.StringFieldValue)4