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

Support table creation of Scalar DB on JDBC in schema-tool #152

Merged
merged 15 commits into from
Feb 26, 2021

Conversation

brfrn169
Copy link
Collaborator

@brfrn169 brfrn169 commented Feb 4, 2021

https://scalar-labs.atlassian.net/browse/DLT-7846

As I'm new to Clojure, this code might not be good. Please review it from the Clojure perspective as well 😄

@brfrn169 brfrn169 added the enhancement New feature or request label Feb 4, 2021
@brfrn169 brfrn169 self-assigned this Feb 4, 2021
Copy link
Member

@yito88 yito88 left a comment

Choose a reason for hiding this comment

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

Thank you!
I think it can be getting simpler.
Please take a look at my comments.

tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
@brfrn169
Copy link
Collaborator Author

brfrn169 commented Feb 5, 2021

@yito88 Thank you for reviewing this and giving me the great advices! I will modify the patch based on them and push a new commit for it. Thanks.

Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

Overall looking good!
I left minor comments and suggestions.

(= rdb-engine :sql-server) "BIT"
:else "BOOLEAN"))

(defn- boolean-value-true
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you clarify when this method returns true?
I feel it should be renamed for more ease of understanding.

(key? column clustering-key) "CLUSTERING"
:else nil))

(defn- get-secondary-indexed [rdb-engine column secondary-index]
Copy link
Contributor

Choose a reason for hiding this comment

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

If it returns true/false, should it be like is-secondary-indexed?

tools/scalar-schema/src/scalar_schema/core.clj Outdated Show resolved Hide resolved
"BOOLEAN" "BIT"
"BLOB" "VARBINARY"}})

(def ^:private data-type-mapping-for-key
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

tools/scalar-schema/src/scalar_schema/core.clj Outdated Show resolved Hide resolved
tools/scalar-schema/src/scalar_schema/core.clj Outdated Show resolved Hide resolved
Copy link
Member

@yito88 yito88 left a comment

Choose a reason for hiding this comment

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

Looks better! Thanks 👍
I left some comments.

tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
{:keys [boolean-value-fn] :as opts}
column data-type ordinal-position]
(let [key-type (get-key-type column partition-key clustering-key)
key-order (if (key? column clustering-key) "ASC" nil)
Copy link
Member

Choose a reason for hiding this comment

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

How about this? The corresponding if can be removed?

Suggested change
key-order (if (key? column clustering-key) "ASC" nil)
key-order (if (key? column clustering-key) "'ASC'" "NULL")

tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
@brfrn169
Copy link
Collaborator Author

It seems like the CI failure was not related to this change. I will rerun the CI.

@brfrn169 brfrn169 requested a review from yito88 February 12, 2021 07:25
yito88
yito88 previously approved these changes Feb 18, 2021
Copy link
Member

@yito88 yito88 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

tools/scalar-schema/src/scalar_schema/jdbc.clj Outdated Show resolved Hide resolved
feeblefakie
feeblefakie previously approved these changes Feb 18, 2021
Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

Still LGTM! Left some minor suggestions on the documentation.

tools/scalar-schema/README.md Outdated Show resolved Hide resolved
tools/scalar-schema/README.md Outdated Show resolved Hide resolved
tools/scalar-schema/README.md Outdated Show resolved Hide resolved
@brfrn169 brfrn169 changed the title Support table creation of Scalar DB with JDBC in schema-tool [DO NOT MERGE] Support table creation of Scalar DB with JDBC in schema-tool Feb 19, 2021
Copy link
Member

@yito88 yito88 left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@feeblefakie feeblefakie changed the title [DO NOT MERGE] Support table creation of Scalar DB with JDBC in schema-tool Support table creation of Scalar DB on JDBC in schema-tool Feb 26, 2021
Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

LGTM!

@feeblefakie feeblefakie merged commit b11156c into master Feb 26, 2021
@feeblefakie feeblefakie deleted the support-schema-tool-for-jdbc branch February 26, 2021 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants