You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sqoop.apache.org by "Cheolsoo Park (Created) (JIRA)" <ji...@apache.org> on 2012/03/07 09:01:59 UTC

[jira] [Created] (SQOOP-456) Generated Java class does not distinguish date and timestamp in Oracle DB

Generated Java class does not distinguish date and timestamp in Oracle DB 
--------------------------------------------------------------------------

                 Key: SQOOP-456
                 URL: https://issues.apache.org/jira/browse/SQOOP-456
             Project: Sqoop
          Issue Type: Bug
          Components: codegen
            Reporter: Cheolsoo Park
            Assignee: Cheolsoo Park


In genereated Java class, both date and timestamp are considered as timestamps. For examples, the following getter method is generated for a date column:

{code:xml} 
public void readFields(ResultSet __dbResults) throws SQLException {
  this.__cur_result_set = __dbResults;
  this.DATA_COL0 = JdbcWritableBridge.readTimestamp(1, __dbResults);
}
{code}

This happens because both date and timestamp is labeled as Types.TIMESTAMP by ConnManager. The fix seems straightforward. In ClassWriter, the new method getColTypeNamesForTable introduced by Bilung at SQOOP-352 should replace getColTypes(). 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SQOOP-456) Generated Java class does not distinguish date and timestamp in Oracle DB

Posted by "Arvind Prabhakar (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SQOOP-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13229487#comment-13229487 ] 

Arvind Prabhakar commented on SQOOP-456:
----------------------------------------

Sounds good to me. As long as we are backward compatible by default, the user should have the ability to work around this issue. Introducing a option that allows user to override this functionality sounds like a good plan.
                
> Generated Java class does not distinguish date and timestamp in Oracle DB 
> --------------------------------------------------------------------------
>
>                 Key: SQOOP-456
>                 URL: https://issues.apache.org/jira/browse/SQOOP-456
>             Project: Sqoop
>          Issue Type: Bug
>          Components: codegen
>            Reporter: Cheolsoo Park
>            Assignee: Cheolsoo Park
>            Priority: Minor
>
> In genereated Java class, both date and timestamp are considered as timestamps. For examples, the following getter method is generated for a date column:
> {code:xml} 
> public void readFields(ResultSet __dbResults) throws SQLException {
>   this.__cur_result_set = __dbResults;
>   this.DATA_COL0 = JdbcWritableBridge.readTimestamp(1, __dbResults);
> }
> {code}
> This happens because both date and timestamp is labeled as Types.TIMESTAMP by ConnManager. The fix seems straightforward. In ClassWriter, the new method getColTypeNamesForTable introduced by Bilung at SQOOP-352 should replace getColTypes(). 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SQOOP-456) Generated Java class does not distinguish date and timestamp in Oracle DB

Posted by "Cheolsoo Park (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SQOOP-456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cheolsoo Park updated SQOOP-456:
--------------------------------

    Priority: Minor  (was: Major)

The Oracle JDBC driver has a long history on date and timestamp. In shorts, versions < 9.2 && > 11.1 auto-cast date to timestamp. But the rest of versions do not.

For more details, please refer to the following link: http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#08_01
                
> Generated Java class does not distinguish date and timestamp in Oracle DB 
> --------------------------------------------------------------------------
>
>                 Key: SQOOP-456
>                 URL: https://issues.apache.org/jira/browse/SQOOP-456
>             Project: Sqoop
>          Issue Type: Bug
>          Components: codegen
>            Reporter: Cheolsoo Park
>            Assignee: Cheolsoo Park
>            Priority: Minor
>
> In genereated Java class, both date and timestamp are considered as timestamps. For examples, the following getter method is generated for a date column:
> {code:xml} 
> public void readFields(ResultSet __dbResults) throws SQLException {
>   this.__cur_result_set = __dbResults;
>   this.DATA_COL0 = JdbcWritableBridge.readTimestamp(1, __dbResults);
> }
> {code}
> This happens because both date and timestamp is labeled as Types.TIMESTAMP by ConnManager. The fix seems straightforward. In ClassWriter, the new method getColTypeNamesForTable introduced by Bilung at SQOOP-352 should replace getColTypes(). 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SQOOP-456) Generated Java class does not distinguish date and timestamp in Oracle DB

