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
embedded processing directly in the service until there exists
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
* 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?"
......
/* https://www.kaggle.com/jsphyg/weather-dataset-rattle-package */
CREATE DATABASE weather;
USE weather;
CREATE
DATABASE weather;
USE
weather;
CREATE TABLE weather_location
(
......@@ -92,3 +94,9 @@ CREATE VIEW not_in_metadata_db2 AS
select `date`, `location`, `mintemp` as `MinTemp`, `rainfall` as `Rainfall`
from `weather_aus`
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;
import at.tuwien.mapper.DataMapper;
import at.tuwien.mapper.MariaDbMapper;
import at.tuwien.mapper.MetadataMapper;
import at.tuwien.service.SchemaService;
import at.tuwien.service.ViewService;
import com.google.common.hash.Hashing;
import com.mchange.v2.c3p0.ComboPooledDataSource;
......@@ -35,14 +36,16 @@ public class ViewServiceMariaDbImpl extends HibernateConnector implements ViewSe
private final DataMapper dataMapper;
private final QueryConfig queryConfig;
private final SchemaService schemaService;
private final MariaDbMapper mariaDbMapper;
private final MetadataMapper metadataMapper;
@Autowired
public ViewServiceMariaDbImpl(DataMapper dataMapper, QueryConfig queryConfig, MariaDbMapper mariaDbMapper,
MetadataMapper metadataMapper) {
public ViewServiceMariaDbImpl(DataMapper dataMapper, QueryConfig queryConfig, SchemaService schemaService,
MariaDbMapper mariaDbMapper, MetadataMapper metadataMapper) {
this.dataMapper = dataMapper;
this.queryConfig = queryConfig;
this.schemaService = schemaService;
this.mariaDbMapper = mariaDbMapper;
this.metadataMapper = metadataMapper;
}
......@@ -86,11 +89,19 @@ public class ViewServiceMariaDbImpl extends HibernateConnector implements ViewSe
log.trace("executed statement in {} ms", System.currentTimeMillis() - start);
while (resultSet1.next()) {
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))) {
log.trace("view {}.{} already known to metadata database, skip.", database.getInternalName(), viewName);
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) {
log.error("Failed to get view schemas: {}", e.getMessage());
......
......@@ -19,7 +19,7 @@ import lombok.extern.jackson.Jacksonized;
public class ViewCreateDto {
@NotBlank
@Size(min = 1, max = 64)
@Size(min = 1, max = 63)
@Schema(example = "Air Quality")
private String name;
......
......@@ -84,7 +84,6 @@ export const useQueryService = (): any => {
axios.post<QueryResultDto>(`/api/database/${databaseId}/subset`, data, {params: mapFilter(timestamp, page, size), timeout: 600_000})
.then((response) => {
console.info('Executed query with id', response.data.id, ' in database with id', databaseId)
console.debug('=======>', response)
const result: QueryResultDto = {
id: 1,
headers: [],
......
......@@ -5,7 +5,7 @@ spring.profiles.active=local,junit
spring.cloud.discovery.enabled=false
# 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.username=sa
spring.datasource.password=password
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment