-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f7dadba
Showing
7 changed files
with
279 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,89 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### JetBrains template | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff: | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/dictionaries | ||
|
||
# Sensitive or high-churn files: | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.xml | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
|
||
# Gradle: | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# CMake | ||
cmake-build-debug/ | ||
cmake-build-release/ | ||
|
||
# Mongo Explorer plugin: | ||
.idea/**/mongoSettings.xml | ||
|
||
## File-based project format: | ||
*.iws | ||
|
||
## Plugin-specific files: | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
### Java template | ||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
### Maven template | ||
target/ | ||
pom.xml.tag | ||
pom.xml.releaseBackup | ||
pom.xml.versionsBackup | ||
pom.xml.next | ||
release.properties | ||
dependency-reduced-pom.xml | ||
buildNumber.properties | ||
.mvn/timing.properties | ||
|
||
# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored) | ||
!/.mvn/wrapper/maven-wrapper.jar | ||
|
This file contains 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,3 @@ | ||
[submodule "data"] | ||
path = data | ||
url = https://github.com/revkov/JAVA.CSV.TEST.git |
This file contains 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,156 @@ | ||
CREATE TABLE raw_data | ||
( | ||
ssoid TEXT, | ||
ts TEXT, | ||
grp TEXT, | ||
atype TEXT, | ||
asubtype TEXT, | ||
url TEXT, | ||
orgid TEXT, | ||
formid TEXT, | ||
code TEXT, | ||
ltpa TEXT, | ||
sudirresponse TEXT, | ||
ymdh TEXT | ||
); | ||
|
||
COPY raw_data (ssoid, ts, grp, atype, asubtype, url, orgid, formid, code, ltpa, sudirresponse, ymdh) | ||
FROM '/var/test_case.csv' | ||
DELIMITER ';' CSV HEADER; | ||
|
||
SELECT DISTINCT asubtype | ||
FROM raw_data; | ||
|
||
SELECT DISTINCT formid | ||
FROM raw_data; | ||
|
||
SELECT | ||
ssoid, | ||
ts, | ||
atype, | ||
asubtype | ||
FROM raw_data | ||
ORDER BY ssoid, ts; | ||
|
||
SELECT DISTINCT formid | ||
FROM raw_data; | ||
SELECT * | ||
FROM raw_data | ||
WHERE formid = '-47' | ||
ORDER BY ssoid, ts; | ||
|
||
SELECT DISTINCT grp | ||
FROM raw_data; | ||
|
||
SELECT | ||
ssoid, | ||
grp, | ||
count(*) | ||
FROM raw_data | ||
GROUP BY ssoid, grp; | ||
|
||
SELECT | ||
grp, | ||
atype, | ||
asubtype, | ||
ts, | ||
ymdh | ||
FROM raw_data | ||
WHERE ssoid = '105e8d6a-03e2-4911-b208-9656d0d88777' | ||
ORDER BY ts; | ||
|
||
SELECT TIMESTAMP 'epoch' + 1499765675 * INTERVAL '1 second'; | ||
|
||
SELECT to_timestamp(1499765675); | ||
|
||
SELECT DISTINCT ssoid | ||
FROM raw_data | ||
WHERE ssoid <> 'Unauthorized' | ||
AND ssoid IS NOT NULL; | ||
|
||
SELECT DISTINCT ymdh | ||
FROM raw_data; | ||
|
||
SELECT | ||
ssoid, | ||
count(formid) | ||
FROM raw_data | ||
GROUP BY ssoid | ||
ORDER BY ssoid; | ||
|
||
SELECT | ||
ssoid, | ||
count(DISTINCT formid) | ||
FROM raw_data | ||
WHERE formid IS NOT NULL | ||
AND formid <> 'null' | ||
GROUP BY ssoid | ||
ORDER BY ssoid; | ||
|
||
SELECT formid | ||
FROM raw_data | ||
WHERE ssoid = '00408b4b-a917-4622-a25c-e445115597a8'; | ||
|
||
SELECT | ||
ssoid, | ||
formid | ||
FROM raw_data | ||
WHERE ssoid <> 'Unauthorized' | ||
AND ssoid IS NOT NULL | ||
AND formid IS NOT NULL | ||
AND formid <> 'null' | ||
GROUP BY ssoid, formid | ||
ORDER BY formid; | ||
|
||
SELECT | ||
formid, | ||
count(*) AS form_count | ||
FROM raw_data | ||
WHERE ssoid <> 'Unauthorized' | ||
AND ssoid IS NOT NULL | ||
AND formid IS NOT NULL | ||
AND formid <> 'null' | ||
GROUP BY formid | ||
ORDER BY form_count DESC | ||
LIMIT 5; | ||
|
||
WITH form_counter AS ( | ||
SELECT | ||
ssoid, | ||
formid | ||
FROM raw_data | ||
WHERE ssoid <> 'Unauthorized' | ||
AND ssoid IS NOT NULL | ||
AND formid IS NOT NULL | ||
AND formid <> 'null' | ||
GROUP BY ssoid, formid | ||
ORDER BY formid | ||
) | ||
SELECT | ||
formid, | ||
count(formid) AS fc | ||
FROM form_counter | ||
GROUP BY formid | ||
ORDER BY fc DESC; | ||
|
||
WITH form_counter AS ( | ||
SELECT | ||
ssoid, | ||
formid | ||
FROM raw_data | ||
WHERE ssoid NOT LIKE 'Unauthorized%' | ||
AND ssoid IS NOT NULL | ||
AND formid IS NOT NULL | ||
AND formid <> 'null' | ||
GROUP BY ssoid, formid | ||
ORDER BY formid | ||
) | ||
SELECT | ||
ssoid, formid | ||
FROM form_counter | ||
GROUP BY ssoid, formid | ||
ORDER BY ssoid; | ||
|
||
SELECT ssoid | ||
FROM raw_data | ||
GROUP BY ssoid; |
This file contains 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,11 @@ | ||
version: '3.1' | ||
|
||
services: | ||
java-csv-task-db: | ||
image: postgres:9-alpine | ||
restart: always | ||
environment: | ||
POSTGRES_PASSWORD: secretpass | ||
ports: | ||
- 5432:5432 | ||
|
This file contains 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,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="WEB_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$" /> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
This file contains 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,10 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>ru.ffyud.trials</groupId> | ||
<artifactId>java-csv-task</artifactId> | ||
<packaging>pom</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>java-csv-task</name> | ||
<url>http://maven.apache.org</url> | ||
</project> |