-
Notifications
You must be signed in to change notification settings - Fork 831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CopyManager throws wrong exception when setting DateStyle #131
Comments
So, what - specifically - do you want changed? PSQLException is a sub-class of SQLException. That said the interface for copyIn(string, Reader) allows for an IOException so wrapping it in a PSQLException (and by extension an SQLException) could be considered incorrect; though that does not appear to be your complaint anyway. Getting a pg-specific error from a pg-specific class is something where maybe you can quibble on semantics but given the class-inheritance I'd say you are getting the best of both worlds. Maybe something other than an IOException should occur but if you agree that the queries are invalid the distinction between the two is irrelevant since you couldn't recover from either in any meaningful way other that rewriting the query. I don't see changing this to IOException because it really is the higher-level protocol, and not the I/O itself, that is generating the error. And making it explicitly an SQLException seems pointless and possibly harmful since callers would no longer be able to use "getServerErrorMessage()" on the error. |
As I stated in the title, the problem seems to arise when the DateStyle parameter is set, without it the exception messages are very clear. In fact, the problem is that:
If the DateStyle parameter is not modified, the exceptions are very clear. For the first case (wrong query syntax):
For the second case:
|
Related pull request: #132 |
Great! Thank you! |
I meet a question,please help me fix it. Sqoop command arguments : 12728 [main] INFO org.apache.hadoop.mapreduce.Job - Job job_1499303596818_281263 running in uber mode : false 18936 [main] INFO org.apache.hadoop.mapreduce.Job - Counters: 8 Error: java.io.IOException: org.postgresql.util.PSQLException: Tried to end inactive copy at org.apache.sqoop.mapreduce.postgresql.PostgreSQLCopyExportMapper.cleanup(PostgreSQLCopyExportMapper.java:145) at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:148) at org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1783) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158) Caused by: org.postgresql.util.PSQLException: Tried to end inactive copy at org.postgresql.core.v3.QueryExecutorImpl.endCopy(QueryExecutorImpl.java:816) at org.postgresql.core.v3.CopyInImpl.endCopy(CopyInImpl.java:61) at org.apache.sqoop.mapreduce.postgresql.PostgreSQLCopyExportMapper.cleanup(PostgreSQLCopyExportMapper.java:142) ... 9 more |
Not exactly sure what you want us to do with this. Very difficult to figure out what the problem is with the information provided |
@davecramer mr task , extract data from hive to pg , An error is as follows What are the usual reasons |
When trying to set DateStyle before a COPY operation through CopyManager, the SQLExceptions that it throws are wrong.
You can try it with the following Maven-based project:
https://www.dropbox.com/s/663132bj1kolqv9/jdbc-bug-poc.zip
Using PG JDBC version 9.3-1101-jdbc41
Using PGSql server version 9.2.4
WrongQueryMain: executes a wrong query for a COPY.
WrongDataMain: executes a correct query but with wrong data.
The table to create is inside src/etc/sql/create.sql
The wrong exceptions are, in particular:
If the data is wrong it fails this way:
The text was updated successfully, but these errors were encountered: