• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Table类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.flink.table.api.Table的典型用法代码示例。如果您正苦于以下问题:Java Table类的具体用法?Java Table怎么用?Java Table使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Table类属于org.apache.flink.table.api包,在下文中一共展示了Table类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testAggregationWithTwoCount

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Test
public void testAggregationWithTwoCount() throws Exception {
	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env, config());

	DataSource<Tuple2<Float, String>> input =
		env.fromElements(
			new Tuple2<>(1f, "Hello"),
			new Tuple2<>(2f, "Ciao"));

	Table table =
		tableEnv.fromDataSet(input);

	Table result =
		table.select("f0.count, f1.count");

	DataSet<Row> ds = tableEnv.toDataSet(result, Row.class);
	List<Row> results = ds.collect();
	String expected = "2,2";
	compareResultAsText(results, expected);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:22,代码来源:AggregationsITCase.java


示例2: testTableSourceFullScan

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Test
public void testTableSourceFullScan() throws Exception {

	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	env.setParallelism(4);
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env, new TableConfig());
	HBaseTableSource hbaseTable = new HBaseTableSource(getConf(), TEST_TABLE);
	hbaseTable.addColumn(FAMILY1, F1COL1, Integer.class);
	hbaseTable.addColumn(FAMILY2, F2COL1, String.class);
	hbaseTable.addColumn(FAMILY2, F2COL2, Long.class);
	hbaseTable.addColumn(FAMILY3, F3COL1, Double.class);
	hbaseTable.addColumn(FAMILY3, F3COL2, Boolean.class);
	hbaseTable.addColumn(FAMILY3, F3COL3, String.class);
	tableEnv.registerTableSource("hTable", hbaseTable);

	Table result = tableEnv.sqlQuery(
		"SELECT " +
			"  h.family1.col1, " +
			"  h.family2.col1, " +
			"  h.family2.col2, " +
			"  h.family3.col1, " +
			"  h.family3.col2, " +
			"  h.family3.col3 " +
			"FROM hTable AS h"
	);
	DataSet<Row> resultSet = tableEnv.toDataSet(result, Row.class);
	List<Row> results = resultSet.collect();

	String expected =
		"10,Hello-1,100,1.01,false,Welt-1\n" +
		"20,Hello-2,200,2.02,true,Welt-2\n" +
		"30,Hello-3,300,3.03,false,Welt-3\n" +
		"40,null,400,4.04,true,Welt-4\n" +
		"50,Hello-5,500,5.05,false,Welt-5\n" +
		"60,Hello-6,600,6.06,true,Welt-6\n" +
		"70,Hello-7,700,7.07,false,Welt-7\n" +
		"80,null,800,8.08,true,Welt-8\n";

	TestBaseUtils.compareResultAsText(results, expected);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:41,代码来源:HBaseConnectorITCase.java


示例3: testAsFromPojoProjected

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Test
public void testAsFromPojoProjected() throws Exception {
	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env, config());

	List<SmallPojo> data = new ArrayList<>();
	data.add(new SmallPojo("Peter", 28, 4000.00, "Sales", new Integer[] {42}));
	data.add(new SmallPojo("Anna", 56, 10000.00, "Engineering", new Integer[] {}));
	data.add(new SmallPojo("Lucy", 42, 6000.00, "HR", new Integer[] {1, 2, 3}));

	Table table = tableEnv
		.fromDataSet(env.fromCollection(data), "name AS d")
		.select("d");

	DataSet<Row> ds = tableEnv.toDataSet(table, Row.class);
	List<Row> results = ds.collect();
	String expected =
		"Peter\n" +
		"Anna\n" +
		"Lucy\n";
	compareResultAsText(results, expected);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:JavaTableEnvironmentITCase.java


示例4: main

import org.apache.flink.table.api.Table; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	ExecutionEnvironment env = ExecutionEnvironment.createCollectionsEnvironment();
	BatchTableEnvironment tEnv = TableEnvironment.getTableEnvironment(env);

	DataSet<WC> input = env.fromElements(
			new WC("Hello", 1),
			new WC("Ciao", 1),
			new WC("Hello", 1));

	Table table = tEnv.fromDataSet(input);

	Table filtered = table
			.groupBy("word")
			.select("word, frequency.sum as frequency")
			.filter("frequency = 2");

	DataSet<WC> result = tEnv.toDataSet(filtered, WC.class);

	result.print();
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:WordCountTable.java


