Skip to content
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

Closed
wants to merge 5 commits into from

Conversation

zygitup
Copy link
Contributor

@zygitup zygitup commented Nov 28, 2018

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.

@CarbonDataQA
Copy link

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) {
Copy link
Contributor

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

Copy link
Contributor

@xubo245 xubo245 Nov 29, 2018

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

such as StringUtils.isNotEmpty

Copy link
Contributor

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 " "

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use StringUtils.isNotBlank.

@chenliang613
Copy link
Contributor

add to whitelist

@chenliang613
Copy link
Contributor

the pr title is not correct, the format should be : [JIRA NUMBER] PR description

@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1574/

@CarbonDataQA
Copy link

Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1786/

@CarbonDataQA
Copy link

Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9833/

@xubo245
Copy link
Contributor

xubo245 commented Nov 29, 2018

Please optimize the title, for example: [CARBONDATA-3119]Fix the error of getOrCreateCarbonSession method parameter is an empty string
Please optimize the PR content, keep the checklist format and finish the checklist

@zygitup zygitup changed the title Fixing the getOrCreateCarbonSession method parameter to an empty stri…[[JIRA CARBONDATA-3119]] [[JIRA CARBONDATA-3119]]Fixing the getOrCreateCarbonSession method parameter to an empty string Nov 29, 2018
@zygitup zygitup changed the title [[JIRA CARBONDATA-3119]]Fixing the getOrCreateCarbonSession method parameter to an empty string [JIRA CARBONDATA-3119] Fixing the getOrCreateCarbonSession method parameter to an empty string Nov 29, 2018
@zygitup zygitup changed the title [JIRA CARBONDATA-3119] Fixing the getOrCreateCarbonSession method parameter to an empty string [CARBONDATA-3119] Fixing the getOrCreateCarbonSession method parameter to an empty string Nov 29, 2018
@@ -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) {
Copy link
Contributor

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?

Copy link
Contributor

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) {
Copy link
Contributor

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?

@xuchuanyin
Copy link
Contributor

+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]
@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1595/

@CarbonDataQA
Copy link

Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9855/

@CarbonDataQA
Copy link

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]
@CarbonDataQA
Copy link

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)) {
Copy link
Contributor

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



Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove these two lines.

Copy link
Contributor Author

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)) {
Copy link
Contributor

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.

@zzcclp
Copy link
Contributor

zzcclp commented Nov 30, 2018

If possible, it better add a test case for this.

@CarbonDataQA
Copy link

Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9861/

@CarbonDataQA
Copy link

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]
@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1603/

@CarbonDataQA
Copy link

Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9863/

@CarbonDataQA
Copy link

Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1814/

@xuchuanyin
Copy link
Contributor

LGTM

1 similar comment
@zzcclp
Copy link
Contributor

zzcclp commented Nov 30, 2018

LGTM

@asfgit asfgit closed this in 382ce43 Nov 30, 2018
asfgit pushed a commit that referenced this pull request Nov 30, 2018
…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
Shubh18s pushed a commit to Shubh18s/carbondata that referenced this pull request Dec 14, 2018
[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
qiuchenjian pushed a commit to qiuchenjian/carbondata that referenced this pull request Jun 14, 2019
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants