Package io.crate.metadata

Examples of io.crate.metadata.ColumnIdent


    static class NestedSettingExpression extends SysClusterObjectReference {

        private final Map<String, Object> values;

        protected NestedSettingExpression(Setting setting, Map<String, Object> values) {
            super(new ColumnIdent(NAME, setting.chain()));
            this.values = values;
            addChildImplementations(setting.children());
        }
View Full Code Here


public class NodeOsCpuExpression extends SysNodeObjectReference {

    public static final String NAME = "cpu";

    abstract class CpuExpression extends SysNodeExpression<Object> {
        CpuExpression(String name) {super(new ColumnIdent(NodeOsExpression.NAME, ImmutableList.of(NAME, name))); }
View Full Code Here

    protected void configure() {
        MapBinder<ReferenceIdent, ReferenceImplementation> b = MapBinder
                .newMapBinder(binder(), ReferenceIdent.class, ReferenceImplementation.class);

        Map<ColumnIdent, ReferenceInfo> infos = SysClusterTableInfo.INFOS;
        b.addBinding(infos.get(new ColumnIdent(ClusterIdExpression.NAME)).ident()).to(
                ClusterIdExpression.class).asEagerSingleton();
        b.addBinding(infos.get(new ColumnIdent(ClusterNameExpression.NAME)).ident()).to(
                ClusterNameExpression.class).asEagerSingleton();
        b.addBinding(infos.get(new ColumnIdent(ClusterMasterNodeExpression.NAME)).ident()).to(
                ClusterMasterNodeExpression.class).asEagerSingleton();
        b.addBinding(infos.get(new ColumnIdent(ClusterSettingsExpression.NAME)).ident()).to(
                ClusterSettingsExpression.class).asEagerSingleton();
    }
View Full Code Here

            super(InformationTablesTableInfo.ReferenceInfos.CLUSTERED_BY);
        }

        @Override
        public BytesRef value() {
            ColumnIdent clusteredBy = row.clusteredBy();
            if (clusteredBy == null) {
                return null;
            }
            return new BytesRef(clusteredBy.fqn());
        }
View Full Code Here

    private Map<ColumnIdent, ReferenceInfo> infos;
    private MapBinder<ReferenceIdent, ReferenceImplementation> refBinder;

    private void bindExpr(String name, Class clazz) {
        refBinder.addBinding(infos.get(new ColumnIdent(name)).ident()).to(clazz).asEagerSingleton();
    }
View Full Code Here

class NodeNetworkTCPExpression extends SysNodeObjectReference {

    public static final String NAME = "tcp";

    public NodeNetworkTCPExpression(NetworkService networkService) {
        super(new ColumnIdent(NodeNetworkExpression.NAME, ImmutableList.of(NAME)));
        childImplementations.put(TCPConnectionsExpression.NAME, new TCPConnectionsExpression(networkService));
        childImplementations.put(TCPPacketsExpression.NAME, new TCPPacketsExpression(networkService));
    }
View Full Code Here

        private static final String EMBRYONIC_DROPPED = "embryonic_dropped";

        private final NetworkService networkService;

        protected TCPConnectionsExpression(NetworkService networkService) {
            super(new ColumnIdent(NodeNetworkExpression.NAME,
                    ImmutableList.of(NodeNetworkTCPExpression.NAME, NAME)));
            this.networkService = networkService;
            addChildImplementations();
        }
View Full Code Here

        settings = ImmutableSettings.readSettingsFromStream(in);

        int numOverwrites = in.readVInt();
        overwrites = new HashMap<>(numOverwrites);
        for (int i = 0; i < numOverwrites; i++) {
            ColumnIdent columnIdent = new ColumnIdent();
            columnIdent.readFrom(in);
            overwrites.put(columnIdent, Symbol.fromStream(in));
        }
    }
View Full Code Here

        }

        @Override
        public Void visitNestedColumnDefinition(NestedColumnDefinition node, ColumnDefinitionContext context) {
            String columnName = ExpressionToStringVisitor.convert(node.name(), context.parameters);
            ColumnIdent ident = ColumnIdent.fromPath(columnName);
            context.analyzedColumnDefinition.name(ident.name());

            // nested columns can only be added using alter table so no other columns exist.
            assert context.analyzedTableElements.columns().size() == 0;

            AnalyzedColumnDefinition root = context.analyzedColumnDefinition;
            root.dataType(DataTypes.OBJECT.getName());
            if (!ident.path().isEmpty()) {
                AnalyzedColumnDefinition parent = context.analyzedColumnDefinition;
                AnalyzedColumnDefinition leaf = parent;
                for (String name : ident.path()) {
                    parent.dataType(DataTypes.OBJECT.getName());
                    parent.isParentColumn(true);
                    leaf = new AnalyzedColumnDefinition(parent);
                    leaf.name(name);
                    parent.addChild(leaf);
View Full Code Here

    }

    @Override
    public Void visitClusteredBy(ClusteredBy node, CreateTableAnalysis context) {
        if (node.column().isPresent()) {
            ColumnIdent routingColumn = ColumnIdent.fromPath(
                    ExpressionToStringVisitor.convert(node.column().get(), context.parameters()));

            if (!context.hasColumnDefinition(routingColumn)) {
                throw new IllegalArgumentException(
                        String.format(Locale.ENGLISH, "Invalid or non-existent routing column \"%s\"",
                                routingColumn));
            }
            if (context.primaryKeys().size() > 0 && !context.primaryKeys().contains(routingColumn.fqn())) {
                throw new IllegalArgumentException("Clustered by column must be part of primary keys");
            }

            context.routing(routingColumn);
        }
View Full Code Here

TOP

Related Classes of io.crate.metadata.ColumnIdent

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.