Posted by "Arvind Prabhakar (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SQOOP-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13229413#comment-13229413 ] 

Arvind Prabhakar commented on SQOOP-456:
----------------------------------------

Good find Cheolsoo. Changing the code generator will fix this problem, but will introduce backward incompatibility for previously generated records. Any suggestion on how to handle that?
                
> Generated Java class does not distinguish date and timestamp in Oracle DB 
> --------------------------------------------------------------------------
>
>                 Key: SQOOP-456
>                 URL: https://issues.apache.org/jira/browse/SQOOP-456
>             Project: Sqoop
>          Issue Type: Bug
>          Components: codegen
>            Reporter: Cheolsoo Park
>            Assignee: Cheolsoo Park
>            Priority: Minor
>
> In genereated Java class, both date and timestamp are considered as timestamps. For examples, the following getter method is generated for a date column:
> {code:xml} 
> public void readFields(ResultSet __dbResults) throws SQLException {
>   this.__cur_result_set = __dbResults;
>   this.DATA_COL0 = JdbcWritableBridge.readTimestamp(1, __dbResults);
> }
> {code}
> This happens because both date and timestamp is labeled as Types.TIMESTAMP by ConnManager. The fix seems straightforward. In ClassWriter, the new method getColTypeNamesForTable introduced by Bilung at SQOOP-352 should replace getColTypes(). 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SQOOP-456) Generated Java class does not distinguish date and timestamp in Oracle DB

Posted by "Cheolsoo Park (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SQOOP-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13229473#comment-13229473 ] 

Cheolsoo Park commented on SQOOP-456:
-------------------------------------

Hi Arvind,

Thanks for your comment. I think that we would need to introduce a new option something like ""--mapDateToTimestamp". In fact, this is the property that Oracle provides for this particular problem. By default, we could set "--mapDatetoTimestamp" to true so that backward incompatibility wouldn't be introduced.
                
> Generated Java class does not distinguish date and timestamp in Oracle DB 
> --------------------------------------------------------------------------
>
>                 Key: SQOOP-456
>                 URL: https://issues.apache.org/jira/browse/SQOOP-456
>             Project: Sqoop
>          Issue Type: Bug
>          Components: codegen
>            Reporter: Cheolsoo Park
>            Assignee: Cheolsoo Park
>            Priority: Minor
>
> In genereated Java class, both date and timestamp are considered as timestamps. For examples, the following getter method is generated for a date column:
> {code:xml} 
> public void readFields(ResultSet __dbResults) throws SQLException {
>   this.__cur_result_set = __dbResults;
>   this.DATA_COL0 = JdbcWritableBridge.readTimestamp(1, __dbResults);
> }
> {code}
> This happens because both date and timestamp is labeled as Types.TIMESTAMP by ConnManager. The fix seems straightforward. In ClassWriter, the new method getColTypeNamesForTable introduced by Bilung at SQOOP-352 should replace getColTypes(). 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SQOOP-456) Generated Java class does not distinguish date and timestamp in Oracle DB

Posted by "Cheolsoo Park (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SQOOP-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13229038#comment-13229038 ] 

Cheolsoo Park commented on SQOOP-456:
-------------------------------------

The best way to fix the problems is probably to override the getColumnTypes() method in OracleManager. If the type is timestamp, but the type name is "DATE", the column type should be labelled as date not timestamp. Since getColumnTypes() is used everywhere to determine the type of columns in Sqoop, if we fixed this method, ClassWriter would generate code that reads dates.
                
> Generated Java class does not distinguish date and timestamp in Oracle DB 
> --------------------------------------------------------------------------
>
>                 Key: SQOOP-456
>                 URL: https://issues.apache.org/jira/browse/SQOOP-456
>             Project: Sqoop
>          Issue Type: Bug
>          Components: codegen
>            Reporter: Cheolsoo Park
>            Assignee: Cheolsoo Park
>            Priority: Minor
>
> In genereated Java class, both date and timestamp are considered as timestamps. For examples, the following getter method is generated for a date column:
> {code:xml} 
> public void readFields(ResultSet __dbResults) throws SQLException {
>   this.__cur_result_set = __dbResults;
>   this.DATA_COL0 = JdbcWritableBridge.readTimestamp(1, __dbResults);
> }
> {code}
> This happens because both date and timestamp is labeled as Types.TIMESTAMP by ConnManager. The fix seems straightforward. In ClassWriter, the new method getColTypeNamesForTable introduced by Bilung at SQOOP-352 should replace getColTypes(). 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (SQOOP-456) Generated Java class does not distinguish date and timestamp in Oracle DB

