Skip to content

Commit

Permalink
adjustment to mongo
Browse files Browse the repository at this point in the history
  • Loading branch information
datomo committed Sep 24, 2023
1 parent 18b06ee commit fedb409
Show file tree
Hide file tree
Showing 60 changed files with 1,305 additions and 906 deletions.
5 changes: 5 additions & 0 deletions core/src/main/java/org/polypheny/db/adapter/Adapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ public Expression asExpression() {
}


public Expression getCatalogAsExpression() {
return Expressions.field( asExpression(), "storeCatalog" );
}


public Namespace getNamespace( long id ) {
return namespaces.get( id );
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright 2019-2023 The Polypheny Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.polypheny.db.adapter;

import org.polypheny.db.algebra.AlgNode;
import org.polypheny.db.algebra.core.lpg.LpgModify;
import org.polypheny.db.catalog.catalogs.DocStoreCatalog;
import org.polypheny.db.catalog.entity.allocation.AllocationTable;
import org.polypheny.db.catalog.entity.logical.LogicalColumn;
import org.polypheny.db.catalog.entity.logical.LogicalIndex;
import org.polypheny.db.prepare.Context;
import org.polypheny.db.tools.AlgBuilder;

public class DocumentModifyDelegate extends DocumentScanDelegate implements Modifiable {

private final Modifiable modifiable;


public DocumentModifyDelegate( Modifiable modifiable, DocStoreCatalog catalog ) {
super( modifiable, catalog );
this.modifiable = modifiable;
}


@Override
public AlgNode getGraphModify( long allocId, LpgModify<?> modify, AlgBuilder builder ) {
return null;
}


@Override
public void addColumn( Context context, long allocId, LogicalColumn column ) {
modifiable.addColumn( context, allocId, column );
}


@Override
public void dropColumn( Context context, long allocId, long columnId ) {
modifiable.dropColumn( context, allocId, columnId );
}


@Override
public String addIndex( Context context, LogicalIndex logicalIndex, AllocationTable allocation ) {
return modifiable.addIndex( context, logicalIndex, allocation );
}


@Override
public void dropIndex( Context context, LogicalIndex logicalIndex, long allocId ) {
modifiable.dropIndex( context, logicalIndex, allocId );
}


@Override
public void updateColumnType( Context context, long allocId, LogicalColumn column ) {
modifiable.updateColumnType( context, allocId, column );
}

}
102 changes: 102 additions & 0 deletions core/src/main/java/org/polypheny/db/adapter/DocumentScanDelegate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
* Copyright 2019-2023 The Polypheny Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.polypheny.db.adapter;

import java.util.List;
import lombok.Getter;
import org.polypheny.db.catalog.catalogs.DocStoreCatalog;
import org.polypheny.db.catalog.entity.allocation.AllocationCollection;
import org.polypheny.db.catalog.entity.allocation.AllocationGraph;
import org.polypheny.db.catalog.entity.allocation.AllocationTableWrapper;
import org.polypheny.db.catalog.entity.logical.LogicalCollection;
import org.polypheny.db.catalog.entity.logical.LogicalGraph;
import org.polypheny.db.catalog.entity.logical.LogicalTableWrapper;
import org.polypheny.db.catalog.entity.physical.PhysicalEntity;
import org.polypheny.db.prepare.Context;

public class DocumentScanDelegate implements Scannable {

private final Scannable scannable;

@Getter
private final DocStoreCatalog catalog;


public DocumentScanDelegate( Scannable scannable, DocStoreCatalog catalog ) {
this.scannable = scannable;
this.catalog = catalog;
}


@Override
public void createTable( Context context, LogicalTableWrapper logical, AllocationTableWrapper allocation ) {
scannable.createTable( context, logical, allocation );
}


@Override
public void refreshTable( long allocId ) {
scannable.refreshTable( allocId );
}


@Override
public void refreshGraph( long allocId ) {
List<PhysicalEntity> physicals = catalog.getPhysicalsFromAllocs( allocId );
scannable.refreshTable( physicals.get( 0 ).allocationId );
scannable.refreshTable( physicals.get( 1 ).allocationId );
scannable.refreshTable( physicals.get( 2 ).allocationId );
scannable.refreshTable( physicals.get( 3 ).allocationId );
}


@Override
public void refreshCollection( long allocId ) {
scannable.refreshCollection( allocId );
}


@Override
public void dropTable( Context context, long allocId ) {
scannable.dropTable( context, allocId );
}


@Override
public void createGraph( Context context, LogicalGraph logical, AllocationGraph allocation ) {
scannable.createGraph( context, logical, allocation );
}


@Override
public void dropGraph( Context context, AllocationGraph allocation ) {
scannable.dropGraph( context, allocation );
}


@Override
public void createCollection( Context context, LogicalCollection logical, AllocationCollection allocation ) {
scannable.createCollection( context, logical, allocation );
}


@Override
public void dropCollection( Context context, AllocationCollection allocation ) {
scannable.dropCollection( context, allocation );
}

}
Loading

0 comments on commit fedb409

Please sign in to comment.