Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove method getNamespaceId #527

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading