Skip to content

Commit

Permalink
renamed namespaceType to DataModel
Browse files Browse the repository at this point in the history
  • Loading branch information
datomo committed Nov 27, 2023
1 parent 0bb567e commit ef69fde
Show file tree
Hide file tree
Showing 103 changed files with 428 additions and 405 deletions.
10 changes: 5 additions & 5 deletions core/src/main/java/org/polypheny/db/PolyImplementation.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -64,7 +64,7 @@ public class PolyImplementation {
private final long maxRowCount = -1;
private final Kind kind;
private Bindable<PolyValue[]> bindable;
private final NamespaceType namespaceType;
private final DataModel dataModel;
private final ExecutionTimeMonitor executionTimeMonitor;
private CursorFactory cursorFactory;
private final Convention resultConvention;
Expand All @@ -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,...
Expand All @@ -92,14 +92,14 @@ public class PolyImplementation {
*/
public PolyImplementation(
@Nullable AlgDataType rowType,
NamespaceType namespaceType,
DataModel dataModel,
ExecutionTimeMonitor executionTimeMonitor,
@Nullable PreparedResult<PolyValue> preparedResult,
Kind kind,
Statement statement,
@Nullable Convention resultConvention ) {

this.namespaceType = namespaceType;
this.dataModel = dataModel;
this.executionTimeMonitor = executionTimeMonitor;
this.preparedResult = preparedResult;
this.kind = kind;
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/org/polypheny/db/adapter/Adapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -271,7 +271,7 @@ public void addInformationPhysicalNames() {
List<PhysicalEntity> 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;
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/org/polypheny/db/algebra/AlgNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -83,8 +83,8 @@ public static LogicalDocumentValues createOneTuple( AlgOptCluster cluster ) {


@Override
public NamespaceType getModel() {
return NamespaceType.DOCUMENT;
public DataModel getModel() {
return DataModel.DOCUMENT;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
Expand All @@ -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();
}
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 );
}

}
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/org/polypheny/db/catalog/Catalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -55,7 +55,7 @@ public abstract class LogicalEntity implements LogicalObject, Wrapper, Serializa
public EntityType entityType;

@Serialize
public NamespaceType namespaceType;
public DataModel dataModel;

@Serialize
@SerializeNullable
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand Down Expand Up @@ -88,7 +88,7 @@ public class LogicalColumn implements LogicalObject, Comparable<LogicalColumn> {
@SerializeNullable
public LogicalDefaultValue defaultValue;

public NamespaceType namespaceType = NamespaceType.RELATIONAL;
public DataModel dataModel = DataModel.RELATIONAL;


public LogicalColumn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}

Expand Down
Loading

0 comments on commit ef69fde

Please sign in to comment.