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

MQTT Query Interface #461

Open
wants to merge 115 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
5857938
Add skeleton
vogti Jun 5, 2023
ddb0b58
Added mqtt client dependency to gradle
NehaSelvan1512 Jun 12, 2023
1ccaa44
coded the connection establishment to broker
NehaSelvan1512 Jun 13, 2023
73ab690
Implemented shutdown method
NehaSelvan1512 Jun 16, 2023
24936a2
Implemented sub, unsub and pub methods
NehaSelvan1512 Jun 16, 2023
2ccdf62
Implemented MonitoringPage
NehaSelvan1512 Jun 17, 2023
247892a
deleted security files
NehaSelvan1512 Jun 17, 2023
c6d0d1b
Renamed Interface to Stream
NehaSelvan1512 Jun 17, 2023
5a26572
Resolved issues coming from name changing of classes
NehaSelvan1512 Jun 18, 2023
477ea76
changed the mqtt client library
NehaSelvan1512 Jun 20, 2023
8721294
added the mqtt client library version as variable
NehaSelvan1512 Jun 22, 2023
2b888db
implemented skeleton of StreamProcessing
NehaSelvan1512 Jun 24, 2023
ec4b9b1
corrected minor things in processMsg method
NehaSelvan1512 Jun 25, 2023
e4953dc
implemented registerTopicFolder and saveMsgInFile methods
NehaSelvan1512 Jun 25, 2023
9684d69
implemented createCollection method
NehaSelvan1512 Jun 27, 2023
f8b5559
resolved problem with inserting changed settings to map settings
NehaSelvan1512 Jun 27, 2023
27b96ba
Reformatted code
NehaSelvan1512 Jun 27, 2023
d5c93e4
optimized and debugged reloadSettings method
NehaSelvan1512 Jun 29, 2023
38035ff
created skeleton of class PolyStream
NehaSelvan1512 Jun 29, 2023
45fe6ed
added namespaces to createCollection
NehaSelvan1512 Jun 29, 2023
097d3a0
implemented the process to get a collection
NehaSelvan1512 Jul 2, 2023
d487f91
added instance variables
NehaSelvan1512 Jul 2, 2023
440400b
started implementing saveContent
NehaSelvan1512 Jul 4, 2023
85c96e0
added PolyStream and connected processMsg with StreamCapture class
NehaSelvan1512 Jul 4, 2023
d6dd1bf
made changes in modifiers and new constructor
NehaSelvan1512 Jul 4, 2023
b118f39
resolved problem of changes in the settings not being permanently saved
NehaSelvan1512 Jul 7, 2023
d7f48aa
Improve update settings fix
vogti Jul 7, 2023
e165e37
inserted option of using default databaseID and userID
NehaSelvan1512 Jul 7, 2023
4b8e37a
added example for doc insert and scan, added dedicate methods in AlgB…
datomo Jul 7, 2023
62b2553
debugged namespace and collection creation logic
NehaSelvan1512 Jul 7, 2023
2d46042
improved trimming of topics coming from UI
NehaSelvan1512 Jul 7, 2023
66385ef
Merge branch 'mqtt-interface' of https://github.com/polypheny/Polyphe…
NehaSelvan1512 Jul 7, 2023
8a2801d
added namespace and type handling
NehaSelvan1512 Jul 9, 2023
3f8ab3c
fixed minor changes
NehaSelvan1512 Jul 9, 2023
805a691
included MqttTopic objects
NehaSelvan1512 Jul 11, 2023
9fe13b4
debugging of reloadSettings method
NehaSelvan1512 Jul 11, 2023
e4e9d0b
Revert "debugging of reloadSettings method"
NehaSelvan1512 Jul 12, 2023
68be5dd
Revert "included MqttTopic objects"
NehaSelvan1512 Jul 12, 2023
adf1278
reverted changes made because of MqttTopic
NehaSelvan1512 Jul 13, 2023
7ba81bc
Debugging of insertDocument ongoing
NehaSelvan1512 Jul 16, 2023
324409e
skeleton of StreamProcessing added
NehaSelvan1512 Jul 16, 2023
608e7c6
fixed issue with insertDocument
NehaSelvan1512 Jul 17, 2023
d7d94e2
changed Module of MqttStreamProcessor
NehaSelvan1512 Jul 17, 2023
75956c0
added StreamMessage to module stream
NehaSelvan1512 Jul 17, 2023
8220800
added getStreamProcessor method
NehaSelvan1512 Jul 17, 2023
7dedc4f
integrated MqttMessage objects in existing code
NehaSelvan1512 Jul 17, 2023
ff33451
Reformatted files
NehaSelvan1512 Jul 17, 2023
5a01216
added EntityType STREAM
NehaSelvan1512 Jul 17, 2023
2c0113d
integrated MqttMessage objects in MqttStreamProcessor
NehaSelvan1512 Jul 17, 2023
0cc5df6
changed constructor parameter from TransactionManager to Transaction
NehaSelvan1512 Jul 18, 2023
e1bd401
change of StreamProcessorImpl constructor
NehaSelvan1512 Jul 18, 2023
cd72d1c
fixed accessing StreamProcessorImpl from MqttStreamProcessor
NehaSelvan1512 Jul 18, 2023
71bd1d7
changed topics List to a ConcurrentHashMap
NehaSelvan1512 Jul 18, 2023
81b13a8
Monitoring Page now shows recent messages
NehaSelvan1512 Jul 19, 2023
5088320
added a reconnect button
NehaSelvan1512 Jul 20, 2023
d777da6
corrected code adding placements
NehaSelvan1512 Jul 20, 2023
52501f6
moved creating collections to MqttInterface
NehaSelvan1512 Jul 20, 2023
04d1fee
implemented message count for each topic
NehaSelvan1512 Jul 20, 2023
c017cac
implemented a option to save all messages in one collection
NehaSelvan1512 Jul 21, 2023
599f418
imploved Monitoring Page
NehaSelvan1512 Jul 21, 2023
add043a
small fixes
NehaSelvan1512 Jul 21, 2023
7671e87
minor fixes and reformatted file
NehaSelvan1512 Jul 27, 2023
db2757f
Minor fixes
NehaSelvan1512 Jul 27, 2023
b0fe5d0
made both classes independent of ids
NehaSelvan1512 Jul 27, 2023
40a6cd7
debugging
NehaSelvan1512 Jul 28, 2023
f3cda56
inserted field source
NehaSelvan1512 Jul 28, 2023
97a9d9f
added function to create all necessary collections in reload method
NehaSelvan1512 Jul 29, 2023
a88e584
implemented queue for messages
NehaSelvan1512 Jul 29, 2023
8138aca
resolving concurrency
NehaSelvan1512 Jul 29, 2023
4fdeeb2
Minor fix
NehaSelvan1512 Jul 30, 2023
54b0993
deleted unused methods
NehaSelvan1512 Jul 30, 2023
8a5a9c8
ssl code added but commented
NehaSelvan1512 Aug 7, 2023
76c8e34
comment ssl conn code
NehaSelvan1512 Aug 7, 2023
15687e2
integrated universal lock for concurrency
NehaSelvan1512 Aug 7, 2023
4ea38ff
started testing environment
NehaSelvan1512 Aug 31, 2023
af47b78
StreamProcessor in progress
NehaSelvan1512 Sep 3, 2023
32dc64e
minor changes
NehaSelvan1512 Sep 3, 2023
db647fe
fixed test and filtering
datomo Sep 4, 2023
8b2c078
changed ModelTrait to Document
NehaSelvan1512 Sep 5, 2023
e49b725
changed structure of convert method & added '$$ROOT' as operator
NehaSelvan1512 Sep 5, 2023
202d39a
finished implementing and testing
NehaSelvan1512 Sep 8, 2023
2d5628f
Deleted PolyStream class
NehaSelvan1512 Sep 8, 2023
2380174
reformatted code
NehaSelvan1512 Sep 8, 2023
38b1528
made various changes
NehaSelvan1512 Sep 10, 2023
baf6eb3
cleaned up code
NehaSelvan1512 Sep 10, 2023
da2f9c8
added mockito
NehaSelvan1512 Sep 10, 2023
6075479
various changes, see description
NehaSelvan1512 Sep 12, 2023
db22a1d
MQTT version 5, create topic collection in constructor, added automa…
NehaSelvan1512 Sep 13, 2023
11302ba
Debugging with Unit tests and added Qos
NehaSelvan1512 Sep 15, 2023
1ef13a8
testing and debugging
NehaSelvan1512 Sep 15, 2023
ce068fc
minor change at prefix for query
NehaSelvan1512 Sep 15, 2023
e3042b4
last time pushing multiple changes at once!!
NehaSelvan1512 Sep 24, 2023
d763c08
fixed find with boolean
NehaSelvan1512 Sep 25, 2023
d24a242
defined Helper class for StreamCapture testing
NehaSelvan1512 Sep 25, 2023
5610f8f
changed variable name message -> payload
NehaSelvan1512 Sep 25, 2023
c359ddf
Debugged code while testing stream capture + mqttClient component
NehaSelvan1512 Sep 27, 2023
f70e933
added getter to topicsMap
NehaSelvan1512 Sep 28, 2023
a13c18d
added workflow for testing a broker in container
NehaSelvan1512 Sep 28, 2023
f413f11
changed version
NehaSelvan1512 Sep 28, 2023
e4b66cc
renamed variable
NehaSelvan1512 Sep 29, 2023
60ee769
removed unnecessary code
NehaSelvan1512 Sep 29, 2023
e834f56
Tests for sub + wildcards and unsub
NehaSelvan1512 Sep 29, 2023
64c8bcd
removed methods related to ssl
NehaSelvan1512 Sep 29, 2023
9b9a570
inserted tests for verifying collection creation
NehaSelvan1512 Sep 29, 2023
38067a5
added getWildcard and catchAllEntity=false tests
NehaSelvan1512 Sep 29, 2023
a1bc339
renamed methods and vars
NehaSelvan1512 Sep 29, 2023
68431a7
inserted query for namespace type
NehaSelvan1512 Sep 29, 2023
6b100d9
fixed dependency problem
NehaSelvan1512 Sep 29, 2023
9a34ee8
minor changes
NehaSelvan1512 Sep 29, 2023
9689011
reformatted files
NehaSelvan1512 Sep 29, 2023
f14cb74
changed test method name and made few modifications
NehaSelvan1512 Sep 30, 2023
7e524ad
fixed mistake in UI
NehaSelvan1512 Oct 8, 2023
002b814
removed forgotten logger
NehaSelvan1512 Oct 8, 2023
5c3723e
cleaned up code
NehaSelvan1512 Oct 16, 2023
15ee90f
removed code related to stream entity
NehaSelvan1512 Oct 17, 2023
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
51 changes: 51 additions & 0 deletions .github/workflows/mqttClientTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Polypheny-DB MQTT Client Test