示例5: main

import org.apache.flink.table.api.Table; //导入依赖的package包/类
public static void main(String[] args) throws Exception {

		// set up execution environment
		ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
		BatchTableEnvironment tEnv = TableEnvironment.getTableEnvironment(env);

		DataSet<WC> input = env.fromElements(
			new WC("Hello", 1),
			new WC("Ciao", 1),
			new WC("Hello", 1));

		// register the DataSet as table "WordCount"
		tEnv.registerDataSet("WordCount", input, "word, frequency");

		// run a SQL query on the Table and retrieve the result as a new Table
		Table table = tEnv.sql(
			"SELECT word, SUM(frequency) as frequency FROM WordCount GROUP BY word");

		DataSet<WC> result = tEnv.toDataSet(table, WC.class);

		result.print();
	}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:WordCountSQL.java


示例6: testSelect

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Test
public void testSelect() throws Exception {
	StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
	StreamTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env);
	StreamITCase.clear();

	DataStream<Tuple3<Integer, Long, String>> ds = StreamTestData.getSmall3TupleDataSet(env);
	Table in = tableEnv.fromDataStream(ds, "a,b,c");
	tableEnv.registerTable("MyTable", in);

	String sqlQuery = "SELECT * FROM MyTable";
	Table result = tableEnv.sql(sqlQuery);

	DataStream<Row> resultSet = tableEnv.toAppendStream(result, Row.class);
	resultSet.addSink(new StreamITCase.StringSink<Row>());
	env.execute();

	List<String> expected = new ArrayList<>();
	expected.add("1,1,Hi");
	expected.add("2,2,Hello");
	expected.add("3,2,Hello world");

	StreamITCase.compareWithList(expected);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:SqlITCase.java


示例7: testAsFromTupleToPojo

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Ignore
@Test
public void testAsFromTupleToPojo() throws Exception {
	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env, config());

	List<Tuple4<String, Integer, Double, String>> data = new ArrayList<>();
	data.add(new Tuple4<>("Rofl", 1, 1.0, "Hi"));
	data.add(new Tuple4<>("lol", 2, 1.0, "Hi"));
	data.add(new Tuple4<>("Test me", 4, 3.33, "Hello world"));

	Table table = tableEnv
		.fromDataSet(env.fromCollection(data), "q, w, e, r")
		.select("q as a, w as b, e as c, r as d");

	DataSet<SmallPojo2> ds = tableEnv.toDataSet(table, SmallPojo2.class);
	List<SmallPojo2> results = ds.collect();
	String expected = "Rofl,1,1.0,Hi\n" + "lol,2,1.0,Hi\n" + "Test me,4,3.33,Hello world\n";
	compareResultAsText(results, expected);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:JavaTableEnvironmentITCase.java


示例8: testSimpleRegister

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Test
public void testSimpleRegister() throws Exception {
	final String tableName = "MyTable";
	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env, config());

	DataSet<Tuple3<Integer, Long, String>> ds = CollectionDataSets.get3TupleDataSet(env);
	tableEnv.registerDataSet(tableName, ds);
	Table t = tableEnv.scan(tableName);

	Table result = t.select("f0, f1");

	DataSet<Row> resultSet = tableEnv.toDataSet(result, Row.class);
	List<Row> results = resultSet.collect();
	String expected = "1,1\n" + "2,2\n" + "3,2\n" + "4,3\n" + "5,3\n" + "6,3\n" + "7,4\n" +
			"8,4\n" + "9,4\n" + "10,4\n" + "11,5\n" + "12,5\n" + "13,5\n" + "14,5\n" + "15,5\n" +
			"16,6\n" + "17,6\n" + "18,6\n" + "19,6\n" + "20,6\n" + "21,6\n";
	compareResultAsText(results, expected);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:20,代码来源:TableEnvironmentITCase.java


