Skip to content

Commit 0356be8

Browse files
Add hidden treatTimestampLTZAsTimestamp
1 parent d9af2d2 commit 0356be8

File tree

7 files changed

+20
-24
lines changed

7 files changed

+20
-24
lines changed

oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleConnector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ protected DBConnectorPath getDBConnectorPath(String path) {
115115
protected SchemaReader getSchemaReader(String sessionID) {
116116
return new OracleSourceSchemaReader(sessionID, config.getTreatAsOldTimestamp(),
117117
config.getTreatPrecisionlessNumAsDeci(),
118-
config.getTreatAsTimestampForLocalTimeZone());
118+
config.getTreatTimestampLTZAsTimestamp());
119119
}
120120

121121
@Override

oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleConnectorConfig.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public OracleConnectorConfig(String host, int port, String user, String password
4949
String connectionArguments, String connectionType, String database,
5050
String role, Boolean useSSL, @Nullable Boolean treatAsOldTimestamp,
5151
@Nullable Boolean treatPrecisionlessNumAsDeci,
52-
@Nullable Boolean treatAsTimestampForLocalTimeZone) {
52+
@Nullable Boolean treatTimestampLTZAsTimestamp) {
5353

5454
this.host = host;
5555
this.port = port;
@@ -63,7 +63,7 @@ public OracleConnectorConfig(String host, int port, String user, String password
6363
this.useSSL = useSSL;
6464
this.treatAsOldTimestamp = treatAsOldTimestamp;
6565
this.treatPrecisionlessNumAsDeci = treatPrecisionlessNumAsDeci;
66-
this.treatAsTimestampForLocalTimeZone = treatAsTimestampForLocalTimeZone;
66+
this.treatTimestampLTZAsTimestamp = treatTimestampLTZAsTimestamp;
6767
}
6868

6969
@Override
@@ -100,10 +100,10 @@ public String getConnectionString() {
100100
@Nullable
101101
public Boolean treatPrecisionlessNumAsDeci;
102102

103-
@Name(OracleConstants.TREAT_AS_TIMESTAMP_FOR_LOCAL_TIME_ZONE)
103+
@Name(OracleConstants.TREAT_TIMESTAMP_LTZ_AS_TIMESTAMP)
104104
@Description("A hidden field to handle mapping of Oracle Timestamp_LTZ data type to BQ Timestamp.")
105105
@Nullable
106-
public Boolean treatAsTimestampForLocalTimeZone;
106+
public Boolean treatTimestampLTZAsTimestamp;
107107

108108
@Override
109109
protected int getDefaultPort() {
@@ -135,8 +135,8 @@ public Boolean getTreatPrecisionlessNumAsDeci() {
135135
return Boolean.TRUE.equals(treatPrecisionlessNumAsDeci);
136136
}
137137

138-
public Boolean getTreatAsTimestampForLocalTimeZone() {
139-
return Boolean.TRUE.equals(treatAsTimestampForLocalTimeZone);
138+
public Boolean getTreatTimestampLTZAsTimestamp() {
139+
return Boolean.TRUE.equals(treatTimestampLTZAsTimestamp);
140140
}
141141

142142
@Override

oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private OracleConstants() {
4646
public static final String USE_SSL = "useSSL";
4747
public static final String TREAT_AS_OLD_TIMESTAMP = "treatAsOldTimestamp";
4848
public static final String TREAT_PRECISIONLESSNUM_AS_DECI = "treatPrecisionlessNumAsDeci";
49-
public static final String TREAT_AS_TIMESTAMP_FOR_LOCAL_TIME_ZONE = "treatAsTimestampForLocalTimeZone";
49+
public static final String TREAT_TIMESTAMP_LTZ_AS_TIMESTAMP = "treatTimestampLTZAsTimestamp";
5050

5151
/**
5252
* Constructs the Oracle connection string based on the provided connection type, host, port, and database.

oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSource.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ protected SchemaReader getSchemaReader() {
6868
// handle schema to make it backward compatible.
6969
boolean treatAsOldTimestamp = oracleSourceConfig.getConnection().getTreatAsOldTimestamp();
7070
boolean treatPrecisionlessNumAsDeci = oracleSourceConfig.getConnection().getTreatPrecisionlessNumAsDeci();
71-
boolean treatAsTimestampForLocalTimeZone = oracleSourceConfig.getConnection().getTreatAsTimestampForLocalTimeZone();
71+
boolean treatTimestampLTZAsTimestamp = oracleSourceConfig.getConnection().getTreatTimestampLTZAsTimestamp();
7272

7373
return new OracleSourceSchemaReader(null, treatAsOldTimestamp, treatPrecisionlessNumAsDeci,
74-
treatAsTimestampForLocalTimeZone);
74+
treatTimestampLTZAsTimestamp);
7575
}
7676

7777
@Override
@@ -139,10 +139,10 @@ public OracleSourceConfig(String host, int port, String user, String password, S
139139
int defaultBatchValue, int defaultRowPrefetch,
140140
String importQuery, Integer numSplits, int fetchSize,
141141
String boundingQuery, String splitBy, Boolean useSSL, Boolean treatAsOldTimestamp,
142-
Boolean treatPrecisionlessNumAsDeci, Boolean treatAsTimestampForLocalTimeZone) {
142+
Boolean treatPrecisionlessNumAsDeci, Boolean treatTimestampLTZAsTimestamp) {
143143
this.connection = new OracleConnectorConfig(host, port, user, password, jdbcPluginName, connectionArguments,
144144
connectionType, database, role, useSSL, treatAsOldTimestamp,
145-
treatPrecisionlessNumAsDeci, treatAsTimestampForLocalTimeZone);
145+
treatPrecisionlessNumAsDeci, treatTimestampLTZAsTimestamp);
146146
this.defaultBatchValue = defaultBatchValue;
147147
this.defaultRowPrefetch = defaultRowPrefetch;
148148
this.fetchSize = fetchSize;

oracle-plugin/src/main/java/io/cdap/plugin/oracle/OracleSourceSchemaReader.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,17 @@ public class OracleSourceSchemaReader extends CommonSchemaReader {
6969
private final String sessionID;
7070
private final Boolean isTimestampOldBehavior;
7171
private final Boolean isPrecisionlessNumAsDecimal;
72-
private final Boolean isLtzFieldTimestamp;
72+
private final Boolean isTimestampLtzFieldTimestamp;
7373

7474
public OracleSourceSchemaReader() {
7575
this(null, false, false, false);
7676
}
7777
public OracleSourceSchemaReader(@Nullable String sessionID, boolean isTimestampOldBehavior,
78-
boolean isPrecisionlessNumAsDecimal, boolean isLtzFieldTimestamp) {
78+
boolean isPrecisionlessNumAsDecimal, boolean isTimestampLtzFieldTimestamp) {
7979
this.sessionID = sessionID;
8080
this.isTimestampOldBehavior = isTimestampOldBehavior;
8181
this.isPrecisionlessNumAsDecimal = isPrecisionlessNumAsDecimal;
82-
this.isLtzFieldTimestamp = isLtzFieldTimestamp;
82+
this.isTimestampLtzFieldTimestamp = isTimestampLtzFieldTimestamp;
8383
}
8484

8585
@Override
@@ -142,11 +142,7 @@ public Schema getSchema(ResultSetMetaData metadata, int index) throws SQLExcepti
142142
}
143143

144144
private @NotNull Schema getTimestampLtzSchema() {
145-
if (Boolean.TRUE.equals(isLtzFieldTimestamp)) {
146-
return Schema.of(Schema.LogicalType.TIMESTAMP_MICROS);
147-
}
148-
149-
return isTimestampOldBehavior
145+
return isTimestampOldBehavior || isTimestampLtzFieldTimestamp
150146
? Schema.of(Schema.LogicalType.TIMESTAMP_MICROS)
151147
: Schema.of(Schema.LogicalType.DATETIME);
152148
}

oracle-plugin/widgets/Oracle-batchsource.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@
160160
},
161161
{
162162
"widget-type": "hidden",
163-
"label": "Treat as Timestamp for Timestamp_LTZ",
164-
"name": "treatAsTimestampForLocalTimeZone",
163+
"label": "Treat Timestamp_LTZ as Timestamp",
164+
"name": "treatTimestampLTZAsTimestamp",
165165
"widget-attributes": {
166166
"layout": "inline",
167167
"default": "false",

oracle-plugin/widgets/Oracle-connector.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@
170170
},
171171
{
172172
"widget-type": "hidden",
173-
"label": "Treat as Timestamp for Timestamp_LTZ",
174-
"name": "treatAsTimestampForLocalTimeZone",
173+
"label": "Treat Timestamp_LTZ as Timestamp",
174+
"name": "treatTimestampLTZAsTimestamp",
175175
"widget-attributes": {
176176
"layout": "inline",
177177
"default": "false",

0 commit comments

Comments
 (0)