on:
push: { branches: mqtt-interface }

jobs:
build:
runs-on: ubuntu-latest
name: MQTT Client Tests (Java 17)
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 17
- name: Set env variable
run: |
echo "POLYPHENY_HOME=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Create folders for certs
run: |
mkdir $POLYPHENY_HOME/.polypheny
mkdir $POLYPHENY_HOME/.polypheny/certs

- name: Start Mosquitto broker in docker container
uses: namoshek/mosquitto-github-action@v1
with:
version: '1.6'
ports: '1883:1883'
container-name: 'mqttBroker'

- name: Assemble
uses: nick-invision/retry@v2
with:
max_attempts: 2
timeout_minutes: 60
command: ./gradlew assemble

- name: Build Plugins
uses: nick-invision/retry@v2
with:
max_attempts: 1
timeout_minutes: 60
command: ./gradlew assemblePlugins

- name: Execute MQTT client tests
uses: nick-invision/retry@v2
with:
max_attempts: 1
timeout_minutes: 30
command: ./gradlew mqttTests
9 changes: 8 additions & 1 deletion core/src/main/java/org/polypheny/db/adapter/Adapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.polypheny.db.catalog.entity.CatalogColumnPlacement;
import org.polypheny.db.catalog.entity.CatalogPartitionPlacement;
import org.polypheny.db.catalog.entity.CatalogTable;
import org.polypheny.db.catalog.exceptions.NoTablePrimaryKeyException;
import org.polypheny.db.config.Config;
import org.polypheny.db.config.Config.ConfigListener;
import org.polypheny.db.config.ConfigDocker;
Expand Down Expand Up @@ -406,7 +407,13 @@ public void updateSettings( Map<String, String> newSettings ) {
this.validateSettings( newSettings, false );
List<String> updatedSettings = this.applySettings( newSettings );
this.reloadSettings( updatedSettings );
Catalog.getInstance().updateAdapterSettings( getAdapterId(), newSettings );
Catalog catalog = Catalog.getInstance();
catalog.updateAdapterSettings( getAdapterId(), getCurrentSettings() );
try {
catalog.commit();
} catch ( NoTablePrimaryKeyException e ) {
throw new RuntimeException( e );
}
}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright 2019-2023 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.polypheny.db.adapter.enumerable;

