EstimatorBase extends PipelineStageBase<E> implements Estimator<E, M> { @Override public M fit(TableEnvironment tEnv, Table input) { Preconditions.checkArgument(input != null, "Input CAN NOT BE null!"); Preconditions.checkArgument( tableEnvOf(input) == tEnv, "The input table is not in the specified table environment."); return fit(input); } EstimatorBase();  EstimatorBase(Params params); @Override M fit(TableEnvironment tEnv, Table input); M fit(Table input); abstract M fit(BatchOperator input); M fit(StreamOperator input);  }
@Test public void testFitBatchTable() { Long id = MLEnvironmentFactory.getNewMLEnvironmentId(); MLEnvironment env = MLEnvironmentFactory.get(id); DataSet<Integer> input= env.getExecutionEnvironment().fromElements(1, 2, 3); Table table = env.getBatchTableEnvironment().fromDataSet(input); FakeEstimator estimator = new FakeEstimator(); estimator.setMLEnvironmentId(id); estimator.fit(env.getBatchTableEnvironment(), table); Assert.assertTrue(estimator.batchFitted); Assert.assertFalse(estimator.streamFitted); }
@Test public void testFitStreamTable() { Long id = MLEnvironmentFactory.getNewMLEnvironmentId(); MLEnvironment env = MLEnvironmentFactory.get(id); DataStream<Integer> input= env.getStreamExecutionEnvironment().fromElements(1, 2, 3); Table table = env.getStreamTableEnvironment().fromDataStream(input); FakeEstimator estimator = new FakeEstimator(); estimator.setMLEnvironmentId(id); estimator.fit(env.getStreamTableEnvironment(), table); Assert.assertFalse(estimator.batchFitted); Assert.assertTrue(estimator.streamFitted); }