Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

TAJO-2154: Refactor Datum to use new Type implementation. #1017

Closed
wants to merge 8 commits into from

Conversation

hyunsik
Copy link
Member

@hyunsik hyunsik commented May 14, 2016

No description provided.

@jihoonson
Copy link
Contributor

Would you rebase please?

@hyunsik
Copy link
Member Author

hyunsik commented May 18, 2016

rebased. Thank you.

@@ -36,6 +36,7 @@

// No paramter types
public static final Any Any = new Any();
public static final Bit Bit = new Bit();
Copy link
Contributor

Choose a reason for hiding this comment

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

How about making the modifier of the constructors of these singleton instances to be default?
This is not the changes made in this patch, but it seems better.

Copy link
Member Author

Choose a reason for hiding this comment

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

IMO, the main difference between singleton with (typical) getInstance method and static final variable is the initialization time. Singleton pattern is preferred if the variable needs to be initialized lazily. Static variable is initialized at class loading. In this case, they are always used throughout a system. So, IMO, static variable is also right choice here. In addition, static variable provides more concise usages.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for the confusion. I'm talking about the modifier of the constructor of the classes which are used in only singleton pattern. I left another comment.

@jihoonson
Copy link
Contributor

Hi @hyunsik, thank you for your patch. It looks good to me.
I left a comment, but it is not directly related to the changed made in this patch.
Also, I believe you are going to do remaining works to support complex data types. So, if you want to consider my comment in another issue, please do that.

import static org.apache.tajo.common.TajoDataTypes.Type.BIT;

public class Bit extends Type {
public Bit() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I mean, this constructor is used only in Type. Its modifier doesn't have to be public, and it will also reduce contributors' mistakes.

Copy link
Member Author

Choose a reason for hiding this comment

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

I got your point. I misunderstood your comment. I'll change them. Thank you!

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for your understanding. When you update your patch, I'll finish my review immediately.

@hyunsik
Copy link
Member Author

hyunsik commented May 20, 2016

thank you for your review. I fixed them.

@hyunsik
Copy link
Member Author

hyunsik commented May 22, 2016

fixed.

@jihoonson
Copy link
Contributor

+1 LGTM! Ship it!

@hyunsik
Copy link
Member Author

hyunsik commented May 23, 2016

Thank you very much. I'll commit it soon.

@asfgit asfgit closed this in 1321249 May 23, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants