Search in sources :

Example 1 with AttributeExpression

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

the class ExpressionVisitorTestCase method requireThatAllExpressionsAreVisited.

@SuppressWarnings("unchecked")
@Test
public void requireThatAllExpressionsAreVisited() {
    assertCount(3, new ArithmeticExpression(new InputExpression("foo"), ArithmeticExpression.Operator.ADD, new InputExpression("bar")));
    assertCount(1, new AttributeExpression("foo"));
    assertCount(1, new Base64DecodeExpression());
    assertCount(1, new Base64EncodeExpression());
    assertCount(3, new CatExpression(new InputExpression("foo"), new IndexExpression("bar")));
    assertCount(1, new ClearStateExpression());
    assertCount(1, new EchoExpression());
    assertCount(2, new ForEachExpression(new IndexExpression("foo")));
    assertCount(1, new GetFieldExpression("foo"));
    assertCount(1, new GetVarExpression("foo"));
    assertCount(2, new GuardExpression(new IndexExpression("foo")));
    assertCount(1, new HexDecodeExpression());
    assertCount(1, new HexEncodeExpression());
    assertCount(1, new HostNameExpression());
    assertCount(5, new IfThenExpression(new InputExpression("foo"), IfThenExpression.Comparator.EQ, new InputExpression("bar"), new IndexExpression("baz"), new IndexExpression("cox")));
    assertCount(1, new IndexExpression("foo"));
    assertCount(1, new InputExpression("foo"));
    assertCount(1, new JoinExpression("foo"));
    assertCount(1, new LowerCaseExpression());
    assertCount(1, new NormalizeExpression(new SimpleLinguistics()));
    assertCount(1, new NowExpression());
    assertCount(1, new OptimizePredicateExpression());
    assertCount(2, new ParenthesisExpression(new InputExpression("foo")));
    assertCount(1, new RandomExpression(69));
    assertCount(3, new ScriptExpression(new StatementExpression(new InputExpression("foo"))));
    assertCount(3, new SelectInputExpression(new Pair<String, Expression>("foo", new IndexExpression("bar")), new Pair<String, Expression>("bar", new IndexExpression("foo"))));
    assertCount(1, new SetLanguageExpression());
    assertCount(1, new SetValueExpression(new IntegerFieldValue(69)));
    assertCount(1, new SetVarExpression("foo"));
    assertCount(1, new SplitExpression("foo"));
    assertCount(2, new StatementExpression(new InputExpression("foo")));
    assertCount(1, new SummaryExpression("foo"));
    assertCount(1, new SubstringExpression(6, 9));
    assertCount(3, new SwitchExpression(Collections.singletonMap("foo", (Expression) new IndexExpression("bar")), new InputExpression("baz")));
    assertCount(1, new ThisExpression());
    assertCount(1, new ToArrayExpression());
    assertCount(1, new ToByteExpression());
    assertCount(1, new ToDoubleExpression());
    assertCount(1, new ToFloatExpression());
    assertCount(1, new ToIntegerExpression());
    assertCount(1, new TokenizeExpression(new SimpleLinguistics(), new AnnotatorConfig()));
    assertCount(1, new ToLongExpression());
    assertCount(1, new ToPositionExpression());
    assertCount(1, new ToStringExpression());
    assertCount(1, new ToWsetExpression(false, false));
    assertCount(1, new TrimExpression());
    assertCount(1, new ZCurveExpression());
}
Also used : SummaryExpression(com.yahoo.vespa.indexinglanguage.expressions.SummaryExpression) SwitchExpression(com.yahoo.vespa.indexinglanguage.expressions.SwitchExpression) AnnotatorConfig(com.yahoo.vespa.indexinglanguage.linguistics.AnnotatorConfig) StatementExpression(com.yahoo.vespa.indexinglanguage.expressions.StatementExpression) IntegerFieldValue(com.yahoo.document.datatypes.IntegerFieldValue) OptimizePredicateExpression(com.yahoo.vespa.indexinglanguage.expressions.OptimizePredicateExpression) SplitExpression(com.yahoo.vespa.indexinglanguage.expressions.SplitExpression) ToPositionExpression(com.yahoo.vespa.indexinglanguage.expressions.ToPositionExpression) ThisExpression(com.yahoo.vespa.indexinglanguage.expressions.ThisExpression) ToByteExpression(com.yahoo.vespa.indexinglanguage.expressions.ToByteExpression) TokenizeExpression(com.yahoo.vespa.indexinglanguage.expressions.TokenizeExpression) IfThenExpression(com.yahoo.vespa.indexinglanguage.expressions.IfThenExpression) ToStringExpression(com.yahoo.vespa.indexinglanguage.expressions.ToStringExpression) SubstringExpression(com.yahoo.vespa.indexinglanguage.expressions.SubstringExpression) EchoExpression(com.yahoo.vespa.indexinglanguage.expressions.EchoExpression) SetVarExpression(com.yahoo.vespa.indexinglanguage.expressions.SetVarExpression) HexDecodeExpression(com.yahoo.vespa.indexinglanguage.expressions.HexDecodeExpression) SelectInputExpression(com.yahoo.vespa.indexinglanguage.expressions.SelectInputExpression) InputExpression(com.yahoo.vespa.indexinglanguage.expressions.InputExpression) AttributeExpression(com.yahoo.vespa.indexinglanguage.expressions.AttributeExpression) ScriptExpression(com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression) SimpleLinguistics(com.yahoo.language.simple.SimpleLinguistics) ToArrayExpression(com.yahoo.vespa.indexinglanguage.expressions.ToArrayExpression) SetLanguageExpression(com.yahoo.vespa.indexinglanguage.expressions.SetLanguageExpression) LowerCaseExpression(com.yahoo.vespa.indexinglanguage.expressions.LowerCaseExpression) ToIntegerExpression(com.yahoo.vespa.indexinglanguage.expressions.ToIntegerExpression) ForEachExpression(com.yahoo.vespa.indexinglanguage.expressions.ForEachExpression) SelectInputExpression(com.yahoo.vespa.indexinglanguage.expressions.SelectInputExpression) ToWsetExpression(com.yahoo.vespa.indexinglanguage.expressions.ToWsetExpression) Base64DecodeExpression(com.yahoo.vespa.indexinglanguage.expressions.Base64DecodeExpression) IndexExpression(com.yahoo.vespa.indexinglanguage.expressions.IndexExpression) GetFieldExpression(com.yahoo.vespa.indexinglanguage.expressions.GetFieldExpression) RandomExpression(com.yahoo.vespa.indexinglanguage.expressions.RandomExpression) TrimExpression(com.yahoo.vespa.indexinglanguage.expressions.TrimExpression) JoinExpression(com.yahoo.vespa.indexinglanguage.expressions.JoinExpression) HexEncodeExpression(com.yahoo.vespa.indexinglanguage.expressions.HexEncodeExpression) Pair(com.yahoo.collections.Pair) SetValueExpression(com.yahoo.vespa.indexinglanguage.expressions.SetValueExpression) NowExpression(com.yahoo.vespa.indexinglanguage.expressions.NowExpression) ToDoubleExpression(com.yahoo.vespa.indexinglanguage.expressions.ToDoubleExpression) ToLongExpression(com.yahoo.vespa.indexinglanguage.expressions.ToLongExpression) ToFloatExpression(com.yahoo.vespa.indexinglanguage.expressions.ToFloatExpression) Base64EncodeExpression(com.yahoo.vespa.indexinglanguage.expressions.Base64EncodeExpression) CatExpression(com.yahoo.vespa.indexinglanguage.expressions.CatExpression) GuardExpression(com.yahoo.vespa.indexinglanguage.expressions.GuardExpression) ParenthesisExpression(com.yahoo.vespa.indexinglanguage.expressions.ParenthesisExpression) NormalizeExpression(com.yahoo.vespa.indexinglanguage.expressions.NormalizeExpression) ArithmeticExpression(com.yahoo.vespa.indexinglanguage.expressions.ArithmeticExpression) HostNameExpression(com.yahoo.vespa.indexinglanguage.expressions.HostNameExpression) GetVarExpression(com.yahoo.vespa.indexinglanguage.expressions.GetVarExpression) ClearStateExpression(com.yahoo.vespa.indexinglanguage.expressions.ClearStateExpression) ZCurveExpression(com.yahoo.vespa.indexinglanguage.expressions.ZCurveExpression) Test(org.junit.Test)