示例9: testTableRegister

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Test
public void testTableRegister() throws Exception {
	final String tableName = "MyTable";
	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env, config());

	DataSet<Tuple3<Integer, Long, String>> ds = CollectionDataSets.get3TupleDataSet(env);
	Table t = tableEnv.fromDataSet(ds);
	tableEnv.registerTable(tableName, t);
	Table result = tableEnv.scan(tableName).select("f0, f1").filter("f0 > 7");

	DataSet<Row> resultSet = tableEnv.toDataSet(result, Row.class);
	List<Row> results = resultSet.collect();
	String expected = "8,4\n" + "9,4\n" + "10,4\n" + "11,5\n" + "12,5\n" +
			"13,5\n" + "14,5\n" + "15,5\n" +
			"16,6\n" + "17,6\n" + "18,6\n" + "19,6\n" + "20,6\n" + "21,6\n";
	compareResultAsText(results, expected);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:19,代码来源:TableEnvironmentITCase.java


示例10: testAsFromTuple

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Test
public void testAsFromTuple() throws Exception {
	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env, config());

	Table table = tableEnv
		.fromDataSet(CollectionDataSets.get3TupleDataSet(env), "a, b, c")
		.select("a, b, c");

	DataSet<Row> ds = tableEnv.toDataSet(table, Row.class);
	List<Row> results = ds.collect();
	String expected = "1,1,Hi\n" + "2,2,Hello\n" + "3,2,Hello world\n" +
		"4,3,Hello world, how are you?\n" + "5,3,I am fine.\n" + "6,3,Luke Skywalker\n" +
		"7,4,Comment#1\n" + "8,4,Comment#2\n" + "9,4,Comment#3\n" + "10,4,Comment#4\n" +
		"11,5,Comment#5\n" + "12,5,Comment#6\n" + "13,5,Comment#7\n" +
		"14,5,Comment#8\n" + "15,5,Comment#9\n" + "16,6,Comment#10\n" +
		"17,6,Comment#11\n" + "18,6,Comment#12\n" + "19,6,Comment#13\n" +
		"20,6,Comment#14\n" + "21,6,Comment#15\n";
	compareResultAsText(results, expected);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:TableEnvironmentITCase.java


示例11: testAsFromAndToTuple

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Test
public void testAsFromAndToTuple() throws Exception {
	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env, config());

	Table table = tableEnv
		.fromDataSet(CollectionDataSets.get3TupleDataSet(env), "a, b, c")
		.select("a, b, c");

	TypeInformation<?> ti = new TupleTypeInfo<Tuple3<Integer, Long, String>>(
		BasicTypeInfo.INT_TYPE_INFO,
		BasicTypeInfo.LONG_TYPE_INFO,
		BasicTypeInfo.STRING_TYPE_INFO);

	DataSet<?> ds = tableEnv.toDataSet(table, ti);
	List<?> results = ds.collect();
	String expected = "(1,1,Hi)\n" + "(2,2,Hello)\n" + "(3,2,Hello world)\n" +
		"(4,3,Hello world, how are you?)\n" + "(5,3,I am fine.)\n" + "(6,3,Luke Skywalker)\n" +
		"(7,4,Comment#1)\n" + "(8,4,Comment#2)\n" + "(9,4,Comment#3)\n" + "(10,4,Comment#4)\n" +
		"(11,5,Comment#5)\n" + "(12,5,Comment#6)\n" + "(13,5,Comment#7)\n" +
		"(14,5,Comment#8)\n" + "(15,5,Comment#9)\n" + "(16,6,Comment#10)\n" +
		"(17,6,Comment#11)\n" + "(18,6,Comment#12)\n" + "(19,6,Comment#13)\n" +
		"(20,6,Comment#14)\n" + "(21,6,Comment#15)\n";
	compareResultAsText(results, expected);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:26,代码来源:JavaTableEnvironmentITCase.java


