Skip to content
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

Document Data Model & Mongo Query Language #358

Merged
merged 278 commits into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
278 commits
Select commit Hold shift + click to select a range
2b7f09d
added alpha version of MQL parser
datomo Jun 12, 2021
f1dc2a6
added Mql to transaction, not yet tested, todo: add to interface/ui
datomo Jun 12, 2021
a2769dc
enabled parsing of mql queries to MqlNode tree
datomo Jun 12, 2021
69902c2
exchanged own BsonDocument with mongodb BsonDocument
datomo Jun 13, 2021
1bc9d95
adjusted getCollection logic and fixed parser bugs
datomo Jun 13, 2021
85a758b
adjusting filter logic for parser, added some examples for ddl and ot…
datomo Jun 13, 2021
6e08c69
extended mql logic, which would allow to peform relational queries (p…
datomo Jun 14, 2021
9383c00
example for ddl (createCollection)
datomo Jun 15, 2021
da3a52c
example for parsing dql
datomo Jun 15, 2021
d58d4db
some testing with filter
datomo Jun 16, 2021
b0bf77b
simple find with filter and projections work
datomo Jun 18, 2021
7c9e6dd
enabled $match and $project for aggregate rest still missing
datomo Jun 18, 2021
32fe500
correct channing of different aggregates
datomo Jun 19, 2021
0fb9b8d
correct parsing of side-by-side documents
datomo Jun 20, 2021
f2dfbfe
correct parsing of $in and $nin
datomo Jun 21, 2021
dd76207
re-inclusion of all stores
datomo Jun 21, 2021
a05017b
added github label workaround
datomo Jun 21, 2021
edfe8a5
Minor improvements of code formatting
vogti Jun 21, 2021
9708b56
potential fix if user.home does not exist
datomo Jun 21, 2021
5888fa2
Merge branch 'mongodb-adapter' of https://github.com/polypheny/Polyph…
datomo Jun 21, 2021
f466c97
check for FilesystemManger permission
datomo Jun 21, 2021
0eac0c3
adding calls to FileSystemManager to FileStore
datomo Jun 24, 2021
552a167
parent folder creation test
datomo Jun 24, 2021
cdc2061
adjusting init of root folder
datomo Jun 24, 2021
368f646
adding backup location for .polypheny folder
datomo Jun 24, 2021
7bba867
adjusting iterative folder creation
datomo Jun 24, 2021
57ace55
minor fix
datomo Jun 24, 2021
f79df86
trying to set dir to writable
datomo Jun 24, 2021
fde93a9
adjusting workflow
datomo Jun 25, 2021
6981a57
removed old code
datomo Jun 25, 2021
2d22585
excluding not working tests for cassandra
datomo Jun 25, 2021
5ba4eb4
adjusting docker workflow
datomo Jun 25, 2021
c2d9d33
adding $not, $or, $nor, $and
datomo Jun 30, 2021
24307d8
fixing merge conflicts
datomo Jun 30, 2021
0e1d091
rearrangements and initial insert logic
datomo Jun 30, 2021
4921313
Minor improvements of code formatting
vogti Jul 1, 2021
bf25c02
Fix issue with BigDecimals on file store
vogti Jul 1, 2021
e544b23
adding logic to move .polypheny to any location specified via env var…
datomo Jul 1, 2021
7f20715
adjusting workflow order
datomo Jul 1, 2021
392919d
adding workflow step to create folders
datomo Jul 1, 2021
6e95bd7
split mkdir
datomo Jul 1, 2021
de54990
Merge branch 'mongodb-adapter' of https://github.com/polypheny/Polyph…
datomo Jul 1, 2021
5362ba2
removed print statement
datomo Jul 1, 2021
ecb557c
Merge branch 'mongodb-adapter' of https://github.com/polypheny/Polyph…
datomo Jul 1, 2021
8353dfa
Insert default values when adding column in file store
vogti Jul 1, 2021
a8b53ac
passing dynamicRowType for document model
datomo Jul 2, 2021
665874e
started working on fixed data field approach
datomo Jul 4, 2021
329f0bc
fixed merge conflicts
datomo Jul 4, 2021
72be73f
Add view tests to CI workflow
vogti Jul 4, 2021
a5c1747
fixed missing q10 test and added retry to workflows
datomo Jul 5, 2021
9c8f670
adjusting workflow timeout
datomo Jul 5, 2021
a75f632
adjusting workflow timeouts and proposed change for calculation in Te…
datomo Jul 5, 2021
709a4a6
adjusting logic for more complex queries (ComplexViewTest)
datomo Jul 5, 2021
50c2b30
adjusting array logic and complex rexCall matches
datomo Jul 6, 2021
e0e554e
Move drop view into finally-block in arrayTypesViewTest
vogti Jul 7, 2021
b13e802
Move drop view into finally-block in viewTestTypes
vogti Jul 7, 2021
91e5546
Fix issue in tests
vogti Jul 7, 2021
6be105a
Fix drop view statement
vogti Jul 7, 2021
dc2523c
Merge branch 'master' of https://github.com/polypheny/Polypheny-DB in…
datomo Jul 7, 2021
a143f66
fixed all ComplexViewTest for MongoDB and adjusted workloads(retry fo…
datomo Jul 7, 2021
6b8ee66
Improve dropping of tables in ComplexViewTest
vogti Jul 7, 2021
e891d68
Merge remote-tracking branch 'origin/mongodb-adapter' into mongodb-ad…
vogti Jul 7, 2021
79649b2
excluding view tests for stores, which dont support them yet
datomo Jul 7, 2021
28f4e80
Merge branch 'mongodb-adapter' of https://github.com/polypheny/Polyph…
datomo Jul 7, 2021
04fbf7a
adjusting transaction timeout for mongodb
datomo Jul 7, 2021
f440176
fixing merge conflicts with branch mongodb-adapter
datomo Jul 7, 2021
364e7b6
Further improve dropping of tables in ComplexViewTest
vogti Jul 7, 2021
7ac3fef
added setting to adjust transactionLifetimeSeconds
datomo Jul 7, 2021
d12c8e9
Fix complex view test on Postgres
vogti Jul 7, 2021
cecdc81
Merge remote-tracking branch 'origin/mongodb-adapter' into mongodb-ad…
vogti Jul 7, 2021
ab9ddb9
dockerManager appends _test for testContainers and resets them
datomo Jul 7, 2021
9ffce63
reset testContainer allways
datomo Jul 7, 2021
5cc0f2c
Enable ComplexViewTest for postgres
vogti Jul 7, 2021
1e0c902
Merge remote-tracking branch 'origin/mongodb-adapter' into mongodb-ad…
vogti Jul 7, 2021
0286122
Fix failing tests
vogti Jul 7, 2021
2a04649
added logic for documents to be inserted in non-doc and doc stores
datomo Jul 7, 2021
6c36b72
Fix issues with casts in MonetDB
vogti Jul 9, 2021
1814eb6
Fix issues with column names containing schema in MonetDB
vogti Jul 9, 2021
c94dc33
Fix issues with column names containing schema in MonetDB
vogti Jul 9, 2021
78bef7b
Parameterize dml queries
vogti Jul 9, 2021
bce26fe
Improve dialect definition and improve complex view test
vogti Jul 7, 2021
ed26ca3
Improve complex view test
vogti Jul 10, 2021
2c94f43
Improve stability of docker integration for tests
datomo Jul 10, 2021
1255074
Adjust HSQLDB dialect
vogti Jul 10, 2021
070fb5b
Add config options for query parameterization
vogti Jul 10, 2021
8b2c6b7
Merge branch 'dml-parameterization' into mongodb-adapter
vogti Jul 10, 2021
189a2a2
Improve handling of PolyType File
vogti Jul 10, 2021
287aa1c
Merge branch 'dml-parameterization' into mongodb-adapter
vogti Jul 10, 2021
a758d1e
Update excludes
vogti Jul 10, 2021
7da08d6
added hardcoded cast for querying json when not supported, allows to …
datomo Jul 10, 2021
fcbfa51
proper querying of sub-documents
datomo Jul 11, 2021
45921cf
added testing setup for mql parsing and mql2rel, implemented $exists
datomo Jul 11, 2021
a5b9f34
added tests for comparisons, added $in and $nin
datomo Jul 11, 2021
a5f6427
added signature for future testing of mql2rel
datomo Jul 12, 2021
196791b
added way to allow math operations as literals
datomo Jul 12, 2021
b985bd4
finished complete find query, todo projection
datomo Jul 13, 2021
4a0466b
Restore list of keywords
vogti Jul 13, 2021
d6d8241
Upgrade avatica and jdbc driver
vogti Jul 13, 2021
1e27c1c
Improve jdbc array support
vogti Jul 13, 2021
2d5860c
Enable some tests
vogti Jul 13, 2021
05ff84d
Improve test helper
vogti Jul 13, 2021
f252410
Disable some tests
vogti Jul 13, 2021
fee8787
Update tests
vogti Jul 13, 2021
c4bddc5
Fix cottontail adapter
vogti Jul 13, 2021
2a6de8f
Enable some tests
vogti Jul 13, 2021
203c214
Migrate to DateString, TimeString and TimestampString for parameter v…
vogti Jul 13, 2021
102c4e8
Exclude test
vogti Jul 13, 2021
313d82c
Restore list of keywords
vogti Jul 13, 2021
e21ba9c
Upgrade avatica and jdbc driver
vogti Jul 13, 2021
946698d
Improve jdbc array support
vogti Jul 13, 2021
4de402a
Improve test helper
vogti Jul 13, 2021
8453fb1
Update tests
vogti Jul 13, 2021
8a4dc81
Fix cottontail adapter
vogti Jul 13, 2021
fba4226
Migrate to DateString, TimeString and TimestampString for parameter v…
vogti Jul 13, 2021
34e0ded
Merge branch 'dml-parameterization' into mongodb-adapter
vogti Jul 13, 2021
d2b6693
Merge branch 'master' into mongodb-adapter
vogti Jul 13, 2021
59f04fd
fixed merge conflicts
datomo Jul 14, 2021
c29879f
Update formatting
vogti Jul 14, 2021
dd2a8c5
Further improve formatting
vogti Jul 14, 2021
ca88752
Update year in copyright for changes of PR #345
vogti Jul 14, 2021
6b7ac09
Remove class path in query mongodb query plans displayed in the ui
vogti Jul 14, 2021
92d2e1b
fixed failing tests
datomo Jul 14, 2021
edcc266
Merge remote-tracking branch 'origin/mongodb-adapter' into mongodb-ad…
datomo Jul 14, 2021
ce741fe
minor reformatting
datomo Jul 14, 2021
5ef6762
changed default value for trx lifetime
datomo Jul 14, 2021
755c7e1
fixed merge conflicts
datomo Jul 14, 2021
cad6fb1
prototyping filter json_function
datomo Jul 15, 2021
467e39a
added projection and testes for it
datomo Jul 16, 2021
98420ff
finished element query operators, added $type function
datomo Jul 17, 2021
c119d02
added regex parsing for mql
datomo Jul 17, 2021
5aed6f3
finished $all operator and fixed some array stuff in mongodb adapter
datomo Jul 18, 2021
0f7d103
added $slice
datomo Jul 18, 2021
5d27ec3
added unprojected handling of $addFields
datomo Jul 18, 2021
8487ce8
started with $group
datomo Jul 19, 2021
b9d4635
Merge branch 'master' of https://github.com/polypheny/Polypheny-DB in…
datomo Jul 19, 2021
24fe9e5
fixes added signatures for sort,limit,skip
datomo Jul 20, 2021
2f1e24b
added $order as aggregation stage
datomo Jul 20, 2021
30e2c87
adding ddl for creating schema/db and dql and dml one, many logic
datomo Jul 21, 2021
be598f6
added different dml and ddl nodes
datomo Jul 22, 2021
18534b4
added update and rewrote parsing
datomo Jul 23, 2021
e0f3e99
added own enumerable, which allows to dynamicly match array elements …
datomo Jul 24, 2021
56c58ab
fixing tests and excluding needed build files
datomo Jul 24, 2021
1428a22
minor change
datomo Jul 24, 2021
783bc76
added $unwind enumerable to allow unwinding arrays into multiple rows
datomo Jul 25, 2021
e32a502
fixing query analysis for mql queries
datomo Jul 25, 2021
0203bf9
different clean up and refactoring
datomo Jul 25, 2021
9abaf03
started directly implementing doc into MongoDB adapter
datomo Jul 26, 2021
fb2760a
implemented all doc logic except update in mongodb adapter
datomo Jul 26, 2021
5e98f28
fixed backend validation of json
datomo Jul 26, 2021
06ad2a4
fixed inserts via gui, and console
datomo Jul 27, 2021
a765124
added singleMathOperators
datomo Jul 27, 2021
b3e177a
added doc updates where possible in MongoDB adapter
datomo Jul 27, 2021
86fc2a0
added defaultDatabase parameter from frontend
datomo Jul 27, 2021
0a7ac57
rewrote document update parsing to work correctly in MongoDB adapter
datomo Jul 28, 2021
be218b6
changed default store back for tests
datomo Jul 28, 2021
602d11e
fixed missing setting in MongoDB adapter
datomo Jul 28, 2021
b5a98c7
auto-generation of ddl for dmls according to mql standard
datomo Jul 28, 2021
16a2970
fixed multiple error when working with ui options
datomo Jul 28, 2021
58d38a6
minor fix to show dbs
datomo Jul 28, 2021
d92480f
fixed parser error
datomo Jul 28, 2021
1eaacb0
removed prints
datomo Jul 30, 2021
0b73431
removed trxLifetimeLimit for now
datomo Jul 30, 2021
32055e0
fixed mongo version
datomo Jul 30, 2021
0533108
minor fix for ddl parsing
datomo Jul 31, 2021
ca13f24
fixed $exists, $replaceRoot, $replaceWith
datomo Aug 2, 2021
67cb8e4
refactored filter to handle doc conditions
datomo Aug 4, 2021
40d8de0
fixed mql2relfindtest
datomo Aug 4, 2021
a60040a
mongoql http interface for testing prototype
datomo Aug 4, 2021
ba5e6b6
testing setup for testing mongoQl, query tests
datomo Aug 5, 2021
90dfef7
added more test functions, aggregate stages
datomo Aug 5, 2021
9872552
testing of $addToFields, $count;$group started
datomo Aug 8, 2021
6cb6460
additional $group tests
datomo Aug 8, 2021
38384bc
fixed aggregates for mongodb adapter and non-document adapters
datomo Aug 10, 2021
fd478a5
fixes last tests
datomo Aug 10, 2021
653bfc4
fixed multiple errors on insert, find and aggregation queries
datomo Aug 11, 2021
bcf3369
adjustments to enable other stores correctly and fix edge-cases
datomo Aug 12, 2021
f074a8d
adjusted exclusion for cassandra
datomo Aug 12, 2021
3366883
wrong default store
datomo Aug 12, 2021
f159b2b
enabled view for mql and fixed timeout bug
datomo Aug 12, 2021
f089b62
timeout adjustment
datomo Aug 12, 2021
c1ae003
timeout adjustment
datomo Aug 12, 2021
4fae84d
adjusted commit time
datomo Aug 12, 2021
ebc1335
adjusted timeouts
datomo Aug 12, 2021
9ec1e38
fixed sessions leak bug
datomo Aug 12, 2021
6f24aed
some security for sessionsmap
datomo Aug 12, 2021
eeebc70
fixed views for mql
datomo Aug 12, 2021
4bb2d59
enabled view
datomo Aug 13, 2021
8549040
fixed merge conflicts
datomo Aug 15, 2021
f20f520
adding javadoc, missing tests and multiple bugs
datomo Aug 17, 2021
b899c6d
changed default store back
datomo Aug 17, 2021
b9aa3e8
Refactoring and adding more comments
datomo Aug 17, 2021
aa35360
fixed wrong signature for convert
datomo Aug 17, 2021
236da06
fixed merge conflicts
datomo Aug 18, 2021
232173f
adjustments for parsing bugs, comments, fixes
datomo Aug 18, 2021
4b6763f
fixed cases of wrong casts
datomo Aug 20, 2021
0dc0796
renaming, fixed tests, comments
datomo Aug 20, 2021
f2d0e0d
additional comments
datomo Aug 29, 2021
509d1d4
fixed merge conflicts
datomo Sep 1, 2021
090cd15
fixed missing logic with new branch, removed some of mongodbExcluded
datomo Sep 1, 2021
26bd211
fixed caseTest
datomo Sep 1, 2021
459e6f2
fixed functions, date functions, removed multiple MongoDBExcludes
datomo Sep 2, 2021
8368834
fixed castTest
datomo Sep 2, 2021
d1f8a76
fixed nestedSelectTest
datomo Sep 3, 2021
9feb47b
fixed all failing tests and removed MongoDBExclude
datomo Sep 5, 2021
29cf520
more comments, adjustments when querying relational schema from mql
datomo Sep 6, 2021
6158254
finalizing comments for MqlToRelConverter
datomo Sep 9, 2021
6ce9a3e
minor adjustment for uml builder requests
datomo Sep 15, 2021
f9558e1
added missing javadocs, fixed todos and extracted document crud methods
datomo Sep 30, 2021
ab6a55a
Added disabling for single Transaction
datomo Oct 14, 2021
39b5445
Merge branch 'master' of https://github.com/polypheny/Polypheny-DB in…
datomo Oct 15, 2021
46a4270
fixed invert of useCache statement
datomo Oct 15, 2021
d665e0c
fixed avg bug in mongodb
datomo Oct 16, 2021
f4e6cfd
fixed merge conflicts
datomo Oct 18, 2021
714ca07
Re-enable caching and statistics
vogti Oct 19, 2021
0b65334
Re-enable statistics on startup
vogti Oct 19, 2021
d526ca7
Minor changes to code formatting
vogti Oct 19, 2021
83a10d0
Fix typo
vogti Oct 19, 2021
f9c1b7b
Improve formatting and update copyright
vogti Oct 19, 2021
5a2cd35
Minor code improvements
vogti Oct 19, 2021
f57a946
Minor changes
vogti Oct 19, 2021
d8f346b
removed empty docSchema, added DQL
datomo Oct 19, 2021
c143262
added MqlParserPos,fixed schema tests, removed old todos and code
datomo Oct 20, 2021
33b70e4
Update core/src/main/java/org/polypheny/db/sql/validate/DelegatingSco…
datomo Oct 20, 2021
86e6af7
added some missing javadocs, fixed test, removed unused code, fixed m…
datomo Oct 20, 2021
f11e354
Merge branch 'document-schema' of https://github.com/polypheny/Polyph…
datomo Oct 20, 2021
a8c9b0a
fixed placements of non json stores
datomo Oct 20, 2021
03a8f04
correctly sorted mql types and renaming for test execution of rest te…
datomo Oct 22, 2021
6036520
adjusted rest test to not fail in some circumstances
datomo Oct 22, 2021
eebf0c3
Remove unchanged files and minor formatting improvements
vogti Oct 23, 2021
f4b8089
added multiple missing tests for find operations
datomo Oct 23, 2021
ece2e56
fixed failing tests in mongodb, adjusted doc regex to match doc behavior
datomo Oct 23, 2021
496b11c
fixed doc test of cottontail, unordered result
datomo Oct 24, 2021
19d5660
Minor formatting changes and renaming
vogti Oct 24, 2021
6101964
Update year in copyright
vogti Oct 24, 2021
007ef09
fixed missing caching due to new flag, correct handling of some no-ops
datomo Oct 24, 2021
903231d
enabled parametrization and caching for doc correctly
datomo Oct 24, 2021
5974897
adjusted caching of RexCall with doc operator
datomo Oct 24, 2021
073a260
Remove static import
vogti Oct 24, 2021
30c5a87
fixed mod test on mongodb
datomo Oct 24, 2021
aba08d1
Fix dropping of database in MqlTestTemplate
vogti Oct 24, 2021
b2aaabf
Merge remote-tracking branch 'origin/document-schema' into document-s…
vogti Oct 24, 2021
5b34547
removed print statement
datomo Oct 24, 2021
3c42224
missing request parameter
datomo Oct 26, 2021
78629f7
Manually refresh information manager monitoring page
vogti Oct 27, 2021
492b087
added missing blocked statements for document, multiple statement logic
datomo Oct 27, 2021
5cce96a
Merge branch 'document-schema' of https://github.com/polypheny/Polyph…
datomo Oct 27, 2021
2292066
added caching flag for regRequest, fixed limit of mql and queries
datomo Oct 27, 2021
d56847d
correctly allow mql scripts from frontend
datomo Oct 28, 2021
a29e1d6
added missing generated query for dql and dml mql queries
datomo Oct 28, 2021
84c92af
fixed empty find() added json to explore by example
datomo Oct 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 The Polypheny Project
* Copyright 2019-2021 The Polypheny Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -157,19 +157,25 @@ public void implement( CassandraImplementContext context ) {
context.addInsertValues( valuesList );
} else {
context.visitChild( 0, getInput() );
final CassandraRules.RexToCassandraTranslator translator = new CassandraRules.RexToCassandraTranslator( (JavaTypeFactory) getCluster().getTypeFactory(), CassandraRules.cassandraPhysicalFieldNames( getInput().getRowType() ) );
final CassandraRules.RexToCassandraTranslator translator = new CassandraRules.RexToCassandraTranslator(
(JavaTypeFactory) getCluster().getTypeFactory(),
CassandraRules.cassandraPhysicalFieldNames( getInput().getRowType() ) );
final List<Selector> fields = new ArrayList<>();
for ( Pair<RexNode, String> pair : getNamedProjects() ) {
if ( pair.left instanceof RexInputRef ) {
final String name = pair.right;
String name = pair.right;
// getRowType()
// ((RexInputRef) pair.left);
final String originalName = pair.left.accept( translator );
if ( name.startsWith( "_" ) ) {
name = "\"" + name + "\"";
}
fields.add( Selector.column( originalName ).as( name ) );
}
}
context.addSelectColumns( fields );
}
}

}

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2020 The Polypheny Project
* Copyright 2019-2021 The Polypheny Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -95,6 +95,7 @@ public static DataType getDataType( PolyType polyType, UserDefinedType arrayCont
case CHAR:
// TODO: What to return for char?
case VARCHAR:
case JSON:
return DataTypes.TEXT;
case BINARY:
case VARBINARY:
Expand Down Expand Up @@ -494,4 +495,5 @@ private static List<Object> createListForArrays( List<RexNode> operands ) {
}
return list;
}

}
96 changes: 63 additions & 33 deletions catalog/src/main/java/org/polypheny/db/catalog/CatalogImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ private void insertDefaultData() throws GenericCatalogException, UnknownUserExce
if ( !userNames.containsKey( "pa" ) ) {
addUser( "pa", "" );
}
Catalog.defaultUser = systemId;