Example 2 with AttributeExpression

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

the class ExpressionConverterTestCase method requireThatSwitchElementsCanBeRemoved.

@Test
public void requireThatSwitchElementsCanBeRemoved() {
    Map<String, Expression> cases = new HashMap<>();
    Expression foo = new AttributeExpression("foo");
    Expression bar = new AttributeExpression("bar");
    cases.put("foo", foo);
    cases.put("bar", bar);
    SwitchExpression before = new SwitchExpression(cases);
    Expression after = new SearchReplace(foo, null).convert(before);
    assertTrue(after instanceof SwitchExpression);
    assertEquals(1, ((SwitchExpression) after).getCases().size());
    after = new SearchReplace(bar, null).convert(before);
    assertTrue(after instanceof SwitchExpression);
    assertEquals(1, ((SwitchExpression) after).getCases().size());
}
Also used : SwitchExpression(com.yahoo.vespa.indexinglanguage.expressions.SwitchExpression) GetFieldExpression(com.yahoo.vespa.indexinglanguage.expressions.GetFieldExpression) SetVarExpression(com.yahoo.vespa.indexinglanguage.expressions.SetVarExpression) Base64DecodeExpression(com.yahoo.vespa.indexinglanguage.expressions.Base64DecodeExpression) SummaryExpression(com.yahoo.vespa.indexinglanguage.expressions.SummaryExpression) SelectInputExpression(com.yahoo.vespa.indexinglanguage.expressions.SelectInputExpression) IndexExpression(com.yahoo.vespa.indexinglanguage.expressions.IndexExpression) SubstringExpression(com.yahoo.vespa.indexinglanguage.expressions.SubstringExpression) ClearStateExpression(com.yahoo.vespa.indexinglanguage.expressions.ClearStateExpression) EchoExpression(com.yahoo.vespa.indexinglanguage.expressions.EchoExpression) ToByteExpression(com.yahoo.vespa.indexinglanguage.expressions.ToByteExpression) TrimExpression(com.yahoo.vespa.indexinglanguage.expressions.TrimExpression) GuardExpression(com.yahoo.vespa.indexinglanguage.expressions.GuardExpression) ScriptExpression(com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression) JoinExpression(com.yahoo.vespa.indexinglanguage.expressions.JoinExpression) LowerCaseExpression(com.yahoo.vespa.indexinglanguage.expressions.LowerCaseExpression) GetVarExpression(com.yahoo.vespa.indexinglanguage.expressions.GetVarExpression) NowExpression(com.yahoo.vespa.indexinglanguage.expressions.NowExpression) HostNameExpression(com.yahoo.vespa.indexinglanguage.expressions.HostNameExpression) SwitchExpression(com.yahoo.vespa.indexinglanguage.expressions.SwitchExpression) CompositeExpression(com.yahoo.vespa.indexinglanguage.expressions.CompositeExpression) AttributeExpression(com.yahoo.vespa.indexinglanguage.expressions.AttributeExpression) CatExpression(com.yahoo.vespa.indexinglanguage.expressions.CatExpression) SetLanguageExpression(com.yahoo.vespa.indexinglanguage.expressions.SetLanguageExpression) Expression(com.yahoo.vespa.indexinglanguage.expressions.Expression) SetValueExpression(com.yahoo.vespa.indexinglanguage.expressions.SetValueExpression) ToLongExpression(com.yahoo.vespa.indexinglanguage.expressions.ToLongExpression) ZCurveExpression(com.yahoo.vespa.indexinglanguage.expressions.ZCurveExpression) ToDoubleExpression(com.yahoo.vespa.indexinglanguage.expressions.ToDoubleExpression) ArithmeticExpression(com.yahoo.vespa.indexinglanguage.expressions.ArithmeticExpression) InputExpression(com.yahoo.vespa.indexinglanguage.expressions.InputExpression) ToFloatExpression(com.yahoo.vespa.indexinglanguage.expressions.ToFloatExpression) OptimizePredicateExpression(com.yahoo.vespa.indexinglanguage.expressions.OptimizePredicateExpression) TokenizeExpression(com.yahoo.vespa.indexinglanguage.expressions.TokenizeExpression) ToArrayExpression(com.yahoo.vespa.indexinglanguage.expressions.ToArrayExpression) ToIntegerExpression(com.yahoo.vespa.indexinglanguage.expressions.ToIntegerExpression) ThisExpression(com.yahoo.vespa.indexinglanguage.expressions.ThisExpression) ForEachExpression(com.yahoo.vespa.indexinglanguage.expressions.ForEachExpression) NormalizeExpression(com.yahoo.vespa.indexinglanguage.expressions.NormalizeExpression) RandomExpression(com.yahoo.vespa.indexinglanguage.expressions.RandomExpression) Base64EncodeExpression(com.yahoo.vespa.indexinglanguage.expressions.Base64EncodeExpression) IfThenExpression(com.yahoo.vespa.indexinglanguage.expressions.IfThenExpression) HexDecodeExpression(com.yahoo.vespa.indexinglanguage.expressions.HexDecodeExpression) StatementExpression(com.yahoo.vespa.indexinglanguage.expressions.StatementExpression) ToWsetExpression(com.yahoo.vespa.indexinglanguage.expressions.ToWsetExpression) ParenthesisExpression(com.yahoo.vespa.indexinglanguage.expressions.ParenthesisExpression) HexEncodeExpression(com.yahoo.vespa.indexinglanguage.expressions.HexEncodeExpression) ToPositionExpression(com.yahoo.vespa.indexinglanguage.expressions.ToPositionExpression) ToStringExpression(com.yahoo.vespa.indexinglanguage.expressions.ToStringExpression) SplitExpression(com.yahoo.vespa.indexinglanguage.expressions.SplitExpression) HashMap(java.util.HashMap) AttributeExpression(com.yahoo.vespa.indexinglanguage.expressions.AttributeExpression) Test(org.junit.Test)

