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

    
https://github.com/apache/incubator-carbondata/pull/398#discussion_r110117757
  
    --- Diff: 
integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/GlobalDictionaryUtil.scala
 ---
    @@ -784,9 +784,28 @@ 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("generate global dictionary failed, " +
    +                                trimErrorMessage(spx.getMessage))
    +          case _ =>
    +            LOGGER.error(ex, "generate global dictionary failed")
    +            throw ex
    +        }
    +    }
    +  }
    +
    +  // Get proper error message of TextParsingException
    +  def trimErrorMessage(input: String): String = {
    +    var errorMessage: String = null
    +    if (input != null) {
    +      if (input.split("Hint").length > 0 &&
    +          input.split("Hint")(0).split("TextParsingException: ").length > 
1) {
    +        errorMessage = input.split("Hint")(0).split("TextParsingException: 
")(1)
    +      }
    --- End diff --
    
    Just simplify as follows.
    ```
    val hintSplit = input.split("Hint")
    if (hintSplit.length > 0) {
      val parseSplit = hintSplit(0).split("TextParsingException: ")
      if (parseSplit.length > 1) {
       errorMessage = parseSplit(1)
      }
    }
    ```


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to