示例12: testAsFromTupleByPosition

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Test
public void testAsFromTupleByPosition() throws Exception {
	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env, config());

	Table table = tableEnv
		.fromDataSet(CollectionDataSets.get3TupleDataSet(env), "a, b, c")
		.select("a, b, c");

	DataSet<Row> ds = tableEnv.toDataSet(table, Row.class);
	List<Row> results = ds.collect();
	String expected = "1,1,Hi\n" + "2,2,Hello\n" + "3,2,Hello world\n" +
		"4,3,Hello world, how are you?\n" + "5,3,I am fine.\n" + "6,3,Luke Skywalker\n" +
		"7,4,Comment#1\n" + "8,4,Comment#2\n" + "9,4,Comment#3\n" + "10,4,Comment#4\n" +
		"11,5,Comment#5\n" + "12,5,Comment#6\n" + "13,5,Comment#7\n" +
		"14,5,Comment#8\n" + "15,5,Comment#9\n" + "16,6,Comment#10\n" +
		"17,6,Comment#11\n" + "18,6,Comment#12\n" + "19,6,Comment#13\n" +
		"20,6,Comment#14\n" + "21,6,Comment#15\n";
	compareResultAsText(results, expected);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:JavaTableEnvironmentITCase.java


示例13: main

import org.apache.flink.table.api.Table; //导入依赖的package包/类
public static void main(String[] args) throws Exception {

		// set up execution environment
		ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
		BatchTableEnvironment tEnv = TableEnvironment.getTableEnvironment(env);

		DataSet<WC> input = env.fromElements(
			new WC("Hello", 1),
			new WC("Ciao", 1),
			new WC("Hello", 1));

		// register the DataSet as table "WordCount"
		tEnv.registerDataSet("WordCount", input, "word, frequency");

		// run a SQL query on the Table and retrieve the result as a new Table
		Table table = tEnv.sqlQuery(
			"SELECT word, SUM(frequency) as frequency FROM WordCount GROUP BY word");

		DataSet<WC> result = tEnv.toDataSet(table, WC.class);

		result.print();
	}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:WordCountSQL.java


示例14: testJoin

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Test
public void testJoin() throws Exception {
	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env, config());

	DataSet<Tuple3<Integer, Long, String>> ds1 = CollectionDataSets.getSmall3TupleDataSet(env);
	DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds2 = CollectionDataSets.get5TupleDataSet(env);

	tableEnv.registerDataSet("t1", ds1, "a, b, c");
	tableEnv.registerDataSet("t2", ds2, "d, e, f, g, h");

	String sqlQuery = "SELECT c, g FROM t1, t2 WHERE b = e";
	Table result = tableEnv.sqlQuery(sqlQuery);

	DataSet<Row> resultSet = tableEnv.toDataSet(result, Row.class);
	List<Row> results = resultSet.collect();
	String expected = "Hi,Hallo\n" + "Hello,Hallo Welt\n" + "Hello world,Hallo Welt\n";
	compareResultAsText(results, expected);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:20,代码来源:JavaSqlITCase.java


示例15: testAsFromAndToPrivateFieldPojo

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Test
public void testAsFromAndToPrivateFieldPojo() throws Exception {
	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env, config());

	List<PrivateSmallPojo> data = new ArrayList<>();
	data.add(new PrivateSmallPojo("Peter", 28, 4000.00, "Sales"));
	data.add(new PrivateSmallPojo("Anna", 56, 10000.00, "Engineering"));
	data.add(new PrivateSmallPojo("Lucy", 42, 6000.00, "HR"));

	Table table = tableEnv
		.fromDataSet(env.fromCollection(data),
			"department AS a, " +
			"age AS b, " +
			"salary AS c, " +
			"name AS d")
		.select("a, b, c, d");

	DataSet<PrivateSmallPojo2> ds = tableEnv.toDataSet(table, PrivateSmallPojo2.class);
	List<PrivateSmallPojo2> results = ds.collect();
	String expected =
		"Sales,28,4000.0,Peter\n" +
		"Engineering,56,10000.0,Anna\n" +
		"HR,42,6000.0,Lucy\n";
	compareResultAsText(results, expected);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:27,代码来源:TableEnvironmentITCase.java


