APIFramework { public static AlgebricksAbsolutePartitionConstraint getJobLocations(JobSpecification spec, INodeJobTracker jobTracker, AlgebricksAbsolutePartitionConstraint clusterLocations) { final Set<String> jobParticipatingNodes = jobTracker.getJobParticipatingNodes(spec); return new AlgebricksAbsolutePartitionConstraint(Arrays.stream(clusterLocations.getLocations()) .filter(jobParticipatingNodes::contains).toArray(String[]::new)); } APIFramework(ILangCompilationProvider compilationProvider); Pair<IReturningStatement, Integer> reWriteQuery(List<FunctionDecl> declaredFunctions,
            MetadataProvider metadataProvider, IReturningStatement q, SessionOutput output, boolean inlineUdfs,
            Collection<VarIdentifier> externalVars, IWarningCollector warningCollector); JobSpecification compileQuery(IClusterInfoCollector clusterInfoCollector, MetadataProvider metadataProvider,
            Query query, int varCounter, String outputDatasetName, SessionOutput output,
            ICompiledDmlStatement statement, Map<VarIdentifier, IAObject> externalVars, IResponsePrinter printer,
            IWarningCollector warningCollector); void executeJobArray(IHyracksClientConnection hcc, JobSpecification[] specs, PrintWriter out); void executeJobArray(IHyracksClientConnection hcc, Job[] jobs, PrintWriter out); ExecutionPlans getExecutionPlans(); static AlgebricksAbsolutePartitionConstraint getJobLocations(JobSpecification spec,
            INodeJobTracker jobTracker, AlgebricksAbsolutePartitionConstraint clusterLocations); static final String PREFIX_INTERNAL_PARAMETERS; }
@Test public void testJobLocations() { final String nc1 = "nc1"; final String nc2 = "nc2"; final NodeJobTracker nodeJobTracker = new NodeJobTracker(); nodeJobTracker.notifyNodeJoin(nc1, null); nodeJobTracker.notifyNodeJoin(nc2, null); final JobSpecification jobSpec = new JobSpecification(); final ConstantExpression nc1Location = new ConstantExpression(nc1); final LValueConstraintExpression lValueMock = Mockito.mock(LValueConstraintExpression.class); jobSpec.getUserConstraints().add(new Constraint(lValueMock, nc1Location)); final String[] clusterLocation = new String[] { nc1, nc2 }; final AlgebricksAbsolutePartitionConstraint jobLocations = APIFramework.getJobLocations(jobSpec, nodeJobTracker, new AlgebricksAbsolutePartitionConstraint(clusterLocation)); Assert.assertEquals(1, jobLocations.getLocations().length); Assert.assertEquals(nc1, jobLocations.getLocations()[0]); }