Skip to content
Snippets Groups Projects
Verified Commit 76edb0c6 authored by Martin Weise's avatar Martin Weise
Browse files

Updated stuff

parent 5de8915b
No related branches found
No related tags found
2 merge requests!363Resolve "Hotfix query execution",!362Resolve "Hotfix query execution"
...@@ -35,9 +35,15 @@ the [Data Database](../data-db) with a wide range of open-source connectors. The ...@@ -35,9 +35,15 @@ the [Data Database](../data-db) with a wide range of open-source connectors. The
embedded processing directly in the service until there exists embedded processing directly in the service until there exists
a [Bitnami Chart](https://artifacthub.io/packages/helm/bitnami/spark) for Spark 4. a [Bitnami Chart](https://artifacthub.io/packages/helm/bitnami/spark) for Spark 4.
Retrieving data from a subset internally generates a view with the 64-character hash of the query. This view is not
automatically deleted currently.
## Limitations ## Limitations
* Currently only local processing (slow) embedded in the service using a two-thread `local[2]` configuration. * Views in DBRepo can only have 63-character length (it is assumed only internal views have the maximum length of 64
characters).
* Local mode of embedded processing of Apache Spark directly in the service using
a [`local[2]`](https://spark.apache.org/docs/latest/#running-the-examples-and-shell) configuration.
!!! question "Do you miss functionality? Do these limitations affect you?" !!! question "Do you miss functionality? Do these limitations affect you?"
......
/* https://www.kaggle.com/jsphyg/weather-dataset-rattle-package */ /* https://www.kaggle.com/jsphyg/weather-dataset-rattle-package */
CREATE DATABASE weather; CREATE
USE weather; DATABASE weather;
USE
weather;
CREATE TABLE weather_location CREATE TABLE weather_location
( (
...@@ -92,3 +94,9 @@ CREATE VIEW not_in_metadata_db2 AS ...@@ -92,3 +94,9 @@ CREATE VIEW not_in_metadata_db2 AS
select `date`, `location`, `mintemp` as `MinTemp`, `rainfall` as `Rainfall` select `date`, `location`, `mintemp` as `MinTemp`, `rainfall` as `Rainfall`
from `weather_aus` from `weather_aus`
where `location` = 'Vienna'); where `location` = 'Vienna');
CREATE VIEW 5c7ba02f681b889892ee82987aa6c74ce45a30973cfef06b78ce797f25189b9 AS
(
select `date`, `location`, `mintemp` as `MinTemp`, `rainfall` as `Rainfall`
from `weather_aus`
where `location` = 'Vienna');
\ No newline at end of file
...@@ -13,6 +13,7 @@ import at.tuwien.exception.ViewNotFoundException; ...@@ -13,6 +13,7 @@ import at.tuwien.exception.ViewNotFoundException;
import at.tuwien.mapper.DataMapper; import at.tuwien.mapper.DataMapper;
import at.tuwien.mapper.MariaDbMapper; import at.tuwien.mapper.MariaDbMapper;
import at.tuwien.mapper.MetadataMapper; import at.tuwien.mapper.MetadataMapper;
import at.tuwien.service.SchemaService;
import at.tuwien.service.ViewService; import at.tuwien.service.ViewService;
import com.google.common.hash.Hashing; import com.google.common.hash.Hashing;
import com.mchange.v2.c3p0.ComboPooledDataSource; import com.mchange.v2.c3p0.ComboPooledDataSource;
...@@ -35,14 +36,16 @@ public class ViewServiceMariaDbImpl extends HibernateConnector implements ViewSe ...@@ -35,14 +36,16 @@ public class ViewServiceMariaDbImpl extends HibernateConnector implements ViewSe
private final DataMapper dataMapper; private final DataMapper dataMapper;
private final QueryConfig queryConfig; private final QueryConfig queryConfig;
private final SchemaService schemaService;
private final MariaDbMapper mariaDbMapper; private final MariaDbMapper mariaDbMapper;
private final MetadataMapper metadataMapper; private final MetadataMapper metadataMapper;
@Autowired @Autowired
public ViewServiceMariaDbImpl(DataMapper dataMapper, QueryConfig queryConfig, MariaDbMapper mariaDbMapper, public ViewServiceMariaDbImpl(DataMapper dataMapper, QueryConfig queryConfig, SchemaService schemaService,
MetadataMapper metadataMapper) { MariaDbMapper mariaDbMapper, MetadataMapper metadataMapper) {
this.dataMapper = dataMapper; this.dataMapper = dataMapper;
this.queryConfig = queryConfig; this.queryConfig = queryConfig;
this.schemaService = schemaService;
this.mariaDbMapper = mariaDbMapper; this.mariaDbMapper = mariaDbMapper;
this.metadataMapper = metadataMapper; this.metadataMapper = metadataMapper;
} }
...@@ -86,11 +89,19 @@ public class ViewServiceMariaDbImpl extends HibernateConnector implements ViewSe ...@@ -86,11 +89,19 @@ public class ViewServiceMariaDbImpl extends HibernateConnector implements ViewSe
log.trace("executed statement in {} ms", System.currentTimeMillis() - start); log.trace("executed statement in {} ms", System.currentTimeMillis() - start);
while (resultSet1.next()) { while (resultSet1.next()) {
final String viewName = resultSet1.getString(1); final String viewName = resultSet1.getString(1);
if (viewName.length() == 64) {
log.trace("view {}.{} seems to be a subset view (name length = 64), skip.", database.getInternalName(), viewName);
continue;
}
if (database.getViews().stream().anyMatch(v -> v.getInternalName().equals(viewName))) { if (database.getViews().stream().anyMatch(v -> v.getInternalName().equals(viewName))) {
log.trace("view {}.{} already known to metadata database, skip.", database.getInternalName(), viewName); log.trace("view {}.{} already known to metadata database, skip.", database.getInternalName(), viewName);
continue; continue;
} }
final ViewDto view;
view = schemaService.inspectView(database, viewName);
if (database.getTables().stream().noneMatch(t -> t.getInternalName().equals(view.getInternalName()))) {
views.add(view);
}
} }
} catch (SQLException e) { } catch (SQLException e) {
log.error("Failed to get view schemas: {}", e.getMessage()); log.error("Failed to get view schemas: {}", e.getMessage());
......
...@@ -19,7 +19,7 @@ import lombok.extern.jackson.Jacksonized; ...@@ -19,7 +19,7 @@ import lombok.extern.jackson.Jacksonized;
public class ViewCreateDto { public class ViewCreateDto {
@NotBlank @NotBlank
@Size(min = 1, max = 64) @Size(min = 1, max = 63)
@Schema(example = "Air Quality") @Schema(example = "Air Quality")
private String name; private String name;
......
...@@ -84,7 +84,6 @@ export const useQueryService = (): any => { ...@@ -84,7 +84,6 @@ export const useQueryService = (): any => {
axios.post<QueryResultDto>(`/api/database/${databaseId}/subset`, data, {params: mapFilter(timestamp, page, size), timeout: 600_000}) axios.post<QueryResultDto>(`/api/database/${databaseId}/subset`, data, {params: mapFilter(timestamp, page, size), timeout: 600_000})
.then((response) => { .then((response) => {
console.info('Executed query with id', response.data.id, ' in database with id', databaseId) console.info('Executed query with id', response.data.id, ' in database with id', databaseId)
console.debug('=======>', response)
const result: QueryResultDto = { const result: QueryResultDto = {
id: 1, id: 1,
headers: [], headers: [],
......
...@@ -5,7 +5,7 @@ spring.profiles.active=local,junit ...@@ -5,7 +5,7 @@ spring.profiles.active=local,junit
spring.cloud.discovery.enabled=false spring.cloud.discovery.enabled=false
# internal datasource # internal datasource
spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE;INIT=CREATE SCHEMA IF NOT EXISTS DBREPO;NON_KEYWORDS=value spring.datasource.url=jdbc:h2:mem:dbrepo;DB_CLOSE_ON_EXIT=FALSE;INIT=CREATE SCHEMA IF NOT EXISTS dbrepo;NON_KEYWORDS=value
spring.datasource.driverClassName=org.h2.Driver spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa spring.datasource.username=sa
spring.datasource.password=password spring.datasource.password=password
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment