carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gvramana <...@git.apache.org>
Subject [GitHub] carbondata pull request #1032: [CARBONDATA-1149] Fixed range info overlappin...
Date Wed, 28 Jun 2017 14:02:16 GMT
Github user gvramana commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1032#discussion_r124549140
  
    --- Diff: integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/CommonUtil.scala
---
    @@ -288,6 +297,69 @@ object CommonUtil {
         result
       }
     
    +  def validateForOverLappingRangeValues(desType: Option[String],
    +      rangeInfoArray: Array[String]): Boolean = {
    +    val rangeInfoValuesValid = desType match {
    +      case Some("IntegerType") | Some("int") =>
    +        val intRangeInfoArray = rangeInfoArray.map(_.toInt)
    +        val sortedRangeInfoArray = intRangeInfoArray.sorted
    +        intRangeInfoArray.sameElements(sortedRangeInfoArray)
    +      case Some("StringType") | Some("string") =>
    +        val sortedRangeInfoArray = rangeInfoArray.sorted
    +        rangeInfoArray.sameElements(sortedRangeInfoArray)
    +      case a if (desType.get.startsWith("varchar") || desType.get.startsWith("char"))
=>
    +        val sortedRangeInfoArray = rangeInfoArray.sorted
    +        rangeInfoArray.sameElements(sortedRangeInfoArray)
    +      case Some("LongType") | Some("long") | Some("bigint") =>
    +        val longRangeInfoArray = rangeInfoArray.map(_.toLong)
    +        val sortedRangeInfoArray = longRangeInfoArray.sorted
    +        longRangeInfoArray.sameElements(sortedRangeInfoArray)
    +      case Some("FloatType") | Some("float") =>
    +        val floatRangeInfoArray = rangeInfoArray.map(_.toFloat)
    +        val sortedRangeInfoArray = floatRangeInfoArray.sorted
    +        floatRangeInfoArray.sameElements(sortedRangeInfoArray)
    +      case Some("DoubleType") | Some("double") =>
    +        val doubleRangeInfoArray = rangeInfoArray.map(_.toDouble)
    +        val sortedRangeInfoArray = doubleRangeInfoArray.sorted
    +        doubleRangeInfoArray.sameElements(sortedRangeInfoArray)
    +      case Some("ByteType") | Some("tinyint") =>
    +        val byteRangeInfoArray = rangeInfoArray.map(_.toByte)
    +        val sortedRangeInfoArray = byteRangeInfoArray.sorted
    +        byteRangeInfoArray.sameElements(sortedRangeInfoArray)
    +      case Some("ShortType") | Some("smallint") =>
    +        val shortRangeInfoArray = rangeInfoArray.map(_.toShort)
    +        val sortedRangeInfoArray = shortRangeInfoArray.sorted
    +        shortRangeInfoArray.sameElements(sortedRangeInfoArray)
    +      case Some("BooleanType") | Some("boolean") =>
    +        true
    +      case a if (desType.get.startsWith("DecimalType") || desType.get.startsWith("decimal"))
=>
    +        val decimalRangeInfoArray = rangeInfoArray.map(value => BigDecimal(value))
    --- End diff --
    
    Bigdecimal precision and scale needs to be considered , other wise two ranges can overlap
after converting value during dataload. 


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