@Override public int hashCode() { return (this.abstractLabel.getName() + this.getName()).hashCode(); }
@Override public int hashCode() { return (this.abstractLabel.getName() + this.getName()).hashCode(); }
public String getFullName() { return getSchema().getName() + "." + getName(); }
public String getFullName() { return getSchema().getName() + "." + getName(); }
void detach() { StringBuilder sql = new StringBuilder(); sql.append("ALTER TABLE "); sql.append(this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.abstractLabel.getPrefix() + this.abstractLabel.getName())); sql.append(" DETACH PARTITION "); sql.append(this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.getAbstractLabel().getSchema().getName())); sql.append("."); sql.append(this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.name)); if (this.sqlgGraph.getSqlDialect().needsSemicolon()) { sql.append(";"); } if (logger.isDebugEnabled()) { logger.debug(sql.toString()); } Connection conn = this.sqlgGraph.tx().getConnection(); try (Statement stmt = conn.createStatement()) { stmt.execute(sql.toString()); } catch (SQLException e) { throw new RuntimeException(e); } }
void detach() { StringBuilder sql = new StringBuilder(); sql.append("ALTER TABLE "); sql.append(this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.abstractLabel.getPrefix() + this.abstractLabel.getName())); sql.append(" DETACH PARTITION "); sql.append(this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.getAbstractLabel().getSchema().getName())); sql.append("."); sql.append(this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.name)); if (this.sqlgGraph.getSqlDialect().needsSemicolon()) { sql.append(";"); } if (logger.isDebugEnabled()) { logger.debug(sql.toString()); } Connection conn = this.sqlgGraph.tx().getConnection(); try (Statement stmt = conn.createStatement()) { stmt.execute(sql.toString()); } catch (SQLException e) { throw new RuntimeException(e); } }
public static void addEdgeLabelPartition( SqlgGraph sqlgGraph, AbstractLabel abstractLabel, String name, String in, PartitionType partitionType, String partitionExpression) { addEdgeLabelPartition( sqlgGraph, abstractLabel.getSchema().getName(), abstractLabel.getName(), name, in, partitionType, partitionExpression ); }
public static void addEdgeLabelPartition( SqlgGraph sqlgGraph, AbstractLabel abstractLabel, String name, String in, PartitionType partitionType, String partitionExpression) { addEdgeLabelPartition( sqlgGraph, abstractLabel.getSchema().getName(), abstractLabel.getName(), name, in, partitionType, partitionExpression ); }
/** * Create a list partition on an {@link AbstractLabel} * * @param sqlgGraph * @param abstractLabel * @param name * @param in * @return */ static Partition createListPartition(SqlgGraph sqlgGraph, AbstractLabel abstractLabel, String name, String in) { Preconditions.checkArgument(!abstractLabel.getSchema().isSqlgSchema(), "createListPartition may not be called for \"%s\"", Topology.SQLG_SCHEMA); Partition partition = new Partition(sqlgGraph, abstractLabel, name, in, PartitionType.NONE, null); partition.createListPartitionOnDb(); if (abstractLabel instanceof VertexLabel) { TopologyManager.addVertexLabelPartition( sqlgGraph, abstractLabel.getSchema().getName(), abstractLabel.getName(), name, in, PartitionType.NONE, null); } else { TopologyManager.addEdgeLabelPartition(sqlgGraph, abstractLabel, name, in, PartitionType.NONE, null); } partition.committed = false; return partition; }
/** * Create a list partition on an {@link AbstractLabel} * * @param sqlgGraph * @param abstractLabel * @param name * @param in * @return */ static Partition createListPartition(SqlgGraph sqlgGraph, AbstractLabel abstractLabel, String name, String in) { Preconditions.checkArgument(!abstractLabel.getSchema().isSqlgSchema(), "createListPartition may not be called for \"%s\"", Topology.SQLG_SCHEMA); Partition partition = new Partition(sqlgGraph, abstractLabel, name, in, PartitionType.NONE, null); partition.createListPartitionOnDb(); if (abstractLabel instanceof VertexLabel) { TopologyManager.addVertexLabelPartition( sqlgGraph, abstractLabel.getSchema().getName(), abstractLabel.getName(), name, in, PartitionType.NONE, null); } else { TopologyManager.addEdgeLabelPartition(sqlgGraph, abstractLabel, name, in, PartitionType.NONE, null); } partition.committed = false; return partition; }
/** * Create a range partition on an {@link AbstractLabel} * * @param sqlgGraph * @param abstractLabel * @param name * @param from * @param to * @return */ static Partition createRangePartition(SqlgGraph sqlgGraph, AbstractLabel abstractLabel, String name, String from, String to) { Preconditions.checkArgument(!abstractLabel.getSchema().isSqlgSchema(), "createRangePartition may not be called for \"%s\"", Topology.SQLG_SCHEMA); Partition partition = new Partition(sqlgGraph, abstractLabel, name, from, to, PartitionType.NONE, null); partition.createRangePartitionOnDb(); if (abstractLabel instanceof VertexLabel) { TopologyManager.addVertexLabelPartition( sqlgGraph, abstractLabel.getSchema().getName(), abstractLabel.getName(), name, from, to, PartitionType.NONE, null); } else { TopologyManager.addEdgeLabelPartition(sqlgGraph, abstractLabel, name, from, to, PartitionType.NONE, null); } partition.committed = false; return partition; }
/** * Create a range partition on an {@link AbstractLabel} * * @param sqlgGraph * @param abstractLabel * @param name * @param from * @param to * @return */ static Partition createRangePartition(SqlgGraph sqlgGraph, AbstractLabel abstractLabel, String name, String from, String to) { Preconditions.checkArgument(!abstractLabel.getSchema().isSqlgSchema(), "createRangePartition may not be called for \"%s\"", Topology.SQLG_SCHEMA); Partition partition = new Partition(sqlgGraph, abstractLabel, name, from, to, PartitionType.NONE, null); partition.createRangePartitionOnDb(); if (abstractLabel instanceof VertexLabel) { TopologyManager.addVertexLabelPartition( sqlgGraph, abstractLabel.getSchema().getName(), abstractLabel.getName(), name, from, to, PartitionType.NONE, null); } else { TopologyManager.addEdgeLabelPartition(sqlgGraph, abstractLabel, name, from, to, PartitionType.NONE, null); } partition.committed = false; return partition; }
sqlgGraph, abstractLabel.getSchema().getName(), abstractLabel.getName(), name, in,
sqlgGraph, abstractLabel.getSchema().getName(), abstractLabel.getName(), name, in,
.has("name", abstractLabel.getSchema().getName()) .out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE) .has("name", abstractLabel.getName()) .toList(); } else { .has("name", colocate.getSchema().getName()) .out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE) .has("name", colocate.getName()) .toList(); Preconditions.checkState(colocateVertices.size() == 1, "Did not find the colocate %s vertex", colocate.getFullName());
.has("name", abstractLabel.getSchema().getName()) .out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE) .has("name", abstractLabel.getName()) .toList(); } else { .has("name", colocate.getSchema().getName()) .out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE) .has("name", colocate.getName()) .toList(); Preconditions.checkState(colocateVertices.size() == 1, "Did not find the colocate %s vertex", colocate.getFullName());
.has("name", abstractLabel.getSchema().getName()) .out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE) .has(SQLG_SCHEMA_VERTEX_LABEL_NAME, abstractLabel.getName()) .repeat(__.out(SQLG_SCHEMA_VERTEX_PARTITION_EDGE, SQLG_SCHEMA_PARTITION_PARTITION_EDGE)) .until(__.has(SQLG_SCHEMA_PARTITION_NAME, partition.getName())) .out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE) .out(SQLG_SCHEMA_OUT_EDGES_EDGE) .has(SQLG_SCHEMA_EDGE_LABEL_NAME, abstractLabel.getName()) .repeat(__.out(SQLG_SCHEMA_EDGE_PARTITION_EDGE, SQLG_SCHEMA_PARTITION_PARTITION_EDGE)) .until(__.has(SQLG_SCHEMA_PARTITION_NAME, partition.getName()))
.has("name", abstractLabel.getSchema().getName()) .out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE) .has(SQLG_SCHEMA_VERTEX_LABEL_NAME, abstractLabel.getName()) .repeat(__.out(SQLG_SCHEMA_VERTEX_PARTITION_EDGE, SQLG_SCHEMA_PARTITION_PARTITION_EDGE)) .until(__.has(SQLG_SCHEMA_PARTITION_NAME, partition.getName())) .out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE) .out(SQLG_SCHEMA_OUT_EDGES_EDGE) .has(SQLG_SCHEMA_EDGE_LABEL_NAME, abstractLabel.getName()) .repeat(__.out(SQLG_SCHEMA_EDGE_PARTITION_EDGE, SQLG_SCHEMA_PARTITION_PARTITION_EDGE)) .until(__.has(SQLG_SCHEMA_PARTITION_NAME, partition.getName()))
/** * Adds the partition to a partition. A new Vertex with label Partition is added and in linked to its parent with * the SQLG_SCHEMA_PARTITION_PARTITION_EDGE edge label. * * @param sqlgGraph */ public static void addSubPartition(SqlgGraph sqlgGraph, Partition partition) { AbstractLabel abstractLabel = partition.getAbstractLabel(); addSubPartition( sqlgGraph, partition.getParentPartition().getParentPartition() != null, abstractLabel instanceof VertexLabel, abstractLabel.getSchema().getName(), abstractLabel.getName(), partition.getParentPartition().getName(), partition.getName(), partition.getPartitionType(), partition.getPartitionExpression(), partition.getFrom(), partition.getTo(), partition.getIn() ); }
/** * Adds the partition to a partition. A new Vertex with label Partition is added and in linked to its parent with * the SQLG_SCHEMA_PARTITION_PARTITION_EDGE edge label. * * @param sqlgGraph */ public static void addSubPartition(SqlgGraph sqlgGraph, Partition partition) { AbstractLabel abstractLabel = partition.getAbstractLabel(); addSubPartition( sqlgGraph, partition.getParentPartition().getParentPartition() != null, abstractLabel instanceof VertexLabel, abstractLabel.getSchema().getName(), abstractLabel.getName(), partition.getParentPartition().getName(), partition.getName(), partition.getPartitionType(), partition.getPartitionExpression(), partition.getFrom(), partition.getTo(), partition.getIn() ); }