//////////////
// init database
Expand All @@ -615,13 +616,14 @@ private void insertDefaultData() throws GenericCatalogException, UnknownUserExce
} else {
databaseId = getDatabase( "APP" ).id;
}
Catalog.defaultDatabaseId = databaseId;

//////////////
// init schema

long schemaId;
if ( !schemaNames.containsKey( new Object[]{ databaseId, "public" } ) ) {
schemaId = addSchema( "public", databaseId, 1, SchemaType.RELATIONAL );
schemaId = addSchema( "public", databaseId, 1, SchemaType.getDefault() );
} else {
schemaId = getSchema( "APP", "public" ).id;
}
Expand Down Expand Up @@ -668,6 +670,12 @@ private void insertDefaultData() throws GenericCatalogException, UnknownUserExce
restSettings.put( "port", "8089" );
restSettings.put( "maxUploadSizeMb", "10000" );
addQueryInterface( "rest", "org.polypheny.db.restapi.HttpRestServer", restSettings );

// Add REST interface
Map<String, String> mongoSettings = new HashMap<>();
mongoSettings.put( "port", "2717" );
mongoSettings.put( "maxUploadSizeMb", "10000" );
addQueryInterface( "mongo", "org.polypheny.db.mongoql.MongoQlServer", mongoSettings );
}

