forked from data-integrations/database-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Added treatAsOldTimeStamp field #2
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
Open
Krish-cloudsufi
wants to merge
10
commits into
develop
Choose a base branch
from
Timestamp
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
717070c
Added oldTimeStamp field
Krish-cloudsufi 59f1c1b
Made default treatAsOldTimestamp false
Krish-cloudsufi fa0fe82
Added treatAsOldTimeStamp in widgets
Krish-cloudsufi 757daf5
Added treatAsOldTimestamp in OracleSourceSchemaReader
Krish-cloudsufi 4c94f9b
Removed extra validation
Krish-cloudsufi 6d27959
Updated source constructor
Krish-cloudsufi 444d0fa
Removed treatAsOldTimeStamp from OracleConnectorConfig
Krish-cloudsufi 209683c
Changed primitive boolean to Boolean
Krish-cloudsufi 681c7f4
Fixed Boolean return logic
Krish-cloudsufi f70a62b
Changed datatype and added comments
Krish-cloudsufi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,6 +101,7 @@ public static class OracleSourceConfig extends AbstractDBSpecificSourceConfig { | |
| public static final String NAME_CONNECTION = "connection"; | ||
| public static final String DEFAULT_ROW_PREFETCH_VALUE = "40"; | ||
| public static final String DEFAULT_BATCH_SIZE = "10"; | ||
| public static final String TREAT_AS_OLD_TIMESTAMP = "treatAsOldTimestamp"; | ||
|
|
||
| @Name(NAME_USE_CONNECTION) | ||
| @Nullable | ||
|
|
@@ -123,6 +124,14 @@ public static class OracleSourceConfig extends AbstractDBSpecificSourceConfig { | |
| @Nullable | ||
| private Integer defaultRowPrefetch; | ||
|
|
||
| @Name(TREAT_AS_OLD_TIMESTAMP) | ||
| @Description("For internal use only. If set to true, DATETIME types will be treated as TIMESTAMP_MICROS to maintain backward compatibility.") | ||
| @Macro | ||
| @Nullable | ||
| @MetadataProperty(key = "hidden", value = "true") | ||
| private boolean treatAsOldTimestamp = false; | ||
|
|
||
|
|
||
| public OracleSourceConfig(String host, int port, String user, String password, String jdbcPluginName, | ||
| String connectionArguments, String connectionType, String database, String role, | ||
| int defaultBatchValue, int defaultRowPrefetch, | ||
|
|
@@ -163,6 +172,10 @@ public OracleConnectorConfig getConnection() { | |
| return connection; | ||
| } | ||
|
|
||
| public boolean shouldTreatAsOldTimestamp() { | ||
| return treatAsOldTimestamp; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do like this |
||
| } | ||
|
|
||
| @Override | ||
| public void validate(FailureCollector collector) { | ||
| ConfigUtil.validateConnection(this, useConnection, connection, collector); | ||
|
|
@@ -177,6 +190,17 @@ public String getTransactionIsolationLevel() { | |
| @Override | ||
| protected void validateField(FailureCollector collector, | ||
| Schema.Field field, Schema actualFieldSchema, Schema expectedFieldSchema) { | ||
| // For handling backward compatibility with pipelines built prior to plugin version change. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic is already there at line 223 |
||
| // If the config flag 'treatAsOldTimestamp' is enabled, allow DATETIME fields (actual schema) | ||
| // to be treated as TIMESTAMP_MICROS (expected schema). This preserves legacy behavior where | ||
| // non-UTC timestamp fields were interpreted as TIMESTAMP_MICROS. | ||
| if (shouldTreatAsOldTimestamp()) { | ||
| if (Schema.LogicalType.DATETIME.equals(actualFieldSchema.getLogicalType()) | ||
| && Schema.LogicalType.TIMESTAMP_MICROS.equals(expectedFieldSchema.getLogicalType())) { | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| // This change is needed to make sure that the pipeline upgrade continues to work post upgrade. | ||
| // Since the older handling of the precision less used to convert to the decimal type, | ||
| // and the new version would try to convert to the String type. In that case the output schema would | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it object type otherwise it will be shown as mandatory