|
51 | 51 | import static com.facebook.presto.SystemSessionProperties.REMOVE_REDUNDANT_CAST_TO_VARCHAR_IN_JOIN;
|
52 | 52 | import static com.facebook.presto.SystemSessionProperties.SHARDED_JOINS_STRATEGY;
|
53 | 53 | import static com.facebook.presto.SystemSessionProperties.VERBOSE_OPTIMIZER_INFO_ENABLED;
|
| 54 | +import static com.facebook.presto.common.type.UuidType.UUID; |
54 | 55 | import static com.facebook.presto.common.type.VarcharType.VARCHAR;
|
55 | 56 | import static com.facebook.presto.connector.informationSchema.InformationSchemaMetadata.INFORMATION_SCHEMA;
|
56 | 57 | import static com.facebook.presto.sql.tree.CreateView.Security.INVOKER;
|
@@ -1569,4 +1570,26 @@ private String sanitizePlan(String explain)
|
1569 | 1570 | .replaceAll("\\[PlanNodeId (\\d+(?:,\\d+)*)\\]", "")
|
1570 | 1571 | .replaceAll("Values => .*\n", "\n");
|
1571 | 1572 | }
|
| 1573 | + |
| 1574 | + @Test |
| 1575 | + public void testViewWithUUID() |
| 1576 | + { |
| 1577 | + skipTestUnless(supportsViews()); |
| 1578 | + |
| 1579 | + @Language("SQL") String query = "SELECT * FROM (VALUES (CAST(0 AS INTEGER), NULL), (CAST(1 AS INTEGER), UUID '12151fd2-7586-11e9-8f9e-2a86e4085a59')) AS t (rum, c1)"; |
| 1580 | + |
| 1581 | + // Create View with UUID type in Hive |
| 1582 | + assertQuerySucceeds("CREATE VIEW test_hive_view AS " + query); |
| 1583 | + |
| 1584 | + // Select UUID from the view |
| 1585 | + MaterializedResult result = computeActual("SELECT c1 FROM test_hive_view WHERE rum = 1"); |
| 1586 | + |
| 1587 | + // Verify the result set is not empty |
| 1588 | + assertTrue(result.getMaterializedRows().size() > 0, "Result set is empty"); |
| 1589 | + assertEquals(result.getTypes(), ImmutableList.of(UUID)); |
| 1590 | + assertEquals(result.getOnlyValue(), "12151fd2-7586-11e9-8f9e-2a86e4085a59"); |
| 1591 | + |
| 1592 | + // Drop the view after the test |
| 1593 | + assertQuerySucceeds("DROP VIEW test_hive_view"); |
| 1594 | + } |
1572 | 1595 | }
|
0 commit comments