-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed hive view uuid type parsing #24538
base: master
Are you sure you want to change the base?
Conversation
Thanks for the release note! Nits of formatting suggested.
|
74e49fa
to
d5f9256
Compare
@adkharat Please add tests for both hive and iceberg. |
c9fab35
to
f26adef
Compare
Don't add tests in new files. You can add tests to existing test file like AbstractTestDistributedQueries.java. Existing hive and iceberg tests derive from this file. So, it will be run for both. |
f26adef
to
2f396cc
Compare
ff3bb49
to
bfc7065
Compare
@nmahadevuni Added test case in AbstractTestDistributedQueries.java |
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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we compare the UUID value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we cannot directly compare the UUID returned in the result unless casted to string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I see, the data maintained in materialized row for uuid is already plain string, so seems we can validate the result as follows:
assertEquals(result.getTypes(), ImmutableList.of(UUID));
assertEquals(result.getOnlyValue(), "12151fd2-7586-11e9-8f9e-2a86e4085a59");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it worked.
Changes pushed to compare type and UUID returned in the result.
52be48e
to
f87af61
Compare
@@ -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")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (hiveTypeName.equals("uuid")) { | |
if (hiveTypeName.equals(HIVE_UUID.getTypeInfo().getTypeName())) { |
Better to use HIVE_UUID.getTypeInfo().getTypeName()
, since it is where the value uuid
from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks,
Done. Pushed.
7258103
to
9017291
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -16,6 +16,7 @@ | |||
import com.facebook.airlift.testing.Assertions; | |||
import com.facebook.presto.Session; | |||
import com.facebook.presto.SystemSessionProperties; | |||
import com.facebook.presto.common.type.UuidType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import static com.facebook.presto.common.type.UuidType.UUID;
and use UUID in the assert function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks,
Changes pushed.
added view with UUID compare the UUID returned in the result compare with constant uuid imported static constant
6d063ad
9017291
to
6d063ad
Compare
Description
Currently, creation of VIEW with UUID on hive catalog throws exception
This PR fixes UUID type parsing while VIEW creation, selection on Hive
Motivation and Context
Presto is failing to recognize UUID as a valid Hive type, leading to a type resolution failure.
cannot construct instance of com.facebook.presto.hive.HiveType, problem: Error: type expected at the position 0 of uuid'but uuid is found.
Test Plan
Added a test for hive and iceberg where we create the view with uuid column and select from that view.
Release Notes
Please follow release notes guidelines and fill in the release notes below.