import com.google.common.collect.ImmutableList;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import org.apache.calcite.linq4j.tree.BlockBuilder;
import org.apache.calcite.linq4j.tree.Expression;
import org.apache.calcite.linq4j.tree.Expressions;
import org.apache.calcite.linq4j.tree.Primitive;
import org.bson.BsonValue;
import org.polypheny.db.adapter.java.JavaTypeFactory;
import org.polypheny.db.algebra.core.document.DocumentValues;
import org.polypheny.db.algebra.type.AlgDataType;
import org.polypheny.db.algebra.type.AlgDataTypeField;
import org.polypheny.db.plan.AlgOptCluster;
import org.polypheny.db.plan.AlgTraitSet;
import org.polypheny.db.schema.ModelTrait;
import org.polypheny.db.util.BuiltInMethod;

public class EnumerableDocumentValues extends DocumentValues implements EnumerableAlg {

/**
* Creates a {@link DocumentValues}.
* {@link ModelTrait#DOCUMENT} node, which contains values.
*
* @param cluster
* @param traitSet
* @param rowType
* @param documentTuples
*/
public EnumerableDocumentValues( AlgOptCluster cluster, AlgTraitSet traitSet, AlgDataType rowType, List<BsonValue> documentTuples ) {
super( cluster, traitSet, rowType, ImmutableList.copyOf( documentTuples ) );
}


@Override
public Result implement( EnumerableAlgImplementor implementor, Prefer pref ) {
final JavaTypeFactory typeFactory = (JavaTypeFactory) getCluster().getTypeFactory();
final BlockBuilder builder = new BlockBuilder();
final PhysType physType =
PhysTypeImpl.of(
implementor.getTypeFactory(),
getRowType(),
pref.preferCustom() );
final Type rowClass = physType.getJavaRowType();

final List<Expression> expressions = new ArrayList<>();
final List<AlgDataTypeField> fields = rowType.getFieldList();
for ( BsonValue doc : documentTuples ) {
final List<Expression> literals = new ArrayList<>();

literals.add( Expressions.constant( doc.asDocument().toJson() ) );

expressions.add( physType.record( literals ) );
}
builder.add(
Expressions.return_(
null,
Expressions.call(
BuiltInMethod.AS_ENUMERABLE.method,
Expressions.newArrayInit( Primitive.box( rowClass ), expressions ) ) ) );
return implementor.result( physType, builder.toBlock() );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.polypheny.db.plan.AlgTraitSet;
import org.polypheny.db.plan.Convention;
import org.polypheny.db.rex.RexLiteral;
import org.polypheny.db.schema.ModelTrait;
import org.polypheny.db.type.PolyType;
import org.polypheny.db.type.PolyTypeFactoryImpl;
import org.polypheny.db.util.BsonUtil;
Expand Down Expand Up @@ -77,7 +78,7 @@ public class LogicalDocumentValues extends DocumentValues implements RelationalT
* @param tuples the documents in their native BSON format
*/
public LogicalDocumentValues( AlgOptCluster cluster, AlgDataType defaultRowType, AlgTraitSet traitSet, ImmutableList<BsonValue> tuples ) {
super( cluster, traitSet, defaultRowType, tuples );
super( cluster, traitSet.replace( ModelTrait.DOCUMENT ), defaultRowType, tuples );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import lombok.extern.slf4j.Slf4j;
import org.polypheny.db.adapter.enumerable.EnumerableAggregate;
import org.polypheny.db.adapter.enumerable.EnumerableConvention;
import org.polypheny.db.adapter.enumerable.EnumerableDocumentValues;
import org.polypheny.db.adapter.enumerable.EnumerableFilter;
import org.polypheny.db.adapter.enumerable.EnumerableLimit;
import org.polypheny.db.adapter.enumerable.EnumerableProject;
Expand All @@ -30,6 +31,7 @@
import org.polypheny.db.algebra.logical.document.LogicalDocumentFilter;
import org.polypheny.db.algebra.logical.document.LogicalDocumentProject;
import org.polypheny.db.algebra.logical.document.LogicalDocumentSort;
import org.polypheny.db.algebra.logical.document.LogicalDocumentValues;
import org.polypheny.db.plan.AlgOptRule;
import org.polypheny.db.plan.AlgOptRuleCall;
import org.polypheny.db.plan.AlgOptRuleOperand;
Expand All @@ -43,6 +45,8 @@ public class DocumentToEnumerableRule extends AlgOptRule {
public static DocumentToEnumerableRule FILTER_TO_ENUMERABLE = new DocumentToEnumerableRule( Type.FILTER, operand( LogicalDocumentFilter.class, any() ), "DOCUMENT_FILTER_TO_ENUMERABLE" );
public static DocumentToEnumerableRule SORT_TO_ENUMERABLE = new DocumentToEnumerableRule( Type.SORT, operand( LogicalDocumentSort.class, any() ), "DOCUMENT_SORT_TO_ENUMERABLE" );

public static DocumentToEnumerableRule VALUES_TO_ENUMERABLE = new DocumentToEnumerableRule( Type.VALUES, operand( LogicalDocumentValues.class, any() ), "DOCUMENT_VALUES_TO_ENUMERABLE" );

private final Type type;


Expand All @@ -62,13 +66,26 @@ public void onMatch( AlgOptRuleCall call ) {
convertAggregate( call );
} else if ( type == Type.SORT ) {
convertSort( call );
} else if ( type == Type.VALUES ) {
convertValues( call );
} else {
throw new UnsupportedOperationException( "This document is not supported." );
}

}


private void convertValues( AlgOptRuleCall call ) {
LogicalDocumentValues values = call.alg( 0 );
AlgTraitSet out = values.getTraitSet().replace( EnumerableConvention.INSTANCE );

EnumerableDocumentValues enumerable = new EnumerableDocumentValues( values.getCluster(), out, values.getRowType(), values.documentTuples );
call.transformTo( enumerable );

// call.transformTo( values.getRelationalEquivalent() );
}


private void convertSort( AlgOptRuleCall call ) {
LogicalDocumentSort sort = call.alg( 0 );
AlgTraitSet out = sort.getTraitSet().replace( EnumerableConvention.INSTANCE );
Expand Down
10 changes: 9 additions & 1 deletion core/src/main/java/org/polypheny/db/catalog/Catalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -1233,6 +1233,14 @@ protected final boolean isValidIdentifier( final String str ) {
*/
public abstract void deleteQueryInterface( int ifaceId );

/**
* Update settings of a query interface
*
* @param queryInterfaceId The id of the query interface
* @param newSettings The new settings for the query interface
*/
public abstract void updateQueryInterfaceSettings( int queryInterfaceId, Map<String, String> newSettings );

/**
* Adds a partition to the catalog
*
Expand Down Expand Up @@ -1926,7 +1934,7 @@ public enum EntityType {
SOURCE( 2 ),
VIEW( 3 ),
MATERIALIZED_VIEW( 4 );
// STREAM, ...
//STREAM(5);

private final int id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ public Serializable[] getParameterArray() {
public CatalogCollection addPlacement( int adapterId ) {
List<Integer> placements = new ArrayList<>( this.placements );
placements.add( adapterId );
return new CatalogCollection( databaseId, namespaceId, id, name, placements, EntityType.ENTITY, physicalName );
return new CatalogCollection( databaseId, namespaceId, id, name, placements, entityType, physicalName );
}


public CatalogCollection removePlacement( int adapterId ) {
List<Integer> placements = this.placements.stream().filter( id -> id != adapterId ).collect( Collectors.toList() );
return new CatalogCollection( databaseId, namespaceId, id, name, placements, EntityType.ENTITY, physicalName );
return new CatalogCollection( databaseId, namespaceId, id, name, placements, entityType, physicalName );
}


Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/org/polypheny/db/config/RuntimeConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,21 +159,21 @@ public enum RuntimeConfig {
DYNAMIC_QUERYING(
"statistics/useDynamicQuerying",
"Use statistics for query assistance.",
true,
false,
ConfigType.BOOLEAN,
"statisticSettingsGroup" ),

STATISTICS_ON_STARTUP(
"statistics/statisticsOnStartup",
"Whether to build statistics for all stored data on system startup.",
true,
false,
ConfigType.BOOLEAN,
"statisticSettingsGroup" ),

ACTIVE_TRACKING(
"statistics/activeTracking",
"All transactions are tracked and statistics collected during execution.",
true,
false,
ConfigType.BOOLEAN,
"statisticSettingsGroup" ),

Expand Down Expand Up @@ -418,7 +418,7 @@ public enum RuntimeConfig {
MONITORING_QUEUE_ACTIVE(
"runtime/monitoringQueueActive",
"Enables automatic monitoring of executed events in workload monitoring. If disabled no events are captured, hence the queue remains empty. This also effects routing!",
true,
false,
ConfigType.BOOLEAN,
"monitoringSettingsQueueGroup" ),

Expand Down
17 changes: 16 additions & 1 deletion core/src/main/java/org/polypheny/db/iface/QueryInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.pf4j.ExtensionPoint;
import org.polypheny.db.catalog.Catalog;
import org.polypheny.db.catalog.exceptions.NoTablePrimaryKeyException;
import org.polypheny.db.languages.LanguageManager;
import org.polypheny.db.transaction.TransactionManager;

Expand Down Expand Up @@ -61,10 +64,15 @@ public QueryInterface(
this.authenticator = authenticator;
this.queryInterfaceId = queryInterfaceId;
this.uniqueName = uniqueName;
this.settings = settings;
//this.settings = settings;
this.supportsDml = supportsDml;
this.supportsDdl = supportsDdl;

this.settings = new HashMap<>(settings.size());
for ( Map.Entry<String, String> entry : settings.entrySet()) {
this.settings.put(entry.getKey(), entry.getValue());
}

LanguageManager.getINSTANCE().addObserver( this );
}

Expand Down Expand Up @@ -120,6 +128,13 @@ public void updateSettings( Map<String, String> newSettings ) {
this.validateSettings( newSettings, false );
List<String> updatedSettings = this.applySettings( newSettings );
this.reloadSettings( updatedSettings );
Catalog catalog = Catalog.getInstance();
Catalog.getInstance().updateQueryInterfaceSettings( getQueryInterfaceId(), getCurrentSettings() );
try {
catalog.commit();
} catch ( NoTablePrimaryKeyException e ) {
throw new RuntimeException( e );
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,7 @@ public void registerModelRules() {
addRule( DocumentToEnumerableRule.FILTER_TO_ENUMERABLE );
addRule( DocumentToEnumerableRule.AGGREGATE_TO_ENUMERABLE );
addRule( DocumentToEnumerableRule.SORT_TO_ENUMERABLE );
addRule( DocumentToEnumerableRule.VALUES_TO_ENUMERABLE );

// Relational
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.polypheny.db.algebra.logical.document.LogicalDocumentScan;
import org.polypheny.db.algebra.logical.document.LogicalDocumentSort;
import org.polypheny.db.algebra.logical.document.LogicalDocumentTransformer;
import org.polypheny.db.algebra.logical.document.LogicalDocumentValues;
import org.polypheny.db.algebra.logical.lpg.LogicalGraph;
import org.polypheny.db.algebra.logical.lpg.LogicalLpgAggregate;
import org.polypheny.db.algebra.logical.lpg.LogicalLpgFilter;
Expand Down Expand Up @@ -261,6 +262,11 @@ public AlgNode visit( LogicalDocumentScan scan ) {
return super.visit( scan );
}

public AlgNode visit( LogicalDocumentValues values ) {
hashBasis.add( "LogicalDocumentValues" );
return super.visit( values );
}


@Override
public AlgNode visit( LogicalDocumentSort sort ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,8 @@ private static Object transformBsonToPrimitive( BsonValue doc ) {
return doc.asDocument().entrySet().stream().collect( Collectors.toMap( Entry::getKey, e -> transformBsonToPrimitive( e.getValue() ) ) );
case ARRAY:
return doc.asArray().stream().map( MqlFunctions::transformBsonToPrimitive ).collect( Collectors.toList() );
case BOOLEAN:
return doc.asBoolean().getValue();
default:
return null;
}
Expand Down
Loading
Loading