private void init(ODatabase db) { if (this.clusterIds == null) { this.clusterIds = clusters.stream().map(x -> db.getClusterIdByName(x)).filter(x -> x != null).collect(Collectors.toSet()); } }
@Override public int getClusterIdByName(String clusterName) { return dbf.db().getClusterIdByName(clusterName); }
@Override public int getClusterIdByName(String clusterName) { return dbf.db().getClusterIdByName(clusterName); }
private List<com.orientechnologies.orient.core.storage.OCluster> getClusters(OCommandContext ctx) { OStorage storage = ((ODatabaseDocumentInternal) ctx.getDatabase()).getStorage(); if (starred) { List<com.orientechnologies.orient.core.storage.OCluster> result = new ArrayList<>(); for (String clusterName : storage.getClusterNames()) { if (clusterName.startsWith(name.getStringValue())) { result.add(storage.getClusterByName(clusterName)); } } return result; } else { int clusterId = ctx.getDatabase().getClusterIdByName(name.getStringValue()); if (clusterId <= 0) { throw new OCommandExecutionException("Cannot find cluster " + name); } com.orientechnologies.orient.core.storage.OCluster cluster = storage.getClusterById(clusterId); return Collections.singletonList(cluster); } }
private void handleTargetCluster(ODeleteExecutionPlan result, OCommandContext ctx, OIdentifier targetClusterName, boolean profilingEnabled) { if (targetClusterName != null) { String name = targetClusterName.getStringValue(); int clusterId = ctx.getDatabase().getClusterIdByName(name); if (clusterId < 0) { throw new OCommandExecutionException("Cluster not found: " + name); } result.chain(new FetchFromClusterExecutionStep(clusterId, ctx, profilingEnabled)); } }
throw new OCommandExecutionException("cluster not defined: " + clusterName); int clusterId = db.getClusterIdByName(clusterName); OClass oClass = db.getMetadata().getSchema().getClassByClusterId(clusterId); if (oClass != null) {
int[] filterClusterIds = null; if (filterClusters != null) { filterClusterIds = filterClusters.stream().map(name -> ctx.getDatabase().getClusterIdByName(name)).mapToInt(i -> i) .toArray();
Integer clusterId = cluster.getClusterNumber(); if (clusterId == null) { clusterId = db.getClusterIdByName(cluster.getClusterName()); Integer clusterId = cluster.getClusterNumber(); if (clusterId == null) { clusterId = db.getClusterIdByName(cluster.getClusterName());
private OExecutionStepInternal createParallelIndexFetch(List<IndexSearchDescriptor> indexSearchDescriptors, Set<String> filterClusters, OCommandContext ctx, boolean profilingEnabled) { List<OInternalExecutionPlan> subPlans = new ArrayList<>(); for (IndexSearchDescriptor desc : indexSearchDescriptors) { OSelectExecutionPlan subPlan = new OSelectExecutionPlan(ctx); subPlan.chain(new FetchFromIndexStep(desc.idx, desc.keyCondition, desc.additionalRangeCondition, ctx, profilingEnabled)); int[] filterClusterIds = null; if (filterClusters != null) { filterClusterIds = filterClusters.stream().map(name -> ctx.getDatabase().getClusterIdByName(name)).mapToInt(i -> i) .toArray(); } subPlan.chain(new GetValueFromIndexEntryStep(ctx, filterClusterIds, profilingEnabled)); if (requiresMultipleIndexLookups(desc.keyCondition)) { subPlan.chain(new DistinctExecutionStep(ctx, profilingEnabled)); } if (desc.remainingCondition != null && !desc.remainingCondition.isEmpty()) { subPlan.chain(new FilterStep(createWhereFrom(desc.remainingCondition), ctx, profilingEnabled)); } subPlans.add(subPlan); } return new ParallelExecStep(subPlans, ctx, profilingEnabled); }
int[] filterClusterIds = null; if (filterClusters != null) { filterClusterIds = filterClusters.stream().map(name -> ctx.getDatabase().getClusterIdByName(name)).mapToInt(i -> i) .toArray();
clusterId = db.getClusterIdByName(name); Integer clusterId = cluster.getClusterNumber(); if (clusterId == null) { clusterId = db.getClusterIdByName(cluster.getClusterName()); Integer clusterId = cluster.getClusterNumber(); if (clusterId == null) { clusterId = db.getClusterIdByName(cluster.getClusterName());
clusterId = db.getClusterIdByName(clusterName); } else if (cluster.getClusterName() != null) { clusterId = db.getClusterIdByName(cluster.getClusterName()); } else { clusterId = cluster.getClusterNumber();
String clusterName = targetClusterName(item, iCommandContext); if (clusterName != null) { clusterId = iCommandContext.getDatabase().getClusterIdByName(clusterName);
filterClusterIds = filterClusters.stream().map(name -> ctx.getDatabase().getClusterIdByName(name)).mapToInt(i -> i).toArray();
private boolean clusterMatchesRidRange(String clusterName, OAndBlock ridRangeConditions, ODatabase database, OCommandContext ctx) { int thisClusterId = database.getClusterIdByName(clusterName); for (OBooleanExpression ridRangeCondition : ridRangeConditions.getSubBlocks()) { if (ridRangeCondition instanceof OBinaryCondition) { OBinaryCompareOperator operator = ((OBinaryCondition) ridRangeCondition).getOperator(); ORID conditionRid; Object obj; if (((OBinaryCondition) ridRangeCondition).getRight().getRid() != null) { obj = ((OBinaryCondition) ridRangeCondition).getRight().getRid().toRecordId((OResult) null, ctx); } else { obj = ((OBinaryCondition) ridRangeCondition).getRight().execute((OResult) null, ctx); } conditionRid = ((OIdentifiable) obj).getIdentity(); if (conditionRid != null) { int conditionClusterId = conditionRid.getClusterId(); if (operator instanceof OGtOperator || operator instanceof OGeOperator) { if (thisClusterId < conditionClusterId) { return false; } } else if (operator instanceof OLtOperator || operator instanceof OLeOperator) { if (thisClusterId > conditionClusterId) { return false; } } } } } return true; }
int[] filterClusterIds = null; if (filterClusters != null) { filterClusterIds = filterClusters.stream().map(name -> ctx.getDatabase().getClusterIdByName(name)).mapToInt(i -> i) .toArray();
@Override public OResultSet executeDDL(OCommandContext ctx) { ODatabase db = ctx.getDatabase(); int existingId = db.getClusterIdByName(name.getStringValue()); if (existingId >= 0) { if (ifNotExists) {
int clusterId = -1; if (identifierValue != null) { clusterId = ctx.getDatabase().getClusterIdByName(identifierValue.getStringValue()); if (clusterId < 0) { throw new OCommandExecutionException("Cluster not found: " + toString()); oClass.setDefaultClusterId(defaultClusterId.getValue().intValue()); } else if (defaultClusterName != null) { int clusterId = ctx.getDatabase().getClusterIdByName(defaultClusterName.getStringValue()); oClass.setDefaultClusterId(clusterId);