Package io.crate.planner.node.dml

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


        XContentBuilder builder = XContentFactory.jsonBuilder().startObject();
        builder.field(id_ref.info().ident().columnIdent().name(), 99);
        builder.field(name_ref.info().ident().columnIdent().name(), "Marvin");

        ESIndexNode indexNode = new ESIndexNode(
                new String[]{"characters"},
                Arrays.asList(builder.bytes()),
                ImmutableList.of("99"),
                ImmutableList.of("99"),
                false,
View Full Code Here


                .put("id", 0L)
                .put("name", "Trillian")
                .map();
        BytesReference source = XContentFactory.jsonBuilder().map(sourceMap).bytes();
        PartitionName partitionName = new PartitionName("parted", Arrays.asList(new BytesRef("13959981214861")));
        ESIndexNode indexNode = new ESIndexNode(
                new String[]{partitionName.stringValue()},
                Arrays.asList(source),
                ImmutableList.of("123"),
                ImmutableList.of("123"),
                true,
View Full Code Here

        Map<String, Object> sourceMap2 = new HashMap<>();
        sourceMap2.put(id_ref.info().ident().columnIdent().name(), 42);
        sourceMap2.put(name_ref.info().ident().columnIdent().name(), "Deep Thought");
        BytesReference source2 = XContentFactory.jsonBuilder().map(sourceMap2).bytes();

        ESIndexNode indexNode = new ESIndexNode(
                new String[]{"characters"},
                Arrays.asList(source1, source2),
                ImmutableList.of("99", "42"),
                ImmutableList.of("99", "42"),
                false,
View Full Code Here

        Plan plan = plan("insert into users (id, name) values (42, 'Deep Thought')");
        Iterator<PlanNode> iterator = plan.iterator();
        PlanNode planNode = iterator.next();
        assertThat(planNode, instanceOf(ESIndexNode.class));

        ESIndexNode indexNode = (ESIndexNode) planNode;
        assertThat(indexNode.sourceMaps().size(), is(1));
        Map<String, Object> values = XContentHelper.convertToMap(indexNode.sourceMaps().get(0), false).v2();
        assertThat(values.size(), is(2));

        assertThat(values.keySet(), contains("id", "name"));

        assertThat((Integer) values.get("id"), is(42));
        assertThat((String) values.get("name"), is("Deep Thought"));

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

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

        Plan plan = plan("insert into users (id, name) values (42, 'Deep Thought'), (99, 'Marvin')");
        Iterator<PlanNode> iterator = plan.iterator();
        PlanNode planNode = iterator.next();
        assertThat(planNode, instanceOf(ESIndexNode.class));

        ESIndexNode indexNode = (ESIndexNode) planNode;

        Map<String, Object> values0 = XContentHelper.convertToMap(indexNode.sourceMaps().get(0), false).v2();
        assertThat(indexNode.sourceMaps().size(), is(2));
        assertThat(values0.size(), is(2));

        Map<String, Object> values1 = XContentHelper.convertToMap(indexNode.sourceMaps().get(1), false).v2();
        assertThat(values1.size(), is(2));

        assertThat((Integer) values0.get("id"), is(42));
        assertThat((String) values0.get("name"), is("Deep Thought"));

        assertThat((Integer) values1.get("id"), is(99));
        assertThat((String) values1.get("name"), is("Marvin"));

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

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

            indices = analysis.partitions().toArray(new String[analysis.partitions().size()]);
        } else {
            indices = new String[]{ analysis.table().ident().name() };
        }

        ESIndexNode indexNode = new ESIndexNode(
                indices,
                analysis.sourceMaps(),
                analysis.ids(),
                analysis.routingValues(),
                analysis.table().isPartitioned(),
View Full Code Here

TOP

Related Classes of io.crate.planner.node.dml.ESIndexNode

Copyright © 2018 www.massapicom. 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.