-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add coercion test for unpartitioned tables in hive #16119
Add coercion test for unpartitioned tables in hive #16119
Conversation
7724041
to
2ff3167
Compare
2ff3167
to
f23b8bc
Compare
It kind of add partial test coverage to #15938 - only for ORC as of now. |
c6048db
to
35b38d9
Compare
testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/TestHiveCoercion.java
Show resolved
Hide resolved
testing/trino-product-tests/src/main/java/io/trino/tests/product/hive/BaseTestHiveCoercion.java
Show resolved
Hide resolved
if (expectedExceptionsWithTrinoContext().isEmpty()) { | ||
assertEquals(ImmutableSet.copyOf(prestoReadColumns), expectedPrestoResults.keySet()); |
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.
why assertion became conditional?
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.
In case of unpartitioned tables we might not support all the column coercion as of now so we avoid the assertion when Trino throws some sort of exception.
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.
add a code comment then
import static java.lang.String.format; | ||
import static java.util.Locale.ENGLISH; | ||
|
||
public class TestHiveCoercionOnUnPartitionedTable |
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.
UnPartitioned is one word
} | ||
} | ||
|
||
@Requires(OrcRequirements.class) |
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.
I don't think Requirements Providers gives us any benefit, especially for mutable tables which aren't reused.
Plain old direct create table in a test would be better.
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.
Maybe we can remove the Requirements Provider as a follow up as it would be common for both partitioned and unpartitioned tables.
...ct-tests/src/main/java/io/trino/tests/product/hive/TestHiveCoercionOnUnPartitionedTable.java
Outdated
Show resolved
Hide resolved
...ct-tests/src/main/java/io/trino/tests/product/hive/TestHiveCoercionOnUnPartitionedTable.java
Outdated
Show resolved
Hide resolved
...ct-tests/src/main/java/io/trino/tests/product/hive/TestHiveCoercionOnUnPartitionedTable.java
Outdated
Show resolved
Hide resolved
...ct-tests/src/main/java/io/trino/tests/product/hive/TestHiveCoercionOnUnPartitionedTable.java
Outdated
Show resolved
Hide resolved
Set<String> unsupportedColumns = expectedExceptions.keySet().stream() | ||
.filter(context -> context.hiveVersion().orElseThrow().equals(hiveVersion) && tableName.contains(context.format())) |
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.
why removed?
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.
For Trino side failures we don't need check on hive version right ?
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.
unless the failure is related to what hive version did modify the version
anyway, why are you changing this line to first add .orElseThrow()
and then to remove the condition if all you need is remove the condition?
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.
With the latest change by squashing the commits - this changeset got disappeared.
- varchar is also a primitive - tailing/trailing
aec09cc
to
fd20512
Compare
@findepi AC |
@Praveen2112 didn't re-review, but i see the build is failin |
fd20512
to
e08a8dc
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.
lgtm % findepi's comments
e08a8dc
to
3c863f5
Compare
@@ -881,11 +881,11 @@ private static List<List<?>> extract(List<TrinoArray> arrays) | |||
|
|||
public static class ColumnContext | |||
{ | |||
private final String hiveVersion; | |||
private final Optional<String> hiveVersion; |
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.
Make version optional in ColumnContext
can this commit include some description on why?
(sorry, i failed to infer this myself)
if (expectedExceptionsWithTrinoContext().isEmpty()) { | ||
assertEquals(ImmutableSet.copyOf(prestoReadColumns), expectedPrestoResults.keySet()); |
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.
add a code comment then
Set<String> unsupportedColumns = expectedExceptions.keySet().stream() | ||
.filter(context -> context.hiveVersion().orElseThrow().equals(hiveVersion) && tableName.contains(context.format())) |
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.
unless the failure is related to what hive version did modify the version
anyway, why are you changing this line to first add .orElseThrow()
and then to remove the condition if all you need is remove the condition?
STORED AS | ||
""" + fileFormat); |
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.
redundant line break between STORED AS and ORC
It allows us to re-use `ColumnContext` in scenarios which are independent of hive version.
And rename TestHiveCoercion to TestHiveCoercionOnPartitionedTable
3c863f5
to
f454737
Compare
@findepi AC |
LGTM |
Description
Adds additional test coverage for coercion on un-partitioned tables in hive.
Release notes
(x) This is not user-visible or docs only and no release notes are required.