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-3856] [core] Create types for java.sql.Date/Time/Timestamp #1959

Closed
wants to merge 5 commits into from

Conversation

twalthr
Copy link
Contributor

@twalthr twalthr commented May 3, 2016

Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration.
If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the How To Contribute guide.
In addition to going through the list, please provide a meaningful description of your changes.

  • General
    • The pull request references the related JIRA issue ("[FLINK-XXX] Jira title text")
    • The pull request addresses only one issue
    • Each commit in the PR has a meaningful commit message (including the JIRA id)
  • Documentation
    • Documentation has been added for new functionality
    • Old documentation affected by the pull request has been updated
    • JavaDoc for public methods has been added
  • Tests & Build
    • Functionality added by the pull request is covered by tests
    • mvn clean verify has been executed successfully locally or a Travis build has passed

This PR adds java.sql.Date/Time/Timestamp as basic types. I declared them PublicEvolving, therefore I didn't add the types to the documentation. I improved the Date serialization to use Long.MIN_VALUE instead of -1. But it still does not solve FLINK-3858 completely.

@StephanEwen
Copy link
Contributor

Can these type infos exist independent of the BasicTypeInfo?
Either in some class like SQL type infos, or even only inside the Table API / SQL project?

@fhueske
Copy link
Contributor

fhueske commented May 3, 2016

These types would also be useful for flink-jdbc and possibly other modules. We can move them to a dedicated TimeTypeInfo or SqlTimeTypeInfo class, but I think they should be part of flink-core.

@Override
protected Timestamp[] getSortedTestData() {
return new Timestamp[] {
Timestamp.valueOf("1970-01-01 00:00:00.000"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Add Timestamps that only differ in the nanos?

@fhueske
Copy link
Contributor

fhueske commented May 4, 2016

Just a few minor comments. What do you think about moving the types to a SqlTimeTypeInfo class, @twalthr? @StephanEwen would that be OK for you?

@twalthr
Copy link
Contributor Author

twalthr commented May 9, 2016

I will move it to SqlTimeTypeInfo.

@twalthr twalthr force-pushed the DateTimeTimestamp branch 2 times, most recently from 790ee12 to 182fabc Compare May 9, 2016 13:12
* Type information for Java SQL Date/Time/Timestamp.
*/
@PublicEvolving
public class SqlTimeTypeInfo<T> extends TypeInformation<T> implements AtomicType<T> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to implement a new TypeInformation which is basically a copy of BasicTypeInfo?

Alternatively we could make SqlTimeTypeInfo just a holder for three public static final BasicTypeInfos of the three time types. The protected constructor of BasicTypeInfo is visible if SqlTimeTypeInfo is in the same package as BasicTypeInfo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also thought about that. But this would also mean that BasicTypeInfo's getInfoFor needs to support types that are declared in an other class. So we have to add the classes to the TYPES of BasicTypeInfo. I think complete separation is a nicer design.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. Let's stick to this solution then.

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, I will fix the unused import issues and merge once travis build passed.

@fhueske
Copy link
Contributor

fhueske commented May 10, 2016

@twalthr, should SqlTimeTypeInfo implement TypeInformation? What do you think?
You can go ahead and merge the PR. I'm OK with both solutions. Thanks, Fabian

@fhueske
Copy link
Contributor

fhueske commented May 13, 2016

Merging

@asfgit asfgit closed this in bbd02d2 May 13, 2016
gna-phetsarath pushed a commit to gna-phetsarath/flink that referenced this pull request May 13, 2016
markreddy pushed a commit to markreddy/flink that referenced this pull request May 14, 2016
mbode pushed a commit to mbode/flink that referenced this pull request May 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants