diff --git a/core/src/main/java/org/polypheny/db/PolyImplementation.java b/core/src/main/java/org/polypheny/db/PolyImplementation.java index f3ed0e0e96..eff55e46fd 100644 --- a/core/src/main/java/org/polypheny/db/PolyImplementation.java +++ b/core/src/main/java/org/polypheny/db/PolyImplementation.java @@ -39,7 +39,7 @@ import org.polypheny.db.algebra.type.AlgDataType; import org.polypheny.db.algebra.type.AlgDataTypeFactory.Builder; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.interpreter.BindableConvention; import org.polypheny.db.monitoring.events.MonitoringType; import org.polypheny.db.monitoring.events.StatementEvent; @@ -64,7 +64,7 @@ public class PolyImplementation { private final long maxRowCount = -1; private final Kind kind; private Bindable bindable; - private final NamespaceType namespaceType; + private final DataModel dataModel; private final ExecutionTimeMonitor executionTimeMonitor; private CursorFactory cursorFactory; private final Convention resultConvention; @@ -83,7 +83,7 @@ public class PolyImplementation { * on access e.g. {@link #getColumns()} * * @param rowType defines the types of the result - * @param namespaceType type of the + * @param dataModel type of the * @param executionTimeMonitor to keep track of different execution times * @param preparedResult nullable result, which holds all info from the execution * @param kind of initial query, which is used to get type of result e.g. DDL, DQL,... @@ -92,14 +92,14 @@ public class PolyImplementation { */ public PolyImplementation( @Nullable AlgDataType rowType, - NamespaceType namespaceType, + DataModel dataModel, ExecutionTimeMonitor executionTimeMonitor, @Nullable PreparedResult preparedResult, Kind kind, Statement statement, @Nullable Convention resultConvention ) { - this.namespaceType = namespaceType; + this.dataModel = dataModel; this.executionTimeMonitor = executionTimeMonitor; this.preparedResult = preparedResult; this.kind = kind; diff --git a/core/src/main/java/org/polypheny/db/adapter/Adapter.java b/core/src/main/java/org/polypheny/db/adapter/Adapter.java index acda9edfaa..31eaff2201 100644 --- a/core/src/main/java/org/polypheny/db/adapter/Adapter.java +++ b/core/src/main/java/org/polypheny/db/adapter/Adapter.java @@ -37,7 +37,7 @@ import org.polypheny.db.catalog.entity.physical.PhysicalEntity; import org.polypheny.db.catalog.entity.physical.PhysicalTable; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.config.Config; import org.polypheny.db.config.Config.ConfigListener; @@ -271,7 +271,7 @@ public void addInformationPhysicalNames() { List physicalsOnAdapter = new ArrayList<>();//snapshot.physical().getPhysicalsOnAdapter( adapterId ); for ( PhysicalEntity entity : physicalsOnAdapter ) { - if ( entity.namespaceType != NamespaceType.RELATIONAL ) { + if ( entity.dataModel != DataModel.RELATIONAL ) { continue; } PhysicalTable physicalTable = (PhysicalTable) entity; diff --git a/core/src/main/java/org/polypheny/db/algebra/AlgNode.java b/core/src/main/java/org/polypheny/db/algebra/AlgNode.java index ea80a1709d..dbe08bf153 100644 --- a/core/src/main/java/org/polypheny/db/algebra/AlgNode.java +++ b/core/src/main/java/org/polypheny/db/algebra/AlgNode.java @@ -45,7 +45,7 @@ import org.polypheny.db.algebra.metadata.Metadata; import org.polypheny.db.algebra.type.AlgDataType; import org.polypheny.db.catalog.entity.LogicalEntity; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.plan.AlgImplementor; import org.polypheny.db.plan.AlgOptCluster; import org.polypheny.db.plan.AlgOptCost; @@ -359,7 +359,7 @@ default AlgNode unfoldView( @Nullable AlgNode parent, int index, AlgOptCluster c return this; } - default NamespaceType getModel() { + default DataModel getModel() { return Objects.requireNonNull( getTraitSet().getTrait( ModelTraitDef.INSTANCE ) ).getDataModel(); } diff --git a/core/src/main/java/org/polypheny/db/algebra/logical/document/LogicalDocumentValues.java b/core/src/main/java/org/polypheny/db/algebra/logical/document/LogicalDocumentValues.java index a970957763..ce04b86bec 100644 --- a/core/src/main/java/org/polypheny/db/algebra/logical/document/LogicalDocumentValues.java +++ b/core/src/main/java/org/polypheny/db/algebra/logical/document/LogicalDocumentValues.java @@ -22,7 +22,7 @@ import org.polypheny.db.algebra.core.document.DocumentValues; import org.polypheny.db.algebra.core.relational.RelationalTransformable; import org.polypheny.db.algebra.type.AlgDataType; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.plan.AlgOptCluster; import org.polypheny.db.plan.AlgTraitSet; import org.polypheny.db.plan.Convention; @@ -83,8 +83,8 @@ public static LogicalDocumentValues createOneTuple( AlgOptCluster cluster ) { @Override - public NamespaceType getModel() { - return NamespaceType.DOCUMENT; + public DataModel getModel() { + return DataModel.DOCUMENT; } diff --git a/core/src/main/java/org/polypheny/db/algebra/rules/AllocationToPhysicalScanRule.java b/core/src/main/java/org/polypheny/db/algebra/rules/AllocationToPhysicalScanRule.java index 4c2a2d7c95..a6b2c4c264 100644 --- a/core/src/main/java/org/polypheny/db/algebra/rules/AllocationToPhysicalScanRule.java +++ b/core/src/main/java/org/polypheny/db/algebra/rules/AllocationToPhysicalScanRule.java @@ -53,7 +53,7 @@ public void onMatch( AlgOptRuleCall call ) { AlgNode newAlg; - switch ( scan.entity.namespaceType ) { + switch ( scan.entity.dataModel ) { case RELATIONAL: newAlg = handleRelationalEntity( call, scan, alloc ); break; @@ -73,7 +73,7 @@ public void onMatch( AlgOptRuleCall call ) { private static AlgNode handleGraphEntity( AlgOptRuleCall call, Scan scan, AllocationEntity alloc ) { AlgNode alg = AdapterManager.getInstance().getAdapter( alloc.adapterId ).getGraphScan( alloc.id, call.builder() ); - if ( scan.getModel() != scan.entity.namespaceType ) { + if ( scan.getModel() != scan.entity.dataModel ) { // cross-model queries need a transformer first, we let another rule handle that alg = call.builder().push( alg ).transform( scan.getTraitSet().getTrait( ModelTraitDef.INSTANCE ), scan.getRowType(), true ).build(); } @@ -84,7 +84,7 @@ private static AlgNode handleGraphEntity( AlgOptRuleCall call, Scan scan, All private static AlgNode handleDocumentEntity( AlgOptRuleCall call, Scan scan, AllocationEntity alloc ) { AlgNode alg = AdapterManager.getInstance().getAdapter( alloc.adapterId ).getDocumentScan( alloc.id, call.builder() ); - if ( scan.getModel() != scan.entity.namespaceType ) { + if ( scan.getModel() != scan.entity.dataModel ) { // cross-model queries need a transformer first, we let another rule handle that alg = call.builder().push( alg ).transform( scan.getTraitSet().getTrait( ModelTraitDef.INSTANCE ), scan.getRowType(), true ).build(); } @@ -94,11 +94,11 @@ private static AlgNode handleDocumentEntity( AlgOptRuleCall call, Scan scan, private AlgNode handleRelationalEntity( AlgOptRuleCall call, Scan scan, AllocationEntity alloc ) { AlgNode alg = AdapterManager.getInstance().getAdapter( alloc.adapterId ).getRelScan( alloc.id, call.builder() ); - if ( scan.getModel() == scan.entity.namespaceType ) { + if ( scan.getModel() == scan.entity.dataModel ) { alg = attachReorder( alg, scan, call.builder() ); } - if ( scan.getModel() != scan.entity.namespaceType ) { + if ( scan.getModel() != scan.entity.dataModel ) { // cross-model queries need a transformer first, we let another rule handle that alg = call.builder().push( alg ).transform( scan.getTraitSet().getTrait( ModelTraitDef.INSTANCE ), scan.getRowType(), true ).build(); } diff --git a/core/src/main/java/org/polypheny/db/algebra/rules/LoptSemiJoinOptimizer.java b/core/src/main/java/org/polypheny/db/algebra/rules/LoptSemiJoinOptimizer.java index 37e5508872..e07eec7b82 100644 --- a/core/src/main/java/org/polypheny/db/algebra/rules/LoptSemiJoinOptimizer.java +++ b/core/src/main/java/org/polypheny/db/algebra/rules/LoptSemiJoinOptimizer.java @@ -53,8 +53,8 @@ import org.polypheny.db.algebra.metadata.AlgMetadataQuery; import org.polypheny.db.algebra.operators.OperatorName; import org.polypheny.db.catalog.entity.LogicalEntity; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; import org.polypheny.db.languages.OperatorRegistry; import org.polypheny.db.plan.AlgOptCost; import org.polypheny.db.plan.AlgOptUtil; @@ -669,7 +669,7 @@ public int compare( Integer alg1Idx, Integer alg2Idx ) { private abstract static class LcsEntity extends LogicalEntity { protected LcsEntity() { - super( -1, "lcs", -1, EntityType.ENTITY, NamespaceType.RELATIONAL, false ); + super( -1, "lcs", -1, EntityType.ENTITY, DataModel.RELATIONAL, false ); } } diff --git a/core/src/main/java/org/polypheny/db/catalog/Catalog.java b/core/src/main/java/org/polypheny/db/catalog/Catalog.java index 640b682d06..639a40cb48 100644 --- a/core/src/main/java/org/polypheny/db/catalog/Catalog.java +++ b/core/src/main/java/org/polypheny/db/catalog/Catalog.java @@ -45,7 +45,7 @@ import org.polypheny.db.catalog.entity.LogicalQueryInterface; import org.polypheny.db.catalog.entity.LogicalUser; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.iface.QueryInterfaceManager.QueryInterfaceTemplate; import org.polypheny.db.util.PolyphenyMode; @@ -178,11 +178,11 @@ public void removeObserver( PropertyChangeListener listener ) { * Adds a schema in a specified database * * @param name The name of the schema - * @param namespaceType The type of this schema + * @param dataModel The type of this schema * @param caseSensitive * @return The id of the inserted schema */ - public abstract long createNamespace( String name, NamespaceType namespaceType, boolean caseSensitive ); + public abstract long createNamespace( String name, DataModel dataModel, boolean caseSensitive ); /** * Add an adapter diff --git a/core/src/main/java/org/polypheny/db/catalog/entity/LogicalEntity.java b/core/src/main/java/org/polypheny/db/catalog/entity/LogicalEntity.java index 7f4edf94be..9b3e1c9195 100644 --- a/core/src/main/java/org/polypheny/db/catalog/entity/LogicalEntity.java +++ b/core/src/main/java/org/polypheny/db/catalog/entity/LogicalEntity.java @@ -32,8 +32,8 @@ import org.polypheny.db.algebra.type.AlgDataTypeFactory; import org.polypheny.db.algebra.type.DocumentType; import org.polypheny.db.algebra.type.GraphType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; import org.polypheny.db.catalog.refactor.CatalogType; import org.polypheny.db.schema.Statistic; import org.polypheny.db.schema.Statistics; @@ -55,7 +55,7 @@ public abstract class LogicalEntity implements LogicalObject, Wrapper, Serializa public EntityType entityType; @Serialize - public NamespaceType namespaceType; + public DataModel dataModel; @Serialize @SerializeNullable @@ -73,19 +73,19 @@ public LogicalEntity( String name, long namespaceId, EntityType type, - NamespaceType namespaceType, + DataModel dataModel, boolean modifiable ) { this.id = id; this.namespaceId = namespaceId; this.name = name; this.entityType = type; - this.namespaceType = namespaceType; + this.dataModel = dataModel; this.modifiable = modifiable; } public AlgDataType getRowType() { - switch ( namespaceType ) { + switch ( dataModel ) { case RELATIONAL: throw new UnsupportedOperationException( "Should be overwritten by child" ); case DOCUMENT: diff --git a/core/src/main/java/org/polypheny/db/catalog/entity/allocation/AllocationCollection.java b/core/src/main/java/org/polypheny/db/catalog/entity/allocation/AllocationCollection.java index 0368c92f16..31b207c0bc 100644 --- a/core/src/main/java/org/polypheny/db/catalog/entity/allocation/AllocationCollection.java +++ b/core/src/main/java/org/polypheny/db/catalog/entity/allocation/AllocationCollection.java @@ -24,7 +24,7 @@ import org.apache.calcite.linq4j.tree.Expression; import org.apache.calcite.linq4j.tree.Expressions; import org.polypheny.db.catalog.Catalog; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; @EqualsAndHashCode(callSuper = true) @Value @@ -38,7 +38,7 @@ public AllocationCollection( @Deserialize("logicalId") long logicalId, @Deserialize("namespaceId") long namespaceId, @Deserialize("adapterId") long adapterId ) { - super( id, placementId, partitionId, logicalId, namespaceId, adapterId, NamespaceType.DOCUMENT ); + super( id, placementId, partitionId, logicalId, namespaceId, adapterId, DataModel.DOCUMENT ); } diff --git a/core/src/main/java/org/polypheny/db/catalog/entity/allocation/AllocationEntity.java b/core/src/main/java/org/polypheny/db/catalog/entity/allocation/AllocationEntity.java index 8e7f98f937..fac6d95b99 100644 --- a/core/src/main/java/org/polypheny/db/catalog/entity/allocation/AllocationEntity.java +++ b/core/src/main/java/org/polypheny/db/catalog/entity/allocation/AllocationEntity.java @@ -25,8 +25,8 @@ import lombok.experimental.SuperBuilder; import lombok.extern.slf4j.Slf4j; import org.polypheny.db.catalog.entity.LogicalEntity; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; import org.polypheny.db.catalog.logistic.PartitionType; @EqualsAndHashCode(callSuper = true) @@ -59,7 +59,7 @@ protected AllocationEntity( long logicalId, long namespaceId, long adapterId, - NamespaceType type ) { + DataModel type ) { super( id, null, namespaceId, EntityType.ENTITY, type, true ); this.adapterId = adapterId; this.logicalId = logicalId; diff --git a/core/src/main/java/org/polypheny/db/catalog/entity/allocation/AllocationGraph.java b/core/src/main/java/org/polypheny/db/catalog/entity/allocation/AllocationGraph.java index 9cbda2db31..0c0f89e8d0 100644 --- a/core/src/main/java/org/polypheny/db/catalog/entity/allocation/AllocationGraph.java +++ b/core/src/main/java/org/polypheny/db/catalog/entity/allocation/AllocationGraph.java @@ -24,7 +24,7 @@ import org.apache.calcite.linq4j.tree.Expression; import org.apache.calcite.linq4j.tree.Expressions; import org.polypheny.db.catalog.Catalog; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; @EqualsAndHashCode(callSuper = true) @Value @@ -39,7 +39,7 @@ public AllocationGraph( @Deserialize("logicalId") long logicalId, @Deserialize("namespaceId") long namespaceId, @Deserialize("adapterId") long adapterId ) { - super( id, placementId, partitionId, logicalId, namespaceId, adapterId, NamespaceType.GRAPH ); + super( id, placementId, partitionId, logicalId, namespaceId, adapterId, DataModel.GRAPH ); } diff --git a/core/src/main/java/org/polypheny/db/catalog/entity/allocation/AllocationTable.java b/core/src/main/java/org/polypheny/db/catalog/entity/allocation/AllocationTable.java index 34e32a4078..dfe05cc57d 100644 --- a/core/src/main/java/org/polypheny/db/catalog/entity/allocation/AllocationTable.java +++ b/core/src/main/java/org/polypheny/db/catalog/entity/allocation/AllocationTable.java @@ -32,7 +32,7 @@ import org.polypheny.db.algebra.type.AlgDataTypeImpl; import org.polypheny.db.catalog.Catalog; import org.polypheny.db.catalog.entity.logical.LogicalColumn; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; @EqualsAndHashCode(callSuper = true) @Value @@ -47,7 +47,7 @@ public AllocationTable( @Deserialize("logicalId") long logicalId, @Deserialize("namespaceId") long namespaceId, @Deserialize("adapterId") long adapterId ) { - super( id, placementId, partitionId, logicalId, namespaceId, adapterId, NamespaceType.RELATIONAL ); + super( id, placementId, partitionId, logicalId, namespaceId, adapterId, DataModel.RELATIONAL ); } diff --git a/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalCollection.java b/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalCollection.java index 9e95e5c0ec..8780447c2e 100644 --- a/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalCollection.java +++ b/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalCollection.java @@ -25,8 +25,8 @@ import org.apache.calcite.linq4j.tree.Expressions; import org.polypheny.db.catalog.Catalog; import org.polypheny.db.catalog.entity.LogicalObject; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; @EqualsAndHashCode(callSuper = true) @Value @@ -42,7 +42,7 @@ public LogicalCollection( @Deserialize("namespaceId") long namespaceId, @Deserialize("entityType") EntityType entityType, @Deserialize("modifiable") boolean modifiable ) { - super( id, name, namespaceId, entityType, NamespaceType.DOCUMENT, modifiable ); + super( id, name, namespaceId, entityType, DataModel.DOCUMENT, modifiable ); } diff --git a/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalColumn.java b/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalColumn.java index da176cd4d5..437367a6cc 100644 --- a/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalColumn.java +++ b/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalColumn.java @@ -32,7 +32,7 @@ import org.polypheny.db.catalog.entity.LogicalDefaultValue; import org.polypheny.db.catalog.entity.LogicalObject; import org.polypheny.db.catalog.logistic.Collation; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.type.PolyType; @@ -88,7 +88,7 @@ public class LogicalColumn implements LogicalObject, Comparable { @SerializeNullable public LogicalDefaultValue defaultValue; - public NamespaceType namespaceType = NamespaceType.RELATIONAL; + public DataModel dataModel = DataModel.RELATIONAL; public LogicalColumn( diff --git a/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalEntity.java b/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalEntity.java index 607300befb..c165d48b6d 100644 --- a/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalEntity.java +++ b/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalEntity.java @@ -20,8 +20,8 @@ import lombok.Value; import lombok.experimental.NonFinal; import lombok.experimental.SuperBuilder; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; @EqualsAndHashCode(callSuper = true) @SuperBuilder(toBuilder = true) @@ -35,9 +35,9 @@ public LogicalEntity( String name, long namespaceId, EntityType type, - NamespaceType namespaceType, + DataModel dataModel, boolean modifiable ) { - super( id, name, namespaceId, type, namespaceType, modifiable ); + super( id, name, namespaceId, type, dataModel, modifiable ); } diff --git a/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalGraph.java b/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalGraph.java index 57544242db..6f9227a8f5 100644 --- a/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalGraph.java +++ b/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalGraph.java @@ -24,8 +24,8 @@ import org.apache.calcite.linq4j.tree.Expression; import org.apache.calcite.linq4j.tree.Expressions; import org.polypheny.db.catalog.Catalog; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; @EqualsAndHashCode(callSuper = true) @Value @@ -42,7 +42,7 @@ public LogicalGraph( @Deserialize("name") String name, @Deserialize("modifiable") boolean modifiable, @Deserialize("caseSensitive") boolean caseSensitive ) { - super( id, name, id, EntityType.ENTITY, NamespaceType.GRAPH, modifiable ); + super( id, name, id, EntityType.ENTITY, DataModel.GRAPH, modifiable ); this.caseSensitive = caseSensitive; } diff --git a/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalNamespace.java b/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalNamespace.java index cfb91bb5a7..f9b99f60e8 100644 --- a/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalNamespace.java +++ b/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalNamespace.java @@ -28,7 +28,7 @@ import lombok.With; import org.polypheny.db.catalog.Catalog; import org.polypheny.db.catalog.entity.LogicalObject; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; @EqualsAndHashCode(callSuper = false) @@ -46,7 +46,7 @@ public class LogicalNamespace implements LogicalObject, Comparable a.position ) ).collect( Collectors.toList() ) ); } diff --git a/core/src/main/java/org/polypheny/db/catalog/impl/AdapterRestore.java b/core/src/main/java/org/polypheny/db/catalog/impl/AdapterRestore.java index a955299185..1a2954b826 100644 --- a/core/src/main/java/org/polypheny/db/catalog/impl/AdapterRestore.java +++ b/core/src/main/java/org/polypheny/db/catalog/impl/AdapterRestore.java @@ -70,7 +70,7 @@ public void addPhysicals( AllocationEntity allocation, List phys public void activate( Adapter adapter ) { physicals.forEach( ( allocId, physicals ) -> { AllocationEntity entity = allocations.get( allocId ); - switch ( entity.namespaceType ) { + switch ( entity.dataModel ) { case RELATIONAL: adapter.restoreTable( entity.unwrap( AllocationTable.class ), physicals ); diff --git a/core/src/main/java/org/polypheny/db/catalog/impl/NCatalog.java b/core/src/main/java/org/polypheny/db/catalog/impl/NCatalog.java index f458d993aa..2cfedd7df9 100644 --- a/core/src/main/java/org/polypheny/db/catalog/impl/NCatalog.java +++ b/core/src/main/java/org/polypheny/db/catalog/impl/NCatalog.java @@ -20,7 +20,7 @@ import org.polypheny.db.catalog.impl.logical.DocumentCatalog; import org.polypheny.db.catalog.impl.logical.GraphCatalog; import org.polypheny.db.catalog.impl.logical.RelationalCatalog; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; @SerializeClass(subclasses = { GraphCatalog.class, RelationalCatalog.class, DocumentCatalog.class }) // required for deserialization public interface NCatalog { @@ -31,7 +31,7 @@ public interface NCatalog { boolean hasUncommittedChanges(); - NamespaceType getType(); + DataModel getType(); default T unwrap( Class clazz ) { if ( !this.getClass().isAssignableFrom( clazz ) ) { diff --git a/core/src/main/java/org/polypheny/db/catalog/impl/PolyCatalog.java b/core/src/main/java/org/polypheny/db/catalog/impl/PolyCatalog.java index cf87ff3a80..351ab83d00 100644 --- a/core/src/main/java/org/polypheny/db/catalog/impl/PolyCatalog.java +++ b/core/src/main/java/org/polypheny/db/catalog/impl/PolyCatalog.java @@ -58,7 +58,7 @@ import org.polypheny.db.catalog.impl.logical.DocumentCatalog; import org.polypheny.db.catalog.impl.logical.GraphCatalog; import org.polypheny.db.catalog.impl.logical.RelationalCatalog; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.catalog.snapshot.impl.SnapshotBuilder; import org.polypheny.db.iface.QueryInterfaceManager.QueryInterfaceTemplate; @@ -240,8 +240,8 @@ private void restoreLastState() { } - private void validateNamespaceType( long id, NamespaceType type ) { - if ( logicalCatalogs.get( id ).getLogicalNamespace().namespaceType != type ) { + private void validateNamespaceType( long id, DataModel type ) { + if ( logicalCatalogs.get( id ).getLogicalNamespace().dataModel != type ) { throw new GenericRuntimeException( "Error while retrieving namespace type" ); } } @@ -249,42 +249,42 @@ private void validateNamespaceType( long id, NamespaceType type ) { @Override public LogicalRelationalCatalog getLogicalRel( long namespaceId ) { - validateNamespaceType( namespaceId, NamespaceType.RELATIONAL ); + validateNamespaceType( namespaceId, DataModel.RELATIONAL ); return (LogicalRelationalCatalog) logicalCatalogs.get( namespaceId ); } @Override public LogicalDocumentCatalog getLogicalDoc( long namespaceId ) { - validateNamespaceType( namespaceId, NamespaceType.DOCUMENT ); + validateNamespaceType( namespaceId, DataModel.DOCUMENT ); return (LogicalDocumentCatalog) logicalCatalogs.get( namespaceId ); } @Override public LogicalGraphCatalog getLogicalGraph( long namespaceId ) { - validateNamespaceType( namespaceId, NamespaceType.GRAPH ); + validateNamespaceType( namespaceId, DataModel.GRAPH ); return (LogicalGraphCatalog) logicalCatalogs.get( namespaceId ); } @Override public AllocationRelationalCatalog getAllocRel( long namespaceId ) { - validateNamespaceType( namespaceId, NamespaceType.RELATIONAL ); + validateNamespaceType( namespaceId, DataModel.RELATIONAL ); return (AllocationRelationalCatalog) allocationCatalogs.get( namespaceId ); } @Override public AllocationDocumentCatalog getAllocDoc( long namespaceId ) { - validateNamespaceType( namespaceId, NamespaceType.DOCUMENT ); + validateNamespaceType( namespaceId, DataModel.DOCUMENT ); return (AllocationDocumentCatalog) allocationCatalogs.get( namespaceId ); } @Override public AllocationGraphCatalog getAllocGraph( long namespaceId ) { - validateNamespaceType( namespaceId, NamespaceType.GRAPH ); + validateNamespaceType( namespaceId, DataModel.GRAPH ); return (AllocationGraphCatalog) allocationCatalogs.get( namespaceId ); } @@ -309,12 +309,12 @@ public long createUser( String name, String password ) { } - public long createNamespace( String name, NamespaceType namespaceType, boolean caseSensitive ) { + public long createNamespace( String name, DataModel dataModel, boolean caseSensitive ) { // cannot separate namespace and entity ids, as there are models which have their entity on the namespace level long id = idBuilder.getNewLogicalId(); - LogicalNamespace namespace = new LogicalNamespace( id, name, namespaceType, caseSensitive ); + LogicalNamespace namespace = new LogicalNamespace( id, name, dataModel, caseSensitive ); - switch ( namespaceType ) { + switch ( dataModel ) { case RELATIONAL: logicalCatalogs.put( id, new RelationalCatalog( namespace ) ); allocationCatalogs.put( id, new PolyAllocRelCatalog( namespace ) ); diff --git a/core/src/main/java/org/polypheny/db/catalog/logistic/NamespaceType.java b/core/src/main/java/org/polypheny/db/catalog/logistic/DataModel.java similarity index 75% rename from core/src/main/java/org/polypheny/db/catalog/logistic/NamespaceType.java rename to core/src/main/java/org/polypheny/db/catalog/logistic/DataModel.java index d527e3907e..444ac939c1 100644 --- a/core/src/main/java/org/polypheny/db/catalog/logistic/NamespaceType.java +++ b/core/src/main/java/org/polypheny/db/catalog/logistic/DataModel.java @@ -20,7 +20,7 @@ import org.polypheny.db.schema.trait.ModelTrait; @Getter -public enum NamespaceType { +public enum DataModel { RELATIONAL( 1 ), DOCUMENT( 2 ), GRAPH( 3 ); @@ -29,19 +29,19 @@ public enum NamespaceType { public final int id; - NamespaceType( int id ) { + DataModel( int id ) { this.id = id; } - public static NamespaceType getDefault() { + public static DataModel getDefault() { //return (NamespaceType) ConfigManager.getInstance().getConfig( "runtime/defaultSchemaModel" ).getEnum(); - return NamespaceType.RELATIONAL; + return DataModel.RELATIONAL; } - public static NamespaceType getById( final int id ) { - for ( NamespaceType t : values() ) { + public static DataModel getById( final int id ) { + for ( DataModel t : values() ) { if ( t.id == id ) { return t; } @@ -50,8 +50,8 @@ public static NamespaceType getById( final int id ) { } - public static NamespaceType getByName( final String name ) { - for ( NamespaceType t : values() ) { + public static DataModel getByName( final String name ) { + for ( DataModel t : values() ) { if ( t.name().equalsIgnoreCase( name ) ) { return t; } @@ -61,11 +61,11 @@ public static NamespaceType getByName( final String name ) { public ModelTrait getModelTrait() { - if ( this == NamespaceType.RELATIONAL ) { + if ( this == DataModel.RELATIONAL ) { return ModelTrait.RELATIONAL; - } else if ( this == NamespaceType.DOCUMENT ) { + } else if ( this == DataModel.DOCUMENT ) { return ModelTrait.DOCUMENT; - } else if ( this == NamespaceType.GRAPH ) { + } else if ( this == DataModel.GRAPH ) { return ModelTrait.GRAPH; } throw new RuntimeException( "Not found a suitable NamespaceType." ); diff --git a/core/src/main/java/org/polypheny/db/catalog/snapshot/impl/AllocSnapshotImpl.java b/core/src/main/java/org/polypheny/db/catalog/snapshot/impl/AllocSnapshotImpl.java index 651124a40c..5041da089d 100644 --- a/core/src/main/java/org/polypheny/db/catalog/snapshot/impl/AllocSnapshotImpl.java +++ b/core/src/main/java/org/polypheny/db/catalog/snapshot/impl/AllocSnapshotImpl.java @@ -43,7 +43,7 @@ import org.polypheny.db.catalog.entity.allocation.AllocationPartitionGroup; import org.polypheny.db.catalog.entity.allocation.AllocationPlacement; import org.polypheny.db.catalog.entity.allocation.AllocationTable; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.AllocSnapshot; import org.polypheny.db.partition.properties.PartitionProperty; import org.polypheny.db.util.Pair; @@ -87,27 +87,27 @@ public AllocSnapshotImpl( Map allocationCatalogs, Map a.getNamespace().namespaceType == NamespaceType.RELATIONAL ) + .filter( a -> a.getNamespace().dataModel == DataModel.RELATIONAL ) .map( c -> (AllocationRelationalCatalog) c ) .collect( Collectors.toList() ) ); this.collections = buildCollections( allocationCatalogs .values() .stream() - .filter( a -> a.getNamespace().namespaceType == NamespaceType.DOCUMENT ) + .filter( a -> a.getNamespace().dataModel == DataModel.DOCUMENT ) .map( c -> (AllocationDocumentCatalog) c ) .collect( Collectors.toList() ) ); this.graphs = buildGraphs( allocationCatalogs .values() .stream() - .filter( a -> a.getNamespace().namespaceType == NamespaceType.GRAPH ) + .filter( a -> a.getNamespace().dataModel == DataModel.GRAPH ) .map( c -> (AllocationGraphCatalog) c ) .collect( Collectors.toList() ) ); this.columns = buildPlacementColumns( allocationCatalogs.values() .stream() - .filter( a -> a.getNamespace().namespaceType == NamespaceType.RELATIONAL ) + .filter( a -> a.getNamespace().dataModel == DataModel.RELATIONAL ) .map( c -> (AllocationRelationalCatalog) c ) .map( AllocationRelationalCatalog::getColumns ) .flatMap( c -> c.values().stream() ) @@ -129,7 +129,7 @@ public AllocSnapshotImpl( Map allocationCatalogs, Map a.getNamespace().namespaceType == NamespaceType.RELATIONAL ) + .filter( a -> a.getNamespace().dataModel == DataModel.RELATIONAL ) .map( c -> (AllocationRelationalCatalog) c ) .map( AllocationRelationalCatalog::getProperties ) .flatMap( c -> c.values().stream() ) @@ -251,7 +251,7 @@ private ImmutableMap buildPartitions( Map buildPartitionGroups( Map allocationCatalogs ) { return ImmutableMap.copyOf( allocationCatalogs.values() .stream() - .filter( a -> a.getNamespace().namespaceType == NamespaceType.RELATIONAL ) + .filter( a -> a.getNamespace().dataModel == DataModel.RELATIONAL ) .map( c -> (AllocationRelationalCatalog) c ) .map( AllocationRelationalCatalog::getPartitionGroups ) .flatMap( c -> c.values().stream() ) diff --git a/core/src/main/java/org/polypheny/db/catalog/snapshot/impl/SnapshotBuilder.java b/core/src/main/java/org/polypheny/db/catalog/snapshot/impl/SnapshotBuilder.java index 5d1c5f6ff0..ca380b9a34 100644 --- a/core/src/main/java/org/polypheny/db/catalog/snapshot/impl/SnapshotBuilder.java +++ b/core/src/main/java/org/polypheny/db/catalog/snapshot/impl/SnapshotBuilder.java @@ -27,7 +27,7 @@ import org.polypheny.db.catalog.catalogs.LogicalRelationalCatalog; import org.polypheny.db.catalog.entity.LogicalAdapter; import org.polypheny.db.catalog.entity.logical.LogicalNamespace; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.AllocSnapshot; import org.polypheny.db.catalog.snapshot.LogicalDocSnapshot; import org.polypheny.db.catalog.snapshot.LogicalGraphSnapshot; @@ -57,7 +57,7 @@ private static LogicalGraphSnapshot buildGraphSnapshots( Map e.getValue().getLogicalNamespace().namespaceType == NamespaceType.GRAPH ) + .filter( e -> e.getValue().getLogicalNamespace().dataModel == DataModel.GRAPH ) .collect( Collectors.toMap( Entry::getKey, e -> (LogicalGraphCatalog) e.getValue() ) ) ); } @@ -66,7 +66,7 @@ private static LogicalDocSnapshot buildDocSnapshots( Map l return new LogicalDocSnapshotImpl( logicalCatalogs .entrySet() .stream() - .filter( e -> e.getValue().getLogicalNamespace().namespaceType == NamespaceType.DOCUMENT ) + .filter( e -> e.getValue().getLogicalNamespace().dataModel == DataModel.DOCUMENT ) .collect( Collectors.toMap( Entry::getKey, e -> (LogicalDocumentCatalog) e.getValue() ) ) ); } @@ -75,7 +75,7 @@ private static LogicalRelSnapshot buildRelSnapshots( Map l return new LogicalRelSnapshotImpl( logicalCatalogs .entrySet() .stream() - .filter( e -> e.getValue().getLogicalNamespace().namespaceType == NamespaceType.RELATIONAL ) + .filter( e -> e.getValue().getLogicalNamespace().dataModel == DataModel.RELATIONAL ) .collect( Collectors.toMap( Entry::getKey, e -> (LogicalRelationalCatalog) e.getValue() ) ) ); } diff --git a/core/src/main/java/org/polypheny/db/ddl/DdlManager.java b/core/src/main/java/org/polypheny/db/ddl/DdlManager.java index 5a63f06cdf..2ab00591b2 100644 --- a/core/src/main/java/org/polypheny/db/ddl/DdlManager.java +++ b/core/src/main/java/org/polypheny/db/ddl/DdlManager.java @@ -34,8 +34,8 @@ import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.catalog.logistic.Collation; import org.polypheny.db.catalog.logistic.ConstraintType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.ForeignKeyOption; -import org.polypheny.db.catalog.logistic.NamespaceType; import org.polypheny.db.catalog.logistic.PlacementType; import org.polypheny.db.languages.QueryLanguage; import org.polypheny.db.nodes.DataTypeSpec; @@ -94,7 +94,7 @@ public static DdlManager getInstance() { * @param ifNotExists whether to silently ignore if a namespace with this name does already exist * @param replace whether to replace an existing namespace with this name */ - public abstract long createNamespace( String name, NamespaceType type, boolean ifNotExists, boolean replace ); + public abstract long createNamespace( String name, DataModel type, boolean ifNotExists, boolean replace ); /** * Adds a new adapter (data store or data source) diff --git a/core/src/main/java/org/polypheny/db/interpreter/Bindables.java b/core/src/main/java/org/polypheny/db/interpreter/Bindables.java index a9d1a547c1..f352cce4d9 100644 --- a/core/src/main/java/org/polypheny/db/interpreter/Bindables.java +++ b/core/src/main/java/org/polypheny/db/interpreter/Bindables.java @@ -213,7 +213,7 @@ public static BindableScan create( AlgOptCluster cluster, LogicalEntity entity ) public static BindableScan create( AlgOptCluster cluster, LogicalEntity entity, List filters, List projects ) { final AlgTraitSet traitSet = cluster.traitSetOf( BindableConvention.INSTANCE ) - .replace( entity.namespaceType.getModelTrait() ) + .replace( entity.dataModel.getModelTrait() ) .replaceIfs( AlgCollationTraitDef.INSTANCE, entity::getCollations ); return new BindableScan( cluster, traitSet, entity, ImmutableList.copyOf( filters ), ImmutableList.copyOf( projects ) ); } diff --git a/core/src/main/java/org/polypheny/db/languages/LanguageManager.java b/core/src/main/java/org/polypheny/db/languages/LanguageManager.java index fe41e8a3d8..216e82a95f 100644 --- a/core/src/main/java/org/polypheny/db/languages/LanguageManager.java +++ b/core/src/main/java/org/polypheny/db/languages/LanguageManager.java @@ -26,10 +26,6 @@ import org.polypheny.db.algebra.AlgRoot; import org.polypheny.db.algebra.type.AlgDataType; import org.polypheny.db.config.RuntimeConfig; -import org.polypheny.db.information.InformationGroup; -import org.polypheny.db.information.InformationManager; -import org.polypheny.db.information.InformationPage; -import org.polypheny.db.information.InformationStacktrace; import org.polypheny.db.nodes.Node; import org.polypheny.db.processing.ImplementationContext; import org.polypheny.db.processing.ImplementationContext.ExecutedContext; @@ -132,18 +128,14 @@ public List anyPrepareQuery( QueryContext context, Statem } implementation = statement.getQueryProcessor().prepareQuery( root, true ); } - implementationContexts.add( new ImplementationContext( implementation, parsed, statement ) ); + implementationContexts.add( new ImplementationContext( implementation, parsed, statement, null ) ); } catch ( Exception e ) { if ( transaction.isAnalyze() ) { - InformationManager analyzer = transaction.getQueryAnalyzer(); - InformationPage exceptionPage = new InformationPage( "Stacktrace" ).fullWidth(); - InformationGroup exceptionGroup = new InformationGroup( exceptionPage.getId(), "Stacktrace" ); - InformationStacktrace exceptionElement = new InformationStacktrace( e, exceptionGroup ); - analyzer.addPage( exceptionPage ); - analyzer.addGroup( exceptionGroup ); - analyzer.registerInformation( exceptionElement ); + transaction.getQueryAnalyzer().attachStacktrace( e ); } + implementationContexts.add( ImplementationContext.ofError( e, parsed, statement ) ); + return implementationContexts; } } return implementationContexts; @@ -159,6 +151,9 @@ public List anyQuery( QueryContext context, Statement statement for ( ImplementationContext implementation : prepared ) { try { + if ( implementation.getException().isPresent() ) { + throw implementation.getException().get(); + } if ( context.isAnalysed() ) { implementation.getStatement().getOverviewDuration().start( "Execution" ); } @@ -168,15 +163,9 @@ public List anyQuery( QueryContext context, Statement statement } } catch ( Exception e ) { if ( transaction.isAnalyze() ) { - InformationManager analyzer = transaction.getQueryAnalyzer(); - InformationPage exceptionPage = new InformationPage( "Stacktrace" ).fullWidth(); - InformationGroup exceptionGroup = new InformationGroup( exceptionPage.getId(), "Stacktrace" ); - InformationStacktrace exceptionElement = new InformationStacktrace( e, exceptionGroup ); - analyzer.addPage( exceptionPage ); - analyzer.addGroup( exceptionGroup ); - analyzer.registerInformation( exceptionElement ); + transaction.getQueryAnalyzer().attachStacktrace( e ); } - executedContexts.add( ExecutedContext.ofError( e ) ); + executedContexts.add( ExecutedContext.ofError( e, implementation ) ); return executedContexts; } } diff --git a/core/src/main/java/org/polypheny/db/languages/QueryLanguage.java b/core/src/main/java/org/polypheny/db/languages/QueryLanguage.java index fbb69de62c..61fdabcb92 100644 --- a/core/src/main/java/org/polypheny/db/languages/QueryLanguage.java +++ b/core/src/main/java/org/polypheny/db/languages/QueryLanguage.java @@ -25,7 +25,7 @@ import javax.annotation.Nullable; import lombok.Value; import org.jetbrains.annotations.NotNull; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.nodes.validate.Validator; import org.polypheny.db.prepare.Context; @@ -37,7 +37,7 @@ public class QueryLanguage { @NotNull - NamespaceType namespaceType; + DataModel dataModel; @NotNull String serializedName; @NotNull @@ -53,14 +53,14 @@ public class QueryLanguage { public QueryLanguage( - @NotNull NamespaceType namespaceType, + @NotNull DataModel dataModel, @NotNull String serializedName, @NotNull List otherNames, @Nullable ParserFactory factory, @NotNull Supplier processorSupplier, @Nullable BiFunction validatorSupplier, @NotNull Function> splitter ) { - this.namespaceType = namespaceType; + this.dataModel = dataModel; this.serializedName = serializedName; this.factory = factory; this.processorSupplier = processorSupplier; diff --git a/core/src/main/java/org/polypheny/db/languages/QueryParameters.java b/core/src/main/java/org/polypheny/db/languages/QueryParameters.java index 5ea2e05611..b12413887e 100644 --- a/core/src/main/java/org/polypheny/db/languages/QueryParameters.java +++ b/core/src/main/java/org/polypheny/db/languages/QueryParameters.java @@ -17,7 +17,7 @@ package org.polypheny.db.languages; import lombok.Getter; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.interpreter.Node; /** @@ -27,12 +27,12 @@ @Getter public class QueryParameters { - private final NamespaceType namespaceType; + private final DataModel dataModel; private final String query; - public QueryParameters( String query, NamespaceType namespaceType ) { - this.namespaceType = namespaceType; + public QueryParameters( String query, DataModel dataModel ) { + this.dataModel = dataModel; this.query = query; } diff --git a/core/src/main/java/org/polypheny/db/processing/ExtendedQueryParameters.java b/core/src/main/java/org/polypheny/db/processing/ExtendedQueryParameters.java index 5677c7e047..2f98e6c6ff 100644 --- a/core/src/main/java/org/polypheny/db/processing/ExtendedQueryParameters.java +++ b/core/src/main/java/org/polypheny/db/processing/ExtendedQueryParameters.java @@ -21,7 +21,7 @@ import lombok.EqualsAndHashCode; import lombok.Value; import lombok.experimental.NonFinal; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.languages.QueryParameters; @@ -36,15 +36,15 @@ public class ExtendedQueryParameters extends QueryParameters { public boolean fullGraph; - public ExtendedQueryParameters( String query, NamespaceType namespaceType, String namespace ) { - super( query, namespaceType ); + public ExtendedQueryParameters( String query, DataModel dataModel, String namespace ) { + super( query, dataModel ); this.namespace = namespace; this.fullGraph = false; } public ExtendedQueryParameters( String namespace ) { - super( "*", NamespaceType.GRAPH ); + super( "*", DataModel.GRAPH ); this.namespace = namespace; this.fullGraph = true; } diff --git a/core/src/main/java/org/polypheny/db/processing/ImplementationContext.java b/core/src/main/java/org/polypheny/db/processing/ImplementationContext.java index 4a2cd0ccf2..4d8e06ae28 100644 --- a/core/src/main/java/org/polypheny/db/processing/ImplementationContext.java +++ b/core/src/main/java/org/polypheny/db/processing/ImplementationContext.java @@ -17,6 +17,7 @@ package org.polypheny.db.processing; +import java.util.Optional; import lombok.EqualsAndHashCode; import lombok.Value; import lombok.experimental.NonFinal; @@ -37,6 +38,14 @@ public class ImplementationContext { Statement statement; + @Nullable + Exception exception; + + + public static ImplementationContext ofError( Exception e, ParsedQueryContext parsed, Statement statement ) { + return new ImplementationContext( null, parsed, statement, e ); + } + public ExecutedContext execute( Statement statement ) { long time = System.nanoTime(); @@ -46,35 +55,45 @@ public ExecutedContext execute( Statement statement ) { return new ExecutedContext( implementation, null, query, time, result, statement ); } catch ( Exception e ) { time = System.nanoTime() - time; - return new ExecutedContext( implementation, e.getMessage(), query, time, null, statement ); + return new ExecutedContext( implementation, e, query, time, null, statement ); } } + public Optional getException() { + return Optional.of( exception ); + } + + @EqualsAndHashCode(callSuper = true) @Value public static class ExecutedContext extends ImplementationContext { - @Nullable - String error; + @NotNull + ResultIterator iterator; long executionTime; - @NotNull - ResultIterator iterator; + @Nullable + Exception error; - private ExecutedContext( PolyImplementation implementation, String error, ParsedQueryContext query, long executionTime, ResultIterator iterator, Statement statement ) { - super( implementation, query, statement ); + private ExecutedContext( PolyImplementation implementation, @Nullable Exception error, ParsedQueryContext query, long executionTime, ResultIterator iterator, Statement statement ) { + super( implementation, query, statement, error ); this.executionTime = executionTime; this.iterator = iterator; this.error = error; } - public static ExecutedContext ofError( Exception e ) { - return new ExecutedContext( null, e.getMessage(), null, 0l, null, null ); + public static ExecutedContext ofError( Exception e, ImplementationContext implementation ) { + return new ExecutedContext( implementation.implementation, e, implementation.query, 0l, null, implementation.statement ); + } + + + public Optional getError() { + return Optional.of( error ); } } diff --git a/core/src/main/java/org/polypheny/db/processing/LogicalAlgAnalyzeShuttle.java b/core/src/main/java/org/polypheny/db/processing/LogicalAlgAnalyzeShuttle.java index 590ef8a97c..7a90a7aaf0 100644 --- a/core/src/main/java/org/polypheny/db/processing/LogicalAlgAnalyzeShuttle.java +++ b/core/src/main/java/org/polypheny/db/processing/LogicalAlgAnalyzeShuttle.java @@ -68,7 +68,7 @@ import org.polypheny.db.catalog.entity.allocation.AllocationEntity; import org.polypheny.db.catalog.entity.logical.LogicalColumn; import org.polypheny.db.catalog.entity.logical.LogicalTable; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.transaction.Statement; @@ -90,9 +90,9 @@ public class LogicalAlgAnalyzeShuttle extends AlgShuttleImpl { public Map availableColumnsWithTable = new HashMap<>(); // columnId -> tableId - public Map> modifiedEntities = new HashMap<>(); + public Map> modifiedEntities = new HashMap<>(); - public Map> scannedEntities = new HashMap<>(); + public Map> scannedEntities = new HashMap<>(); public List entityIds = new ArrayList<>(); @@ -143,7 +143,7 @@ public String getQueryName() { } - private void addScannedEntity( NamespaceType type, long entityId ) { + private void addScannedEntity( DataModel type, long entityId ) { if ( !scannedEntities.containsKey( type ) ) { scannedEntities.put( type, new HashSet<>() ); } @@ -151,7 +151,7 @@ private void addScannedEntity( NamespaceType type, long entityId ) { } - private void addModifiedEntity( NamespaceType type, long entityId ) { + private void addModifiedEntity( DataModel type, long entityId ) { if ( !modifiedEntities.containsKey( type ) ) { modifiedEntities.put( type, new HashSet<>() ); } @@ -170,7 +170,7 @@ public AlgNode visit( LogicalAggregate aggregate ) { public AlgNode visit( LogicalLpgModify modify ) { hashBasis.add( modify.getClass().getSimpleName() ); - addModifiedEntity( modify.getEntity().namespaceType, getLogicalId( modify ) ); + addModifiedEntity( modify.getEntity().dataModel, getLogicalId( modify ) ); return super.visit( modify ); } @@ -180,7 +180,7 @@ public AlgNode visit( LogicalLpgModify modify ) { public AlgNode visit( LogicalLpgScan scan ) { hashBasis.add( scan.getClass().getSimpleName() + "#" + scan.entity.id ); - addScannedEntity( scan.getEntity().namespaceType, scan.entity.id ); + addScannedEntity( scan.getEntity().dataModel, scan.entity.id ); return super.visit( scan ); } @@ -247,7 +247,7 @@ public AlgNode visit( LogicalLpgTransformer transformer ) { public AlgNode visit( LogicalDocumentModify modify ) { hashBasis.add( "LogicalDocumentModify" ); - addModifiedEntity( modify.getEntity().namespaceType, getLogicalId( modify ) ); + addModifiedEntity( modify.getEntity().dataModel, getLogicalId( modify ) ); return super.visit( modify ); } @@ -285,7 +285,7 @@ public AlgNode visit( LogicalDocumentProject project ) { public AlgNode visit( LogicalDocumentScan scan ) { hashBasis.add( "LogicalDocumentScan#" + scan.entity.id ); - addScannedEntity( scan.entity.namespaceType, getLogicalId( scan ) ); + addScannedEntity( scan.entity.dataModel, getLogicalId( scan ) ); return super.visit( scan ); } @@ -326,7 +326,7 @@ public AlgNode visit( RelScan scan ) { } hashBasis.add( "Scan#" + scan.getEntity().id ); - addScannedEntity( scan.getEntity().namespaceType, getLogicalId( scan ) ); + addScannedEntity( scan.getEntity().dataModel, getLogicalId( scan ) ); // get available columns for every table scan this.getAvailableColumns( scan ); @@ -428,7 +428,7 @@ public AlgNode visit( LogicalExchange exchange ) { public AlgNode visit( LogicalRelModify modify ) { hashBasis.add( "LogicalModify" ); - addModifiedEntity( modify.getEntity().namespaceType, getLogicalId( modify ) ); + addModifiedEntity( modify.getEntity().dataModel, getLogicalId( modify ) ); // e.g. inserts only have underlying values and need to attach the table correctly this.getAvailableColumns( modify ); diff --git a/core/src/main/java/org/polypheny/db/processing/Processor.java b/core/src/main/java/org/polypheny/db/processing/Processor.java index b5e1807a40..86a8ca45e6 100644 --- a/core/src/main/java/org/polypheny/db/processing/Processor.java +++ b/core/src/main/java/org/polypheny/db/processing/Processor.java @@ -72,7 +72,7 @@ PolyImplementation getImplementation( Statement statement, ParsedQueryContext co Catalog.getInstance().commit(); return new PolyImplementation( null, - context.getLanguage().getNamespaceType(), + context.getLanguage().getDataModel(), new ExecutionTimeMonitor(), null, Kind.CREATE_NAMESPACE, // technically correct, maybe change diff --git a/core/src/main/java/org/polypheny/db/routing/LogicalQueryInformation.java b/core/src/main/java/org/polypheny/db/routing/LogicalQueryInformation.java index 9be19b0949..8a4d8fd211 100644 --- a/core/src/main/java/org/polypheny/db/routing/LogicalQueryInformation.java +++ b/core/src/main/java/org/polypheny/db/routing/LogicalQueryInformation.java @@ -21,7 +21,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; /** @@ -63,9 +63,9 @@ public interface LogicalQueryInformation { */ String getQueryHash(); - ImmutableMap> getScannedEntities(); + ImmutableMap> getScannedEntities(); - ImmutableMap> getModifiedEntities(); + ImmutableMap> getModifiedEntities(); ImmutableSet getAllModifiedEntities(); diff --git a/core/src/main/java/org/polypheny/db/schema/Entity.java b/core/src/main/java/org/polypheny/db/schema/Entity.java index 325daeb007..2487554bfd 100644 --- a/core/src/main/java/org/polypheny/db/schema/Entity.java +++ b/core/src/main/java/org/polypheny/db/schema/Entity.java @@ -35,7 +35,7 @@ import org.polypheny.db.algebra.type.AlgDataType; import org.polypheny.db.algebra.type.AlgDataTypeFactory; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.nodes.Call; import org.polypheny.db.nodes.Node; import org.polypheny.db.prepare.JavaTypeFactoryImpl; @@ -112,8 +112,8 @@ default AlgDataTypeFactory getTypeFactory() { boolean rolledUpColumnValidInsideAgg( String column, Call call, Node parent ); - default NamespaceType getNamespaceType() { - return NamespaceType.RELATIONAL; + default DataModel getNamespaceType() { + return DataModel.RELATIONAL; } interface Table { diff --git a/core/src/main/java/org/polypheny/db/schema/SchemaPlus.java b/core/src/main/java/org/polypheny/db/schema/SchemaPlus.java index 37ac21b55b..0e5ef6807d 100644 --- a/core/src/main/java/org/polypheny/db/schema/SchemaPlus.java +++ b/core/src/main/java/org/polypheny/db/schema/SchemaPlus.java @@ -35,7 +35,7 @@ import com.google.common.collect.ImmutableList; import org.polypheny.db.algebra.type.AlgProtoDataType; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.schema.Namespace.Schema; @@ -77,7 +77,7 @@ public interface SchemaPlus extends Namespace, Schema { /** * Adds a schema as a sub-schema of this schema, and returns the wrapped object. */ - SchemaPlus add( String name, Namespace namespace, NamespaceType namespaceType ); + SchemaPlus add( String name, Namespace namespace, DataModel dataModel ); /** * Adds a table to this schema. diff --git a/core/src/main/java/org/polypheny/db/schema/trait/ModelTrait.java b/core/src/main/java/org/polypheny/db/schema/trait/ModelTrait.java index 16f1bbd932..aca1f11497 100644 --- a/core/src/main/java/org/polypheny/db/schema/trait/ModelTrait.java +++ b/core/src/main/java/org/polypheny/db/schema/trait/ModelTrait.java @@ -18,7 +18,7 @@ import lombok.Getter; import org.polypheny.db.algebra.AlgNode; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.plan.AlgOptPlanner; import org.polypheny.db.plan.AlgTrait; import org.polypheny.db.plan.Convention; @@ -31,16 +31,16 @@ @Getter public class ModelTrait implements AlgTrait { - public static final ModelTrait RELATIONAL = new ModelTrait( NamespaceType.RELATIONAL ); + public static final ModelTrait RELATIONAL = new ModelTrait( DataModel.RELATIONAL ); - public static final ModelTrait DOCUMENT = new ModelTrait( NamespaceType.DOCUMENT ); + public static final ModelTrait DOCUMENT = new ModelTrait( DataModel.DOCUMENT ); - public static final ModelTrait GRAPH = new ModelTrait( NamespaceType.GRAPH ); + public static final ModelTrait GRAPH = new ModelTrait( DataModel.GRAPH ); - private final NamespaceType dataModel; + private final DataModel dataModel; - public ModelTrait( NamespaceType dataModel ) { + public ModelTrait( DataModel dataModel ) { this.dataModel = dataModel; } diff --git a/core/src/main/java/org/polypheny/db/tools/AlgBuilder.java b/core/src/main/java/org/polypheny/db/tools/AlgBuilder.java index f2d33fa2ea..c0f22784fc 100644 --- a/core/src/main/java/org/polypheny/db/tools/AlgBuilder.java +++ b/core/src/main/java/org/polypheny/db/tools/AlgBuilder.java @@ -110,7 +110,7 @@ import org.polypheny.db.catalog.entity.logical.LogicalTable; import org.polypheny.db.catalog.entity.physical.PhysicalEntity; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.languages.OperatorRegistry; import org.polypheny.db.languages.QueryLanguage; @@ -583,7 +583,7 @@ private RexNode field( int inputCount, int inputOrdinal, int fieldOrdinal, boole final AlgDataTypeField field = rowType.getFields().get( fieldOrdinal ); final int offset = inputOffset( inputCount, inputOrdinal ); final RexIndexRef ref = cluster.getRexBuilder().makeInputRef( field.getType(), offset + fieldOrdinal ); - if ( frame.alg.getModel() == NamespaceType.DOCUMENT ) { + if ( frame.alg.getModel() == DataModel.DOCUMENT ) { return ref; } final AlgDataTypeField aliasField = frame.relFields().get( fieldOrdinal ); diff --git a/core/src/main/java/org/polypheny/db/util/Util.java b/core/src/main/java/org/polypheny/db/util/Util.java index eb6e454616..ff3ef193b2 100644 --- a/core/src/main/java/org/polypheny/db/util/Util.java +++ b/core/src/main/java/org/polypheny/db/util/Util.java @@ -104,7 +104,7 @@ import org.polypheny.db.algebra.fun.AggFunction; import org.polypheny.db.catalog.entity.LogicalEntity; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.nodes.BasicNodeVisitor; import org.polypheny.db.nodes.Call; import org.polypheny.db.nodes.Literal; @@ -2023,7 +2023,7 @@ public static Iterator filter( Iterator iterator, Predicate predica public static Monotonicity getMonotonicity( LogicalEntity entity, String columnName ) { - if ( entity.namespaceType != NamespaceType.RELATIONAL ) { + if ( entity.dataModel != DataModel.RELATIONAL ) { return Monotonicity.NOT_MONOTONIC; } diff --git a/core/src/test/java/org/polypheny/db/catalog/MockCatalog.java b/core/src/test/java/org/polypheny/db/catalog/MockCatalog.java index 39c84355c9..bd0cf354d7 100644 --- a/core/src/test/java/org/polypheny/db/catalog/MockCatalog.java +++ b/core/src/test/java/org/polypheny/db/catalog/MockCatalog.java @@ -30,7 +30,7 @@ import org.polypheny.db.catalog.entity.LogicalAdapter.AdapterType; import org.polypheny.db.catalog.entity.LogicalQueryInterface; import org.polypheny.db.catalog.entity.LogicalUser; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.Snapshot; @@ -145,7 +145,7 @@ public void rollback() { } @Override - public long createNamespace( String name, NamespaceType namespaceType, boolean caseSensitive ) { + public long createNamespace( String name, DataModel dataModel, boolean caseSensitive ) { throw new NotImplementedException(); } diff --git a/dbms/src/main/java/org/polypheny/db/PolyphenyDb.java b/dbms/src/main/java/org/polypheny/db/PolyphenyDb.java index b5ba4502df..8c078772c7 100644 --- a/dbms/src/main/java/org/polypheny/db/PolyphenyDb.java +++ b/dbms/src/main/java/org/polypheny/db/PolyphenyDb.java @@ -45,8 +45,8 @@ import org.polypheny.db.catalog.entity.LogicalAdapter.AdapterType; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.catalog.impl.PolyCatalog; -import org.polypheny.db.catalog.logistic.NamespaceType; -import org.polypheny.db.cli.PolyphenyModesConverter; +import org.polypheny.db.catalog.logistic.DataModel; +import org.polypheny.db.cli.PolyModesConverter; import org.polypheny.db.config.ConfigManager; import org.polypheny.db.config.RuntimeConfig; import org.polypheny.db.ddl.DdlManager; @@ -114,7 +114,7 @@ public class PolyphenyDb { @Option(name = { "-memoryCatalog" }, description = "Store catalog only in-memory") public boolean memoryCatalog = false; - @Option(name = { "-mode" }, description = "Special system configuration for running tests", typeConverterProvider = PolyphenyModesConverter.class) + @Option(name = { "-mode" }, description = "Special system configuration for running tests", typeConverterProvider = PolyModesConverter.class) public PolyphenyMode mode = PolyphenyMode.PRODUCTION; @Option(name = { "-gui" }, description = "Show splash screen on startup and add taskbar gui") @@ -124,7 +124,7 @@ public class PolyphenyDb { public boolean daemonMode = false; @Option(name = { "-defaultStore" }, description = "Type of default storeId") - public String defaultStoreName = "hsqldb"; + public String defaultStoreName = "monetdb"; @Option(name = { "-defaultSource" }, description = "Type of default source") public String defaultSourceName = "csv"; @@ -387,7 +387,7 @@ public void join( final long millis ) throws InterruptedException { // temporary add sql and rel here QueryLanguage language = new QueryLanguage( - NamespaceType.RELATIONAL, + DataModel.RELATIONAL, "alg", List.of( "alg", "algebra" ), null, diff --git a/dbms/src/main/java/org/polypheny/db/ddl/DdlManagerImpl.java b/dbms/src/main/java/org/polypheny/db/ddl/DdlManagerImpl.java index 5aa8ccec2d..73371deef3 100644 --- a/dbms/src/main/java/org/polypheny/db/ddl/DdlManagerImpl.java +++ b/dbms/src/main/java/org/polypheny/db/ddl/DdlManagerImpl.java @@ -80,12 +80,12 @@ import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.catalog.logistic.Collation; import org.polypheny.db.catalog.logistic.ConstraintType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.DataPlacementRole; import org.polypheny.db.catalog.logistic.EntityType; import org.polypheny.db.catalog.logistic.ForeignKeyOption; import org.polypheny.db.catalog.logistic.IndexType; import org.polypheny.db.catalog.logistic.NameGenerator; -import org.polypheny.db.catalog.logistic.NamespaceType; import org.polypheny.db.catalog.logistic.PartitionType; import org.polypheny.db.catalog.logistic.Pattern; import org.polypheny.db.catalog.logistic.PlacementType; @@ -172,7 +172,7 @@ protected DataStore getDataStoreInstance( long storeId ) { @Override - public long createNamespace( String name, NamespaceType type, boolean ifNotExists, boolean replace ) { + public long createNamespace( String name, DataModel type, boolean ifNotExists, boolean replace ) { name = name.toLowerCase(); // Check if there is already a namespace with this name Optional optionalNamespace = catalog.getSnapshot().getNamespace( name ); @@ -869,14 +869,14 @@ private void deleteAllocationColumn( LogicalTable table, Statement statement, Al private void checkModelLogic( LogicalTable catalogTable ) { - if ( catalogTable.namespaceType == NamespaceType.DOCUMENT ) { + if ( catalogTable.dataModel == DataModel.DOCUMENT ) { throw new GenericRuntimeException( "Modification operation is not allowed by schema type DOCUMENT" ); } } private void checkModelLogic( LogicalTable catalogTable, String columnName ) { - if ( catalogTable.namespaceType == NamespaceType.DOCUMENT + if ( catalogTable.dataModel == DataModel.DOCUMENT && (columnName.equals( "_data" ) || columnName.equals( "_id" )) ) { throw new GenericRuntimeException( "Modification operation is not allowed by schema type DOCUMENT" ); } @@ -1648,10 +1648,10 @@ public void createMaterializedView( String viewName, long namespaceId, AlgRoot a private void checkModelLangCompatibility( QueryLanguage language, long namespaceId ) { LogicalNamespace namespace = catalog.getSnapshot().getNamespace( namespaceId ).orElseThrow(); - if ( namespace.namespaceType != language.getNamespaceType() ) { + if ( namespace.dataModel != language.getDataModel() ) { throw new GenericRuntimeException( "The used language cannot execute schema changing queries on this entity with the data model %s.", - namespace.getNamespaceType() ); + namespace.getDataModel() ); } } @@ -1675,7 +1675,7 @@ public long createGraph( String name, boolean modifiable, @Nullable List PolyImplementation createPolyImplementation( PreparedResult preparedResult, Kind kind, AlgNode optimalNode, AlgDataType validatedRowType, Convention resultConvention, ExecutionTimeMonitor executionTimeMonitor, NamespaceType namespaceType ) { + private PolyImplementation createPolyImplementation( PreparedResult preparedResult, Kind kind, AlgNode optimalNode, AlgDataType validatedRowType, Convention resultConvention, ExecutionTimeMonitor executionTimeMonitor, DataModel dataModel ) { final AlgDataType jdbcType = QueryProcessorHelpers.makeStruct( optimalNode.getCluster().getTypeFactory(), validatedRowType ); return new PolyImplementation( jdbcType, - namespaceType, + dataModel, executionTimeMonitor, preparedResult, kind, diff --git a/dbms/src/main/java/org/polypheny/db/processing/ConstraintEnforceAttacher.java b/dbms/src/main/java/org/polypheny/db/processing/ConstraintEnforceAttacher.java index 97e4521066..56056eaab6 100644 --- a/dbms/src/main/java/org/polypheny/db/processing/ConstraintEnforceAttacher.java +++ b/dbms/src/main/java/org/polypheny/db/processing/ConstraintEnforceAttacher.java @@ -59,8 +59,8 @@ import org.polypheny.db.catalog.entity.logical.LogicalTable; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.catalog.logistic.ConstraintType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; import org.polypheny.db.catalog.snapshot.LogicalRelSnapshot; import org.polypheny.db.config.Config; import org.polypheny.db.config.Config.ConfigListener; @@ -642,7 +642,7 @@ private boolean testConstraintsValid() { .getNamespaces( null ) .stream() .flatMap( n -> Catalog.getInstance().getSnapshot().rel().getTables( n.id, null ).stream() ) - .filter( t -> t.entityType == EntityType.ENTITY && t.getNamespaceType() == NamespaceType.RELATIONAL ) + .filter( t -> t.entityType == EntityType.ENTITY && t.getDataModel() == DataModel.RELATIONAL ) .collect( Collectors.toList() ); Transaction transaction = this.manager.startTransaction( Catalog.defaultUserId, false, "ConstraintEnforcement" ); Statement statement = transaction.createStatement(); diff --git a/dbms/src/main/java/org/polypheny/db/processing/shuttles/LogicalQueryInformationImpl.java b/dbms/src/main/java/org/polypheny/db/processing/shuttles/LogicalQueryInformationImpl.java index cf29e9409e..3c680ffea3 100644 --- a/dbms/src/main/java/org/polypheny/db/processing/shuttles/LogicalQueryInformationImpl.java +++ b/dbms/src/main/java/org/polypheny/db/processing/shuttles/LogicalQueryInformationImpl.java @@ -26,7 +26,7 @@ import java.util.Set; import java.util.stream.Collectors; import lombok.Value; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.routing.LogicalQueryInformation; @Value @@ -37,8 +37,8 @@ public class LogicalQueryInformationImpl implements LogicalQueryInformation { public ImmutableMap availableColumns; // column id -> schemaName.tableName.ColumnName public ImmutableMap availableColumnsWithTable; // columnId -> tableId public ImmutableMap usedColumns; - public ImmutableMap> scannedEntities; - public ImmutableMap> modifiedEntities; + public ImmutableMap> scannedEntities; + public ImmutableMap> modifiedEntities; public ImmutableSet allModifiedEntities; public ImmutableSet allScannedEntities; public ImmutableSet allEntities; @@ -50,8 +50,8 @@ public LogicalQueryInformationImpl( Map availableColumns, Map availableColumnsWithTable, Map usedColumns, - Map> scannedEntities, - Map> modifiedEntities ) { + Map> scannedEntities, + Map> modifiedEntities ) { this.queryHash = queryHash; this.accessedPartitions = ImmutableMap.copyOf( accessedPartitions ); this.availableColumns = ImmutableMap.copyOf( availableColumns ); diff --git a/dbms/src/main/java/org/polypheny/db/routing/routers/AbstractDqlRouter.java b/dbms/src/main/java/org/polypheny/db/routing/routers/AbstractDqlRouter.java index 6f1e1112df..7c344ea178 100644 --- a/dbms/src/main/java/org/polypheny/db/routing/routers/AbstractDqlRouter.java +++ b/dbms/src/main/java/org/polypheny/db/routing/routers/AbstractDqlRouter.java @@ -42,7 +42,7 @@ import org.polypheny.db.catalog.entity.logical.LogicalEntity; import org.polypheny.db.catalog.entity.logical.LogicalTable; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.plan.AlgOptCluster; import org.polypheny.db.rex.RexBuilder; import org.polypheny.db.routing.LogicalQueryInformation; @@ -195,7 +195,7 @@ protected List buildSelect( AlgNode node, List( partitionsColumnsPlacements.values() ).get( 0 ).get( 0 ); // todo dl: remove after RowType refactor - if ( catalog.getSnapshot().getNamespace( placement.namespaceId ).orElseThrow().namespaceType == NamespaceType.DOCUMENT ) { + if ( catalog.getSnapshot().getNamespace( placement.namespaceId ).orElseThrow().dataModel == DataModel.DOCUMENT ) { AlgDataType rowType = new AlgRecordType( List.of( new AlgDataTypeFieldImpl( 1L, "d", 0, cluster.getTypeFactory().createPolyType( PolyType.DOCUMENT ) ) ) ); builder.push( new LogicalTransformer( node.getCluster(), diff --git a/dbms/src/main/java/org/polypheny/db/transaction/EntityAccessMap.java b/dbms/src/main/java/org/polypheny/db/transaction/EntityAccessMap.java index 31400c287a..43e402bc13 100644 --- a/dbms/src/main/java/org/polypheny/db/transaction/EntityAccessMap.java +++ b/dbms/src/main/java/org/polypheny/db/transaction/EntityAccessMap.java @@ -46,7 +46,7 @@ import org.polypheny.db.catalog.entity.allocation.AllocationEntity; import org.polypheny.db.catalog.entity.logical.LogicalTable; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.config.RuntimeConfig; import org.polypheny.db.partition.properties.PartitionProperty; import org.polypheny.db.plan.AlgOptUtil; @@ -277,7 +277,7 @@ public void visit( AlgNode p, int ordinal, AlgNode parent ) { if ( accessedPartitions.containsKey( p.getId() ) ) { relevantPartitions = accessedPartitions.get( p.getId() ); } else { - if ( table.namespaceType == NamespaceType.RELATIONAL ) { + if ( table.dataModel == DataModel.RELATIONAL ) { List allocations = Catalog.getInstance().getSnapshot().alloc().getFromLogical( table.id ); relevantPartitions = allocations.stream().map( a -> a.id ).collect( Collectors.toList() ); } else { diff --git a/dbms/src/test/java/org/polypheny/db/catalog/CatalogTransactionTest.java b/dbms/src/test/java/org/polypheny/db/catalog/CatalogTransactionTest.java index af9a2f650b..0242386f28 100644 --- a/dbms/src/test/java/org/polypheny/db/catalog/CatalogTransactionTest.java +++ b/dbms/src/test/java/org/polypheny/db/catalog/CatalogTransactionTest.java @@ -23,8 +23,8 @@ import org.polypheny.db.catalog.entity.logical.LogicalTable; import org.polypheny.db.catalog.impl.PolyCatalog; import org.polypheny.db.catalog.logistic.Collation; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; import org.polypheny.db.type.PolyType; public class CatalogTransactionTest { @@ -40,7 +40,7 @@ public static void initClass() { public void simpleRollbackTest() { PolyCatalog catalog = new PolyCatalog(); - long namespaceId = catalog.createNamespace( "test", NamespaceType.RELATIONAL, false ); + long namespaceId = catalog.createNamespace( "test", DataModel.RELATIONAL, false ); catalog.commit(); @@ -61,7 +61,7 @@ public void simpleRollbackTest() { public void rollbackTest() { PolyCatalog catalog = new PolyCatalog(); - long namespaceId = catalog.createNamespace( "test", NamespaceType.RELATIONAL, false ); + long namespaceId = catalog.createNamespace( "test", DataModel.RELATIONAL, false ); catalog.commit(); diff --git a/information/src/main/java/org/polypheny/db/information/InformationManager.java b/information/src/main/java/org/polypheny/db/information/InformationManager.java index 7b4fdceb41..f04a66e5c9 100644 --- a/information/src/main/java/org/polypheny/db/information/InformationManager.java +++ b/information/src/main/java/org/polypheny/db/information/InformationManager.java @@ -320,4 +320,14 @@ private void notifyPageList() { } } + + public void attachStacktrace( Exception e ) { + InformationPage exceptionPage = new InformationPage( "Stacktrace" ).fullWidth(); + InformationGroup exceptionGroup = new InformationGroup( exceptionPage.getId(), "Stacktrace" ); + InformationStacktrace exceptionElement = new InformationStacktrace( e, exceptionGroup ); + this.addPage( exceptionPage ); + this.addGroup( exceptionGroup ); + this.registerInformation( exceptionElement ); + } + } diff --git a/monitoring/src/main/java/org/polypheny/db/monitoring/statistics/DashboardInformation.java b/monitoring/src/main/java/org/polypheny/db/monitoring/statistics/DashboardInformation.java index 0f755ad4f4..5cabca9618 100644 --- a/monitoring/src/main/java/org/polypheny/db/monitoring/statistics/DashboardInformation.java +++ b/monitoring/src/main/java/org/polypheny/db/monitoring/statistics/DashboardInformation.java @@ -22,7 +22,7 @@ import lombok.Setter; import org.polypheny.db.catalog.Catalog; import org.polypheny.db.catalog.entity.LogicalAdapter.AdapterType; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.monitoring.core.MonitoringServiceProvider; import org.polypheny.db.monitoring.events.metrics.DmlDataPoint; @@ -50,7 +50,7 @@ public class DashboardInformation { private final Map> availableAdapter = new HashMap<>(); - private final Map> availableSchemas = new HashMap<>(); + private final Map> availableSchemas = new HashMap<>(); private boolean catalogPersistent; @@ -78,7 +78,7 @@ public void updatePolyphenyStatistic() { this.availableAdapter.put( v.uniqueName, Pair.of( v.adapterTypeName, v.type ) ); } ); snapshot.getNamespaces( null ).forEach( v -> { - availableSchemas.put( v.id, Pair.of( v.name, v.namespaceType ) ); + availableSchemas.put( v.id, Pair.of( v.name, v.dataModel ) ); } ); } diff --git a/monitoring/src/main/java/org/polypheny/db/monitoring/statistics/StatisticQueryProcessor.java b/monitoring/src/main/java/org/polypheny/db/monitoring/statistics/StatisticQueryProcessor.java index 14f15d35d2..7efc5071bd 100644 --- a/monitoring/src/main/java/org/polypheny/db/monitoring/statistics/StatisticQueryProcessor.java +++ b/monitoring/src/main/java/org/polypheny/db/monitoring/statistics/StatisticQueryProcessor.java @@ -30,7 +30,7 @@ import org.polypheny.db.catalog.Catalog; import org.polypheny.db.catalog.entity.logical.LogicalTable; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.Pattern; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.config.RuntimeConfig; @@ -86,7 +86,7 @@ public List getAllColumns() { Snapshot snapshot = Catalog.getInstance().getSnapshot(); return snapshot.getNamespaces( null ) .stream() - .filter( n -> n.namespaceType == NamespaceType.RELATIONAL ) + .filter( n -> n.dataModel == DataModel.RELATIONAL ) .flatMap( n -> snapshot.rel().getTables( Pattern.of( n.name ), null ).stream().filter( t -> t.entityType != EntityType.VIEW ).flatMap( t -> snapshot.rel().getColumns( t.id ).stream() ) ) .map( QueryResult::fromCatalogColumn ) .collect( Collectors.toList() ); @@ -100,7 +100,7 @@ public List getAllColumns() { */ public List getAllTable() { Snapshot snapshot = Catalog.getInstance().getSnapshot(); - return snapshot.getNamespaces( null ).stream().filter( n -> n.namespaceType == NamespaceType.RELATIONAL ) + return snapshot.getNamespaces( null ).stream().filter( n -> n.dataModel == DataModel.RELATIONAL ) .flatMap( n -> snapshot.rel().getTables( Pattern.of( n.name ), null ).stream().filter( t -> t.entityType != EntityType.VIEW ) ).collect( Collectors.toList() ); } diff --git a/monitoring/src/main/java/org/polypheny/db/monitoring/statistics/StatisticTable.java b/monitoring/src/main/java/org/polypheny/db/monitoring/statistics/StatisticTable.java index 65039f6129..9b28f83fed 100644 --- a/monitoring/src/main/java/org/polypheny/db/monitoring/statistics/StatisticTable.java +++ b/monitoring/src/main/java/org/polypheny/db/monitoring/statistics/StatisticTable.java @@ -24,7 +24,7 @@ import org.polypheny.db.catalog.Catalog; import org.polypheny.db.catalog.entity.logical.LogicalTable; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; /** @@ -43,7 +43,7 @@ public class StatisticTable { private TableCalls calls; @Getter - private NamespaceType namespaceType; + private DataModel dataModel; @Getter private final List availableAdapters = new ArrayList<>(); @@ -74,7 +74,7 @@ public StatisticTable( Long tableId ) { if ( catalog.getSnapshot().getLogicalEntity( tableId ).isPresent() ) { LogicalTable catalogTable = catalog.getSnapshot().getLogicalEntity( tableId ).map( e -> e.unwrap( LogicalTable.class ) ).orElseThrow(); this.table = catalogTable.name; - this.namespaceType = catalogTable.namespaceType; + this.dataModel = catalogTable.dataModel; //this.dataPlacements = ImmutableList.copyOf( catalog.getSnapshot().alloc().getDataPlacements( catalogTable.id ).stream().map( c -> c.adapterId ).collect( Collectors.toList() ) ); this.entityType = catalogTable.entityType; } diff --git a/monitoring/src/main/java/org/polypheny/db/monitoring/statistics/StatisticsManagerImpl.java b/monitoring/src/main/java/org/polypheny/db/monitoring/statistics/StatisticsManagerImpl.java index 9cba794966..763dfeeff4 100644 --- a/monitoring/src/main/java/org/polypheny/db/monitoring/statistics/StatisticsManagerImpl.java +++ b/monitoring/src/main/java/org/polypheny/db/monitoring/statistics/StatisticsManagerImpl.java @@ -721,7 +721,7 @@ public void displayInformation() { } ); tableStatistic.forEach( ( k, v ) -> { - tableInformation.addRow( v.getTable(), v.getNamespaceType(), v.getNumberOfRows() ); + tableInformation.addRow( v.getTable(), v.getDataModel(), v.getNumberOfRows() ); if ( RuntimeConfig.ACTIVE_TRACKING.getBoolean() && v.getEntityType() != EntityType.MATERIALIZED_VIEW ) { tableSelectInformation.addRow( diff --git a/plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/DbmsMeta.java b/plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/DbmsMeta.java index 4a0e48d255..7e8f48a2ca 100644 --- a/plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/DbmsMeta.java +++ b/plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/DbmsMeta.java @@ -96,9 +96,9 @@ import org.polypheny.db.catalog.entity.logical.LogicalTable; import org.polypheny.db.catalog.entity.logical.LogicalTable.PrimitiveCatalogTable; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; import org.polypheny.db.catalog.logistic.EntityType.PrimitiveTableType; -import org.polypheny.db.catalog.logistic.NamespaceType; import org.polypheny.db.catalog.logistic.Pattern; import org.polypheny.db.iface.AuthenticationException; import org.polypheny.db.iface.Authenticator; @@ -147,7 +147,7 @@ public class DbmsMeta implements ProtobufMeta { public static final boolean SEND_FIRST_FRAME_WITH_RESPONSE = false; private final ConcurrentMap openConnections = new ConcurrentHashMap<>(); - private final ConcurrentMap openStatements = new ConcurrentHashMap<>(); + private final ConcurrentMap openStatements = new ConcurrentHashMap<>(); final Calendar calendar = Unsafe.localCalendar(); private final Catalog catalog = Catalog.getInstance(); @@ -203,8 +203,8 @@ private MetaResultSet createMetaResultSet( List columns, CursorFactory cursorFactory, final Iterable firstFrame ) { - final PolyphenyDbSignature signature = - new PolyphenyDbSignature( + final PolySignature signature = + new PolySignature( "", ImmutableList.of(), internalParameters, @@ -217,7 +217,7 @@ private MetaResultSet createMetaResultSet( null, StatementType.SELECT, new ExecutionTimeMonitor(), - NamespaceType.RELATIONAL ) { + DataModel.RELATIONAL ) { @Override public Enumerable enumerable( DataContext dataContext ) { return Linq4j.asEnumerable( firstFrame ); @@ -906,7 +906,7 @@ public ExecuteBatchResult executeBatchProtobuf( final StatementHandle h, final L log.trace( "executeBatchProtobuf( StatementHandle {}, List {} )", h, parameterValues ); } - final PolyphenyDbStatementHandle statementHandle = getPolyphenyDbStatementHandle( h ); + final PolyStatementHandle statementHandle = getPolyphenyDbStatementHandle( h ); long[] updateCounts = new long[parameterValues.size()]; Map> values = new HashMap<>(); @@ -988,7 +988,7 @@ public StatementHandle prepare( final ConnectionHandle ch, final String sql, fin } StatementHandle h = createStatement( ch ); - PolyphenyDbStatementHandle polyphenyDbStatement; + PolyStatementHandle polyphenyDbStatement; try { polyphenyDbStatement = getPolyphenyDbStatementHandle( h ); } catch ( NoSuchStatementException e ) { @@ -1007,7 +1007,7 @@ public StatementHandle prepare( final ConnectionHandle ch, final String sql, fin List avaticaParameters = deriveAvaticaParameters( parameterRowType ); - PolyphenyDbSignature signature = new PolyphenyDbSignature( + PolySignature signature = new PolySignature( sql, avaticaParameters, ImmutableMap.of(), @@ -1020,7 +1020,7 @@ public StatementHandle prepare( final ConnectionHandle ch, final String sql, fin null, StatementType.SELECT, null, - NamespaceType.RELATIONAL ); + DataModel.RELATIONAL ); h.signature = signature; polyphenyDbStatement.setSignature( signature ); @@ -1067,7 +1067,7 @@ public ExecuteResult prepareAndExecute( final StatementHandle h, final String sq log.trace( "prepareAndExecute( StatementHandle {}, String {}, long {}, int {}, PrepareCallback {} )", h, sql, maxRowCount, maxRowsInFirstFrame, callback ); } - PolyphenyDbStatementHandle statementHandle = getPolyphenyDbStatementHandle( h ); + PolyStatementHandle statementHandle = getPolyphenyDbStatementHandle( h ); statementHandle.setPreparedQuery( sql ); statementHandle.setStatement( connection.getCurrentOrCreateNewTransaction().createStatement() ); return execute( h, new ArrayList<>(), maxRowsInFirstFrame, connection ); @@ -1135,9 +1135,9 @@ public Frame fetch( final StatementHandle h, final long offset, final int fetchM log.trace( "fetch( StatementHandle {}, long {}, int {} )", h, offset, fetchMaxRowCount ); } - final PolyphenyDbStatementHandle statementHandle = getPolyphenyDbStatementHandle( h ); + final PolyStatementHandle statementHandle = getPolyphenyDbStatementHandle( h ); - final PolyphenyDbSignature signature = statementHandle.getSignature(); + final PolySignature signature = statementHandle.getSignature(); final Iterator iterator; if ( statementHandle.getOpenResultSet() == null ) { final Iterable iterable = createExternalIterable( statementHandle.getStatement().getDataContext(), signature ); @@ -1169,7 +1169,7 @@ public Frame fetch( final StatementHandle h, final long offset, final int fetchM } - private Iterable createExternalIterable( DataContext dataContext, PolyphenyDbSignature signature ) { + private Iterable createExternalIterable( DataContext dataContext, PolySignature signature ) { return externalize( signature.enumerable( dataContext ), signature.rowType ); } @@ -1209,7 +1209,7 @@ public ExecuteResult execute( final StatementHandle h, final List pa if ( log.isTraceEnabled() ) { log.trace( "execute( StatementHandle {}, List {}, int {} )", h, parameterValues, maxRowsInFirstFrame ); } - final PolyphenyDbStatementHandle statementHandle = getPolyphenyDbStatementHandle( h ); + final PolyStatementHandle statementHandle = getPolyphenyDbStatementHandle( h ); statementHandle.setStatement( connection.getCurrentOrCreateNewTransaction().createStatement() ); return execute( h, parameterValues, maxRowsInFirstFrame, connection ); } @@ -1217,7 +1217,7 @@ public ExecuteResult execute( final StatementHandle h, final List pa private ExecuteResult execute( StatementHandle h, List parameterValues, int maxRowsInFirstFrame, PolyphenyDbConnectionHandle connection ) throws NoSuchStatementException { - final PolyphenyDbStatementHandle statementHandle = getPolyphenyDbStatementHandle( h ); + final PolyStatementHandle statementHandle = getPolyphenyDbStatementHandle( h ); long index = 0; for ( TypedValue v : parameterValues ) { @@ -1300,7 +1300,7 @@ private PolyType toPolyType( Rep type ) { private PolyList convertList( List list ) { - List newList = new LinkedList<>(); + List newList = new ArrayList<>(); for ( TypedValue o : list ) { newList.add( toPolyValue( o ) ); } @@ -1350,7 +1350,7 @@ private PolyValue toPolyValue( TypedValue value ) { private void prepare( StatementHandle h, String sql ) throws NoSuchStatementException { - PolyphenyDbStatementHandle statementHandle = getPolyphenyDbStatementHandle( h ); + PolyStatementHandle statementHandle = getPolyphenyDbStatementHandle( h ); QueryLanguage language = QueryLanguage.from( "sql" ); QueryContext context = QueryContext.builder() .query( sql ) @@ -1359,7 +1359,7 @@ private void prepare( StatementHandle h, String sql ) throws NoSuchStatementExce .transactionManager( transactionManager ) .build(); - PolyphenyDbSignature signature = PolyphenyDbSignature.from( LanguageManager.getINSTANCE().anyPrepareQuery( context, statementHandle.getStatement() ).get( 0 ).getImplementation() ); + PolySignature signature = PolySignature.from( LanguageManager.getINSTANCE().anyPrepareQuery( context, statementHandle.getStatement() ).get( 0 ).getImplementation() ); h.signature = signature; statementHandle.setSignature( signature ); @@ -1394,7 +1394,7 @@ public Enumerator enumerator() { } - private List execute( StatementHandle h, PolyphenyDbConnectionHandle connection, PolyphenyDbStatementHandle statementHandle, int maxRowsInFirstFrame ) { + private List execute( StatementHandle h, PolyphenyDbConnectionHandle connection, PolyStatementHandle statementHandle, int maxRowsInFirstFrame ) { List resultSets; if ( statementHandle.getSignature().statementType == StatementType.OTHER_DDL ) { MetaResultSet resultSet = MetaResultSet.count( statementHandle.getConnection().getConnectionId().toString(), h.id, 1 ); @@ -1447,10 +1447,10 @@ public StatementHandle createStatement( ConnectionHandle ch ) { log.trace( "createStatement( ConnectionHandle {} )", ch ); } - final PolyphenyDbStatementHandle statement; + final PolyStatementHandle statement; final int id = statementIdGenerator.getAndIncrement(); - statement = new PolyphenyDbStatementHandle<>( connection, id ); + statement = new PolyStatementHandle<>( connection, id ); openStatements.put( ch.id + "::" + id, statement ); StatementHandle h = new StatementHandle( ch.id, statement.getStatementId(), null ); @@ -1475,7 +1475,7 @@ public void closeStatement( final StatementHandle statementHandle ) { log.trace( "closeStatement( StatementHandle {} )", statementHandle ); } - final PolyphenyDbStatementHandle toClose = openStatements.remove( statementHandle.connectionId + "::" + statementHandle.id ); + final PolyStatementHandle toClose = openStatements.remove( statementHandle.connectionId + "::" + statementHandle.id ); if ( toClose != null ) { if ( toClose.getOpenResultSet() != null && toClose.getOpenResultSet() instanceof AutoCloseable ) { try { @@ -1588,7 +1588,7 @@ public void closeConnection( ConnectionHandle ch ) { for ( final String key : openStatements.keySet() ) { if ( key.startsWith( ch.id ) ) { - PolyphenyDbStatementHandle statementHandle = openStatements.remove( key ); + PolyStatementHandle statementHandle = openStatements.remove( key ); statementHandle.unset(); } } @@ -1607,8 +1607,8 @@ private PolyphenyDbConnectionHandle getPolyphenyDbConnectionHandle( String conne } - private PolyphenyDbStatementHandle getPolyphenyDbStatementHandle( StatementHandle h ) throws NoSuchStatementException { - final PolyphenyDbStatementHandle statement; + private PolyStatementHandle getPolyphenyDbStatementHandle( StatementHandle h ) throws NoSuchStatementException { + final PolyStatementHandle statement; if ( openStatements.containsKey( h.connectionId + "::" + h.id ) ) { statement = openStatements.get( h.connectionId + "::" + h.id ); } else { diff --git a/plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/PolyphenyDbSignature.java b/plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/PolySignature.java similarity index 90% rename from plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/PolyphenyDbSignature.java rename to plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/PolySignature.java index 8d43adb9c3..a8f47081c4 100644 --- a/plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/PolyphenyDbSignature.java +++ b/plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/PolySignature.java @@ -35,7 +35,7 @@ import org.polypheny.db.algebra.AlgCollation; import org.polypheny.db.algebra.type.AlgDataType; import org.polypheny.db.algebra.type.AlgDataTypeField; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.routing.ExecutionTimeMonitor; import org.polypheny.db.runtime.Bindable; import org.polypheny.db.schema.PolyphenyDbSchema; @@ -48,7 +48,7 @@ * */ @Getter -public class PolyphenyDbSignature extends Meta.Signature { +public class PolySignature extends Meta.Signature { @JsonIgnore public final AlgDataType rowType; @@ -58,11 +58,11 @@ public class PolyphenyDbSignature extends Meta.Signature { private final List collationList; private final long maxRowCount; private final Bindable bindable; - private final NamespaceType namespaceType; + private final DataModel dataModel; private final ExecutionTimeMonitor executionTimeMonitor; - public PolyphenyDbSignature( + public PolySignature( String sql, List parameterList, Map internalParameters, @@ -75,7 +75,7 @@ public PolyphenyDbSignature( Bindable bindable, StatementType statementType, ExecutionTimeMonitor executionTimeMonitor, - NamespaceType namespaceType ) { + DataModel dataModel ) { super( columns, sql, parameterList, internalParameters, cursorFactory, statementType ); this.rowType = rowType; this.rootSchema = rootSchema; @@ -83,11 +83,11 @@ public PolyphenyDbSignature( this.maxRowCount = maxRowCount; this.bindable = bindable; this.executionTimeMonitor = executionTimeMonitor; - this.namespaceType = namespaceType; + this.dataModel = dataModel; } - public static PolyphenyDbSignature from( PolyImplementation prepareQuery ) { + public static PolySignature from( PolyImplementation prepareQuery ) { final List parameters = new ArrayList<>(); if ( prepareQuery.rowType != null ) { for ( AlgDataTypeField field : prepareQuery.rowType.getFields() ) { @@ -103,7 +103,7 @@ public static PolyphenyDbSignature from( PolyImplementation prepareQuery ) { field.getName() ) ); } } - return new PolyphenyDbSignature( + return new PolySignature( "", parameters, new HashMap<>(), @@ -116,7 +116,7 @@ public static PolyphenyDbSignature from( PolyImplementation prepareQuery ) { prepareQuery.getBindable(), prepareQuery.getStatementType(), prepareQuery.getExecutionTimeMonitor(), - prepareQuery.getNamespaceType() + prepareQuery.getDataModel() ); } diff --git a/plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/PolyphenyDbStatementHandle.java b/plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/PolyStatementHandle.java similarity index 85% rename from plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/PolyphenyDbStatementHandle.java rename to plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/PolyStatementHandle.java index 33a986d5d9..312a7aa8b9 100644 --- a/plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/PolyphenyDbStatementHandle.java +++ b/plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/PolyStatementHandle.java @@ -27,12 +27,12 @@ * */ @Getter -public class PolyphenyDbStatementHandle { +public class PolyStatementHandle { private final PolyphenyDbConnectionHandle connection; private final int statementId; private volatile transient Iterator openResultSet; - private volatile transient PolyphenyDbSignature signature; + private volatile transient PolySignature signature; @Setter private volatile transient String preparedQuery; @Setter @@ -45,7 +45,7 @@ public class PolyphenyDbStatementHandle { private final StopWatch executionStopWatch = new StopWatch(); - public PolyphenyDbStatementHandle( final PolyphenyDbConnectionHandle connection, final int statementId ) { + public PolyStatementHandle( final PolyphenyDbConnectionHandle connection, final int statementId ) { this.connection = connection; this.statementId = statementId; } @@ -59,7 +59,7 @@ public synchronized void setOpenResultSet( Iterator result ) { } - public synchronized void setSignature( PolyphenyDbSignature signature ) { + public synchronized void setSignature( PolySignature signature ) { this.signature = signature; this.openResultSet = null; executionStopWatch.reset(); diff --git a/plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/PolyphenyDbResultSet.java b/plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/PolyphenyDbResultSet.java index a4f2e2fffd..5e50660315 100644 --- a/plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/PolyphenyDbResultSet.java +++ b/plugins/avatica-interface/src/main/java/org/polypheny/db/avatica/PolyphenyDbResultSet.java @@ -62,8 +62,8 @@ public class PolyphenyDbResultSet extends AvaticaResultSet { /** * Creates a PolyphenyDbResultSet. */ - public PolyphenyDbResultSet( AvaticaStatement statement, PolyphenyDbSignature polyphenyDbSignature, ResultSetMetaData resultSetMetaData, TimeZone timeZone, Meta.Frame firstFrame ) throws SQLException { - super( statement, null, polyphenyDbSignature, resultSetMetaData, timeZone, firstFrame ); + public PolyphenyDbResultSet( AvaticaStatement statement, PolySignature polySignature, ResultSetMetaData resultSetMetaData, TimeZone timeZone, Meta.Frame firstFrame ) throws SQLException { + super( statement, null, polySignature, resultSetMetaData, timeZone, firstFrame ); } @@ -75,9 +75,9 @@ public ResultSet create( ColumnMetaData.AvaticaType elementType, Iterable // Do not make public - PolyphenyDbSignature getSignature() { - return (PolyphenyDbSignature) signature; + PolySignature getSignature() { + return (PolySignature) signature; } } diff --git a/plugins/cql-language/src/main/java/org/polypheny/db/cql/CqlLanguagePlugin.java b/plugins/cql-language/src/main/java/org/polypheny/db/cql/CqlLanguagePlugin.java index a2c341cec5..9556c3c200 100644 --- a/plugins/cql-language/src/main/java/org/polypheny/db/cql/CqlLanguagePlugin.java +++ b/plugins/cql-language/src/main/java/org/polypheny/db/cql/CqlLanguagePlugin.java @@ -18,7 +18,7 @@ import java.util.List; import lombok.extern.slf4j.Slf4j; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.languages.LanguageManager; import org.polypheny.db.languages.QueryLanguage; import org.polypheny.db.plugins.PluginContext; @@ -44,7 +44,7 @@ public CqlLanguagePlugin( PluginContext context ) { @Override public void start() { - QueryLanguage language = new QueryLanguage( NamespaceType.RELATIONAL, NAME, List.of( NAME ), null, CqlProcessor::new, null, CqlQueryBuilder::splitter ); + QueryLanguage language = new QueryLanguage( DataModel.RELATIONAL, NAME, List.of( NAME ), null, CqlProcessor::new, null, CqlQueryBuilder::splitter ); LanguageManager.getINSTANCE().addQueryLanguage( language ); PolyPluginManager.AFTER_INIT.add( () -> LanguageCrud.addToResult( language, LanguageCrud::getRelResult ) ); } diff --git a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/CypherLanguagePlugin.java b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/CypherLanguagePlugin.java index 9caa977e22..649557b1f8 100644 --- a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/CypherLanguagePlugin.java +++ b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/CypherLanguagePlugin.java @@ -17,7 +17,7 @@ package org.polypheny.db.cypher; import java.util.List; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.cypher.parser.CypherParserImpl; import org.polypheny.db.languages.LanguageManager; import org.polypheny.db.languages.QueryLanguage; @@ -44,7 +44,7 @@ public CypherLanguagePlugin( PluginContext context ) { @Override public void start() { QueryLanguage language = new QueryLanguage( - NamespaceType.GRAPH, + DataModel.GRAPH, NAME, List.of( NAME, "opencypher" ), CypherParserImpl.FACTORY, diff --git a/plugins/jdbc-adapter-framework/src/test/java/org/polypheny/db/adapter/jdbc/alg2sql/AlgToSqlConverterTest.java b/plugins/jdbc-adapter-framework/src/test/java/org/polypheny/db/adapter/jdbc/alg2sql/AlgToSqlConverterTest.java index 3c271bdbac..dccb84190e 100644 --- a/plugins/jdbc-adapter-framework/src/test/java/org/polypheny/db/adapter/jdbc/alg2sql/AlgToSqlConverterTest.java +++ b/plugins/jdbc-adapter-framework/src/test/java/org/polypheny/db/adapter/jdbc/alg2sql/AlgToSqlConverterTest.java @@ -36,7 +36,7 @@ import org.polypheny.db.algebra.rules.UnionMergeRule; import org.polypheny.db.algebra.type.AlgDataTypeSystemImpl; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.languages.NodeToAlgConverter; import org.polypheny.db.languages.NodeToAlgConverter.Config; import org.polypheny.db.languages.OperatorRegistry; @@ -108,7 +108,7 @@ public class AlgToSqlConverterTest extends SqlLanguageDependent { private Sql sql( String sql ) { final SchemaPlus schema = Frameworks .createSnapshot( true ) - .add( "foodmart", new ReflectiveSchema( new FoodmartSchema(), -1 ), NamespaceType.RELATIONAL ); + .add( "foodmart", new ReflectiveSchema( new FoodmartSchema(), -1 ), DataModel.RELATIONAL ); return new Sql( schema, sql, PolyphenyDbSqlDialect.DEFAULT, DEFAULT_REL_CONFIG, ImmutableList.of() ); } @@ -164,7 +164,7 @@ private static MysqlSqlDialect mySqlDialect( NullCollation nullCollation ) { */ private static AlgBuilder algBuilder() { // Creates a config based on the "scott" schema. - final SchemaPlus schema = Frameworks.createSnapshot( true ).add( "scott", new ReflectiveSchema( new ScottSchema(), -1 ), NamespaceType.RELATIONAL ); + final SchemaPlus schema = Frameworks.createSnapshot( true ).add( "scott", new ReflectiveSchema( new ScottSchema(), -1 ), DataModel.RELATIONAL ); Frameworks.ConfigBuilder configBuilder = Frameworks.newConfigBuilder() .parserConfig( Parser.ParserConfig.DEFAULT ) .defaultSnapshot( schema ) diff --git a/plugins/mongodb-adapter/src/main/java/org/polypheny/db/adapter/mongodb/MongoEntity.java b/plugins/mongodb-adapter/src/main/java/org/polypheny/db/adapter/mongodb/MongoEntity.java index 62b70c55fb..426ec29375 100644 --- a/plugins/mongodb-adapter/src/main/java/org/polypheny/db/adapter/mongodb/MongoEntity.java +++ b/plugins/mongodb-adapter/src/main/java/org/polypheny/db/adapter/mongodb/MongoEntity.java @@ -92,7 +92,7 @@ import org.polypheny.db.catalog.entity.physical.PhysicalEntity; import org.polypheny.db.catalog.entity.physical.PhysicalField; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.plan.AlgOptCluster; import org.polypheny.db.plan.AlgTraitSet; @@ -135,7 +135,7 @@ public class MongoEntity extends PhysicalEntity implements TranslatableEntity, M * Creates a MongoTable. */ MongoEntity( PhysicalEntity physical, List fields, MongoNamespace namespace, TransactionProvider transactionProvider ) { - super( physical.id, physical.allocationId, physical.logicalId, physical.name, physical.namespaceId, physical.namespaceName, physical.namespaceType, physical.adapterId ); + super( physical.id, physical.allocationId, physical.logicalId, physical.name, physical.namespaceId, physical.namespaceName, physical.dataModel, physical.adapterId ); this.physical = physical; this.mongoNamespace = namespace; this.transactionProvider = transactionProvider; @@ -147,7 +147,7 @@ public class MongoEntity extends PhysicalEntity implements TranslatableEntity, M @Override public AlgDataType getRowType() { - if ( namespaceType == NamespaceType.RELATIONAL ) { + if ( dataModel == DataModel.RELATIONAL ) { return buildProto().apply( AlgDataTypeFactory.DEFAULT ); } return super.getRowType(); diff --git a/plugins/mql-language/src/main/java/org/polypheny/db/languages/MongoLanguagePlugin.java b/plugins/mql-language/src/main/java/org/polypheny/db/languages/MongoLanguagePlugin.java index b850bd73e5..96ad196f2b 100644 --- a/plugins/mql-language/src/main/java/org/polypheny/db/languages/MongoLanguagePlugin.java +++ b/plugins/mql-language/src/main/java/org/polypheny/db/languages/MongoLanguagePlugin.java @@ -28,7 +28,7 @@ import org.polypheny.db.catalog.Catalog; import org.polypheny.db.catalog.entity.logical.LogicalCollection; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.languages.mql.MqlCreateCollection; import org.polypheny.db.languages.mql.MqlCreateView; @@ -77,7 +77,7 @@ public void stop() { public static void startup() { QueryLanguage language = new QueryLanguage( - NamespaceType.DOCUMENT, + DataModel.DOCUMENT, "mongo", List.of( "mongo", "mql" ), MqlParserImpl.FACTORY, diff --git a/plugins/mql-language/src/main/java/org/polypheny/db/languages/mql/MqlQueryParameters.java b/plugins/mql-language/src/main/java/org/polypheny/db/languages/mql/MqlQueryParameters.java index 05d5255032..73cfc92966 100644 --- a/plugins/mql-language/src/main/java/org/polypheny/db/languages/mql/MqlQueryParameters.java +++ b/plugins/mql-language/src/main/java/org/polypheny/db/languages/mql/MqlQueryParameters.java @@ -17,7 +17,7 @@ package org.polypheny.db.languages.mql; import lombok.Getter; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.languages.QueryParameters; @Getter @@ -26,8 +26,8 @@ public class MqlQueryParameters extends QueryParameters { final Long namespaceId; - public MqlQueryParameters( String query, Long namespaceId, NamespaceType namespaceType ) { - super( query, namespaceType ); + public MqlQueryParameters( String query, Long namespaceId, DataModel dataModel ) { + super( query, dataModel ); this.namespaceId = namespaceId; } diff --git a/plugins/mql-language/src/main/java/org/polypheny/db/languages/mql/MqlUseDatabase.java b/plugins/mql-language/src/main/java/org/polypheny/db/languages/mql/MqlUseDatabase.java index 3cdd550ae2..77ca5a4793 100644 --- a/plugins/mql-language/src/main/java/org/polypheny/db/languages/mql/MqlUseDatabase.java +++ b/plugins/mql-language/src/main/java/org/polypheny/db/languages/mql/MqlUseDatabase.java @@ -17,7 +17,7 @@ package org.polypheny.db.languages.mql; import lombok.Getter; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.ddl.DdlManager; import org.polypheny.db.languages.ParserPos; import org.polypheny.db.languages.mql.Mql.Type; @@ -41,7 +41,7 @@ public MqlUseDatabase( ParserPos pos, String database ) { @Override public void execute( Context context, Statement statement, ParsedQueryContext parsedQueryContext ) { - DdlManager.getInstance().createNamespace( this.database, NamespaceType.DOCUMENT, true, false ); + DdlManager.getInstance().createNamespace( this.database, DataModel.DOCUMENT, true, false ); } diff --git a/plugins/mql-language/src/main/java/org/polypheny/db/languages/mql2alg/MqlToAlgConverter.java b/plugins/mql-language/src/main/java/org/polypheny/db/languages/mql2alg/MqlToAlgConverter.java index d44928e6f7..ccb35381fe 100644 --- a/plugins/mql-language/src/main/java/org/polypheny/db/languages/mql2alg/MqlToAlgConverter.java +++ b/plugins/mql-language/src/main/java/org/polypheny/db/languages/mql2alg/MqlToAlgConverter.java @@ -69,7 +69,7 @@ import org.polypheny.db.catalog.entity.logical.LogicalNamespace; import org.polypheny.db.catalog.entity.logical.LogicalTable; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.languages.OperatorRegistry; import org.polypheny.db.languages.QueryLanguage; @@ -260,7 +260,7 @@ public AlgRoot convert( MqlCollectionStatement query ) { AlgNode node; - if ( entity.namespaceType == NamespaceType.RELATIONAL ) { + if ( entity.dataModel == DataModel.RELATIONAL ) { _dataExists = false; } diff --git a/plugins/neo4j-adapter/src/main/java/org/polypheny/db/adapter/neo4j/NeoEntity.java b/plugins/neo4j-adapter/src/main/java/org/polypheny/db/adapter/neo4j/NeoEntity.java index 04bf52e96e..c867d7e2c5 100644 --- a/plugins/neo4j-adapter/src/main/java/org/polypheny/db/adapter/neo4j/NeoEntity.java +++ b/plugins/neo4j-adapter/src/main/java/org/polypheny/db/adapter/neo4j/NeoEntity.java @@ -70,7 +70,7 @@ public class NeoEntity extends PhysicalEntity implements TranslatableEntity, Mod protected NeoEntity( PhysicalEntity physical, List fields, NeoNamespace namespace ) { - super( physical.id, physical.allocationId, physical.logicalId, physical.name, physical.namespaceId, physical.namespaceName, physical.namespaceType, physical.adapterId ); + super( physical.id, physical.allocationId, physical.logicalId, physical.name, physical.namespaceId, physical.namespaceName, physical.dataModel, physical.adapterId ); this.fields = fields; this.namespace = namespace; } diff --git a/plugins/pig-language/src/main/java/org/polypheny/db/PigLanguagePlugin.java b/plugins/pig-language/src/main/java/org/polypheny/db/PigLanguagePlugin.java index 453dc31861..bb88231b3b 100644 --- a/plugins/pig-language/src/main/java/org/polypheny/db/PigLanguagePlugin.java +++ b/plugins/pig-language/src/main/java/org/polypheny/db/PigLanguagePlugin.java @@ -18,7 +18,7 @@ import java.util.List; import lombok.extern.slf4j.Slf4j; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.languages.LanguageManager; import org.polypheny.db.languages.QueryLanguage; import org.polypheny.db.piglet.PigProcessor; @@ -45,7 +45,7 @@ public PigLanguagePlugin( PluginContext context ) { @Override public void start() { - QueryLanguage language = new QueryLanguage( NamespaceType.RELATIONAL, NAME, List.of( NAME, "piglet" ), null, PigProcessor::new, null, LanguageManager::toQueryNodes ); + QueryLanguage language = new QueryLanguage( DataModel.RELATIONAL, NAME, List.of( NAME, "piglet" ), null, PigProcessor::new, null, LanguageManager::toQueryNodes ); LanguageManager.getINSTANCE().addQueryLanguage( language ); PolyPluginManager.AFTER_INIT.add( () -> LanguageCrud.addToResult( language, LanguageCrud::getRelResult ) ); diff --git a/plugins/sql-language/src/main/codegen/Parser.jj b/plugins/sql-language/src/main/codegen/Parser.jj index 017d666cb9..653d4e1cb2 100644 --- a/plugins/sql-language/src/main/codegen/Parser.jj +++ b/plugins/sql-language/src/main/codegen/Parser.jj @@ -145,7 +145,7 @@ import java.util.HashMap; import org.polypheny.db.util.CoreUtil; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.languages.ParserFactory; import org.polypheny.db.util.Conformance; import org.polypheny.db.languages.NodeParseException; @@ -1850,21 +1850,21 @@ SqlCreate SqlCreateNamespace(Span s, boolean replace) : { final boolean ifNotExists; final SqlIdentifier id; - final NamespaceType namespaceType; + final DataModel dataModel; } { ( - { namespaceType = NamespaceType.RELATIONAL; } + { dataModel = DataModel.RELATIONAL; } | - { namespaceType = NamespaceType.DOCUMENT; } + { dataModel = DataModel.DOCUMENT; } | - { namespaceType = NamespaceType.GRAPH; } + { dataModel = DataModel.GRAPH; } | - { namespaceType = NamespaceType.RELATIONAL; } + { dataModel = DataModel.RELATIONAL; } ) ( | ) ifNotExists = IfNotExistsOpt() id = CompoundIdentifier() { - return SqlDdlNodes.createNamespace(s.end(this), replace, ifNotExists, id, namespaceType); + return SqlDdlNodes.createNamespace(s.end(this), replace, ifNotExists, id, dataModel); } } diff --git a/plugins/sql-language/src/main/codegen/includes/ddlParser.ftl b/plugins/sql-language/src/main/codegen/includes/ddlParser.ftl index 3c99d8c850..cd1a4d4896 100644 --- a/plugins/sql-language/src/main/codegen/includes/ddlParser.ftl +++ b/plugins/sql-language/src/main/codegen/includes/ddlParser.ftl @@ -39,17 +39,17 @@ SqlCreate SqlCreateSchema(Span s, boolean replace) : { final boolean ifNotExists; final SqlIdentifier id; - final NamespaceType namespaceType; + final DataModel dataModel; } { ( - { namespaceType = NamespaceType.DOCUMENT; } + { dataModel = DataModel.DOCUMENT; } | - { namespaceType = NamespaceType.RELATIONAL; } + { dataModel = DataModel.RELATIONAL; } ) ifNotExists = IfNotExistsOpt() id = CompoundIdentifier() { - return SqlDdlNodes.createSchema(s.end(this), replace, ifNotExists, id, namespaceType); + return SqlDdlNodes.createSchema(s.end(this), replace, ifNotExists, id, dataModel); } } diff --git a/plugins/sql-language/src/main/java/org/polypheny/db/sql/SqlLanguagePlugin.java b/plugins/sql-language/src/main/java/org/polypheny/db/sql/SqlLanguagePlugin.java index 55e1031511..c1ec4de4cb 100644 --- a/plugins/sql-language/src/main/java/org/polypheny/db/sql/SqlLanguagePlugin.java +++ b/plugins/sql-language/src/main/java/org/polypheny/db/sql/SqlLanguagePlugin.java @@ -35,7 +35,7 @@ import org.polypheny.db.algebra.operators.OperatorName; import org.polypheny.db.algebra.operators.OperatorTable; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.config.PolyphenyDbConnectionProperty; import org.polypheny.db.languages.LanguageManager; @@ -199,7 +199,7 @@ public void stop() { public static void startup() { // add language to general processing QueryLanguage language = new QueryLanguage( - NamespaceType.RELATIONAL, + DataModel.RELATIONAL, "sql", List.of( "sql" ), SqlParserImpl.FACTORY, diff --git a/plugins/sql-language/src/main/java/org/polypheny/db/sql/SqlProcessor.java b/plugins/sql-language/src/main/java/org/polypheny/db/sql/SqlProcessor.java index 47fc023cdc..2df8ff07a2 100644 --- a/plugins/sql-language/src/main/java/org/polypheny/db/sql/SqlProcessor.java +++ b/plugins/sql-language/src/main/java/org/polypheny/db/sql/SqlProcessor.java @@ -38,7 +38,7 @@ import org.polypheny.db.catalog.entity.logical.LogicalColumn; import org.polypheny.db.catalog.entity.logical.LogicalTable; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.config.RuntimeConfig; import org.polypheny.db.languages.NodeParseException; @@ -256,13 +256,13 @@ private void addDefaultValues( Transaction transaction, SqlInsert insert ) { if ( oldColumnList != null ) { LogicalTable catalogTable = getTable( transaction, (SqlIdentifier) insert.getTargetTable() ); - NamespaceType namespaceType = Catalog.getInstance().getSnapshot().getNamespace( catalogTable.namespaceId ).orElseThrow().namespaceType; + DataModel dataModel = Catalog.getInstance().getSnapshot().getNamespace( catalogTable.namespaceId ).orElseThrow().dataModel; catalogTable = getTable( transaction, (SqlIdentifier) insert.getTargetTable() ); SqlNodeList newColumnList = new SqlNodeList( ParserPos.ZERO ); int size = catalogTable.getColumns().size(); - if ( namespaceType == NamespaceType.DOCUMENT ) { + if ( dataModel == DataModel.DOCUMENT ) { List columnNames = catalogTable.getColumnNames(); size += (int) oldColumnList.getSqlList().stream().filter( column -> !columnNames.contains( ((SqlIdentifier) column).names.get( 0 ) ) ).count(); } @@ -325,7 +325,7 @@ private void addDefaultValues( Transaction transaction, SqlInsert insert ) { } // add doc values back TODO DL: change - if ( namespaceType == NamespaceType.DOCUMENT ) { + if ( dataModel == DataModel.DOCUMENT ) { List documentColumns = new ArrayList<>(); for ( Node column : oldColumnList.getSqlList() ) { if ( newColumnList.getSqlList() diff --git a/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/SqlInsert.java b/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/SqlInsert.java index 2fb7ca7342..7b9ebf4997 100644 --- a/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/SqlInsert.java +++ b/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/SqlInsert.java @@ -21,7 +21,7 @@ import lombok.Setter; import org.jetbrains.annotations.Nullable; import org.polypheny.db.algebra.constant.Kind; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.languages.ParserPos; import org.polypheny.db.nodes.Node; import org.polypheny.db.nodes.Operator; @@ -166,8 +166,8 @@ public void validate( SqlValidator validator, SqlValidatorScope scope ) { } - public NamespaceType getSchemaType() { - return NamespaceType.RELATIONAL; + public DataModel getSchemaType() { + return DataModel.RELATIONAL; } } diff --git a/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/ddl/SqlCreateNamespace.java b/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/ddl/SqlCreateNamespace.java index 468057d845..87eff9fca8 100644 --- a/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/ddl/SqlCreateNamespace.java +++ b/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/ddl/SqlCreateNamespace.java @@ -20,7 +20,7 @@ import java.util.List; import java.util.Objects; import org.polypheny.db.algebra.constant.Kind; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.ddl.DdlManager; import org.polypheny.db.languages.ParserPos; import org.polypheny.db.nodes.ExecutableStatement; @@ -44,7 +44,7 @@ public class SqlCreateNamespace extends SqlCreate implements ExecutableStatement private final SqlIdentifier name; - private final NamespaceType type; + private final DataModel type; private static final SqlOperator OPERATOR = new SqlSpecialOperator( "CREATE NAMESPACE", Kind.CREATE_NAMESPACE ); @@ -52,10 +52,10 @@ public class SqlCreateNamespace extends SqlCreate implements ExecutableStatement /** * Creates a SqlCreateNamespace. */ - SqlCreateNamespace( ParserPos pos, boolean replace, boolean ifNotExists, SqlIdentifier name, NamespaceType namespaceType ) { + SqlCreateNamespace( ParserPos pos, boolean replace, boolean ifNotExists, SqlIdentifier name, DataModel dataModel ) { super( OPERATOR, pos, replace, ifNotExists ); this.name = Objects.requireNonNull( name ); - this.type = namespaceType; + this.type = dataModel; } diff --git a/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/ddl/SqlDdlNodes.java b/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/ddl/SqlDdlNodes.java index 5bd6ff73f8..cfe4ba5952 100644 --- a/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/ddl/SqlDdlNodes.java +++ b/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/ddl/SqlDdlNodes.java @@ -18,7 +18,7 @@ import java.util.List; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.languages.ParserPos; import org.polypheny.db.nodes.Operator; import org.polypheny.db.partition.raw.RawPartitionInformation; @@ -43,8 +43,8 @@ private SqlDdlNodes() { /** * Creates a CREATE NAMESPACE. */ - public static SqlCreateNamespace createNamespace( ParserPos pos, boolean replace, boolean ifNotExists, SqlIdentifier name, NamespaceType namespaceType ) { - return new SqlCreateNamespace( pos, replace, ifNotExists, name, namespaceType ); + public static SqlCreateNamespace createNamespace( ParserPos pos, boolean replace, boolean ifNotExists, SqlIdentifier name, DataModel dataModel ) { + return new SqlCreateNamespace( pos, replace, ifNotExists, name, dataModel ); } diff --git a/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/validate/IdentifierNamespace.java b/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/validate/IdentifierNamespace.java index aa414296df..b94c957cdf 100644 --- a/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/validate/IdentifierNamespace.java +++ b/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/validate/IdentifierNamespace.java @@ -33,7 +33,7 @@ import org.polypheny.db.catalog.entity.logical.LogicalNamespace; import org.polypheny.db.catalog.entity.logical.LogicalTable; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.Pattern; import org.polypheny.db.languages.ParserPos; import org.polypheny.db.sql.language.SqlCall; @@ -170,11 +170,11 @@ private SqlValidatorNamespace resolveImpl( SqlIdentifier id ) { } else if ( ns.size() == 2 ) { LogicalNamespace namespace = validator.snapshot.getNamespace( ns.get( 0 ) ).orElseThrow(); LogicalEntity entity = null; - if ( namespace.namespaceType == NamespaceType.RELATIONAL ) { + if ( namespace.dataModel == DataModel.RELATIONAL ) { entity = validator.snapshot.rel().getTable( namespace.id, ns.get( 1 ) ).orElse( null ); - } else if ( namespace.namespaceType == NamespaceType.DOCUMENT ) { + } else if ( namespace.dataModel == DataModel.DOCUMENT ) { entity = validator.snapshot.doc().getCollection( namespace.id, ns.get( 1 ) ).orElse( null ); - } else if ( namespace.namespaceType == NamespaceType.GRAPH ) { + } else if ( namespace.dataModel == DataModel.GRAPH ) { throw new NotImplementedException(); } diff --git a/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/validate/SqlValidatorImpl.java b/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/validate/SqlValidatorImpl.java index cb2e396792..6b2d19d11a 100644 --- a/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/validate/SqlValidatorImpl.java +++ b/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/validate/SqlValidatorImpl.java @@ -75,7 +75,7 @@ import org.polypheny.db.catalog.entity.LogicalEntity; import org.polypheny.db.catalog.entity.logical.LogicalTable; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.config.RuntimeConfig; import org.polypheny.db.languages.OperatorRegistry; @@ -4061,7 +4061,7 @@ public void validateInsert( SqlInsert insert ) { null, null ); - boolean allowDynamic = insert.getSchemaType() == NamespaceType.DOCUMENT; + boolean allowDynamic = insert.getSchemaType() == DataModel.DOCUMENT; // INSERT has an optional column name list. If present then reduce the rowtype to the columns specified. If not present then the entire target rowtype is used. final AlgDataType targetRowType = createTargetRowType( table, insert.getTargetColumnList(), false, allowDynamic ); diff --git a/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/validate/SqlValidatorUtil.java b/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/validate/SqlValidatorUtil.java index d31a562678..b36e7e32b2 100644 --- a/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/validate/SqlValidatorUtil.java +++ b/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/validate/SqlValidatorUtil.java @@ -41,7 +41,7 @@ import org.polypheny.db.catalog.Catalog; import org.polypheny.db.catalog.entity.LogicalEntity; import org.polypheny.db.catalog.entity.logical.LogicalTable; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.languages.OperatorRegistry; import org.polypheny.db.languages.ParserPos; @@ -623,7 +623,7 @@ public static boolean isNotRelational( SqlValidatorImpl validator ) { namespace = Catalog.defaultNamespaceName; } - return validator.snapshot.getNamespace( namespace ).orElseThrow().namespaceType != NamespaceType.RELATIONAL; + return validator.snapshot.getNamespace( namespace ).orElseThrow().dataModel != DataModel.RELATIONAL; } diff --git a/plugins/sql-language/src/main/java/org/polypheny/db/sql/sql2alg/SqlToAlgConverter.java b/plugins/sql-language/src/main/java/org/polypheny/db/sql/sql2alg/SqlToAlgConverter.java index 831d6f5b92..c172f1fcb0 100644 --- a/plugins/sql-language/src/main/java/org/polypheny/db/sql/sql2alg/SqlToAlgConverter.java +++ b/plugins/sql-language/src/main/java/org/polypheny/db/sql/sql2alg/SqlToAlgConverter.java @@ -127,8 +127,8 @@ import org.polypheny.db.catalog.entity.LogicalEntity; import org.polypheny.db.catalog.entity.logical.LogicalTable; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.languages.NodeToAlgConverter; import org.polypheny.db.languages.OperatorRegistry; @@ -2959,7 +2959,7 @@ protected AlgNode convertColumnList( final SqlInsert call, AlgNode source ) { final LogicalEntity targetTable = getTargetTable( call ); final AlgDataType targetRowType = targetTable.getRowType();//AlgOptEntityImpl.realRowType( targetTable ); final List targetFields = targetRowType.getFields(); - boolean isDocument = call.getSchemaType() == NamespaceType.DOCUMENT; + boolean isDocument = call.getSchemaType() == DataModel.DOCUMENT; List sourceExps = new ArrayList<>( Collections.nCopies( targetFields.size(), null ) ); List fieldNames = new ArrayList<>( Collections.nCopies( targetFields.size(), null ) ); // TODO DL: reevaluate and make final again? @@ -3082,7 +3082,7 @@ protected void collectInsertTargets( SqlInsert call, final RexNode sourceRef, fi } else { boolean allowDynamic = false; - if ( call.getSchemaType() == NamespaceType.DOCUMENT ) { + if ( call.getSchemaType() == DataModel.DOCUMENT ) { allowDynamic = true; } diff --git a/webui/src/main/java/org/polypheny/db/webui/Crud.java b/webui/src/main/java/org/polypheny/db/webui/Crud.java index 4526ecdcc7..de55ab6fcb 100644 --- a/webui/src/main/java/org/polypheny/db/webui/Crud.java +++ b/webui/src/main/java/org/polypheny/db/webui/Crud.java @@ -113,10 +113,10 @@ import org.polypheny.db.catalog.entity.logical.LogicalView; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.catalog.logistic.ConstraintType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; import org.polypheny.db.catalog.logistic.ForeignKeyOption; import org.polypheny.db.catalog.logistic.NameGenerator; -import org.polypheny.db.catalog.logistic.NamespaceType; import org.polypheny.db.catalog.logistic.PartitionType; import org.polypheny.db.catalog.logistic.PlacementType; import org.polypheny.db.catalog.snapshot.LogicalRelSnapshot; @@ -300,7 +300,7 @@ RelationalResult getTable( final UIRequest request ) { // determine if it is a view or a table LogicalTable table = Catalog.snapshot().rel().getTable( request.entityId ).orElseThrow(); - resultBuilder.namespaceType( table.namespaceType ); + resultBuilder.dataModel( table.dataModel ); if ( table.modifiable ) { resultBuilder.type( ResultType.TABLE ); } else { @@ -367,7 +367,7 @@ void getEntities( final Context ctx ) { LogicalNamespace namespace = Catalog.snapshot().getNamespace( namespaceId ).orElseThrow(); List entities = List.of(); - switch ( namespace.namespaceType ) { + switch ( namespace.dataModel ) { case RELATIONAL: entities = Catalog.snapshot().rel().getTables( namespace.id, null ); break; @@ -2578,18 +2578,18 @@ RelationalResult executeAlg( final AlgRequest request, Session session ) { void namespaceRequest( final Context ctx ) { Namespace namespace = ctx.bodyAsClass( Namespace.class ); - if ( namespace.getType() == NamespaceType.GRAPH ) { + if ( namespace.getType() == DataModel.GRAPH ) { createGraph( namespace, ctx ); return; } - NamespaceType type = namespace.getType(); + DataModel type = namespace.getType(); // create namespace if ( namespace.isCreate() && !namespace.isDrop() ) { StringBuilder query = new StringBuilder( "CREATE " ); - if ( Objects.requireNonNull( namespace.getType() ) == NamespaceType.DOCUMENT ) { + if ( Objects.requireNonNull( namespace.getType() ) == DataModel.DOCUMENT ) { query.append( "DOCUMENT " ); } @@ -2685,7 +2685,7 @@ public void observeInfos( final String infoAsJson, final String analyzerId, fina public void observePageList( final InformationPage[] pages, final String analyzerId, final Session session ) { List nodes = new ArrayList<>(); for ( InformationPage page : pages ) { - nodes.add( new SidebarElement( page.getId(), page.getName(), NamespaceType.RELATIONAL, analyzerId + "/", page.getIcon() ).setLabel( page.getLabel() ) ); + nodes.add( new SidebarElement( page.getId(), page.getName(), DataModel.RELATIONAL, analyzerId + "/", page.getIcon() ).setLabel( page.getLabel() ) ); } WebSocket.sendMessage( session, gson.toJson( nodes.toArray( new SidebarElement[0] ) ) ); } diff --git a/webui/src/main/java/org/polypheny/db/webui/WebSocket.java b/webui/src/main/java/org/polypheny/db/webui/WebSocket.java index f9140b4fa6..13bc95641b 100644 --- a/webui/src/main/java/org/polypheny/db/webui/WebSocket.java +++ b/webui/src/main/java/org/polypheny/db/webui/WebSocket.java @@ -157,7 +157,7 @@ public void onMessage( final WsMessageContext ctx ) { UIRequest uiRequest = ctx.messageAsClass( UIRequest.class ); try { LogicalNamespace namespace = Catalog.getInstance().getSnapshot().getNamespace( uiRequest.namespace ).orElse( null ); - switch ( namespace.namespaceType ) { + switch ( namespace.dataModel ) { case RELATIONAL: result = crud.getTable( uiRequest ); break; diff --git a/webui/src/main/java/org/polypheny/db/webui/crud/CatalogCrud.java b/webui/src/main/java/org/polypheny/db/webui/crud/CatalogCrud.java index 624ec63eb5..737cdd9e5e 100644 --- a/webui/src/main/java/org/polypheny/db/webui/crud/CatalogCrud.java +++ b/webui/src/main/java/org/polypheny/db/webui/crud/CatalogCrud.java @@ -29,8 +29,8 @@ import org.polypheny.db.catalog.entity.logical.LogicalColumn; import org.polypheny.db.catalog.entity.logical.LogicalNamespace; import org.polypheny.db.catalog.entity.logical.LogicalTable; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; import org.polypheny.db.catalog.logistic.Pattern; import org.polypheny.db.webui.Crud; import org.polypheny.db.webui.models.AlgNodeModel; @@ -67,7 +67,7 @@ public void getTypeNamespaces( final Context ctx ) { ctx.json( Catalog.snapshot() .getNamespaces( null ) .stream() - .collect( Collectors.toMap( LogicalNamespace::getName, LogicalNamespace::getNamespaceType ) ) ); + .collect( Collectors.toMap( LogicalNamespace::getName, LogicalNamespace::getDataModel ) ) ); } @@ -82,12 +82,12 @@ public void getSchemaTree( final Context ctx ) { List namespaces = Catalog.snapshot().getNamespaces( null ); // remove unwanted namespaces - namespaces = namespaces.stream().filter( s -> request.dataModels.contains( s.namespaceType ) ).collect( Collectors.toList() ); + namespaces = namespaces.stream().filter( s -> request.dataModels.contains( s.dataModel ) ).collect( Collectors.toList() ); for ( LogicalNamespace namespace : namespaces ) { - SidebarElement schemaTree = new SidebarElement( namespace.name, namespace.name, namespace.namespaceType, "", getIconName( namespace.namespaceType ) ); + SidebarElement schemaTree = new SidebarElement( namespace.name, namespace.name, namespace.dataModel, "", getIconName( namespace.dataModel ) ); if ( request.depth > 1 ) { - switch ( namespace.namespaceType ) { + switch ( namespace.dataModel ) { case RELATIONAL: attachTreeElements( namespace, request, schemaTree ); break; @@ -117,7 +117,7 @@ private void attachDocumentTreeElements( LogicalNamespace namespace, SchemaTreeR } if ( request.showTable ) { - schemaTree.addChild( new SidebarElement( namespace.name + ".tables", "tables", namespace.namespaceType, request.routerLinkRoot, "fa fa-table" ).addChildren( collectionTree ).setRouterLink( "" ) ); + schemaTree.addChild( new SidebarElement( namespace.name + ".tables", "tables", namespace.dataModel, request.routerLinkRoot, "fa fa-table" ).addChildren( collectionTree ).setRouterLink( "" ) ); } else { schemaTree.addChildren( collectionTree ).setRouterLink( "" ); } @@ -133,7 +133,7 @@ private static SidebarElement attachCollectionElement( LogicalNamespace namespac icon = "icon-eye"; } - SidebarElement tableElement = new SidebarElement( namespace.name + "." + collection.name, collection.name, namespace.namespaceType, request.routerLinkRoot, icon ); + SidebarElement tableElement = new SidebarElement( namespace.name + "." + collection.name, collection.name, namespace.dataModel, request.routerLinkRoot, icon ); if ( request.views ) { if ( collection.entityType == EntityType.ENTITY || collection.entityType == EntityType.SOURCE ) { @@ -158,15 +158,15 @@ private void attachTreeElements( LogicalNamespace namespace, SchemaTreeRequest r } else if ( table.entityType == EntityType.VIEW ) { icon = "icon-eye"; } - if ( table.entityType != EntityType.VIEW && namespace.namespaceType == NamespaceType.DOCUMENT ) { + if ( table.entityType != EntityType.VIEW && namespace.dataModel == DataModel.DOCUMENT ) { icon = "cui-description"; } - SidebarElement tableElement = new SidebarElement( namespace.name + "." + table.name, table.name, namespace.namespaceType, request.routerLinkRoot, icon ); + SidebarElement tableElement = new SidebarElement( namespace.name + "." + table.name, table.name, namespace.dataModel, request.routerLinkRoot, icon ); if ( request.depth > 2 ) { List columns = Catalog.snapshot().rel().getColumns( table.id ); for ( LogicalColumn column : columns ) { - tableElement.addChild( new SidebarElement( namespace.name + "." + table.name + "." + column.name, column.name, namespace.namespaceType, request.routerLinkRoot, icon ).setCssClass( "sidebarColumn" ) ); + tableElement.addChild( new SidebarElement( namespace.name + "." + table.name + "." + column.name, column.name, namespace.dataModel, request.routerLinkRoot, icon ).setCssClass( "sidebarColumn" ) ); } } @@ -184,15 +184,15 @@ private void attachTreeElements( LogicalNamespace namespace, SchemaTreeRequest r } if ( request.showTable ) { - schemaTree.addChild( new SidebarElement( namespace.name + ".tables", "tables", namespace.namespaceType, request.routerLinkRoot, "fa fa-table" ).addChildren( collectionTree ).setRouterLink( "" ) ); + schemaTree.addChild( new SidebarElement( namespace.name + ".tables", "tables", namespace.dataModel, request.routerLinkRoot, "fa fa-table" ).addChildren( collectionTree ).setRouterLink( "" ) ); } else { schemaTree.addChildren( collectionTree ).setRouterLink( "" ); } } - private String getIconName( NamespaceType namespaceType ) { - switch ( namespaceType ) { + private String getIconName( DataModel dataModel ) { + switch ( dataModel ) { case RELATIONAL: return "cui-layers"; case DOCUMENT: diff --git a/webui/src/main/java/org/polypheny/db/webui/crud/LanguageCrud.java b/webui/src/main/java/org/polypheny/db/webui/crud/LanguageCrud.java index 37c29826f7..6d17fa23b9 100644 --- a/webui/src/main/java/org/polypheny/db/webui/crud/LanguageCrud.java +++ b/webui/src/main/java/org/polypheny/db/webui/crud/LanguageCrud.java @@ -50,8 +50,8 @@ import org.polypheny.db.catalog.entity.logical.LogicalNamespace; import org.polypheny.db.catalog.entity.logical.LogicalTable; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; import org.polypheny.db.information.InformationManager; import org.polypheny.db.information.InformationObserver; import org.polypheny.db.languages.LanguageManager; @@ -140,6 +140,11 @@ public static void anyQuery( Context ctx ) { TriFunction> builder = REGISTER.get( context.getLanguage() ); for ( ExecutedContext executedContext : executedContexts ) { + if ( executedContext.getError().isPresent() ) { + attachError( transaction, results, executedContext.getQuery().getQuery(), executedContext.getQuery().getLanguage().getDataModel(), executedContext.getError().get() ); + continue; + } + results.add( builder.apply( executedContext, request, executedContext.getStatement() ).build() ); } @@ -211,7 +216,7 @@ public static PolyGraph getGraph( String namespace, TransactionManager manager, } - public static void attachError( Transaction transaction, List> results, String query, NamespaceType model, Throwable t ) { + public static void attachError( Transaction transaction, List> results, String query, DataModel model, Throwable t ) { //String msg = t.getMessage() == null ? "" : t.getMessage(); Result result; switch ( model ) { @@ -296,7 +301,7 @@ public static void attachError( Transaction transaction, List> resu .builder() .header( header.toArray( new UiColumnDefinition[0] ) ) .data( data.toArray( new String[0][] ) ) - .namespaceType( context.getIterator().getImplementation().getNamespaceType() ) + .dataModel( context.getIterator().getImplementation().getDataModel() ) .namespace( request.namespace ) .language( context.getQuery().getLanguage() ) .affectedTuples( data.size() ) @@ -359,7 +364,7 @@ public static List computeResultData( final List> rows .header( context.getIterator().getImplementation().rowType.getFields().stream().map( FieldDefinition::of ).toArray( FieldDefinition[]::new ) ) .query( context.getQuery().getQuery() ) .language( context.getQuery().getLanguage() ) - .namespaceType( context.getIterator().getImplementation().getNamespaceType() ) + .dataModel( context.getIterator().getImplementation().getDataModel() ) .xid( statement.getTransaction().getXid().toString() ) .namespace( request.namespace ); @@ -386,7 +391,7 @@ public static List computeResultData( final List> rows .query( context.getQuery().getQuery() ) .language( context.getQuery().getLanguage() ) .xid( statement.getTransaction().getXid().toString() ) - .namespaceType( context.getIterator().getImplementation().getNamespaceType() ) + .dataModel( context.getIterator().getImplementation().getDataModel() ) .namespace( request.namespace ); } @@ -422,7 +427,7 @@ public void getDocumentDatabases( final Context ctx ) { Map names = Catalog.getInstance().getSnapshot() .getNamespaces( null ) .stream() - .collect( Collectors.toMap( LogicalNamespace::getName, s -> s.namespaceType.name() ) ); + .collect( Collectors.toMap( LogicalNamespace::getName, s -> s.dataModel.name() ) ); String[][] data = names.entrySet().stream().map( n -> new String[]{ n.getKey(), n.getValue() } ).toArray( String[][]::new ); ctx.json( RelationalResult diff --git a/webui/src/main/java/org/polypheny/db/webui/models/Namespace.java b/webui/src/main/java/org/polypheny/db/webui/models/Namespace.java index e1c13c13d6..2162094c4d 100644 --- a/webui/src/main/java/org/polypheny/db/webui/models/Namespace.java +++ b/webui/src/main/java/org/polypheny/db/webui/models/Namespace.java @@ -22,7 +22,7 @@ import lombok.Getter; import lombok.Value; import lombok.experimental.NonFinal; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; /** @@ -35,7 +35,7 @@ public class Namespace { @JsonProperty String name; @JsonProperty - NamespaceType type; + DataModel type; @JsonProperty String store; @@ -64,12 +64,12 @@ public class Namespace { */ public Namespace( @JsonProperty("name") String name, - @JsonProperty("type") final NamespaceType type, + @JsonProperty("type") final DataModel type, @JsonProperty("store") @Nullable final String store ) { this.name = name; this.type = type; - if ( type == NamespaceType.GRAPH ) { + if ( type == DataModel.GRAPH ) { assert store != null; this.store = store; } else { diff --git a/webui/src/main/java/org/polypheny/db/webui/models/SidebarElement.java b/webui/src/main/java/org/polypheny/db/webui/models/SidebarElement.java index 97c141a44e..b9bd2e6529 100644 --- a/webui/src/main/java/org/polypheny/db/webui/models/SidebarElement.java +++ b/webui/src/main/java/org/polypheny/db/webui/models/SidebarElement.java @@ -21,7 +21,7 @@ import java.util.List; import lombok.Setter; import lombok.experimental.Accessors; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; /** @@ -31,7 +31,7 @@ @Accessors(chain = true) public class SidebarElement { - private final NamespaceType namespaceType; + private final DataModel dataModel; private String id; private String name; @Setter @@ -49,14 +49,14 @@ public class SidebarElement { * * @param id unique id for the SidebarElement, e.g. of the form "schemaName.tableName.columnName" * @param name the name of the SidebarElement that will be displayed in the UI - * @param namespaceType the schema type of the sidebar element, this is nullable for non-database elements + * @param dataModel the schema type of the sidebar element, this is nullable for non-database elements * @param routerLinkRoot routerLink to the view where the Sidebar is displayed. When clicking on a SidebarElement, the user will be directed to the page "routerLinkRoot/id" (id of the SidebarElement) * @param icon class name of the icon that will be displayed left of the id, e.g. "fa fa-table" */ - public SidebarElement( final String id, final String name, NamespaceType namespaceType, final String routerLinkRoot, String icon ) { + public SidebarElement( final String id, final String name, DataModel dataModel, final String routerLinkRoot, String icon ) { this.id = id; this.name = name; - this.namespaceType = namespaceType; + this.dataModel = dataModel; if ( !routerLinkRoot.isEmpty() ) { this.routerLink = routerLinkRoot + id; } else { diff --git a/webui/src/main/java/org/polypheny/db/webui/models/catalog/requests/NamespaceRequest.java b/webui/src/main/java/org/polypheny/db/webui/models/catalog/requests/NamespaceRequest.java index 049468e058..1d3a467a6f 100644 --- a/webui/src/main/java/org/polypheny/db/webui/models/catalog/requests/NamespaceRequest.java +++ b/webui/src/main/java/org/polypheny/db/webui/models/catalog/requests/NamespaceRequest.java @@ -18,12 +18,12 @@ import java.util.List; import lombok.AllArgsConstructor; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; @AllArgsConstructor public class NamespaceRequest { - public List namespaceTypes; + public List dataModels; public String pattern; diff --git a/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/CollectionModel.java b/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/CollectionModel.java index 7efde351cb..117dc80a68 100644 --- a/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/CollectionModel.java +++ b/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/CollectionModel.java @@ -18,19 +18,19 @@ import org.jetbrains.annotations.Nullable; import org.polypheny.db.catalog.entity.logical.LogicalCollection; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; public class CollectionModel extends EntityModel { - public CollectionModel( @Nullable Long id, @Nullable String name, Long namespaceId, boolean modifiable, NamespaceType namespaceType, EntityType entityType ) { - super( id, name, namespaceId, modifiable, namespaceType, entityType ); + public CollectionModel( @Nullable Long id, @Nullable String name, Long namespaceId, boolean modifiable, DataModel dataModel, EntityType entityType ) { + super( id, name, namespaceId, modifiable, dataModel, entityType ); } public static CollectionModel from( LogicalCollection collection ) { - return new CollectionModel( collection.id, collection.name, collection.namespaceId, collection.modifiable, collection.namespaceType, collection.entityType ); + return new CollectionModel( collection.id, collection.name, collection.namespaceId, collection.modifiable, collection.dataModel, collection.entityType ); } } diff --git a/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/EntityModel.java b/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/EntityModel.java index 7c8f9ac615..6c3e4c1531 100644 --- a/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/EntityModel.java +++ b/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/EntityModel.java @@ -18,14 +18,14 @@ import org.jetbrains.annotations.Nullable; import org.polypheny.db.catalog.entity.logical.LogicalEntity; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; import org.polypheny.db.webui.models.catalog.IdEntity; public class EntityModel extends IdEntity { - public final NamespaceType namespaceType; + public final DataModel dataModel; public final EntityType entityType; @@ -34,17 +34,17 @@ public class EntityModel extends IdEntity { public final boolean modifiable; - public EntityModel( @Nullable Long id, @Nullable String name, @Nullable Long namespaceId, boolean modifiable, NamespaceType namespaceType, EntityType entityType ) { + public EntityModel( @Nullable Long id, @Nullable String name, @Nullable Long namespaceId, boolean modifiable, DataModel dataModel, EntityType entityType ) { super( id, name ); this.namespaceId = namespaceId; - this.namespaceType = namespaceType; + this.dataModel = dataModel; this.entityType = entityType; this.modifiable = modifiable; } public static EntityModel from( LogicalEntity entity ) { - return new EntityModel( entity.id, entity.name, entity.namespaceId, entity.modifiable, entity.namespaceType, entity.entityType ); + return new EntityModel( entity.id, entity.name, entity.namespaceId, entity.modifiable, entity.dataModel, entity.entityType ); } diff --git a/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/GraphModel.java b/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/GraphModel.java index 85d82ffe2e..09685ffe94 100644 --- a/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/GraphModel.java +++ b/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/GraphModel.java @@ -18,18 +18,18 @@ import org.jetbrains.annotations.Nullable; import org.polypheny.db.catalog.entity.logical.LogicalGraph; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; public class GraphModel extends EntityModel { - public GraphModel( @Nullable Long id, @Nullable String name, Long namespaceId, boolean modifiable, NamespaceType namespaceType, EntityType entityType ) { - super( id, name, namespaceId, modifiable, namespaceType, entityType ); + public GraphModel( @Nullable Long id, @Nullable String name, Long namespaceId, boolean modifiable, DataModel dataModel, EntityType entityType ) { + super( id, name, namespaceId, modifiable, dataModel, entityType ); } public static GraphModel from( LogicalGraph graph ) { - return new GraphModel( graph.id, graph.name, graph.namespaceId, graph.modifiable, graph.namespaceType, graph.entityType ); + return new GraphModel( graph.id, graph.name, graph.namespaceId, graph.modifiable, graph.dataModel, graph.entityType ); } } diff --git a/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/NamespaceModel.java b/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/NamespaceModel.java index 8bddcbaa75..fdb4cf804c 100644 --- a/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/NamespaceModel.java +++ b/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/NamespaceModel.java @@ -17,25 +17,25 @@ package org.polypheny.db.webui.models.catalog.schema; import org.polypheny.db.catalog.entity.logical.LogicalNamespace; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.webui.models.catalog.IdEntity; public class NamespaceModel extends IdEntity { public final boolean caseSensitive; - public final NamespaceType namespaceType; + public final DataModel dataModel; - public NamespaceModel( long id, String name, NamespaceType type, boolean caseSensitive ) { + public NamespaceModel( long id, String name, DataModel type, boolean caseSensitive ) { super( id, name ); - this.namespaceType = type; + this.dataModel = type; this.caseSensitive = caseSensitive; } public static NamespaceModel from( LogicalNamespace namespace ) { - return new NamespaceModel( namespace.id, namespace.name, namespace.namespaceType, namespace.caseSensitive ); + return new NamespaceModel( namespace.id, namespace.name, namespace.dataModel, namespace.caseSensitive ); } } diff --git a/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/TableModel.java b/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/TableModel.java index 50014b7070..d6190f9462 100644 --- a/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/TableModel.java +++ b/webui/src/main/java/org/polypheny/db/webui/models/catalog/schema/TableModel.java @@ -18,19 +18,19 @@ import org.jetbrains.annotations.Nullable; import org.polypheny.db.catalog.entity.logical.LogicalTable; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.catalog.logistic.EntityType; -import org.polypheny.db.catalog.logistic.NamespaceType; public class TableModel extends EntityModel { - public TableModel( @Nullable Long id, @Nullable String name, Long namespaceId, boolean modifiable, NamespaceType namespaceType, EntityType entityType ) { - super( id, name, namespaceId, modifiable, namespaceType, entityType ); + public TableModel( @Nullable Long id, @Nullable String name, Long namespaceId, boolean modifiable, DataModel dataModel, EntityType entityType ) { + super( id, name, namespaceId, modifiable, dataModel, entityType ); } public static TableModel from( LogicalTable table ) { - return new TableModel( table.id, table.name, table.namespaceId, table.modifiable, table.namespaceType, table.entityType ); + return new TableModel( table.id, table.name, table.namespaceId, table.modifiable, table.dataModel, table.entityType ); } } diff --git a/webui/src/main/java/org/polypheny/db/webui/models/requests/SchemaTreeRequest.java b/webui/src/main/java/org/polypheny/db/webui/models/requests/SchemaTreeRequest.java index 3a6cd6f020..a179388c49 100644 --- a/webui/src/main/java/org/polypheny/db/webui/models/requests/SchemaTreeRequest.java +++ b/webui/src/main/java/org/polypheny/db/webui/models/requests/SchemaTreeRequest.java @@ -18,7 +18,7 @@ import java.util.List; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; public class SchemaTreeRequest extends UIRequest { @@ -27,7 +27,7 @@ public class SchemaTreeRequest extends UIRequest { public int depth; public boolean showTable; - public List dataModels; + public List dataModels; } diff --git a/webui/src/main/java/org/polypheny/db/webui/models/results/DocResult.java b/webui/src/main/java/org/polypheny/db/webui/models/results/DocResult.java index b37d11f881..8c2570a531 100644 --- a/webui/src/main/java/org/polypheny/db/webui/models/results/DocResult.java +++ b/webui/src/main/java/org/polypheny/db/webui/models/results/DocResult.java @@ -20,7 +20,7 @@ import lombok.EqualsAndHashCode; import lombok.Value; import lombok.experimental.SuperBuilder; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.languages.QueryLanguage; import org.polypheny.db.webui.models.catalog.FieldDefinition; @@ -30,7 +30,7 @@ public class DocResult extends Result { public DocResult( - @JsonProperty("namespaceType") NamespaceType namespaceType, + @JsonProperty("dataModel") DataModel dataModel, @JsonProperty("namespace") String namespace, @JsonProperty("data") String[] data, @JsonProperty("header") FieldDefinition[] header, @@ -44,7 +44,7 @@ public DocResult( @JsonProperty("language") QueryLanguage language, @JsonProperty("affectedTuples") int affectedTuples ) { super( - namespaceType, + dataModel, namespace, data, header, diff --git a/webui/src/main/java/org/polypheny/db/webui/models/results/GraphResult.java b/webui/src/main/java/org/polypheny/db/webui/models/results/GraphResult.java index 2a81a5c983..3ea3fb7ab0 100644 --- a/webui/src/main/java/org/polypheny/db/webui/models/results/GraphResult.java +++ b/webui/src/main/java/org/polypheny/db/webui/models/results/GraphResult.java @@ -20,7 +20,7 @@ import lombok.EqualsAndHashCode; import lombok.Value; import lombok.experimental.SuperBuilder; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.languages.QueryLanguage; import org.polypheny.db.webui.models.catalog.FieldDefinition; @@ -30,7 +30,7 @@ public class GraphResult extends Result { public GraphResult( - @JsonProperty("namespaceType") NamespaceType namespaceType, + @JsonProperty("dataModel") DataModel dataModel, @JsonProperty("namespace") String namespace, @JsonProperty("data") String[][] data, @JsonProperty("header") FieldDefinition[] header, @@ -43,7 +43,7 @@ public GraphResult( @JsonProperty("hasMore") boolean hasMore, @JsonProperty("language") QueryLanguage language, @JsonProperty("affectedTuples") int affectedTuples ) { - super( namespaceType, namespace, data, header, exception, query, xid, error, currentPage, highestPage, hasMore, language, affectedTuples ); + super( dataModel, namespace, data, header, exception, query, xid, error, currentPage, highestPage, hasMore, language, affectedTuples ); } public static abstract class GraphResultBuilder> extends ResultBuilder { diff --git a/webui/src/main/java/org/polypheny/db/webui/models/results/RelationalResult.java b/webui/src/main/java/org/polypheny/db/webui/models/results/RelationalResult.java index 34358767e6..ee8b3a2a24 100644 --- a/webui/src/main/java/org/polypheny/db/webui/models/results/RelationalResult.java +++ b/webui/src/main/java/org/polypheny/db/webui/models/results/RelationalResult.java @@ -24,7 +24,7 @@ import lombok.Value; import lombok.experimental.NonFinal; import lombok.experimental.SuperBuilder; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.languages.QueryLanguage; import org.polypheny.db.webui.HttpServer; import org.polypheny.db.webui.models.catalog.UiColumnDefinition; @@ -61,7 +61,7 @@ public class RelationalResult extends Result { @JsonCreator public RelationalResult( - @JsonProperty("namespaceType") NamespaceType namespaceType, + @JsonProperty("dataModel") DataModel dataModel, @JsonProperty("namespace") String namespace, @JsonProperty("data") String[][] data, @JsonProperty("UiColumnDefinition") UiColumnDefinition[] header, @@ -78,7 +78,7 @@ public RelationalResult( @JsonProperty("ResultType") ResultType type, @JsonProperty("hasMoreRows") boolean hasMore, @JsonProperty("language") QueryLanguage language ) { - super( namespaceType, namespace, data, header, exception, query, xid, error, currentPage, highestPage, hasMore, language, affectedTuples ); + super( dataModel, namespace, data, header, exception, query, xid, error, currentPage, highestPage, hasMore, language, affectedTuples ); this.table = table; this.tables = tables; this.request = request; diff --git a/webui/src/main/java/org/polypheny/db/webui/models/results/Result.java b/webui/src/main/java/org/polypheny/db/webui/models/results/Result.java index 540f164808..5ca6c097f8 100644 --- a/webui/src/main/java/org/polypheny/db/webui/models/results/Result.java +++ b/webui/src/main/java/org/polypheny/db/webui/models/results/Result.java @@ -31,7 +31,7 @@ import lombok.Value; import lombok.experimental.NonFinal; import lombok.experimental.SuperBuilder; -import org.polypheny.db.catalog.logistic.NamespaceType; +import org.polypheny.db.catalog.logistic.DataModel; import org.polypheny.db.languages.QueryLanguage; @@ -44,7 +44,7 @@ public abstract class Result { /** * namespace type of result DOCUMENT/RELATIONAL */ - public NamespaceType namespaceType; + public DataModel dataModel; public String namespace; @@ -103,7 +103,7 @@ public static abstract class ResultBuilder, B exten */ protected B $fillValuesFrom( C instance ) { this.data = instance.data; - this.namespaceType = instance.namespaceType; + this.dataModel = instance.dataModel; this.xid = instance.xid; this.error = instance.error; this.namespace = instance.namespace;