Skip to content

Commit

Permalink
Remove constant method getNamespaceId
Browse files Browse the repository at this point in the history
  • Loading branch information
gartens committed Dec 20, 2024
1 parent af3d18f commit 04e124f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 13 deletions.
5 changes: 0 additions & 5 deletions core/src/main/java/org/polypheny/db/nodes/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.Set;
import org.jetbrains.annotations.Nullable;
import org.polypheny.db.algebra.constant.Kind;
import org.polypheny.db.catalog.Catalog;
import org.polypheny.db.languages.ParserPos;
import org.polypheny.db.languages.QueryLanguage;
import org.polypheny.db.util.Litmus;
Expand Down Expand Up @@ -96,10 +95,6 @@ default boolean isDdl() {
return Kind.DDL.contains( getKind() );
}

default long getNamespaceId() {
return Catalog.defaultNamespaceId;
}

@Nullable
default String getNamespaceName() {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static ParsedQueryContext fromQuery( String query, Node queryNode, QueryC
long namespaceId = context.namespaceId;

if ( queryNode != null && queryNode.getNamespaceName() != null ) {
namespaceId = Catalog.snapshot().getNamespace( queryNode.getNamespaceName() ).map( n -> n.id ).orElse( queryNode.getNamespaceId() );
namespaceId = Catalog.snapshot().getNamespace( queryNode.getNamespaceName() ).map( n -> n.id ).orElse( namespaceId );
}

if ( context.transactions.stream().anyMatch( t -> !t.isActive() ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ public MqlCreateView( ParserPos pos, String name, String namespace, String sourc

@Override
public void execute( Context context, Statement statement, ParsedQueryContext parsedQueryContext ) {
long database = parsedQueryContext.getQueryNode().orElseThrow().getNamespaceId();

long namespaceId = context.getSnapshot().getNamespace( database ).orElseThrow().id;
long namespaceId = context.getSnapshot().getNamespace( parsedQueryContext.getNamespaceId() ).orElseThrow().id;

QueryContext queryContext = QueryContext.builder()
.query( buildQuery() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,13 @@ public Type getMqlKind() {

@Override
public void execute( Context context, Statement statement, ParsedQueryContext parsedQueryContext ) {
long namespaceId = parsedQueryContext.getQueryNode().orElseThrow().getNamespaceId();

LogicalCollection collection = context.getSnapshot().doc().getCollection( namespaceId, getCollection() ).orElseThrow();
LogicalCollection collection = context.getSnapshot().doc().getCollection( parsedQueryContext.getNamespaceId(), getCollection() ).orElseThrow();

if ( dropTarget ) {
DdlManager.getInstance().dropCollection( collection, statement );
}

DdlManager.getInstance().renameCollection( collection, newName, statement );

}


Expand Down

0 comments on commit 04e124f

Please sign in to comment.