You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by aj...@apache.org on 2020/08/06 07:41:12 UTC

[carbondata] branch master updated: [CARBONDATA-3930] Fix DataLoadingException of MVExample

This is an automated email from the ASF dual-hosted git repository.

ajantha pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/carbondata.git


The following commit(s) were added to refs/heads/master by this push:
     new 229a77e  [CARBONDATA-3930] Fix DataLoadingException of MVExample
229a77e is described below

commit 229a77e628b816248374bd11cfa1777152468626
Author: QiangCai <qi...@qq.com>
AuthorDate: Wed Jul 29 10:07:57 2020 +0800

    [CARBONDATA-3930] Fix DataLoadingException of MVExample
    
    Why is this PR needed?
    MVExample is throwing DataLoadingException because the path of the input file is wrong.
    
    What changes were proposed in this PR?
    Correct the path of the input file
    Remove unused CarbonMVRules
    Both CarbonExtensions and CarbonSession use MVRewriteRule
    
    Does this PR introduce any user interface change?
    No
    
    Is any new testcase added?
    No
    
    This closes #3870
---
 .../org/apache/carbondata/examples/MVExample.scala |  6 +--
 .../org/apache/spark/sql/hive/CarbonAnalyzer.scala |  2 +-
 .../org/apache/spark/sql/hive/CarbonMVRules.scala  | 47 ----------------------
 .../apache/spark/sql/CarbonToSparkAdapter.scala    |  2 +-
 .../apache/spark/sql/CarbonToSparkAdapter.scala    |  2 +-
 5 files changed, 5 insertions(+), 54 deletions(-)

diff --git a/examples/spark/src/main/scala/org/apache/carbondata/examples/MVExample.scala b/examples/spark/src/main/scala/org/apache/carbondata/examples/MVExample.scala
index d5949ed..91c521f 100644
--- a/examples/spark/src/main/scala/org/apache/carbondata/examples/MVExample.scala
+++ b/examples/spark/src/main/scala/org/apache/carbondata/examples/MVExample.scala
@@ -20,10 +20,8 @@ package org.apache.carbondata.examples
 import java.io.File
 import java.util.Random
 
-import org.apache.spark.sql.{CarbonEnv, SparkSession}
+import org.apache.spark.sql.SparkSession
 
-import org.apache.carbondata.core.constants.CarbonCommonConstants
-import org.apache.carbondata.core.util.CarbonProperties
 import org.apache.carbondata.examples.util.ExampleUtils
 
 /**
@@ -42,7 +40,7 @@ object MVExample {
   def exampleBody(spark: SparkSession): Unit = {
     val rootPath = new File(this.getClass.getResource("/").getPath
                             + "../../../..").getCanonicalPath
-    val testData = s"$rootPath/integration/spark-common-test/src/test/resources/sample.csv"
+    val testData = s"$rootPath/integration/spark/src/test/resources/sample.csv"
 
     spark.sql("DROP TABLE IF EXISTS mainTable")
     spark.sql("DROP TABLE IF EXISTS dimtable")
diff --git a/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonAnalyzer.scala b/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonAnalyzer.scala
index 7daeefa..bfa2e98 100644
--- a/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonAnalyzer.scala
+++ b/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonAnalyzer.scala
@@ -32,7 +32,7 @@ class CarbonAnalyzer(catalog: SessionCatalog,
 
   val mvPlan = try {
     CarbonReflectionUtils.createObject(
-      "org.apache.carbondata.mv.extension.MVAnalyzerRule",
+      "org.apache.spark.sql.optimizer.MVRewriteRule",
       sparkSession)._1.asInstanceOf[Rule[LogicalPlan]]
   } catch {
     case e: Exception =>
diff --git a/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonMVRules.scala b/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonMVRules.scala
deleted file mode 100644
index bea09bb..0000000
--- a/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonMVRules.scala
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.spark.sql.hive
-
-import org.apache.spark.sql.SparkSession
-import org.apache.spark.sql.catalyst.plans.logical.{Command, LogicalPlan}
-import org.apache.spark.sql.catalyst.rules.Rule
-import org.apache.spark.util.CarbonReflectionUtils
-
-case class CarbonMVRules(sparkSession: SparkSession) extends Rule[LogicalPlan] {
-
-  val mvPlan = try {
-    CarbonReflectionUtils.createObject(
-      "org.apache.carbondata.mv.extension.MVAnalyzerRule",
-      sparkSession)._1.asInstanceOf[Rule[LogicalPlan]]
-  } catch {
-    case e: Exception =>
-      null
-  }
-
-  override def apply(plan: LogicalPlan): LogicalPlan = {
-    plan match {
-      case _: Command => plan
-      case _ =>
-        if (mvPlan != null) {
-          mvPlan.apply(plan)
-        } else {
-          plan
-        }
-    }
-  }
-}
diff --git a/integration/spark/src/main/spark2.3/org/apache/spark/sql/CarbonToSparkAdapter.scala b/integration/spark/src/main/spark2.3/org/apache/spark/sql/CarbonToSparkAdapter.scala
index 79318fa..1215525 100644
--- a/integration/spark/src/main/spark2.3/org/apache/spark/sql/CarbonToSparkAdapter.scala
+++ b/integration/spark/src/main/spark2.3/org/apache/spark/sql/CarbonToSparkAdapter.scala
@@ -30,7 +30,7 @@ import org.apache.spark.sql.catalyst.optimizer.Optimizer
 import org.apache.spark.sql.catalyst.plans.logical.{LogicalPlan, OneRowRelation, SubqueryAlias}
 import org.apache.spark.sql.catalyst.rules.Rule
 import org.apache.spark.sql.execution.command.ExplainCommand
-import org.apache.spark.sql.hive.{CarbonMVRules, HiveExternalCatalog}
+import org.apache.spark.sql.hive.HiveExternalCatalog
 import org.apache.spark.sql.optimizer.{CarbonIUDRule, CarbonUDFTransformRule, MVRewriteRule}
 import org.apache.spark.sql.secondaryindex.optimizer.CarbonSITransformationRule
 import org.apache.spark.sql.types.{DataType, Metadata}
diff --git a/integration/spark/src/main/spark2.4/org/apache/spark/sql/CarbonToSparkAdapter.scala b/integration/spark/src/main/spark2.4/org/apache/spark/sql/CarbonToSparkAdapter.scala
index 04fec41..ec1b976 100644
--- a/integration/spark/src/main/spark2.4/org/apache/spark/sql/CarbonToSparkAdapter.scala
+++ b/integration/spark/src/main/spark2.4/org/apache/spark/sql/CarbonToSparkAdapter.scala
@@ -30,7 +30,7 @@ import org.apache.spark.sql.catalyst.optimizer.Optimizer
 import org.apache.spark.sql.catalyst.plans.logical.{LogicalPlan, OneRowRelation, SubqueryAlias}
 import org.apache.spark.sql.catalyst.rules.Rule
 import org.apache.spark.sql.execution.command.ExplainCommand
-import org.apache.spark.sql.hive.{CarbonMVRules, HiveExternalCatalog}
+import org.apache.spark.sql.hive.HiveExternalCatalog
 import org.apache.spark.sql.optimizer.{CarbonIUDRule, CarbonUDFTransformRule, MVRewriteRule}
 import org.apache.spark.sql.secondaryindex.optimizer.CarbonSITransformationRule
 import org.apache.spark.sql.types.{DataType, Metadata}