Posted by "Cheolsoo Park (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SQOOP-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13229473#comment-13229473 ] 

Cheolsoo Park edited comment on SQOOP-456 at 3/14/12 6:33 PM:
--------------------------------------------------------------

Hi Arvind,

Thanks for your comment. I think that we would need to introduce a new option something like "--mapDateToTimestamp". In fact, this is the property that Oracle provides for this particular problem. By default, we could set "--mapDatetoTimestamp" to true so that backward incompatibility wouldn't be introduced.
                
      was (Author: cheolsoo):
    Hi Arvind,

Thanks for your comment. I think that we would need to introduce a new option something like ""--mapDateToTimestamp". In fact, this is the property that Oracle provides for this particular problem. By default, we could set "--mapDatetoTimestamp" to true so that backward incompatibility wouldn't be introduced.
                  
> Generated Java class does not distinguish date and timestamp in Oracle DB 
> --------------------------------------------------------------------------
>
>                 Key: SQOOP-456
>                 URL: https://issues.apache.org/jira/browse/SQOOP-456
>             Project: Sqoop
>          Issue Type: Bug
>          Components: codegen
>            Reporter: Cheolsoo Park
>            Assignee: Cheolsoo Park
>            Priority: Minor
>
> In genereated Java class, both date and timestamp are considered as timestamps. For examples, the following getter method is generated for a date column:
> {code:xml} 
> public void readFields(ResultSet __dbResults) throws SQLException {
>   this.__cur_result_set = __dbResults;
>   this.DATA_COL0 = JdbcWritableBridge.readTimestamp(1, __dbResults);
> }
> {code}
> This happens because both date and timestamp is labeled as Types.TIMESTAMP by ConnManager. The fix seems straightforward. In ClassWriter, the new method getColTypeNamesForTable introduced by Bilung at SQOOP-352 should replace getColTypes(). 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (SQOOP-456) Generated Java class does not distinguish date and timestamp in Oracle DB

Posted by "Cheolsoo Park (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SQOOP-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13229473#comment-13229473 ] 

Cheolsoo Park edited comment on SQOOP-456 at 3/14/12 6:33 PM:
--------------------------------------------------------------

Hi Arvind,

Thanks for your comment. I think that we would need to introduce a new option something like --mapDateToTimestamp. In fact, this is the property that Oracle provides for this particular problem. By default, we could set --mapDatetoTimestamp to true so that backward incompatibility wouldn't be introduced.
                
      was (Author: cheolsoo):
    Hi Arvind,

Thanks for your comment. I think that we would need to introduce a new option something like "--mapDateToTimestamp". In fact, this is the property that Oracle provides for this particular problem. By default, we could set "--mapDatetoTimestamp" to true so that backward incompatibility wouldn't be introduced.
                  
> Generated Java class does not distinguish date and timestamp in Oracle DB 
> --------------------------------------------------------------------------
>
>                 Key: SQOOP-456
>                 URL: https://issues.apache.org/jira/browse/SQOOP-456
>             Project: Sqoop
>          Issue Type: Bug
>          Components: codegen
>            Reporter: Cheolsoo Park
>            Assignee: Cheolsoo Park
>            Priority: Minor
>
> In genereated Java class, both date and timestamp are considered as timestamps. For examples, the following getter method is generated for a date column:
> {code:xml} 
> public void readFields(ResultSet __dbResults) throws SQLException {
>   this.__cur_result_set = __dbResults;
>   this.DATA_COL0 = JdbcWritableBridge.readTimestamp(1, __dbResults);
> }
> {code}
> This happens because both date and timestamp is labeled as Types.TIMESTAMP by ConnManager. The fix seems straightforward. In ClassWriter, the new method getColTypeNamesForTable introduced by Bilung at SQOOP-352 should replace getColTypes(). 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira