-
Notifications
You must be signed in to change notification settings - Fork 13k
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
[FLINK-9292] [core] Remove TypeInfoParser (part 2) #5970
Conversation
hi @StephanEwen this issues part 2, please review it |
cc @StephanEwen fixed a incompatibility error |
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, this looks mostly good.
Some inline comments, most important the one about not changing the one test that must use TypeHint rather than Types.
@@ -61,7 +61,7 @@ public void testOfGenericClassForGenericType() { | |||
@Test | |||
public void testOfTypeHint() { | |||
assertEquals(BasicTypeInfo.STRING_TYPE_INFO, TypeInformation.of(String.class)); | |||
assertEquals(BasicTypeInfo.STRING_TYPE_INFO, TypeInformation.of(new TypeHint<String>(){})); | |||
assertEquals(BasicTypeInfo.STRING_TYPE_INFO, Types.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.
Please undo this one, the test explicitly tests the TypeHint use.
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.
OK, sorry maybe batch replace, will revert it
@@ -109,7 +112,7 @@ public String map(MyPojo value) throws Exception { | |||
@Test | |||
public void testForwardWithGenericTypePublicAttrAccess() { | |||
compareAnalyzerResultWithAnnotationsSingleInput(MapFunction.class, Map4.class, | |||
"org.apache.flink.api.java.sca.UdfAnalyzerTest$MyPojo", "String"); | |||
TypeInformation.of(new TypeHint<GenericTypeInfo<MyPojo>>(){}), Types.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.
The GenericTypeInfo
here seems to be not correct.
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.
@StephanEwen it is a problem, will trigger test error, because the class will be parsed as a PoJo type, when I debug it.
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.
Then the code needs to be new GenericTypeInfo<>(MyPojo.class)
. Otherwise it will try and determine why the Type Info for GenericType
is and it just happens to be a generic type ;-)
compareAnalyzerResultWithAnnotationsSingleInput(MapFunction.class, Map14.class, "Tuple2<String,Integer>", | ||
"Tuple2<String,String>"); | ||
compareAnalyzerResultWithAnnotationsSingleInput(MapFunction.class, Map14.class, | ||
TypeInformation.of(new TypeHint<Tuple2<String, Integer>>(){}), TypeInformation.of(new TypeHint<Tuple2<String, 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.
There is so much use of the types Tuple2<String, Integer>>
and Tuple2<String, String>
, it would make sense to factor these out into a static field and reference them from there.
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.
accept this suggestion
cc @StephanEwen refactored based on your suggestion, the travis build failed because of yarn test, seems not about this PR's change. |
cc @StephanEwen |
@@ -62,6 +62,10 @@ | |||
@SuppressWarnings("serial") | |||
public class UdfAnalyzerTest { | |||
|
|||
private static TypeInformation<Tuple2<String, Integer>> stringIntTuple2TypeInfo = TypeInformation.of(new TypeHint<Tuple2<String, Integer>>(){}); |
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.
These fields are constants, so they should be final. Can you add the modified and rename the fields to match the naming convention?
One minor style comment, otherwise this is good to go! |
cc @StephanEwen refactored base on your suggestion. |
Looks good, thanks. +1 to merge |
cc @tillrohrmann this can be merged thanks! |
cc @tzulitai |
Merging this... |
@yanghua The PR has been merged, could you close it? |
@zentol OK, closing after merged~ |
What is the purpose of the change
This pull request removed class
TypeInfoParser
and refactored specific test caseBrief change log
TypeInfoParser
TypeInfoParser
TypeInfoParser
Verifying this change
This change is already covered by existing tests*.
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (yes / no)Documentation