carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manishgupt...@apache.org
Subject [02/50] [abbrv] carbondata git commit: [HOTFIX][Search] Carbon should throw exception for TEXT_MATCH UDF
Date Thu, 17 May 2018 14:30:15 GMT
[HOTFIX][Search] Carbon should throw exception for TEXT_MATCH UDF

This closes #2242


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/325eac2b
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/325eac2b
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/325eac2b

Branch: refs/heads/spark-2.3
Commit: 325eac2b4acfc461533f806ac62572097a567276
Parents: 74ea24d
Author: Jacky Li <jacky.likun@qq.com>
Authored: Fri Apr 27 21:42:33 2018 +0800
Committer: QiangCai <qiangcai@qq.com>
Committed: Tue May 8 19:23:18 2018 +0800

----------------------------------------------------------------------
 .../executer/RowLevelFilterExecuterImpl.java      |  8 +++++++-
 .../lucene/LuceneFineGrainDataMapSuite.scala      | 18 ++++++++++++++++++
 .../carbondata/spark/rdd/CarbonScanRDD.scala      |  2 +-
 3 files changed, 26 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/325eac2b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelFilterExecuterImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelFilterExecuterImpl.java
b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelFilterExecuterImpl.java
index 7e92aef..4bee89b 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelFilterExecuterImpl.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RowLevelFilterExecuterImpl.java
@@ -193,7 +193,13 @@ public class RowLevelFilterExecuterImpl implements FilterExecuter {
   public BitSetGroup applyFilter(RawBlockletColumnChunks rawBlockletColumnChunks,
       boolean useBitsetPipeLine) throws FilterUnsupportedException, IOException {
     if (exp instanceof MatchExpression) {
-      return rawBlockletColumnChunks.getBitSetGroup();
+      BitSetGroup bitSetGroup = rawBlockletColumnChunks.getBitSetGroup();
+      if (bitSetGroup == null) {
+        // It means there are no datamap created on this table
+        throw new FilterUnsupportedException(String.format("%s is not supported on table
%s",
+            exp.getFilterExpressionType().name(), tableIdentifier.getTableName()));
+      }
+      return bitSetGroup;
     }
     readColumnChunks(rawBlockletColumnChunks);
     // CHECKSTYLE:ON

http://git-wip-us.apache.org/repos/asf/carbondata/blob/325eac2b/integration/spark-common-test/src/test/scala/org/apache/carbondata/datamap/lucene/LuceneFineGrainDataMapSuite.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common-test/src/test/scala/org/apache/carbondata/datamap/lucene/LuceneFineGrainDataMapSuite.scala
b/integration/spark-common-test/src/test/scala/org/apache/carbondata/datamap/lucene/LuceneFineGrainDataMapSuite.scala
index b0a59d4..406ee41 100644
--- a/integration/spark-common-test/src/test/scala/org/apache/carbondata/datamap/lucene/LuceneFineGrainDataMapSuite.scala
+++ b/integration/spark-common-test/src/test/scala/org/apache/carbondata/datamap/lucene/LuceneFineGrainDataMapSuite.scala
@@ -21,6 +21,7 @@ import java.io.{File, PrintWriter}
 
 import scala.util.Random
 
+import org.apache.spark.SparkException
 import org.apache.spark.sql.{CarbonEnv, Row}
 import org.apache.spark.sql.test.util.QueryTest
 import org.scalatest.BeforeAndAfterAll
@@ -29,6 +30,7 @@ import org.apache.carbondata.common.exceptions.sql.{MalformedCarbonCommandExcept
 import org.apache.carbondata.core.constants.CarbonCommonConstants
 import org.apache.carbondata.core.util.CarbonProperties
 import org.apache.carbondata.core.datamap.DataMapStoreManager
+import org.apache.carbondata.core.scan.expression.exception.FilterUnsupportedException
 
 class LuceneFineGrainDataMapSuite extends QueryTest with BeforeAndAfterAll {
 
@@ -699,6 +701,22 @@ class LuceneFineGrainDataMapSuite extends QueryTest with BeforeAndAfterAll
{
 
   }
 
+  test("test text_match on normal table") {
+    sql("DROP TABLE IF EXISTS table1")
+    sql(
+      """
+        | CREATE TABLE table1(id INT, name STRING, city STRING, age INT)
+        | STORED BY 'org.apache.carbondata.format'
+        | TBLPROPERTIES('SORT_COLUMNS'='city,name')
+      """.stripMargin)
+    sql(s"LOAD DATA LOCAL INPATH '$file2' INTO TABLE table1 OPTIONS('header'='false')")
+    val msg = intercept[SparkException] {
+      sql("select * from table1 where TEXT_MATCH('name:n*')").show()
+    }
+    assert(msg.getCause.getMessage.contains("TEXT_MATCH is not supported on table"))
+    sql("DROP TABLE table1")
+  }
+
   override protected def afterAll(): Unit = {
     LuceneFineGrainDataMapSuite.deleteFile(file2)
     sql("DROP TABLE IF EXISTS normal_test")

http://git-wip-us.apache.org/repos/asf/carbondata/blob/325eac2b/integration/spark-common/src/main/scala/org/apache/carbondata/spark/rdd/CarbonScanRDD.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common/src/main/scala/org/apache/carbondata/spark/rdd/CarbonScanRDD.scala
b/integration/spark-common/src/main/scala/org/apache/carbondata/spark/rdd/CarbonScanRDD.scala
index 24a6927..b9a3371 100644
--- a/integration/spark-common/src/main/scala/org/apache/carbondata/spark/rdd/CarbonScanRDD.scala
+++ b/integration/spark-common/src/main/scala/org/apache/carbondata/spark/rdd/CarbonScanRDD.scala
@@ -452,7 +452,7 @@ class CarbonScanRDD[T: ClassTag](
             reader.close()
           } catch {
             case e: Exception =>
-              LOGGER.error(e)
+              LogServiceFactory.getLogService(this.getClass.getCanonicalName).error(e)
           }
           reader = null
         }


Mime
View raw message