New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CARBONDATA-3119] Fixing the getOrCreateCarbonSession method parameter to an empty string #2961
Conversation
…ng causes the select table data to be empty
Can one of the admins verify this patch? |
@@ -248,7 +248,7 @@ object CarbonSession { | |||
|
|||
session = new CarbonSession(sparkContext, None, !enableInMemCatlog) | |||
val carbonProperties = CarbonProperties.getInstance() | |||
if (storePath != null) { | |||
if (storePath != null && !storePath.trim.isEmpty) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use StringUtils or other String tools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which method? Can you give details? @qiuchenjian
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
such as StringUtils.isNotEmpty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StringUtils.isNotEmpty shouldn't support " "
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use StringUtils.isNotBlank.
add to whitelist |
the pr title is not correct, the format should be : [JIRA NUMBER] PR description |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1574/ |
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1786/ |
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9833/ |
Please optimize the title, for example: [CARBONDATA-3119]Fix the error of getOrCreateCarbonSession method parameter is an empty string |
@@ -180,7 +180,7 @@ object CarbonSession { | |||
val userSuppliedContext: Option[SparkContext] = | |||
getValue("userSuppliedContext", builder).asInstanceOf[Option[SparkContext]] | |||
|
|||
if (metaStorePath != null) { | |||
if (metaStorePath != null && !metaStorePath.trim.isEmpty) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some test case to test it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use StringUtils.isNotBlank.
@@ -248,7 +248,7 @@ object CarbonSession { | |||
|
|||
session = new CarbonSession(sparkContext, None, !enableInMemCatlog) | |||
val carbonProperties = CarbonProperties.getInstance() | |||
if (storePath != null) { | |||
if (storePath != null && !storePath.trim.isEmpty) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some test case to test it?
+1 for @zzcclp 's comments |
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]
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1595/ |
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9855/ |
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1807/ |
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]
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1601/ |
@@ -180,7 +183,7 @@ object CarbonSession { | |||
val userSuppliedContext: Option[SparkContext] = | |||
getValue("userSuppliedContext", builder).asInstanceOf[Option[SparkContext]] | |||
|
|||
if (metaStorePath != null) { | |||
if (metaStorePath != null && StringUtils.isNotBlank(metaStorePath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StringUtils.isNotBlank will judge null
@@ -37,6 +38,8 @@ import org.apache.carbondata.core.constants.CarbonCommonConstants | |||
import org.apache.carbondata.core.util.{CarbonProperties, CarbonSessionInfo, ThreadLocalSessionInfo} | |||
import org.apache.carbondata.streaming.CarbonStreamingQueryListener | |||
|
|||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove these two lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok.Has been removed
@@ -248,7 +251,7 @@ object CarbonSession { | |||
|
|||
session = new CarbonSession(sparkContext, None, !enableInMemCatlog) | |||
val carbonProperties = CarbonProperties.getInstance() | |||
if (storePath != null) { | |||
if (storePath != null && StringUtils.isNotBlank(storePath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove 'storePath != null', StringUtils.isNotBlank already includes this judgement.
If possible, it better add a test case for this. |
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9861/ |
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1812/ |
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]
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1603/ |
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9863/ |
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1814/ |
LGTM |
1 similar comment
LGTM |
…r 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
[CARBONDATA-2961] Simplify SDK API interfaces problem: current SDK API interfaces are not simpler and don't follow builder pattern. If new features are added, it will become more complex. Solution: Simplify the SDK interfaces as per builder pattern. Refer the latest sdk-guide. Added: changes in Carbon Writer: public CarbonWriterBuilder withThreadSafe(short numOfThreads) public CarbonWriterBuilder withHadoopConf(Configuration conf) public CarbonWriterBuilder withCsvInput(Schema schema) public CarbonWriterBuilder withAvroInput(org.apache.avro.Schema avroSchema) public CarbonWriterBuilder withJsonInput(Schema carbonSchema) public CarbonWriter build() throws IOException, InvalidLoadOptionException Changes in carbon Reader public CarbonReaderBuilder withHadoopConf(Configuration conf) public CarbonWriter build() throws IOException, InvalidLoadOptionException Removed: changes in Carbon Writer: public CarbonWriterBuilder isTransactionalTable(boolean isTransactionalTable) public CarbonWriterBuilder persistSchemaFile(boolean persist) setAccessKey setAccessKey setSecretKey setSecretKey setEndPoint setEndPoint public CarbonWriter buildWriterForCSVInput(Schema schema, Configuration configuration) public CarbonWriter buildThreadSafeWriterForCSVInput(Schema schema, short numOfThreads,Configuration configuration) public CarbonWriter buildWriterForAvroInput(org.apache.avro.Schema avroSchema,Configuration configuration) public CarbonWriter buildThreadSafeWriterForAvroInput(org.apache.avro.Schema avroSchema,short numOfThreads, Configuration configuration) public JsonCarbonWriter buildWriterForJsonInput(Schema carbonSchema, Configuration configuration) public JsonCarbonWriter buildThreadSafeWriterForJsonInput(Schema carbonSchema, short numOfThreads,Configuration configuration) Changes in carbon Reader public CarbonReaderBuilder isTransactionalTable(boolean isTransactionalTable) public CarbonWriter build(Configuration conf) throws IOException, InvalidLoadOptionException This closes apache#2961
…r 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 apache#2961
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.