carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jackylk <...@git.apache.org>
Subject [GitHub] incubator-carbondata pull request #470: [WIP]Fixed Performance issue for dic...
Date Mon, 09 Jan 2017 10:37:33 GMT
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/470#discussion_r95131917
  
    --- Diff: integration/spark/src/main/scala/org/apache/spark/sql/CarbonDictionaryDecoder.scala
---
    @@ -224,21 +226,39 @@ case class CarbonDictionaryDecoder(
       }
     
       private def getDictionary(atiMap: Map[String, AbsoluteTableIdentifier],
    -      cache: Cache[DictionaryColumnUniqueIdentifier, Dictionary]) = {
    -    val dicts: Seq[Dictionary] = getDictionaryColumnIds.map { f =>
    +                            cache: Cache[DictionaryColumnUniqueIdentifier, Dictionary])
= {
    +    val dictionaryColumnIds = getDictionaryColumnIds.map { f =>
           if (f._2 != null) {
    -        try {
    -          cache.get(new DictionaryColumnUniqueIdentifier(
    -            atiMap(f._1).getCarbonTableIdentifier,
    -            f._2, f._3))
    -        } catch {
    -          case _: Throwable => null
    -        }
    +        new DictionaryColumnUniqueIdentifier(
    +          atiMap(f._1).getCarbonTableIdentifier,
    +          f._2, f._3)
           } else {
             null
           }
         }
    -    dicts
    +    try {
    +      val noDictionaryIndexes = new java.util.ArrayList[Int]()
    +      dictionaryColumnIds.zipWithIndex.foreach { x =>
    +        if (x._1 == null) {
    +          noDictionaryIndexes.add(x._2)
    +        }
    +      }
    +      val dict = cache.getAll(dictionaryColumnIds.filter(_ != null).toSeq.asJava);
    +      val finalDict = new java.util.ArrayList[Dictionary]()
    +      var dictIndex: Int = 0
    +      dictionaryColumnIds.zipWithIndex.foreach { x =>
    +        if (!noDictionaryIndexes.contains(x._2)) {
    +          finalDict.add(dict.get(dictIndex))
    +          dictIndex += 1
    +        } else {
    +          finalDict.add(null)
    --- End diff --
    
    why adding null?


---
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.
---

Mime
View raw message