Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2274#discussion_r189755781
--- Diff: docs/sdk-writer-guide.md ---
@@ -13,25 +13,33 @@ These SDK writer output contains just a carbondata and
carbonindex files. No met
import
org.apache.carbondata.common.exceptions.sql.InvalidLoadOptionException;
import org.apache.carbondata.core.metadata.datatype.DataTypes;
+ import org.apache.carbondata.core.util.CarbonProperties;
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 while executing the main to use offheap memory or
not
public static void main(String[] args) throws IOException,
InvalidLoadOptionException {
- testSdkWriter();
+ if (args.length > 0 && args[0] != null) {
+ testSdkWriter(args[0]);
+ } else {
+ testSdkWriter("true");
+ }
}
- public static void testSdkWriter() throws IOException,
InvalidLoadOptionException {
- String path = "/home/root1/Documents/ab/temp";
+ public static void testSdkWriter(String enableOffheap) throws
IOException, InvalidLoadOptionException {
+ String path = "./target/testCSVSdkWriter";
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);
--- End diff --
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.
---