Package io.crate.metadata.doc

Examples of io.crate.metadata.doc.DocTableInfo


    @Test
    public void testESSearchTask() throws Exception {
        insertCharacters();

        DocTableInfo characters = docSchemaInfo.getTableInfo("characters");

        QueryThenFetchNode node = new QueryThenFetchNode(
                characters.getRouting(WhereClause.MATCH_ALL),
                Arrays.<Symbol>asList(id_ref, name_ref),
                Arrays.<Symbol>asList(name_ref),
                new boolean[]{false},
                new Boolean[] { null },
                null, null, WhereClause.MATCH_ALL,
View Full Code Here


        Function whereClause = new Function(new FunctionInfo(
                new FunctionIdent(EqOperator.NAME, Arrays.<DataType>asList(DataTypes.STRING, DataTypes.STRING)),
                DataTypes.BOOLEAN),
                Arrays.<Symbol>asList(name_ref, Literal.newLiteral("Ford")));

        DocTableInfo characters = docSchemaInfo.getTableInfo("characters");
        QueryThenFetchNode node = new QueryThenFetchNode(
                characters.getRouting(WhereClause.MATCH_ALL),
                Arrays.<Symbol>asList(id_ref, name_ref),
                Arrays.<Symbol>asList(name_ref),
                new boolean[]{false},
                new Boolean[] { null },
                null, null,
View Full Code Here

                new FunctionIdent(EqOperator.NAME, Arrays.<DataType>asList(DataTypes.INTEGER, DataTypes.INTEGER)),
                DataTypes.BOOLEAN),
                Arrays.<Symbol>asList(id_ref, Literal.newLiteral(2))
        );

        DocTableInfo searchf = docSchemaInfo.getTableInfo("searchf");
        QueryThenFetchNode node = new QueryThenFetchNode(
                searchf.getRouting(WhereClause.MATCH_ALL),
                Arrays.<Symbol>asList(id_ref, date_ref),
                Arrays.<Symbol>asList(id_ref),
                new boolean[]{false},
                new Boolean[] { null },
                null, null,
View Full Code Here

        // get partitions
        ImmutableOpenMap<String, List<AliasMetaData>> aliases =
                client().admin().indices().prepareGetAliases().addAliases("parted")
                        .execute().actionGet().getAliases();

        DocTableInfo parted = docSchemaInfo.getTableInfo("parted");
        QueryThenFetchNode node = new QueryThenFetchNode(
                parted.getRouting(WhereClause.MATCH_ALL),
                Arrays.<Symbol>asList(parted_id_ref, parted_name_ref, parted_date_ref),
                Arrays.<Symbol>asList(name_ref),
                new boolean[]{false},
                new Boolean[] { null },
                null, null,
View Full Code Here

        Object[][] rows = taskResult.rows();
        assertThat(rows.length, is(0));
        assertThat(taskResult.rowCount(), is(-1L));

        // verify deletion
        DocTableInfo characters = docSchemaInfo.getTableInfo("characters");
        QueryThenFetchNode searchNode = new QueryThenFetchNode(
                characters.getRouting(WhereClause.MATCH_ALL),
                Arrays.<Symbol>asList(id_ref, name_ref),
                Arrays.<Symbol>asList(name_ref),
                new boolean[]{false},
                new Boolean[] { null },
                null, null,
View Full Code Here

        Function searchWhereClause = new Function(new FunctionInfo(
                new FunctionIdent(EqOperator.NAME, Arrays.<DataType>asList(DataTypes.STRING, DataTypes.STRING)),
                DataTypes.BOOLEAN),
                Arrays.<Symbol>asList(name_ref, Literal.newLiteral("mostly harmless")));

        DocTableInfo characters = docSchemaInfo.getTableInfo("characters");
        QueryThenFetchNode node = new QueryThenFetchNode(
                characters.getRouting(WhereClause.MATCH_ALL),
                Arrays.<Symbol>asList(id_ref, name_ref),
                ImmutableList.<Symbol>of(id_ref),
                new boolean[]{false},
                new Boolean[] { null },
                null, null, new WhereClause(searchWhereClause),
View Full Code Here

    @Test
    public void testDocTable() throws Exception {
        execute("create table t1 (id int primary key, name string, details object(dynamic) as (size byte, created timestamp)) clustered into 10 shards with(number_of_replicas=1)");
        ensureGreen();

        DocTableInfo ti = (DocTableInfo) referenceInfos.getTableInfo(new TableIdent(null, "t1"));
        assertThat(ti.ident().name(), is("t1"));

        assertThat(ti.columns().size(), is(3));
        assertThat(ti.primaryKey().size(), is(1));
        assertThat(ti.primaryKey().get(0), is(new ColumnIdent("id")));
        assertThat(ti.clusteredBy(), is(new ColumnIdent("id")));

        Routing routing = ti.getRouting(WhereClause.MATCH_ALL);

        Set<String> nodes = routing.nodes();

        assertThat(nodes.size(), is(2));
        int numShards = 0;
View Full Code Here

        if (PartitionName.isPartition(index.name())) {
            String tableName = PartitionName.tableName(index.name());
            // check if alias exists
            if (clusterService.state().metaData().hasConcreteIndex(tableName)) {
                // get DocTableInfo for virtual partitioned table
                DocTableInfo info = new DocTableInfoBuilder(
                        docSchemaInfo,
                        new TableIdent(DocSchemaInfo.NAME, tableName),
                        clusterService, transportPutIndexTemplateAction, true).build();
                assert info.isPartitioned();
                int i = 0;
                int numPartitionedColumns = info.partitionedByColumns().size();

                PartitionName partitionName;
                try {
                    partitionName = PartitionName.fromString(
                            index.name(),
                            tableName);
                } catch (IllegalArgumentException e) {
                    throw new UnhandledServerException(
                            String.format(Locale.ENGLISH,
                                    "Unable to load PARTITIONED BY columns from partition %s",
                                    index.name()),
                            e
                    );
                }
                assert partitionName.values().size() == numPartitionedColumns : "invalid number of partitioned columns";
                for (ReferenceInfo partitionedInfo : info.partitionedByColumns()) {
                    builder.put(partitionedInfo.ident(), new PartitionedColumnExpression(
                            partitionedInfo,
                            partitionName.values().get(i)
                    ));
                    i++;
View Full Code Here

TOP

Related Classes of io.crate.metadata.doc.DocTableInfo

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.