Java Code Examples for org.apache.flink.table.client.gateway.Executor#listTables()
The following examples show how to use
org.apache.flink.table.client.gateway.Executor#listTables() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocalExecutorITCase.java From flink with Apache License 2.0 | 6 votes |
@Test public void testAlterTable() throws Exception { final Executor executor = createDefaultExecutor(clusterClient); final LocalExecutor localExecutor = (LocalExecutor) executor; final SessionContext session = new SessionContext("test-session", new Environment()); String sessionId = executor.openSession(session); assertEquals("test-session", sessionId); executor.useCatalog(sessionId, "simple-catalog"); executor.useDatabase(sessionId, "default_database"); List<String> actualTables = executor.listTables(sessionId); List<String> expectedTables = Arrays.asList("test-table"); assertEquals(expectedTables, actualTables); executor.executeUpdate(sessionId, "alter table `test-table` rename to t1"); actualTables = executor.listTables(sessionId); expectedTables = Arrays.asList("t1"); assertEquals(expectedTables, actualTables); //todo: we should add alter table set test when we support create table in executor. executor.closeSession(sessionId); }
Example 2
Source File: LocalExecutorITCase.java From flink with Apache License 2.0 | 6 votes |
@Test public void testListTables() throws Exception { final Executor executor = createDefaultExecutor(clusterClient); final SessionContext session = new SessionContext("test-session", new Environment()); String sessionId = executor.openSession(session); assertEquals("test-session", sessionId); final List<String> actualTables = executor.listTables(sessionId); final List<String> expectedTables = Arrays.asList( "TableNumber1", "TableNumber2", "TableSourceSink", "TestView1", "TestView2"); assertEquals(expectedTables, actualTables); executor.closeSession(sessionId); }
Example 3
Source File: LocalExecutorITCase.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testListTables() throws Exception { final Executor executor = createDefaultExecutor(clusterClient); final SessionContext session = new SessionContext("test-session", new Environment()); final List<String> actualTables = executor.listTables(session); final List<String> expectedTables = Arrays.asList( "TableNumber1", "TableNumber2", "TableSourceSink", "TestView1", "TestView2"); assertEquals(expectedTables, actualTables); }
Example 4
Source File: LocalExecutorITCase.java From flink with Apache License 2.0 | 5 votes |
@Test public void testListTables() throws Exception { final Executor executor = createDefaultExecutor(clusterClient); final SessionContext session = new SessionContext("test-session", new Environment()); final List<String> actualTables = executor.listTables(session); final List<String> expectedTables = Arrays.asList( "TableNumber1", "TableNumber2", "TableSourceSink", "TestView1", "TestView2"); assertEquals(expectedTables, actualTables); }
Example 5
Source File: LocalExecutorITCase.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Test public void testValidateSession() throws Exception { final Executor executor = createDefaultExecutor(clusterClient); final SessionContext session = new SessionContext("test-session", new Environment()); executor.validateSession(session); session.addView(ViewEntry.create("AdditionalView1", "SELECT 1")); session.addView(ViewEntry.create("AdditionalView2", "SELECT * FROM AdditionalView1")); executor.validateSession(session); List<String> actualTables = executor.listTables(session); List<String> expectedTables = Arrays.asList( "AdditionalView1", "AdditionalView2", "TableNumber1", "TableNumber2", "TableSourceSink", "TestView1", "TestView2"); assertEquals(expectedTables, actualTables); session.removeView("AdditionalView1"); try { executor.validateSession(session); fail(); } catch (SqlExecutionException e) { // AdditionalView2 needs AdditionalView1 } session.removeView("AdditionalView2"); executor.validateSession(session); actualTables = executor.listTables(session); expectedTables = Arrays.asList( "TableNumber1", "TableNumber2", "TableSourceSink", "TestView1", "TestView2"); assertEquals(expectedTables, actualTables); }
Example 6
Source File: LocalExecutorITCase.java From flink with Apache License 2.0 | 4 votes |
@Test public void testValidateSession() throws Exception { final Executor executor = createDefaultExecutor(clusterClient); final SessionContext session = new SessionContext("test-session", new Environment()); executor.validateSession(session); session.addView(ViewEntry.create("AdditionalView1", "SELECT 1")); session.addView(ViewEntry.create("AdditionalView2", "SELECT * FROM AdditionalView1")); executor.validateSession(session); List<String> actualTables = executor.listTables(session); List<String> expectedTables = Arrays.asList( "TableNumber1", "TableNumber2", "TableSourceSink", "TestView1", "TestView2", "AdditionalView1", "AdditionalView2"); assertEquals(expectedTables, actualTables); session.removeView("AdditionalView1"); try { executor.validateSession(session); fail(); } catch (SqlExecutionException e) { // AdditionalView2 needs AdditionalView1 } session.removeView("AdditionalView2"); executor.validateSession(session); actualTables = executor.listTables(session); expectedTables = Arrays.asList( "TableNumber1", "TableNumber2", "TableSourceSink", "TestView1", "TestView2"); assertEquals(expectedTables, actualTables); }