Example 3 with AttributeExpression

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

the class ExpressionConverterTestCase method requireThatScriptElementsCanBeRemoved.

@Test
public void requireThatScriptElementsCanBeRemoved() {
    StatementExpression foo = new StatementExpression(new AttributeExpression("foo"));
    StatementExpression bar = new StatementExpression(new AttributeExpression("bar"));
    ScriptExpression before = new ScriptExpression(foo, bar);
    Expression after = new SearchReplace(foo, null).convert(before);
    assertTrue(after instanceof ScriptExpression);
    assertEquals(1, ((ScriptExpression) after).size());
    assertEquals(bar, ((ScriptExpression) after).get(0));
    after = new SearchReplace(bar, null).convert(before);
    assertTrue(after instanceof ScriptExpression);
    assertEquals(1, ((ScriptExpression) after).size());
    assertEquals(foo, ((ScriptExpression) after).get(0));
}
Also used : StatementExpression(com.yahoo.vespa.indexinglanguage.expressions.StatementExpression) GetFieldExpression(com.yahoo.vespa.indexinglanguage.expressions.GetFieldExpression) SetVarExpression(com.yahoo.vespa.indexinglanguage.expressions.SetVarExpression) Base64DecodeExpression(com.yahoo.vespa.indexinglanguage.expressions.Base64DecodeExpression) SummaryExpression(com.yahoo.vespa.indexinglanguage.expressions.SummaryExpression) SelectInputExpression(com.yahoo.vespa.indexinglanguage.expressions.SelectInputExpression) IndexExpression(com.yahoo.vespa.indexinglanguage.expressions.IndexExpression) SubstringExpression(com.yahoo.vespa.indexinglanguage.expressions.SubstringExpression) ClearStateExpression(com.yahoo.vespa.indexinglanguage.expressions.ClearStateExpression) EchoExpression(com.yahoo.vespa.indexinglanguage.expressions.EchoExpression) ToByteExpression(com.yahoo.vespa.indexinglanguage.expressions.ToByteExpression) TrimExpression(com.yahoo.vespa.indexinglanguage.expressions.TrimExpression) GuardExpression(com.yahoo.vespa.indexinglanguage.expressions.GuardExpression) ScriptExpression(com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression) JoinExpression(com.yahoo.vespa.indexinglanguage.expressions.JoinExpression) LowerCaseExpression(com.yahoo.vespa.indexinglanguage.expressions.LowerCaseExpression) GetVarExpression(com.yahoo.vespa.indexinglanguage.expressions.GetVarExpression) NowExpression(com.yahoo.vespa.indexinglanguage.expressions.NowExpression) HostNameExpression(com.yahoo.vespa.indexinglanguage.expressions.HostNameExpression) SwitchExpression(com.yahoo.vespa.indexinglanguage.expressions.SwitchExpression) CompositeExpression(com.yahoo.vespa.indexinglanguage.expressions.CompositeExpression) AttributeExpression(com.yahoo.vespa.indexinglanguage.expressions.AttributeExpression) CatExpression(com.yahoo.vespa.indexinglanguage.expressions.CatExpression) SetLanguageExpression(com.yahoo.vespa.indexinglanguage.expressions.SetLanguageExpression) Expression(com.yahoo.vespa.indexinglanguage.expressions.Expression) SetValueExpression(com.yahoo.vespa.indexinglanguage.expressions.SetValueExpression) ToLongExpression(com.yahoo.vespa.indexinglanguage.expressions.ToLongExpression) ZCurveExpression(com.yahoo.vespa.indexinglanguage.expressions.ZCurveExpression) ToDoubleExpression(com.yahoo.vespa.indexinglanguage.expressions.ToDoubleExpression) ArithmeticExpression(com.yahoo.vespa.indexinglanguage.expressions.ArithmeticExpression) InputExpression(com.yahoo.vespa.indexinglanguage.expressions.InputExpression) ToFloatExpression(com.yahoo.vespa.indexinglanguage.expressions.ToFloatExpression) OptimizePredicateExpression(com.yahoo.vespa.indexinglanguage.expressions.OptimizePredicateExpression) TokenizeExpression(com.yahoo.vespa.indexinglanguage.expressions.TokenizeExpression) ToArrayExpression(com.yahoo.vespa.indexinglanguage.expressions.ToArrayExpression) ToIntegerExpression(com.yahoo.vespa.indexinglanguage.expressions.ToIntegerExpression) ThisExpression(com.yahoo.vespa.indexinglanguage.expressions.ThisExpression) ForEachExpression(com.yahoo.vespa.indexinglanguage.expressions.ForEachExpression) NormalizeExpression(com.yahoo.vespa.indexinglanguage.expressions.NormalizeExpression) RandomExpression(com.yahoo.vespa.indexinglanguage.expressions.RandomExpression) Base64EncodeExpression(com.yahoo.vespa.indexinglanguage.expressions.Base64EncodeExpression) IfThenExpression(com.yahoo.vespa.indexinglanguage.expressions.IfThenExpression) HexDecodeExpression(com.yahoo.vespa.indexinglanguage.expressions.HexDecodeExpression) StatementExpression(com.yahoo.vespa.indexinglanguage.expressions.StatementExpression) ToWsetExpression(com.yahoo.vespa.indexinglanguage.expressions.ToWsetExpression) ParenthesisExpression(com.yahoo.vespa.indexinglanguage.expressions.ParenthesisExpression) HexEncodeExpression(com.yahoo.vespa.indexinglanguage.expressions.HexEncodeExpression) ToPositionExpression(com.yahoo.vespa.indexinglanguage.expressions.ToPositionExpression) ToStringExpression(com.yahoo.vespa.indexinglanguage.expressions.ToStringExpression) SplitExpression(com.yahoo.vespa.indexinglanguage.expressions.SplitExpression) AttributeExpression(com.yahoo.vespa.indexinglanguage.expressions.AttributeExpression) ScriptExpression(com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression) Test(org.junit.Test)

