-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[enhancement](jni)Adjust the statistical time of JNI appenddata. #58224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -50,6 +50,7 @@ | |||||||||||||||
|
|
||||||||||||||||
| import java.io.IOException; | ||||||||||||||||
| import java.time.ZoneId; | ||||||||||||||||
| import java.util.ArrayList; | ||||||||||||||||
| import java.util.Arrays; | ||||||||||||||||
| import java.util.List; | ||||||||||||||||
| import java.util.Map; | ||||||||||||||||
|
|
@@ -166,13 +167,24 @@ public int getNext() throws IOException { | |||||||||||||||
| return preExecutionAuthenticator.execute(() -> { | ||||||||||||||||
| NullWritable key = reader.createKey(); | ||||||||||||||||
| ArrayWritable value = reader.createValue(); | ||||||||||||||||
| List<Object> records = new ArrayList<>(); | ||||||||||||||||
| int numRows = 0; | ||||||||||||||||
|
Comment on lines
+170
to
171
|
||||||||||||||||
| List<Object> records = new ArrayList<>(); | |
| int numRows = 0; | |
| int numRows = 0; | |
| List<Object> records = null; | |
| if (fields.length > 0) { | |
| records = new ArrayList<>(); | |
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -105,24 +105,29 @@ private void nextScanTask() throws IOException { | |
| @Override | ||
| protected int getNext() throws IOException { | ||
| try (ThreadClassLoaderContext ignored = new ThreadClassLoaderContext(classLoader)) { | ||
| int rows = 0; | ||
| while (rows < getBatchSize()) { | ||
|
|
||
| List<StructLike> records = new ArrayList<>(); | ||
| while (records.size() < getBatchSize()) { | ||
| while (!reader.hasNext() && scanTasks.hasNext()) { | ||
| nextScanTask(); | ||
| } | ||
| if (!reader.hasNext()) { | ||
| break; | ||
| } | ||
| StructLike row = reader.next(); | ||
| records.add(reader.next()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May this consume more memory? Cause we have to save all records before doing the append?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don’t think it will consume much memory, because at most there will only be one batch of data at a time. The reason for storing this data before calling |
||
| } | ||
| long startTime = System.nanoTime(); | ||
| for (StructLike row : records) { | ||
| for (int i = 0; i < fields.size(); i++) { | ||
| NestedField field = fields.get(i); | ||
| Object value = row.get(i, field.type().typeId().javaClass()); | ||
| ColumnValue columnValue = new IcebergSysTableColumnValue(value, timezone); | ||
| appendData(i, columnValue); | ||
| } | ||
| rows++; | ||
| } | ||
| return rows; | ||
| appendDataTime += System.nanoTime() - startTime; | ||
|
|
||
| return records.size(); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -34,6 +34,7 @@ | |||
| import org.slf4j.LoggerFactory; | ||||
|
|
||||
| import java.io.IOException; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Arrays; | ||||
| import java.util.Iterator; | ||||
| import java.util.List; | ||||
|
|
@@ -159,21 +160,15 @@ private void resetDatetimeV2Precision() { | |||
| } | ||||
| } | ||||
|
|
||||
| private int readAndProcessNextBatch() throws IOException { | ||||
| int rows = 0; | ||||
| private List<InternalRow> readNextBatch() throws IOException { | ||||
| List<InternalRow> records = new ArrayList<>(); | ||||
| // int rows = 0; | ||||
|
||||
| // int rows = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented-out code. This code block appears to be old implementation that has been replaced by the refactored version in the
getNext()method. Commented code should be removed rather than left in the codebase.