You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by ravipesala <gi...@git.apache.org> on 2017/04/05 16:27:55 UTC

[GitHub] incubator-carbondata pull request #398: [CARBONDATA-400] Error message for d...

Github user ravipesala commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/398#discussion_r109963768
  
    --- Diff: integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/GlobalDictionaryUtil.scala ---
    @@ -784,11 +784,24 @@ object GlobalDictionaryUtil {
           }
         } catch {
           case ex: Exception =>
    -        LOGGER.error(ex, "generate global dictionary failed")
    -        throw ex
    +        ex match {
    +          case spx: SparkException =>
    +            LOGGER.error(spx, "generate global dictionary failed")
    +            throw new Exception(
    +              trimErrorMessage(spx.getMessage))
    +          case _ =>
    +            LOGGER.error(ex, "generate global dictionary failed")
    +            throw ex
    +        }
         }
       }
     
    +  // Get proper error message of TextParsingException
    +  def trimErrorMessage(input: String): String = {
    +    val message = input.split("Hint")(0).split("TextParsingException: ")(1)
    --- End diff --
    
    There may be chances of input is null because `spsx.getMessage()` can be null, so handle NPE here.
    And also please check the array length after you split with `"Hint"`, other wise we may get ArrayIndexOutOfBoundException.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---