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

[Bitsail] Refactor Oracle connector and add unit tests on util classes #82

Merged
merged 2 commits into from
Nov 4, 2022

Conversation

ysamchu
Copy link
Collaborator

@ysamchu ysamchu commented Nov 2, 2022

Signed-off-by:

Pre-Checklist

Note: Please complete ALL items in the following checklist.

  • I have read through the CONTRIBUTING.md documentation.
  • My code has the necessary comments and documentation (if needed).
  • I have added relevant tests.

Purpose

Refactor Oracle connector and add unit tests on util classes

Approaches

  1. Remove unused variable columnName throughout JdbcValueConverter and its children classes.
  2. Replace MicroIntervalUtil with Duration class to properly handle time unit parsing and conversion of micro-seceonds.
  3. In OracleValueConverter, combine methods and make logic consistent:
    • convertIntervalDSValue() & convertIntervalYMValue() => convertInterval()
  4. Add unit tests

Related Issues

N/A

New Behavior (screenshots if needed)

N/A

@garyli1019
Copy link
Collaborator

@ysamchu the unit tests are failing.

@ysamchu
Copy link
Collaborator Author

ysamchu commented Nov 2, 2022

@ysamchu the unit tests are failing.

I checked the test log. It fails on maven dependencies and seems not related to my change. Rerun the unit test and pass https://github.com/bytedance/bitsail/actions/runs/3374216700/jobs/5601154392.

@@ -369,10 +364,10 @@ protected Double convertDoubleValue(Object value, String columnName, String colu
return ((BigDecimal) value).doubleValue();
}
throw new IllegalArgumentException(String
.format("Unexpected value for JDBC type: %s and column %s", columnTypeName, columnName));
Copy link
Collaborator

Choose a reason for hiding this comment

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

This debug message is quite useful to local the column that has an issue. Is there any reason we wanna make this change?

Copy link
Collaborator Author

@ysamchu ysamchu Nov 3, 2022

Choose a reason for hiding this comment

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

The reason I made this change was because I didn't see a logic usage besides logging for columnName and columnTypeName. However it makes sense if we want those specific logs to easily locate issue. Will add columnName and columnTypeName back.
One follow-up question for this log: Original logging doesn't printout value. Is there any reason (such as privacy concern) for doing so? If no then I can printout value to help debugging.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't have a standard whether to log value or not, some connectors does.

@jliao07
Copy link
Collaborator

jliao07 commented Nov 3, 2022

Overall LGTM~

Copy link
Collaborator

@garyli1019 garyli1019 left a comment

Choose a reason for hiding this comment

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

LGTM

@garyli1019 garyli1019 merged commit cfd2fc3 into master Nov 4, 2022
@garyli1019 garyli1019 deleted the refactor-oracle-connector branch November 4, 2022 08:21
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

3 participants