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-2678]DataSet API does not support multi-dimensional arrays as keys #1566

Closed
wants to merge 1 commit into from

Conversation

sbcd90
Copy link
Contributor

@sbcd90 sbcd90 commented Feb 1, 2016

Hello,

@tillrohrmann I have added support for multi-dimensional arrays as keys in Dataset api. Please review & merge.

@sbcd90
Copy link
Contributor Author

sbcd90 commented Feb 1, 2016

@StephanEwen could you also help reviewing the code?

import java.lang.reflect.Array;
import java.util.Arrays;

public class GenericArrayComparator<T> extends TypeComparator<T[]> implements java.io.Serializable {
Copy link
Contributor

Choose a reason for hiding this comment

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

Java docs missing

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not calling it ObjectArrayComparator?

@tillrohrmann
Copy link
Contributor

Thanks for your contribution @sbcd90. I think the PR needs still a bit of work before it can be merged. The implementation of GenericArrayComparator only works for primitive types. Furthermore, I think that it is easier to construct the comparator out of the component type information of the ObjectArrayTypeInfo instead of doing the type analysis again every time you call compare.

@sbcd90
Copy link
Contributor Author

sbcd90 commented Feb 1, 2016

@tillrohrmann Thanks for the review. I had a few questions based on your comments. Kindly help me in getting the questions answered so that I can proceed.

@sbcd90
Copy link
Contributor Author

sbcd90 commented Feb 4, 2016

Hello @tillrohrmann ..I have made all the changes you have mentioned.

  • support for CompositeType.
  • added test cases for both primitive type & composite type
  • modified the changed test case in DataSinkTest.java
  • changed the name of Comparator to ObjectArrayComparator.java
  • javadocs are auto-generated by intellij.

Please review my code now. Kindly let me know if there are any further changes required. Kindly let me know if this can be merged now also.

@sbcd90
Copy link
Contributor Author

sbcd90 commented Feb 5, 2016

Hello @tillrohrmann please review the commit as the work to be done is nearly complete I believe. Please comment.

}

@SuppressWarnings("unchecked")
private TypeComparator<? super Object> getBaseComparatorInfo(TypeInformation<? extends Object> componentInfo, boolean sortOrderAscending, ExecutionConfig executionConfig) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you extracting for certain types the element comparator (for example the ObjectArrayTypeInfo) and for other you create the TypeComparator (for example the CompositeTypeInfo)? I don't get it. Why do you need the getBaseComparatorInfo method at all? Simply check in createComparator the different subtypes and then create the TypeComparator.

@tillrohrmann
Copy link
Contributor

I think the PR is still not in a good shape. I pointed out the problematic code sections.

Also please bear in mind that people will always try to review your code as soon as possible. But sometimes people are just busy and it takes some time for them to review a PR. In such a case, one simply has to be a little bit patient with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants