-
Notifications
You must be signed in to change notification settings - Fork 13
matching stats as join table #3835
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
Open
awildturtok
wants to merge
52
commits into
develop
Choose a base branch
from
feature/matching-stats-as-join-table
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
74d9da4
First draft of function to resolve concepts
awildturtok e028841
remove qualification from CTConditionContext to make integration with…
awildturtok 4cccd65
Collect Auxiliary columns to then generate proper signature
awildturtok 209d881
properly insert function (only postgres atm)
awildturtok 8620c65
first draft towards applying matching stats
awildturtok 51f1aea
Reworks registration of MatchingStats.
awildturtok 98b69c4
fixes usage in MatchingStatsTests.java
awildturtok f09cdaa
wip
awildturtok 107407d
implements conversion and extraction of matching stats for Hana and P…
awildturtok 1b4949f
Merge remote-tracking branch 'origin/develop' into feature/matching-s…
awildturtok 3f0b1bb
disable daterange and money type compat check
awildturtok ff18d93
adds missing coalesce for primaryColumn
awildturtok b86af08
don't remove connector column
awildturtok 7735740
removes very verbose logging
awildturtok ed98bd2
use cursor to iterate results
awildturtok 368b4f5
adds timing to SQL matching stats fetching
awildturtok 5ffdade
use transaction to disable autocommit
awildturtok 0cb22e8
log select statement for debugging
awildturtok 8e64d47
add PARALLEL SAFE marker to created functions
awildturtok 8d5cd0a
reworks SqlMatchingStats function as flattened table
awildturtok 44899ee
adds some logging
awildturtok e2df161
adds missing concept Id
awildturtok 750a03b
adds missing error handling in outer loop
awildturtok 152fc72
adds grouping by params to map into most specific child
awildturtok 37009b0
fixes wrong usage of immutable datasctructure
awildturtok 67a0547
try to insert the join-tables
awildturtok 34b8bb5
adds typing to fields
awildturtok 4ff4776
remove primary key (nullability issue) and add index
awildturtok 11bd235
fix index creation
awildturtok 8e56eda
fix index creation #2
awildturtok 0c355b3
fix index creation #3
awildturtok 811afeb
outcomment index creation
awildturtok ced3e38
delete prior table
awildturtok bf1f37e
first draft of using join tables
awildturtok f04d739
fix dupe join
awildturtok 6aef402
cleanup of SqlMatchingStats
awildturtok f5fe46e
fix naming
awildturtok 8ef440f
adds exception handling
awildturtok 556f5ee
hopefully fixes reference on ColumnValue
awildturtok 4faabfb
hopefully fixes reference on ColumnValue
awildturtok 46f46a1
hopefully fixes reference on ColumnValue
awildturtok c53ce5f
hopefully fixes reference on ColumnValue
awildturtok 3093a9a
minor fixes for extraction of matching stats
awildturtok 53ba076
more cleanup
awildturtok 11c304f
more cleanup
awildturtok 3d02375
fix union to intersection
awildturtok 4366d85
cleanup
awildturtok 1ef85b9
Cleanup of failing tests
awildturtok e301226
Merge branch 'develop' into feature/matching-stats-as-join-table
awildturtok 14b72b5
fix hana insertion
awildturtok 7b9d34d
Some more Hana fixes
awildturtok 6e7d423
Merge branch 'develop' into feature/matching-stats-as-join-table
awildturtok 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
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
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
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
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
76 changes: 76 additions & 0 deletions
76
backend/src/main/java/com/bakdata/conquery/mode/local/UpdateMatchingStatsSqlJob.java
|
Collaborator
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. Löschen?
Collaborator
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. ne eigentlich eher die Logik wenn es dann passt hierhin migrieren |
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 |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| package com.bakdata.conquery.mode.local; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.concurrent.CompletableFuture; | ||
| import java.util.concurrent.ExecutorService; | ||
| import java.util.concurrent.Executors; | ||
| import java.util.concurrent.TimeUnit; | ||
|
|
||
| import com.bakdata.conquery.models.datasets.Dataset; | ||
| import com.bakdata.conquery.models.datasets.concepts.Concept; | ||
| import com.bakdata.conquery.models.datasets.concepts.tree.TreeConcept; | ||
| import com.bakdata.conquery.models.jobs.Job; | ||
| import com.bakdata.conquery.sql.conquery.SqlMatchingStats; | ||
| import com.google.common.base.Stopwatch; | ||
| import lombok.Data; | ||
| import lombok.ToString; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.apache.commons.lang3.builder.ToStringExclude; | ||
|
|
||
| @Slf4j | ||
| @Data | ||
| public class UpdateMatchingStatsSqlJob extends Job { | ||
|
|
||
| @ToString.Exclude | ||
| private final List<Concept<?>> concepts; | ||
| private final Dataset dataset; | ||
|
|
||
| @ToString.Exclude | ||
| private final SqlMatchingStats matchingStats; | ||
|
|
||
|
|
||
| @Override | ||
| public void execute() throws Exception { | ||
|
|
||
| log.info("BEGIN collecting SQL matching stats for {}", dataset); | ||
|
|
||
| Stopwatch stopwatch = Stopwatch.createStarted(); | ||
|
|
||
| ExecutorService executorService = Executors.newSingleThreadExecutor(); | ||
|
|
||
| List<CompletableFuture<?>> jobs = new ArrayList<>(); | ||
|
|
||
|
|
||
| for (Concept<?> concept : concepts) { | ||
| if (!(concept instanceof TreeConcept)) { | ||
| continue; | ||
| } | ||
| jobs.add(matchingStats.collectMatchingStatsForConcept((TreeConcept) concept, executorService).toCompletableFuture()); | ||
| } | ||
|
|
||
| CompletableFuture<Void> all = CompletableFuture.allOf(jobs.toArray(CompletableFuture[]::new)); | ||
| while (!all.isDone()) { | ||
| if (isCancelled()) { | ||
| all.cancel(true); | ||
| log.debug("CANCELLED update matching stats for {}", getDataset(), all.exceptionNow()); | ||
| return; | ||
| } | ||
|
|
||
| all.get(5, TimeUnit.SECONDS); | ||
| log.trace("WAITING for matching stats to finish {}", getDataset()); | ||
|
|
||
| if (all.isCompletedExceptionally()) { | ||
| log.error("FAILED update matching stats for {}", getDataset(), all.exceptionNow()); | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| log.debug("DONE collecting SQL matching stats for {} within {}", dataset, stopwatch); | ||
| } | ||
|
|
||
| @Override | ||
| public String getLabel() { | ||
| return "Collect matching stats for %s (%s concepts)".formatted(dataset.getName(), concepts.size()); | ||
| } | ||
| } |
Oops, something went wrong.
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.
Ich hätte das Interface beibehalten und davon diese abstract Class abgeleitet.
Interfaces können auch praktisch sein, da man für diese Proxies implementieren kann