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 #1094: [CARBONDATA-1181] Show partitions
Date Tue, 27 Jun 2017 10:56:14 GMT
Github user gvramana commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1094#discussion_r124226416
  
    --- Diff: integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/CommonUtil.scala
---
    @@ -544,4 +552,52 @@ object CommonUtil {
         }
       }
     
    +  def getPartitionInfo(columnName: String, partitionType: PartitionType,
    +      partitionInfo: PartitionInfo): Seq[Row] = {
    +    var result = Seq.newBuilder[Row]
    +    partitionType match {
    +      case PartitionType.RANGE =>
    +        result.+=(RowFactory.create(columnName + "=default"))
    +        var rangeInfo = partitionInfo.getRangeInfo
    +        var size = rangeInfo.size() - 1
    +        for (index <- 0 to size) {
    +          if (index == 0) {
    +            result.+=(RowFactory.create(columnName + "<" + rangeInfo.get(index)))
    +          } else {
    +            result.+=(RowFactory.create(rangeInfo.get(index - 1) + "<=" +
    +              columnName + "<" + rangeInfo.get(index)))
    +          }
    +        }
    +      case PartitionType.RANGE_INTERVAL =>
    +        result.+=(RowFactory.create(columnName + "="))
    +      case PartitionType.LIST =>
    +        result.+=(RowFactory.create(columnName + "=default"))
    +        var id = 1
    +        var listInfo = partitionInfo.getListInfo
    +        var size = listInfo.size() - 1
    +        for (index <- 0 to size) {
    +          var listStr = ""
    +          listInfo.get(index).toArray().foreach { x =>
    --- End diff --
    
    Please use map/foreach function and inside use mkString(",") function


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