Skip to content

Commit eeff764

Browse files
committed
Reverting OracleSourceDBRecord.java
1 parent ffca662 commit eeff764

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

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

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
import io.cdap.plugin.db.ColumnType;
2525
import io.cdap.plugin.db.DBRecord;
2626
import io.cdap.plugin.db.SchemaReader;
27-
import org.slf4j.Logger;
28-
import org.slf4j.LoggerFactory;
2927

3028
import java.io.IOException;
3129
import java.io.InputStream;
@@ -50,8 +48,6 @@
5048
*/
5149
public class OracleSourceDBRecord extends DBRecord {
5250

53-
private static final Logger LOG = LoggerFactory.getLogger(OracleSourceDBRecord.class);
54-
5551
public OracleSourceDBRecord(StructuredRecord record, List<ColumnType> columnTypes) {
5652
this.record = record;
5753
this.columnTypes = columnTypes;
@@ -218,31 +214,16 @@ private void handleOracleSpecificType(ResultSet resultSet, StructuredRecord.Buil
218214
if (Double.class.getTypeName().equals(resultSet.getMetaData().getColumnClassName(columnIndex))) {
219215
recordBuilder.set(field.getName(), resultSet.getDouble(columnIndex));
220216
} else {
221-
int scaleInSchema = getScale(field.getSchema());
222-
if (precision == 0 && scaleInSchema == 0) {
223-
BigDecimal value = BigDecimal.valueOf(resultSet.getDouble(columnIndex));
224-
if (value != null && !containsIntegerValue(value)) {
225-
LOG.warn(String.format("Precision loss detected in the field '%s'. "
226-
+ "Scale in the data='%s' scale present in the schema='%s'.",
227-
field.getName(),
228-
value.scale(),
229-
scaleInSchema));
230-
}
231-
}
232217
// It's required to pass 'scale' parameter since in the case of Oracle, scale of 'BigDecimal' depends on the
233218
// scale set in the logical schema. For example for value '77.12' if the scale set in the logical schema is
234219
// set to 4 then the number will change to '77.1200'. Also if the value is '22.1274' and the logical schema
235220
// scale is set to 2 then the decimal value used will be '22.13' after rounding.
236-
BigDecimal decimal = resultSet.getBigDecimal(columnIndex, scaleInSchema);
221+
BigDecimal decimal = resultSet.getBigDecimal(columnIndex, getScale(field.getSchema()));
237222
recordBuilder.setDecimal(field.getName(), decimal);
238223
}
239224
}
240225
}
241226

242-
private boolean containsIntegerValue(BigDecimal value) {
243-
return value.remainder(BigDecimal.ONE).compareTo(BigDecimal.ZERO) == 0;
244-
}
245-
246227
/**
247228
* Get the scale set in Non-nullable schema associated with the schema
248229
* */

0 commit comments

Comments
 (0)