Examples of ESUpdateNode


Examples of io.crate.planner.node.dml.ESUpdateNode

        insertCharacters();

        // update characters set name='Vogon lyric fan' where id=1
        WhereClause whereClause = new WhereClause(null, false);
        whereClause.clusteredByLiteral(Literal.newLiteral("1"));
        ESUpdateNode updateNode = new ESUpdateNode(
                new String[]{"characters"},
                new HashMap<Reference, Symbol>(){{
                    put(name_ref, Literal.newLiteral("Vogon lyric fan"));
                }},
                whereClause,
View Full Code Here

Examples of io.crate.planner.node.dml.ESUpdateNode

                )));

        // update characters set name='mostly harmless' where name='Arthur' and "_version"=?
        WhereClause whereClause = new WhereClause(whereClauseFunction);
        whereClause.version(1L);
        ESUpdateNode updateNode = new ESUpdateNode(
                new String[]{"characters"},
                new HashMap<Reference, Symbol>(){{
                    put(name_ref, Literal.newLiteral("mostly harmless"));
                }},
                whereClause,
View Full Code Here

Examples of io.crate.planner.node.dml.ESUpdateNode

                                Arrays.<DataType>asList(DataTypes.INTEGER, DataTypes.INTEGER)), DataTypes.BOOLEAN),
                        Arrays.<Symbol>asList(id_ref, Literal.newLiteral(1))
                )));

        // update characters set name='mostly harmless' where id=1 or name='Trillian'
        ESUpdateNode updateNode = new ESUpdateNode(
                new String[]{"characters"},
                new HashMap<Reference, Symbol>(){{
                    put(name_ref, Literal.newLiteral("mostly harmless"));
                }},
                new WhereClause(whereClause),
View Full Code Here

Examples of io.crate.planner.node.dml.ESUpdateNode

        Plan plan = plan("update users set name='Vogon lyric fan' where id=1");
        Iterator<PlanNode> iterator = plan.iterator();
        PlanNode planNode = iterator.next();
        assertThat(planNode, instanceOf(ESUpdateNode.class));

        ESUpdateNode updateNode = (ESUpdateNode)planNode;
        assertThat(updateNode.indices(), is(new String[]{"users"}));
        assertThat(updateNode.ids().size(), is(1));
        assertThat(updateNode.ids().get(0), is("1"));

        assertThat(updateNode.outputTypes().size(), is(1));
        assertEquals(DataTypes.LONG, updateNode.outputTypes().get(0));

        Map.Entry<String, Object> entry = updateNode.updateDoc().entrySet().iterator().next();
        assertThat(entry.getKey(), is("name"));
        assertThat((String)entry.getValue(), is("Vogon lyric fan"));

        assertTrue(plan.expectsAffectedRows());
    }
View Full Code Here

Examples of io.crate.planner.node.dml.ESUpdateNode

        Plan plan = plan("update users set name='Vogon lyric fan' where id in (1,2,3)");
        Iterator<PlanNode> iterator = plan.iterator();
        PlanNode planNode = iterator.next();
        assertThat(planNode, instanceOf(ESUpdateNode.class));

        ESUpdateNode updateNode = (ESUpdateNode)planNode;
        assertThat(updateNode.ids().size(), is(3));
        assertThat(updateNode.ids(), containsInAnyOrder("1", "2", "3"));
    }
View Full Code Here

Examples of io.crate.planner.node.dml.ESUpdateNode

    @Override
    protected Plan visitUpdateAnalysis(UpdateAnalysis analysis, Context context) {
        Plan plan = new Plan();
        for (UpdateAnalysis.NestedAnalysis nestedAnalysis : analysis.nestedAnalysis()) {
            if (!nestedAnalysis.hasNoResult()) {
                ESUpdateNode node = new ESUpdateNode(
                        indices(nestedAnalysis),
                        nestedAnalysis.assignments(),
                        nestedAnalysis.whereClause(),
                        nestedAnalysis.ids(),
                        nestedAnalysis.routingValues()
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.