-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[log] logging specific join keys and results for lookup join #4856
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4614bef
[log] logging specific join keys and results for lookup join
LsomeYeah 1b4856a
fix
LsomeYeah db5caad
fix
LsomeYeah 8c79686
fix log
LsomeYeah 5a24dcd
[temp] trun on the debug mode in FileStoreLookupFunction
LsomeYeah 1771129
remove log property for debug
LsomeYeah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,6 +91,8 @@ public class FileStoreLookupFunction implements Serializable, Closeable { | |
| @Nullable private final Predicate predicate; | ||
| @Nullable private final RefreshBlacklist refreshBlacklist; | ||
|
|
||
| private final List<InternalRow.FieldGetter> projectFieldsGetters; | ||
|
|
||
| private transient File path; | ||
| private transient LookupTable lookupTable; | ||
|
|
||
|
|
@@ -123,6 +125,11 @@ public FileStoreLookupFunction( | |
| .mapToObj(i -> table.rowType().getFieldNames().get(i)) | ||
| .collect(Collectors.toList()); | ||
|
|
||
| this.projectFieldsGetters = | ||
| Arrays.stream(projection) | ||
| .mapToObj(i -> table.rowType().fieldGetters()[i]) | ||
| .collect(Collectors.toList()); | ||
|
|
||
| // add primary keys | ||
| for (String field : table.primaryKeys()) { | ||
| if (!projectFields.contains(field)) { | ||
|
|
@@ -166,6 +173,11 @@ private void open() throws Exception { | |
|
|
||
| List<String> fieldNames = table.rowType().getFieldNames(); | ||
| int[] projection = projectFields.stream().mapToInt(fieldNames::indexOf).toArray(); | ||
| LOG.info( | ||
| "lookup projection fields in lookup table:{}, join fields in lookup table:{}", | ||
| projectFields, | ||
| joinKeys); | ||
|
|
||
| FileStoreTable storeTable = (FileStoreTable) table; | ||
|
|
||
| if (options.get(LOOKUP_CACHE_MODE) == LookupCacheMode.AUTO | ||
|
|
@@ -236,6 +248,9 @@ public Collection<RowData> lookup(RowData keyRow) { | |
| try { | ||
| tryRefresh(); | ||
|
|
||
| if (LOG.isDebugEnabled()) { | ||
| LOG.debug("lookup key:{}", keyRow.toString()); | ||
| } | ||
| InternalRow key = new FlinkRowWrapper(keyRow); | ||
| if (partitionLoader == null) { | ||
| return lookupInternal(key); | ||
|
|
@@ -264,6 +279,16 @@ private List<RowData> lookupInternal(InternalRow key) throws IOException { | |
| for (InternalRow matchedRow : lookupResults) { | ||
| rows.add(new FlinkRowData(matchedRow)); | ||
| } | ||
|
|
||
| if (LOG.isDebugEnabled()) { | ||
| LOG.debug( | ||
| "matched rows in lookup table, size:{}, rows:{}", | ||
| lookupResults.size(), | ||
| lookupResults.stream() | ||
| .map(row -> logRow(projectFieldsGetters, row)) | ||
| .collect(Collectors.toList())); | ||
| } | ||
|
|
||
| return rows; | ||
| } | ||
|
|
||
|
|
@@ -413,4 +438,15 @@ protected Set<Integer> getRequireCachedBucketIds() { | |
| protected void setCacheRowFilter(@Nullable Filter<InternalRow> cacheRowFilter) { | ||
| this.cacheRowFilter = cacheRowFilter; | ||
| } | ||
|
|
||
| private String logRow(List<InternalRow.FieldGetter> fieldGetters, InternalRow row) { | ||
| List<String> rowValues = new ArrayList<>(fieldGetters.size()); | ||
|
|
||
| for (InternalRow.FieldGetter fieldGetter : fieldGetters) { | ||
| Object fieldValue = fieldGetter.getFieldOrNull(row); | ||
| String value = fieldValue == null ? "null" : fieldValue.toString(); | ||
| rowValues.add(value); | ||
|
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. rowValues.add(fieldValue == null ? "null" : fieldValue.toString()); |
||
| } | ||
| return rowValues.toString(); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (LOG.isDebugEnabled()) {
LOG.debug("xxx");
}