Skip to content

Conversation

@jacek-lewandowski
Copy link
Contributor

What changes were proposed in this pull request?

There are some calls to methods or fields (getParameters, properties) which are then passed to Java/Scala collection converters. Unfortunately those fields can be null in some cases and then the conversions throws NPE. We fix it by wrapping calls to those fields and methods with option and then do the conversion.

How was this patch tested?

Manually tested with a custom Hive metastore.

@jacek-lewandowski
Copy link
Contributor Author

test this please

@jacek-lewandowski jacek-lewandowski changed the title SPARK-16528: Fix NPE problem in HiveClientImpl [SPARK-16528][SQL]: Fix NPE problem in HiveClientImpl Jul 14, 2016
There are some calls to methods or fields (getParameters, properties) which are then passed to Java/Scala collection converters. Unfortunately those fields can be null in some cases and then the conversions throws NPE. We fix it by wrapping calls to those fields and methods with option and then do the conversion.
@jacek-lewandowski jacek-lewandowski changed the title [SPARK-16528][SQL]: Fix NPE problem in HiveClientImpl [SPARK-16528][SQL] Fix NPE problem in HiveClientImpl Jul 14, 2016
@srowen
Copy link
Member

srowen commented Jul 14, 2016

OK by me

@SparkQA
Copy link

SparkQA commented Jul 14, 2016

Test build #62310 has finished for PR 14200 at commit 667abc0.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jul 14, 2016

Test build #62311 has finished for PR 14200 at commit 49c5451.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@rxin
Copy link
Contributor

rxin commented Jul 14, 2016

LGTM - merging in master/2.0.

@asfgit asfgit closed this in 31ca741 Jul 14, 2016
asfgit pushed a commit that referenced this pull request Jul 14, 2016
## What changes were proposed in this pull request?

There are some calls to methods or fields (getParameters, properties) which are then passed to Java/Scala collection converters. Unfortunately those fields can be null in some cases and then the conversions throws NPE. We fix it by wrapping calls to those fields and methods with option and then do the conversion.

## How was this patch tested?

Manually tested with a custom Hive metastore.

Author: Jacek Lewandowski <[email protected]>

Closes #14200 from jacek-lewandowski/SPARK-16528.

(cherry picked from commit 31ca741)
Signed-off-by: Reynold Xin <[email protected]>
description = d.getDescription,
locationUri = d.getLocationUri,
properties = d.getParameters.asScala.toMap)
properties = Option(d.getParameters).map(_.asScala.toMap).orNull)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Map.empty a better default value? Or we should update the properties field in CatalogDatabase to indicate that it's nullable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps... however this would change the semantics which was out of the scope of this ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants