Skip to content

Commit

Permalink
[ISSUE-4305] Optimize the magic number
Browse files Browse the repository at this point in the history
  • Loading branch information
xubo245 committed Apr 9, 2023
1 parent 92f4dff commit 3cc0367
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ target/
store/CSDK/cmake-build-debug/*
.project
.classpath
.DS_Store
metastore_db/
derby.log
python/.idea/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@
import org.apache.carbondata.core.util.path.CarbonTablePath;
import org.apache.carbondata.sdk.file.CarbonReader;

import static org.apache.carbondata.sdk.file.utils.SDKUtil.listFiles;

import org.apache.hadoop.conf.Configuration;
import org.apache.log4j.Logger;

import static org.apache.carbondata.sdk.file.utils.SDKUtil.listFiles;
import static org.apache.hadoop.fs.s3a.Constants.ACCESS_KEY;
import static org.apache.hadoop.fs.s3a.Constants.ENDPOINT;
import static org.apache.hadoop.fs.s3a.Constants.SECRET_KEY;
Expand All @@ -44,12 +43,13 @@ public static void main(String[] args) throws Exception {
Logger logger = LogServiceFactory.getLogService(SDKS3ReadExample.class.getName());
if (args == null || args.length < 3) {
logger.error("Usage: java CarbonS3Example: <access-key> <secret-key>"
+ "<s3-endpoint> [table-path-on-s3]");
+ "<s3-endpoint> [table-path-on-s3]");
System.exit(0);
}

String path = "s3a://sdk/WriterOutput/carbondata5";
if (args.length > 3) {
String path = "s3a://obs-xubo4/sdkdata/test";
int parameterLength = 3;
if (args.length > parameterLength) {
path = args[3];
}

Expand Down Expand Up @@ -78,7 +78,8 @@ public static void main(String[] args) throws Exception {

System.out.println("\nData:");
int i = 0;
while (i < 20 && reader.hasNext()) {
int count = 20;
while (i < count && reader.hasNext()) {
Object[] row = (Object[]) reader.readNextRow();
System.out.println(row[0] + " " + row[1]);
i++;
Expand All @@ -97,7 +98,7 @@ public static void main(String[] args) throws Exception {

System.out.println("\nData:");
i = 0;
while (i < 20 && reader2.hasNext()) {
while (i < count && reader2.hasNext()) {
Object[] row = (Object[]) reader2.readNextRow();
System.out.println(row[0] + " " + row[1]);
i++;
Expand Down

0 comments on commit 3cc0367

Please sign in to comment.