Example 4 with AttributeExpression

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

the class SearchClusterTest method testSdConfigLogical.

@Test
public void testSdConfigLogical() throws IOException, SAXException {
    // sd1
    SDDocumentType sdt1 = new SDDocumentType("s1");
    Search search1 = new Search("s1", null);
    SDField f1 = new SDField("f1", DataType.STRING);
    f1.addAttribute(new Attribute("f1", DataType.STRING));
    f1.setIndexingScript(new ScriptExpression(new StatementExpression(new AttributeExpression("f1"))));
    sdt1.addField(f1);
    search1.addDocument(sdt1);
    // sd2
    SDDocumentType sdt2 = new SDDocumentType("s2");
    Search search2 = new Search("s2", null);
    SDField f2 = new SDField("f2", DataType.STRING);
    f2.addAttribute(new Attribute("f2", DataType.STRING));
    f2.setIndexingScript(new ScriptExpression(new StatementExpression(new AttributeExpression("f2"))));
    sdt2.addField(f2);
    search2.addDocument(sdt2);
    SearchBuilder builder = new SearchBuilder();
    builder.importRawSearch(search1);
    builder.importRawSearch(search2);
    builder.build();
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField) SDDocumentType(com.yahoo.searchdefinition.document.SDDocumentType) Attribute(com.yahoo.searchdefinition.document.Attribute) StatementExpression(com.yahoo.vespa.indexinglanguage.expressions.StatementExpression) Search(com.yahoo.searchdefinition.Search) SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) AttributeExpression(com.yahoo.vespa.indexinglanguage.expressions.AttributeExpression) ScriptExpression(com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression) Test(org.junit.Test)

