|
28 | 28 | import org.apache.flink.table.api.internal.TableEnvironmentInternal;
|
29 | 29 | import org.apache.flink.table.catalog.CatalogPartitionSpec;
|
30 | 30 | import org.apache.flink.table.catalog.CatalogTable;
|
| 31 | +import org.apache.flink.table.catalog.ObjectIdentifier; |
31 | 32 | import org.apache.flink.table.catalog.ObjectPath;
|
32 | 33 | import org.apache.flink.table.catalog.hive.HiveCatalog;
|
33 | 34 | import org.apache.flink.table.catalog.hive.HiveTestUtils;
|
34 | 35 | import org.apache.flink.table.delegation.Parser;
|
| 36 | +import org.apache.flink.table.operations.DescribeTableOperation; |
35 | 37 | import org.apache.flink.table.operations.command.ClearOperation;
|
36 | 38 | import org.apache.flink.table.operations.command.HelpOperation;
|
37 | 39 | import org.apache.flink.table.operations.command.QuitOperation;
|
@@ -255,6 +257,27 @@ public void testCreateTable() throws Exception {
|
255 | 257 | tableEnv.executeSql("create table if not exists tbl5 (m map<bigint,string>)");
|
256 | 258 | hiveTable = hiveCatalog.getHiveTable(new ObjectPath("default", "tbl5"));
|
257 | 259 | assertEquals(createdTimeForTableExists, hiveTable.getCreateTime());
|
| 260 | + |
| 261 | + // test describe table |
| 262 | + Parser parser = ((TableEnvironmentInternal) tableEnv).getParser(); |
| 263 | + DescribeTableOperation operation = |
| 264 | + (DescribeTableOperation) parser.parse("desc tbl1").get(0); |
| 265 | + assertFalse(operation.isExtended()); |
| 266 | + assertEquals( |
| 267 | + ObjectIdentifier.of(hiveCatalog.getName(), "default", "tbl1"), |
| 268 | + operation.getSqlIdentifier()); |
| 269 | + |
| 270 | + operation = (DescribeTableOperation) parser.parse("describe default.tbl2").get(0); |
| 271 | + assertFalse(operation.isExtended()); |
| 272 | + assertEquals( |
| 273 | + ObjectIdentifier.of(hiveCatalog.getName(), "default", "tbl2"), |
| 274 | + operation.getSqlIdentifier()); |
| 275 | + |
| 276 | + operation = (DescribeTableOperation) parser.parse("describe extended tbl3").get(0); |
| 277 | + assertTrue(operation.isExtended()); |
| 278 | + assertEquals( |
| 279 | + ObjectIdentifier.of(hiveCatalog.getName(), "default", "tbl3"), |
| 280 | + operation.getSqlIdentifier()); |
258 | 281 | }
|
259 | 282 |
|
260 | 283 | @Test
|
|
0 commit comments