Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

yanghua
Copy link
Contributor

@yanghua yanghua commented May 9, 2018

What is the purpose of the change

This pull request removed class TypeInfoParser and refactored specific test case

Brief change log

  • Removed class TypeInfoParser
  • Refactor code where use TypeInfoParser
  • Refactor test code where use TypeInfoParser

Verifying this change

This change is already covered by existing tests*.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes / no)
  • The serializers: (yes / no / don't know)
  • The runtime per-record code paths (performance sensitive): (yes / no / don't know)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / no / don't know)
  • The S3 file system connector: (yes / no / don't know)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@yanghua
Copy link
Contributor Author

yanghua commented May 9, 2018

hi @StephanEwen this issues part 2, please review it

@yanghua
Copy link
Contributor Author

yanghua commented May 10, 2018

cc @StephanEwen fixed a incompatibility error

Copy link
Contributor

@StephanEwen StephanEwen left a 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);
Copy link
Contributor

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.

Copy link
Contributor Author

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);
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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>>(){}));
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accept this suggestion

@yanghua
Copy link
Contributor Author

yanghua commented May 11, 2018

cc @StephanEwen refactored based on your suggestion, the travis build failed because of yarn test, seems not about this PR's change.

@yanghua
Copy link
Contributor Author

yanghua commented May 13, 2018

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>>(){});
Copy link
Contributor

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?

@StephanEwen
Copy link
Contributor

One minor style comment, otherwise this is good to go!

@yanghua
Copy link
Contributor Author

yanghua commented May 13, 2018

cc @StephanEwen refactored base on your suggestion.

@StephanEwen
Copy link
Contributor

Looks good, thanks.

+1 to merge

@yanghua
Copy link
Contributor Author

yanghua commented May 15, 2018

cc @tillrohrmann this can be merged thanks!

@yanghua
Copy link
Contributor Author

yanghua commented May 16, 2018

cc @tzulitai

@StephanEwen
Copy link
Contributor

Merging this...

StephanEwen pushed a commit to StephanEwen/flink that referenced this pull request May 16, 2018
StephanEwen pushed a commit to StephanEwen/flink that referenced this pull request May 17, 2018
cjolif pushed a commit to cjolif/flink that referenced this pull request May 19, 2018
@zentol
Copy link
Contributor

zentol commented May 22, 2018

@yanghua The PR has been merged, could you close it?

@yanghua
Copy link
Contributor Author

yanghua commented May 22, 2018

@zentol OK, closing after merged~

@yanghua yanghua closed this May 22, 2018
sampathBhat pushed a commit to sampathBhat/flink that referenced this pull request Jul 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants