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

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
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 <rahul.kumar@...>
Date:   2018-07-30T06:31:49Z

    fixing MadularPlan Exception

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

    Fixed modular plan creation only if valid datamaps are available.

----


---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
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/



---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:

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


---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
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/



---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
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/



---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:

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


---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
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/



---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
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/



---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
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/



---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user brijoobopanna commented on the issue:

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



---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
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


---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
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?


---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
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


---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
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


---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
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


---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
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


---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
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


---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
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


---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
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/



---
Reply | Threaded
Open this post in threaded view
|

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

qiuchenjian-2
In reply to this post by qiuchenjian-2
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/



---
12