Skip to content

Commit

Permalink
fixed view uuid type parsing
Browse files Browse the repository at this point in the history
added view with UUID
  • Loading branch information
adkharat committed Feb 14, 2025
1 parent b835409 commit bfc7065
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ public static boolean isSupportedType(TypeInfo typeInfo)
public static HiveType valueOf(String hiveTypeName)
{
requireNonNull(hiveTypeName, "hiveTypeName is null");
if (hiveTypeName.equals("uuid")) {
return HIVE_UUID;
}
return toHiveType(getTypeInfoFromTypeString(hiveTypeName));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1569,4 +1569,24 @@ private String sanitizePlan(String explain)
.replaceAll("\\[PlanNodeId (\\d+(?:,\\d+)*)\\]", "")
.replaceAll("Values => .*\n", "\n");
}

@Test
public void testViewWithUUID()
{
skipTestUnless(supportsViews());

@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)";

// Create View with UUID type in Hive
assertQuerySucceeds("CREATE VIEW test_hive_view AS " + query);

// Select UUID from the view
MaterializedResult result = computeActual("SELECT c1 FROM test_hive_view WHERE rum = 1");

// Verify the result set is not empty
assertTrue(result.getMaterializedRows().size() > 0, "Result set is empty");

// Drop the view after the test
assertQuerySucceeds("DROP VIEW test_hive_view");
}
}

0 comments on commit bfc7065

Please sign in to comment.