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

[GitHub] incubator-carbondata pull request #765: [CARBONDATA-887]lazy rdd iterator fo...

GitHub user QiangCai opened a pull request:

    https://github.com/apache/incubator-carbondata/pull/765

    [CARBONDATA-887]lazy rdd iterator for InsertInto

    Previously we also called the rdd.iterator method for all partitions, and released the resources after all partitions were executed.
    Now we call rdd.iterator method one by one, and release the resource immediately after each partition is executed.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/QiangCai/incubator-carbondata rdddeserialize

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-carbondata/pull/765.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #765
    
----
commit 0d4a720d4f4157c8eab7a965f3dec224266fecdb
Author: QiangCai <qi...@qq.com>
Date:   2017-04-07T14:08:19Z

    lazy rdd iterator

----


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

[GitHub] incubator-carbondata issue #765: [CARBONDATA-887]lazy rdd iterator for Inser...

Posted by QiangCai <gi...@git.apache.org>.
Github user QiangCai commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/765
  
    @gvramana This pr will fix memory issue of InsertInto.


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

[GitHub] incubator-carbondata pull request #765: [CARBONDATA-887]lazy rdd iterator fo...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/765#discussion_r110531763
  
    --- Diff: integration/spark-common/src/main/scala/org/apache/carbondata/spark/rdd/NewCarbonDataLoadRDD.scala ---
    @@ -504,3 +500,66 @@ class NewRddIterator(rddIter: Iterator[Row],
       }
     
     }
    +
    +/**
    + * LazyRddIterator invoke rdd.iterator method when invoking hasNext method.
    + * @param serializer
    + * @param serializeBytes
    + * @param partition
    + * @param carbonLoadModel
    + * @param context
    + */
    +class LazyRddIterator(serializer: SerializerInstance,
    +    serializeBytes: Array[Byte],
    +    partition: Partition,
    +    carbonLoadModel: CarbonLoadModel,
    +    context: TaskContext) extends CarbonIterator[Array[AnyRef]] {
    +
    +  val timeStampformatString = CarbonProperties.getInstance().getProperty(CarbonCommonConstants
    +    .CARBON_TIMESTAMP_FORMAT, CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT)
    +  val timeStampFormat = new SimpleDateFormat(timeStampformatString)
    +  val dateFormatString = CarbonProperties.getInstance().getProperty(CarbonCommonConstants
    +    .CARBON_DATE_FORMAT, CarbonCommonConstants.CARBON_DATE_DEFAULT_FORMAT)
    +  val dateFormat = new SimpleDateFormat(dateFormatString)
    +  val delimiterLevel1 = carbonLoadModel.getComplexDelimiterLevel1
    +  val delimiterLevel2 = carbonLoadModel.getComplexDelimiterLevel2
    +  val serializationNullFormat =
    --- End diff --
    
    make all these variables private


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

[GitHub] incubator-carbondata pull request #765: [CARBONDATA-887]lazy rdd iterator fo...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-carbondata/pull/765


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

[GitHub] incubator-carbondata issue #765: [CARBONDATA-887]lazy rdd iterator for Inser...

Posted by gvramana <gi...@git.apache.org>.
Github user gvramana commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/765
  
    LGTM


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

[GitHub] incubator-carbondata pull request #765: [CARBONDATA-887]lazy rdd iterator fo...

Posted by QiangCai <gi...@git.apache.org>.
Github user QiangCai commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/765#discussion_r110675213
  
    --- Diff: integration/spark-common/src/main/scala/org/apache/carbondata/spark/rdd/NewCarbonDataLoadRDD.scala ---
    @@ -504,3 +500,66 @@ class NewRddIterator(rddIter: Iterator[Row],
       }
     
     }
    +
    +/**
    + * LazyRddIterator invoke rdd.iterator method when invoking hasNext method.
    + * @param serializer
    + * @param serializeBytes
    + * @param partition
    + * @param carbonLoadModel
    + * @param context
    + */
    +class LazyRddIterator(serializer: SerializerInstance,
    +    serializeBytes: Array[Byte],
    +    partition: Partition,
    +    carbonLoadModel: CarbonLoadModel,
    +    context: TaskContext) extends CarbonIterator[Array[AnyRef]] {
    +
    +  val timeStampformatString = CarbonProperties.getInstance().getProperty(CarbonCommonConstants
    +    .CARBON_TIMESTAMP_FORMAT, CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT)
    +  val timeStampFormat = new SimpleDateFormat(timeStampformatString)
    +  val dateFormatString = CarbonProperties.getInstance().getProperty(CarbonCommonConstants
    +    .CARBON_DATE_FORMAT, CarbonCommonConstants.CARBON_DATE_DEFAULT_FORMAT)
    +  val dateFormat = new SimpleDateFormat(dateFormatString)
    +  val delimiterLevel1 = carbonLoadModel.getComplexDelimiterLevel1
    +  val delimiterLevel2 = carbonLoadModel.getComplexDelimiterLevel2
    +  val serializationNullFormat =
    --- End diff --
    
    ok


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

[GitHub] incubator-carbondata pull request #765: [CARBONDATA-887]lazy rdd iterator fo...

Posted by QiangCai <gi...@git.apache.org>.
Github user QiangCai commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/765#discussion_r110675207
  
    --- Diff: integration/spark-common/src/main/scala/org/apache/carbondata/spark/rdd/NewCarbonDataLoadRDD.scala ---
    @@ -504,3 +500,66 @@ class NewRddIterator(rddIter: Iterator[Row],
       }
     
     }
    +
    +/**
    + * LazyRddIterator invoke rdd.iterator method when invoking hasNext method.
    + * @param serializer
    + * @param serializeBytes
    + * @param partition
    + * @param carbonLoadModel
    + * @param context
    + */
    +class LazyRddIterator(serializer: SerializerInstance,
    +    serializeBytes: Array[Byte],
    +    partition: Partition,
    +    carbonLoadModel: CarbonLoadModel,
    +    context: TaskContext) extends CarbonIterator[Array[AnyRef]] {
    +
    +  val timeStampformatString = CarbonProperties.getInstance().getProperty(CarbonCommonConstants
    +    .CARBON_TIMESTAMP_FORMAT, CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT)
    +  val timeStampFormat = new SimpleDateFormat(timeStampformatString)
    +  val dateFormatString = CarbonProperties.getInstance().getProperty(CarbonCommonConstants
    +    .CARBON_DATE_FORMAT, CarbonCommonConstants.CARBON_DATE_DEFAULT_FORMAT)
    +  val dateFormat = new SimpleDateFormat(dateFormatString)
    +  val delimiterLevel1 = carbonLoadModel.getComplexDelimiterLevel1
    +  val delimiterLevel2 = carbonLoadModel.getComplexDelimiterLevel2
    +  val serializationNullFormat =
    +    carbonLoadModel.getSerializationNullFormat.split(CarbonCommonConstants.COMMA, 2)(1)
    +
    +  var rddIter: Iterator[Row] = null
    +  var uninitialized = true
    +  var closed = false
    +
    +  def hasNext: Boolean = {
    +    if (uninitialized) {
    +      uninitialized = false
    +      rddIter = serializer.deserialize[RDD[Row]](ByteBuffer.wrap(serializeBytes))
    +        .iterator(partition, context)
    +    }
    +    if (closed) {
    +      false
    +    } else {
    +      rddIter.hasNext
    +    }
    +  }
    +
    +  def next: Array[AnyRef] = {
    +    val row = rddIter.next()
    +    val columns = new Array[AnyRef](row.length)
    +    for (i <- 0 until columns.length) {
    --- End diff --
    
    need row.toseq.map, so better to keep it.


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

[GitHub] incubator-carbondata pull request #765: [CARBONDATA-887]lazy rdd iterator fo...

Posted by QiangCai <gi...@git.apache.org>.
Github user QiangCai commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/765#discussion_r110675205
  
    --- Diff: integration/spark-common/src/main/scala/org/apache/carbondata/spark/rdd/NewCarbonDataLoadRDD.scala ---
    @@ -504,3 +500,66 @@ class NewRddIterator(rddIter: Iterator[Row],
       }
     
     }
    +
    +/**
    + * LazyRddIterator invoke rdd.iterator method when invoking hasNext method.
    + * @param serializer
    + * @param serializeBytes
    + * @param partition
    + * @param carbonLoadModel
    + * @param context
    + */
    +class LazyRddIterator(serializer: SerializerInstance,
    +    serializeBytes: Array[Byte],
    +    partition: Partition,
    +    carbonLoadModel: CarbonLoadModel,
    +    context: TaskContext) extends CarbonIterator[Array[AnyRef]] {
    +
    +  val timeStampformatString = CarbonProperties.getInstance().getProperty(CarbonCommonConstants
    +    .CARBON_TIMESTAMP_FORMAT, CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT)
    +  val timeStampFormat = new SimpleDateFormat(timeStampformatString)
    +  val dateFormatString = CarbonProperties.getInstance().getProperty(CarbonCommonConstants
    +    .CARBON_DATE_FORMAT, CarbonCommonConstants.CARBON_DATE_DEFAULT_FORMAT)
    +  val dateFormat = new SimpleDateFormat(dateFormatString)
    +  val delimiterLevel1 = carbonLoadModel.getComplexDelimiterLevel1
    +  val delimiterLevel2 = carbonLoadModel.getComplexDelimiterLevel2
    +  val serializationNullFormat =
    +    carbonLoadModel.getSerializationNullFormat.split(CarbonCommonConstants.COMMA, 2)(1)
    +
    +  var rddIter: Iterator[Row] = null
    +  var uninitialized = true
    +  var closed = false
    +
    +  def hasNext: Boolean = {
    +    if (uninitialized) {
    +      uninitialized = false
    +      rddIter = serializer.deserialize[RDD[Row]](ByteBuffer.wrap(serializeBytes))
    +        .iterator(partition, context)
    +    }
    +    if (closed) {
    +      false
    +    } else {
    +      rddIter.hasNext
    +    }
    +  }
    +
    +  def next: Array[AnyRef] = {
    +    val row = rddIter.next()
    +    val columns = new Array[AnyRef](row.length)
    +    for (i <- 0 until columns.length) {
    +      columns(i) = CarbonScalaUtil.getString(row.get(i), serializationNullFormat,
    +        delimiterLevel1, delimiterLevel2, timeStampFormat, dateFormat)
    +    }
    +    columns
    +  }
    +
    +  override def initialize: Unit = {
    --- End diff --
    
    ok


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

[GitHub] incubator-carbondata issue #765: [CARBONDATA-887]lazy rdd iterator for Inser...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/765
  
    Build Success with Spark 1.6.2, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/1530/



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

[GitHub] incubator-carbondata issue #765: [CARBONDATA-887]lazy rdd iterator for Inser...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/765
  
    Build Success with Spark 1.6.2, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/1513/



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

[GitHub] incubator-carbondata pull request #765: [CARBONDATA-887]lazy rdd iterator fo...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/765#discussion_r110531875
  
    --- Diff: integration/spark-common/src/main/scala/org/apache/carbondata/spark/rdd/NewCarbonDataLoadRDD.scala ---
    @@ -504,3 +500,66 @@ class NewRddIterator(rddIter: Iterator[Row],
       }
     
     }
    +
    +/**
    + * LazyRddIterator invoke rdd.iterator method when invoking hasNext method.
    + * @param serializer
    + * @param serializeBytes
    + * @param partition
    + * @param carbonLoadModel
    + * @param context
    + */
    +class LazyRddIterator(serializer: SerializerInstance,
    +    serializeBytes: Array[Byte],
    +    partition: Partition,
    +    carbonLoadModel: CarbonLoadModel,
    +    context: TaskContext) extends CarbonIterator[Array[AnyRef]] {
    +
    +  val timeStampformatString = CarbonProperties.getInstance().getProperty(CarbonCommonConstants
    +    .CARBON_TIMESTAMP_FORMAT, CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT)
    +  val timeStampFormat = new SimpleDateFormat(timeStampformatString)
    +  val dateFormatString = CarbonProperties.getInstance().getProperty(CarbonCommonConstants
    +    .CARBON_DATE_FORMAT, CarbonCommonConstants.CARBON_DATE_DEFAULT_FORMAT)
    +  val dateFormat = new SimpleDateFormat(dateFormatString)
    +  val delimiterLevel1 = carbonLoadModel.getComplexDelimiterLevel1
    +  val delimiterLevel2 = carbonLoadModel.getComplexDelimiterLevel2
    +  val serializationNullFormat =
    +    carbonLoadModel.getSerializationNullFormat.split(CarbonCommonConstants.COMMA, 2)(1)
    +
    +  var rddIter: Iterator[Row] = null
    +  var uninitialized = true
    +  var closed = false
    +
    +  def hasNext: Boolean = {
    +    if (uninitialized) {
    +      uninitialized = false
    +      rddIter = serializer.deserialize[RDD[Row]](ByteBuffer.wrap(serializeBytes))
    +        .iterator(partition, context)
    +    }
    +    if (closed) {
    +      false
    +    } else {
    +      rddIter.hasNext
    +    }
    +  }
    +
    +  def next: Array[AnyRef] = {
    +    val row = rddIter.next()
    +    val columns = new Array[AnyRef](row.length)
    +    for (i <- 0 until columns.length) {
    +      columns(i) = CarbonScalaUtil.getString(row.get(i), serializationNullFormat,
    +        delimiterLevel1, delimiterLevel2, timeStampFormat, dateFormat)
    +    }
    +    columns
    +  }
    +
    +  override def initialize: Unit = {
    --- End diff --
    
    add empty parentheses, for scala coding convention


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

[GitHub] incubator-carbondata pull request #765: [CARBONDATA-887]lazy rdd iterator fo...

Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/incubator-carbondata/pull/765#discussion_r110531816
  
    --- Diff: integration/spark-common/src/main/scala/org/apache/carbondata/spark/rdd/NewCarbonDataLoadRDD.scala ---
    @@ -504,3 +500,66 @@ class NewRddIterator(rddIter: Iterator[Row],
       }
     
     }
    +
    +/**
    + * LazyRddIterator invoke rdd.iterator method when invoking hasNext method.
    + * @param serializer
    + * @param serializeBytes
    + * @param partition
    + * @param carbonLoadModel
    + * @param context
    + */
    +class LazyRddIterator(serializer: SerializerInstance,
    +    serializeBytes: Array[Byte],
    +    partition: Partition,
    +    carbonLoadModel: CarbonLoadModel,
    +    context: TaskContext) extends CarbonIterator[Array[AnyRef]] {
    +
    +  val timeStampformatString = CarbonProperties.getInstance().getProperty(CarbonCommonConstants
    +    .CARBON_TIMESTAMP_FORMAT, CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT)
    +  val timeStampFormat = new SimpleDateFormat(timeStampformatString)
    +  val dateFormatString = CarbonProperties.getInstance().getProperty(CarbonCommonConstants
    +    .CARBON_DATE_FORMAT, CarbonCommonConstants.CARBON_DATE_DEFAULT_FORMAT)
    +  val dateFormat = new SimpleDateFormat(dateFormatString)
    +  val delimiterLevel1 = carbonLoadModel.getComplexDelimiterLevel1
    +  val delimiterLevel2 = carbonLoadModel.getComplexDelimiterLevel2
    +  val serializationNullFormat =
    +    carbonLoadModel.getSerializationNullFormat.split(CarbonCommonConstants.COMMA, 2)(1)
    +
    +  var rddIter: Iterator[Row] = null
    +  var uninitialized = true
    +  var closed = false
    +
    +  def hasNext: Boolean = {
    +    if (uninitialized) {
    +      uninitialized = false
    +      rddIter = serializer.deserialize[RDD[Row]](ByteBuffer.wrap(serializeBytes))
    +        .iterator(partition, context)
    +    }
    +    if (closed) {
    +      false
    +    } else {
    +      rddIter.hasNext
    +    }
    +  }
    +
    +  def next: Array[AnyRef] = {
    +    val row = rddIter.next()
    +    val columns = new Array[AnyRef](row.length)
    +    for (i <- 0 until columns.length) {
    --- End diff --
    
    use `row.map` to replace this for statement


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

[GitHub] incubator-carbondata issue #765: [CARBONDATA-887]lazy rdd iterator for Inser...

Posted by QiangCai <gi...@git.apache.org>.
Github user QiangCai commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/765
  
    retest this please


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

[GitHub] incubator-carbondata issue #765: [CARBONDATA-887]lazy rdd iterator for Inser...

Posted by QiangCai <gi...@git.apache.org>.
Github user QiangCai commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/765
  
    @jackylk  please review again


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

[GitHub] incubator-carbondata issue #765: [CARBONDATA-887]lazy rdd iterator for Inser...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/765
  
    Build Success with Spark 1.6.2, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/1548/



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

[GitHub] incubator-carbondata issue #765: [CARBONDATA-887]lazy rdd iterator for Inser...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/765
  
    Build Success with Spark 1.6.2, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/1559/



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

[GitHub] incubator-carbondata issue #765: [CARBONDATA-887]lazy rdd iterator for Inser...

Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/incubator-carbondata/pull/765
  
    Build Failed  with Spark 1.6.2, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/1554/



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