sqoop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleksiy Sayankin (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (SQOOP-1383) Sqoop2: MSSQL Export not working
Date Mon, 27 Oct 2014 13:57:34 GMT

    [ https://issues.apache.org/jira/browse/SQOOP-1383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14185039#comment-14185039
] 

Oleksiy Sayankin edited comment on SQOOP-1383 at 10/27/14 1:57 PM:
-------------------------------------------------------------------

The main idea of the fix is to give possibility to implement DB specific optimizations and
settings for many future cases. IBaseJdbcExecutor and its implementation MsSqlServerJdbcExecutor
serve for only that purpose. If we don't need this and JdbcExecutorFactory is an overkill,
then the best solution is just to remove the parenthesis from migrateData() in GenericJdbcExecutor:
obviously it is easy and the code change is minimal. 

The only thing that we need to do in case of just removing the parenthesis is regression testing.
 This construction

INSERT INTO TestTable SELECT * FROM StageTable 

should work as fine as 

INSERT INTO TestTable ( SELECT * FROM StageTable )

in all cases in all DBs. I have no 100% guarantee for that but if true – why not? At least
it is true for most DBs from here: http://stackoverflow.com/questions/25969/sql-insert-into-values-select-from


was (Author: osayankin):
The main idea of the fix is to give possibility to implement DB specific optimizations and
settings for many future cases. IBaseJdbcExecutor and its implementation MsSqlServerJdbcExecutor
serve for only that purpose. If we don't need this, then the best solution is just to remove
the parenthesis from migrateData() in GenericJdbcExecutor: obviously it is easy and the code
change is minimal. 

The only thing that we need to do in case of just removing the parenthesis is regression testing.
 This construction

INSERT INTO TestTable SELECT * FROM StageTable 

should work as fine as 

INSERT INTO TestTable ( SELECT * FROM StageTable )

in all cases in all DBs. I have no 100% guarantee for that but if true – why not?

> Sqoop2: MSSQL Export not working
> --------------------------------
>
>                 Key: SQOOP-1383
>                 URL: https://issues.apache.org/jira/browse/SQOOP-1383
>             Project: Sqoop
>          Issue Type: Bug
>          Components: sqoop2-server
>    Affects Versions: 2.0.0, 1.99.3
>            Reporter: Abraham Elmahrek
>            Assignee: Oleksiy Sayankin
>              Labels: patch
>             Fix For: 1.99.4
>
>         Attachments: Fixed-Sqoop2-export-to-MSSQL-fails.patch
>
>
> {code}
> com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the
> keyword 'SELECT'.
>     at
> com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
>     at
> com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)
>     at
> com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:792)
>     at
> com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:689)
>     at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
>     at
> com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
>     at
> com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
>     at
> com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
>     at
> com.microsoft.sqlserver.jdbc.SQLServerStatement.executeUpdate(SQLServerStatement.java:642)
>     at
> org.apache.sqoop.connector.jdbc.GenericJdbcExecutor.migrateData(GenericJdbcExecutor.java:91)
>     at
> org.apache.sqoop.connector.jdbc.GenericJdbcExportDestroyer.moveDataToDestinationTable(GenericJdbcExportDestroyer.java:55)
>     at
> org.apache.sqoop.connector.jdbc.GenericJdbcExportDestroyer.destroy(GenericJdbcExportDestroyer.java:39)
>     at
> org.apache.sqoop.connector.jdbc.GenericJdbcExportDestroyer.destroy(GenericJdbcExportDestroyer.java:26)
>     at
> org.apache.sqoop.job.mr.SqoopDestroyerExecutor.executeDestroyer(SqoopDestroyerExecutor.java:65)
>     at
> org.apache.sqoop.job.mr.SqoopNullOutputFormat$DestroyerOutputCommitter.commitJob(SqoopNullOutputFormat.java:70)
>     at org.apache.hadoop.mapred.Task.runJobCleanupTask(Task.java:1102)
>     at org.apache.hadoop.mapred.MapTask.run(MapTask.java:333)
>     at org.apache.hadoop.mapred.Child$4.run(Child.java:282)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at javax.security.auth.Subject.doAs(Subject.java:415)
>     at
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1117)
>     at org.apache.hadoop.mapred.Child.main(Child.java:271)
> {code}
> - Additional Info: 
> - The issue is re-producible 
> - Import from MSSQL works fine.
> - Steps to re-produce: 
>     - Import a MSSQL table using sqoop2
>     - Try to export the same table to MSSQL.
> - Job info (from my test box): 
> ---------------
> sqoop:000> update job --jid 1
> Updating job with id 1
> Please update job metadata:
> Name: to MSworld
> Database configuration
> Schema name: dbo
> Table name: reg
> Table SQL statement: 
> Table column names: id,name
> Stage table name: reg_stage
> Clear stage table: true
> Input configuration
> Input directory: /sqoop/reg2
> ---------------
> Throttling resources
> Extractors: 
> Loaders: 
> Job was successfully updated with status FINE
> ---------------------------------------------------



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

Mime
View raw message