Example 5 with AttributeExpression

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

the class ExpressionConverterTestCase method requireThatAllExpressionTypesCanBeTraversed.

@SuppressWarnings("unchecked")
@Test
public void requireThatAllExpressionTypesCanBeTraversed() {
    assertConvertable(new ArithmeticExpression(new InputExpression("foo"), ArithmeticExpression.Operator.ADD, new InputExpression("bar")));
    assertConvertable(new AttributeExpression("foo"));
    assertConvertable(new Base64DecodeExpression());
    assertConvertable(new Base64EncodeExpression());
    assertConvertable(new CatExpression(new InputExpression("foo"), new IndexExpression("bar")));
    assertConvertable(new ClearStateExpression());
    assertConvertable(new EchoExpression());
    assertConvertable(new ForEachExpression(new IndexExpression("foo")));
    assertConvertable(new GetFieldExpression("foo"));
    assertConvertable(new GetVarExpression("foo"));
    assertConvertable(new GuardExpression(new IndexExpression("foo")));
    assertConvertable(new HexDecodeExpression());
    assertConvertable(new HexEncodeExpression());
    assertConvertable(new HostNameExpression());
    assertConvertable(new IfThenExpression(new InputExpression("foo"), IfThenExpression.Comparator.EQ, new InputExpression("bar"), new IndexExpression("baz"), new IndexExpression("cox")));
    assertConvertable(new IndexExpression("foo"));
    assertConvertable(new InputExpression("foo"));
    assertConvertable(new JoinExpression("foo"));
    assertConvertable(new LowerCaseExpression());
    assertConvertable(new NormalizeExpression(new SimpleLinguistics()));
    assertConvertable(new NowExpression());
    assertConvertable(new OptimizePredicateExpression());
    assertConvertable(new ParenthesisExpression(new InputExpression("foo")));
    assertConvertable(new RandomExpression(69));
    assertConvertable(new ScriptExpression(new StatementExpression(new InputExpression("foo"))));
    assertConvertable(new SelectInputExpression(new Pair<String, Expression>("foo", new IndexExpression("bar")), new Pair<String, Expression>("bar", new IndexExpression("foo"))));
    assertConvertable(new SetLanguageExpression());
    assertConvertable(new SetValueExpression(new IntegerFieldValue(69)));
    assertConvertable(new SetVarExpression("foo"));
    assertConvertable(new SplitExpression("foo"));
    assertConvertable(new StatementExpression(new InputExpression("foo")));
    assertConvertable(new SubstringExpression(6, 9));
    assertConvertable(new SummaryExpression("foo"));
    assertConvertable(new SwitchExpression(Collections.singletonMap("foo", (Expression) new IndexExpression("bar")), new InputExpression("baz")));
    assertConvertable(new ThisExpression());
    assertConvertable(new ToArrayExpression());
    assertConvertable(new ToByteExpression());
    assertConvertable(new ToDoubleExpression());
    assertConvertable(new ToFloatExpression());
    assertConvertable(new ToIntegerExpression());
    assertConvertable(new TokenizeExpression(new SimpleLinguistics(), new AnnotatorConfig()));
    assertConvertable(new ToLongExpression());
    assertConvertable(new ToPositionExpression());
    assertConvertable(new ToStringExpression());
    assertConvertable(new ToWsetExpression(false, false));
    assertConvertable(new TrimExpression());
    assertConvertable(new ZCurveExpression());
}
Also used : SummaryExpression(com.yahoo.vespa.indexinglanguage.expressions.SummaryExpression) SwitchExpression(com.yahoo.vespa.indexinglanguage.expressions.SwitchExpression) AnnotatorConfig(com.yahoo.vespa.indexinglanguage.linguistics.AnnotatorConfig) StatementExpression(com.yahoo.vespa.indexinglanguage.expressions.StatementExpression) IntegerFieldValue(com.yahoo.document.datatypes.IntegerFieldValue) OptimizePredicateExpression(com.yahoo.vespa.indexinglanguage.expressions.OptimizePredicateExpression) SplitExpression(com.yahoo.vespa.indexinglanguage.expressions.SplitExpression) ToPositionExpression(com.yahoo.vespa.indexinglanguage.expressions.ToPositionExpression) ThisExpression(com.yahoo.vespa.indexinglanguage.expressions.ThisExpression) ToByteExpression(com.yahoo.vespa.indexinglanguage.expressions.ToByteExpression) TokenizeExpression(com.yahoo.vespa.indexinglanguage.expressions.TokenizeExpression) IfThenExpression(com.yahoo.vespa.indexinglanguage.expressions.IfThenExpression) ToStringExpression(com.yahoo.vespa.indexinglanguage.expressions.ToStringExpression) SubstringExpression(com.yahoo.vespa.indexinglanguage.expressions.SubstringExpression) EchoExpression(com.yahoo.vespa.indexinglanguage.expressions.EchoExpression) SetVarExpression(com.yahoo.vespa.indexinglanguage.expressions.SetVarExpression) HexDecodeExpression(com.yahoo.vespa.indexinglanguage.expressions.HexDecodeExpression) SelectInputExpression(com.yahoo.vespa.indexinglanguage.expressions.SelectInputExpression) InputExpression(com.yahoo.vespa.indexinglanguage.expressions.InputExpression) AttributeExpression(com.yahoo.vespa.indexinglanguage.expressions.AttributeExpression) ScriptExpression(com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression) SimpleLinguistics(com.yahoo.language.simple.SimpleLinguistics) ToArrayExpression(com.yahoo.vespa.indexinglanguage.expressions.ToArrayExpression) SetLanguageExpression(com.yahoo.vespa.indexinglanguage.expressions.SetLanguageExpression) LowerCaseExpression(com.yahoo.vespa.indexinglanguage.expressions.LowerCaseExpression) ToIntegerExpression(com.yahoo.vespa.indexinglanguage.expressions.ToIntegerExpression) ForEachExpression(com.yahoo.vespa.indexinglanguage.expressions.ForEachExpression) SelectInputExpression(com.yahoo.vespa.indexinglanguage.expressions.SelectInputExpression) ToWsetExpression(com.yahoo.vespa.indexinglanguage.expressions.ToWsetExpression) Base64DecodeExpression(com.yahoo.vespa.indexinglanguage.expressions.Base64DecodeExpression) IndexExpression(com.yahoo.vespa.indexinglanguage.expressions.IndexExpression) GetFieldExpression(com.yahoo.vespa.indexinglanguage.expressions.GetFieldExpression) RandomExpression(com.yahoo.vespa.indexinglanguage.expressions.RandomExpression) TrimExpression(com.yahoo.vespa.indexinglanguage.expressions.TrimExpression) JoinExpression(com.yahoo.vespa.indexinglanguage.expressions.JoinExpression) HexEncodeExpression(com.yahoo.vespa.indexinglanguage.expressions.HexEncodeExpression) Pair(com.yahoo.collections.Pair) SetValueExpression(com.yahoo.vespa.indexinglanguage.expressions.SetValueExpression) NowExpression(com.yahoo.vespa.indexinglanguage.expressions.NowExpression) ToDoubleExpression(com.yahoo.vespa.indexinglanguage.expressions.ToDoubleExpression) ToLongExpression(com.yahoo.vespa.indexinglanguage.expressions.ToLongExpression) ToFloatExpression(com.yahoo.vespa.indexinglanguage.expressions.ToFloatExpression) Base64EncodeExpression(com.yahoo.vespa.indexinglanguage.expressions.Base64EncodeExpression) CatExpression(com.yahoo.vespa.indexinglanguage.expressions.CatExpression) GuardExpression(com.yahoo.vespa.indexinglanguage.expressions.GuardExpression) ParenthesisExpression(com.yahoo.vespa.indexinglanguage.expressions.ParenthesisExpression) NormalizeExpression(com.yahoo.vespa.indexinglanguage.expressions.NormalizeExpression) ArithmeticExpression(com.yahoo.vespa.indexinglanguage.expressions.ArithmeticExpression) HostNameExpression(com.yahoo.vespa.indexinglanguage.expressions.HostNameExpression) GetVarExpression(com.yahoo.vespa.indexinglanguage.expressions.GetVarExpression) ClearStateExpression(com.yahoo.vespa.indexinglanguage.expressions.ClearStateExpression) ZCurveExpression(com.yahoo.vespa.indexinglanguage.expressions.ZCurveExpression) Test(org.junit.Test)

