Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
caosdb
Software
caosdb-server
Commits
4ba69065
Verified
Commit
4ba69065
authored
5 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
ENH: slightly improved measurement names for POV.java
parent
dfe241de
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/caosdb/server/query/POV.java
+22
-22
22 additions, 22 deletions
src/main/java/caosdb/server/query/POV.java
with
22 additions
and
22 deletions
src/main/java/caosdb/server/query/POV.java
+
22
−
22
View file @
4ba69065
...
...
@@ -43,6 +43,7 @@ import java.sql.SQLException;
import
java.sql.Types
;
import
java.util.HashMap
;
import
java.util.Map.Entry
;
import
java.util.Stack
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
org.jdom2.Element
;
...
...
@@ -70,6 +71,7 @@ public class POV implements EntityFilterInterface {
private
String
refIdsTable
=
null
;
private
final
HashMap
<
String
,
String
>
statistics
=
new
HashMap
<>();
private
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
private
Stack
<
String
>
prefix
=
new
Stack
<>();
private
Unit
getUnit
(
final
String
s
)
throws
ParserException
{
return
CaosDBSystemOfUnits
.
getUnit
(
s
);
...
...
@@ -88,6 +90,7 @@ public class POV implements EntityFilterInterface {
final
String
operator
,
final
String
value
,
final
String
aggregate
)
{
prefix
.
add
(
"POV"
);
if
(
property
!=
null
&&
property
.
type
!=
Query
.
Pattern
.
TYPE_NORMAL
)
{
throw
new
UnsupportedOperationException
(
"Regular Expression and Like Patterns are not implemented for properties yet."
);
...
...
@@ -213,7 +216,9 @@ public class POV implements EntityFilterInterface {
this
.
connection
=
query
.
getConnection
();
this
.
targetSet
=
query
.
getTargetSet
();
prefix
.
add
(
"#initPOV"
);
initPOV
(
query
);
prefix
.
pop
();
// applyPOV(sourceSet, targetSet, propertiesTable, refIdsTable, o,
// vText, vInt,
...
...
@@ -315,15 +320,16 @@ public class POV implements EntityFilterInterface {
}
else
{
callPOV
.
setNull
(
15
,
VARCHAR
);
}
prefix
.
add
(
"#executeStmt"
);
executeStmt
(
callPOV
,
query
);
prefix
.
pop
();
callPOV
.
close
();
}
catch
(
final
SQLException
e
)
{
logger
.
error
(
"This POV filter caused an error: "
+
this
.
toString
());
throw
new
QueryException
(
e
);
}
query
.
addBenchmark
(
this
.
getClass
().
getSimpleName
(
),
System
.
currentTimeMillis
()
-
t1
);
query
.
addBenchmark
(
measurement
(
""
),
System
.
currentTimeMillis
()
-
t1
);
}
private
void
initPOV
(
final
QueryInterface
query
)
throws
SQLException
{
...
...
@@ -350,7 +356,7 @@ public class POV implements EntityFilterInterface {
}
}
final
long
t2
=
System
.
currentTimeMillis
();
query
.
addBenchmark
(
getClass
().
getSimpleName
()
+
".initPOVRefidsTable()"
,
t2
-
t1
);
query
.
addBenchmark
(
measurement
(
".initPOVRefidsTable()"
)
,
t2
-
t1
);
try
(
PreparedStatement
stmt
=
query
.
getConnection
().
prepareCall
(
"call initPOVPropertiesTable(?,?,?)"
))
{
// initPOVPropertiesTable(in pid INT UNSIGNED, in pname
...
...
@@ -385,36 +391,28 @@ public class POV implements EntityFilterInterface {
final
long
st5
=
rs
.
getLong
(
"t5"
);
final
long
st6
=
rs
.
getLong
(
"t6"
);
if
(
st2
-
st1
>
0
)
{
query
.
addBenchmark
(
getClass
().
getSimpleName
()
+
".initPOVPropertiesTable()#initPropertiesTableByName"
,
st2
-
st1
);
query
.
addBenchmark
(
measurement
(
"#initPropertiesTableByName"
),
st2
-
st1
);
}
if
(
st3
-
st2
>
0
)
{
query
.
addBenchmark
(
getClass
().
getSimpleName
()
+
".initPOVPropertiesTable()#initPropertiesTableById"
,
st3
-
st2
);
query
.
addBenchmark
(
measurement
(
"#initPropertiesTableById"
),
st3
-
st2
);
}
if
(
st4
-
st3
>
0
)
{
query
.
addBenchmark
(
getClass
().
getSimpleName
()
+
".initPOVPropertiesTable()#getChildren"
,
st4
-
st3
);
query
.
addBenchmark
(
measurement
(
"#getChildren"
),
st4
-
st3
);
}
if
(
st5
-
st4
>
0
)
{
query
.
addBenchmark
(
getClass
().
getSimpleName
()
+
".initPOVPropertiesTable()#findReplacements"
,
st5
-
st4
);
query
.
addBenchmark
(
measurement
(
"#findReplacements"
),
st5
-
st4
);
}
if
(
st6
-
st5
>
0
)
{
query
.
addBenchmark
(
getClass
().
getSimpleName
()
+
".initPOVPropertiesTable()#addReplacements"
,
st6
-
st5
);
query
.
addBenchmark
(
measurement
(
"#addReplacements"
),
st6
-
st5
);
}
}
}
final
long
t3
=
System
.
currentTimeMillis
();
query
.
addBenchmark
(
getClass
().
getSimpleName
()
+
".initPOVPropertiesTable()"
,
t3
-
t2
);
query
.
addBenchmark
(
measurement
(
""
)
,
t3
-
t2
);
if
(
this
.
refIdsTable
!=
null
)
{
query
.
getQuery
().
applyQueryTemplates
(
query
,
this
.
refIdsTable
);
query
.
addBenchmark
(
getClass
().
getSimpleName
()
+
".applyQueryTemplates()"
,
System
.
currentTimeMillis
()
-
t3
);
query
.
addBenchmark
(
measurement
(
".applyQueryTemplates()"
),
System
.
currentTimeMillis
()
-
t3
);
}
if
(
hasSubProperty
()
&&
this
.
targetSet
!=
null
)
{
...
...
@@ -434,8 +432,7 @@ public class POV implements EntityFilterInterface {
try
{
final
long
t1
=
System
.
currentTimeMillis
();
final
ResultSet
rs
=
callPOV
.
executeQuery
();
query
.
addBenchmark
(
getClass
().
getSimpleName
()
+
".executeStmt()"
,
System
.
currentTimeMillis
()
-
t1
);
query
.
addBenchmark
(
measurement
(
".callPOV"
),
System
.
currentTimeMillis
()
-
t1
);
if
(
rs
.
next
())
{
final
int
c
=
rs
.
getMetaData
().
getColumnCount
();
for
(
int
i
=
0
;
i
<
c
;
i
++)
{
...
...
@@ -452,8 +449,7 @@ public class POV implements EntityFilterInterface {
if
(
hasSubProperty
())
{
final
long
t2
=
System
.
currentTimeMillis
();
getSubProperty
().
apply
(
query
,
this
.
targetSet
,
this
.
propertiesTable
,
this
.
refIdsTable
);
query
.
addBenchmark
(
getClass
().
getSimpleName
()
+
".applySubProperty()"
,
System
.
currentTimeMillis
()
-
t2
);
query
.
addBenchmark
(
measurement
(
".applySubProperty()"
),
System
.
currentTimeMillis
()
-
t2
);
}
}
catch
(
final
SQLException
e
)
{
if
(
e
.
getMessage
().
trim
().
startsWith
(
"Can't reopen table:"
)
&&
retry
>
this
.
retry_count
++)
{
...
...
@@ -498,4 +494,8 @@ public class POV implements EntityFilterInterface {
public
String
getAggregate
()
{
return
this
.
aggregate
;
}
private
String
measurement
(
String
m
)
{
return
String
.
join
(
""
,
prefix
)
+
m
;
}
}
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