Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
blendb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
C3SL
blendb
Commits
89d436aa
Commit
89d436aa
authored
6 years ago
by
rafaelatc3sl
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#94
: Update view join algorithm
Signed-off-by:
rafaelatc3sl
<
rpd17@c3sl
>
parent
d2c88631
No related branches found
No related tags found
No related merge requests found
Pipeline
#18968
failed
6 years ago
Stage: test
Stage: build
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/util/viewHandler.ts
+15
-41
15 additions, 41 deletions
src/util/viewHandler.ts
with
15 additions
and
41 deletions
src/util/viewHandler.ts
+
15
−
41
View file @
89d436aa
...
...
@@ -309,60 +309,34 @@ export class ViewHandler {
}
/**
* Finds the pair of views most realted in a set of views and
* applies the JOIN operation in this set.
* Returns a set with the joined view and without the most
* related view.
* Assemble a set of views and applies
* JOIN operation in this set.
* Returns a set with the joined view.
* @param v - Set of candidated views to be joined.
*/
private
static
applyJoin
(
v
:
View
[]):
View
[]
{
/*
At this point 2 views will be joined, first the
similarity with each pair of views is calculated,
the pair with the biggedt similarity will be joined.
Similarity is calculated with the number of common
dimensions in the keys.
*/
const
views
=
v
.
map
((
i
)
=>
i
);
let
similarity
=
0
;
let
idx0
=
0
;
let
idx1
=
1
;
for
(
let
i
=
0
;
i
<
views
.
length
;
++
i
)
{
for
(
let
j
=
i
+
1
;
j
<
views
.
length
;
++
j
)
{
const
pi
=
views
[
i
].
dimensions
;
const
pj
=
views
[
j
].
dimensions
;
let
score
=
this
.
similarDimensions
(
pi
,
pj
);
if
(
similarity
<
score
)
{
similarity
=
score
;
idx0
=
i
;
idx1
=
j
;
}
}
}
const
partial0
=
views
[
idx0
];
const
partial1
=
views
[
idx1
];
let
dims
:
Dimension
[]
=
[];
let
mets
:
Metric
[]
=
[];
let
clauses
:
Clause
[]
=
[];
views
.
splice
(
idx1
,
1
);
views
.
splice
(
idx0
,
1
);
for
(
let
i
=
0
;
i
<
views
.
length
;
++
i
)
{
mets
=
mets
.
concat
(
views
[
i
].
metrics
);
dims
=
dims
.
concat
(
views
[
i
].
dimensions
);
clauses
=
clauses
.
concat
(
views
[
i
].
clauses
);
}
let
dims
=
partial0
.
dimensions
.
concat
(
partial1
.
dimensions
);
dims
=
ViewHandler
.
removeDuplicatedDimensions
(
dims
);
let
mets
=
partial0
.
metrics
.
concat
(
partial1
.
metrics
);
mets
=
ViewHandler
.
removeDuplicatedMetrics
(
mets
);
let
clauses
=
partial0
.
clauses
.
concat
(
partial1
.
clauses
);
clauses
=
ViewHandler
.
removeDuplicatedClauses
(
clauses
);
const
qOpts
:
QueryOpts
=
{
metrics
:
mets
,
dimensions
:
dims
,
clauses
:
clauses
};
const
partialQuery
=
new
Query
(
qOpts
);
const
partial
=
ViewHandler
.
queryJoin
(
partialQuery
,
[
partial0
,
partial1
]);
views
.
push
(
partial
);
return
views
;
const
partial
=
ViewHandler
.
queryJoin
(
partialQuery
,
views
);
return
[
partial
];
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment