You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by ravipesala <gi...@git.apache.org> on 2018/07/30 09:31:58 UTC

[GitHub] carbondata pull request #2579: [HOTFIX][PR 2575] Fixed modular plan creation...

GitHub user ravipesala opened a pull request:

    https://github.com/apache/carbondata/pull/2579

    [HOTFIX][PR 2575]  Fixed modular plan creation only if valid datamaps are available

    update query is failing in spark-2.2 cluster if mv jars are available because catalogs are not empty if datamap are created for other table also and returns true from isValidPlan() inside MVAnalyzerRule.
    
    Be sure to do all of the following checklist to help us incorporate 
    your contribution quickly and easily:
    
     - [ ] Any interfaces changed?
     
     - [ ] Any backward compatibility impacted?
     
     - [ ] Document update required?
    
     - [ ] Testing done
            Please provide details on 
            - Whether new unit test cases have been added or why no new tests are required?
            - How it is tested? Please attach test report.
            - Is it a performance related change? Please attach the performance test report.
            - Any additional information to help reviewers in testing this change.
           
     - [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA. 
    


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

    $ git pull https://github.com/ravipesala/incubator-carbondata pr-2575

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

    https://github.com/apache/carbondata/pull/2579.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 #2579
    
----
commit ff3244dbb603b0e822334c2fdf5a955ee0144949
Author: rahul <ra...@...>
Date:   2018-07-30T06:31:49Z

    fixing MadularPlan Exception

commit 6d1dee32071cc9d4d7033a013f308ec4a6c5d4c8
Author: ravipesala <ra...@...>
Date:   2018-07-30T09:30:00Z

    Fixed modular plan creation only if valid datamaps are available.

----


---

[GitHub] carbondata issue #2579: [HOTFIX][PR 2575] Fixed modular plan creation only i...

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

    https://github.com/apache/carbondata/pull/2579
  
    Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/6357/



---

[GitHub] carbondata issue #2579: [HOTFIX][PR 2575] Fixed modular plan creation only i...

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

    https://github.com/apache/carbondata/pull/2579
  
    Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/6377/



---

[GitHub] carbondata issue #2579: [HOTFIX][PR 2575] Fixed modular plan creation only i...

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

    https://github.com/apache/carbondata/pull/2579
  
    retest this please


---

[GitHub] carbondata pull request #2579: [HOTFIX][PR 2575] Fixed modular plan creation...

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

    https://github.com/apache/carbondata/pull/2579#discussion_r206912038
  
    --- Diff: datamap/mv/core/src/main/scala/org/apache/carbondata/mv/datamap/MVAnalyzerRule.scala ---
    @@ -80,26 +83,54 @@ class MVAnalyzerRule(sparkSession: SparkSession) extends Rule[LogicalPlan] {
       }
     
       def isValidPlan(plan: LogicalPlan, catalog: SummaryDatasetCatalog): Boolean = {
    -    !plan.isInstanceOf[Command] && !isDataMapExists(plan, catalog.listAllSchema()) &&
    -    !plan.isInstanceOf[DeserializeToObject]
    +    if (!plan.isInstanceOf[Command]  && !plan.isInstanceOf[DeserializeToObject]) {
    +      val catalogs = extractCatalogs(plan)
    +      !isDataMapReplaced(catalog.listAllValidSchema(), catalogs) &&
    +      isDataMapExists(catalog.listAllValidSchema(), catalogs)
    +    } else {
    +      false
    +    }
    +
       }
       /**
        * Check whether datamap table already updated in the query.
        *
    -   * @param plan
        * @param mvs
    --- End diff --
    
    ok


---

[GitHub] carbondata issue #2579: [HOTFIX][PR 2575] Fixed modular plan creation only i...

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

    https://github.com/apache/carbondata/pull/2579
  
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/7610/



---

[GitHub] carbondata issue #2579: [HOTFIX][PR 2575] Fixed modular plan creation only i...

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

    https://github.com/apache/carbondata/pull/2579
  
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/7653/



---

[GitHub] carbondata issue #2579: [HOTFIX][PR 2575] Fixed modular plan creation only i...

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

    https://github.com/apache/carbondata/pull/2579
  
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/7711/



---

[GitHub] carbondata issue #2579: [HOTFIX][PR 2575] Fixed modular plan creation only i...

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

    https://github.com/apache/carbondata/pull/2579
  
    retest sdv please



---

[GitHub] carbondata pull request #2579: [HOTFIX][PR 2575] Fixed modular plan creation...

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

    https://github.com/apache/carbondata/pull/2579#discussion_r206914703
  
    --- Diff: datamap/mv/core/src/main/scala/org/apache/carbondata/mv/datamap/MVAnalyzerRule.scala ---
    @@ -80,26 +83,54 @@ class MVAnalyzerRule(sparkSession: SparkSession) extends Rule[LogicalPlan] {
       }
     
       def isValidPlan(plan: LogicalPlan, catalog: SummaryDatasetCatalog): Boolean = {
    --- End diff --
    
    ok


---

[GitHub] carbondata issue #2579: [HOTFIX][PR 2575] Fixed modular plan creation only i...

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

    https://github.com/apache/carbondata/pull/2579
  
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/7631/



---

[GitHub] carbondata pull request #2579: [HOTFIX][PR 2575] Fixed modular plan creation...

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

    https://github.com/apache/carbondata/pull/2579#discussion_r206914734
  
    --- Diff: datamap/mv/core/src/main/scala/org/apache/carbondata/mv/datamap/MVAnalyzerRule.scala ---
    @@ -80,26 +83,54 @@ class MVAnalyzerRule(sparkSession: SparkSession) extends Rule[LogicalPlan] {
       }
     
       def isValidPlan(plan: LogicalPlan, catalog: SummaryDatasetCatalog): Boolean = {
    -    !plan.isInstanceOf[Command] && !isDataMapExists(plan, catalog.listAllSchema()) &&
    -    !plan.isInstanceOf[DeserializeToObject]
    +    if (!plan.isInstanceOf[Command]  && !plan.isInstanceOf[DeserializeToObject]) {
    +      val catalogs = extractCatalogs(plan)
    +      !isDataMapReplaced(catalog.listAllValidSchema(), catalogs) &&
    +      isDataMapExists(catalog.listAllValidSchema(), catalogs)
    +    } else {
    +      false
    +    }
    +
       }
       /**
        * Check whether datamap table already updated in the query.
        *
    -   * @param plan
        * @param mvs
        * @return
        */
    -  def isDataMapExists(plan: LogicalPlan, mvs: Array[SummaryDataset]): Boolean = {
    -    val catalogs = plan collect {
    -      case l: LogicalRelation => l.catalogTable
    -    }
    -    catalogs.isEmpty || catalogs.exists { c =>
    +  def isDataMapReplaced(
    +      mvs: Array[SummaryDataset],
    +      catalogs: Seq[Option[CatalogTable]]): Boolean = {
    +    catalogs.exists { c =>
           mvs.exists { mv =>
             val identifier = mv.dataMapSchema.getRelationIdentifier
             identifier.getTableName.equals(c.get.identifier.table) &&
             identifier.getDatabaseName.equals(c.get.database)
           }
         }
       }
    +
    +  /**
    +   * Check whether any suitable datamaps exists for this plan.
    +   *
    +   * @param mvs
    +   * @return
    +   */
    +  def isDataMapExists(mvs: Array[SummaryDataset], catalogs: Seq[Option[CatalogTable]]): Boolean = {
    +    catalogs.exists { c =>
    +      mvs.exists { mv =>
    +        mv.dataMapSchema.getParentTables.asScala.exists { identifier =>
    +          identifier.getTableName.equals(c.get.identifier.table) &&
    +          identifier.getDatabaseName.equals(c.get.database)
    +        }
    +      }
    +    }
    +  }
    +
    +  private def extractCatalogs(plan: LogicalPlan) = {
    --- End diff --
    
    ok


---

[GitHub] carbondata pull request #2579: [HOTFIX][PR 2575] Fixed modular plan creation...

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

    https://github.com/apache/carbondata/pull/2579#discussion_r206905056
  
    --- Diff: datamap/mv/core/src/main/scala/org/apache/carbondata/mv/datamap/MVAnalyzerRule.scala ---
    @@ -80,26 +83,54 @@ class MVAnalyzerRule(sparkSession: SparkSession) extends Rule[LogicalPlan] {
       }
     
       def isValidPlan(plan: LogicalPlan, catalog: SummaryDatasetCatalog): Boolean = {
    --- End diff --
    
    can you add comment to this func


---

[GitHub] carbondata issue #2579: [HOTFIX][PR 2575] Fixed modular plan creation only i...

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

    https://github.com/apache/carbondata/pull/2579
  
    LGTM


---

[GitHub] carbondata pull request #2579: [HOTFIX][PR 2575] Fixed modular plan creation...

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

    https://github.com/apache/carbondata/pull/2579


---

[GitHub] carbondata issue #2579: [HOTFIX][PR 2575] Fixed modular plan creation only i...

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

    https://github.com/apache/carbondata/pull/2579
  
    SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/6104/



---

[GitHub] carbondata pull request #2579: [HOTFIX][PR 2575] Fixed modular plan creation...

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

    https://github.com/apache/carbondata/pull/2579#discussion_r206904688
  
    --- Diff: datamap/mv/core/src/main/scala/org/apache/carbondata/mv/datamap/MVAnalyzerRule.scala ---
    @@ -80,26 +83,54 @@ class MVAnalyzerRule(sparkSession: SparkSession) extends Rule[LogicalPlan] {
       }
     
       def isValidPlan(plan: LogicalPlan, catalog: SummaryDatasetCatalog): Boolean = {
    -    !plan.isInstanceOf[Command] && !isDataMapExists(plan, catalog.listAllSchema()) &&
    -    !plan.isInstanceOf[DeserializeToObject]
    +    if (!plan.isInstanceOf[Command]  && !plan.isInstanceOf[DeserializeToObject]) {
    +      val catalogs = extractCatalogs(plan)
    +      !isDataMapReplaced(catalog.listAllValidSchema(), catalogs) &&
    +      isDataMapExists(catalog.listAllValidSchema(), catalogs)
    +    } else {
    +      false
    +    }
    +
       }
       /**
        * Check whether datamap table already updated in the query.
        *
    -   * @param plan
        * @param mvs
        * @return
        */
    -  def isDataMapExists(plan: LogicalPlan, mvs: Array[SummaryDataset]): Boolean = {
    -    val catalogs = plan collect {
    -      case l: LogicalRelation => l.catalogTable
    -    }
    -    catalogs.isEmpty || catalogs.exists { c =>
    +  def isDataMapReplaced(
    +      mvs: Array[SummaryDataset],
    +      catalogs: Seq[Option[CatalogTable]]): Boolean = {
    +    catalogs.exists { c =>
           mvs.exists { mv =>
             val identifier = mv.dataMapSchema.getRelationIdentifier
             identifier.getTableName.equals(c.get.identifier.table) &&
             identifier.getDatabaseName.equals(c.get.database)
           }
         }
       }
    +
    +  /**
    +   * Check whether any suitable datamaps exists for this plan.
    +   *
    +   * @param mvs
    +   * @return
    +   */
    +  def isDataMapExists(mvs: Array[SummaryDataset], catalogs: Seq[Option[CatalogTable]]): Boolean = {
    +    catalogs.exists { c =>
    +      mvs.exists { mv =>
    +        mv.dataMapSchema.getParentTables.asScala.exists { identifier =>
    +          identifier.getTableName.equals(c.get.identifier.table) &&
    +          identifier.getDatabaseName.equals(c.get.database)
    +        }
    +      }
    +    }
    +  }
    +
    +  private def extractCatalogs(plan: LogicalPlan) = {
    --- End diff --
    
    please add return value type


---

[GitHub] carbondata issue #2579: [HOTFIX][PR 2575] Fixed modular plan creation only i...

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

    https://github.com/apache/carbondata/pull/2579
  
    Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/6391/



---

[GitHub] carbondata pull request #2579: [HOTFIX][PR 2575] Fixed modular plan creation...

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

    https://github.com/apache/carbondata/pull/2579#discussion_r206903988
  
    --- Diff: datamap/mv/core/src/main/scala/org/apache/carbondata/mv/datamap/MVAnalyzerRule.scala ---
    @@ -80,26 +83,54 @@ class MVAnalyzerRule(sparkSession: SparkSession) extends Rule[LogicalPlan] {
       }
     
       def isValidPlan(plan: LogicalPlan, catalog: SummaryDatasetCatalog): Boolean = {
    -    !plan.isInstanceOf[Command] && !isDataMapExists(plan, catalog.listAllSchema()) &&
    -    !plan.isInstanceOf[DeserializeToObject]
    +    if (!plan.isInstanceOf[Command]  && !plan.isInstanceOf[DeserializeToObject]) {
    +      val catalogs = extractCatalogs(plan)
    +      !isDataMapReplaced(catalog.listAllValidSchema(), catalogs) &&
    +      isDataMapExists(catalog.listAllValidSchema(), catalogs)
    +    } else {
    +      false
    +    }
    +
       }
       /**
        * Check whether datamap table already updated in the query.
        *
    -   * @param plan
        * @param mvs
        * @return
        */
    -  def isDataMapExists(plan: LogicalPlan, mvs: Array[SummaryDataset]): Boolean = {
    -    val catalogs = plan collect {
    -      case l: LogicalRelation => l.catalogTable
    -    }
    -    catalogs.isEmpty || catalogs.exists { c =>
    +  def isDataMapReplaced(
    +      mvs: Array[SummaryDataset],
    +      catalogs: Seq[Option[CatalogTable]]): Boolean = {
    +    catalogs.exists { c =>
           mvs.exists { mv =>
             val identifier = mv.dataMapSchema.getRelationIdentifier
             identifier.getTableName.equals(c.get.identifier.table) &&
             identifier.getDatabaseName.equals(c.get.database)
           }
         }
       }
    +
    +  /**
    +   * Check whether any suitable datamaps exists for this plan.
    --- End diff --
    
    suitable means matched plan?


---

[GitHub] carbondata pull request #2579: [HOTFIX][PR 2575] Fixed modular plan creation...

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

    https://github.com/apache/carbondata/pull/2579#discussion_r206913481
  
    --- Diff: datamap/mv/core/src/main/scala/org/apache/carbondata/mv/datamap/MVAnalyzerRule.scala ---
    @@ -80,26 +83,54 @@ class MVAnalyzerRule(sparkSession: SparkSession) extends Rule[LogicalPlan] {
       }
     
       def isValidPlan(plan: LogicalPlan, catalog: SummaryDatasetCatalog): Boolean = {
    -    !plan.isInstanceOf[Command] && !isDataMapExists(plan, catalog.listAllSchema()) &&
    -    !plan.isInstanceOf[DeserializeToObject]
    +    if (!plan.isInstanceOf[Command]  && !plan.isInstanceOf[DeserializeToObject]) {
    +      val catalogs = extractCatalogs(plan)
    +      !isDataMapReplaced(catalog.listAllValidSchema(), catalogs) &&
    +      isDataMapExists(catalog.listAllValidSchema(), catalogs)
    +    } else {
    +      false
    +    }
    +
       }
       /**
        * Check whether datamap table already updated in the query.
        *
    -   * @param plan
        * @param mvs
        * @return
        */
    -  def isDataMapExists(plan: LogicalPlan, mvs: Array[SummaryDataset]): Boolean = {
    -    val catalogs = plan collect {
    -      case l: LogicalRelation => l.catalogTable
    -    }
    -    catalogs.isEmpty || catalogs.exists { c =>
    +  def isDataMapReplaced(
    +      mvs: Array[SummaryDataset],
    +      catalogs: Seq[Option[CatalogTable]]): Boolean = {
    +    catalogs.exists { c =>
           mvs.exists { mv =>
             val identifier = mv.dataMapSchema.getRelationIdentifier
             identifier.getTableName.equals(c.get.identifier.table) &&
             identifier.getDatabaseName.equals(c.get.database)
           }
         }
       }
    +
    +  /**
    +   * Check whether any suitable datamaps exists for this plan.
    --- End diff --
    
    yes, initial match of parent table. Updated the comment


---

[GitHub] carbondata pull request #2579: [HOTFIX][PR 2575] Fixed modular plan creation...

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

    https://github.com/apache/carbondata/pull/2579#discussion_r206903577
  
    --- Diff: datamap/mv/core/src/main/scala/org/apache/carbondata/mv/datamap/MVAnalyzerRule.scala ---
    @@ -80,26 +83,54 @@ class MVAnalyzerRule(sparkSession: SparkSession) extends Rule[LogicalPlan] {
       }
     
       def isValidPlan(plan: LogicalPlan, catalog: SummaryDatasetCatalog): Boolean = {
    -    !plan.isInstanceOf[Command] && !isDataMapExists(plan, catalog.listAllSchema()) &&
    -    !plan.isInstanceOf[DeserializeToObject]
    +    if (!plan.isInstanceOf[Command]  && !plan.isInstanceOf[DeserializeToObject]) {
    +      val catalogs = extractCatalogs(plan)
    +      !isDataMapReplaced(catalog.listAllValidSchema(), catalogs) &&
    +      isDataMapExists(catalog.listAllValidSchema(), catalogs)
    +    } else {
    +      false
    +    }
    +
       }
       /**
        * Check whether datamap table already updated in the query.
        *
    -   * @param plan
        * @param mvs
    --- End diff --
    
    can you provide the comment for parameter and return value


---

[GitHub] carbondata issue #2579: [HOTFIX][PR 2575] Fixed modular plan creation only i...

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

    https://github.com/apache/carbondata/pull/2579
  
    retest this please


---

[GitHub] carbondata issue #2579: [HOTFIX][PR 2575] Fixed modular plan creation only i...

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

    https://github.com/apache/carbondata/pull/2579
  
    Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/6437/



---