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

Add facility to handle non null column type #359

Merged
merged 4 commits into from Mar 21, 2019

Conversation

amitvc
Copy link
Contributor

@amitvc amitvc commented Mar 15, 2019

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean verify to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.

If your pull request is about ~20 lines of code you don't need to sign an iCLA if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@amitvc
Copy link
Contributor Author

amitvc commented Mar 15, 2019

@eolivelli for the UT in jdbc module is it new class or I need to add more tests to existing classes of unit tests?

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

I left a small nit.

We should add a test case.
There are already tests around system tables (SystemTablesTest), you can add it there

I would create a new test that creates a table with "not null" columns and check the results of a query to syscolumns

String data_type = ColumnTypes.typeToString(c.type);

result.add(RecordSerializer.makeRecord(
table,
"table_name", t.name,
"column_name", c.name,
"ordinal_position", pos++,
"is_nullable", pk ? 0 : 1,
"is_nullable", (pk || nonNullCType) ? DatabaseMetaData.columnNoNulls : DatabaseMetaData.columnNullable,
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't "pl" reduntant here ?
if ("pk") nonNullCType is already true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct. I removed it.

@eolivelli
Copy link
Contributor

@amitvc good idea to split your work in smaller subtasks

@eolivelli
Copy link
Contributor

In the context of this patch you can add only a testcase in SystemTablesTest

JDBC clients won't be impacted directly, they will only "see" this new constraint, but it is already handled, as it was handled for pk columns.

@amitvc
Copy link
Contributor Author

amitvc commented Mar 20, 2019

SystemTablesTest class is present in both core and jdbc. I am assuming adding tests in the one that is in the core project.

@amitvc
Copy link
Contributor Author

amitvc commented Mar 20, 2019

@eolivelli - I had to modify DDLSQLPlanner.java to add support for not null types when specified in query string. Also added UT to test my changes.

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

awesome.
I left two comments.

case LONG:
return NOTNULL_LONG;
default:
return type;
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure this is the best return value, what about am IllegalArgumentException ?
Other wide it is better to add a Javadoc

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 modified the method to add more types that are supported in ColumnTypes.

@eolivelli
Copy link
Contributor

I left one last comment

@amitvc
Copy link
Contributor Author

amitvc commented Mar 21, 2019

@eolivelli - Yes the scan won't get executed. I removed it to make it more obvious what we are testing in the UT

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

+1
looks great

I am waiting for Travis, then I will merge
thanks

@amitvc
Copy link
Contributor Author

amitvc commented Mar 21, 2019

@eolivelli thanks for the review.

@eolivelli eolivelli merged commit ff5fc84 into diennea:master Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants