From d30deff9a88d326ff829df689c69c46960dbf3d3 Mon Sep 17 00:00:00 2001 From: datomo Date: Sat, 28 Oct 2023 20:44:43 +0200 Subject: [PATCH] fixes incorrect loading of configs, replaced Runtime with our exception --- .../polypheny/db/config/ConfigManager.java | 2 +- .../polypheny/db/config/ConfigServerTest.java | 27 ++++++++++++++++++- .../org/polypheny/db/PolyImplementation.java | 6 ++--- .../db/plan/volcano/VolcanoPlanner.java | 3 ++- .../java/org/polypheny/db/PolyphenyDb.java | 4 +++ .../db/processing/AbstractQueryProcessor.java | 14 +++++----- .../db/processing/DataMigratorImpl.java | 6 ++--- .../db/routing/routers/BaseRouter.java | 2 +- .../org/polypheny/db/avatica/DbmsMeta.java | 15 ++++++----- .../ConcurrentTestCommandGenerator.java | 2 +- .../adapter/cottontail/CottontailPlugin.java | 4 +-- .../adapter/cottontail/CottontailWrapper.java | 5 ++-- .../cottontail/algebra/CottontailFilter.java | 5 ++-- .../cottontail/algebra/CottontailSort.java | 3 ++- .../algebra/CottontailTableModify.java | 5 ++-- .../CottontailToEnumerableConverter.java | 3 ++- .../CottontailEnumerableFactory.java | 3 ++- .../CottontailQueryEnumerable.java | 3 ++- .../cottontail/util/CottontailTypeUtil.java | 21 ++++++++------- .../adapter/cottontail/util/Linq4JFixer.java | 3 ++- .../db/cypher/CypherProcessorImpl.java | 3 ++- .../polypheny/db/cypher/CypherRegisterer.java | 3 ++- .../admin/CypherAlterDatabaseAlias.java | 3 ++- .../db/cypher/admin/CypherDropDatabase.java | 3 ++- .../db/cypher/ddl/CypherAddPlacement.java | 4 +-- .../db/cypher/ddl/CypherDropPlacement.java | 7 ++--- .../db/cypher/query/CypherSingleQuery.java | 3 ++- .../db/cypher/remove/CypherRemoveLabels.java | 5 ++-- .../db/cypher/set/CypherSetVariable.java | 3 ++- .../db/adapter/ethereum/BlockReader.java | 3 ++- .../adapter/ethereum/EthereumEnumerator.java | 4 +-- .../db/adapter/ethereum/EthereumPlugin.java | 2 +- .../ExploreQueryProcessor.java | 3 ++- .../db/adapter/file/util/FileUtil.java | 11 +++++--- .../googlesheet/GoogleSheetFieldType.java | 3 ++- .../googlesheet/GoogleSheetReader.java | 5 ++-- .../polypheny/db/adapter/jdbc/JdbcSchema.java | 3 ++- .../jdbc/JdbcToEnumerableConverter.java | 3 ++- .../polypheny/db/adapter/jdbc/JdbcUtils.java | 4 +-- .../db/adapter/jdbc/ResultSetEnumerable.java | 2 +- .../adapter/jdbc/rel2sql/SqlImplementor.java | 3 ++- .../jdbc/sources/AbstractJdbcSource.java | 13 ++++----- .../jdbc/stores/AbstractJdbcStore.java | 4 +-- .../db/monitoring/MapDbRepository.java | 3 ++- .../adapter/monetdb/stores/MonetdbStore.java | 12 ++++----- .../db/adapter/mongodb/MongoPlugin.java | 2 +- .../db/languages/MongoLanguagePlugin.java | 3 ++- .../languages/mql2alg/MqlToAlgConverter.java | 18 ++++++------- .../postgres/store/PostgresqlStore.java | 12 ++++----- .../db/sql/language/ddl/SqlAlterConfig.java | 3 ++- .../java/org/polypheny/db/webui/Crud.java | 6 ++--- 51 files changed, 178 insertions(+), 114 deletions(-) diff --git a/config/src/main/java/org/polypheny/db/config/ConfigManager.java b/config/src/main/java/org/polypheny/db/config/ConfigManager.java index 442631b2de..a23ab9ccf5 100644 --- a/config/src/main/java/org/polypheny/db/config/ConfigManager.java +++ b/config/src/main/java/org/polypheny/db/config/ConfigManager.java @@ -205,7 +205,7 @@ private com.typesafe.config.Config parseConfigObject( String configKey, Object u myList.add( v ); } } - if ( myMap.size() > 0 ) { + if ( !myMap.isEmpty() ) { modifiedConfig = configFile.withValue( configKey, ConfigValueFactory.fromAnyRef( myMap ) ); } else { modifiedConfig = configFile.withValue( configKey, ConfigValueFactory.fromAnyRef( myList ) ); diff --git a/config/src/test/java/org/polypheny/db/config/ConfigServerTest.java b/config/src/test/java/org/polypheny/db/config/ConfigServerTest.java index a17a573c0b..19d4478604 100644 --- a/config/src/test/java/org/polypheny/db/config/ConfigServerTest.java +++ b/config/src/test/java/org/polypheny/db/config/ConfigServerTest.java @@ -17,6 +17,13 @@ package org.polypheny.db.config; +import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import io.javalin.Javalin; +import io.javalin.plugin.json.JavalinJackson; import java.util.Arrays; import java.util.Random; import java.util.Timer; @@ -27,8 +34,26 @@ public class ConfigServerTest { + public static void main( String[] args ) { - ConfigService s = new ConfigService( null ); + ObjectMapper mapper = new ObjectMapper() { + { + setSerializationInclusion( JsonInclude.Include.NON_NULL ); + configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false ); + setVisibility( getSerializationConfig().getDefaultVisibilityChecker() + .withIsGetterVisibility( Visibility.NONE ) + .withGetterVisibility( Visibility.NONE ) + .withSetterVisibility( Visibility.NONE ) ); + configure( SerializationFeature.FAIL_ON_EMPTY_BEANS, false ); + writerWithDefaultPrettyPrinter(); + } + }; + Javalin server = Javalin.create( config -> { + config.jsonMapper( new JavalinJackson( mapper ) ); + config.enableCorsForAllOrigins(); + config.addStaticFiles( staticFileConfig -> staticFileConfig.directory = "webapp/" ); + } ).start( 7659 ); + ConfigService s = new ConfigService( server ); demoData( s ); } diff --git a/core/src/main/java/org/polypheny/db/PolyImplementation.java b/core/src/main/java/org/polypheny/db/PolyImplementation.java index 9fd23715a4..be1f523bb4 100644 --- a/core/src/main/java/org/polypheny/db/PolyImplementation.java +++ b/core/src/main/java/org/polypheny/db/PolyImplementation.java @@ -267,7 +267,7 @@ public static Meta.StatementType toStatementType( Kind kind ) { return Meta.StatementType.IS_DML; } - throw new RuntimeException( "Statement type does not exist." ); + throw new GenericRuntimeException( "Statement type does not exist." ); } @@ -286,9 +286,9 @@ public int getRowsChanged( Statement statement ) throws Exception { rowsChanged = getRowsChanged( statement, iterator, MonitoringType.from( getKind() ) ); } catch ( RuntimeException e ) { if ( e.getCause() != null ) { - throw new Exception( e.getCause().getMessage(), e ); + throw new GenericRuntimeException( e.getCause().getMessage(), e ); } else { - throw new Exception( e.getMessage(), e ); + throw new GenericRuntimeException( e.getMessage(), e ); } } return rowsChanged; diff --git a/core/src/main/java/org/polypheny/db/plan/volcano/VolcanoPlanner.java b/core/src/main/java/org/polypheny/db/plan/volcano/VolcanoPlanner.java index 0ac7e9501a..4d3656ab8b 100644 --- a/core/src/main/java/org/polypheny/db/plan/volcano/VolcanoPlanner.java +++ b/core/src/main/java/org/polypheny/db/plan/volcano/VolcanoPlanner.java @@ -80,6 +80,7 @@ import org.polypheny.db.algebra.rules.SemiJoinRules; import org.polypheny.db.algebra.rules.SortRemoveRule; import org.polypheny.db.algebra.rules.UnionToDistinctRule; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.config.RuntimeConfig; import org.polypheny.db.plan.AbstractRelOptPlanner; import org.polypheny.db.plan.AlgOptCost; @@ -393,7 +394,7 @@ public boolean addRule( AlgOptRule rule ) { if ( ruleNames.put( ruleName, rule.getClass() ) ) { Set> x = ruleNames.get( ruleName ); if ( x.size() > 1 ) { - throw new RuntimeException( "Rule description '" + ruleName + "' is not unique; classes: " + x ); + throw new GenericRuntimeException( "Rule description '" + ruleName + "' is not unique; classes: " + x ); } } diff --git a/dbms/src/main/java/org/polypheny/db/PolyphenyDb.java b/dbms/src/main/java/org/polypheny/db/PolyphenyDb.java index 1b803fe933..3b195731a6 100644 --- a/dbms/src/main/java/org/polypheny/db/PolyphenyDb.java +++ b/dbms/src/main/java/org/polypheny/db/PolyphenyDb.java @@ -72,6 +72,7 @@ import org.polypheny.db.processing.AuthenticatorImpl; import org.polypheny.db.processing.ConstraintEnforceAttacher.ConstraintTracker; import org.polypheny.db.processing.JsonRelProcessorImpl; +import org.polypheny.db.routing.RoutingManager; import org.polypheny.db.transaction.PUID; import org.polypheny.db.transaction.Transaction; import org.polypheny.db.transaction.TransactionException; @@ -371,6 +372,7 @@ public void join( final long millis ) throws InterruptedException { new ConfigService( server.getServer() ); new InformationService( server.getServer() ); + try { new JavaInformation(); } catch ( Exception e ) { @@ -457,6 +459,8 @@ public void join( final long millis ) throws InterruptedException { } PolyPluginManager.initAfterCatalog(); + //noinspection ResultOfMethodCallIgnored + RoutingManager.getInstance(); PolyPluginManager.initAfterTransaction( transactionManager ); diff --git a/dbms/src/main/java/org/polypheny/db/processing/AbstractQueryProcessor.java b/dbms/src/main/java/org/polypheny/db/processing/AbstractQueryProcessor.java index dc4f796887..6719c57371 100644 --- a/dbms/src/main/java/org/polypheny/db/processing/AbstractQueryProcessor.java +++ b/dbms/src/main/java/org/polypheny/db/processing/AbstractQueryProcessor.java @@ -598,7 +598,7 @@ private void acquireLock( boolean isAnalyze, AlgRoot logicalRoot, Map( rowValues, targetRowValues ) ); @@ -1000,7 +1000,7 @@ private List route( AlgRoot logicalRoot, Statement statemen final List distinctPlans = proposedPlans.stream().distinct().collect( Collectors.toList() ); if ( distinctPlans.isEmpty() ) { - throw new RuntimeException( "No routing of query found" ); + throw new GenericRuntimeException( "No routing of query found" ); } if ( statement.getTransaction().isAnalyze() ) { @@ -1584,7 +1584,7 @@ public void lock( Statement statement ) { try { LockManager.INSTANCE.lock( Collections.singletonList( Pair.of( LockManager.GLOBAL_LOCK, LockMode.SHARED ) ), (TransactionImpl) statement.getTransaction() ); } catch ( DeadlockException e ) { - throw new RuntimeException( "DeadLock while locking to reevaluate statistics", e ); + throw new GenericRuntimeException( "DeadLock while locking to reevaluate statistics", e ); } } diff --git a/dbms/src/main/java/org/polypheny/db/processing/DataMigratorImpl.java b/dbms/src/main/java/org/polypheny/db/processing/DataMigratorImpl.java index 058b8f89e8..9c5bc13261 100644 --- a/dbms/src/main/java/org/polypheny/db/processing/DataMigratorImpl.java +++ b/dbms/src/main/java/org/polypheny/db/processing/DataMigratorImpl.java @@ -675,7 +675,7 @@ public void copySelectiveData( Transaction transaction, LogicalAdapter store, Lo targetStatement.getDataContext().resetParameterValues(); } } catch ( Throwable t ) { - throw new RuntimeException( t ); + throw new GenericRuntimeException( t ); } } @@ -877,7 +877,7 @@ private AlgRoot getScan( Statement statement, LogicalTable table, AllocationTabl public void copyPartitionDataOld( Transaction transaction, LogicalAdapter store, LogicalTable sourceTable, LogicalTable targetTable, List columns, List sourcePartitionIds, List targetPartitionIds ) { if ( sourceTable.id != targetTable.id ) { - throw new RuntimeException( "Unsupported migration scenario. Table ID mismatch" ); + throw new GenericRuntimeException( "Unsupported migration scenario. Table ID mismatch" ); } Snapshot snapshot = Catalog.getInstance().getSnapshot(); LogicalPrimaryKey primaryKey = snapshot.rel().getPrimaryKey( sourceTable.primaryKey ).orElseThrow(); @@ -1015,7 +1015,7 @@ public void copyPartitionDataOld( Transaction transaction, LogicalAdapter store, } } } catch ( Throwable t ) { - throw new RuntimeException( t ); + throw new GenericRuntimeException( t ); } } diff --git a/dbms/src/main/java/org/polypheny/db/routing/routers/BaseRouter.java b/dbms/src/main/java/org/polypheny/db/routing/routers/BaseRouter.java index 4de24b3c0e..5ed5018f8f 100644 --- a/dbms/src/main/java/org/polypheny/db/routing/routers/BaseRouter.java +++ b/dbms/src/main/java/org/polypheny/db/routing/routers/BaseRouter.java @@ -315,7 +315,7 @@ protected List handleGeneric( AlgNode node, List map, fina try { propertyValue = p.method.invoke( metaData ); } catch ( IllegalAccessException | InvocationTargetException e ) { - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } } else { propertyValue = p.defaultValue; @@ -240,7 +241,7 @@ private MetaResultSet createMetaResultSet( final ConnectionHandle ch, final try { field = clazz.getField( fieldName ); } catch ( NoSuchFieldException e ) { - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } columns.add( MetaImpl.columnMetaData( name, index, field.getType(), false ) ); fields.add( field ); @@ -989,11 +990,11 @@ public StatementHandle prepare( final ConnectionHandle ch, final String sql, fin } StatementHandle h = createStatement( ch ); - PolyphenyDbStatementHandle polyphenyDbStatement; + PolyphenyDbStatementHandle polyphenyDbStatement; try { polyphenyDbStatement = getPolyphenyDbStatementHandle( h ); } catch ( NoSuchStatementException e ) { - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } polyphenyDbStatement.setPreparedQuery( sql ); @@ -1236,7 +1237,7 @@ private ExecuteResult execute( StatementHandle h, List parameterValu } catch ( Exception e ) { rollback( connection.getHandle() ); - throw new RuntimeException( "Error on auto-commit, transaction was rolled back.\n\n" + e ); + throw new GenericRuntimeException( "Error on auto-commit, transaction was rolled back.\n\n" + e ); } } @@ -1588,7 +1589,7 @@ public void closeConnection( ConnectionHandle ch ) { try { transaction.rollback(); } catch ( TransactionException e ) { - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } } @@ -1733,7 +1734,7 @@ private RuntimeException propagate( Throwable e ) { } else if ( e instanceof Error ) { throw (Error) e; } else { - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } } diff --git a/plugins/avatica-interface/src/main/test/org.polypheny.db.jdbc/concurrent/ConcurrentTestCommandGenerator.java b/plugins/avatica-interface/src/main/test/org.polypheny.db.jdbc/concurrent/ConcurrentTestCommandGenerator.java index 0a89ce4105..14e79fa6cb 100644 --- a/plugins/avatica-interface/src/main/test/org.polypheny.db.jdbc/concurrent/ConcurrentTestCommandGenerator.java +++ b/plugins/avatica-interface/src/main/test/org.polypheny.db.jdbc/concurrent/ConcurrentTestCommandGenerator.java @@ -1154,7 +1154,7 @@ private void dumpData( String message ) { rowNum++; } - throw new RuntimeException( fullMessage.toString() ); + throw new GenericRuntimeException( fullMessage.toString() ); } } diff --git a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/CottontailPlugin.java b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/CottontailPlugin.java index 5902545070..850c44ba26 100644 --- a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/CottontailPlugin.java +++ b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/CottontailPlugin.java @@ -321,7 +321,7 @@ public void addColumn( Context context, long allocId, LogicalColumn logicalColum .addAllColumns( columns ) ).build(); if ( !this.wrapper.createEntityBlocking( message ) ) { - throw new RuntimeException( "Unable to create table." ); + throw new GenericRuntimeException( "Unable to create table." ); } PolyType actualDefaultType; @@ -399,7 +399,7 @@ public void dropColumn( Context context, long allocId, long columnId ) { .build(); if ( !this.wrapper.createEntityBlocking( message ) ) { - throw new RuntimeException( "Unable to create table." ); + throw new GenericRuntimeException( "Unable to create table." ); } final QueryMessage query = QueryMessage.newBuilder() .setMetadata( Metadata.newBuilder().setTransactionId( txId ) ) diff --git a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/CottontailWrapper.java b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/CottontailWrapper.java index 9ce9fefeed..2439bf3ef7 100644 --- a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/CottontailWrapper.java +++ b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/CottontailWrapper.java @@ -23,6 +23,7 @@ import java.util.concurrent.TimeUnit; import lombok.extern.slf4j.Slf4j; import org.polypheny.db.adapter.cottontail.CottontailPlugin.CottontailStore; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.transaction.PolyXid; import org.polypheny.db.transaction.Transaction; import org.vitrivr.cottontail.client.SimpleClient; @@ -121,7 +122,7 @@ public void commit( PolyXid xid ) { this.transactions.remove( xid ); } catch ( StatusRuntimeException e ) { log.error( "Could not COMMIT Cottontail DB transaction {} due to error; trying rollback", txId, e ); - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } } else { log.warn( "No Cottontail DB transaction for Xid {} could be found.", xid ); @@ -142,7 +143,7 @@ public void rollback( PolyXid xid ) { this.transactions.remove( xid ); } catch ( StatusRuntimeException e ) { log.error( "Could not ROLLBACK Cottontail DB transaction {} due to error.", txId, e ); - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } } else { log.warn( "No Cottontail DB transaction for Xid {} could be found.", xid ); diff --git a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/algebra/CottontailFilter.java b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/algebra/CottontailFilter.java index d6e2a8c642..6481f1462b 100644 --- a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/algebra/CottontailFilter.java +++ b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/algebra/CottontailFilter.java @@ -35,6 +35,7 @@ import org.polypheny.db.algebra.core.Filter; import org.polypheny.db.algebra.type.AlgDataType; import org.polypheny.db.algebra.type.AlgDataTypeField; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.plan.AlgOptCluster; import org.polypheny.db.plan.AlgTraitSet; import org.polypheny.db.rex.RexCall; @@ -323,7 +324,7 @@ public static Where generateWhere( Object filterExpression ) { return Where.newBuilder().setCompound( (CompoundBooleanPredicate) filterExpression ).build(); } - throw new RuntimeException( "Not a proper filter expression!" ); + throw new GenericRuntimeException( "Not a proper filter expression!" ); } } @@ -595,7 +596,7 @@ public Op inverse() { case ROOT: return this; } - throw new RuntimeException( "Unreachable code!" ); + throw new GenericRuntimeException( "Unreachable code!" ); } } diff --git a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/algebra/CottontailSort.java b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/algebra/CottontailSort.java index a2005fddf1..85e90ea983 100644 --- a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/algebra/CottontailSort.java +++ b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/algebra/CottontailSort.java @@ -31,6 +31,7 @@ import org.polypheny.db.algebra.AlgNode; import org.polypheny.db.algebra.core.Sort; import org.polypheny.db.algebra.metadata.AlgMetadataQuery; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.plan.AlgOptCluster; import org.polypheny.db.plan.AlgOptCost; import org.polypheny.db.plan.AlgOptPlanner; @@ -133,7 +134,7 @@ private static Expression numberBuilderBuilder( RexNode node ) { } else if ( node instanceof RexDynamicParam ) { expr = Expressions.call( dynamicParameterMap_, BuiltInMethod.MAP_GET.method, Expressions.constant( ((RexDynamicParam) node).getIndex() ) ); } else { - throw new RuntimeException( "Node statement is neither a Literal nor a Dynamic Parameter." ); + throw new GenericRuntimeException( "Node statement is neither a Literal nor a Dynamic Parameter." ); } inner.add( Expressions.return_( null, expr ) ); diff --git a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/algebra/CottontailTableModify.java b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/algebra/CottontailTableModify.java index 06d573f6d1..746c10a30c 100644 --- a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/algebra/CottontailTableModify.java +++ b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/algebra/CottontailTableModify.java @@ -35,6 +35,7 @@ import org.polypheny.db.algebra.core.relational.RelModify; import org.polypheny.db.algebra.metadata.AlgMetadataQuery; import org.polypheny.db.algebra.type.AlgDataTypeField; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.plan.AlgOptCost; import org.polypheny.db.plan.AlgOptPlanner; import org.polypheny.db.plan.AlgTraitSet; @@ -134,7 +135,7 @@ public void implement( CottontailImplementContext context ) { // context.visitChild( 0, getInput() ); break; case MERGE: - throw new RuntimeException( "Merge is not supported." ); + throw new GenericRuntimeException( "Merge is not supported." ); } } @@ -174,7 +175,7 @@ private Expression buildUpdateTupleBuilder( CottontailImplementContext context ) } else if ( (rexNode instanceof RexCall) && (((RexCall) rexNode).getOperator() instanceof SqlArrayValueConstructor) ) { source_ = CottontailTypeUtil.rexArrayConstructorToExpression( (RexCall) rexNode, columnTypes.get( actualColumnIndex ) ); } else { - throw new RuntimeException( "unable to convert expression." ); + throw new GenericRuntimeException( "unable to convert expression." ); } inner.add( Expressions.statement( diff --git a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/algebra/CottontailToEnumerableConverter.java b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/algebra/CottontailToEnumerableConverter.java index d1a80baa51..9d1b5d5d52 100644 --- a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/algebra/CottontailToEnumerableConverter.java +++ b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/algebra/CottontailToEnumerableConverter.java @@ -41,6 +41,7 @@ import org.polypheny.db.algebra.enumerable.PhysTypeImpl; import org.polypheny.db.algebra.metadata.AlgMetadataQuery; import org.polypheny.db.algebra.type.AlgDataType; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.plan.AlgOptCluster; import org.polypheny.db.plan.AlgOptCost; import org.polypheny.db.plan.AlgOptPlanner; @@ -223,7 +224,7 @@ private void generateGet( AlgDataType rowType, BlockBuilder blockBuilder, Parame try { getDataFromMap_ = blockBuilder.append( "v" + i, Expressions.call( result_, Types.lookupMethod( Tuple.class, "get", Integer.TYPE ), Expressions.constant( i ) ) ); } catch ( Exception e ) { - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } // Create accessor + converter for values returned by Cottontail DB. */ diff --git a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/enumberable/CottontailEnumerableFactory.java b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/enumberable/CottontailEnumerableFactory.java index e2f135058a..106e7d2022 100644 --- a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/enumberable/CottontailEnumerableFactory.java +++ b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/enumberable/CottontailEnumerableFactory.java @@ -29,6 +29,7 @@ import org.polypheny.db.adapter.DataContext; import org.polypheny.db.adapter.cottontail.CottontailWrapper; import org.polypheny.db.adapter.cottontail.util.CottontailTypeUtil; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.type.entity.PolyValue; import org.vitrivr.cottontail.client.iterators.Tuple; import org.vitrivr.cottontail.client.iterators.TupleIterator; @@ -360,7 +361,7 @@ private static UpdateMessage buildSingleUpdate( .build() ); } } catch ( RuntimeException e ) { - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } builder.setFrom( from_ ); diff --git a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/enumberable/CottontailQueryEnumerable.java b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/enumberable/CottontailQueryEnumerable.java index 0ba15e5c53..44968b561b 100644 --- a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/enumberable/CottontailQueryEnumerable.java +++ b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/enumberable/CottontailQueryEnumerable.java @@ -25,6 +25,7 @@ import org.polypheny.db.adapter.cottontail.util.Linq4JFixer; import org.polypheny.db.algebra.type.AlgDataType; import org.polypheny.db.algebra.type.AlgDataTypeField; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.sql.language.fun.SqlArrayValueConstructor; import org.polypheny.db.type.ArrayType; import org.polypheny.db.type.entity.PolyBigDecimal; @@ -196,7 +197,7 @@ private PolyValue parseSingleField( Object data, AlgDataType type ) { case REAL: return Linq4JFixer.getFloatVector( data ); default: - throw new RuntimeException( "Impossible to reach statement." ); + throw new GenericRuntimeException( "Impossible to reach statement." ); } } else { SqlArrayValueConstructor.reparse( arrayType.getComponentType().getPolyType(), arrayType.getDimension(), (String) data ); diff --git a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/util/CottontailTypeUtil.java b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/util/CottontailTypeUtil.java index 20011d0c51..1ce3767f26 100644 --- a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/util/CottontailTypeUtil.java +++ b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/util/CottontailTypeUtil.java @@ -37,6 +37,7 @@ import org.apache.calcite.linq4j.tree.Types; import org.polypheny.db.algebra.type.AlgDataType; import org.polypheny.db.catalog.entity.CatalogDefaultValue; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.languages.ParserPos; import org.polypheny.db.rex.RexCall; import org.polypheny.db.rex.RexDynamicParam; @@ -178,7 +179,7 @@ public static CottontailGrpc.Type getPhysicalTypeRepresentation( PolyType logica } } - throw new RuntimeException( "Type " + logicalType + " is not supported by the Cottontail DB adapter." ); + throw new GenericRuntimeException( "Type " + logicalType + " is not supported by the Cottontail DB adapter." ); } @@ -252,7 +253,7 @@ public static Expression rexLiteralToDataExpression( RexLiteral rexLiteral, Poly constantExpression = Expressions.constant( rexLiteral.value.asBlob().as64String() ); break; default: - throw new RuntimeException( "Type " + rexLiteral.type + " is not supported by the cottontail adapter." ); + throw new GenericRuntimeException( "Type " + rexLiteral.type + " is not supported by the cottontail adapter." ); } } @@ -423,7 +424,7 @@ public static CottontailGrpc.Literal toData( Object value, PolyType actualType, } log.error( "Conversion not possible! value: {}, type: {}", value.getClass().getCanonicalName(), actualType ); - throw new RuntimeException( "Cottontail data type error: Type not handled." ); + throw new GenericRuntimeException( "Cottontail data type error: Type not handled." ); } @@ -463,7 +464,7 @@ public static Vector toVectorCallData( Object vectorObject, PolyType dstElementT } return builder.build(); default: - throw new RuntimeException( "Unsupported type: " + dstElementType.getName() ); + throw new GenericRuntimeException( "Unsupported type: " + dstElementType.getName() ); } } @@ -543,7 +544,7 @@ private static List arrayCallToList( List operands, PolyType in } else if ( node instanceof RexCall ) { list.add( arrayCallToList( ((RexCall) node).operands, innerType ) ); } else { - throw new RuntimeException( "Invalid array." ); + throw new GenericRuntimeException( "Invalid array." ); } } @@ -583,7 +584,7 @@ private static Object rexLiteralToJavaClass( RexLiteral rexLiteral, PolyType act case SMALLINT: return rexLiteral.getValueAs( Short.class ); default: - throw new RuntimeException( "Type " + actualType + " is not supported by the cottontail adapter." ); + throw new GenericRuntimeException( "Type " + actualType + " is not supported by the cottontail adapter." ); } } @@ -627,7 +628,7 @@ private static Expression knnCallTargetColumn( RexNode node, List physic return Expressions.call( dynamicParamMap, BuiltInMethod.MAP_GET.method, Expressions.constant( dynamicParam.getIndex() ) ); } - throw new RuntimeException( "First argument is neither an input ref nor a dynamic parameter" ); + throw new GenericRuntimeException( "First argument is neither an input ref nor a dynamic parameter" ); } @@ -648,7 +649,7 @@ private static Expression knnCallVector( RexNode node, ParameterExpression dynam return Expressions.call( CottontailTypeUtil.class, "toVectorCallData", listExpression, Expressions.constant( actualType ) ); } - throw new RuntimeException( "Argument is neither an array call nor a dynamic parameter" ); + throw new GenericRuntimeException( "Argument is neither an array call nor a dynamic parameter" ); } @@ -667,13 +668,13 @@ private static Expression knnCallDistance( RexNode node, ParameterExpression dyn Expressions.constant( dynamicParam.getIndex() ) ); } - throw new RuntimeException( "Argument is neither an array call nor a dynamic parameter" ); + throw new GenericRuntimeException( "Argument is neither an array call nor a dynamic parameter" ); } public static Object defaultValueParser( CatalogDefaultValue catalogDefaultValue, PolyType actualType ) { if ( actualType == PolyType.ARRAY ) { - throw new RuntimeException( "Default values are not supported for array types" ); + throw new GenericRuntimeException( "Default values are not supported for array types" ); } Object literal; diff --git a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/util/Linq4JFixer.java b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/util/Linq4JFixer.java index decca8a56a..84e248a8bd 100644 --- a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/util/Linq4JFixer.java +++ b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/util/Linq4JFixer.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import org.apache.calcite.avatica.util.ByteString; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.type.entity.PolyBoolean; import org.polypheny.db.type.entity.PolyDouble; import org.polypheny.db.type.entity.PolyFloat; @@ -295,7 +296,7 @@ public static Where generateWhere( Object filterExpression ) { return Where.newBuilder().setCompound( (CompoundBooleanPredicate) filterExpression ).build(); } - throw new RuntimeException( "Not a proper filter expression!" ); + throw new GenericRuntimeException( "Not a proper filter expression!" ); } diff --git a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/CypherProcessorImpl.java b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/CypherProcessorImpl.java index 83fff1e0e4..ebce9a04a9 100644 --- a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/CypherProcessorImpl.java +++ b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/CypherProcessorImpl.java @@ -24,6 +24,7 @@ import org.polypheny.db.algebra.constant.ExplainFormat; import org.polypheny.db.algebra.constant.ExplainLevel; import org.polypheny.db.algebra.type.AlgDataType; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.cypher.cypher2alg.CypherToAlgConverter; import org.polypheny.db.cypher.parser.CypherParser; import org.polypheny.db.cypher.parser.CypherParser.CypherParserConfig; @@ -73,7 +74,7 @@ public List parse( String query ) { parsed = parser.parseStmts(); } catch ( NodeParseException e ) { log.error( "Caught exception", e ); - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } stopWatch.stop(); if ( log.isTraceEnabled() ) { diff --git a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/CypherRegisterer.java b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/CypherRegisterer.java index 9d8f2ede37..bdd8df3b5f 100644 --- a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/CypherRegisterer.java +++ b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/CypherRegisterer.java @@ -20,6 +20,7 @@ import lombok.Getter; import org.polypheny.db.algebra.constant.Kind; import org.polypheny.db.algebra.operators.OperatorName; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.languages.OperatorRegistry; import org.polypheny.db.languages.QueryLanguage; import org.polypheny.db.nodes.LangFunctionOperator; @@ -34,7 +35,7 @@ public class CypherRegisterer { public static void registerOperators() { if ( isInit ) { - throw new RuntimeException( "Cypher operators were already registered." ); + throw new GenericRuntimeException( "Cypher operators were already registered." ); } register( OperatorName.CYPHER_LIKE, new LangFunctionOperator( OperatorName.CYPHER_LIKE.name(), Kind.LIKE ) ); diff --git a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/admin/CypherAlterDatabaseAlias.java b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/admin/CypherAlterDatabaseAlias.java index a23c118509..c5ffba9fb3 100644 --- a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/admin/CypherAlterDatabaseAlias.java +++ b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/admin/CypherAlterDatabaseAlias.java @@ -19,6 +19,7 @@ import java.util.List; import lombok.Getter; import org.polypheny.db.catalog.entity.logical.LogicalNamespace; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.catalog.logistic.Pattern; import org.polypheny.db.cypher.CypherParameter; import org.polypheny.db.cypher.CypherSimpleEither; @@ -56,7 +57,7 @@ public void execute( Context context, Statement statement, QueryParameters param if ( graphs.size() != 1 ) { if ( !ifExists ) { - throw new RuntimeException( "Graph database does not exist and IF EXISTS was not specified." ); + throw new GenericRuntimeException( "Graph database does not exist and IF EXISTS was not specified." ); } return; } diff --git a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/admin/CypherDropDatabase.java b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/admin/CypherDropDatabase.java index fa9b043fb6..e3a4a9acd7 100644 --- a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/admin/CypherDropDatabase.java +++ b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/admin/CypherDropDatabase.java @@ -19,6 +19,7 @@ import java.util.List; import java.util.concurrent.TimeUnit; import org.polypheny.db.catalog.entity.logical.LogicalNamespace; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.catalog.logistic.Pattern; import org.polypheny.db.cypher.CypherParameter; import org.polypheny.db.cypher.CypherSimpleEither; @@ -67,7 +68,7 @@ public void execute( Context context, Statement statement, QueryParameters param if ( databases.size() != 1 ) { if ( !ifExists ) { - throw new RuntimeException( "Graph database does not exist and IF EXISTS was not specified." ); + throw new GenericRuntimeException( "Graph database does not exist and IF EXISTS was not specified." ); } return; } diff --git a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/ddl/CypherAddPlacement.java b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/ddl/CypherAddPlacement.java index 67238a3d0e..fb01622f30 100644 --- a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/ddl/CypherAddPlacement.java +++ b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/ddl/CypherAddPlacement.java @@ -52,10 +52,10 @@ public CypherAddPlacement( this.store = getNameOrNull( storeName ); if ( this.database == null ) { - throw new RuntimeException( "Unknown database name." ); + throw new GenericRuntimeException( "Unknown database name." ); } if ( this.store == null ) { - throw new RuntimeException( "Unknown storeId name." ); + throw new GenericRuntimeException( "Unknown storeId name." ); } } diff --git a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/ddl/CypherDropPlacement.java b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/ddl/CypherDropPlacement.java index bcf5fc7242..c1964eea7e 100644 --- a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/ddl/CypherDropPlacement.java +++ b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/ddl/CypherDropPlacement.java @@ -22,6 +22,7 @@ import org.polypheny.db.adapter.AdapterManager; import org.polypheny.db.adapter.DataStore; import org.polypheny.db.catalog.entity.logical.LogicalNamespace; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.catalog.logistic.Pattern; import org.polypheny.db.cypher.CypherParameter; import org.polypheny.db.cypher.CypherSimpleEither; @@ -55,12 +56,12 @@ public void execute( Context context, Statement statement, QueryParameters param List graphs = statement.getTransaction().getSnapshot().getNamespaces( new Pattern( this.databaseName ) ); - DataStore dataStore = Stream.of( storeName ) - .map( store -> (DataStore) adapterManager.getAdapter( storeName ) ) + DataStore dataStore = Stream.of( storeName ) + .map( store -> (DataStore) adapterManager.getAdapter( storeName ) ) .collect( Collectors.toList() ).get( 0 ); if ( graphs.size() != 1 ) { - throw new RuntimeException( "Error while adding graph placement" ); + throw new GenericRuntimeException( "Error while adding graph placement" ); } DdlManager.getInstance().dropGraphPlacement( graphs.get( 0 ).id, dataStore, statement ); diff --git a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/query/CypherSingleQuery.java b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/query/CypherSingleQuery.java index 6910c2f1e7..602bc08781 100644 --- a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/query/CypherSingleQuery.java +++ b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/query/CypherSingleQuery.java @@ -18,6 +18,7 @@ import java.util.List; import lombok.Getter; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.cypher.CypherNode; import org.polypheny.db.cypher.clause.CypherClause; import org.polypheny.db.cypher.clause.CypherQuery; @@ -64,7 +65,7 @@ public boolean isDDL() { if ( clauses.stream().noneMatch( CypherNode::isDDL ) ) { return false; } - throw new RuntimeException( "The mixed query is not supported" ); + throw new GenericRuntimeException( "The mixed query is not supported" ); } diff --git a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/remove/CypherRemoveLabels.java b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/remove/CypherRemoveLabels.java index 6ff0466482..e4be4463fe 100644 --- a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/remove/CypherRemoveLabels.java +++ b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/remove/CypherRemoveLabels.java @@ -22,6 +22,7 @@ import org.polypheny.db.algebra.AlgNode; import org.polypheny.db.algebra.operators.OperatorName; import org.polypheny.db.algebra.type.AlgDataTypeField; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.cypher.cypher2alg.CypherToAlgConverter.CypherContext; import org.polypheny.db.cypher.expression.CypherVariable; import org.polypheny.db.cypher.parser.StringPos; @@ -50,12 +51,12 @@ public void removeItem( CypherContext context ) { AlgNode node = context.peek(); int index = node.getRowType().getFieldNames().indexOf( variable.getName() ); if ( index < 0 ) { - throw new RuntimeException( String.format( "Unknown variable with name %s", variable ) ); + throw new GenericRuntimeException( String.format( "Unknown variable with name %s", variable ) ); } AlgDataTypeField field = node.getRowType().getFieldList().get( index ); if ( field.getType().getPolyType() == PolyType.EDGE && labels.size() != 1 ) { - throw new RuntimeException( "Edges require exactly one label" ); + throw new GenericRuntimeException( "Edges require exactly one label" ); } RexNode ref = context.getRexNode( variable.getName() ); diff --git a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/set/CypherSetVariable.java b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/set/CypherSetVariable.java index 240dfd5084..2b51c81aaa 100644 --- a/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/set/CypherSetVariable.java +++ b/plugins/cypher-language/src/main/java/org/polypheny/db/cypher/set/CypherSetVariable.java @@ -23,6 +23,7 @@ import org.polypheny.db.algebra.AlgNode; import org.polypheny.db.algebra.operators.OperatorName; import org.polypheny.db.algebra.type.AlgDataTypeField; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.cypher.cypher2alg.CypherToAlgConverter.CypherContext; import org.polypheny.db.cypher.expression.CypherExpression; import org.polypheny.db.cypher.expression.CypherExpression.ExpressionType; @@ -63,7 +64,7 @@ public void convertItem( CypherContext context ) { AlgNode node = context.peek(); int index = node.getRowType().getFieldNames().indexOf( nodeName ); if ( index < 0 ) { - throw new RuntimeException( String.format( "Unknown variable with name %s", nodeName ) ); + throw new GenericRuntimeException( String.format( "Unknown variable with name %s", nodeName ) ); } AlgDataTypeField field = node.getRowType().getFieldList().get( index ); diff --git a/plugins/ethereum-adapter/src/main/java/org/polypheny/db/adapter/ethereum/BlockReader.java b/plugins/ethereum-adapter/src/main/java/org/polypheny/db/adapter/ethereum/BlockReader.java index 646b607d39..3ae0139f66 100644 --- a/plugins/ethereum-adapter/src/main/java/org/polypheny/db/adapter/ethereum/BlockReader.java +++ b/plugins/ethereum-adapter/src/main/java/org/polypheny/db/adapter/ethereum/BlockReader.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.math.BigInteger; import java.util.function.Predicate; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.web3j.protocol.Web3j; import org.web3j.protocol.core.DefaultBlockParameter; import org.web3j.protocol.core.methods.response.EthBlock; @@ -41,7 +42,7 @@ class BlockReader implements Closeable { try { this.currentBlock = web3j.ethBlockNumber().send().getBlockNumber(); } catch ( IOException e ) { - throw new RuntimeException( "Unable to connect to server: " + clientUrl ); + throw new GenericRuntimeException( "Unable to connect to server: " + clientUrl ); } } diff --git a/plugins/ethereum-adapter/src/main/java/org/polypheny/db/adapter/ethereum/EthereumEnumerator.java b/plugins/ethereum-adapter/src/main/java/org/polypheny/db/adapter/ethereum/EthereumEnumerator.java index d35c9af36f..75723b2da9 100644 --- a/plugins/ethereum-adapter/src/main/java/org/polypheny/db/adapter/ethereum/EthereumEnumerator.java +++ b/plugins/ethereum-adapter/src/main/java/org/polypheny/db/adapter/ethereum/EthereumEnumerator.java @@ -127,7 +127,7 @@ public boolean moveNext() { return true; } } catch ( IOException e ) { - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } } @@ -143,7 +143,7 @@ public void close() { try { reader.close(); } catch ( IOException e ) { - throw new RuntimeException( "Error closing Blockchain reader", e ); + throw new GenericRuntimeException( "Error closing Blockchain reader", e ); } } diff --git a/plugins/ethereum-adapter/src/main/java/org/polypheny/db/adapter/ethereum/EthereumPlugin.java b/plugins/ethereum-adapter/src/main/java/org/polypheny/db/adapter/ethereum/EthereumPlugin.java index c1142f532c..7793d96e78 100644 --- a/plugins/ethereum-adapter/src/main/java/org/polypheny/db/adapter/ethereum/EthereumPlugin.java +++ b/plugins/ethereum-adapter/src/main/java/org/polypheny/db/adapter/ethereum/EthereumPlugin.java @@ -121,7 +121,7 @@ private void setClientURL( String clientURL ) { try { BigInteger latest = web3j.ethBlockNumber().send().getBlockNumber(); } catch ( Exception e ) { - throw new RuntimeException( "Unable to connect the client URL '" + clientURL + "'" ); + throw new GenericRuntimeException( "Unable to connect the client URL '" + clientURL + "'" ); } web3j.shutdown(); this.clientURL = clientURL; diff --git a/plugins/explore-by-example/src/main/java/org/polypheny/db/exploreByExample/ExploreQueryProcessor.java b/plugins/explore-by-example/src/main/java/org/polypheny/db/exploreByExample/ExploreQueryProcessor.java index 5c1360393f..e552b9b8fa 100644 --- a/plugins/explore-by-example/src/main/java/org/polypheny/db/exploreByExample/ExploreQueryProcessor.java +++ b/plugins/explore-by-example/src/main/java/org/polypheny/db/exploreByExample/ExploreQueryProcessor.java @@ -27,6 +27,7 @@ import org.polypheny.db.algebra.type.AlgDataType; import org.polypheny.db.algebra.type.AlgDataTypeField; import org.polypheny.db.catalog.Catalog; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.config.RuntimeConfig; import org.polypheny.db.iface.Authenticator; import org.polypheny.db.languages.QueryLanguage; @@ -162,7 +163,7 @@ private PolyImplementation processQuery( Statement statement, String sql ) { if ( parsed.isA( Kind.DDL ) ) { // explore by example should not execute any ddls - throw new RuntimeException( "No DDL expected here" ); + throw new GenericRuntimeException( "No DDL expected here" ); } else { Pair validated = sqlProcessor.validate( statement.getTransaction(), parsed, false ); AlgRoot logicalRoot = sqlProcessor.translate( statement, validated.left, null ); diff --git a/plugins/file-adapter/src/main/java/org/polypheny/db/adapter/file/util/FileUtil.java b/plugins/file-adapter/src/main/java/org/polypheny/db/adapter/file/util/FileUtil.java index d0d34e77ee..2c685c820a 100644 --- a/plugins/file-adapter/src/main/java/org/polypheny/db/adapter/file/util/FileUtil.java +++ b/plugins/file-adapter/src/main/java/org/polypheny/db/adapter/file/util/FileUtil.java @@ -34,10 +34,10 @@ public static Object fromValue( PolyValue value ) { case INTEGER: case TINYINT: case SMALLINT: - value.asNumber().IntValue(); + return value.asNumber().IntValue(); case REAL: case FLOAT: - value.asNumber().FloatValue(); + return value.asNumber().FloatValue(); case VARCHAR: case CHAR: return value.asString().value; @@ -51,7 +51,12 @@ public static Object fromValue( PolyValue value ) { return value.asNumber().DoubleValue(); case BOOLEAN: return value.asBoolean().value; - + case DATE: + return value.asDate().getDaysSinceEpoch(); + case TIME: + return value.asTime().ofDay; + case TIMESTAMP: + return value.asTimeStamp().milliSinceEpoch; } throw new NotImplementedException(); } diff --git a/plugins/google-sheet-adapter/src/main/java/org/polypheny/db/adapter/googlesheet/GoogleSheetFieldType.java b/plugins/google-sheet-adapter/src/main/java/org/polypheny/db/adapter/googlesheet/GoogleSheetFieldType.java index 38b03a16d2..8881524480 100644 --- a/plugins/google-sheet-adapter/src/main/java/org/polypheny/db/adapter/googlesheet/GoogleSheetFieldType.java +++ b/plugins/google-sheet-adapter/src/main/java/org/polypheny/db/adapter/googlesheet/GoogleSheetFieldType.java @@ -21,6 +21,7 @@ import org.apache.calcite.linq4j.tree.Primitive; import org.polypheny.db.adapter.java.JavaTypeFactory; import org.polypheny.db.algebra.type.AlgDataType; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.type.PolyType; @@ -89,7 +90,7 @@ public static GoogleSheetFieldType getGoogleSheetFieldType( PolyType type ) { case TIMESTAMP: return GoogleSheetFieldType.TIMESTAMP; default: - throw new RuntimeException( "Unsupported datatype: " + type.name() ); + throw new GenericRuntimeException( "Unsupported datatype: " + type.name() ); } } diff --git a/plugins/google-sheet-adapter/src/main/java/org/polypheny/db/adapter/googlesheet/GoogleSheetReader.java b/plugins/google-sheet-adapter/src/main/java/org/polypheny/db/adapter/googlesheet/GoogleSheetReader.java index b0c582ec91..02caa98f56 100644 --- a/plugins/google-sheet-adapter/src/main/java/org/polypheny/db/adapter/googlesheet/GoogleSheetReader.java +++ b/plugins/google-sheet-adapter/src/main/java/org/polypheny/db/adapter/googlesheet/GoogleSheetReader.java @@ -31,6 +31,7 @@ import java.util.HashMap; import java.util.List; import java.util.Objects; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.util.Pair; @@ -111,7 +112,7 @@ private void readTableSurfaceData() { } } } catch ( IOException e ) { - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } } @@ -269,7 +270,7 @@ private void readTable( String tableName ) { } } } catch ( IOException | GeneralSecurityException e ) { - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } } diff --git a/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/JdbcSchema.java b/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/JdbcSchema.java index c967800fba..40eecc2ba2 100644 --- a/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/JdbcSchema.java +++ b/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/JdbcSchema.java @@ -58,6 +58,7 @@ import org.polypheny.db.catalog.catalogs.StoreCatalog; import org.polypheny.db.catalog.entity.CatalogEntity; import org.polypheny.db.catalog.entity.physical.PhysicalTable; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.catalog.snapshot.Snapshot; import org.polypheny.db.schema.Function; import org.polypheny.db.schema.Namespace; @@ -193,7 +194,7 @@ public ConnectionHandler getConnectionHandler( DataContext dataContext ) { dataContext.getStatement().getTransaction().registerInvolvedAdapter( adapter ); return connectionFactory.getOrCreateConnectionHandler( dataContext.getStatement().getTransaction().getXid() ); } catch ( ConnectionHandlerException e ) { - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } } diff --git a/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/JdbcToEnumerableConverter.java b/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/JdbcToEnumerableConverter.java index b02856652c..f08d92a362 100644 --- a/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/JdbcToEnumerableConverter.java +++ b/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/JdbcToEnumerableConverter.java @@ -67,6 +67,7 @@ import org.polypheny.db.algebra.enumerable.PhysTypeImpl; import org.polypheny.db.algebra.metadata.AlgMetadataQuery; import org.polypheny.db.algebra.type.AlgDataType; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.config.RuntimeConfig; import org.polypheny.db.functions.Functions; import org.polypheny.db.plan.AlgOptCluster; @@ -220,7 +221,7 @@ public Result implement( EnumerableAlgImplementor implementor, Prefer pref ) { Expressions.block( Expressions.tryCatch( builder.toBlock(), - Expressions.catch_( e_, Expressions.throw_( Expressions.new_( RuntimeException.class, e_ ) ) ) ) ) ) ) ), + Expressions.catch_( e_, Expressions.throw_( Expressions.new_( GenericRuntimeException.class, e_ ) ) ) ) ) ) ) ), resultSet_ ) ); final Expression enumerable; diff --git a/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/JdbcUtils.java b/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/JdbcUtils.java index 01c0c66296..1786814d07 100644 --- a/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/JdbcUtils.java +++ b/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/JdbcUtils.java @@ -130,7 +130,7 @@ synchronized SqlDialect get( SqlDialectFactory dialectFactory, DataSource dataSo connection = null; return dialect; } catch ( SQLException e ) { - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } finally { if ( connection != null ) { try { @@ -173,7 +173,7 @@ public static Function1> factory( final List

> getExportedColumns() { for ( String str : tables ) { String[] names = str.split( "\\." ); if ( names.length == 0 || names.length > 2 || (requiresSchema() && names.length == 1) ) { - throw new RuntimeException( "Invalid table name: " + str ); + throw new GenericRuntimeException( "Invalid table name: " + str ); } String tableName; String schemaPattern; @@ -263,7 +264,7 @@ public Map> getExportedColumns() { type = PolyType.TIME; length = row.getInt( "DECIMAL_DIGITS" ); if ( length > 3 ) { - throw new RuntimeException( "Unsupported precision for data type time: " + length ); + throw new GenericRuntimeException( "Unsupported precision for data type time: " + length ); } break; case TIMESTAMP: @@ -271,7 +272,7 @@ public Map> getExportedColumns() { type = PolyType.TIMESTAMP; length = row.getInt( "DECIMAL_DIGITS" ); if ( length > 3 ) { - throw new RuntimeException( "Unsupported precision for data type timestamp: " + length ); + throw new GenericRuntimeException( "Unsupported precision for data type timestamp: " + length ); } break; case CHAR: @@ -285,7 +286,7 @@ public Map> getExportedColumns() { length = row.getInt( "COLUMN_SIZE" ); break; default: - throw new RuntimeException( "Unsupported data type: " + type.getName() ); + throw new GenericRuntimeException( "Unsupported data type: " + type.getName() ); } list.add( new ExportedColumn( row.getString( "COLUMN_NAME" ).toLowerCase(), @@ -307,7 +308,7 @@ public Map> getExportedColumns() { } } } catch ( SQLException | ConnectionHandlerException e ) { - throw new RuntimeException( "Exception while collecting schema information!" + e ); + throw new GenericRuntimeException( "Exception while collecting schema information!" + e ); } return map; } diff --git a/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/stores/AbstractJdbcStore.java b/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/stores/AbstractJdbcStore.java index 3b446b36ae..48b0566968 100644 --- a/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/stores/AbstractJdbcStore.java +++ b/plugins/jdbc-adapter-framework/src/main/java/org/polypheny/db/adapter/jdbc/stores/AbstractJdbcStore.java @@ -266,7 +266,7 @@ protected StringBuilder buildInsertDefaultValueQuery( PhysicalTable table, Physi builder.append( " SET " ).append( dialect.quoteIdentifier( column.name ) ).append( " = " ); if ( column.collectionsType == PolyType.ARRAY ) { - throw new RuntimeException( "Default values are not supported for array types" ); + throw new GenericRuntimeException( "Default values are not supported for array types" ); } SqlLiteral literal; @@ -414,7 +414,7 @@ protected void executeUpdate( StringBuilder builder, Context context ) { context.getStatement().getTransaction().registerInvolvedAdapter( this ); connectionFactory.getOrCreateConnectionHandler( context.getStatement().getTransaction().getXid() ).executeUpdate( builder.toString() ); } catch ( SQLException | ConnectionHandlerException e ) { - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } } diff --git a/plugins/mapdb-monitoring/src/main/java/org/polypheny/db/monitoring/MapDbRepository.java b/plugins/mapdb-monitoring/src/main/java/org/polypheny/db/monitoring/MapDbRepository.java index 05033b5b19..0746f9097f 100644 --- a/plugins/mapdb-monitoring/src/main/java/org/polypheny/db/monitoring/MapDbRepository.java +++ b/plugins/mapdb-monitoring/src/main/java/org/polypheny/db/monitoring/MapDbRepository.java @@ -28,6 +28,7 @@ import java.util.stream.Collectors; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.monitoring.events.MonitoringDataPoint; import org.polypheny.db.monitoring.events.QueryPostCost; import org.polypheny.db.monitoring.events.metrics.QueryPostCostImpl; @@ -245,7 +246,7 @@ protected void initialize( String filePath, String folderName, boolean resetRepo }*/ // Exceeded threshold if ( (finish - start) >= timeThreshold ) { - throw new RuntimeException( "Initializing Monitoring Repository took too long...\nMake sure that no other " + throw new GenericRuntimeException( "Initializing Monitoring Repository took too long...\nMake sure that no other " + "instance of Polypheny-DB has still locked the monitoring information.\n" + "Wait a few seconds or stop the locking process and try again. " ); } diff --git a/plugins/monetdb-adapter/src/main/java/org/polypheny/db/adapter/monetdb/stores/MonetdbStore.java b/plugins/monetdb-adapter/src/main/java/org/polypheny/db/adapter/monetdb/stores/MonetdbStore.java index ef8cf015de..89904fd485 100644 --- a/plugins/monetdb-adapter/src/main/java/org/polypheny/db/adapter/monetdb/stores/MonetdbStore.java +++ b/plugins/monetdb-adapter/src/main/java/org/polypheny/db/adapter/monetdb/stores/MonetdbStore.java @@ -95,7 +95,7 @@ protected ConnectionFactory deployDocker( int dockerInstanceId ) { } DockerInstance instance = DockerManager.getInstance().getInstanceById( dockerInstanceId ) - .orElseThrow( () -> new RuntimeException( "No docker instance with id " + dockerInstanceId ) ); + .orElseThrow( () -> new GenericRuntimeException( "No docker instance with id " + dockerInstanceId ) ); try { this.container = instance.newBuilder( "polypheny/monet:latest", getUniqueName() ) .withEnvironmentVariable( "MONETDB_PASSWORD", settings.get( "password" ) ) @@ -107,7 +107,7 @@ protected ConnectionFactory deployDocker( int dockerInstanceId ) { if ( !container.waitTillStarted( this::testDockerConnection, 15000 ) ) { container.destroy(); - throw new RuntimeException( "Failed to connect to monetdb container" ); + throw new GenericRuntimeException( "Failed to connect to monetdb container" ); } deploymentId = container.getContainerId(); @@ -117,9 +117,9 @@ protected ConnectionFactory deployDocker( int dockerInstanceId ) { deploymentId = settings.get( "deploymentId" ); DockerManager.getInstance(); // Make sure docker instances are loaded. Very hacky, but it works. container = DockerContainer.getContainerByUUID( deploymentId ) - .orElseThrow( () -> new RuntimeException( "Could not find docker container with id " + deploymentId ) ); + .orElseThrow( () -> new GenericRuntimeException( "Could not find docker container with id " + deploymentId ) ); if ( !testDockerConnection() ) { - throw new RuntimeException( "Could not connect to container" ); + throw new GenericRuntimeException( "Could not connect to container" ); } } @@ -136,7 +136,7 @@ protected ConnectionFactory deployRemote() { database = settings.get( "database" ); username = settings.get( "username" ); if ( !testConnection() ) { - throw new RuntimeException( "Unable to connect" ); + throw new GenericRuntimeException( "Unable to connect" ); } ConnectionFactory connectionFactory = createConnectionFactory(); createDefaultSchema( connectionFactory ); @@ -152,7 +152,7 @@ private void createDefaultSchema( ConnectionFactory connectionFactory ) { handler.execute( "CREATE SCHEMA IF NOT EXISTS \"public\";" ); handler.commit(); } catch ( SQLException | ConnectionHandlerException e ) { - throw new RuntimeException( "Exception while creating default schema on monetdb store!", e ); + throw new GenericRuntimeException( "Exception while creating default schema on monetdb store!", e ); } } diff --git a/plugins/mongodb-adapter/src/main/java/org/polypheny/db/adapter/mongodb/MongoPlugin.java b/plugins/mongodb-adapter/src/main/java/org/polypheny/db/adapter/mongodb/MongoPlugin.java index b9ea213f45..b3300b4c58 100644 --- a/plugins/mongodb-adapter/src/main/java/org/polypheny/db/adapter/mongodb/MongoPlugin.java +++ b/plugins/mongodb-adapter/src/main/java/org/polypheny/db/adapter/mongodb/MongoPlugin.java @@ -153,7 +153,7 @@ public MongoStore( long adapterId, String uniqueName, Map settin if ( settings.getOrDefault( "deploymentId", "" ).isEmpty() ) { int instanceId = Integer.parseInt( settings.get( "instanceId" ) ); DockerInstance instance = DockerManager.getInstance().getInstanceById( instanceId ) - .orElseThrow( () -> new RuntimeException( "No docker instance with id " + instanceId ) ); + .orElseThrow( () -> new GenericRuntimeException( "No docker instance with id " + instanceId ) ); try { this.container = instance.newBuilder( "polypheny/mongo:latest", getUniqueName() ) .withCommand( Arrays.asList( "mongod", "--replSet", "poly" ) ) 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 4fa5c62e8f..46fcb00f22 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 @@ -29,6 +29,7 @@ import org.polypheny.db.algebra.operators.OperatorName; import org.polypheny.db.catalog.Catalog; import org.polypheny.db.catalog.entity.logical.LogicalNamespace; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.catalog.logistic.NamespaceType; import org.polypheny.db.information.InformationManager; import org.polypheny.db.languages.mql.Mql.Family; @@ -185,7 +186,7 @@ public static void startup() { public static void registerOperators() { if ( isInit ) { - throw new RuntimeException( "Mql operators were already registered." ); + throw new GenericRuntimeException( "Mql operators were already registered." ); } register( OperatorName.MQL_EQUALS, new LangFunctionOperator( "MQL_EQUALS", Kind.EQUALS ) ); 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 1638e0aa53..faba254935 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 @@ -363,7 +363,7 @@ private AlgNode translateUpdate( MqlUpdate query, AlgDataType rowType, AlgNode n for ( Entry entry : query.getUpdate().asDocument().entrySet() ) { String op = entry.getKey(); if ( !entry.getValue().isDocument() ) { - throw new RuntimeException( "After a update statement a document is needed" ); + throw new GenericRuntimeException( "After a update statement a document is needed" ); } Map temp = new HashMap<>(); switch ( op ) { @@ -414,7 +414,7 @@ private AlgNode translateUpdate( MqlUpdate query, AlgDataType rowType, AlgNode n case "$slice": case "$sort":*/ default: - throw new RuntimeException( "The update operation is not supported." ); + throw new GenericRuntimeException( "The update operation is not supported." ); } if ( query.isOnlyOne() ) { node = wrapLimit( node, 1 ); @@ -470,7 +470,7 @@ private void mergeUpdates( Map>> mer // direct update to a field directUpdates.put( nodeEntry.getKey(), nodeEntry.getValue() ); if ( updateOp == UpdateOperation.RENAME ) { - throw new RuntimeException( "You cannot rename a fixed field in an update, as this is a ddl" ); + throw new GenericRuntimeException( "You cannot rename a fixed field in an update, as this is a ddl" ); // TODO DL maybe find way to trigger ddl later } } else { @@ -485,7 +485,7 @@ private void mergeUpdates( Map>> mer } if ( childName == null ) { - throw new RuntimeException( "the specified field in the update was not found" ); + throw new GenericRuntimeException( "the specified field in the update was not found" ); } if ( childUpdates.containsKey( parent ) ) { @@ -499,7 +499,7 @@ private void mergeUpdates( Map>> mer } if ( !Collections.disjoint( directUpdates.entrySet(), childUpdates.keySet() ) && directUpdates.size() == 0 ) { - throw new RuntimeException( "DML of a field and its subfields at the same time is not possible" ); + throw new GenericRuntimeException( "DML of a field and its subfields at the same time is not possible" ); } combineUpdate( mergedUpdates, updateOp, childUpdates ); @@ -649,11 +649,11 @@ private AlgNode convertReducedPipeline( MqlUpdate query, AlgDataType rowType, Al UpdateOperation updateOp; for ( BsonValue value : query.getPipeline() ) { if ( !value.isDocument() || value.asDocument().size() != 1 ) { - throw new RuntimeException( "Each initial update steps document in the aggregate pipeline can only have one key." ); + throw new GenericRuntimeException( "Each initial update steps document in the aggregate pipeline can only have one key." ); } String key = value.asDocument().getFirstKey(); if ( !value.asDocument().get( key ).isDocument() ) { - throw new RuntimeException( "The update document needs one key and a document." ); + throw new GenericRuntimeException( "The update document needs one key and a document." ); } BsonDocument doc = value.asDocument().get( key ).asDocument(); switch ( key ) { @@ -668,7 +668,7 @@ private AlgNode convertReducedPipeline( MqlUpdate query, AlgDataType rowType, Al updateOp = UpdateOperation.REMOVE; break; default: - throw new RuntimeException( "The used statement is not supported in the update aggregation pipeline" ); + throw new GenericRuntimeException( "The used statement is not supported in the update aggregation pipeline" ); } mergeUpdates( mergedUpdates, rowType, updates, updateOp ); @@ -801,7 +801,7 @@ private AlgNode convertAggregate( MqlAggregate query, AlgDataType rowType, AlgNo for ( BsonValue value : query.getPipeline() ) { if ( !value.isDocument() && ((BsonDocument) value).size() > 1 ) { - throw new RuntimeException( "The aggregation pipeline is not used correctly." ); + throw new GenericRuntimeException( "The aggregation pipeline is not used correctly." ); } switch ( ((BsonDocument) value).getFirstKey() ) { case "$match": diff --git a/plugins/postgres-adapter/src/main/java/org/polypheny/db/adapter/postgres/store/PostgresqlStore.java b/plugins/postgres-adapter/src/main/java/org/polypheny/db/adapter/postgres/store/PostgresqlStore.java index 9c5fa7be3a..130ebdeae2 100644 --- a/plugins/postgres-adapter/src/main/java/org/polypheny/db/adapter/postgres/store/PostgresqlStore.java +++ b/plugins/postgres-adapter/src/main/java/org/polypheny/db/adapter/postgres/store/PostgresqlStore.java @@ -108,18 +108,18 @@ public ConnectionFactory deployDocker( int instanceId ) { } DockerInstance instance = DockerManager.getInstance().getInstanceById( instanceId ) - .orElseThrow( () -> new RuntimeException( "No docker instance with id " + instanceId ) ); + .orElseThrow( () -> new GenericRuntimeException( "No docker instance with id " + instanceId ) ); try { container = instance.newBuilder( "polypheny/postgres:latest", getUniqueName() ) .withEnvironmentVariable( "POSTGRES_PASSWORD", settings.get( "password" ) ) .createAndStart(); } catch ( IOException e ) { - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } if ( !container.waitTillStarted( this::testDockerConnection, 15000 ) ) { container.destroy(); - throw new RuntimeException( "Failed to connect to postgres container" ); + throw new GenericRuntimeException( "Failed to connect to postgres container" ); } deploymentId = container.getContainerId(); @@ -129,9 +129,9 @@ public ConnectionFactory deployDocker( int instanceId ) { deploymentId = settings.get( "deploymentId" ); DockerManager.getInstance(); // Make sure docker instances are loaded. Very hacky, but it works. container = DockerContainer.getContainerByUUID( deploymentId ) - .orElseThrow( () -> new RuntimeException( "Could not find docker container with id " + deploymentId ) ); + .orElseThrow( () -> new GenericRuntimeException( "Could not find docker container with id " + deploymentId ) ); if ( !testDockerConnection() ) { - throw new RuntimeException( "Could not connect to container" ); + throw new GenericRuntimeException( "Could not connect to container" ); } } @@ -383,7 +383,7 @@ protected String getTypeString( PolyType type ) { case ARRAY: return "ARRAY"; } - throw new RuntimeException( "Unknown type: " + type.name() ); + throw new GenericRuntimeException( "Unknown type: " + type.name() ); } diff --git a/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/ddl/SqlAlterConfig.java b/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/ddl/SqlAlterConfig.java index 6115f19f8a..f5720013ac 100644 --- a/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/ddl/SqlAlterConfig.java +++ b/plugins/sql-language/src/main/java/org/polypheny/db/sql/language/ddl/SqlAlterConfig.java @@ -21,6 +21,7 @@ import java.util.Objects; import org.apache.commons.lang3.StringUtils; import org.polypheny.db.algebra.constant.Kind; +import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.config.Config; import org.polypheny.db.config.ConfigManager; import org.polypheny.db.languages.ParserPos; @@ -97,7 +98,7 @@ public void execute( Context context, Statement statement, QueryParameters param } Config config = ConfigManager.getInstance().getConfig( keyStr ); if ( config == null ) { - throw new RuntimeException( "Unknown config key: " + keyStr ); + throw new GenericRuntimeException( "Unknown config key: " + keyStr ); } config.parseStringAndSetValue( valueStr ); } 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 7b8aaee6c8..8bcee45d40 100644 --- a/webui/src/main/java/org/polypheny/db/webui/Crud.java +++ b/webui/src/main/java/org/polypheny/db/webui/Crud.java @@ -640,7 +640,7 @@ void insertTuple( final Context ctx ) throws IOException { } } } catch ( ServletException e ) { - throw new RuntimeException( e ); + throw new GenericRuntimeException( e ); } String query = String.format( "INSERT INTO %s %s VALUES %s", entityName, columns, values ); @@ -1124,7 +1124,7 @@ void getDataSourceColumns( final Context ctx ) { } else { List allocs = Catalog.snapshot().alloc().getFromLogical( tablee.id ); if ( Catalog.snapshot().alloc().getFromLogical( tablee.id ).size() != 1 ) { - throw new RuntimeException( "The table has an unexpected number of placements!" ); + throw new GenericRuntimeException( "The table has an unexpected number of placements!" ); } long adapterId = allocs.get( 0 ).adapterId; @@ -1224,7 +1224,7 @@ void getMaterializedInfo( final Context ctx ) { ctx.json( new MaterializedInfos( materializedInfo ) ); } else { - throw new RuntimeException( "only possible with materialized views" ); + throw new GenericRuntimeException( "only possible with materialized views" ); } }