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

Gwen Shapira commented on SQOOP-1621:
-------------------------------------

There are quite a few places in the Executor code that do getSchema and will 
work fine with an schema object that have no columns (that is - 
schema.isEmpty()==true) but will NPE on null.

If we do decide to support nulls, we'll need to check for nulls every single 
place we expect a schema, not just in Matcher.

I thought its reasonable to expect getSchema to return a Schema and not a null, 
and simply document the fact, explain what to do when there is known schema, 
and warn that returning null will result in NPE. However, maybe I was overly 
optimistic :)

So feel free to change this, just be aware that its a larger change than just 
to the Matcher. We'll need to check every time we get a value from getSchema, 
and there are quite a few. I hope there is a better solution that I'm not 
thinking of at the moment.



> Allow null as a dummy Schema
> ----------------------------
>
>                 Key: SQOOP-1621
>                 URL: https://issues.apache.org/jira/browse/SQOOP-1621
>             Project: Sqoop
>          Issue Type: Improvement
>            Reporter: Qian Xu
>            Assignee: Veena Basavaraj
>            Priority: Minor
>
> The {{getSchema}} of a {{Initializer}} cannot return {{null}} as a dummy 
> schema instance, It is not necessary. Caller (i.e. {{Matcher}}) should check 
> schema by using {{schema == null || schema.isEmpty()}}.



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

Reply via email to