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
Conversation
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/4745/ |
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/5667/ |
Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4507/ |
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/4746/ |
retest this please |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/5671/ |
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"); |
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.
This will impact others, why not let SDK user to set 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.
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");
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.
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.
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.
@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.
LGTM |
Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4686/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/5842/ |
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/4887/ |
0c31b5b
to
9de9ffe
Compare
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/5883/ |
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/4918/ |
Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4731/ |
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/4919/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/5885/ |
docs/sdk-writer-guide.md
Outdated
* This method will be used to add a new property | ||
* | ||
* @param key | ||
* @return properties value |
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.
return CarbonProperties object,not properties value
docs/sdk-writer-guide.md
Outdated
@@ -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"); |
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.
it should import CarbonProperties first.
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.
this one not fix
docs/sdk-writer-guide.md
Outdated
|
||
``` | ||
/** | ||
* This method will be responsible to get the instance of CarbonProperties class |
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.
please optimize the Scala Style: indent
docs/sdk-writer-guide.md
Outdated
|
||
``` | ||
/** | ||
* This method will be used to add a new property |
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.
please optimize the Scala Style: indent
docs/sdk-writer-guide.md
Outdated
|
||
``` | ||
/** | ||
* This method will be used to get the property value. if property is not |
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.
'if' should be 'If'
docs/sdk-writer-guide.md
Outdated
if(args[0] != null) { | ||
testSdkWriter(args[0]); | ||
} else { | ||
testSdkWriter("true"); |
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.
please optimize the Scala Style: indent
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.
done
docs/sdk-writer-guide.md
Outdated
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 |
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.
"whle" is incorrect, please optimize.
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.
Suggest use "Pass" instead of "pass".
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.
done
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6003/ |
docs/sdk-writer-guide.md
Outdated
public static void main(String[] args) throws IOException, InvalidLoadOptionException { | ||
testSdkWriter(); | ||
if(args[0] != null) { |
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.
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]
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.
BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in));
String enableOffheapSortVal = reader.readLine();
i think above code is ok to take input.
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.
is this ok?
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.
Have you run this test case in you machine? I run it but failed
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.
Didn't you rebase to the latest master? please rebase to the latest code if not
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.
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.
yeah, this path also has problem. I raised a commit just now:xubo245@09f3877, it can run success, maybe you can refer
docs/sdk-writer-guide.md
Outdated
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); |
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.
some methods have been changed, like withSchema and some. Please rebase to latest code
docs/sdk-writer-guide.md
Outdated
} | ||
|
||
public static void testSdkWriter() throws IOException, InvalidLoadOptionException { | ||
public static void testSdkWriter(String enableOffheap) throws IOException, InvalidLoadOptionException { | ||
String path = "/home/root1/Documents/ab/temp"; |
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.
It will throw exception if the path not exists and no permission to create. Can you optimize it? such as change the path.
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.
done
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6014/ |
Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4856/ |
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6022/ |
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5029/ |
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); |
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.
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.
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.
@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.
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.
It's different,validateEnableUnsafeSort method validate "enable.unsafe.sort", not "enable.offheap.sort".
docs/sdk-writer-guide.md
Outdated
* This method will be used to add a new property | ||
* | ||
* @param key | ||
* @return CarbonProperties object |
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.
should add @param value and describe
docs/sdk-writer-guide.md
Outdated
* present, then it will return the default value. | ||
* | ||
* @param key | ||
* @return properties value |
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.
Please add @param defaultValue and related describe.
SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5036/ |
Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/4874/ |
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6033/ |
retest this please |
LGTM |
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
doc updated to set the property for SDK user This closes apache#2274
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
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