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-2440] doc updated to set the property for SDK user #2274

Closed
wants to merge 1 commit into from

Conversation

rahulk2
Copy link
Contributor

@rahulk2 rahulk2 commented May 6, 2018

  • Any interfaces changed? NO

  • Any backward compatibility impacted? No

  • Document update required? ==> Yes

  • Testing done ==> All UT and SDV succes report is enough.

  • For large changes, please consider breaking it into sub-tasks under an umbrella JIRA. NA

@ravipesala
Copy link
Contributor

SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/4745/

@CarbonDataQA
Copy link

Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/5667/

@CarbonDataQA
Copy link

Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4507/

@ravipesala
Copy link
Contributor

SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/4746/

@rahulk2
Copy link
Contributor Author

rahulk2 commented May 6, 2018

retest this please

@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/5671/

@CarbonDataQA
Copy link

Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4511/


if (!table.isTransactionalTable()) {
CarbonProperties.getInstance()
.addProperty(CarbonCommonConstants.ENABLE_OFFHEAP_SORT, "false");
Copy link
Contributor

Choose a reason for hiding this comment

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

This will impact others, why not let SDK user to set it

Copy link
Contributor Author

@rahulk2 rahulk2 May 10, 2018

Choose a reason for hiding this comment

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

Intention was to prevent 'unsafe' property from being used by SDK user by default. Otherwise they have to configure memory for unsafe also. So making it simple to use.

Any way we will update the doc how SDK user can set the property by following code:

CarbonProperties.getInstance() .addProperty("property", "value");

Copy link
Contributor

@kunal642 kunal642 May 11, 2018

Choose a reason for hiding this comment

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

But this will overwrite the ENABLE_OFFHEAP_SORT if the user has set it. Need to check if this is already set. If not then set to false otherwise use what the user has set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kunal642 if we are updating the doc to set the properties then no need of this code. same PR we can use to update the doc.

@rahulk2 rahulk2 changed the title [CARBONDATA-2440] default value of ENABLE_OFFHEAP_SORT for sdk set as false [CARBONDATA-2440] doc updated to set the property for SDK user May 11, 2018
@sgururajshetty
Copy link
Contributor

LGTM

@CarbonDataQA
Copy link

Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4686/

@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/5842/

@ravipesala
Copy link
Contributor

SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/4887/

@rahulk2 rahulk2 force-pushed the unsafe_mem_sdk branch 4 times, most recently from 0c31b5b to 9de9ffe Compare May 15, 2018 06:54
@CarbonDataQA
Copy link

Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/5883/

@ravipesala
Copy link
Contributor

SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/4918/

@CarbonDataQA
Copy link

Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4731/

@ravipesala
Copy link
Contributor

SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/4919/

@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/5885/

* This method will be used to add a new property
*
* @param key
* @return properties value
Copy link
Contributor

Choose a reason for hiding this comment

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

return CarbonProperties object,not properties value

@@ -32,6 +32,8 @@ These SDK writer output contains just a carbondata and carbonindex files. No met
fields[1] = new Field("age", DataTypes.INT);

Schema schema = new Schema(fields);

CarbonProperties.getInstance().addProperty("enable.offheap.sort", "false");
Copy link
Contributor

@xubo245 xubo245 May 21, 2018

Choose a reason for hiding this comment

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

it should import CarbonProperties first.

Copy link
Contributor

Choose a reason for hiding this comment

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

this one not fix


```
/**
* This method will be responsible to get the instance of CarbonProperties class
Copy link
Contributor

Choose a reason for hiding this comment

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

please optimize the Scala Style: indent


```
/**
* This method will be used to add a new property
Copy link
Contributor

Choose a reason for hiding this comment

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

please optimize the Scala Style: indent


```
/**
* This method will be used to get the property value. if property is not
Copy link
Contributor

@xubo245 xubo245 May 21, 2018

Choose a reason for hiding this comment

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

'if' should be 'If'

if(args[0] != null) {
testSdkWriter(args[0]);
} else {
testSdkWriter("true");
Copy link
Contributor

Choose a reason for hiding this comment

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

please optimize the Scala Style: indent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

import org.apache.carbondata.sdk.file.CarbonWriter;
import org.apache.carbondata.sdk.file.CarbonWriterBuilder;
import org.apache.carbondata.sdk.file.Field;
import org.apache.carbondata.sdk.file.Schema;

public class TestSdk {


// pass true or false whle executing the main to use offheap memory or not
Copy link
Contributor

Choose a reason for hiding this comment

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

"whle" is incorrect, please optimize.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest use "Pass" instead of "pass".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6003/

public static void main(String[] args) throws IOException, InvalidLoadOptionException {
testSdkWriter();
if(args[0] != null) {
Copy link
Contributor

@xubo245 xubo245 May 21, 2018

Choose a reason for hiding this comment

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

It will throw "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at org.apache.carbondata.examples.sdk.TestSDK.main(TestSDK.java:17)"

The length of args should more than 0 when you use args[0]

Copy link
Contributor Author

@rahulk2 rahulk2 May 21, 2018

Choose a reason for hiding this comment

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

        BufferedReader reader = 
                   new BufferedReader(new InputStreamReader(System.in));
        String enableOffheapSortVal = reader.readLine();

i think above code is ok to take input.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is this ok?

Copy link
Contributor

Choose a reason for hiding this comment

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

Have you run this test case in you machine? I run it but failed

Copy link
Contributor

@xubo245 xubo245 May 21, 2018

Choose a reason for hiding this comment

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

Didn't you rebase to the latest master? please rebase to the latest code if not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it may be failing because of invalid path given in testSdkWriter().

image

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, this path also has problem. I raised a commit just now:xubo245@09f3877, it can run success, maybe you can refer

String path = "/home/root1/Documents/ab/temp";

Field[] fields = new Field[2];
fields[0] = new Field("name", DataTypes.STRING);
fields[1] = new Field("age", DataTypes.INT);

Schema schema = new Schema(fields);

CarbonProperties.getInstance().addProperty("enable.offheap.sort", enableOffheap);

CarbonWriterBuilder builder = CarbonWriter.builder().withSchema(schema).outputPath(path);
Copy link
Contributor

@xubo245 xubo245 May 21, 2018

Choose a reason for hiding this comment

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

some methods have been changed, like withSchema and some. Please rebase to latest code

}

public static void testSdkWriter() throws IOException, InvalidLoadOptionException {
public static void testSdkWriter(String enableOffheap) throws IOException, InvalidLoadOptionException {
String path = "/home/root1/Documents/ab/temp";
Copy link
Contributor

@xubo245 xubo245 May 21, 2018

Choose a reason for hiding this comment

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

It will throw exception if the path not exists and no permission to create. Can you optimize it? such as change the path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6014/

@CarbonDataQA
Copy link

Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4856/

@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6022/

@ravipesala
Copy link
Contributor

SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5029/

@CarbonDataQA
Copy link

Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4863/


Field[] fields = new Field[2];
fields[0] = new Field("name", DataTypes.STRING);
fields[1] = new Field("age", DataTypes.INT);

Schema schema = new Schema(fields);

CarbonProperties.getInstance().addProperty("enable.offheap.sort", enableOffheap);
Copy link
Contributor

Choose a reason for hiding this comment

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

The value of "enable.offheap.sort" will transform to false when args[0] not equal to true, including "false" and other string, like "f","any" and so on.

Copy link
Contributor Author

@rahulk2 rahulk2 May 22, 2018

Choose a reason for hiding this comment

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

@xubo245 if args[0] is specified as any other value except true or false then it will log warning message and will set default value.

refer
image

Copy link
Contributor

Choose a reason for hiding this comment

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

It's different,validateEnableUnsafeSort method validate "enable.unsafe.sort", not "enable.offheap.sort".

* This method will be used to add a new property
*
* @param key
* @return CarbonProperties object
Copy link
Contributor

Choose a reason for hiding this comment

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

should add @param value and describe

* present, then it will return the default value.
*
* @param key
* @return properties value
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add @param defaultValue and related describe.

@ravipesala
Copy link
Contributor

SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5036/

@CarbonDataQA
Copy link

Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4874/

@CarbonDataQA
Copy link

Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6033/

@xubo245
Copy link
Contributor

xubo245 commented May 22, 2018

retest this please

@xubo245
Copy link
Contributor

xubo245 commented May 22, 2018

LGTM

@asfgit asfgit closed this in e1ef85a May 22, 2018
asfgit pushed a commit that referenced this pull request May 28, 2018
In #2274, the value of enable.offheap.sort will transform to false when args[0] not equal to true, including false and other string, like f,any and so on.

So we should validate it.

This closes #2331
asfgit pushed a commit that referenced this pull request Jun 5, 2018
In #2274, the value of enable.offheap.sort will transform to false when args[0] not equal to true, including false and other string, like f,any and so on.

So we should validate it.

This closes #2331
sv71294 pushed a commit to sv71294/carbondata that referenced this pull request Jun 22, 2018
In apache#2274, the value of enable.offheap.sort will transform to false when args[0] not equal to true, including false and other string, like f,any and so on.

So we should validate it.

This closes apache#2331
anubhav100 pushed a commit to anubhav100/incubator-carbondata that referenced this pull request Jun 22, 2018
doc updated to set the property for SDK user

This closes apache#2274
anubhav100 pushed a commit to anubhav100/incubator-carbondata that referenced this pull request Jun 22, 2018
In apache#2274, the value of enable.offheap.sort will transform to false when args[0] not equal to true, including false and other string, like f,any and so on.

So we should validate it.

This closes apache#2331
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