當前位置: 首頁>>代碼示例>>Java>>正文


Java DataStatistics類代碼示例

本文整理匯總了Java中org.apache.flink.optimizer.DataStatistics的典型用法代碼示例。如果您正苦於以下問題:Java DataStatistics類的具體用法?Java DataStatistics怎麽用?Java DataStatistics使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DataStatistics類屬於org.apache.flink.optimizer包,在下文中一共展示了DataStatistics類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ClusterClient

import org.apache.flink.optimizer.DataStatistics; //導入依賴的package包/類
/**
 * Creates a instance that submits the programs to the JobManager defined in the
 * configuration. This method will try to resolve the JobManager hostname and throw an exception
 * if that is not possible.
 *
 * @param flinkConfig The config used to obtain the job-manager's address, and used to configure the optimizer.
 * @param highAvailabilityServices HighAvailabilityServices to use for leader retrieval
 */
public ClusterClient(Configuration flinkConfig, HighAvailabilityServices highAvailabilityServices) {
	this.flinkConfig = Preconditions.checkNotNull(flinkConfig);
	this.compiler = new Optimizer(new DataStatistics(), new DefaultCostEstimator(), flinkConfig);

	this.timeout = AkkaUtils.getClientTimeout(flinkConfig);
	this.lookupTimeout = AkkaUtils.getLookupTimeout(flinkConfig);

	this.actorSystemLoader = new LazyActorSystemLoader(
		highAvailabilityServices,
		Time.milliseconds(lookupTimeout.toMillis()),
		flinkConfig,
		log);

	this.highAvailabilityServices = Preconditions.checkNotNull(highAvailabilityServices);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:24,代碼來源:ClusterClient.java

示例2: computeOperatorSpecificDefaultEstimates

import org.apache.flink.optimizer.DataStatistics; //導入依賴的package包/類
/**
 * The default estimates build on the principle of inclusion: The smaller input key domain is included in the larger
 * input key domain. We also assume that every key from the larger input has one join partner in the smaller input.
 * The result cardinality is hence the larger one.
 */
@Override
protected void computeOperatorSpecificDefaultEstimates(DataStatistics statistics) {
	long card1 = getFirstPredecessorNode().getEstimatedNumRecords();
	long card2 = getSecondPredecessorNode().getEstimatedNumRecords();
	this.estimatedNumRecords = (card1 < 0 || card2 < 0) ? -1 : Math.max(card1, card2);
	
	if (this.estimatedNumRecords >= 0) {
		float width1 = getFirstPredecessorNode().getEstimatedAvgWidthPerOutputRecord();
		float width2 = getSecondPredecessorNode().getEstimatedAvgWidthPerOutputRecord();
		float width = (width1 <= 0 || width2 <= 0) ? -1 : width1 + width2;
		
		if (width > 0) {
			this.estimatedOutputSize = (long) (width * this.estimatedNumRecords);
		}
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:22,代碼來源:JoinNode.java

示例3: computeOperatorSpecificDefaultEstimates

import org.apache.flink.optimizer.DataStatistics; //導入依賴的package包/類
@Override
protected void computeOperatorSpecificDefaultEstimates(DataStatistics statistics) {
	long card1 = getFirstPredecessorNode().getEstimatedNumRecords();
	long card2 = getSecondPredecessorNode().getEstimatedNumRecords();

	if (card1 < 0 || card2 < 0) {
		this.estimatedNumRecords = -1;
	} else {
		this.estimatedNumRecords = Math.max(card1, card2);
	}

	if (this.estimatedNumRecords >= 0) {
		float width1 = getFirstPredecessorNode().getEstimatedAvgWidthPerOutputRecord();
		float width2 = getSecondPredecessorNode().getEstimatedAvgWidthPerOutputRecord();
		float width = (width1 <= 0 || width2 <= 0) ? -1 : width1 + width2;

		if (width > 0) {
			this.estimatedOutputSize = (long) (width * this.estimatedNumRecords);
		}
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:22,代碼來源:OuterJoinNode.java

示例4: computeOperatorSpecificDefaultEstimates

import org.apache.flink.optimizer.DataStatistics; //導入依賴的package包/類
/**
 * We assume that the cardinality is the product of  the input cardinalities
 * and that the result width is the sum of the input widths.
 * 
 * @param statistics The statistics object to optionally access.
 */
@Override
protected void computeOperatorSpecificDefaultEstimates(DataStatistics statistics) {
	long card1 = getFirstPredecessorNode().getEstimatedNumRecords();
	long card2 = getSecondPredecessorNode().getEstimatedNumRecords();
	this.estimatedNumRecords = (card1 < 0 || card2 < 0) ? -1 : card1 * card2;
	
	if (this.estimatedNumRecords >= 0) {
		float width1 = getFirstPredecessorNode().getEstimatedAvgWidthPerOutputRecord();
		float width2 = getSecondPredecessorNode().getEstimatedAvgWidthPerOutputRecord();
		float width = (width1 <= 0 || width2 <= 0) ? -1 : width1 + width2;
		
		if (width > 0) {
			this.estimatedOutputSize = (long) (width * this.estimatedNumRecords);
		}
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:23,代碼來源:CrossNode.java

示例5: getOptimizedPlan

import org.apache.flink.optimizer.DataStatistics; //導入依賴的package包/類
/**
 * Helpers to generate the JobGraph.
 */
private static JobGraph getOptimizedPlan(Plan plan) {
	Optimizer pc = new Optimizer(new DataStatistics(), new Configuration());
	JobGraphGenerator jgg = new JobGraphGenerator();
	OptimizedPlan op = pc.compile(plan);
	return jgg.compileJobGraph(op);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:10,代碼來源:AccumulatorLiveITCase.java

示例6: getJobGraphAndClassLoader

import org.apache.flink.optimizer.DataStatistics; //導入依賴的package包/類
protected Tuple2<JobGraph, ClassLoader> getJobGraphAndClassLoader(JarActionHandlerConfig config) throws Exception {
	// generate the graph
	JobGraph graph = null;

	PackagedProgram program = new PackagedProgram(
			new File(jarDir, config.getJarFile()),
			config.getEntryClass(),
			config.getProgramArgs());
	ClassLoader classLoader = program.getUserCodeClassLoader();

	Optimizer optimizer = new Optimizer(new DataStatistics(), new DefaultCostEstimator(), new Configuration());
	FlinkPlan plan = ClusterClient.getOptimizedPlan(optimizer, program, config.getParallelism());

	if (plan instanceof StreamingPlan) {
		graph = ((StreamingPlan) plan).getJobGraph();
	} else if (plan instanceof OptimizedPlan) {
		graph = new JobGraphGenerator().compileJobGraph((OptimizedPlan) plan);
	}
	if (graph == null) {
		throw new CompilerException("A valid job graph couldn't be generated for the jar.");
	}

	// Set the savepoint settings
	graph.setSavepointRestoreSettings(config.getSavepointRestoreSettings());

	for (URL jar : program.getAllLibraries()) {
		try {
			graph.addJar(new Path(jar.toURI()));
		}
		catch (URISyntaxException e) {
			throw new ProgramInvocationException("Invalid jar path. Unexpected error. :(");
		}
	}
	return Tuple2.of(graph, classLoader);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:36,代碼來源:JarActionHandler.java

示例7: getOptimizerPlanAsJSON

import org.apache.flink.optimizer.DataStatistics; //導入依賴的package包/類
/**
 * Creates a JSON representation of the given dataflow's execution plan.
 *
 * @param plan The dataflow plan.
 * @return The dataflow's execution plan, as a JSON string.
 * @throws Exception Thrown, if the optimization process that creates the execution plan failed.
 */
@Override
public String getOptimizerPlanAsJSON(Plan plan) throws Exception {
	final int parallelism = plan.getDefaultParallelism() == ExecutionConfig.PARALLELISM_DEFAULT ? 1 : plan.getDefaultParallelism();

	Optimizer pc = new Optimizer(new DataStatistics(), this.configuration);
	pc.setDefaultParallelism(parallelism);
	OptimizedPlan op = pc.compile(plan);

	return new PlanJSONDumpGenerator().getOptimizerPlanAsJSON(op);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:18,代碼來源:LocalExecutor.java

示例8: optimizerPlanAsJSON

import org.apache.flink.optimizer.DataStatistics; //導入依賴的package包/類
/**
 * Creates a JSON representation of the given dataflow's execution plan.
 *
 * @param plan The dataflow plan.
 * @return The dataflow's execution plan, as a JSON string.
 * @throws Exception Thrown, if the optimization process that creates the execution plan failed.
 */
public static String optimizerPlanAsJSON(Plan plan) throws Exception {
	final int parallelism = plan.getDefaultParallelism() == ExecutionConfig.PARALLELISM_DEFAULT ? 1 : plan.getDefaultParallelism();

	Optimizer pc = new Optimizer(new DataStatistics(), new Configuration());
	pc.setDefaultParallelism(parallelism);
	OptimizedPlan op = pc.compile(plan);

	return new PlanJSONDumpGenerator().getOptimizerPlanAsJSON(op);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:17,代碼來源:LocalExecutor.java

示例9: testGetExecutionPlan

import org.apache.flink.optimizer.DataStatistics; //導入依賴的package包/類
@Test
public void testGetExecutionPlan() {
	try {
		jobManagerSystem.actorOf(
			Props.create(FailureReturningActor.class),
			JobMaster.JOB_MANAGER_NAME);

		PackagedProgram prg = new PackagedProgram(TestOptimizerPlan.class, "/dev/random", "/tmp");
		assertNotNull(prg.getPreviewPlan());

		Optimizer optimizer = new Optimizer(new DataStatistics(), new DefaultCostEstimator(), config);
		OptimizedPlan op = (OptimizedPlan) ClusterClient.getOptimizedPlan(optimizer, prg, 1);
		assertNotNull(op);

		PlanJSONDumpGenerator dumper = new PlanJSONDumpGenerator();
		assertNotNull(dumper.getOptimizerPlanAsJSON(op));

		// test HTML escaping
		PlanJSONDumpGenerator dumper2 = new PlanJSONDumpGenerator();
		dumper2.setEncodeForHTML(true);
		String htmlEscaped = dumper2.getOptimizerPlanAsJSON(op);

		assertEquals(-1, htmlEscaped.indexOf('\\'));
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:30,代碼來源:ClientTest.java

示例10: testGetExecutionPlan

import org.apache.flink.optimizer.DataStatistics; //導入依賴的package包/類
@Test
public void testGetExecutionPlan() {
	try {
		PackagedProgram prg = new PackagedProgram(TestOptimizerPlan.class, "/dev/random", "/tmp");
		assertNotNull(prg.getPreviewPlan());

		InetAddress mockAddress = InetAddress.getLocalHost();
		InetSocketAddress mockJmAddress = new InetSocketAddress(mockAddress, 12345);

		Configuration config = new Configuration();

		config.setString(JobManagerOptions.ADDRESS, mockJmAddress.getHostName());
		config.setInteger(JobManagerOptions.PORT, mockJmAddress.getPort());

		Optimizer optimizer = new Optimizer(new DataStatistics(), new DefaultCostEstimator(), config);
		OptimizedPlan op = (OptimizedPlan) ClusterClient.getOptimizedPlan(optimizer, prg, -1);
		assertNotNull(op);

		PlanJSONDumpGenerator dumper = new PlanJSONDumpGenerator();
		assertNotNull(dumper.getOptimizerPlanAsJSON(op));

		// test HTML escaping
		PlanJSONDumpGenerator dumper2 = new PlanJSONDumpGenerator();
		dumper2.setEncodeForHTML(true);
		String htmlEscaped = dumper2.getOptimizerPlanAsJSON(op);

		assertEquals(-1, htmlEscaped.indexOf('\\'));
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:34,代碼來源:ExecutionPlanCreationTest.java

示例11: computeOperatorSpecificDefaultEstimates

import org.apache.flink.optimizer.DataStatistics; //導入依賴的package包/類
@Override
protected void computeOperatorSpecificDefaultEstimates(DataStatistics statistics) {
	long card1 = getFirstPredecessorNode().getEstimatedNumRecords();
	long card2 = getSecondPredecessorNode().getEstimatedNumRecords();
	this.estimatedNumRecords = (card1 < 0 || card2 < 0) ? -1 : card1 + card2;
	
	long size1 = getFirstPredecessorNode().getEstimatedOutputSize();
	long size2 = getSecondPredecessorNode().getEstimatedOutputSize();
	this.estimatedOutputSize = (size1 < 0 || size2 < 0) ? -1 : size1 + size2;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:11,代碼來源:BinaryUnionNode.java

示例12: computeOutputEstimates

import org.apache.flink.optimizer.DataStatistics; //導入依賴的package包/類
@Override
public void computeOutputEstimates(DataStatistics statistics) {
	OptimizerNode in1 = getFirstPredecessorNode();
	OptimizerNode in2 = getSecondPredecessorNode();
	
	this.estimatedNumRecords = in1.estimatedNumRecords > 0 && in2.estimatedNumRecords > 0 ?
			in1.estimatedNumRecords + in2.estimatedNumRecords : -1;
	this.estimatedOutputSize = in1.estimatedOutputSize > 0 && in2.estimatedOutputSize > 0 ?
		in1.estimatedOutputSize + in2.estimatedOutputSize : -1;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:11,代碼來源:BinaryUnionNode.java

示例13: setup

import org.apache.flink.optimizer.DataStatistics; //導入依賴的package包/類
@Before
public void setup() {
	Configuration flinkConf = new Configuration();
	this.dataStats = new DataStatistics();
	this.withStatsCompiler = new Optimizer(this.dataStats, new DefaultCostEstimator(), flinkConf);
	this.withStatsCompiler.setDefaultParallelism(DEFAULT_PARALLELISM);

	this.noStatsCompiler = new Optimizer(null, new DefaultCostEstimator(), flinkConf);
	this.noStatsCompiler.setDefaultParallelism(DEFAULT_PARALLELISM);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:11,代碼來源:CompilerTestBase.java

示例14: compileProgram

import org.apache.flink.optimizer.DataStatistics; //導入依賴的package包/類
private OptimizedPlan compileProgram(String jobName) {
	Plan p = createProgramPlan(jobName);

	Optimizer pc = new Optimizer(new DataStatistics(), new Configuration());
	return pc.compile(p);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:7,代碼來源:TestEnvironment.java

示例15: getJobGraph

import org.apache.flink.optimizer.DataStatistics; //導入依賴的package包/類
private JobGraph getJobGraph(final Plan plan) throws Exception {
	final Optimizer pc = new Optimizer(new DataStatistics(), this.executor.configuration());
	final OptimizedPlan op = pc.compile(plan);
	final JobGraphGenerator jgg = new JobGraphGenerator();
	return jgg.compileJobGraph(op);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:7,代碼來源:CancelingTestBase.java


注:本文中的org.apache.flink.optimizer.DataStatistics類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。