sqoop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Veena Basavaraj (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SQOOP-2036) Sqoop2: JDBC Connector need to send BigDecimal for decimal type in Object array
Date Thu, 22 Jan 2015 21:46:34 GMT

     [ https://issues.apache.org/jira/browse/SQOOP-2036?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Veena Basavaraj updated SQOOP-2036:
-----------------------------------
    Description: 
At this point, we do not see the JDBC Connector sending BigDecimal for objects that are Sqoop
Decimal type, as we prescribe JODA for date objects, we need BigDecimal for decimal objects.

JDBC does send bigDecimal 
DECIMAL[(M[,D])]	DECIMAL	java.math.BigDecimal

Confirmed: Not a issue

  was:
At this point, we do not see the JDBC Connector sending BigDecimal for objects that are Sqoop
Decimal type, as we prescribe JODA for date objects, we need BigDecimal for decimal objects.

http://www.cs.mun.ca/~michael/java/jdk1.1-beta2-docs/guide/jdbc/mapping.doc.html
8.3.2	DECIMAL and NUMERIC

The SQL data types DECIMAL and NUMERIC, used to express fixed-point numbers where absolute
precision is required, can be expressed identically in Java. They are mapped to java.lang.Bignum,
a Java type that also expresses fixed-point numbers with absolute precision. The java.lang.Bignum
type is a subtype of the standard java.lang.Number type and provides math operations to allow
Bignum types to be added, subtracted, multiplied, and divided with other Bignum types, with
integer types, and with floating point types.
The method recommended for retrieving SQL DECIMAL and SQL NUMERIC values is ResultSet.getBigNum.
JDBC also allows access to these SQL types as simple Strings or arrays of char. Thus, Java
programmers can use getString to receive a NUMERIC or DECIMAL result. However, this makes
the common case where NUMERIC or DECIMAL are used for currency values rather awkward, since
it means that application writers have to perform math on strings. It is also possible to
retrieve these SQL types as any of the Java numeric types.


code to be fixed
{code}

  @Override
  public void extract(ExtractorContext context, LinkConfiguration linkConfig,
      FromJobConfiguration fromJobConfig, KiteDatasetPartition partition) {
    String uri = partition.getUri();
    LOG.info("Loading data from " + uri);

    KiteDatasetExecutor executor = getExecutor(uri);
    DataWriter writer = context.getDataWriter();
    Object[] array;
    rowsRead = 0L;

    try {
      while ((array = executor.readRecord()) != null) {
        // TODO: SQOOP-1616 will cover more column data types. Use schema and do data type
conversion (e.g. datatime).
        writer.writeArrayRecord(array);
        rowsRead++;
      }
    } finally {
      executor.closeReader();
    }
  }

{code}



> Sqoop2: JDBC Connector need to send BigDecimal for decimal type in Object array
> -------------------------------------------------------------------------------
>
>                 Key: SQOOP-2036
>                 URL: https://issues.apache.org/jira/browse/SQOOP-2036
>             Project: Sqoop
>          Issue Type: Bug
>            Reporter: Veena Basavaraj
>            Assignee: Veena Basavaraj
>             Fix For: 1.99.6
>
>
> At this point, we do not see the JDBC Connector sending BigDecimal for objects that are
Sqoop Decimal type, as we prescribe JODA for date objects, we need BigDecimal for decimal
objects.
> JDBC does send bigDecimal 
> DECIMAL[(M[,D])]	DECIMAL	java.math.BigDecimal
> Confirmed: Not a issue



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message