Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Bacheloroppgave_2022
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
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
Eilert Tunheim
Bacheloroppgave_2022
Commits
0a65c153
Commit
0a65c153
authored
3 years ago
by
Karin Pettersen
Browse files
Options
Downloads
Patches
Plain Diff
Finished sort class
parent
c453cc52
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/com/application/DB/Sort.java
+11
-10
11 additions, 10 deletions
src/main/java/com/application/DB/Sort.java
target/classes/com/application/DB/Sort.class
+0
-0
0 additions, 0 deletions
target/classes/com/application/DB/Sort.class
with
11 additions
and
10 deletions
src/main/java/com/application/DB/Sort.java
+
11
−
10
View file @
0a65c153
...
...
@@ -42,18 +42,18 @@ public class Sort {
}
//getFromExistingTable sorts out treespecies, ex, width and height
public
static
void
getFromExistingTable
()
throws
Exception
{
// Step 2: Prepare query job
// A "QueryJob" is a type of job that executes SQL queries
// we create a new job configuration from our SQL query and
final
String
GET_WORD_COUNT
=
"SELECT InTidTork, UtTidTork FROM sf-drying-optimization.124.int_gs_ds_sipalpackages "
+
"INNER JOIN sf-drying-optimization.124.int_dk_valmaticsdryingbatches ON sf-drying-optimization.124.int_gs_ds_sipalpackages.InTidTork = "
+
"sf-drying-optimization.124.int_dk_valmaticsdryingbatches.CalculatedStart"
+
"WHERE Name Like '%Gran%' OR Name LIKE '%2ex%' OR Name LIKE '%47x175%"
+
"AND BETWEEN \"2021-08-17\" AND \"2020-08-29\" ORDER BY InTidTork"
+
"LIMIT 100"
;
final
String
GET_WORD_COUNT
=
"SELECT Name, CalculatedStart, CalculatedStop FROM `sf-drying-optimization.124.int_dk_valmaticsdryingbatches`"
+
"WHERE Name Like \"%Gran%\" AND Name Like \"%3ex%\" AND NAME Like \"%47x150%\" AND DATE(CalculatedStart) "
+
"BETWEEN \"2018-08-17\" AND \"2022-08-30\" ORDER BY DATE(CalculatedStart)"
;
QueryJobConfiguration
queryConfig
=
QueryJobConfiguration
.
newBuilder
(
GET_WORD_COUNT
).
build
();
...
...
@@ -77,15 +77,16 @@ public class Sort {
// Step 4: Display results
// Print out a header line, and iterate through the
// query results to print each result in a new line
System
.
out
.
println
(
"
Timestamp\tVarient value
"
);
System
.
out
.
println
(
"
Name\tCalculatedStarted\tCalculatedStop
"
);
TableResult
result
=
queryJob
.
getQueryResults
();
for
(
FieldValueList
row
:
result
.
iterateAll
())
{
// We can use the `get` method along with the column
// name to get the corresponding row entry
int
variantValue
=
row
.
get
(
"VariantValue"
).
getNumericValue
().
intValue
();
String
timeStamp
=
row
.
get
(
"TimeStamp"
).
getStringValue
();
System
.
out
.
printf
(
"%s\t%d\n"
,
timeStamp
,
variantValue
);
String
name
=
row
.
get
(
"Name"
).
getStringValue
();
String
calculatedStart
=
row
.
get
(
"CalculatedStart"
).
getStringValue
();
String
calculatedStop
=
row
.
get
(
"CalculatedStop"
).
getStringValue
();
System
.
out
.
printf
(
"%s\t%s\t%s\n"
,
name
,
calculatedStart
,
calculatedStop
);
}
...
...
This diff is collapsed.
Click to expand it.
target/classes/com/application/DB/Sort.class
+
0
−
0
View file @
0a65c153
No preview for this file type
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