Repository: carbondata
Updated Branches:
refs/heads/master 4554d191b -> 382ce430a
[CARBONDATA-3119] Fixing the getOrCreateCarbonSession method parameter to an
empty string
Fixing the getOrCreateCarbonSession method parameter to an empty string causes
the select table data to be empty
problem: When create carbonSession in this way: [val carbon =
SparkSession.builder().config(sc.getConf).getOrCreateCarbonSession("")],The
prompt can be created successfully, with no exceptions thrown during the
process, but ultimately [carbon.sql("SELECT * FROM TABLE").show()] is empty.
cause: [carbon.sql("SELECT * FROM TABLE").show()] is empty.
solution: Increases the null or empty judgment of getOrCreateCarbonSession
method parameters[storePath,metaStorePath]
This closes #2961
Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/382ce430
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/382ce430
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/382ce430
Branch: refs/heads/master
Commit: 382ce430a18ca3d7d0b444777c66591e2c2e705f
Parents: 4554d19
Author: zygitup <[email protected]>
Authored: Wed Nov 28 20:38:56 2018 +0800
Committer: Zhang Zhichao <[email protected]>
Committed: Fri Nov 30 23:03:00 2018 +0800
----------------------------------------------------------------------
.../src/main/scala/org/apache/spark/sql/CarbonSession.scala | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/carbondata/blob/382ce430/integration/spark2/src/main/scala/org/apache/spark/sql/CarbonSession.scala
----------------------------------------------------------------------
diff --git
a/integration/spark2/src/main/scala/org/apache/spark/sql/CarbonSession.scala
b/integration/spark2/src/main/scala/org/apache/spark/sql/CarbonSession.scala
index 8e40bf7..af7f3f6 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/CarbonSession.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/CarbonSession.scala
@@ -21,6 +21,7 @@ import java.util.concurrent.atomic.AtomicLong
import scala.collection.JavaConverters._
+import org.apache.commons.lang.StringUtils
import org.apache.hadoop.conf.Configuration
import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.sql.SparkSession.Builder
@@ -180,7 +181,7 @@ object CarbonSession {
val userSuppliedContext: Option[SparkContext] =
getValue("userSuppliedContext",
builder).asInstanceOf[Option[SparkContext]]
- if (metaStorePath != null) {
+ if (StringUtils.isNotBlank(metaStorePath)) {
val hadoopConf = new Configuration()
val configFile =
Utils.getContextOrSparkClassLoader.getResource("hive-site.xml")
if (configFile != null) {
@@ -248,7 +249,7 @@ object CarbonSession {
session = new CarbonSession(sparkContext, None, !enableInMemCatlog)
val carbonProperties = CarbonProperties.getInstance()
- if (storePath != null) {
+ if (StringUtils.isNotBlank(storePath)) {
carbonProperties.addProperty(CarbonCommonConstants.STORE_LOCATION,
storePath)
// In case if it is in carbon.properties for backward compatible
} else if
(carbonProperties.getProperty(CarbonCommonConstants.STORE_LOCATION) == null) {