throw new OCommandExecutionException("Class " + className + " not found in the schema: " + query); } else if (statement.getTarget().getItem().getRids() != null) { this.rids = statement.getTarget().getItem().getRids().stream() .map(x -> x.toRecordId(new OResultInternal(), new OBasicCommandContext())).collect(Collectors.toList());
} else if (target.getRids() != null && target.getRids().size() > 0) { Set<String> filterClusters = info.serverToClusters.get(shardedPlan.getKey()); List<ORid> rids = new ArrayList<>(); for (ORid rid : target.getRids()) { if (filterClusters == null || isFromClusters(rid, filterClusters, ctx.getDatabase())) { rids.add(rid);
ODatabase db = ctx.getDatabase(); OFromItem item = info.target.getItem(); if (item.getRids() != null && item.getRids().size() > 0) { if (item.getRids().size() == 1) { OInteger cluster = item.getRids().get(0).getCluster(); result.add(db.getClusterNameById(cluster.getValue().intValue())); } else { for (ORid rid : item.getRids()) { OInteger cluster = rid.getCluster(); result.add(db.getClusterNameById(cluster.getValue().intValue()));
private void handleFetchFromTarger(OSelectExecutionPlan result, OCommandContext ctx, boolean profilingEnabled) { OFromItem target = this.target == null ? null : this.target.getItem(); if (target == null) { handleNoTarget(result, ctx, profilingEnabled); } else if (target.getIdentifier() != null) { handleClassAsTarget(result, this.target, ctx, profilingEnabled); } else if (target.getCluster() != null) { handleClustersAsTarget(result, Collections.singletonList(target.getCluster()), ctx, profilingEnabled); } else if (target.getClusterList() != null) { handleClustersAsTarget(result, target.getClusterList().toListOfClusters(), ctx, profilingEnabled); } else if (target.getStatement() != null) { handleSubqueryAsTarget(result, target.getStatement(), ctx, profilingEnabled); } else if (target.getFunctionCall() != null) { // handleFunctionCallAsTarget(result, target.getFunctionCall(), ctx);//TODO throw new OCommandExecutionException("function call as target is not supported yet"); } else if (target.getInputParam() != null) { handleInputParamAsTarget(result, target.getInputParam(), ctx, profilingEnabled); } else if (target.getIndex() != null) { handleIndexAsTarget(result, target.getIndex(), ctx, profilingEnabled); } else if (target.getMetadata() != null) { handleMetadataAsTarget(result, target.getMetadata(), ctx, profilingEnabled); } else if (target.getRids() != null && target.getRids().size() > 0) { handleRidsAsTarget(result, target.getRids(), ctx, profilingEnabled); } else { throw new UnsupportedOperationException(); } }
private void validateStatement(OSelectStatement statement) { if (statement.getProjection() != null) { if (statement.getProjection().getItems().size() > 1) { throw new OCommandExecutionException("Projections cannot be used in live query " + statement); } else if (statement.getProjection().getItems().get(0).isAll()) { throw new OCommandExecutionException("Projections cannot be used in live query " + statement); } } if (statement.getTarget().getItem().getIdentifier() == null && statement.getTarget().getItem().getRids() == null) { throw new OCommandExecutionException("Live queries can only be executed against a Class or on RIDs" + statement); } if (statement.getOrderBy() != null) { throw new OCommandExecutionException("Live queries do not support ORDER BY " + statement); } if (statement.getGroupBy() != null) { throw new OCommandExecutionException("Live queries do not support GROUP BY " + statement); } if (statement.getSkip() != null || statement.getLimit() != null) { throw new OCommandExecutionException("Live queries do not support SKIP/LIMIT " + statement); } }