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. ---- --- |
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/ --- |
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 --- |
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/ --- |
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/ --- |
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 --- |
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/ --- |
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/ --- |
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/ --- |
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 --- |
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 --- |
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? --- |
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 --- |
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 --- |
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 --- |
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 --- |
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 --- |
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 --- |
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/ --- |
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/ --- |
Free forum by Nabble | Edit this page |