try {
Expand All @@ -686,38 +694,38 @@ private void addDefaultCsvColumns( CatalogAdapter csv ) throws UnknownSchemaExce
CatalogSchema schema = getSchema( "APP", "public" );
CatalogTable depts = getTable( schema.id, "depts" );

addDefaultColumn( csv, depts, "deptno", PolyType.INTEGER, null, 1, null );
addDefaultColumn( csv, depts, "name", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 2, 20 );
addDefaultCsvColumn( csv, depts, "deptno", PolyType.INTEGER, null, 1, null );
addDefaultCsvColumn( csv, depts, "name", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 2, 20 );

CatalogTable emps = getTable( schema.id, "emps" );
addDefaultColumn( csv, emps, "empid", PolyType.INTEGER, null, 1, null );
addDefaultColumn( csv, emps, "deptno", PolyType.INTEGER, null, 2, null );
addDefaultColumn( csv, emps, "name", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 3, 20 );
addDefaultColumn( csv, emps, "salary", PolyType.INTEGER, null, 4, null );
addDefaultColumn( csv, emps, "commission", PolyType.INTEGER, null, 5, null );
addDefaultCsvColumn( csv, emps, "empid", PolyType.INTEGER, null, 1, null );
addDefaultCsvColumn( csv, emps, "deptno", PolyType.INTEGER, null, 2, null );
addDefaultCsvColumn( csv, emps, "name", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 3, 20 );
addDefaultCsvColumn( csv, emps, "salary", PolyType.INTEGER, null, 4, null );
addDefaultCsvColumn( csv, emps, "commission", PolyType.INTEGER, null, 5, null );

CatalogTable emp = getTable( schema.id, "emp" );
addDefaultColumn( csv, emp, "employeeno", PolyType.INTEGER, null, 1, null );
addDefaultColumn( csv, emp, "age", PolyType.INTEGER, null, 2, null );
addDefaultColumn( csv, emp, "gender", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 3, 20 );
addDefaultColumn( csv, emp, "maritalstatus", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 4, 20 );
addDefaultColumn( csv, emp, "worklifebalance", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 5, 20 );
addDefaultColumn( csv, emp, "education", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 6, 20 );
addDefaultColumn( csv, emp, "monthlyincome", PolyType.INTEGER, null, 7, null );
addDefaultColumn( csv, emp, "relationshipjoy", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 8, 20 );
addDefaultColumn( csv, emp, "workingyears", PolyType.INTEGER, null, 9, null );
addDefaultColumn( csv, emp, "yearsatcompany", PolyType.INTEGER, null, 10, null );
addDefaultCsvColumn( csv, emp, "employeeno", PolyType.INTEGER, null, 1, null );
addDefaultCsvColumn( csv, emp, "age", PolyType.INTEGER, null, 2, null );
addDefaultCsvColumn( csv, emp, "gender", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 3, 20 );
addDefaultCsvColumn( csv, emp, "maritalstatus", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 4, 20 );
addDefaultCsvColumn( csv, emp, "worklifebalance", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 5, 20 );
addDefaultCsvColumn( csv, emp, "education", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 6, 20 );
addDefaultCsvColumn( csv, emp, "monthlyincome", PolyType.INTEGER, null, 7, null );
addDefaultCsvColumn( csv, emp, "relationshipjoy", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 8, 20 );
addDefaultCsvColumn( csv, emp, "workingyears", PolyType.INTEGER, null, 9, null );
addDefaultCsvColumn( csv, emp, "yearsatcompany", PolyType.INTEGER, null, 10, null );

CatalogTable work = getTable( schema.id, "work" );
addDefaultColumn( csv, work, "employeeno", PolyType.INTEGER, null, 1, null );
addDefaultColumn( csv, work, "educationfield", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 2, 20 );
addDefaultColumn( csv, work, "jobinvolvement", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 3, 20 );
addDefaultColumn( csv, work, "joblevel", PolyType.INTEGER, null, 4, null );
addDefaultColumn( csv, work, "jobrole", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 5, 30 );
addDefaultColumn( csv, work, "businesstravel", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 6, 20 );
addDefaultColumn( csv, work, "department", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 7, 25 );
addDefaultColumn( csv, work, "attrition", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 8, 20 );
addDefaultColumn( csv, work, "dailyrate", PolyType.INTEGER, null, 9, null );
addDefaultCsvColumn( csv, work, "employeeno", PolyType.INTEGER, null, 1, null );
addDefaultCsvColumn( csv, work, "educationfield", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 2, 20 );
addDefaultCsvColumn( csv, work, "jobinvolvement", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 3, 20 );
addDefaultCsvColumn( csv, work, "joblevel", PolyType.INTEGER, null, 4, null );
addDefaultCsvColumn( csv, work, "jobrole", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 5, 30 );
addDefaultCsvColumn( csv, work, "businesstravel", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 6, 20 );
addDefaultCsvColumn( csv, work, "department", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 7, 25 );
addDefaultCsvColumn( csv, work, "attrition", PolyType.VARCHAR, Collation.CASE_INSENSITIVE, 8, 20 );
addDefaultCsvColumn( csv, work, "dailyrate", PolyType.INTEGER, null, 9, null );

// set all needed primary keys
addPrimaryKey( depts.id, Collections.singletonList( getColumn( depts.id, "deptno" ).id ) );
Expand Down Expand Up @@ -745,7 +753,7 @@ private void addDefaultCsvColumns( CatalogAdapter csv ) throws UnknownSchemaExce
}


