You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by xubo245 <gi...@git.apache.org> on 2018/10/16 03:16:36 UTC
[GitHub] carbondata pull request #2816: [CARBONDATA-300] Suppor read batch row in CSD...
GitHub user xubo245 opened a pull request:
https://github.com/apache/carbondata/pull/2816
[CARBONDATA-300] Suppor read batch row in CSDK
[CARBONDATA-300] Suppor read batch row in CSDK
1. support read batch row in SDK
2. support read batch row in CSDK
3. add SDKReaderBenchmark IN SDK and testNextBatchRowPerformance in CSDK
4. improve CSDK read performance
This PR based on https://github.com/apache/carbondata/pull/2792 and cherry pick its commits. After PR2792 merged , this PR will remove its commits.
For SDK batch read:
readNextBatchRow:
total lines is 200100000, build time is 10.434133262 s, total read time is 167.567157044 s, average speed is 1194148.0868321797records/s.
readNextCarbonRow:
total lines is 200100000, build time is 15.775965656 s, total read time is 183.312544655 s, average speed is 1091578.322567037records/s.
read batch row is faster 9.4% than readCarbonRow( one by one)
For CSDK:
Test next Row Performance:
build time is: 2.749129 s
100000: time is 0.147732 s, speed is 676901.416078 records/s from_email10144phillip.allen@enron.com to_email69149buck.buckner@honeywell.com from_to <51...@thyme> 1538015558000000 971703720000000
200000: time is 0.320773 s, speed is 311746.936307 records/s from_email10324veronica.espinoza@enron.com to_email44094cynthia.franklin@enron.com from_to <14...@thyme> 1538015558000000 1003768608000000
300000: time is 0.138412 s, speed is 722480.709765 records/s from_email10545store-news@amazon.com to_email59755pallen@enron.com from_to <59...@thyme> 1538015558000000 1004057196000000
400000: time is 0.381501 s, speed is 262122.510819 records/s from_email1075sarah.novosel@enron.com to_email16354shelley.corman@enron.com from_to <23...@thyme> 1538015558000000 976725540000000
500000: time is 0.124684 s, speed is 802027.525585 records/s from_email10951ray.alvarez@enron.com to_email63518alan.comnes@enron.com from_to <31...@thyme> 1538015558000000 1003441879000000
600000: time is 1.260054 s, speed is 79361.678150 records/s from_email11168veronica.espinoza@enron.com to_email62073clinton.anderson@enron.com from_to <14...@thyme> 1538015558000000 1003768608000000
700000: time is 0.120333 s, speed is 831027.232762 records/s from_email11347ryan.o'rourke@enron.com to_email33299m..scott@enron.com from_to <20...@thyme> 1538015558000000 1003974318000000
800000: time is 0.424332 s, speed is 235664.526833 records/s from_email11540ryan.o'rourke@enron.com to_email60688keith.holst@enron.com from_to <20...@thyme> 1538015558000000 1003974318000000
900000: time is 0.127125 s, speed is 786627.335300 records/s from_email11756veronica.espinoza@enron.com to_email40317p..south@enron.com from_to <14...@thyme> 1538015558000000 1003768608000000
1000000: time is 0.135605 s, speed is 737435.935253 records/s from_email11965veronica.espinoza@enron.com to_email28764r..conner@enron.com from_to <14...@thyme> 1538015558000000 1003768608000000
1100000: time is 0.653121 s, speed is 153110.985560 records/s from_email12200phillip.allen@enron.com to_email53803anne.bike@enron.com from_to <12...@thyme> 1538015558000000 972994320000000
readNextBatchRow
log4j:WARN No appenders could be found for logger (org.apache.carbondata.core.util.CarbonProperties).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
build time is 10.434133262
100000: time is 0.015234857 s, speed is 6563894.88920047records/s, hasNext time is 1.872E-5s from_email10144phillip.allen@enron.com to_email69149buck.buckner@honeywell.com from_to <51...@thyme> 1538015558000000 971703720000000
200000: time is 1.381838498 s, speed is 72367.35707156423records/s, hasNext time is 1.373877655s from_email10324veronica.espinoza@enron.com to_email44094cynthia.franklin@enron.com from_to <14...@thyme> 1538015558000000 1003768608000000
300000: time is 0.071597049 s, speed is 1396705.6100314974records/s, hasNext time is 0.068254875s from_email10545store-news@amazon.com to_email59755pallen@enron.com from_to <59...@thyme> 1538015558000000 1004057196000000
400000: time is 0.071777167 s, speed is 1393200.7096351406records/s, hasNext time is 0.069637177s from_email1075sarah.novosel@enron.com to_email16354shelley.corman@enron.com from_to <23...@thyme> 1538015558000000 976725540000000
500000: time is 0.227270961 s, speed is 440003.4195305752records/s, hasNext time is 0.225358746s from_email10951ray.alvarez@enron.com to_email63518alan.comnes@enron.com from_to <31...@thyme> 1538015558000000 1003441879000000
600000: time is 0.069326305 s, speed is 1442453.9141383634records/s, hasNext time is 0.06744768s from_email11168veronica.espinoza@enron.com to_email62073clinton.anderson@enron.com from_to <14...@thyme> 1538015558000000 1003768608000000
700000: time is 0.07079448 s, speed is 1412539.508730059records/s, hasNext time is 0.068803357s from_email11347ryan.o'rourke@enron.com to_email33299m..scott@enron.com from_to <20...@thyme> 1538015558000000 1003974318000000
800000: time is 0.147471892 s, speed is 678095.3213782597records/s, hasNext time is 0.145297739s from_email11540ryan.o'rourke@enron.com to_email60688keith.holst@enron.com from_to <20...@thyme> 1538015558000000 1003974318000000
900000: time is 0.073139928 s, speed is 1367242.2537796318records/s, hasNext time is 0.070579908s from_email11756veronica.espinoza@enron.com to_email40317p..south@enron.com from_to <14...@thyme> 1538015558000000 1003768608000000
1000000: time is 0.073197467 s, speed is 1366167.493200277records/s, hasNext time is 0.071379687s from_email11965veronica.espinoza@enron.com to_email28764r..conner@enron.com from_to <14...@thyme> 1538015558000000 1003768608000000
1100000: time is 0.141830179 s, speed is 705068.5594918412records/s, hasNext time is 0.140102684s from_email12200phillip.allen@enron.com to_email53803anne.bike@enron.com from_to <12...@thyme> 1538015558000000 972994320000000
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.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/xubo245/carbondata CARBONDATA-3003_supportBatchRow
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/carbondata/pull/2816.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #2816
----
commit 425e76333ddb0991799f2fc7c0c028a18aca58b5
Author: xubo245 <xu...@...>
Date: 2018-10-09T09:58:48Z
[CARBONDATA-2981] Support read primitive data type in CSDK
1.support readNextCarbonRow
2.support read different primitive data type in c code from java side: int double short long string
3.support some data type and convert: date timestamp varchar decimal array<T>
4.remove readNextStringRow
remove the file after finished run
change the file
commit 4fc5ce599ada4875337c88f5eb8d217a8ae73ddd
Author: xubo245 <xu...@...>
Date: 2018-10-11T02:12:20Z
remove timestamp check
commit d74ce01c499b5b031d8123ea4dfc0cd90e56a2e8
Author: xubo245 <xu...@...>
Date: 2018-10-16T03:02:07Z
[CARBONDATA-300] Suppor read batch row in CSDK
1. support read batch row in SDK
2. support read batch row in CSDK
3. add SDKReaderBenchmark IN SDK and testNextBatchRowPerformance in CSDK
4. improve CSDK read performance
----
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1216/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on the issue:
https://github.com/apache/carbondata/pull/2816
@ajantha-bhat Please review again.
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/830/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1482/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1343/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228480901
--- Diff: store/CSDK/main.cpp ---
@@ -99,21 +102,187 @@ bool readFromLocalWithoutProjection(JNIEnv *env) {
printf("%s\t", carbonRow.getDecimal(10));
printf("%f\t", carbonRow.getFloat(11));
printf("\n");
+ env->DeleteLocalRef(row);
+ env->DeleteLocalRef(array1);
}
carbonReaderClass.close();
}
+/**
+ * test next Row Performance
+ *
+ * @param env jni env
+ * @return
+ */
+bool testNextRowPerformance(JNIEnv *env, char *path, int printNum, char *argv[], int argc) {
--- End diff --
Example code must be independent of data. It should work for small data as well as bigdata.
Also as you know we cannot keep huge data testcase in automation, PR builder will take time. So we avoid huge data test case. It is DFX scenario.
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228191657
--- Diff: examples/spark2/src/main/java/org/apache/carbondata/benchmark/SDKReaderBenchmark.java ---
@@ -0,0 +1,262 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.benchmark;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.sql.Timestamp;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+
+import org.apache.hadoop.conf.Configuration;
+
+import org.apache.carbondata.common.exceptions.sql.InvalidLoadOptionException;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.util.CarbonProperties;
+import org.apache.carbondata.sdk.file.*;
+
+/**
+ * Test SDK read performance
+ */
+public class SDKReaderBenchmark {
--- End diff --
This call not required. Please remove.
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1205/
---
[GitHub] carbondata issue #2816: [CARBONDATA-300] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/999/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9394/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228479559
--- Diff: examples/spark2/src/main/java/org/apache/carbondata/benchmark/SDKReaderBenchmark.java ---
@@ -0,0 +1,262 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.benchmark;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.sql.Timestamp;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+
+import org.apache.hadoop.conf.Configuration;
+
+import org.apache.carbondata.common.exceptions.sql.InvalidLoadOptionException;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.util.CarbonProperties;
+import org.apache.carbondata.sdk.file.*;
+
+/**
+ * Test SDK read performance
+ */
+public class SDKReaderBenchmark {
--- End diff --
**you can have reader benchmarking code,**
but it should just be a reader code that takes path and prints the rows and time taken.
But this example is extending data (writing data) That should not be there.
Also for everything separate S3 example not required. current examples only set conf and it works. So don't add multiple examples also.
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r229713578
--- Diff: core/src/main/java/org/apache/carbondata/core/scan/result/RowBatch.java ---
@@ -100,4 +100,19 @@ public int getSize() {
counter++;
return row;
}
+
+ /**
+ * read next batch
+ *
+ * @return rows
+ */
+ public List<Object[]> nextBatch() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ List<Object[]> row;
+ row = rows.subList(counter, rows.size());
--- End diff --
ok, I return rows directly
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228392301
--- Diff: hadoop/src/main/java/org/apache/carbondata/hadoop/CarbonRecordReader.java ---
@@ -116,6 +116,20 @@ public void initialize(InputSplit inputSplit, TaskAttemptContext context)
return readSupport.readRow(carbonIterator.next());
}
+ /**
+ * get batch result
+ *
+ * @param batch batch size
+ * @return rows
+ */
+ public List<Object[]> getBatchValue(int batch) {
+ rowCount += batch;
--- End diff --
ok, optimized
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on the issue:
https://github.com/apache/carbondata/pull/2816
LGTM
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9434/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1283/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1362/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1262/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1434/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1235/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on the issue:
https://github.com/apache/carbondata/pull/2816
@ajantha-bhat @KanakaKumar @kunal642 optimized and CI pass, please review again.
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1027/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1383/
---
[GitHub] carbondata issue #2816: [CARBONDATA-300] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9059/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9531/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228206123
--- Diff: store/CSDK/CarbonReader.cpp ---
@@ -74,27 +75,41 @@ jobject CarbonReader::withHadoopConf(char *key, char *value) {
return carbonReaderBuilderObject;
}
+jobject CarbonReader::withBatch(int batch) {
+ jclass carbonReaderBuilderClass = jniEnv->GetObjectClass(carbonReaderBuilderObject);
+ jmethodID buildID = jniEnv->GetMethodID(carbonReaderBuilderClass, "withBatch",
--- End diff --
Need to add validation. GetObjectClass, GetMethodID can return null.
Also need to take java exception to cpp for CallObjectMethodA.
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1249/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228221442
--- Diff: store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonReader.java ---
@@ -90,6 +91,18 @@ public T readNextRow() throws IOException, InterruptedException {
return currentReader.getCurrentValue();
}
+ /**
+ * Read and return next batch row objects
+ */
+ public Object[] readNextBatchRow(int batch) throws Exception {
--- End diff --
Why do we need to pass batch size here ? It should return batch same as set from withBatch(int) ??
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228213436
--- Diff: store/CSDK/main.cpp ---
@@ -99,21 +102,187 @@ bool readFromLocalWithoutProjection(JNIEnv *env) {
printf("%s\t", carbonRow.getDecimal(10));
printf("%f\t", carbonRow.getFloat(11));
printf("\n");
+ env->DeleteLocalRef(row);
+ env->DeleteLocalRef(array1);
}
carbonReaderClass.close();
}
+/**
+ * test next Row Performance
+ *
+ * @param env jni env
+ * @return
+ */
+bool testNextRowPerformance(JNIEnv *env, char *path, int printNum, char *argv[], int argc) {
--- End diff --
Same comment, this is internal comparision. No need to add in example test case.
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1344/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9089/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on the issue:
https://github.com/apache/carbondata/pull/2816
retest this please
---
[GitHub] carbondata issue #2816: [CARBONDATA-300] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9067/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228202864
--- Diff: hadoop/src/main/java/org/apache/carbondata/hadoop/CarbonRecordReader.java ---
@@ -116,6 +116,20 @@ public void initialize(InputSplit inputSplit, TaskAttemptContext context)
return readSupport.readRow(carbonIterator.next());
}
+ /**
+ * get batch result
+ *
+ * @param batch batch size
+ * @return rows
+ */
+ public List<Object[]> getBatchValue(int batch) {
+ rowCount += batch;
--- End diff --
we may not get complete batch size data from RowBatch.nextBatch(), it can return lesser data also. So, incrementing rowcount as batchsize is wrong.
we need to increment this value same as returned rows from batch iterator.
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228458636
--- Diff: store/CSDK/CarbonReader.cpp ---
@@ -74,27 +75,41 @@ jobject CarbonReader::withHadoopConf(char *key, char *value) {
return carbonReaderBuilderObject;
}
+jobject CarbonReader::withBatch(int batch) {
+ jclass carbonReaderBuilderClass = jniEnv->GetObjectClass(carbonReaderBuilderObject);
+ jmethodID buildID = jniEnv->GetMethodID(carbonReaderBuilderClass, "withBatch",
+ "(I)Lorg/apache/carbondata/sdk/file/CarbonReaderBuilder;");
+
+ jvalue args[1];
+ args[0].i = batch;
+ carbonReaderBuilderObject = jniEnv->CallObjectMethodA(carbonReaderBuilderObject, buildID, args);
+ return carbonReaderBuilderObject;
+}
+
jobject CarbonReader::build() {
jclass carbonReaderBuilderClass = jniEnv->GetObjectClass(carbonReaderBuilderObject);
jmethodID buildID = jniEnv->GetMethodID(carbonReaderBuilderClass, "build",
"()Lorg/apache/carbondata/sdk/file/CarbonReader;");
carbonReaderObject = jniEnv->CallObjectMethod(carbonReaderBuilderObject, buildID);
+ carbonReader = jniEnv->GetObjectClass(carbonReaderObject);
+ hasNextID = jniEnv->GetMethodID(carbonReader, "hasNext", "()Z");
--- End diff --
this has been done in PR2792
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1468/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1273/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1498/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on the issue:
https://github.com/apache/carbondata/pull/2816
retest this please
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1055/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1219/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228477978
--- Diff: examples/spark2/src/main/java/org/apache/carbondata/benchmark/SDKReaderExampleForBigData.java ---
@@ -0,0 +1,262 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.benchmark;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.sql.Timestamp;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+
+import org.apache.hadoop.conf.Configuration;
+
+import org.apache.carbondata.common.exceptions.sql.InvalidLoadOptionException;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.util.CarbonProperties;
+import org.apache.carbondata.sdk.file.*;
+
+/**
+ * Test SDK read example for big data
+ */
+public class SDKReaderExampleForBigData {
+ public static void main(String[] args) throws InterruptedException, InvalidLoadOptionException, IOException {
+ System.out.println("start to read data");
+ String path = "../../../../Downloads/carbon-data-big";
+ if (args.length > 0) {
+ path = args[0];
+ }
+ double num = 1000000000.0;
+ String originPath = "../../../../Downloads/carbon-data";
+ String newPath = "../../../../Downloads/carbon-data-big";
+ boolean writeNewData = false;
+ if (writeNewData) {
+ extendData(originPath, newPath);
+ }
+
+ Configuration conf = new Configuration();
+ if (args.length > 3) {
+ conf.set("fs.s3a.access.key", args[1]);
+ conf.set("fs.s3a.secret.key", args[2]);
+ conf.set("fs.s3a.endpoint", args[3]);
+ }
+ readNextBatchRow(path, num, conf, 100000, 100000);
+ readNextRow(path, num, conf, 100000);
+ }
+
+ public static void readNextRow(String path, double num, Configuration conf, int printNum) {
+ System.out.println("readNextRow");
+ try {
+ // Read data
+ Long startTime = System.nanoTime();
+ CarbonReader reader = CarbonReader
+ .builder(path, "_temp")
+ .withHadoopConf(conf)
+ .build();
+
+ Long startReadTime = System.nanoTime();
+ System.out.println("build time is " + (startReadTime - startTime) / num);
+ int i = 0;
+ while (reader.hasNext()) {
+ Object[] data = (Object[]) reader.readNextRow();
+ i++;
+ if (i % printNum == 0) {
+ Long point = System.nanoTime();
+ System.out.print(i + ": time is " + (point - startReadTime) / num
+ + " s, speed is " + (i / ((point - startReadTime) / num)) + " records/s \t");
+ for (int j = 0; j < data.length; j++) {
+ System.out.print(data[j] + "\t\t");
+ }
+ System.out.println();
+ }
+ }
+ Long endReadTime = System.nanoTime();
+ System.out.println("total lines is " + i + ", build time is " + (startReadTime - startTime) / num
+ + " s, \ttotal read time is " + (endReadTime - startReadTime) / num
+ + " s, \taverage speed is " + (i / ((endReadTime - startReadTime) / num))
+ + " records/s.");
+ reader.close();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * read next batch row
+ *
+ * @param path data path
+ * @param num number for time
+ * @param conf configuration
+ * @param batch batch size
+ * @param printNum print number for each batch
+ */
+ public static void readNextBatchRow(String path, double num, Configuration conf, int batch, int printNum) {
+ System.out.println("readNextBatchRow");
+ try {
+ // Read data
+ Long startTime = System.nanoTime();
+ CarbonReader reader = CarbonReader
+ .builder(path, "_temp")
+ .withHadoopConf(conf)
+ .withBatch(batch)
+ .build();
+
+ Long startReadTime = System.nanoTime();
+ Long startBatchReadTime = startReadTime;
+ System.out.println("build time is " + (startBatchReadTime - startTime) / num);
+ int i = 0;
+ long startHasNext = System.nanoTime();
+ while (reader.hasNext()) {
+ Long endHasNext = System.nanoTime();
+
+ Object[] batchRow = reader.readNextBatchRow();
+ for (int k = 0; k < batchRow.length; k++) {
+ Object[] data = (Object[]) batchRow[k];
+ i++;
+ if (i > 0 && i % printNum == 0) {
+ Long point = System.nanoTime();
+ System.out.print(i + ": time is " + (point - startBatchReadTime) / num
+ + " s, \tspeed is " + (printNum / ((point - startBatchReadTime) / num))
+ + " records/s, \thasNext time is " + (endHasNext - startHasNext) / num + " s\t");
+ for (int j = 0; j < data.length; j++) {
+ System.out.print(data[j] + "\t\t");
+ }
+ System.out.println();
+ startBatchReadTime = System.nanoTime();
+ }
+ }
+ startHasNext = System.nanoTime();
+ }
+ Long endReadTime = System.nanoTime();
+ System.out.println("total lines is " + i + ", build time is " + (startReadTime - startTime) / num
+ + " s, \ttotal read time is " + (endReadTime - startReadTime) / num
+ + " s, \taverage speed is " + (i / ((endReadTime - startReadTime) / num))
+ + " records/s.");
+ reader.close();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static Schema readSchema(String path) throws IOException {
+ File[] dataFiles = new File(path).listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String name) {
+ if (name == null) {
+ return false;
+ }
+ return name.endsWith("carbondata");
+ }
+ });
+ if (dataFiles == null || dataFiles.length < 1) {
+ throw new RuntimeException("Carbon index file not exists.");
+ }
+ Schema schema = CarbonSchemaReader
+ .readSchemaInDataFile(dataFiles[0].getAbsolutePath())
+ .asOriginOrder();
+ return schema;
+ }
+
+ /**
+ * extend data
+ * read origin path data and generate new data in new path,
+ * the new data is bigger than origin data
+ *
+ * @param originPath origin path of data
+ * @param newPath new path of data
+ * @throws IOException
+ * @throws InterruptedException
+ * @throws InvalidLoadOptionException
+ */
+ public static void extendData(String originPath, String newPath)
+ throws IOException, InterruptedException, InvalidLoadOptionException {
--- End diff --
we don't need this.
1) Benchmarking read performace if you want to check, just have a simple exmpale that takes path of files and reads it and prints the time. why extendData is required ?
2) Also below readSchema(originPath) is called for writing carbonfiles. we should not write any files.
just you can keep an example for read from path and print time. thats all
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228926855
--- Diff: core/src/main/java/org/apache/carbondata/core/scan/result/RowBatch.java ---
@@ -100,4 +100,25 @@ public int getSize() {
counter++;
return row;
}
+
+ /**
+ * read next batch
+ *
+ * @param batch batch size
+ * @return rows
+ */
+ public List<Object[]> nextBatch(int batch) {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ List<Object[]> row;
+ if (counter + batch > rows.size()) {
+ row = rows.subList(counter, rows.size());
+ counter = counter + row.size();
--- End diff --
isn't it counter = row.size() ?
because we are copying rows.size()-counter size data. So it is like counter = counter + (row.size()-counter) ?
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1450/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1041/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1420/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228457234
--- Diff: store/CSDK/CarbonReader.cpp ---
@@ -74,27 +75,41 @@ jobject CarbonReader::withHadoopConf(char *key, char *value) {
return carbonReaderBuilderObject;
}
+jobject CarbonReader::withBatch(int batch) {
+ jclass carbonReaderBuilderClass = jniEnv->GetObjectClass(carbonReaderBuilderObject);
+ jmethodID buildID = jniEnv->GetMethodID(carbonReaderBuilderClass, "withBatch",
--- End diff --
GetObjectClass shouldn't null, we should check whether carbonReaderBuilderObject is null.
checked GetMethodID.
CallObjectMethodA of withBatch won't throw exception
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1269/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228025597
--- Diff: store/CSDK/CarbonReader.cpp ---
@@ -17,6 +17,7 @@
#include "CarbonReader.h"
#include <jni.h>
+#include <sys/time.h>
--- End diff --
ok, done
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9465/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1046/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1193/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228469192
--- Diff: store/CSDK/main.cpp ---
@@ -224,8 +406,81 @@ bool readFromS3(JNIEnv *env, char *argv[]) {
printf("%s\t", carbonRow.getDecimal(10));
printf("%f\t", carbonRow.getFloat(11));
printf("\n");
+ env->DeleteLocalRef(row);
+ env->DeleteLocalRef(array1);
+ }
+ gettimeofday(&read, NULL);
+ time = 1000000 * (read.tv_sec - start.tv_sec) + read.tv_usec - start.tv_usec;
+ printf("total lines is %d: build time: %lf, read time is %lf s, average speed is %lf records/s\n",
+ i, buildTime, time / 1000000.0, i / (time / 1000000.0));
+
+ reader.close();
+}
+
+/**
+ * read data from S3
+ * parameter is ak sk endpoint
+ *
+ * @param env jni env
+ * @param argv argument vector
+ * @return
+ */
+bool readPerformanceFromS3(JNIEnv *env, char *argv[]) {
--- End diff --
I want to test for big data(more than 100 million rows), I change the test case name, is it ok?
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r227679865
--- Diff: core/src/main/java/org/apache/carbondata/core/scan/result/iterator/ChunkRowIterator.java ---
@@ -74,4 +76,13 @@ public ChunkRowIterator(CarbonIterator<RowBatch> iterator) {
return currentChunk.next();
}
+ /**
+ * get
--- End diff --
description is not correct
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r229161334
--- Diff: store/CSDK/test/main.cpp ---
@@ -220,6 +393,86 @@ bool tryCatchException(JNIEnv *env) {
*/
bool readFromS3(JNIEnv *env, char *argv[]) {
printf("\nRead data from S3:\n");
+ struct timeval start, build, read;
+ gettimeofday(&start, NULL);
+
+ CarbonReader reader;
+
+ char *args[3];
+ // "your access key"
+ args[0] = argv[1];
+ // "your secret key"
+ args[1] = argv[2];
+ // "your endPoint"
+ args[2] = argv[3];
+
+ reader.builder(env, "s3a://sdk/WriterOutput/carbondata", "test");
+ reader.withHadoopConf("fs.s3a.access.key", argv[1]);
+ reader.withHadoopConf("fs.s3a.secret.key", argv[2]);
+ reader.withHadoopConf("fs.s3a.endpoint", argv[3]);
+ reader.build();
+
+ gettimeofday(&build, NULL);
+ int time = 1000000 * (build.tv_sec - start.tv_sec) + build.tv_usec - start.tv_usec;
+ int buildTime = time / 1000000.0;
+ printf("build time: %lf s\n", time / 1000000.0);
+
+ CarbonRow carbonRow(env);
+ int i = 0;
+ while (reader.hasNext()) {
+ jobject row = reader.readNextRow();
+ i++;
+ carbonRow.setCarbonRow(row);
+
+ printf("%s\t", carbonRow.getString(0));
+ printf("%d\t", carbonRow.getInt(1));
+ printf("%ld\t", carbonRow.getLong(2));
+ printf("%s\t", carbonRow.getVarchar(3));
+ jobjectArray arr = carbonRow.getArray(4);
+ jsize length = env->GetArrayLength(arr);
+ int j = 0;
+ for (j = 0; j < length; j++) {
+ jobject element = env->GetObjectArrayElement(arr, j);
+ char *str = (char *) env->GetStringUTFChars((jstring) element, JNI_FALSE);
+ printf("%s\t", str);
+ }
+ env->DeleteLocalRef(arr);
+ printf("%d\t", carbonRow.getShort(5));
+ printf("%d\t", carbonRow.getInt(6));
+ printf("%ld\t", carbonRow.getLong(7));
+ printf("%lf\t", carbonRow.getDouble(8));
+ bool bool1 = carbonRow.getBoolean(9);
+ if (bool1) {
+ printf("true\t");
+ } else {
+ printf("false\t");
+ }
+ printf("%s\t", carbonRow.getDecimal(10));
+ printf("%f\t", carbonRow.getFloat(11));
+ printf("\n");
+ env->DeleteLocalRef(row);
+ }
+ gettimeofday(&read, NULL);
+ time = 1000000 * (read.tv_sec - start.tv_sec) + read.tv_usec - start.tv_usec;
+ printf("total lines is %d: build time: %lf, read time is %lf s, average speed is %lf records/s\n",
+ i, buildTime, time / 1000000.0, i / (time / 1000000.0));
+
+ reader.close();
+}
+
+/**
+ * read data from S3
+ * parameter is ak sk endpoint
+ *
+ * @param env jni env
+ * @param argv argument vector
+ * @return
+ */
+bool readFromS3ForBigData(JNIEnv *env, char **argv) {
--- End diff --
removed this test case
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9468/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1342/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r229162173
--- Diff: store/sdk/src/test/java/org/apache/carbondata/sdk/file/CarbonReaderTest.java ---
@@ -1737,4 +1739,95 @@ public void testReadNextRowWithProjectionAndRowUtil() {
}
}
+ @Test
+ public void testReadNextBatchRow() {
+ String path = "./carbondata";
+ try {
+ FileUtils.deleteDirectory(new File(path));
+
+ Field[] fields = new Field[12];
+ fields[0] = new Field("stringField", DataTypes.STRING);
+ fields[1] = new Field("shortField", DataTypes.SHORT);
+ fields[2] = new Field("intField", DataTypes.INT);
+ fields[3] = new Field("longField", DataTypes.LONG);
+ fields[4] = new Field("doubleField", DataTypes.DOUBLE);
+ fields[5] = new Field("boolField", DataTypes.BOOLEAN);
+ fields[6] = new Field("dateField", DataTypes.DATE);
+ fields[7] = new Field("timeField", DataTypes.TIMESTAMP);
+ fields[8] = new Field("decimalField", DataTypes.createDecimalType(8, 2));
+ fields[9] = new Field("varcharField", DataTypes.VARCHAR);
+ fields[10] = new Field("arrayField", DataTypes.createArrayType(DataTypes.STRING));
+ fields[11] = new Field("floatField", DataTypes.FLOAT);
+ Map<String, String> map = new HashMap<>();
+ map.put("complex_delimiter_level_1", "#");
+ CarbonWriter writer = CarbonWriter.builder()
+ .outputPath(path)
+ .withLoadOptions(map)
+ .withCsvInput(new Schema(fields))
+ .writtenBy("CarbonReaderTest")
+ .build();
+
+ for (int i = 0; i < 10; i++) {
+ String[] row2 = new String[]{
+ "robot" + (i % 10),
+ String.valueOf(i % 10000),
+ String.valueOf(i),
+ String.valueOf(Long.MAX_VALUE - i),
+ String.valueOf((double) i / 2),
+ String.valueOf(true),
+ "2019-03-02",
+ "2019-02-12 03:03:34",
+ "12.345",
+ "varchar",
+ "Hello#World#From#Carbon",
+ "1.23"
+ };
+ writer.write(row2);
+ }
+ writer.close();
+
+ // Read data
+ CarbonReader reader = CarbonReader
+ .builder(path, "_temp")
+ .withBatch(3)
+ .build();
+
+ int i = 0;
+ while (reader.hasNext()) {
+ Object[] batch = reader.readNextBatchRow();
+
+ for (int j = 0; j < batch.length; j++) {
--- End diff --
ok,done
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228028346
--- Diff: store/CSDK/main.cpp ---
@@ -21,6 +21,8 @@
#include <iostream>
#include <unistd.h>
#include "CarbonReader.h"
+#include "CarbonRow.h"
+#include <sys/time.h>
using namespace std;
--- End diff --
This is main file in C/C++. but only for test. In the future, CSDK will support test framework(such as googletest) to instead of main.cpp.
---
[GitHub] carbondata issue #2816: [CARBONDATA-300] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1005/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9494/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228932392
--- Diff: store/CSDK/test/main.cpp ---
@@ -220,6 +393,86 @@ bool tryCatchException(JNIEnv *env) {
*/
bool readFromS3(JNIEnv *env, char *argv[]) {
printf("\nRead data from S3:\n");
+ struct timeval start, build, read;
--- End diff --
Like we discussed in the previous PR, separate S3 test cases are not required. only thing we do in s3 testcase is calling withHadoopConf API. user can call this if he needs to run in S3 environment.
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r229161289
--- Diff: store/CSDK/test/main.cpp ---
@@ -220,6 +393,86 @@ bool tryCatchException(JNIEnv *env) {
*/
bool readFromS3(JNIEnv *env, char *argv[]) {
printf("\nRead data from S3:\n");
+ struct timeval start, build, read;
--- End diff --
ok, optimized, please check.
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228469216
--- Diff: store/CSDK/main.cpp ---
@@ -99,21 +102,187 @@ bool readFromLocalWithoutProjection(JNIEnv *env) {
printf("%s\t", carbonRow.getDecimal(10));
printf("%f\t", carbonRow.getFloat(11));
printf("\n");
+ env->DeleteLocalRef(row);
+ env->DeleteLocalRef(array1);
}
carbonReaderClass.close();
}
+/**
+ * test next Row Performance
+ *
+ * @param env jni env
+ * @return
+ */
+bool testNextRowPerformance(JNIEnv *env, char *path, int printNum, char *argv[], int argc) {
--- End diff --
I want to test for big data(more than 100 million rows), I change the test case name, is it ok?
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1406/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9301/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9306/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r227681343
--- Diff: store/CSDK/main.cpp ---
@@ -21,6 +21,8 @@
#include <iostream>
#include <unistd.h>
#include "CarbonReader.h"
+#include "CarbonRow.h"
+#include <sys/time.h>
using namespace std;
--- End diff --
why this file is called main.cpp?
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9321/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1177/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on the issue:
https://github.com/apache/carbondata/pull/2816
retest this please
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9424/
---
[GitHub] carbondata issue #2816: [CARBONDATA-300] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/824/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1131/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9447/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1217/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1373/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9269/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1170/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on the issue:
https://github.com/apache/carbondata/pull/2816
@KanakaKumar CI pass, please check
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9499/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1230/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9459/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on the issue:
https://github.com/apache/carbondata/pull/2816
retest this please
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228209499
--- Diff: store/CSDK/CarbonReader.cpp ---
@@ -74,27 +75,41 @@ jobject CarbonReader::withHadoopConf(char *key, char *value) {
return carbonReaderBuilderObject;
}
+jobject CarbonReader::withBatch(int batch) {
+ jclass carbonReaderBuilderClass = jniEnv->GetObjectClass(carbonReaderBuilderObject);
+ jmethodID buildID = jniEnv->GetMethodID(carbonReaderBuilderClass, "withBatch",
+ "(I)Lorg/apache/carbondata/sdk/file/CarbonReaderBuilder;");
+
+ jvalue args[1];
+ args[0].i = batch;
+ carbonReaderBuilderObject = jniEnv->CallObjectMethodA(carbonReaderBuilderObject, buildID, args);
+ return carbonReaderBuilderObject;
+}
+
jobject CarbonReader::build() {
jclass carbonReaderBuilderClass = jniEnv->GetObjectClass(carbonReaderBuilderObject);
jmethodID buildID = jniEnv->GetMethodID(carbonReaderBuilderClass, "build",
"()Lorg/apache/carbondata/sdk/file/CarbonReader;");
carbonReaderObject = jniEnv->CallObjectMethod(carbonReaderBuilderObject, buildID);
+ carbonReader = jniEnv->GetObjectClass(carbonReaderObject);
+ hasNextID = jniEnv->GetMethodID(carbonReader, "hasNext", "()Z");
--- End diff --
These filling can be moved to those functions only down. just have to check if not null or 0, then only fill. So that only one time we fill
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Support read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1287/
---
[GitHub] carbondata issue #2816: [CARBONDATA-300] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9073/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by KanakaKumar <gi...@git.apache.org>.
Github user KanakaKumar commented on the issue:
https://github.com/apache/carbondata/pull/2816
LGTM
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228156985
--- Diff: store/sdk/src/test/java/org/apache/carbondata/sdk/file/CarbonReaderTest.java ---
@@ -1616,7 +1616,6 @@ public boolean accept(File dir, String name) {
assertEquals(RowUtil.getDouble(data, 4), ((double) i) / 2);
assert (RowUtil.getBoolean(data, 5));
assertEquals(RowUtil.getInt(data, 6), 17957);
- assertEquals(RowUtil.getLong(data, 7), 1549911814000000L);
--- End diff --
Why removed this validation ?
---
[GitHub] carbondata issue #2816: [CARBONDATA-300] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/794/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228220014
--- Diff: store/sdk/src/test/java/org/apache/carbondata/sdk/file/CarbonReaderTest.java ---
@@ -1723,4 +1723,93 @@ public void testReadNextCarbonRowWithProjection() {
}
}
+ @Test
+ public void testReadNextBatchRow() {
+ String path = "./carbondata";
+ try {
+ FileUtils.deleteDirectory(new File(path));
+
+ Field[] fields = new Field[12];
+ fields[0] = new Field("stringField", DataTypes.STRING);
+ fields[1] = new Field("shortField", DataTypes.SHORT);
+ fields[2] = new Field("intField", DataTypes.INT);
+ fields[3] = new Field("longField", DataTypes.LONG);
+ fields[4] = new Field("doubleField", DataTypes.DOUBLE);
+ fields[5] = new Field("boolField", DataTypes.BOOLEAN);
+ fields[6] = new Field("dateField", DataTypes.DATE);
+ fields[7] = new Field("timeField", DataTypes.TIMESTAMP);
+ fields[8] = new Field("decimalField", DataTypes.createDecimalType(8, 2));
+ fields[9] = new Field("varcharField", DataTypes.VARCHAR);
+ fields[10] = new Field("arrayField", DataTypes.createArrayType(DataTypes.STRING));
+ fields[11] = new Field("floatField", DataTypes.FLOAT);
+ Map<String, String> map = new HashMap<>();
+ map.put("complex_delimiter_level_1", "#");
+ CarbonWriter writer = CarbonWriter.builder()
+ .outputPath(path)
+ .withLoadOptions(map)
+ .withCsvInput(new Schema(fields)).build();
+
+ for (int i = 0; i < 10; i++) {
+ String[] row2 = new String[]{
+ "robot" + (i % 10),
+ String.valueOf(i % 10000),
+ String.valueOf(i),
+ String.valueOf(Long.MAX_VALUE - i),
+ String.valueOf((double) i / 2),
+ String.valueOf(true),
+ "2019-03-02",
+ "2019-02-12 03:03:34",
+ "12.345",
+ "varchar",
+ "Hello#World#From#Carbon",
+ "1.23"
+ };
+ writer.write(row2);
+ }
+ writer.close();
+
+ // Read data
+ CarbonReader reader = CarbonReader
+ .builder(path, "_temp")
--- End diff --
Need to set batch size and test ? withBatch(int)
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9537/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1478/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9483/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228214955
--- Diff: store/CSDK/main.cpp ---
@@ -224,8 +406,81 @@ bool readFromS3(JNIEnv *env, char *argv[]) {
printf("%s\t", carbonRow.getDecimal(10));
printf("%f\t", carbonRow.getFloat(11));
printf("\n");
+ env->DeleteLocalRef(row);
+ env->DeleteLocalRef(array1);
+ }
+ gettimeofday(&read, NULL);
+ time = 1000000 * (read.tv_sec - start.tv_sec) + read.tv_usec - start.tv_usec;
+ printf("total lines is %d: build time: %lf, read time is %lf s, average speed is %lf records/s\n",
+ i, buildTime, time / 1000000.0, i / (time / 1000000.0));
+
+ reader.close();
+}
+
+/**
+ * read data from S3
+ * parameter is ak sk endpoint
+ *
+ * @param env jni env
+ * @param argv argument vector
+ * @return
+ */
+bool readPerformanceFromS3(JNIEnv *env, char *argv[]) {
--- End diff --
all internal comparision performance test cases are not needed.
---
[GitHub] carbondata issue #2816: [CARBONDATA-300] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/799/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9469/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1003/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1201/
---
[GitHub] carbondata issue #2816: [CARBONDATA-300] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/808/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r227680646
--- Diff: store/CSDK/CarbonReader.cpp ---
@@ -17,6 +17,7 @@
#include "CarbonReader.h"
#include <jni.h>
+#include <sys/time.h>
--- End diff --
I think system header file should be before carbon header file, so "CarbonReader.h" should be moved down
---
[GitHub] carbondata issue #2816: [CARBONDATA-300] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/801/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1021/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9441/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r229629760
--- Diff: core/src/main/java/org/apache/carbondata/core/scan/result/RowBatch.java ---
@@ -100,4 +100,19 @@ public int getSize() {
counter++;
return row;
}
+
+ /**
+ * read next batch
+ *
+ * @return rows
+ */
+ public List<Object[]> nextBatch() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ List<Object[]> row;
+ row = rows.subList(counter, rows.size());
--- End diff --
where is the batch reading happening now ?
you just have to return rows I think.
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1132/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228459548
--- Diff: store/sdk/src/test/java/org/apache/carbondata/sdk/file/CarbonReaderTest.java ---
@@ -1723,4 +1723,93 @@ public void testReadNextCarbonRowWithProjection() {
}
}
+ @Test
+ public void testReadNextBatchRow() {
+ String path = "./carbondata";
+ try {
+ FileUtils.deleteDirectory(new File(path));
+
+ Field[] fields = new Field[12];
+ fields[0] = new Field("stringField", DataTypes.STRING);
+ fields[1] = new Field("shortField", DataTypes.SHORT);
+ fields[2] = new Field("intField", DataTypes.INT);
+ fields[3] = new Field("longField", DataTypes.LONG);
+ fields[4] = new Field("doubleField", DataTypes.DOUBLE);
+ fields[5] = new Field("boolField", DataTypes.BOOLEAN);
+ fields[6] = new Field("dateField", DataTypes.DATE);
+ fields[7] = new Field("timeField", DataTypes.TIMESTAMP);
+ fields[8] = new Field("decimalField", DataTypes.createDecimalType(8, 2));
+ fields[9] = new Field("varcharField", DataTypes.VARCHAR);
+ fields[10] = new Field("arrayField", DataTypes.createArrayType(DataTypes.STRING));
+ fields[11] = new Field("floatField", DataTypes.FLOAT);
+ Map<String, String> map = new HashMap<>();
+ map.put("complex_delimiter_level_1", "#");
+ CarbonWriter writer = CarbonWriter.builder()
+ .outputPath(path)
+ .withLoadOptions(map)
+ .withCsvInput(new Schema(fields)).build();
+
+ for (int i = 0; i < 10; i++) {
+ String[] row2 = new String[]{
+ "robot" + (i % 10),
+ String.valueOf(i % 10000),
+ String.valueOf(i),
+ String.valueOf(Long.MAX_VALUE - i),
+ String.valueOf((double) i / 2),
+ String.valueOf(true),
+ "2019-03-02",
+ "2019-02-12 03:03:34",
+ "12.345",
+ "varchar",
+ "Hello#World#From#Carbon",
+ "1.23"
+ };
+ writer.write(row2);
+ }
+ writer.close();
+
+ // Read data
+ CarbonReader reader = CarbonReader
+ .builder(path, "_temp")
--- End diff --
ok, done
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on the issue:
https://github.com/apache/carbondata/pull/2816
retest this please
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r229161378
--- Diff: store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonReader.java ---
@@ -90,6 +93,20 @@ public T readNextRow() throws IOException, InterruptedException {
return currentReader.getCurrentValue();
}
+ /**
+ * Read and return next batch row objects
+ */
+ public Object[] readNextBatchRow() throws Exception {
+ validateReader();
+ int batch = Integer.parseInt(CarbonProperties.getInstance()
--- End diff --
ok, I added default batch size
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228932584
--- Diff: store/CSDK/test/main.cpp ---
@@ -220,6 +393,86 @@ bool tryCatchException(JNIEnv *env) {
*/
bool readFromS3(JNIEnv *env, char *argv[]) {
printf("\nRead data from S3:\n");
+ struct timeval start, build, read;
+ gettimeofday(&start, NULL);
+
+ CarbonReader reader;
+
+ char *args[3];
+ // "your access key"
+ args[0] = argv[1];
+ // "your secret key"
+ args[1] = argv[2];
+ // "your endPoint"
+ args[2] = argv[3];
+
+ reader.builder(env, "s3a://sdk/WriterOutput/carbondata", "test");
+ reader.withHadoopConf("fs.s3a.access.key", argv[1]);
+ reader.withHadoopConf("fs.s3a.secret.key", argv[2]);
+ reader.withHadoopConf("fs.s3a.endpoint", argv[3]);
+ reader.build();
+
+ gettimeofday(&build, NULL);
+ int time = 1000000 * (build.tv_sec - start.tv_sec) + build.tv_usec - start.tv_usec;
+ int buildTime = time / 1000000.0;
+ printf("build time: %lf s\n", time / 1000000.0);
+
+ CarbonRow carbonRow(env);
+ int i = 0;
+ while (reader.hasNext()) {
+ jobject row = reader.readNextRow();
+ i++;
+ carbonRow.setCarbonRow(row);
+
+ printf("%s\t", carbonRow.getString(0));
+ printf("%d\t", carbonRow.getInt(1));
+ printf("%ld\t", carbonRow.getLong(2));
+ printf("%s\t", carbonRow.getVarchar(3));
+ jobjectArray arr = carbonRow.getArray(4);
+ jsize length = env->GetArrayLength(arr);
+ int j = 0;
+ for (j = 0; j < length; j++) {
+ jobject element = env->GetObjectArrayElement(arr, j);
+ char *str = (char *) env->GetStringUTFChars((jstring) element, JNI_FALSE);
+ printf("%s\t", str);
+ }
+ env->DeleteLocalRef(arr);
+ printf("%d\t", carbonRow.getShort(5));
+ printf("%d\t", carbonRow.getInt(6));
+ printf("%ld\t", carbonRow.getLong(7));
+ printf("%lf\t", carbonRow.getDouble(8));
+ bool bool1 = carbonRow.getBoolean(9);
+ if (bool1) {
+ printf("true\t");
+ } else {
+ printf("false\t");
+ }
+ printf("%s\t", carbonRow.getDecimal(10));
+ printf("%f\t", carbonRow.getFloat(11));
+ printf("\n");
+ env->DeleteLocalRef(row);
+ }
+ gettimeofday(&read, NULL);
+ time = 1000000 * (read.tv_sec - start.tv_sec) + read.tv_usec - start.tv_usec;
+ printf("total lines is %d: build time: %lf, read time is %lf s, average speed is %lf records/s\n",
+ i, buildTime, time / 1000000.0, i / (time / 1000000.0));
+
+ reader.close();
+}
+
+/**
+ * read data from S3
+ * parameter is ak sk endpoint
+ *
+ * @param env jni env
+ * @param argv argument vector
+ * @return
+ */
+bool readFromS3ForBigData(JNIEnv *env, char **argv) {
--- End diff --
same as above
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1036/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Support read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9548/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r230312203
--- Diff: store/sdk/src/test/java/org/apache/carbondata/sdk/file/CarbonReaderTest.java ---
@@ -1521,4 +1521,294 @@ public boolean accept(File dir, String name) {
e.printStackTrace();
}
}
+
+ @Test
--- End diff --
yes
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228028896
--- Diff: README.md ---
@@ -61,6 +61,7 @@ CarbonData is built using Apache Maven, to [build CarbonData](https://github.com
* [CarbonData Pre-aggregate DataMap](https://github.com/apache/carbondata/blob/master/docs/preaggregate-datamap-guide.md)
* [CarbonData Timeseries DataMap](https://github.com/apache/carbondata/blob/master/docs/timeseries-datamap-guide.md)
* [SDK Guide](https://github.com/apache/carbondata/blob/master/docs/sdk-guide.md)
+* [CSDK Guide](https://github.com/apache/carbondata/blob/master/docs/CSDK-guide.md)
--- End diff --
ok, done
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on the issue:
https://github.com/apache/carbondata/pull/2816
retest this please
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r227680374
--- Diff: store/CSDK/CMakeLists.txt ---
@@ -1,17 +1,17 @@
-cmake_minimum_required (VERSION 2.8)
-project (CJDK)
+cmake_minimum_required(VERSION 2.8)
--- End diff --
Shouldn't add license header?
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9314/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xuchuanyin <gi...@git.apache.org>.
Github user xuchuanyin commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r226558824
--- Diff: examples/spark2/src/main/java/org/apache/carbondata/benchmark/SDKReaderBenchmark.java ---
@@ -0,0 +1,261 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.benchmark;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.sql.Timestamp;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+
+import org.apache.hadoop.conf.Configuration;
+
+import org.apache.carbondata.common.exceptions.sql.InvalidLoadOptionException;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.util.CarbonProperties;
+import org.apache.carbondata.sdk.file.*;
+
+/**
+ * Test SDK read performance
+ */
+public class SDKReaderBenchmark {
--- End diff --
1. It seems this class is not only for reader but also for writer. If it is so, please optimize the class name; If it is not, I think you can include them in one class.
2. For a benchmark, I don't see how the data is generated.
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Support read batch row in CSDK
Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on the issue:
https://github.com/apache/carbondata/pull/2816
LGTM
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1416/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9395/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r229161840
--- Diff: store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonReader.java ---
@@ -90,6 +93,20 @@ public T readNextRow() throws IOException, InterruptedException {
return currentReader.getCurrentValue();
}
+ /**
+ * Read and return next batch row objects
+ */
+ public Object[] readNextBatchRow() throws Exception {
+ validateReader();
+ int batch = Integer.parseInt(CarbonProperties.getInstance()
--- End diff --
no need batch in here, I removed.
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1390/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1445/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1267/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r227681835
--- Diff: README.md ---
@@ -61,6 +61,7 @@ CarbonData is built using Apache Maven, to [build CarbonData](https://github.com
* [CarbonData Pre-aggregate DataMap](https://github.com/apache/carbondata/blob/master/docs/preaggregate-datamap-guide.md)
* [CarbonData Timeseries DataMap](https://github.com/apache/carbondata/blob/master/docs/timeseries-datamap-guide.md)
* [SDK Guide](https://github.com/apache/carbondata/blob/master/docs/sdk-guide.md)
+* [CSDK Guide](https://github.com/apache/carbondata/blob/master/docs/CSDK-guide.md)
--- End diff --
I think it is better call C++ SDK Guide. The SDK is for C++.
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1130/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228932987
--- Diff: store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonReader.java ---
@@ -90,6 +93,20 @@ public T readNextRow() throws IOException, InterruptedException {
return currentReader.getCurrentValue();
}
+ /**
+ * Read and return next batch row objects
+ */
+ public Object[] readNextBatchRow() throws Exception {
+ validateReader();
+ int batch = Integer.parseInt(CarbonProperties.getInstance()
--- End diff --
What is this property is not set ? we get NPE here
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228026273
--- Diff: store/CSDK/CMakeLists.txt ---
@@ -1,17 +1,17 @@
-cmake_minimum_required (VERSION 2.8)
-project (CJDK)
+cmake_minimum_required(VERSION 2.8)
--- End diff --
ok, added
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on the issue:
https://github.com/apache/carbondata/pull/2816
retest this please
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228391972
--- Diff: examples/spark2/src/main/java/org/apache/carbondata/benchmark/SDKReaderBenchmark.java ---
@@ -0,0 +1,262 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.benchmark;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.sql.Timestamp;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+
+import org.apache.hadoop.conf.Configuration;
+
+import org.apache.carbondata.common.exceptions.sql.InvalidLoadOptionException;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.util.CarbonProperties;
+import org.apache.carbondata.sdk.file.*;
+
+/**
+ * Test SDK read performance
+ */
+public class SDKReaderBenchmark {
--- End diff --
we need know the SDK reader performance, and then we can know JNI performance lose by comparing with CSDK performance. And @KanakaKumar told we should test SDK reader performance in 1.5.1.
example has two benchmark currently, ConcurrentQueryBenchmark and SimpleQueryBenchmark。
If there are lack some test or indepth (IO time, pages scanned and all) or granular, we can add.
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228183334
--- Diff: core/src/main/java/org/apache/carbondata/core/scan/result/RowBatch.java ---
@@ -100,4 +100,24 @@ public int getSize() {
counter++;
return row;
}
+
+ /**
+ * read next batch
+ *
+ * @param batch batch size
+ * @return rows
+ */
+ public List<Object[]> nextBatch(int batch) {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ List<Object[]> row;
+ if (counter + batch > rows.size()) {
+ row = rows.subList(counter, rows.size());
+ } else {
+ row = rows.subList(counter, counter + batch);
+ }
+ counter = counter + batch;
--- End diff --
What if code enters if check (line 116), incrementing a counter by batch size wrong. because we fetched data lesser that batch size (only till row size)
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r226565398
--- Diff: examples/spark2/src/main/java/org/apache/carbondata/benchmark/SDKReaderBenchmark.java ---
@@ -0,0 +1,261 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.benchmark;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.sql.Timestamp;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+
+import org.apache.hadoop.conf.Configuration;
+
+import org.apache.carbondata.common.exceptions.sql.InvalidLoadOptionException;
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+import org.apache.carbondata.core.util.CarbonProperties;
+import org.apache.carbondata.sdk.file.*;
+
+/**
+ * Test SDK read performance
+ */
+public class SDKReaderBenchmark {
--- End diff --
1. write code is for read.
This PR didn't test write performance.
I will write SDKWriterBenchmark for writing date after CSDK support write carbondata
2. The data is from could stream, and this PR will enlarge the data.
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by ajantha-bhat <gi...@git.apache.org>.
Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228935418
--- Diff: store/sdk/src/test/java/org/apache/carbondata/sdk/file/CarbonReaderTest.java ---
@@ -1737,4 +1739,95 @@ public void testReadNextRowWithProjectionAndRowUtil() {
}
}
+ @Test
+ public void testReadNextBatchRow() {
+ String path = "./carbondata";
+ try {
+ FileUtils.deleteDirectory(new File(path));
+
+ Field[] fields = new Field[12];
+ fields[0] = new Field("stringField", DataTypes.STRING);
+ fields[1] = new Field("shortField", DataTypes.SHORT);
+ fields[2] = new Field("intField", DataTypes.INT);
+ fields[3] = new Field("longField", DataTypes.LONG);
+ fields[4] = new Field("doubleField", DataTypes.DOUBLE);
+ fields[5] = new Field("boolField", DataTypes.BOOLEAN);
+ fields[6] = new Field("dateField", DataTypes.DATE);
+ fields[7] = new Field("timeField", DataTypes.TIMESTAMP);
+ fields[8] = new Field("decimalField", DataTypes.createDecimalType(8, 2));
+ fields[9] = new Field("varcharField", DataTypes.VARCHAR);
+ fields[10] = new Field("arrayField", DataTypes.createArrayType(DataTypes.STRING));
+ fields[11] = new Field("floatField", DataTypes.FLOAT);
+ Map<String, String> map = new HashMap<>();
+ map.put("complex_delimiter_level_1", "#");
+ CarbonWriter writer = CarbonWriter.builder()
+ .outputPath(path)
+ .withLoadOptions(map)
+ .withCsvInput(new Schema(fields))
+ .writtenBy("CarbonReaderTest")
+ .build();
+
+ for (int i = 0; i < 10; i++) {
+ String[] row2 = new String[]{
+ "robot" + (i % 10),
+ String.valueOf(i % 10000),
+ String.valueOf(i),
+ String.valueOf(Long.MAX_VALUE - i),
+ String.valueOf((double) i / 2),
+ String.valueOf(true),
+ "2019-03-02",
+ "2019-02-12 03:03:34",
+ "12.345",
+ "varchar",
+ "Hello#World#From#Carbon",
+ "1.23"
+ };
+ writer.write(row2);
+ }
+ writer.close();
+
+ // Read data
+ CarbonReader reader = CarbonReader
+ .builder(path, "_temp")
+ .withBatch(3)
+ .build();
+
+ int i = 0;
+ while (reader.hasNext()) {
+ Object[] batch = reader.readNextBatchRow();
+
+ for (int j = 0; j < batch.length; j++) {
--- End diff --
need to validate whether the batch size is same as we set or lesser than that (for last batch). Must not be greater than our set batch size
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1432/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r227681593
--- Diff: store/sdk/src/test/java/org/apache/carbondata/sdk/file/CarbonReaderTest.java ---
@@ -1521,4 +1521,294 @@ public boolean accept(File dir, String name) {
e.printStackTrace();
}
}
+
+ @Test
--- End diff --
Is there testcase in CPP?
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228025690
--- Diff: store/CSDK/main.cpp ---
@@ -21,6 +21,8 @@
#include <iostream>
#include <unistd.h>
#include "CarbonReader.h"
+#include "CarbonRow.h"
+#include <sys/time.h>
--- End diff --
ok, I also change the others.
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r229155198
--- Diff: core/src/main/java/org/apache/carbondata/core/scan/result/RowBatch.java ---
@@ -100,4 +100,25 @@ public int getSize() {
counter++;
return row;
}
+
+ /**
+ * read next batch
+ *
+ * @param batch batch size
+ * @return rows
+ */
+ public List<Object[]> nextBatch(int batch) {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ List<Object[]> row;
+ if (counter + batch > rows.size()) {
+ row = rows.subList(counter, rows.size());
+ counter = counter + row.size();
--- End diff --
counter != row.size() before change readNextBatchRow(batch) to readNextBatchRow(). the batch is different between withBatch(batch) and readNextBatchRow(batch) before. But after change, the batch is the same, so counter = row.size()
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1183/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1263/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228461385
--- Diff: store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonReader.java ---
@@ -90,6 +91,18 @@ public T readNextRow() throws IOException, InterruptedException {
return currentReader.getCurrentValue();
}
+ /**
+ * Read and return next batch row objects
+ */
+ public Object[] readNextBatchRow(int batch) throws Exception {
--- End diff --
ok, optimized. remove batch in readNextBatchRow and keep in withBatch
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1048/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on the issue:
https://github.com/apache/carbondata/pull/2816
retest this please
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9527/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9415/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on the issue:
https://github.com/apache/carbondata/pull/2816
retest this please
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9517/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9396/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by jackylk <gi...@git.apache.org>.
Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r227681257
--- Diff: store/CSDK/main.cpp ---
@@ -21,6 +21,8 @@
#include <iostream>
#include <unistd.h>
#include "CarbonReader.h"
+#include "CarbonRow.h"
+#include <sys/time.h>
--- End diff --
Move before "CarbonReader.h"
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1160/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228386483
--- Diff: store/sdk/src/test/java/org/apache/carbondata/sdk/file/CarbonReaderTest.java ---
@@ -1616,7 +1616,6 @@ public boolean accept(File dir, String name) {
assertEquals(RowUtil.getDouble(data, 4), ((double) i) / 2);
assert (RowUtil.getBoolean(data, 5));
assertEquals(RowUtil.getInt(data, 6), 17957);
- assertEquals(RowUtil.getLong(data, 7), 1549911814000000L);
--- End diff --
It's different between local machine and CI machine.
---
[GitHub] carbondata issue #2816: [CARBONDATA-300] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/991/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228390686
--- Diff: core/src/main/java/org/apache/carbondata/core/scan/result/RowBatch.java ---
@@ -100,4 +100,24 @@ public int getSize() {
counter++;
return row;
}
+
+ /**
+ * read next batch
+ *
+ * @param batch batch size
+ * @return rows
+ */
+ public List<Object[]> nextBatch(int batch) {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+ List<Object[]> row;
+ if (counter + batch > rows.size()) {
+ row = rows.subList(counter, rows.size());
+ } else {
+ row = rows.subList(counter, counter + batch);
+ }
+ counter = counter + batch;
--- End diff --
ok, optimized
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on the issue:
https://github.com/apache/carbondata/pull/2816
@KanakaKumar @ajantha-bhat CI pass, please check.
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1204/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1151/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Support read batch row in C...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/carbondata/pull/2816
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1488/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1419/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228024318
--- Diff: core/src/main/java/org/apache/carbondata/core/scan/result/iterator/ChunkRowIterator.java ---
@@ -74,4 +76,13 @@ public ChunkRowIterator(CarbonIterator<RowBatch> iterator) {
return currentChunk.next();
}
+ /**
+ * get
--- End diff --
ok,optimized
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1396/
---
[GitHub] carbondata pull request #2816: [CARBONDATA-3003] Suppor read batch row in CS...
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2816#discussion_r228025429
--- Diff: store/CSDK/CMakeLists.txt ---
@@ -1,17 +1,17 @@
-cmake_minimum_required (VERSION 2.8)
-project (CJDK)
+cmake_minimum_required(VERSION 2.8)
--- End diff --
I think no need to add license header in this file.
CMakeLists.txt like pom.xml, it's not code file.
Tensorflow and caffe project also didn't add license header in CMakeLists.txt .
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1157/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Failed with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/1254/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1253/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by CarbonDataQA <gi...@git.apache.org>.
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/2816
Build Success with Spark 2.3.1, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/9095/
---
[GitHub] carbondata issue #2816: [CARBONDATA-3003] Suppor read batch row in CSDK
Posted by xubo245 <gi...@git.apache.org>.
Github user xubo245 commented on the issue:
https://github.com/apache/carbondata/pull/2816
retest this please
---