Aggregations

AttributeExpression (com.yahoo.vespa.indexinglanguage.expressions.AttributeExpression)8 ScriptExpression (com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression)8 StatementExpression (com.yahoo.vespa.indexinglanguage.expressions.StatementExpression)8 ArithmeticExpression (com.yahoo.vespa.indexinglanguage.expressions.ArithmeticExpression)7 CatExpression (com.yahoo.vespa.indexinglanguage.expressions.CatExpression)7 ForEachExpression (com.yahoo.vespa.indexinglanguage.expressions.ForEachExpression)7 GuardExpression (com.yahoo.vespa.indexinglanguage.expressions.GuardExpression)7 IfThenExpression (com.yahoo.vespa.indexinglanguage.expressions.IfThenExpression)7 IndexExpression (com.yahoo.vespa.indexinglanguage.expressions.IndexExpression)7 ParenthesisExpression (com.yahoo.vespa.indexinglanguage.expressions.ParenthesisExpression)7 SelectInputExpression (com.yahoo.vespa.indexinglanguage.expressions.SelectInputExpression)7 SwitchExpression (com.yahoo.vespa.indexinglanguage.expressions.SwitchExpression)7 Base64DecodeExpression (com.yahoo.vespa.indexinglanguage.expressions.Base64DecodeExpression)6 Base64EncodeExpression (com.yahoo.vespa.indexinglanguage.expressions.Base64EncodeExpression)6 ClearStateExpression (com.yahoo.vespa.indexinglanguage.expressions.ClearStateExpression)6 EchoExpression (com.yahoo.vespa.indexinglanguage.expressions.EchoExpression)6 GetFieldExpression (com.yahoo.vespa.indexinglanguage.expressions.GetFieldExpression)6 GetVarExpression (com.yahoo.vespa.indexinglanguage.expressions.GetVarExpression)6 HexDecodeExpression (com.yahoo.vespa.indexinglanguage.expressions.HexDecodeExpression)6 HexEncodeExpression (com.yahoo.vespa.indexinglanguage.expressions.HexEncodeExpression)6