private void addDefaultColumn( CatalogAdapter csv, CatalogTable table, String name, PolyType type, Collation collation, int position, Integer length ) {
private void addDefaultCsvColumn( CatalogAdapter csv, CatalogTable table, String name, PolyType type, Collation collation, int position, Integer length ) {
if ( !checkIfExistsColumn( table.id, name ) ) {
long colId = addColumn( name, table.id, position, type, null, length, null, null, null, false, collation );
String filename = table.name + ".csv";
Expand All @@ -762,6 +770,15 @@ private void addDefaultColumn( CatalogAdapter csv, CatalogTable table, String na
}


private void addDefaultColumn( CatalogAdapter adapter, CatalogTable table, String name, PolyType type, Collation collation, int position, Integer length ) {
if ( !checkIfExistsColumn( table.id, name ) ) {
long colId = addColumn( name, table.id, position, type, null, length, null, null, null, false, collation );
addColumnPlacement( adapter.id, colId, PlacementType.AUTOMATIC, "col" + colId, table.name, name, null );
updateColumnPlacementPhysicalPosition( adapter.id, colId, position );
}
}


@Override
public void validateColumns() {
CatalogValidator validator = new CatalogValidator();
Expand Down Expand Up @@ -838,8 +855,9 @@ public void deleteDatabase( long databaseId ) {
* @param password of the user
* @return the id of the created user
*/
@Override
public int addUser( String name, String password ) {
CatalogUser user = new CatalogUser( userIdBuilder.getAndIncrement(), name, password );
CatalogUser user = new CatalogUser( userIdBuilder.getAndIncrement(), name, password, 1 );
synchronized ( this ) {
users.put( user.id, user );
userNames.put( user.name, user );
Expand All @@ -849,6 +867,18 @@ public int addUser( String name, String password ) {
}


@Override
public void setUserSchema( int userId, long schemaId ) {
CatalogUser user = getUser( userId );
CatalogUser newUser = new CatalogUser( user.id, user.name, user.password, schemaId );
synchronized ( this ) {
users.put( user.id, newUser );
userNames.put( user.name, newUser );
}
listeners.firePropertyChange( "user", null, user );
}


/**
* Get all databases
* if pattern is specified, only the ones which confirm to it
Expand Down Expand Up @@ -3499,7 +3529,7 @@ public void removePartitionFromGroup( long partitionGroupId, Long partitionId )
* Assign the partition to a new partitionGroup
*
* @param partitionId Partition to move
* @param partitionGroupId New target gorup to move the partion to
* @param partitionGroupId New target group to move the partition to
*/
@Override
public void updatePartition( long partitionId, Long partitionGroupId ) {
Expand Down Expand Up @@ -4161,9 +4191,9 @@ public void deletePartitionPlacement( int adapterId, long partitionId ) {
/**
* Returns a specific partition entity which is placed on a store.
*
* @param adapterId The adapter on which the requested partitions palcement resides
* @param adapterId The adapter on which the requested partitions placement resides
* @param partitionId The id of the requested partition
* @return The requested PartitionPlacement on that store for agiven is
* @return The PartitionPlacement on the specified store
*/
@Override
public CatalogPartitionPlacement getPartitionPlacement( int adapterId, long partitionId ) {
Expand All @@ -4178,7 +4208,7 @@ public CatalogPartitionPlacement getPartitionPlacement( int adapterId, long part


/**
* Returns a list of all Partition Placements which currently reside on a adpater, disregarded of the table.
* Returns a list of all Partition Placements which currently reside on an adapter, disregarded of the table.
*
* @param adapterId The adapter on which the requested partition placements reside
* @return A list of all Partition Placements, that are currently located on that specific store
Expand Down
9 changes: 3 additions & 6 deletions core/_docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,9 @@ The following is a list of SQL keywords. Reserved keywords are **bold**.
**SYSTEM_TIME**,
**SYSTEM_USER**,
**TABLE**,
**TABLESAMPLE**,
TABLE_NAME,
**TEMPERATURE**,
TEMPORARY,
**THEN**,
TIES,
**TABLESAMPLE**, TABLE_NAME,
**TEMPERATURE**, TEMPORARY,
**THEN**, TIES,
**TABLESAMPLE**, TABLE_NAME, TEMPORARY,
**THEN**, TIES,
**TIME**,
Expand Down
34 changes: 28 additions & 6 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ dependencies {

implementation group: "com.drewnoakes", name: "metadata-extractor", version: metadata_extractor_version // Apache 2.0

implementation group: "org.mongodb", name: "mongodb-driver-sync", version: mongodb_driver_sync_version // Apache 2.0

// https://github.com/docker-java/docker-java
implementation group: 'com.github.docker-java', name: 'docker-java', version: java_docker_version // Apache 2.0
implementation group: 'com.github.docker-java', name: 'docker-java-transport-httpclient5', version: java_docker_version //TODO: should probably be independent version in future
Expand Down Expand Up @@ -104,24 +106,43 @@ sourceSets {
}
}

/**
* Additional MongoDB query language Compile Pipeline
*/
task generateFmppSourcesDocument {
inputs.dir("src/main/codegen/templates/mql")
outputs.dir(project.buildDir.absolutePath + "/generated-sources/fmpp")
doLast {
ant.fmpp(configuration: "src/main/codegen/config_doc.fmpp",
sourceRoot: "src/main/codegen/templates/mql",
outputRoot: project.buildDir.absolutePath + "/generated-sources/fmpp/mql")
}
}
task generateParserDocument (type: CompileJavaccTask) {
dependsOn("generateFmppSourcesDocument")
getConventionMapping().map("classpath", { configurations.javacc })
arguments = [static: "false", lookahead: "2"]
inputDirectory = file(project.buildDir.absolutePath + "/generated-sources/fmpp/mql/javacc")
outputDirectory = file(project.buildDir.absolutePath + "/generated-sources/org/polypheny/db/mql/parser/impl")
}

/**
* Compile Pipeline
*/
task generateFmppSources {
inputs.dir("src/main/codegen/templates")
inputs.dir("src/main/codegen/templates/sql")
outputs.dir(project.buildDir.absolutePath + "/generated-sources/fmpp")
doLast {
ant.fmpp(configuration: "src/main/codegen/config.fmpp",
sourceRoot: "src/main/codegen/templates",
outputRoot: project.buildDir.absolutePath + "/generated-sources/fmpp")
sourceRoot: "src/main/codegen/templates/sql",
outputRoot: project.buildDir.absolutePath + "/generated-sources/fmpp/sql")
}
}
task generateParser (type: CompileJavaccTask) {
dependsOn("generateFmppSources")
getConventionMapping().map("classpath", { configurations.javacc })
arguments = [static: "false", lookahead: "2"]
inputDirectory = file(project.buildDir.absolutePath + "/generated-sources/fmpp/javacc")
inputDirectory = file(project.buildDir.absolutePath + "/generated-sources/fmpp/sql/javacc")
outputDirectory = file(project.buildDir.absolutePath + "/generated-sources/org/polypheny/db/sql/parser/impl")
}
task generateJdbcVersionProperties(type: Copy) {
Expand All @@ -130,7 +151,7 @@ task generateJdbcVersionProperties(type: Copy) {
expand(version: project.version, versionMajor: versionMajor, versionMinor: versionMinor, buildTimestamp: new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"))
}
compileJava {
dependsOn("generateParser", "generateJdbcVersionProperties")
dependsOn("generateParserDocument", "generateParser", "generateJdbcVersionProperties")
}


Expand All @@ -148,7 +169,8 @@ javadoc {
options.addBooleanOption("html5", true)
}
// Exclude build dir
exclude "fmpp/javacc/**"
exclude "fmpp/sql/javacc/**"
exclude "fmpp/mql/javacc/**"
}


Expand Down
2 changes: 2 additions & 0 deletions core/src/main/codegen/config.fmpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ data: {
"org.polypheny.db.schema.ColumnStrategy"
"org.polypheny.db.sql.SqlCreate"
"org.polypheny.db.sql.SqlDrop"
"org.polypheny.db.catalog.Catalog.SchemaType"
"org.polypheny.db.sql.ddl.SqlDdlNodes"
"org.polypheny.db.sql.ddl.SqlTruncate"
"org.polypheny.db.sql.ddl.SqlAlterConfig"
Expand Down Expand Up @@ -283,6 +284,7 @@ data: {
"SQL_DECIMAL"
"SQL_DOUBLE"
"SQL_FLOAT"
"SQL_JSON"
"SQL_INTEGER"
"SQL_INTERVAL_DAY"
"SQL_INTERVAL_DAY_TO_HOUR"
Expand Down
37 changes: 37 additions & 0 deletions core/src/main/codegen/config_doc.fmpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This file is an FMPP (http://fmpp.sourceforge.net/) configuration file to allow clients to extend Polypheny-DB's MongoDB query language (MQL) parser to support application specific
# MQL statements
#
# This MQL parser file (DocumentParser.jj) is written in JavaCC and draws inspiration from the original
# sql parser
#
# Parser template file (DocumentParser.jj) along with this file are packaged as part of the polyphenydb-core-<version>.jar under "codegen" directory.


data: {
parser: {
# Generated parser implementation package and class name.
package: "org.polypheny.db.mql.mql.parser.impl",
class: "MqlParserImpl",

# List of additional classes and packages to import.
# Example. "org.polypheny.db.mql.mql.*", "java.util.List".
imports: [
]

# List of new keywords. Example: "DATABASES", "TABLES". If the keyword is not a reserved keyword add it to 'nonReservedKeywords' section.
keywords: [

]
nonReservedKeywords: [

]

includeCompoundIdentifier: true
includeBraces: true
includeAdditionalDeclarations: false
}
}

freemarkerLinks: {
includes: includes/
}
Loading