示例16: testFilterWithoutExtended

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Test
public void testFilterWithoutExtended() throws Exception {
	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env);

	DataSet<Tuple2<Integer, String>> input = env.fromElements(new Tuple2<>(1,"d"));
	Table table = tableEnv
		.fromDataSet(input, "a, b")
		.filter("a % 2 = 0");

	String result = tableEnv.explain(table).replaceAll("\\r\\n", "\n");
	try (Scanner scanner = new Scanner(new File(testFilePath +
		"../../src/test/scala/resources/testFilter0.out"))){
		String source = scanner.useDelimiter("\\A").next().replaceAll("\\r\\n", "\n");
		assertEquals(source, result);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:18,代码来源:ExplainTest.java


示例17: testFilterWithExtended

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Test
public void testFilterWithExtended() throws Exception {
	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env);

	DataSet<Tuple2<Integer, String>> input = env.fromElements(new Tuple2<>(1,"d"));
	Table table = tableEnv
		.fromDataSet(input, "a, b")
		.filter("a % 2 = 0");

	String result = tableEnv.explain(table, true).replaceAll("\\r\\n", "\n");
	try (Scanner scanner = new Scanner(new File(testFilePath +
		"../../src/test/scala/resources/testFilter1.out"))){
		String source = scanner.useDelimiter("\\A").next().replaceAll("\\r\\n", "\n");
		assertEquals(source, result);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:18,代码来源:ExplainTest.java


示例18: testJoinWithoutExtended

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Test
public void testJoinWithoutExtended() throws Exception {
	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env);

	DataSet<Tuple2<Integer, String>> input1 = env.fromElements(new Tuple2<>(1,"d"));
	DataSet<Tuple2<Integer, String>> input2 = env.fromElements(new Tuple2<>(1,"d"));
	Table table1 = tableEnv.fromDataSet(input1, "a, b");
	Table table2 = tableEnv.fromDataSet(input2, "c, d");
	Table table = table1
		.join(table2)
		.where("b = d")
		.select("a, c");

	String result = tableEnv.explain(table).replaceAll("\\r\\n", "\n");
	try (Scanner scanner = new Scanner(new File(testFilePath +
		"../../src/test/scala/resources/testJoin0.out"))){
		String source = scanner.useDelimiter("\\A").next().replaceAll("\\r\\n", "\n");
		assertEquals(source, result);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:22,代码来源:ExplainTest.java


示例19: testJoinWithExtended

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Test
public void testJoinWithExtended() throws Exception {
	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env);

	DataSet<Tuple2<Integer, String>> input1 = env.fromElements(new Tuple2<>(1,"d"));
	DataSet<Tuple2<Integer, String>> input2 = env.fromElements(new Tuple2<>(1,"d"));
	Table table1 = tableEnv.fromDataSet(input1, "a, b");
	Table table2 = tableEnv.fromDataSet(input2, "c, d");
	Table table = table1
		.join(table2)
		.where("b = d")
		.select("a, c");

	String result = tableEnv.explain(table, true).replaceAll("\\r\\n", "\n");
	try (Scanner scanner = new Scanner(new File(testFilePath +
		"../../src/test/scala/resources/testJoin1.out"))){
		String source = scanner.useDelimiter("\\A").next().replaceAll("\\r\\n", "\n");
		assertEquals(source, result);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:22,代码来源:ExplainTest.java


示例20: testUnionWithoutExtended

import org.apache.flink.table.api.Table; //导入依赖的package包/类
@Test
public void testUnionWithoutExtended() throws Exception {
	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env);

	DataSet<Tuple2<Integer, String>> input1 = env.fromElements(new Tuple2<>(1,"d"));
	DataSet<Tuple2<Integer, String>> input2 = env.fromElements(new Tuple2<>(1,"d"));
	Table table1 = tableEnv.fromDataSet(input1, "count, word");
	Table table2 = tableEnv.fromDataSet(input2, "count, word");
	Table table = table1.unionAll(table2);

	String result = tableEnv.explain(table).replaceAll("\\r\\n", "\n");
	try (Scanner scanner = new Scanner(new File(testFilePath +
		"../../src/test/scala/resources/testUnion0.out"))){
		String source = scanner.useDelimiter("\\A").next().replaceAll("\\r\\n", "\n");
		assertEquals(source, result);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:19,代码来源:ExplainTest.java



注:本文中的org.apache.flink.table.api.Table类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Function类代码示例发布时间:2022-05-23
下一篇:
Java TiffOutputDirectory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap