Examples of PartitionName


Examples of io.crate.PartitionName

            List<BytesRef> values = new ArrayList<>(map.size());
            List<String> columnNames = partitionedByColumnNames();
            for (String columnName : columnNames) {
                values.add(BytesRefs.toBytesRef(map.get(columnName)));
            }
            PartitionName partitionName = new PartitionName(
                table().ident().name(),
                values
            );
            partitionValues.add(partitionName.stringValue());
        }
        return partitionValues;
    }
View Full Code Here

Examples of io.crate.PartitionName

                        .initialCapacity(10)
                        .maximumSize(20)
                        .build(new CacheLoader<List<BytesRef>, String>() {
                            @Override
                            public String load(@Nonnull List<BytesRef> key) throws Exception {
                                return new PartitionName(tableName, key).stringValue();
                            }
                        });
        } else {
            partitionIdentCache = null;
        }
View Full Code Here

Examples of io.crate.PartitionName

                        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++;
                }
            } else {
                logger.error("Orphaned partition '{}' with missing table '{}' found",
View Full Code Here

Examples of io.crate.PartitionName

    }

    private void setTableAndPartitionName(Table node, AddColumnAnalysis context) {
        context.table(TableIdent.of(node));
        if (!node.partitionProperties().isEmpty()) {
            PartitionName partitionName = PartitionPropertiesAnalyzer.toPartitionName(
                    context.table(),
                    node.partitionProperties(),
                    context.parameters());
            if (!context.table().partitions().contains(partitionName)) {
                throw new IllegalArgumentException("Referenced partition does not exist.");
View Full Code Here

Examples of io.crate.PartitionName

        execute("insert into quotes (id, quote, date) values (?, ?, ?)",
                new Object[]{3, "Time is a illusion. Lunchtime doubles so", 1495961200000L}
        );
        execute("refresh table quotes");

        String partition = new PartitionName("quotes", Arrays.asList(new BytesRef("1495961200000"))).stringValue();
        GetSettingsResponse settingsResponse = client().admin().indices().prepareGetSettings(
                partition).execute().get();
        assertThat(settingsResponse.getSetting(partition, IndexMetaData.SETTING_NUMBER_OF_SHARDS), is("5"));
    }
View Full Code Here

Examples of io.crate.PartitionName

    private Map<String, Object> preparePartitionValues(ESGetNode node) {
        Map<String, Object> partitionValues;
        if (node.partitionBy().isEmpty()) {
            partitionValues = ImmutableMap.of();
        } else {
            PartitionName partitionName = PartitionName.fromStringSafe(node.index());
            int numPartitionColumns = node.partitionBy().size();
            partitionValues = new HashMap<>(numPartitionColumns);
            for (int i = 0; i < node.partitionBy().size(); i++) {
                ReferenceInfo info = node.partitionBy().get(i);
                partitionValues.put(
                        info.ident().columnIdent().fqn(),
                        info.type().value(partitionName.values().get(i))
                );
            }
        }
        return partitionValues;
    }
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.