You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2021/09/24 14:11:55 UTC
[incubator-streampipes] branch dev updated (822e5c7 -> dc49f5d)
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a change to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git.
from 822e5c7 [STREAMPIPES-427] Fix some resource path issues
new a62b01a [STREAMPIPS-79] Add group by to data lake API
new dc49f5d Merge branch 'dev' of github.com:apache/incubator-streampipes into dev
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../dataexplorer/DataLakeManagementV3.java | 521 ++++++++++-----------
.../dataexplorer/DataLakeManagementV4.java | 17 +-
.../autoagg/FromNowAutoAggregationQuery.java | 10 +-
.../autoagg/GroupedAutoAggregationQuery.java | 10 +-
.../autoagg/TimeBoundAutoAggregationQuery.java | 10 +-
.../dataexplorer/query/DataExplorerQuery.java | 32 +-
.../query/GetAggregatedEventsFromNowQuery.java | 6 +-
.../query/GetAggregatedEventsQuery.java | 6 +-
.../dataexplorer/query/GetEventsFromNowQuery.java | 6 +-
.../dataexplorer/query/GetEventsQuery.java | 6 +-
.../query/GetGroupedAggregatedEventsQuery.java | 7 +-
.../dataexplorer/query/GetGroupedEventsQuery.java | 7 +-
.../dataexplorer/query/GetPagingEventsQuery.java | 7 +-
.../dataexplorer/v4/AutoAggregationHandler.java | 22 +-
.../dataexplorer/v4/query/DataExplorerQueryV4.java | 34 +-
.../datalake/{DataResult.java => DataSeries.java} | 23 +-
.../model/datalake/GroupedDataResult.java | 54 ---
.../streampipes/model/datalake/PageResult.java | 10 +-
.../{DataResult.java => SpQueryResult.java} | 42 +-
.../apache/streampipes/ps/DataLakeResourceV3.java | 404 ++++++++--------
.../apache/streampipes/ps/DataLakeResourceV4.java | 11 +-
ui/cypress/support/utils/UserUtils.ts | 2 +-
.../app-image-labeling.component.ts | 36 +-
.../datalake-configuration.component.ts | 8 +-
ui/src/app/core-model/datalake/DataResult.ts | 26 -
.../app/core-model/datalake/GroupedDataResult.ts | 24 -
ui/src/app/core-model/datalake/PageResult.ts | 24 -
ui/src/app/core-model/gen/streampipes-model.ts | 58 ++-
.../datalake/DatalakeQueryParameterBuilder.ts | 31 +-
.../datalake/datalake-rest.service.ts | 42 +-
ui/src/app/core-ui/image/image.component.ts | 7 +-
...ta-explorer-widget-data-settings.component.html | 5 +
.../group-selection-panel.component.html} | 8 +-
.../group-selection-panel.component.scss} | 0
.../group-selection-panel.component.ts} | 42 +-
.../widgets/base/base-data-explorer-widget.ts | 37 +-
.../components/widgets/base/base-widget-config.ts | 15 +-
.../density-chart-widget-config.component.ts | 5 +-
.../density/density-chart-widget.component.ts | 32 +-
.../density/model/density-chart-widget.model.ts | 6 +-
.../histogram-chart-widget-config.component.ts | 5 +-
.../histogram/histogram-chart-widget.component.ts | 22 +-
.../model/histogram-chart-widget.model.ts | 6 +-
.../widgets/image/image-widget.component.ts | 11 +-
.../widgets/image/model/image-widget.model.ts | 6 +-
.../indicator-chart-widget-config.component.ts | 5 +-
.../indicator/indicator-chart-widget.component.ts | 38 +-
.../model/indicator-chart-widget.model.ts | 6 +-
.../config/line-chart-widget-config.component.ts | 6 +-
.../line-chart/line-chart-widget.component.ts | 144 +++---
.../line-chart/model/line-chart-widget.model.ts | 11 +-
.../widgets/pie/model/pie-chart-widget.model.ts | 6 +-
.../widgets/pie/pie-chart-widget.component.ts | 27 +-
.../table/config/table-widget-config.component.ts | 4 +-
.../widgets/table/table-widget.component.ts | 31 +-
ui/src/app/data-explorer/data-explorer.module.ts | 3 +
.../models/dataview-dashboard.model.ts | 11 +-
.../services/data-view-query-generator.service.ts | 21 +-
.../apis/datalake-rest.service.ts | 66 ++-
59 files changed, 981 insertions(+), 1101 deletions(-)
copy streampipes-model/src/main/java/org/apache/streampipes/model/datalake/{DataResult.java => DataSeries.java} (74%)
delete mode 100644 streampipes-model/src/main/java/org/apache/streampipes/model/datalake/GroupedDataResult.java
rename streampipes-model/src/main/java/org/apache/streampipes/model/datalake/{DataResult.java => SpQueryResult.java} (53%)
delete mode 100644 ui/src/app/core-model/datalake/DataResult.ts
delete mode 100644 ui/src/app/core-model/datalake/GroupedDataResult.ts
delete mode 100644 ui/src/app/core-model/datalake/PageResult.ts
copy ui/src/app/data-explorer/components/designer-panel/data-settings/{field-selection-panel/field-selection-panel.component.html => group-selection-panel/group-selection-panel.component.html} (86%)
copy ui/src/app/{editor/components/pipeline/pipeline.component.css => data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.scss} (100%)
copy ui/src/app/data-explorer/components/designer-panel/data-settings/{field-selection-panel/field-selection-panel.component.ts => group-selection-panel/group-selection-panel.component.ts} (62%)
[incubator-streampipes] 02/02: Merge branch 'dev' of
github.com:apache/incubator-streampipes into dev
Posted by ze...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit dc49f5df1e2483943ef4652c3b479fc21b5b745f
Merge: a62b01a 822e5c7
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Fri Sep 24 16:11:43 2021 +0200
Merge branch 'dev' of github.com:apache/incubator-streampipes into dev
pom.xml | 1 +
.../backend/StreamPipesResourceConfig.java | 5 +-
.../master/management/SourcesManagement.java | 6 +-
.../master/management/SourcesManagementTest.java | 10 +-
.../streampipes/model/pipeline/Pipeline.java | 1 +
.../apache/streampipes/ps/DataLakeResourceV3.java | 3 +-
.../apache/streampipes/ps/DataLakeResourceV4.java | 2 +-
.../ps/PipelineElementTemplateResource.java | 2 +-
streampipes-rest-core-base/pom.xml | 55 ++++
.../impl/AbstractAuthGuardedRestResource.java | 7 +-
.../rest/core/base}/impl/AbstractRestResource.java | 2 +-
streampipes-rest/pom.xml | 5 +
.../apache/streampipes/rest}/ResetManagement.java | 2 +-
.../streampipes/rest/api/IPipelineElement.java | 14 +-
.../streampipes/rest/impl/AssetDashboard.java | 3 +-
.../streampipes/rest/impl/Authentication.java | 1 +
.../apache/streampipes/rest/impl/AutoComplete.java | 1 +
.../streampipes/rest/impl/CategoryResource.java | 3 +-
.../apache/streampipes/rest/impl/ConsulConfig.java | 1 +
.../rest/impl/ContainerProvidedOptions.java | 3 +-
.../org/apache/streampipes/rest/impl/Couchdb.java | 53 ---
.../apache/streampipes/rest/impl/DataStream.java | 3 +-
.../apache/streampipes/rest/impl/Deployment.java | 8 +-
.../impl/ExtensionsServiceEndpointResource.java | 8 +-
.../rest/impl/InternalPipelineTemplates.java | 14 +-
.../streampipes/rest/impl/LabelResource.java | 3 +-
.../rest/impl/MeasurementUnitResource.java | 3 +-
.../apache/streampipes/rest/impl/Notification.java | 9 +-
.../rest/impl/OntologyMeasurementUnit.java | 1 +
.../rest/impl/OntologyPipelineElement.java | 1 +
.../streampipes/rest/impl/PipelineCache.java | 18 +-
.../rest/impl/PipelineCanvasMetadataCache.java | 18 +-
.../rest/impl/PipelineCanvasMetadataResource.java | 3 +-
.../streampipes/rest/impl/PipelineCategory.java | 9 +-
.../rest/impl/PipelineElementAsset.java | 1 +
.../rest/impl/PipelineElementCategory.java | 1 +
.../streampipes/rest/impl/PipelineElementFile.java | 10 +-
.../rest/impl/PipelineElementImport.java | 24 +-
.../rest/impl/PipelineElementPreview.java | 3 +-
.../rest/impl/PipelineElementRuntimeInfo.java | 3 +-
.../streampipes/rest/impl/PipelineMonitoring.java | 3 +-
.../streampipes/rest/impl/PipelineResource.java | 58 +---
.../streampipes/rest/impl/PipelineTemplate.java | 10 +-
.../streampipes/rest/impl/ResetResource.java | 10 +-
.../rest/impl/SemanticEventConsumer.java | 33 +-
.../rest/impl/SemanticEventProcessingAgent.java | 32 +-
.../rest/impl/SemanticEventProducer.java | 32 +-
.../org/apache/streampipes/rest/impl/Setup.java | 1 +
.../org/apache/streampipes/rest/impl/User.java | 1 +
.../org/apache/streampipes/rest/impl/Version.java | 1 +
.../streampipes/rest/impl/VirtualSensor.java | 47 ---
.../impl/connect}/AbstractAdapterResource.java | 6 +-
.../rest/impl/connect}/AdapterResource.java | 22 +-
.../impl/connect}/AdapterTemplateResource.java | 20 +-
.../rest/impl/connect}/DescriptionResource.java | 10 +-
.../rest/impl/connect}/GuessResource.java | 4 +-
.../impl/connect}/RuntimeResolvableResource.java | 4 +-
.../rest/impl/connect}/SourcesResource.java | 11 +-
.../rest/impl/connect}/UnitResource.java | 4 +-
.../rest/impl/connect}/WelcomePageMaster.java | 2 +-
.../connect}/WorkerAdministrationResource.java | 4 +-
.../impl/dashboard/AbstractDashboardResource.java | 2 +-
.../AbstractPipelineExtractionResource.java | 2 +-
.../streampipes/rest/impl/dashboard/Dashboard.java | 2 +-
.../rest/impl/dashboard/DashboardWidget.java | 4 +-
.../dashboard/VisualizablePipelineResource.java | 2 +-
.../impl/datalake/DataLakeNoUserResourceV3.java | 2 +-
.../rest/impl/datalake/DataLakeWidgetResource.java | 2 +-
.../rest/impl/nouser/FileServingResource.java | 2 +-
.../impl/nouser/PipelineElementImportNoUser.java | 2 +-
.../rest/impl/nouser/PipelineNoUserResource.java | 2 +-
.../rest/management/PipelineManagement.java | 2 +-
ui/src/app/add/services/add.service.ts | 29 +-
.../app-asset-monitoring/services/rest.service.ts | 94 +++---
ui/src/app/connect/services/connect.service.ts | 2 +-
.../connect/services/data-marketplace.service.ts | 64 ++--
ui/src/app/connect/services/rest.service.ts | 193 ++++++-----
.../app/core-ui/labels/services/label.service.ts | 2 +-
.../runtime-resolvable.service.ts | 26 +-
ui/src/app/dashboard/services/dashboard.service.ts | 216 ++++++------
...-explorer-visualisation-settings.component.html | 23 +-
...ta-explorer-visualisation-settings.component.ts | 15 +-
.../time-selector/timeRangeSelector.component.ts | 36 +-
.../data-explorer-dashboard-widget.component.html | 177 +++++-----
.../data-explorer-dashboard-widget.component.scss | 1 +
.../data-explorer-dashboard-widget.component.ts | 62 +++-
.../components/widget/widget.directive.ts | 17 +-
.../widgets/base/base-data-explorer-widget.ts | 44 ++-
.../components/widgets/base/base-widget-config.ts | 33 +-
.../base/data-explorer-widget-data.ts} | 25 +-
.../density-chart-widget-config.component.ts | 23 +-
.../density/density-chart-widget.component.ts | 13 -
.../density/model/density-chart-widget.model.ts | 7 +-
.../histogram-chart-widget-config.component.ts | 21 +-
.../histogram/histogram-chart-widget.component.ts | 13 -
.../model/histogram-chart-widget.model.ts | 7 +-
.../image/config/image-widget-config.component.ts | 16 +-
.../widgets/image/image-widget.component.ts | 14 -
.../widgets/image/model/image-widget.model.ts | 13 +-
.../indicator-chart-widget-config.component.ts | 20 +-
.../indicator/indicator-chart-widget.component.ts | 13 -
.../model/indicator-chart-widget.model.ts | 7 +-
.../config/line-chart-widget-config.component.ts | 31 +-
.../line-chart/line-chart-widget.component.ts | 14 -
.../line-chart/model/line-chart-widget.model.ts | 12 +-
.../config/pie-chart-widget-config.component.ts | 22 +-
.../widgets/pie/model/pie-chart-widget.model.ts | 7 +-
.../widgets/pie/pie-chart-widget.component.ts | 13 -
.../table/config/table-widget-config.component.ts | 25 +-
.../widgets/table/table-widget.component.ts | 13 -
.../app/data-explorer/data-explorer.component.ts | 5 +-
ui/src/app/data-explorer/data-explorer.module.ts | 27 +-
.../models/dataview-dashboard.model.ts | 10 +-
.../registry/data-explorer-widget-registry.ts | 21 +-
.../registry/data-explorer-widgets.ts | 70 ++++
.../services/time-selection.service.ts | 23 +-
.../data-explorer/services/widget-type.service.ts | 16 +-
ui/src/app/editor/services/editor.service.ts | 76 +++--
.../file-overview/file-overview.component.ts | 35 +-
.../file-upload/file-upload-dialog.component.ts | 20 +-
ui/src/app/home/components/status.component.html | 4 +-
ui/src/app/home/components/status.component.ts | 40 ++-
ui/src/app/home/home.component.ts | 14 +-
.../app/notifications/notifications.component.ts | 94 +++---
.../notifications/service/notifications.service.ts | 42 ++-
.../pipeline-overview.component.ts | 26 +-
ui/src/app/pipelines/pipelines.component.html | 2 +-
ui/src/app/pipelines/pipelines.component.ts | 335 ++++++++++---------
.../app/platform-services/apis/commons.service.ts | 4 +
ui/src/app/platform-services/apis/files.service.ts | 28 +-
.../apis/measurement-units.service.ts | 18 +-
.../apis/pipeline-canvas-metadata.service.ts | 22 +-
.../apis/pipeline-element-endpoint.service.ts | 10 +-
.../apis/pipeline-element-template.service.ts | 29 +-
.../apis/pipeline-element.service.ts | 41 +--
.../apis/pipeline-monitoring.service.ts | 6 +-
.../app/platform-services/apis/pipeline.service.ts | 71 ++--
ui/src/app/platform-services/platform.module.ts | 24 +-
ui/src/app/services/rest-api.service.ts | 362 ++++++---------------
139 files changed, 1665 insertions(+), 1832 deletions(-)
diff --cc streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV3.java
index cec4966,0f8bfff..07bf7cc
--- a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV3.java
+++ b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV3.java
@@@ -18,16 -18,20 +18,17 @@@
package org.apache.streampipes.ps;
-import org.apache.streampipes.dataexplorer.DataLakeManagementV3;
import org.apache.streampipes.dataexplorer.utils.DataExplorerUtils;
import org.apache.streampipes.model.datalake.DataLakeMeasure;
- import org.apache.streampipes.rest.impl.AbstractRestResource;
-import org.apache.streampipes.model.datalake.DataResult;
-import org.apache.streampipes.model.datalake.GroupedDataResult;
-import org.apache.streampipes.model.datalake.PageResult;
+ import org.apache.streampipes.model.message.Notification;
+ import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
-import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
-import javax.ws.rs.*;
-import javax.ws.rs.core.*;
-import java.io.IOException;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
import java.util.List;
@Path("/v3/users/{username}/datalake")
diff --cc streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java
index 05b3d8d,e2efc0b..25874a1
--- a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java
+++ b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java
@@@ -29,9 -29,8 +29,9 @@@ import org.apache.streampipes.dataexplo
import org.apache.streampipes.dataexplorer.v4.ProvidedQueryParams;
import org.apache.streampipes.model.datalake.DataLakeConfiguration;
import org.apache.streampipes.model.datalake.DataLakeMeasure;
-import org.apache.streampipes.model.datalake.DataResult;
+ import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
+import org.apache.streampipes.model.datalake.DataSeries;
+import org.apache.streampipes.model.datalake.SpQueryResult;
- import org.apache.streampipes.rest.impl.AbstractRestResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --cc ui/src/app/data-explorer/components/widgets/base/base-data-explorer-widget.ts
index 25ddbc4,e112f31..ce1db4c
--- a/ui/src/app/data-explorer/components/widgets/base/base-data-explorer-widget.ts
+++ b/ui/src/app/data-explorer/components/widgets/base/base-data-explorer-widget.ts
@@@ -16,20 -16,35 +16,22 @@@
*
*/
- import { Directive, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges } from '@angular/core';
-import {
- Directive,
- EventEmitter,
- HostBinding,
- Input,
- OnDestroy,
- OnInit,
- Output
-} from '@angular/core';
++import { Directive, EventEmitter, HostBinding, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { GridsterItem, GridsterItemComponent } from 'angular-gridster2';
-import { DataExplorerWidgetModel } from '../../../../core-model/gen/streampipes-model';
+import { DataExplorerWidgetModel, SpQueryResult } from '../../../../core-model/gen/streampipes-model';
import { WidgetConfigurationService } from '../../../services/widget-configuration.service';
import { DashboardItem, TimeSettings } from '../../../../dashboard/models/dashboard.model';
import { ResizeService } from '../../../services/resize.service';
import { DatalakeRestService } from '../../../../platform-services/apis/datalake-rest.service';
import { DataViewQueryGeneratorService } from '../../../services/data-view-query-generator.service';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
-import {
- DataExplorerDataConfig,
- DataExplorerField,
- FieldProvider
-} from '../../../models/dataview-dashboard.model';
+import { DataExplorerDataConfig, DataExplorerField, FieldProvider } from '../../../models/dataview-dashboard.model';
- import { zip } from 'rxjs';
+ import { Subscription, zip } from 'rxjs';
import { DataExplorerFieldProviderService } from '../../../services/data-explorer-field-provider-service';
+ import { BaseWidgetData } from './data-explorer-widget-data';
+ import { TimeSelectionService } from '../../../services/time-selection.service';
@Directive()
- export abstract class BaseDataExplorerWidget<T extends DataExplorerWidgetModel> implements OnInit, OnChanges, OnDestroy {
+ export abstract class BaseDataExplorerWidget<T extends DataExplorerWidgetModel> implements BaseWidgetData<T>, OnInit, OnDestroy {
@Output()
removeWidgetCallback: EventEmitter<boolean> = new EventEmitter();
diff --cc ui/src/app/data-explorer/components/widgets/base/base-widget-config.ts
index 1a551cc,f7bbc3b..cabef16
--- a/ui/src/app/data-explorer/components/widgets/base/base-widget-config.ts
+++ b/ui/src/app/data-explorer/components/widgets/base/base-widget-config.ts
@@@ -24,12 -24,14 +24,9 @@@ import
EventSchema
} from '../../../../core-model/gen/streampipes-model';
import { WidgetConfigurationService } from '../../../services/widget-configuration.service';
--import {
-- DataExplorerField,
- DataExplorerVisConfig,
-- FieldProvider,
-- SourceConfig
--} from '../../../models/dataview-dashboard.model';
++import { DataExplorerField, DataExplorerVisConfig, FieldProvider, SourceConfig } from '../../../models/dataview-dashboard.model';
import { DataExplorerFieldProviderService } from '../../../services/data-explorer-field-provider-service';
+ import { WidgetType } from '../../../registry/data-explorer-widgets';
@Directive()
// tslint:disable-next-line:directive-class-suffix
@@@ -49,7 -53,14 +48,14 @@@ export abstract class BaseWidgetConfig<
ngOnChanges(changes: SimpleChanges) {
this.makeFields();
if (changes.currentlyConfiguredWidget) {
- this.updateWidgetConfigOptions();
+ this.checkAndInitialize();
+ }
+ }
+
+ checkAndInitialize() {
+ if (!this.currentlyConfiguredWidget.visualizationConfig ||
- !(this.currentlyConfiguredWidget.visualizationConfig.forType === this.getWidgetType())) {
++ !(this.currentlyConfiguredWidget.visualizationConfig.forType === this.getWidgetType())) {
+ this.currentlyConfiguredWidget.visualizationConfig = this.initWidgetConfig();
}
}
@@@ -109,7 -119,7 +114,7 @@@
eventSchema.eventProperties.forEach(p => {
if (!(p.domainProperties.some(dp => dp === 'http://schema.org/DateTime')) &&
-- !this.fieldService.isNumber(p)) {
++ !this.fieldService.isNumber(p)) {
result.push(p);
}
});
@@@ -132,7 -142,7 +137,7 @@@
eventSchema.eventProperties.forEach(p => {
if (!(p.domainProperties.some(dp => dp === 'http://schema.org/DateTime')) &&
-- this.fieldService.isNumber(p)) {
++ this.fieldService.isNumber(p)) {
propertyKeys.push(p);
}
});
@@@ -142,7 -152,7 +147,7 @@@
getTimestampProperty(eventSchema: EventSchema) {
return eventSchema.eventProperties.find(p =>
-- this.fieldService.isTimestamp(p)
++ this.fieldService.isTimestamp(p)
);
}
diff --cc ui/src/app/data-explorer/components/widgets/density/config/density-chart-widget-config.component.ts
index 29075d0,2db017a..8d0be7e
--- a/ui/src/app/data-explorer/components/widgets/density/config/density-chart-widget-config.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/density/config/density-chart-widget-config.component.ts
@@@ -18,8 -18,12 +18,9 @@@
import { Component, OnInit } from '@angular/core';
import { BaseWidgetConfig } from '../../base/base-widget-config';
- import { DensityChartWidgetModel } from '../model/density-chart-widget.model';
-import {
- DensityChartVisConfig,
- DensityChartWidgetModel
-} from '../model/density-chart-widget.model';
++import { DensityChartVisConfig, DensityChartWidgetModel } from '../model/density-chart-widget.model';
import { DataExplorerField } from '../../../../models/dataview-dashboard.model';
+ import { WidgetType } from '../../../../registry/data-explorer-widgets';
@Component({
selector: 'sp-data-explorer-density-chart-widget-config',
diff --cc ui/src/app/data-explorer/components/widgets/density/density-chart-widget.component.ts
index 59c561b,f522719..7fd2fd1
--- a/ui/src/app/data-explorer/components/widgets/density/density-chart-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/density/density-chart-widget.component.ts
@@@ -18,14 -18,9 +18,9 @@@
import { Component, OnInit } from '@angular/core';
import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
- import { DatalakeRestService } from '../../../../platform-services/apis/datalake-rest.service';
- import { WidgetConfigurationService } from '../../../services/widget-configuration.service';
- import { ResizeService } from '../../../services/resize.service';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
import { DensityChartWidgetModel } from './model/density-chart-widget.model';
- import { DataViewQueryGeneratorService } from '../../../services/data-view-query-generator.service';
- import { DataExplorerFieldProviderService } from '../../../services/data-explorer-field-provider-service';
import { DataExplorerField } from '../../../models/dataview-dashboard.model';
+import { SpQueryResult } from '../../../../core-model/gen/streampipes-model';
@Component({
selector: 'sp-data-explorer-density-chart-widget',
diff --cc ui/src/app/data-explorer/components/widgets/density/model/density-chart-widget.model.ts
index 036abc9,ff0e0c4..78b952f
--- a/ui/src/app/data-explorer/components/widgets/density/model/density-chart-widget.model.ts
+++ b/ui/src/app/data-explorer/components/widgets/density/model/density-chart-widget.model.ts
@@@ -17,12 -17,13 +17,9 @@@
*/
import { DataExplorerWidgetModel } from '../../../../../core-model/gen/streampipes-model';
--import {
-- DataExplorerDataConfig,
- DataExplorerField
- DataExplorerField,
- DataExplorerVisConfig
--} from '../../../../models/dataview-dashboard.model';
++import { DataExplorerDataConfig, DataExplorerField, DataExplorerVisConfig } from '../../../../models/dataview-dashboard.model';
- export interface DensityChartVisConfig {
+ export interface DensityChartVisConfig extends DataExplorerVisConfig {
firstField: DataExplorerField;
secondField: DataExplorerField;
}
diff --cc ui/src/app/data-explorer/components/widgets/histogram/config/histogram-chart-widget-config.component.ts
index 2eaaf21,fa91149..f6d06d8
--- a/ui/src/app/data-explorer/components/widgets/histogram/config/histogram-chart-widget-config.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/histogram/config/histogram-chart-widget-config.component.ts
@@@ -18,8 -18,12 +18,9 @@@
import { Component, OnInit } from '@angular/core';
import { BaseWidgetConfig } from '../../base/base-widget-config';
- import { HistogramChartWidgetModel } from '../model/histogram-chart-widget.model';
-import {
- HistogramChartVisConfig,
- HistogramChartWidgetModel
-} from '../model/histogram-chart-widget.model';
++import { HistogramChartVisConfig, HistogramChartWidgetModel } from '../model/histogram-chart-widget.model';
import { DataExplorerField } from '../../../../models/dataview-dashboard.model';
+ import { WidgetType } from '../../../../registry/data-explorer-widgets';
@Component({
selector: 'sp-data-explorer-histogram-chart-widget-config',
diff --cc ui/src/app/data-explorer/components/widgets/histogram/histogram-chart-widget.component.ts
index 194a7a8,c5f7ad3..472aef6
--- a/ui/src/app/data-explorer/components/widgets/histogram/histogram-chart-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/histogram/histogram-chart-widget.component.ts
@@@ -18,14 -18,9 +18,9 @@@
import { Component, OnInit } from '@angular/core';
import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
- import { DatalakeRestService } from '../../../../platform-services/apis/datalake-rest.service';
- import { WidgetConfigurationService } from '../../../services/widget-configuration.service';
- import { ResizeService } from '../../../services/resize.service';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
import { HistogramChartWidgetModel } from './model/histogram-chart-widget.model';
- import { DataViewQueryGeneratorService } from '../../../services/data-view-query-generator.service';
- import { DataExplorerFieldProviderService } from '../../../services/data-explorer-field-provider-service';
import { DataExplorerField } from '../../../models/dataview-dashboard.model';
+import { SpQueryResult } from '../../../../core-model/gen/streampipes-model';
@Component({
selector: 'sp-data-explorer-histogram-chart-widget',
diff --cc ui/src/app/data-explorer/components/widgets/histogram/model/histogram-chart-widget.model.ts
index 08a376a,8a548a8..4971fbe
--- a/ui/src/app/data-explorer/components/widgets/histogram/model/histogram-chart-widget.model.ts
+++ b/ui/src/app/data-explorer/components/widgets/histogram/model/histogram-chart-widget.model.ts
@@@ -17,12 -17,13 +17,9 @@@
*/
import { DataExplorerWidgetModel } from '../../../../../core-model/gen/streampipes-model';
--import {
-- DataExplorerDataConfig,
- DataExplorerField
- DataExplorerField,
- DataExplorerVisConfig
--} from '../../../../models/dataview-dashboard.model';
++import { DataExplorerDataConfig, DataExplorerField, DataExplorerVisConfig } from '../../../../models/dataview-dashboard.model';
- export interface HistogramChartVisConfig {
+ export interface HistogramChartVisConfig extends DataExplorerVisConfig {
selectedProperty: DataExplorerField;
}
diff --cc ui/src/app/data-explorer/components/widgets/image/image-widget.component.ts
index 2db3d40,7eab876..93e134b
--- a/ui/src/app/data-explorer/components/widgets/image/image-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/image/image-widget.component.ts
@@@ -18,16 -18,12 +18,11 @@@
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { MatSort } from '@angular/material/sort';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
-import { EventPropertyUnion, EventSchema } from '../../../../core-model/gen/streampipes-model';
+import { EventPropertyUnion, EventSchema, SpQueryResult } from '../../../../core-model/gen/streampipes-model';
import { ImageWidgetModel } from './model/image-widget.model';
- import { WidgetConfigurationService } from '../../../services/widget-configuration.service';
- import { ResizeService } from '../../../services/resize.service';
- import { DatalakeRestService } from '../../../../platform-services/apis/datalake-rest.service';
import { DatalakeQueryParameters } from '../../../../core-services/datalake/DatalakeQueryParameters';
import { DatalakeQueryParameterBuilder } from '../../../../core-services/datalake/DatalakeQueryParameterBuilder';
- import { DataViewQueryGeneratorService } from '../../../services/data-view-query-generator.service';
- import { DataExplorerFieldProviderService } from '../../../services/data-explorer-field-provider-service';
import { DataExplorerField } from '../../../models/dataview-dashboard.model';
@Component({
diff --cc ui/src/app/data-explorer/components/widgets/image/model/image-widget.model.ts
index d4d18a5,e977356..837d330
--- a/ui/src/app/data-explorer/components/widgets/image/model/image-widget.model.ts
+++ b/ui/src/app/data-explorer/components/widgets/image/model/image-widget.model.ts
@@@ -16,16 -16,15 +16,11 @@@
*
*/
- import {
- DataExplorerWidgetModel,
- EventPropertyUnion
- } from '../../../../../core-model/gen/streampipes-model';
- import { DataExplorerDataConfig } from '../../../../models/dataview-dashboard.model';
+ import { DataExplorerWidgetModel } from '../../../../../core-model/gen/streampipes-model';
-import {
- DataExplorerDataConfig,
- DataExplorerField,
- DataExplorerVisConfig
-} from '../../../../models/dataview-dashboard.model';
++import { DataExplorerDataConfig, DataExplorerField, DataExplorerVisConfig } from '../../../../models/dataview-dashboard.model';
- export interface ImageWidgetVisConfig {
- selectedColumns: EventPropertyUnion[];
- searchValue: string;
- columnNames: string[];
+ export interface ImageWidgetVisConfig extends DataExplorerVisConfig {
+ selectedField: DataExplorerField;
}
export interface ImageWidgetModel extends DataExplorerWidgetModel {
diff --cc ui/src/app/data-explorer/components/widgets/indicator/config/indicator-chart-widget-config.component.ts
index f3604cb,8cc6f32..822b816
--- a/ui/src/app/data-explorer/components/widgets/indicator/config/indicator-chart-widget-config.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/indicator/config/indicator-chart-widget-config.component.ts
@@@ -18,8 -18,12 +18,9 @@@
import { Component, OnInit } from '@angular/core';
import { BaseWidgetConfig } from '../../base/base-widget-config';
- import { IndicatorChartWidgetModel } from '../model/indicator-chart-widget.model';
-import {
- IndicatorChartVisConfig,
- IndicatorChartWidgetModel
-} from '../model/indicator-chart-widget.model';
++import { IndicatorChartVisConfig, IndicatorChartWidgetModel } from '../model/indicator-chart-widget.model';
import { DataExplorerField } from '../../../../models/dataview-dashboard.model';
+ import { WidgetType } from '../../../../registry/data-explorer-widgets';
@Component({
selector: 'sp-data-explorer-indicator-chart-widget-config',
diff --cc ui/src/app/data-explorer/components/widgets/indicator/indicator-chart-widget.component.ts
index c93cb1a,20f061c..90d4302
--- a/ui/src/app/data-explorer/components/widgets/indicator/indicator-chart-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/indicator/indicator-chart-widget.component.ts
@@@ -18,14 -18,9 +18,9 @@@
import { Component, OnInit } from '@angular/core';
import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
- import { DatalakeRestService } from '../../../../platform-services/apis/datalake-rest.service';
- import { WidgetConfigurationService } from '../../../services/widget-configuration.service';
- import { ResizeService } from '../../../services/resize.service';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
import { IndicatorChartWidgetModel } from './model/indicator-chart-widget.model';
- import { DataViewQueryGeneratorService } from '../../../services/data-view-query-generator.service';
- import { DataExplorerFieldProviderService } from '../../../services/data-explorer-field-provider-service';
import { DataExplorerField } from '../../../models/dataview-dashboard.model';
+import { SpQueryResult } from '../../../../core-model/gen/streampipes-model';
@Component({
selector: 'sp-data-explorer-indicator-chart-widget',
diff --cc ui/src/app/data-explorer/components/widgets/indicator/model/indicator-chart-widget.model.ts
index b5d10e0,80ae9a2..9050963
--- a/ui/src/app/data-explorer/components/widgets/indicator/model/indicator-chart-widget.model.ts
+++ b/ui/src/app/data-explorer/components/widgets/indicator/model/indicator-chart-widget.model.ts
@@@ -17,12 -17,13 +17,9 @@@
*/
import { DataExplorerWidgetModel } from '../../../../../core-model/gen/streampipes-model';
--import {
-- DataExplorerDataConfig,
- DataExplorerField
- DataExplorerField,
- DataExplorerVisConfig
--} from '../../../../models/dataview-dashboard.model';
++import { DataExplorerDataConfig, DataExplorerField, DataExplorerVisConfig } from '../../../../models/dataview-dashboard.model';
- export interface IndicatorChartVisConfig {
+ export interface IndicatorChartVisConfig extends DataExplorerVisConfig {
valueField?: DataExplorerField;
deltaField?: DataExplorerField;
showDelta?: boolean;
diff --cc ui/src/app/data-explorer/components/widgets/line-chart/config/line-chart-widget-config.component.ts
index 595aacc,2de1793..f8e3b96
--- a/ui/src/app/data-explorer/components/widgets/line-chart/config/line-chart-widget-config.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/line-chart/config/line-chart-widget-config.component.ts
@@@ -37,7 -38,7 +38,7 @@@ export class LineChartWidgetConfigCompo
}
ngOnInit(): void {
- this.updateWidgetConfigOptions();
- super.onInit();
++ super.onInit();
}
setSelectedProperties(selectedColumns: DataExplorerField[]) {
@@@ -67,15 -68,19 +68,19 @@@
// this.triggerViewRefresh();
}
- protected updateWidgetConfigOptions() {
- if (!this.currentlyConfiguredWidget.visualizationConfig) {
- this.currentlyConfiguredWidget.visualizationConfig = {
- yKeys: [],
- chartMode: 'lines',
- selectedLineChartProperties: this.fieldProvider.numericFields.length > 6 ?
- this.fieldProvider.numericFields.slice(0, 5) :
- this.fieldProvider.numericFields
- };
- }
+ protected getWidgetType(): WidgetType {
+ return WidgetType.LineChart;
+ }
+
+ protected initWidgetConfig(): LineCartVisConfig {
+ return {
+ forType: this.getWidgetType(),
+ yKeys: [],
+ chartMode: 'lines',
+ selectedLineChartProperties: this.fieldProvider.numericFields.length > 6 ?
- this.fieldProvider.numericFields.slice(0, 5) :
- this.fieldProvider.numericFields
++ this.fieldProvider.numericFields.slice(0, 5) :
++ this.fieldProvider.numericFields
+ };
}
+
}
diff --cc ui/src/app/data-explorer/components/widgets/line-chart/line-chart-widget.component.ts
index 46587f7,406ba45..c442942
--- a/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-widget.component.ts
@@@ -17,15 -17,11 +17,10 @@@
*/
import { Component, OnInit } from '@angular/core';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
-import { GroupedDataResult } from '../../../../core-model/datalake/GroupedDataResult';
import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
- import { ResizeService } from '../../../services/resize.service';
import { LineChartWidgetModel } from './model/line-chart-widget.model';
- import { WidgetConfigurationService } from '../../../services/widget-configuration.service';
- import { DatalakeRestService } from '../../../../platform-services/apis/datalake-rest.service';
- import { DataViewQueryGeneratorService } from '../../../services/data-view-query-generator.service';
- import { DataExplorerFieldProviderService } from '../../../services/data-explorer-field-provider-service';
import { DataExplorerField } from '../../../models/dataview-dashboard.model';
+import { SpQueryResult } from '../../../../core-model/gen/streampipes-model';
@Component({
selector: 'sp-data-explorer-line-chart-widget',
diff --cc ui/src/app/data-explorer/components/widgets/line-chart/model/line-chart-widget.model.ts
index 170ec31,7f097d7..1eb910e
--- a/ui/src/app/data-explorer/components/widgets/line-chart/model/line-chart-widget.model.ts
+++ b/ui/src/app/data-explorer/components/widgets/line-chart/model/line-chart-widget.model.ts
@@@ -16,16 -16,17 +16,10 @@@
*
*/
--import {
-- DataExplorerWidgetModel,
-- EventPropertyUnion
--} from '../../../../../core-model/gen/streampipes-model';
--import {
-- DataExplorerDataConfig,
- DataExplorerField
- DataExplorerField,
- DataExplorerVisConfig
--} from '../../../../models/dataview-dashboard.model';
++import { DataExplorerWidgetModel, EventPropertyUnion } from '../../../../../core-model/gen/streampipes-model';
++import { DataExplorerDataConfig, DataExplorerField, DataExplorerVisConfig } from '../../../../models/dataview-dashboard.model';
- export interface LineCartVisConfig {
+ export interface LineCartVisConfig extends DataExplorerVisConfig {
selectedLineChartProperties: DataExplorerField[];
selectedBackgroundColorProperty?: EventPropertyUnion;
groupValue?: string;
diff --cc ui/src/app/data-explorer/components/widgets/pie/model/pie-chart-widget.model.ts
index f634cac,328c7ff..10ea0df
--- a/ui/src/app/data-explorer/components/widgets/pie/model/pie-chart-widget.model.ts
+++ b/ui/src/app/data-explorer/components/widgets/pie/model/pie-chart-widget.model.ts
@@@ -17,13 -17,14 +17,10 @@@
*/
import { DataExplorerWidgetModel } from '../../../../../core-model/gen/streampipes-model';
--import {
-- DataExplorerDataConfig,
- DataExplorerField
- DataExplorerField,
- DataExplorerVisConfig
--} from '../../../../models/dataview-dashboard.model';
++import { DataExplorerDataConfig, DataExplorerField, DataExplorerVisConfig } from '../../../../models/dataview-dashboard.model';
- export interface PieChartVisConfig {
+ export interface PieChartVisConfig extends DataExplorerVisConfig {
selectedProperty: DataExplorerField;
}
diff --cc ui/src/app/data-explorer/components/widgets/pie/pie-chart-widget.component.ts
index 025b800,421a514..139e365
--- a/ui/src/app/data-explorer/components/widgets/pie/pie-chart-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/pie/pie-chart-widget.component.ts
@@@ -18,14 -18,9 +18,9 @@@
import { Component, OnInit } from '@angular/core';
import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
- import { DatalakeRestService } from '../../../../platform-services/apis/datalake-rest.service';
- import { WidgetConfigurationService } from '../../../services/widget-configuration.service';
- import { ResizeService } from '../../../services/resize.service';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
import { PieChartWidgetModel } from './model/pie-chart-widget.model';
- import { DataViewQueryGeneratorService } from '../../../services/data-view-query-generator.service';
- import { DataExplorerFieldProviderService } from '../../../services/data-explorer-field-provider-service';
import { DataExplorerField } from '../../../models/dataview-dashboard.model';
+import { SpQueryResult } from '../../../../core-model/gen/streampipes-model';
@Component({
selector: 'sp-data-explorer-pie-chart-widget',
diff --cc ui/src/app/data-explorer/components/widgets/table/config/table-widget-config.component.ts
index 9db0fd5,6aade3a..854f4f5
--- a/ui/src/app/data-explorer/components/widgets/table/config/table-widget-config.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/table/config/table-widget-config.component.ts
@@@ -62,5 -54,16 +54,16 @@@ export class TableWidgetConfigComponen
protected updateWidgetConfigOptions() {
}
+ protected getWidgetType(): WidgetType {
+ return WidgetType.Table;
+ }
+ protected initWidgetConfig(): TableVisConfig {
+ return {
+ forType: this.getWidgetType(),
- selectedColumns : this.fieldProvider.allFields.length > 6 ?
- this.fieldProvider.allFields.slice(0, 5) : this.fieldProvider.allFields,
++ selectedColumns: this.fieldProvider.allFields.length > 6 ?
++ this.fieldProvider.allFields.slice(0, 5) : this.fieldProvider.allFields,
+ searchValue: ''
+ };
+ }
}
diff --cc ui/src/app/data-explorer/components/widgets/table/table-widget.component.ts
index 2578ad1,14aff9e..1bc1e98
--- a/ui/src/app/data-explorer/components/widgets/table/table-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/table/table-widget.component.ts
@@@ -19,15 -19,10 +19,10 @@@
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
import { TableWidgetModel } from './model/table-widget.model';
- import { DatalakeRestService } from '../../../../platform-services/apis/datalake-rest.service';
- import { WidgetConfigurationService } from '../../../services/widget-configuration.service';
- import { ResizeService } from '../../../services/resize.service';
- import { DataViewQueryGeneratorService } from '../../../services/data-view-query-generator.service';
- import { DataExplorerFieldProviderService } from '../../../services/data-explorer-field-provider-service';
import { DataExplorerField } from '../../../models/dataview-dashboard.model';
+import { SpQueryResult } from '../../../../core-model/gen/streampipes-model';
@Component({
selector: 'sp-data-explorer-table-widget',
diff --cc ui/src/app/data-explorer/data-explorer.module.ts
index 164db03,8da2ac9..ec3b13b
--- a/ui/src/app/data-explorer/data-explorer.module.ts
+++ b/ui/src/app/data-explorer/data-explorer.module.ts
@@@ -82,7 -85,10 +85,11 @@@ import { FieldSelectionComponent } fro
import { FilterSelectionPanelComponent } from './components/designer-panel/data-settings/filter-selection-panel/filter-selection-panel.component';
import { SelectPropertyComponent } from './components/widgets/utils/select-property/select-property.component';
import { DataExplorerVisualisationSettingsComponent } from './components/designer-panel/visualisation-settings/data-explorer-visualisation-settings.component';
+import { GroupSelectionPanelComponent } from './components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component';
+ import { WidgetDirective } from './components/widget/widget.directive';
+ import { WidgetTypeService } from './services/widget-type.service';
+ import { DensityWidgetConfigComponent } from './components/widgets/density/config/density-chart-widget-config.component';
+ import { TimeSelectionService } from './services/time-selection.service';
export const MY_NATIVE_FORMATS = {
fullPickerInput: {
@@@ -163,7 -169,7 +170,9 @@@
TableWidgetConfigComponent,
TimeRangeSelectorComponent,
DataExplorerVisualisationSettingsComponent,
- GroupSelectionPanelComponent
++ GroupSelectionPanelComponent,
++ DataExplorerVisualisationSettingsComponent,
+ WidgetDirective,
],
providers: [
DatalakeRestService,
[incubator-streampipes] 01/02: [STREAMPIPS-79] Add group by to data
lake API
Posted by ze...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit a62b01a99966aafbfa26f76d030eb01780de6477
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Fri Sep 24 15:54:59 2021 +0200
[STREAMPIPS-79] Add group by to data lake API
---
.../dataexplorer/DataLakeManagementV3.java | 521 ++++++++++-----------
.../dataexplorer/DataLakeManagementV4.java | 17 +-
.../autoagg/FromNowAutoAggregationQuery.java | 10 +-
.../autoagg/GroupedAutoAggregationQuery.java | 10 +-
.../autoagg/TimeBoundAutoAggregationQuery.java | 10 +-
.../dataexplorer/query/DataExplorerQuery.java | 32 +-
.../query/GetAggregatedEventsFromNowQuery.java | 6 +-
.../query/GetAggregatedEventsQuery.java | 6 +-
.../dataexplorer/query/GetEventsFromNowQuery.java | 6 +-
.../dataexplorer/query/GetEventsQuery.java | 6 +-
.../query/GetGroupedAggregatedEventsQuery.java | 7 +-
.../dataexplorer/query/GetGroupedEventsQuery.java | 7 +-
.../dataexplorer/query/GetPagingEventsQuery.java | 7 +-
.../dataexplorer/v4/AutoAggregationHandler.java | 22 +-
.../dataexplorer/v4/query/DataExplorerQueryV4.java | 34 +-
.../datalake/{DataResult.java => DataSeries.java} | 23 +-
.../model/datalake/GroupedDataResult.java | 54 ---
.../streampipes/model/datalake/PageResult.java | 10 +-
.../{DataResult.java => SpQueryResult.java} | 42 +-
.../apache/streampipes/ps/DataLakeResourceV3.java | 405 ++++++++--------
.../apache/streampipes/ps/DataLakeResourceV4.java | 11 +-
ui/cypress/support/utils/UserUtils.ts | 2 +-
.../app-image-labeling.component.ts | 36 +-
.../datalake-configuration.component.ts | 8 +-
ui/src/app/core-model/datalake/DataResult.ts | 26 -
.../app/core-model/datalake/GroupedDataResult.ts | 24 -
ui/src/app/core-model/gen/streampipes-model.ts | 58 ++-
.../datalake/DatalakeQueryParameterBuilder.ts | 31 +-
.../datalake/datalake-rest.service.ts | 42 +-
ui/src/app/core-ui/image/image.component.ts | 7 +-
...ta-explorer-widget-data-settings.component.html | 5 +
.../group-selection-panel.component.html | 39 ++
.../group-selection-panel.component.scss} | 9 +-
.../group-selection-panel.component.ts | 74 +++
.../widgets/base/base-data-explorer-widget.ts | 54 +--
.../density/density-chart-widget.component.ts | 34 +-
.../histogram/histogram-chart-widget.component.ts | 22 +-
.../widgets/image/image-widget.component.ts | 11 +-
.../indicator/indicator-chart-widget.component.ts | 38 +-
.../line-chart/line-chart-widget.component.ts | 144 +++---
.../widgets/pie/pie-chart-widget.component.ts | 27 +-
.../widgets/table/table-widget.component.ts | 31 +-
ui/src/app/data-explorer/data-explorer.module.ts | 4 +-
.../models/dataview-dashboard.model.ts | 11 +-
.../services/data-view-query-generator.service.ts | 21 +-
.../apis/datalake-rest.service.ts | 66 ++-
46 files changed, 1064 insertions(+), 1006 deletions(-)
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/DataLakeManagementV3.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/DataLakeManagementV3.java
index c8792ff..9fc117c 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/DataLakeManagementV3.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/DataLakeManagementV3.java
@@ -18,280 +18,255 @@
package org.apache.streampipes.dataexplorer;
-import com.google.gson.Gson;
-import org.apache.commons.io.FileUtils;
-import org.apache.streampipes.config.backend.BackendConfig;
-import org.apache.streampipes.dataexplorer.autoagg.FromNowAutoAggregationQuery;
-import org.apache.streampipes.dataexplorer.autoagg.GroupedAutoAggregationQuery;
-import org.apache.streampipes.dataexplorer.autoagg.TimeBoundAutoAggregationQuery;
-import org.apache.streampipes.dataexplorer.param.*;
-import org.apache.streampipes.dataexplorer.query.*;
-import org.apache.streampipes.dataexplorer.utils.DataExplorerUtils;
-import org.apache.streampipes.model.datalake.DataLakeMeasure;
-import org.apache.streampipes.model.datalake.DataResult;
-import org.apache.streampipes.model.datalake.GroupedDataResult;
-import org.apache.streampipes.model.datalake.PageResult;
-import org.influxdb.InfluxDB;
-import org.influxdb.dto.Point;
-import org.influxdb.dto.QueryResult;
-
-import javax.annotation.Nullable;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
public class DataLakeManagementV3 {
- public DataResult getEvents(String index, long startDate, long endDate, String aggregationUnit, int aggregationValue) {
- return new GetAggregatedEventsQuery(AggregatedTimeBoundQueryParams.from(index, startDate, endDate, aggregationUnit, aggregationValue))
- .executeQuery();
- }
-
- public GroupedDataResult getEvents(String index, long startDate, long endDate, String aggregationUnit, int aggregationValue,
- String groupingTag) {
- return new GetGroupedAggregatedEventsQuery(GroupedAggregatedTimeBoundQueryParams.from(index,
- startDate, endDate, aggregationUnit, aggregationValue, groupingTag)).executeQuery();
- }
-
- public DataResult getEvents(String index, long startDate, long endDate) {
- return new GetEventsQuery(TimeBoundQueryParams.from(index, startDate, endDate)).executeQuery();
- }
-
- public GroupedDataResult getEvents(String index, long startDate, long endDate, String groupingTag) {
- return new GetGroupedEventsQuery(GroupedQueryParams.from(index, startDate, endDate, groupingTag)).executeQuery();
- }
-
- public DataResult getEventsAutoAggregation(String index, long startDate, long endDate) {
- return new TimeBoundAutoAggregationQuery(TimeBoundQueryParams.from(index, startDate, endDate)).executeQuery();
- }
-
- public GroupedDataResult getEventsAutoAggregation(String index, long startDate, long endDate, String groupingTag) {
- return new GroupedAutoAggregationQuery(GroupedQueryParams.from(index, startDate, endDate, groupingTag)).executeQuery();
- }
-
- public DataResult getEventsFromNow(String index, String timeunit, int value,
- String aggregationUnit, int aggregationValue) {
- return new GetAggregatedEventsFromNowQuery(AggregatedTimeUnitQueryParams
- .from(index, timeunit, value, aggregationUnit, aggregationValue)).executeQuery();
- }
-
- public DataResult getEventsFromNowAutoAggregation(String index, String timeunit, int value) {
- return new FromNowAutoAggregationQuery(TimeUnitQueryParams.from(index, timeunit, value)).executeQuery();
- }
-
- public PageResult getEvents(String index, int itemsPerPage, int page) {
- return new GetPagingEventsQuery(PagingQueryParams.from(index, itemsPerPage, page)).executeQuery();
- }
-
- public PageResult getEvents(String index, int itemsPerPage) throws IOException {
- int page = getMaxPage(index, itemsPerPage);
-
- if (page > 0) {
- page = page - 1;
- }
-
- return getEvents(index, itemsPerPage, page);
- }
-
- public void getAllEvents(String index, String outputFormat, OutputStream outputStream) throws IOException {
- getAllEvents(index, outputFormat, null, null, outputStream);
- }
-
- public void getAllEvents(String index, String outputFormat, @Nullable Long startDate,
- @Nullable Long endDate, OutputStream outputStream) throws IOException {
- int itemsPerRequest = 500000;
-
- PageResult dataResult;
- //JSON
- if (outputFormat.equals("json")) {
-
- Gson gson = new Gson();
- int i = 0;
- boolean isFirstDataObject = true;
-
- outputStream.write(toBytes("["));
- do {
- dataResult = new GetPagingEventsQuery(PagingQueryParams.from(index, itemsPerRequest, i, startDate, endDate), TimeUnit.MILLISECONDS).executeQuery();
-
- if (dataResult.getTotal() > 0) {
- for (List<Object> row : dataResult.getRows()) {
- if (!isFirstDataObject) {
- outputStream.write(toBytes(","));
- }
-
- //produce one json object
- boolean isFirstElementInRow = true;
- outputStream.write(toBytes("{"));
- for (int i1 = 0; i1 < row.size(); i1++) {
- Object element = row.get(i1);
- if (!isFirstElementInRow) {
- outputStream.write(toBytes(","));
- }
- isFirstElementInRow = false;
- if (i1 == 0) {
- element = ((Double) element).longValue();
- }
- //produce json e.g. "name": "Pipes" or "load": 42
- outputStream.write(toBytes("\"" + dataResult.getHeaders().get(i1) + "\": "
- + gson.toJson(element)));
- }
- outputStream.write(toBytes("}"));
- isFirstDataObject = false;
- }
-
- i++;
- }
- } while (dataResult.getTotal() > 0);
- outputStream.write(toBytes("]"));
-
- //CSV
- } else if (outputFormat.equals("csv")) {
- int i = 0;
-
- boolean isFirstDataObject = true;
-
- do {
- dataResult = new GetPagingEventsQuery(PagingQueryParams.from(index, itemsPerRequest, i, startDate, endDate), TimeUnit.MILLISECONDS).executeQuery();
- //Send first header
- if (dataResult.getTotal() > 0) {
- if (isFirstDataObject) {
- boolean isFirst = true;
- for (int i1 = 0; i1 < dataResult.getHeaders().size(); i1++) {
- if (!isFirst) {
- outputStream.write(toBytes(";"));
- }
- isFirst = false;
- outputStream.write(toBytes(dataResult.getHeaders().get(i1)));
- }
- }
- outputStream.write(toBytes("\n"));
- isFirstDataObject = false;
- }
-
- if (dataResult.getTotal() > 0) {
- for (List<Object> row : dataResult.getRows()) {
- boolean isFirstInRow = true;
- for (int i1 = 0; i1 < row.size(); i1++) {
- Object element = row.get(i1);
- if (!isFirstInRow) {
- outputStream.write(toBytes(";"));
- }
- isFirstInRow = false;
- if (i1 == 0) {
- element = ((Double) element).longValue();
- }
- if (element == null) {
- outputStream.write(toBytes(""));
- } else {
- outputStream.write(toBytes(element.toString()));
- }
- }
- outputStream.write(toBytes("\n"));
- }
- }
- i++;
- } while (dataResult.getTotal() > 0);
- }
- }
-
- public boolean removeAllDataFromDataLake() {
- List<DataLakeMeasure> allMeasurements = DataExplorerUtils.getInfos();
-
- // Remove data from influxdb
- for (DataLakeMeasure measure : allMeasurements) {
- QueryResult influxResult = new DeleteDataQuery(measure).executeQuery();
- if (influxResult.hasError() || influxResult.getResults().get(0).getError() != null) {
- return false;
- }
- }
- return true;
- }
-
- private byte[] toBytes(String value) {
- return value.getBytes();
- }
-
- private int getMaxPage(String index, int itemsPerPage) {
- return new GetMaxPagesQuery(PagingQueryParams.from(index, itemsPerPage)).executeQuery();
- }
-
- public byte[] getImage(String fileRoute) throws IOException {
- fileRoute = getImageFileRoute(fileRoute);
- File file = new File(fileRoute);
- return FileUtils.readFileToByteArray(file);
- }
-
- public String getImageCoco(String fileRoute) throws IOException {
- fileRoute = getImageFileRoute(fileRoute);
- String cocoRoute = getCocoFileRoute(fileRoute);
-
- File file = new File(cocoRoute);
- if (!file.exists()) {
- return "";
- } else {
- return FileUtils.readFileToString(file, "UTF-8");
- }
- }
-
- public void saveImageCoco(String fileRoute, String data) throws IOException {
- fileRoute = getImageFileRoute(fileRoute);
- String cocoRoute = getCocoFileRoute(fileRoute);
-
- File file = new File(cocoRoute);
- file.getParentFile().mkdirs();
- FileUtils.writeStringToFile(file, data, "UTF-8");
-
- }
-
- private String getImageFileRoute(String fileRoute) {
- fileRoute = fileRoute.replace("_", "/");
- fileRoute = fileRoute.replace("/png", ".png");
- return fileRoute;
- }
-
- private String getCocoFileRoute(String imageRoute) {
- String[] splitedRoute = imageRoute.split("/");
- String route = "";
- for (int i = 0; splitedRoute.length - 2 >= i; i++) {
- route += "/" + splitedRoute[i];
- }
- route += "Coco";
- route += "/" + splitedRoute[splitedRoute.length - 1];
- route = route.replace(".png", ".json");
- return route;
- }
-
- public void updateLabels(String index, String labelColumn, long startdate, long enddate, String label, String timestampColumn) {
- DataResult queryResult = getEvents(index, startdate, enddate);
- Map<String, String> headerWithTypes = new GetHeadersWithTypesQuery(QueryParams.from(index)).executeQuery();
- List<String> headers = queryResult.getHeaders();
-
- InfluxDB influxDB = DataExplorerUtils.getInfluxDBClient();
- influxDB.setDatabase(BackendConfig.INSTANCE.getInfluxDatabaseName());
-
- for (List<Object> row : queryResult.getRows()) {
- long timestampValue = Math.round((double) row.get(headers.indexOf(timestampColumn)));
-
- Point.Builder p = Point.measurement(index).time(timestampValue, TimeUnit.MILLISECONDS);
-
- for (int i = 1; i < row.size(); i++) {
- String selected_header = headers.get(i);
- if (!selected_header.equals(labelColumn)) {
- if (headerWithTypes.get(selected_header).equals("integer")) {
- p.addField(selected_header, Math.round((double) row.get(i)));
- } else if (headerWithTypes.get(selected_header).equals("string")) {
- p.addField(selected_header, row.get(i).toString());
- }
- } else {
- p.addField(selected_header, label);
- }
- }
- influxDB.write(p.build());
- }
- influxDB.close();
- }
+// public DataSeries getEvents(String index, long startDate, long endDate, String aggregationUnit, int aggregationValue) {
+// return new GetAggregatedEventsQuery(AggregatedTimeBoundQueryParams.from(index, startDate, endDate, aggregationUnit, aggregationValue))
+// .executeQuery();
+// }
+//
+// public SPQueryResult getEvents(String index, long startDate, long endDate, String aggregationUnit, int aggregationValue,
+// String groupingTag) {
+// return new GetGroupedAggregatedEventsQuery(GroupedAggregatedTimeBoundQueryParams.from(index,
+// startDate, endDate, aggregationUnit, aggregationValue, groupingTag)).executeQuery();
+// }
+
+// public DataSeries getEvents(String index, long startDate, long endDate) {
+// return new GetEventsQuery(TimeBoundQueryParams.from(index, startDate, endDate)).executeQuery();
+// }
+
+// public SPQueryResult getEvents(String index, long startDate, long endDate, String groupingTag) {
+// return new GetGroupedEventsQuery(GroupedQueryParams.from(index, startDate, endDate, groupingTag)).executeQuery();
+// }
+//
+// public DataSeries getEventsAutoAggregation(String index, long startDate, long endDate) {
+// return new TimeBoundAutoAggregationQuery(TimeBoundQueryParams.from(index, startDate, endDate)).executeQuery();
+// }
+//
+// public SPQueryResult getEventsAutoAggregation(String index, long startDate, long endDate, String groupingTag) {
+// return new GroupedAutoAggregationQuery(GroupedQueryParams.from(index, startDate, endDate, groupingTag)).executeQuery();
+// }
+//
+// public DataSeries getEventsFromNow(String index, String timeunit, int value,
+// String aggregationUnit, int aggregationValue) {
+// return new GetAggregatedEventsFromNowQuery(AggregatedTimeUnitQueryParams
+// .from(index, timeunit, value, aggregationUnit, aggregationValue)).executeQuery();
+// }
+//
+// public DataSeries getEventsFromNowAutoAggregation(String index, String timeunit, int value) {
+// return new FromNowAutoAggregationQuery(TimeUnitQueryParams.from(index, timeunit, value)).executeQuery();
+// }
+//
+// public PageResult getEvents(String index, int itemsPerPage, int page) {
+// return new GetPagingEventsQuery(PagingQueryParams.from(index, itemsPerPage, page)).executeQuery();
+// }
+//
+// public PageResult getEvents(String index, int itemsPerPage) throws IOException {
+// int page = getMaxPage(index, itemsPerPage);
+//
+// if (page > 0) {
+// page = page - 1;
+// }
+//
+// return getEvents(index, itemsPerPage, page);
+// }
+//
+// public void getAllEvents(String index, String outputFormat, OutputStream outputStream) throws IOException {
+// getAllEvents(index, outputFormat, null, null, outputStream);
+// }
+//
+// public void getAllEvents(String index, String outputFormat, @Nullable Long startDate,
+// @Nullable Long endDate, OutputStream outputStream) throws IOException {
+// int itemsPerRequest = 500000;
+//
+// PageResult dataResult;
+// //JSON
+// if (outputFormat.equals("json")) {
+//
+// Gson gson = new Gson();
+// int i = 0;
+// boolean isFirstDataObject = true;
+//
+// outputStream.write(toBytes("["));
+// do {
+// dataResult = new GetPagingEventsQuery(PagingQueryParams.from(index, itemsPerRequest, i, startDate, endDate), TimeUnit.MILLISECONDS).executeQuery();
+//
+// if (dataResult.getTotal() > 0) {
+// for (List<Object> row : dataResult.getRows()) {
+// if (!isFirstDataObject) {
+// outputStream.write(toBytes(","));
+// }
+//
+// //produce one json object
+// boolean isFirstElementInRow = true;
+// outputStream.write(toBytes("{"));
+// for (int i1 = 0; i1 < row.size(); i1++) {
+// Object element = row.get(i1);
+// if (!isFirstElementInRow) {
+// outputStream.write(toBytes(","));
+// }
+// isFirstElementInRow = false;
+// if (i1 == 0) {
+// element = ((Double) element).longValue();
+// }
+// //produce json e.g. "name": "Pipes" or "load": 42
+// outputStream.write(toBytes("\"" + dataResult.getHeaders().get(i1) + "\": "
+// + gson.toJson(element)));
+// }
+// outputStream.write(toBytes("}"));
+// isFirstDataObject = false;
+// }
+//
+// i++;
+// }
+// } while (dataResult.getTotal() > 0);
+// outputStream.write(toBytes("]"));
+//
+// //CSV
+// } else if (outputFormat.equals("csv")) {
+// int i = 0;
+//
+// boolean isFirstDataObject = true;
+//
+// do {
+// dataResult = new GetPagingEventsQuery(PagingQueryParams.from(index, itemsPerRequest, i, startDate, endDate), TimeUnit.MILLISECONDS).executeQuery();
+// //Send first header
+// if (dataResult.getTotal() > 0) {
+// if (isFirstDataObject) {
+// boolean isFirst = true;
+// for (int i1 = 0; i1 < dataResult.getHeaders().size(); i1++) {
+// if (!isFirst) {
+// outputStream.write(toBytes(";"));
+// }
+// isFirst = false;
+// outputStream.write(toBytes(dataResult.getHeaders().get(i1)));
+// }
+// }
+// outputStream.write(toBytes("\n"));
+// isFirstDataObject = false;
+// }
+//
+// if (dataResult.getTotal() > 0) {
+// for (List<Object> row : dataResult.getRows()) {
+// boolean isFirstInRow = true;
+// for (int i1 = 0; i1 < row.size(); i1++) {
+// Object element = row.get(i1);
+// if (!isFirstInRow) {
+// outputStream.write(toBytes(";"));
+// }
+// isFirstInRow = false;
+// if (i1 == 0) {
+// element = ((Double) element).longValue();
+// }
+// if (element == null) {
+// outputStream.write(toBytes(""));
+// } else {
+// outputStream.write(toBytes(element.toString()));
+// }
+// }
+// outputStream.write(toBytes("\n"));
+// }
+// }
+// i++;
+// } while (dataResult.getTotal() > 0);
+// }
+// }
+//
+// public boolean removeAllDataFromDataLake() {
+// List<DataLakeMeasure> allMeasurements = DataExplorerUtils.getInfos();
+//
+// // Remove data from influxdb
+// for (DataLakeMeasure measure : allMeasurements) {
+// org.influxdb.dto.QueryResult influxResult = new DeleteDataQuery(measure).executeQuery();
+// if (influxResult.hasError() || influxResult.getResults().get(0).getError() != null) {
+// return false;
+// }
+// }
+// return true;
+// }
+//
+// private byte[] toBytes(String value) {
+// return value.getBytes();
+// }
+//
+// private int getMaxPage(String index, int itemsPerPage) {
+// return new GetMaxPagesQuery(PagingQueryParams.from(index, itemsPerPage)).executeQuery();
+// }
+//
+// public byte[] getImage(String fileRoute) throws IOException {
+// fileRoute = getImageFileRoute(fileRoute);
+// File file = new File(fileRoute);
+// return FileUtils.readFileToByteArray(file);
+// }
+//
+// public String getImageCoco(String fileRoute) throws IOException {
+// fileRoute = getImageFileRoute(fileRoute);
+// String cocoRoute = getCocoFileRoute(fileRoute);
+//
+// File file = new File(cocoRoute);
+// if (!file.exists()) {
+// return "";
+// } else {
+// return FileUtils.readFileToString(file, "UTF-8");
+// }
+// }
+//
+// public void saveImageCoco(String fileRoute, String data) throws IOException {
+// fileRoute = getImageFileRoute(fileRoute);
+// String cocoRoute = getCocoFileRoute(fileRoute);
+//
+// File file = new File(cocoRoute);
+// file.getParentFile().mkdirs();
+// FileUtils.writeStringToFile(file, data, "UTF-8");
+//
+// }
+//
+// private String getImageFileRoute(String fileRoute) {
+// fileRoute = fileRoute.replace("_", "/");
+// fileRoute = fileRoute.replace("/png", ".png");
+// return fileRoute;
+// }
+//
+// private String getCocoFileRoute(String imageRoute) {
+// String[] splitedRoute = imageRoute.split("/");
+// String route = "";
+// for (int i = 0; splitedRoute.length - 2 >= i; i++) {
+// route += "/" + splitedRoute[i];
+// }
+// route += "Coco";
+// route += "/" + splitedRoute[splitedRoute.length - 1];
+// route = route.replace(".png", ".json");
+// return route;
+// }
+//
+// public void updateLabels(String index, String labelColumn, long startdate, long enddate, String label, String timestampColumn) {
+// DataSeries queryResult = getEvents(index, startdate, enddate);
+// Map<String, String> headerWithTypes = new GetHeadersWithTypesQuery(QueryParams.from(index)).executeQuery();
+// List<String> headers = queryResult.getHeaders();
+//
+// InfluxDB influxDB = DataExplorerUtils.getInfluxDBClient();
+// influxDB.setDatabase(BackendConfig.INSTANCE.getInfluxDatabaseName());
+//
+// for (List<Object> row : queryResult.getRows()) {
+// long timestampValue = Math.round((double) row.get(headers.indexOf(timestampColumn)));
+//
+// Point.Builder p = Point.measurement(index).time(timestampValue, TimeUnit.MILLISECONDS);
+//
+// for (int i = 1; i < row.size(); i++) {
+// String selected_header = headers.get(i);
+// if (!selected_header.equals(labelColumn)) {
+// if (headerWithTypes.get(selected_header).equals("integer")) {
+// p.addField(selected_header, Math.round((double) row.get(i)));
+// } else if (headerWithTypes.get(selected_header).equals("string")) {
+// p.addField(selected_header, row.get(i).toString());
+// }
+// } else {
+// p.addField(selected_header, label);
+// }
+// }
+// influxDB.write(p.build());
+// }
+// influxDB.close();
+// }
}
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/DataLakeManagementV4.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/DataLakeManagementV4.java
index 74f23d1..3ae4241 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/DataLakeManagementV4.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/DataLakeManagementV4.java
@@ -31,10 +31,7 @@ import org.apache.streampipes.dataexplorer.v4.SupportedDataLakeQueryParameters;
import org.apache.streampipes.dataexplorer.v4.params.QueryParamsV4;
import org.apache.streampipes.dataexplorer.v4.query.DataExplorerQueryV4;
import org.apache.streampipes.dataexplorer.v4.utils.DataLakeManagementUtils;
-import org.apache.streampipes.model.datalake.DataLakeConfiguration;
-import org.apache.streampipes.model.datalake.DataLakeMeasure;
-import org.apache.streampipes.model.datalake.DataLakeRetentionPolicy;
-import org.apache.streampipes.model.datalake.DataResult;
+import org.apache.streampipes.model.datalake.*;
import org.apache.streampipes.storage.couchdb.utils.Utils;
import org.influxdb.dto.QueryResult;
import org.lightcouch.CouchDbClient;
@@ -55,7 +52,7 @@ public class DataLakeManagementV4 {
return DataExplorerUtils.getInfos();
}
- public DataResult getData(ProvidedQueryParams queryParams) throws IllegalArgumentException {
+ public SpQueryResult getData(ProvidedQueryParams queryParams) throws IllegalArgumentException {
if (queryParams.has(QP_AUTO_AGGREGATE)) {
queryParams = new AutoAggregationHandler(queryParams).makeAutoAggregationQueryParams();
}
@@ -70,7 +67,7 @@ public class DataLakeManagementV4 {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
- DataResult dataResult;
+ SpQueryResult dataResult;
//JSON
if (format.equals("json")) {
@@ -88,7 +85,7 @@ public class DataLakeManagementV4 {
dataResult = getData(params);
if (dataResult.getTotal() > 0) {
- for (List<Object> row : dataResult.getRows()) {
+ for (List<Object> row : dataResult.getAllDataSeries().get(0).getRows()) {
if (!isFirstDataObject) {
outputStream.write(toBytes(","));
}
@@ -151,7 +148,7 @@ public class DataLakeManagementV4 {
}
if (dataResult.getTotal() > 0) {
- for (List<Object> row : dataResult.getRows()) {
+ for (List<Object> row : dataResult.getAllDataSeries().get(0).getRows()) {
boolean isFirstInRow = true;
for (int i1 = 0; i1 < row.size(); i1++) {
Object element = row.get(i1);
@@ -207,11 +204,11 @@ public class DataLakeManagementV4 {
return false;
}
- public DataResult deleteData(String measurementID) {
+ public SpQueryResult deleteData(String measurementID) {
return this.deleteData(measurementID, null, null);
}
- public DataResult deleteData(String measurementID, Long startDate, Long endDate) {
+ public SpQueryResult deleteData(String measurementID, Long startDate, Long endDate) {
Map<String, QueryParamsV4> queryParts = DataLakeManagementUtils.getDeleteQueryParams(measurementID, startDate, endDate);
return new DataExplorerQueryV4(queryParts).executeQuery();
}
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/autoagg/FromNowAutoAggregationQuery.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/autoagg/FromNowAutoAggregationQuery.java
index a7b118e..8c0721e 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/autoagg/FromNowAutoAggregationQuery.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/autoagg/FromNowAutoAggregationQuery.java
@@ -22,12 +22,12 @@ import org.apache.streampipes.dataexplorer.param.TimeUnitQueryParams;
import org.apache.streampipes.dataexplorer.query.GetAggregatedEventsFromNowQuery;
import org.apache.streampipes.dataexplorer.query.GetEventsFromNowQuery;
import org.apache.streampipes.dataexplorer.query.GetNumberOfRecordsByTimeUnitQuery;
-import org.apache.streampipes.model.datalake.DataResult;
+import org.apache.streampipes.model.datalake.SpQueryResult;
-public class FromNowAutoAggregationQuery extends AbstractAutoAggregationQuery<TimeUnitQueryParams, DataResult> {
+public class FromNowAutoAggregationQuery extends AbstractAutoAggregationQuery<TimeUnitQueryParams, SpQueryResult> {
public FromNowAutoAggregationQuery(TimeUnitQueryParams params) {
- super(params, DataResult::new);
+ super(params, SpQueryResult::new);
}
@Override
@@ -36,12 +36,12 @@ public class FromNowAutoAggregationQuery extends AbstractAutoAggregationQuery<Ti
}
@Override
- protected DataResult getRawEvents() {
+ protected SpQueryResult getRawEvents() {
return new GetEventsFromNowQuery(params).executeQuery();
}
@Override
- protected DataResult getAggregatedEvents(Integer aggregationValue) {
+ protected SpQueryResult getAggregatedEvents(Integer aggregationValue) {
return new GetAggregatedEventsFromNowQuery(AggregatedTimeUnitQueryParams
.from(params.getIndex(), params.getTimeUnit(), params.getTimeValue(), "ms", aggregationValue))
.executeQuery();
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/autoagg/GroupedAutoAggregationQuery.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/autoagg/GroupedAutoAggregationQuery.java
index 5b3c01e..7518f05 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/autoagg/GroupedAutoAggregationQuery.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/autoagg/GroupedAutoAggregationQuery.java
@@ -22,12 +22,12 @@ import org.apache.streampipes.dataexplorer.param.GroupedQueryParams;
import org.apache.streampipes.dataexplorer.query.GetGroupedAggregatedEventsQuery;
import org.apache.streampipes.dataexplorer.query.GetGroupedEventsQuery;
import org.apache.streampipes.dataexplorer.query.GetNumberOfRecordsQuery;
-import org.apache.streampipes.model.datalake.GroupedDataResult;
+import org.apache.streampipes.model.datalake.SpQueryResult;
-public class GroupedAutoAggregationQuery extends AbstractAutoAggregationQuery<GroupedQueryParams, GroupedDataResult> {
+public class GroupedAutoAggregationQuery extends AbstractAutoAggregationQuery<GroupedQueryParams, SpQueryResult> {
public GroupedAutoAggregationQuery(GroupedQueryParams params) {
- super(params, GroupedDataResult::new);
+ super(params, SpQueryResult::new);
}
@Override
@@ -36,12 +36,12 @@ public class GroupedAutoAggregationQuery extends AbstractAutoAggregationQuery<Gr
}
@Override
- protected GroupedDataResult getRawEvents() {
+ protected SpQueryResult getRawEvents() {
return new GetGroupedEventsQuery(params).executeQuery();
}
@Override
- protected GroupedDataResult getAggregatedEvents(Integer aggregationValue) {
+ protected SpQueryResult getAggregatedEvents(Integer aggregationValue) {
return new GetGroupedAggregatedEventsQuery(GroupedAggregatedTimeBoundQueryParams.from(params.getIndex(),
params.getStartDate(), params.getEndDate(), "ms", aggregationValue, params.getGroupingTag())).executeQuery();
}
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/autoagg/TimeBoundAutoAggregationQuery.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/autoagg/TimeBoundAutoAggregationQuery.java
index d333cff..5cc089a 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/autoagg/TimeBoundAutoAggregationQuery.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/autoagg/TimeBoundAutoAggregationQuery.java
@@ -22,12 +22,12 @@ import org.apache.streampipes.dataexplorer.param.TimeBoundQueryParams;
import org.apache.streampipes.dataexplorer.query.GetAggregatedEventsQuery;
import org.apache.streampipes.dataexplorer.query.GetEventsQuery;
import org.apache.streampipes.dataexplorer.query.GetNumberOfRecordsQuery;
-import org.apache.streampipes.model.datalake.DataResult;
+import org.apache.streampipes.model.datalake.SpQueryResult;
-public class TimeBoundAutoAggregationQuery extends AbstractAutoAggregationQuery<TimeBoundQueryParams, DataResult> {
+public class TimeBoundAutoAggregationQuery extends AbstractAutoAggregationQuery<TimeBoundQueryParams, SpQueryResult> {
public TimeBoundAutoAggregationQuery(TimeBoundQueryParams params) {
- super(params, DataResult::new);
+ super(params, SpQueryResult::new);
}
@Override
@@ -36,12 +36,12 @@ public class TimeBoundAutoAggregationQuery extends AbstractAutoAggregationQuery<
}
@Override
- protected DataResult getRawEvents() {
+ protected SpQueryResult getRawEvents() {
return new GetEventsQuery(params).executeQuery();
}
@Override
- protected DataResult getAggregatedEvents(Integer aggregationValue) {
+ protected SpQueryResult getAggregatedEvents(Integer aggregationValue) {
return new GetAggregatedEventsQuery(AggregatedTimeBoundQueryParams.from(params.getIndex(),
params.getStartDate(), params.getEndDate(), "ms", aggregationValue))
.executeQuery();
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/DataExplorerQuery.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/DataExplorerQuery.java
index da06b5d..10516e8 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/DataExplorerQuery.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/DataExplorerQuery.java
@@ -19,12 +19,13 @@ package org.apache.streampipes.dataexplorer.query;
import org.apache.streampipes.config.backend.BackendConfig;
import org.apache.streampipes.dataexplorer.utils.DataExplorerUtils;
-import org.apache.streampipes.model.datalake.DataResult;
-import org.apache.streampipes.model.datalake.GroupedDataResult;
+import org.apache.streampipes.model.datalake.DataSeries;
+import org.apache.streampipes.model.datalake.SpQueryResult;
import org.influxdb.InfluxDB;
import org.influxdb.dto.Query;
-import org.influxdb.dto.QueryResult;
+import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
public abstract class DataExplorerQuery<OUT> {
@@ -34,7 +35,7 @@ public abstract class DataExplorerQuery<OUT> {
DataExplorerQueryBuilder queryBuilder = DataExplorerQueryBuilder.create(BackendConfig.INSTANCE.getInfluxDatabaseName());
getQuery(queryBuilder);
Query query = queryBuilder.toQuery();
- QueryResult result;
+ org.influxdb.dto.QueryResult result;
if (queryBuilder.hasTimeUnit()) {
result = influxDB.query(query, queryBuilder.getTimeUnit());;
} else {
@@ -47,31 +48,32 @@ public abstract class DataExplorerQuery<OUT> {
return dataResult;
}
- protected DataResult convertResult(QueryResult result) {
+ protected SpQueryResult convertResult(org.influxdb.dto.QueryResult result) {
if (result.getResults().get(0).getSeries() != null) {
- return convertResult(result.getResults().get(0).getSeries().get(0));
+ DataSeries dataSeries = convertResult(result.getResults().get(0).getSeries().get(0));
+ return new SpQueryResult(1, dataSeries.getHeaders(), Arrays.asList(dataSeries));
} else {
- return new DataResult();
+ return new SpQueryResult();
}
}
- protected DataResult convertResult(QueryResult.Series serie) {
+ protected DataSeries convertResult(org.influxdb.dto.QueryResult.Series serie) {
List<String> columns = serie.getColumns();
for (int i = 0; i < columns.size(); i++) {
String replacedColumnName = columns.get(i).replaceAll("mean_", "");
columns.set(i, replacedColumnName);
}
List values = serie.getValues();
- return new DataResult(values.size(), columns, values);
+ return new DataSeries(values.size(), values, columns, new HashMap<>());
}
- protected GroupedDataResult convertMultiResult(QueryResult result) {
- GroupedDataResult groupedDataResult = new GroupedDataResult();
+ protected SpQueryResult convertMultiResult(org.influxdb.dto.QueryResult result) {
+ SpQueryResult groupedDataResult = new SpQueryResult();
if (result.getResults().get(0).getSeries() != null) {
- for (QueryResult.Series series : result.getResults().get(0).getSeries()) {
+ for (org.influxdb.dto.QueryResult.Series series : result.getResults().get(0).getSeries()) {
String groupName = series.getTags().entrySet().toArray()[0].toString();
- DataResult dataResult = convertResult(series);
- groupedDataResult.addDataResult(groupName, dataResult);
+ DataSeries dataResult = convertResult(series);
+ groupedDataResult.addDataResult(dataResult);
}
}
return groupedDataResult;
@@ -80,5 +82,5 @@ public abstract class DataExplorerQuery<OUT> {
protected abstract void getQuery(DataExplorerQueryBuilder queryBuilder);
- protected abstract OUT postQuery(QueryResult result) throws RuntimeException;
+ protected abstract OUT postQuery(org.influxdb.dto.QueryResult result) throws RuntimeException;
}
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetAggregatedEventsFromNowQuery.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetAggregatedEventsFromNowQuery.java
index 9e74ece..9c171a6 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetAggregatedEventsFromNowQuery.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetAggregatedEventsFromNowQuery.java
@@ -19,10 +19,10 @@ package org.apache.streampipes.dataexplorer.query;
import org.apache.streampipes.dataexplorer.param.AggregatedTimeUnitQueryParams;
import org.apache.streampipes.dataexplorer.template.QueryTemplates;
-import org.apache.streampipes.model.datalake.DataResult;
+import org.apache.streampipes.model.datalake.SpQueryResult;
import org.influxdb.dto.QueryResult;
-public class GetAggregatedEventsFromNowQuery extends ParameterizedDataExplorerQuery<AggregatedTimeUnitQueryParams, DataResult> {
+public class GetAggregatedEventsFromNowQuery extends ParameterizedDataExplorerQuery<AggregatedTimeUnitQueryParams, SpQueryResult> {
public GetAggregatedEventsFromNowQuery(AggregatedTimeUnitQueryParams queryParams) {
super(queryParams);
@@ -41,7 +41,7 @@ public class GetAggregatedEventsFromNowQuery extends ParameterizedDataExplorerQu
}
@Override
- protected DataResult postQuery(QueryResult result) {
+ protected SpQueryResult postQuery(QueryResult result) {
return convertResult(result);
}
}
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetAggregatedEventsQuery.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetAggregatedEventsQuery.java
index 22d3e71..97e0c31 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetAggregatedEventsQuery.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetAggregatedEventsQuery.java
@@ -19,10 +19,10 @@ package org.apache.streampipes.dataexplorer.query;
import org.apache.streampipes.dataexplorer.param.AggregatedTimeBoundQueryParams;
import org.apache.streampipes.dataexplorer.template.QueryTemplates;
-import org.apache.streampipes.model.datalake.DataResult;
+import org.apache.streampipes.model.datalake.SpQueryResult;
import org.influxdb.dto.QueryResult;
-public class GetAggregatedEventsQuery extends ParameterizedDataExplorerQuery<AggregatedTimeBoundQueryParams, DataResult> {
+public class GetAggregatedEventsQuery extends ParameterizedDataExplorerQuery<AggregatedTimeBoundQueryParams, SpQueryResult> {
public GetAggregatedEventsQuery(AggregatedTimeBoundQueryParams queryParams) {
super(queryParams);
@@ -39,7 +39,7 @@ public class GetAggregatedEventsQuery extends ParameterizedDataExplorerQuery<Agg
}
@Override
- protected DataResult postQuery(QueryResult result) {
+ protected SpQueryResult postQuery(QueryResult result) {
return convertResult(result);
}
}
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetEventsFromNowQuery.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetEventsFromNowQuery.java
index a9d5bba..2f29d75 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetEventsFromNowQuery.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetEventsFromNowQuery.java
@@ -19,10 +19,10 @@ package org.apache.streampipes.dataexplorer.query;
import org.apache.streampipes.dataexplorer.param.TimeUnitQueryParams;
import org.apache.streampipes.dataexplorer.template.QueryTemplates;
-import org.apache.streampipes.model.datalake.DataResult;
+import org.apache.streampipes.model.datalake.SpQueryResult;
import org.influxdb.dto.QueryResult;
-public class GetEventsFromNowQuery extends ParameterizedDataExplorerQuery<TimeUnitQueryParams, DataResult> {
+public class GetEventsFromNowQuery extends ParameterizedDataExplorerQuery<TimeUnitQueryParams, SpQueryResult> {
public GetEventsFromNowQuery(TimeUnitQueryParams queryParams) {
super(queryParams);
@@ -38,7 +38,7 @@ public class GetEventsFromNowQuery extends ParameterizedDataExplorerQuery<TimeUn
}
@Override
- protected DataResult postQuery(QueryResult result) {
+ protected SpQueryResult postQuery(QueryResult result) {
return convertResult(result);
}
}
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetEventsQuery.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetEventsQuery.java
index a817d68..2f4ccd2 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetEventsQuery.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetEventsQuery.java
@@ -19,10 +19,10 @@ package org.apache.streampipes.dataexplorer.query;
import org.apache.streampipes.dataexplorer.param.TimeBoundQueryParams;
import org.apache.streampipes.dataexplorer.template.QueryTemplates;
-import org.apache.streampipes.model.datalake.DataResult;
+import org.apache.streampipes.model.datalake.SpQueryResult;
import org.influxdb.dto.QueryResult;
-public class GetEventsQuery extends ParameterizedDataExplorerQuery<TimeBoundQueryParams, DataResult> {
+public class GetEventsQuery extends ParameterizedDataExplorerQuery<TimeBoundQueryParams, SpQueryResult> {
public GetEventsQuery(TimeBoundQueryParams params) {
super(params);
@@ -36,7 +36,7 @@ public class GetEventsQuery extends ParameterizedDataExplorerQuery<TimeBoundQuer
}
@Override
- protected DataResult postQuery(QueryResult result) {
+ protected SpQueryResult postQuery(QueryResult result) {
return convertResult(result);
}
}
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetGroupedAggregatedEventsQuery.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetGroupedAggregatedEventsQuery.java
index 653db68..81c77f4 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetGroupedAggregatedEventsQuery.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetGroupedAggregatedEventsQuery.java
@@ -19,10 +19,9 @@ package org.apache.streampipes.dataexplorer.query;
import org.apache.streampipes.dataexplorer.param.GroupedAggregatedTimeBoundQueryParams;
import org.apache.streampipes.dataexplorer.template.QueryTemplates;
-import org.apache.streampipes.model.datalake.GroupedDataResult;
-import org.influxdb.dto.QueryResult;
+import org.apache.streampipes.model.datalake.SpQueryResult;
-public class GetGroupedAggregatedEventsQuery extends ParameterizedDataExplorerQuery<GroupedAggregatedTimeBoundQueryParams, GroupedDataResult> {
+public class GetGroupedAggregatedEventsQuery extends ParameterizedDataExplorerQuery<GroupedAggregatedTimeBoundQueryParams, SpQueryResult> {
public GetGroupedAggregatedEventsQuery(GroupedAggregatedTimeBoundQueryParams queryParams) {
super(queryParams);
@@ -39,7 +38,7 @@ public class GetGroupedAggregatedEventsQuery extends ParameterizedDataExplorerQu
}
@Override
- protected GroupedDataResult postQuery(QueryResult result) {
+ protected SpQueryResult postQuery(org.influxdb.dto.QueryResult result) {
return convertMultiResult(result);
}
}
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetGroupedEventsQuery.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetGroupedEventsQuery.java
index 45f9c1c..6bd6409 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetGroupedEventsQuery.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetGroupedEventsQuery.java
@@ -19,10 +19,9 @@ package org.apache.streampipes.dataexplorer.query;
import org.apache.streampipes.dataexplorer.param.GroupedQueryParams;
import org.apache.streampipes.dataexplorer.template.QueryTemplates;
-import org.apache.streampipes.model.datalake.GroupedDataResult;
-import org.influxdb.dto.QueryResult;
+import org.apache.streampipes.model.datalake.SpQueryResult;
-public class GetGroupedEventsQuery extends ParameterizedDataExplorerQuery<GroupedQueryParams, GroupedDataResult> {
+public class GetGroupedEventsQuery extends ParameterizedDataExplorerQuery<GroupedQueryParams, SpQueryResult> {
public GetGroupedEventsQuery(GroupedQueryParams queryParams) {
super(queryParams);
@@ -37,7 +36,7 @@ public class GetGroupedEventsQuery extends ParameterizedDataExplorerQuery<Groupe
}
@Override
- protected GroupedDataResult postQuery(QueryResult result) {
+ protected SpQueryResult postQuery(org.influxdb.dto.QueryResult result) {
return convertMultiResult(result);
}
}
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetPagingEventsQuery.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetPagingEventsQuery.java
index 53aa392..daf186e 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetPagingEventsQuery.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/query/GetPagingEventsQuery.java
@@ -19,10 +19,11 @@ package org.apache.streampipes.dataexplorer.query;
import org.apache.streampipes.dataexplorer.param.PagingQueryParams;
import org.apache.streampipes.dataexplorer.template.QueryTemplates;
-import org.apache.streampipes.model.datalake.DataResult;
import org.apache.streampipes.model.datalake.PageResult;
+import org.apache.streampipes.model.datalake.SpQueryResult;
import org.influxdb.dto.QueryResult;
+import java.util.HashMap;
import java.util.concurrent.TimeUnit;
public class GetPagingEventsQuery extends ParameterizedDataExplorerQuery<PagingQueryParams, PageResult> {
@@ -62,10 +63,10 @@ public class GetPagingEventsQuery extends ParameterizedDataExplorerQuery<PagingQ
@Override
protected PageResult postQuery(QueryResult result) {
- DataResult dataResult = convertResult(result);
+ SpQueryResult dataResult = convertResult(result);
int pageSum = new GetMaxPagesQuery(PagingQueryParams.from(params.getIndex(), params.getItemsPerPage()))
.executeQuery();
- return new PageResult(dataResult.getTotal(), dataResult.getHeaders(), dataResult.getRows(), params.getPage(), pageSum);
+ return new PageResult(dataResult.getTotal(), dataResult.getHeaders(), dataResult.getAllDataSeries().get(0).getRows(), params.getPage(), pageSum, new HashMap<>());
}
}
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/AutoAggregationHandler.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/AutoAggregationHandler.java
index 3cf0c1b..284766c 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/AutoAggregationHandler.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/AutoAggregationHandler.java
@@ -20,7 +20,7 @@ package org.apache.streampipes.dataexplorer.v4;
import org.apache.streampipes.dataexplorer.DataLakeManagementV4;
import org.apache.streampipes.dataexplorer.model.Order;
import org.apache.streampipes.dataexplorer.v4.params.SelectColumn;
-import org.apache.streampipes.model.datalake.DataResult;
+import org.apache.streampipes.model.datalake.SpQueryResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -54,8 +54,8 @@ public class AutoAggregationHandler {
public ProvidedQueryParams makeAutoAggregationQueryParams() throws IllegalArgumentException {
//checkAllArgumentsPresent();
try {
- DataResult newest = getSingleRecord(Order.DESC);
- DataResult oldest = getSingleRecord(Order.ASC);
+ SpQueryResult newest = getSingleRecord(Order.DESC);
+ SpQueryResult oldest = getSingleRecord(Order.ASC);
if (newest.getTotal() > 0) {
String sampleField = getSampleField(newest);
Integer count = getCount(sampleField);
@@ -97,21 +97,21 @@ public class AutoAggregationHandler {
countParams.update(QP_COUNT_ONLY, true);
countParams.update(QP_COLUMNS, fieldName);
- DataResult result = new DataLakeManagementV4().getData(countParams);
- return result.getTotal() > 0 ? ((Double) result.getRows().get(0).get(1)).intValue() : 0;
+ SpQueryResult result = new DataLakeManagementV4().getData(countParams);
+ return result.getTotal() > 0 ? result.getAllDataSeries().get(0).getTotal() : 0;
}
- private DataResult fireQuery(ProvidedQueryParams params) {
+ private SpQueryResult fireQuery(ProvidedQueryParams params) {
return dataLakeManagement.getData(params);
}
- private int getAggregationValue(DataResult newest, DataResult oldest) throws ParseException {
+ private int getAggregationValue(SpQueryResult newest, SpQueryResult oldest) throws ParseException {
long timerange = extractTimestamp(newest) - extractTimestamp(oldest);
double v = timerange / MAX_RETURN_LIMIT;
return Double.valueOf(v).intValue();
}
- private DataResult getSingleRecord(Order order) throws ParseException {
+ private SpQueryResult getSingleRecord(Order order) throws ParseException {
ProvidedQueryParams singleEvent = disableAutoAgg(new ProvidedQueryParams(queryParams));
singleEvent.remove(QP_AGGREGATION_FUNCTION);
singleEvent.update(QP_LIMIT, 1);
@@ -126,7 +126,7 @@ public class AutoAggregationHandler {
return columns.stream().map(SelectColumn::getOriginalField).collect(Collectors.joining(COMMA));
}
- private String getSampleField(DataResult result) {
+ private String getSampleField(SpQueryResult result) {
for (String column : result.getHeaders()) {
if (!column.equals(TIMESTAMP_FIELD)) {
return column;
@@ -135,9 +135,9 @@ public class AutoAggregationHandler {
throw new IllegalArgumentException("No columns present");
}
- private long extractTimestamp(DataResult result) throws ParseException {
+ private long extractTimestamp(SpQueryResult result) throws ParseException {
int timestampIndex = result.getHeaders().indexOf(TIMESTAMP_FIELD);
- return tryParseDate(result.getRows().get(0).get(timestampIndex).toString()).getTime();
+ return tryParseDate(result.getAllDataSeries().get(0).getRows().get(0).get(timestampIndex).toString()).getTime();
}
private Date tryParseDate(String v) throws ParseException {
diff --git a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/DataExplorerQueryV4.java b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/DataExplorerQueryV4.java
index fe0c337..46581e8 100644
--- a/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/DataExplorerQueryV4.java
+++ b/streampipes-data-explorer/src/main/java/org/apache/streampipes/dataexplorer/v4/query/DataExplorerQueryV4.java
@@ -23,7 +23,8 @@ import org.apache.streampipes.dataexplorer.utils.DataExplorerUtils;
import org.apache.streampipes.dataexplorer.v4.params.*;
import org.apache.streampipes.dataexplorer.v4.query.elements.*;
import org.apache.streampipes.dataexplorer.v4.utils.DataLakeManagementUtils;
-import org.apache.streampipes.model.datalake.DataResult;
+import org.apache.streampipes.model.datalake.DataSeries;
+import org.apache.streampipes.model.datalake.SpQueryResult;
import org.influxdb.InfluxDB;
import org.influxdb.dto.Query;
import org.influxdb.dto.QueryResult;
@@ -44,7 +45,7 @@ public class DataExplorerQueryV4 {
this.params = params;
}
- public DataResult executeQuery() throws RuntimeException {
+ public SpQueryResult executeQuery() throws RuntimeException {
InfluxDB influxDB = DataExplorerUtils.getInfluxDBClient();
List<QueryElement<?>> queryElements = getQueryElements();
@@ -54,21 +55,16 @@ public class DataExplorerQueryV4 {
QueryResult result = influxDB.query(query);
LOG.debug("Data Lake Query Result: " + result.toString());
- DataResult dataResult = postQuery(result);
+
+ // TODO Change result here
+ SpQueryResult dataResult = postQuery(result);
influxDB.close();
return dataResult;
}
- protected DataResult convertResult(QueryResult result) {
- if (result.getResults().get(0).getSeries() != null) {
- return convertResult(result.getResults().get(0).getSeries().get(0));
- } else {
- return new DataResult();
- }
- }
- protected DataResult convertResult(QueryResult.Series series) {
+ protected DataSeries convertResult(QueryResult.Series series) {
List<String> columns = series.getColumns();
List<List<Object>> values = series.getValues();
@@ -80,11 +76,21 @@ public class DataExplorerQueryV4 {
}
});
- return new DataResult(values.size(), columns, resultingValues);
+ return new DataSeries(values.size(), resultingValues, columns, series.getTags());
}
- protected DataResult postQuery(QueryResult result) throws RuntimeException {
- return convertResult(result);
+ protected SpQueryResult postQuery(QueryResult queryResult) throws RuntimeException {
+ SpQueryResult result = new SpQueryResult();
+
+ if (queryResult.getResults().get(0).getSeries() != null) {
+ result.setTotal(queryResult.getResults().get(0).getSeries().size());
+ queryResult.getResults().get(0).getSeries().forEach(rs -> {
+ DataSeries series = convertResult(rs);
+ result.setHeaders(series.getHeaders());
+ result.addDataResult(series);
+ });
+ }
+ return result;
}
protected List<QueryElement<?>> getQueryElements() {
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/DataResult.java b/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/DataSeries.java
similarity index 74%
copy from streampipes-model/src/main/java/org/apache/streampipes/model/datalake/DataResult.java
copy to streampipes-model/src/main/java/org/apache/streampipes/model/datalake/DataSeries.java
index 63a516e..14834ee 100644
--- a/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/DataResult.java
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/DataSeries.java
@@ -18,33 +18,44 @@
package org.apache.streampipes.model.datalake;
+import org.apache.streampipes.model.shared.annotation.TsModel;
+
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
-public class DataResult {
+@TsModel
+public class DataSeries {
private int total;
- private List<String> headers;
private List<List<Object>> rows;
+ private Map<String, String> tags;
+ private List<String> headers;
- public DataResult() {
+ public DataSeries() {
this.total = 0;
+ this.tags = new HashMap<>();
}
- public DataResult(int total, List<String> headers, List<List<Object>> rows) {
+ public DataSeries(int total, List<List<Object>> rows, List<String> headers, Map<String, String> tags) {
this.total = total;
- this.headers = headers;
this.rows = rows;
+ this.headers = headers;
+ this.tags = tags;
}
public int getTotal() {
return total;
}
+ public Map<String, String> getTags() {
+ return tags;
+ }
+
public List<String> getHeaders() {
return headers;
}
-
public List<List<Object>> getRows() {
return rows;
}
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/GroupedDataResult.java b/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/GroupedDataResult.java
deleted file mode 100644
index 9287ed8..0000000
--- a/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/GroupedDataResult.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.model.datalake;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class GroupedDataResult {
-
- private int total;
- private Map<String, DataResult> dataResults;
-
- public GroupedDataResult() {
- this.total = 0;
- this.dataResults = new HashMap<>();
- }
-
- public GroupedDataResult(int total, Map<String, DataResult> dataResults) {
- this.total = total;
- this.dataResults = dataResults;
- }
-
- public int getTotal() {
- return total;
- }
-
- public Map<String, DataResult> getDataResults() {
- return dataResults;
- }
-
- public void addDataResult(String index, DataResult dataResult) {
- if (dataResults == null) {
- dataResults = new HashMap<>();
- }
- dataResults.put(index, dataResult);
- this.total += 1;
- }
-}
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/PageResult.java b/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/PageResult.java
index a1721cd..be8b4c5 100644
--- a/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/PageResult.java
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/PageResult.java
@@ -18,16 +18,20 @@
package org.apache.streampipes.model.datalake;
+import org.apache.streampipes.model.shared.annotation.TsModel;
+
import java.util.List;
+import java.util.Map;
-public class PageResult extends DataResult {
+@TsModel
+public class PageResult extends DataSeries {
private int page;
private int pageSum;
- public PageResult(int total, List<String> headers, List<List<Object>> rows, int page, int pageSum) {
- super(total, headers, rows);
+ public PageResult(int total, List<String> headers, List<List<Object>> rows, int page, int pageSum, Map<String, String> tags) {
+ super(total, rows, headers, tags);
this.page = page;
this.pageSum = pageSum;
}
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/DataResult.java b/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/SpQueryResult.java
similarity index 53%
rename from streampipes-model/src/main/java/org/apache/streampipes/model/datalake/DataResult.java
rename to streampipes-model/src/main/java/org/apache/streampipes/model/datalake/SpQueryResult.java
index 63a516e..41b87af 100644
--- a/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/DataResult.java
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/datalake/SpQueryResult.java
@@ -18,35 +18,63 @@
package org.apache.streampipes.model.datalake;
+import org.apache.streampipes.model.shared.annotation.TsModel;
+
+import java.util.ArrayList;
import java.util.List;
-public class DataResult {
+@TsModel
+public class SpQueryResult {
private int total;
private List<String> headers;
- private List<List<Object>> rows;
+ private List<DataSeries> allDataSeries;
+ private int sourceIndex;
- public DataResult() {
+ public SpQueryResult() {
this.total = 0;
+ this.allDataSeries = new ArrayList<>();
}
- public DataResult(int total, List<String> headers, List<List<Object>> rows) {
+ public SpQueryResult(int total, List<String> headers, List<DataSeries> allDataSeries) {
this.total = total;
+ this.allDataSeries = allDataSeries;
this.headers = headers;
- this.rows = rows;
}
public int getTotal() {
return total;
}
+ public void addDataResult(DataSeries dataSeries) {
+ if (this.allDataSeries == null) {
+ this.allDataSeries = new ArrayList<>();
+ }
+
+ this.allDataSeries.add(dataSeries);
+ }
+
+ public List<DataSeries> getAllDataSeries() {
+ return allDataSeries;
+ }
+
public List<String> getHeaders() {
return headers;
}
+ public void setHeaders(List<String> headers) {
+ this.headers = headers;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
- public List<List<Object>> getRows() {
- return rows;
+ public int getSourceIndex() {
+ return sourceIndex;
}
+ public void setSourceIndex(int sourceIndex) {
+ this.sourceIndex = sourceIndex;
+ }
}
diff --git a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV3.java b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV3.java
index d8d814c..cec4966 100644
--- a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV3.java
+++ b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV3.java
@@ -18,59 +18,54 @@
package org.apache.streampipes.ps;
-import org.apache.streampipes.dataexplorer.DataLakeManagementV3;
import org.apache.streampipes.dataexplorer.utils.DataExplorerUtils;
import org.apache.streampipes.model.datalake.DataLakeMeasure;
-import org.apache.streampipes.model.datalake.DataResult;
-import org.apache.streampipes.model.datalake.GroupedDataResult;
-import org.apache.streampipes.model.datalake.PageResult;
-import org.apache.streampipes.model.message.Notification;
import org.apache.streampipes.rest.impl.AbstractRestResource;
-import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
-import javax.ws.rs.*;
-import javax.ws.rs.core.*;
-import java.io.IOException;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
import java.util.List;
@Path("/v3/users/{username}/datalake")
public class DataLakeResourceV3 extends AbstractRestResource {
- private DataLakeManagementV3 dataLakeManagement;
-
+// private DataLakeManagementV3 dataLakeManagement;
+//
public DataLakeResourceV3() {
- this.dataLakeManagement = new DataLakeManagementV3();
- }
-
- public DataLakeResourceV3(DataLakeManagementV3 dataLakeManagement) {
- this.dataLakeManagement = dataLakeManagement;
- }
-
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- @GsonWithIds
- @Path("/data/{index}/paging")
- public Response getPage(@PathParam("index") String index,
- @Context UriInfo info,
- @QueryParam("itemsPerPage") int itemsPerPage) {
-
- PageResult result;
- String page = info.getQueryParameters().getFirst("page");
-
- try {
- if (page != null) {
- result = this.dataLakeManagement.getEvents(index, itemsPerPage, Integer.parseInt(page));
- } else {
- result = this.dataLakeManagement.getEvents(index, itemsPerPage);
- }
- return Response.ok(result).build();
- } catch (IOException e) {
- e.printStackTrace();
-
- return Response.serverError().build();
- }
}
-
+//
+// public DataLakeResourceV3(DataLakeManagementV3 dataLakeManagement) {
+// this.dataLakeManagement = dataLakeManagement;
+// }
+//
+//// @GET
+//// @Produces(MediaType.APPLICATION_JSON)
+//// @GsonWithIds
+//// @Path("/data/{index}/paging")
+//// public Response getPage(@PathParam("index") String index,
+//// @Context UriInfo info,
+//// @QueryParam("itemsPerPage") int itemsPerPage) {
+////
+//// PageResult result;
+//// String page = info.getQueryParameters().getFirst("page");
+////
+//// try {
+//// if (page != null) {
+//// result = this.dataLakeManagement.getEvents(index, itemsPerPage, Integer.parseInt(page));
+//// } else {
+//// result = this.dataLakeManagement.getEvents(index, itemsPerPage);
+//// }
+//// return Response.ok(result).build();
+//// } catch (IOException e) {
+//// e.printStackTrace();
+////
+//// return Response.serverError().build();
+//// }
+//// }
+//
@GET
@JacksonSerialized
@Produces(MediaType.APPLICATION_JSON)
@@ -79,166 +74,168 @@ public class DataLakeResourceV3 extends AbstractRestResource {
List<DataLakeMeasure> result = DataExplorerUtils.getInfos();
return ok(result);
}
-
- @Deprecated
- @GET
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
- @Path("/data/{index}")
- public Response getAllData(@PathParam("index") String index,
- @QueryParam("format") String format) {
- StreamingOutput streamingOutput = output -> dataLakeManagement.getAllEvents(index, format, output);
-
- return Response.ok(streamingOutput, MediaType.APPLICATION_OCTET_STREAM).
- header("Content-Disposition", "attachment; filename=\"datalake." + format + "\"")
- .build();
- }
-
- @GET
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
- @Path("/data/{index}/download")
- public Response downloadData(@PathParam("index") String index,
- @QueryParam("format") String format) {
- StreamingOutput streamingOutput = output -> dataLakeManagement.getAllEvents(index, format, output);
-
- return Response.ok(streamingOutput, MediaType.APPLICATION_OCTET_STREAM).
- header("Content-Disposition", "attachment; filename=\"datalake." + format + "\"")
- .build();
- }
-
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/data/{index}/last/{value}/{unit}")
- public Response getAllData(@PathParam("index") String index,
- @PathParam("value") int value,
- @PathParam("unit") String unit,
- @Context UriInfo info) {
-
-
- String aggregationUnit = info.getQueryParameters().getFirst("aggregationUnit");
- String aggregationValue = info.getQueryParameters().getFirst("aggregationValue");
-
- DataResult result;
- try {
- if (aggregationUnit != null && aggregationValue != null) {
- result = dataLakeManagement.getEventsFromNow(index, unit, value, aggregationUnit,
- Integer.parseInt(aggregationValue));
- } else {
- result = dataLakeManagement.getEventsFromNowAutoAggregation(index, unit, value);
- }
- return Response.ok(result).build();
- } catch (RuntimeException e) {
- return constructErrorMessage(new Notification(e.getMessage(), ""));
- }
- }
-
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/data/{index}/{startdate}/{enddate}")
- public Response getAllData(@Context UriInfo info,
- @PathParam("index") String index,
- @PathParam("startdate") long startdate,
- @PathParam("enddate") long enddate) {
-
- String aggregationUnit = info.getQueryParameters().getFirst("aggregationUnit");
- String aggregationValue = info.getQueryParameters().getFirst("aggregationValue");
-
- DataResult result;
-
- try {
- if (aggregationUnit != null && aggregationValue != null) {
- result = dataLakeManagement.getEvents(index, startdate, enddate, aggregationUnit,
- Integer.parseInt(aggregationValue));
-
- } else {
- result = dataLakeManagement.getEventsAutoAggregation(index, startdate, enddate);
- }
- return Response.ok(result).build();
- } catch (RuntimeException e) {
- return constructErrorMessage(new Notification(e.getMessage(), ""));
- }
- }
-
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/data/{index}/{startdate}/{enddate}/grouping/{groupingTag}")
- public Response getAllDataGrouping(@Context UriInfo info,
- @PathParam("index") String index,
- @PathParam("startdate") long startdate,
- @PathParam("enddate") long enddate,
- @PathParam("groupingTag") String groupingTag) {
-
- String aggregationUnit = info.getQueryParameters().getFirst("aggregationUnit");
- String aggregationValue = info.getQueryParameters().getFirst("aggregationValue");
-
- GroupedDataResult result;
- try {
- if (aggregationUnit != null && aggregationValue != null) {
- result = dataLakeManagement.getEvents(index, startdate, enddate, aggregationUnit,
- Integer.parseInt(aggregationValue), groupingTag);
- } else {
- result = dataLakeManagement.getEventsAutoAggregation(index, startdate, enddate, groupingTag);
- }
- return Response.ok(result).build();
- } catch (RuntimeException e) {
- return constructErrorMessage(new Notification(e.getMessage(), ""));
- }
- }
-
- @DELETE
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/data/delete/all")
- public Response removeAllData() {
-
- boolean result = dataLakeManagement.removeAllDataFromDataLake();
-
- return Response.ok(result).build();
- }
-
- @GET
- @Produces(MediaType.APPLICATION_OCTET_STREAM)
- @Path("/data/{index}/{startdate}/{enddate}/download")
- public Response downloadData(@PathParam("index") String index, @QueryParam("format") String format,
- @PathParam("startdate") long start, @PathParam("enddate") long end) {
- StreamingOutput streamingOutput = output -> dataLakeManagement.getAllEvents(index, format, start, end, output);
-
- return Response.ok(streamingOutput, MediaType.APPLICATION_OCTET_STREAM).
- header("Content-Disposition", "attachment; filename=\"datalake." + format + "\"")
- .build();
- }
-
- @GET
- @Path("/data/image/{route}/file")
- @Produces("image/png")
- public Response getImage(@PathParam("route") String fileRoute) throws IOException {
- return ok(dataLakeManagement.getImage(fileRoute));
- }
-
- @POST
- @Path("/data/image/{route}/coco")
- public void saveImageCoco(@PathParam("route") String fileRoute, String data) throws IOException {
- dataLakeManagement.saveImageCoco(fileRoute, data);
- }
-
- @GET
- @Path("/data/image/{route}/coco")
- @Produces("application/json")
- public Response getImageCoco(@PathParam("route") String fileRoute) throws IOException {
- return ok(dataLakeManagement.getImageCoco(fileRoute));
- }
-
- @POST
- @Produces(MediaType.TEXT_PLAIN)
- @Path("/data/{index}/{startdate}/{enddate}/labeling/{column}/{timestampColumn}")
- public Response labelData(@Context UriInfo info,
- @PathParam("index") String index,
- @PathParam("startdate") long startdate,
- @PathParam("enddate") long enddate,
- @PathParam("column") String column,
- @PathParam("timestampColumn") String timestampColumn) {
-
- String label = info.getQueryParameters().getFirst("label");
- this.dataLakeManagement.updateLabels(index, column, startdate, enddate, label, timestampColumn);
-
- return Response.ok("Successfully updated database.", MediaType.TEXT_PLAIN).build();
- }
+//
+// @Deprecated
+// @GET
+// @Produces(MediaType.APPLICATION_OCTET_STREAM)
+// @Path("/data/{index}")
+// public Response getAllData(@PathParam("index") String index,
+// @QueryParam("format") String format) {
+// StreamingOutput streamingOutput = output -> dataLakeManagement.getAllEvents(index, format, output);
+//
+// return Response.ok(streamingOutput, MediaType.APPLICATION_OCTET_STREAM).
+// header("Content-Disposition", "attachment; filename=\"datalake." + format + "\"")
+// .build();
+// }
+//
+// @GET
+// @Produces(MediaType.APPLICATION_OCTET_STREAM)
+// @Path("/data/{index}/download")
+// public Response downloadData(@PathParam("index") String index,
+// @QueryParam("format") String format) {
+// StreamingOutput streamingOutput = output -> dataLakeManagement.getAllEvents(index, format, output);
+//
+// return Response.ok(streamingOutput, MediaType.APPLICATION_OCTET_STREAM).
+// header("Content-Disposition", "attachment; filename=\"datalake." + format + "\"")
+// .build();
+// }
+//
+// @GET
+// @Produces(MediaType.APPLICATION_JSON)
+// @Path("/data/{index}/last/{value}/{unit}")
+// public Response getAllData(@PathParam("index") String index,
+// @PathParam("value") int value,
+// @PathParam("unit") String unit,
+// @Context UriInfo info) {
+//
+//
+// String aggregationUnit = info.getQueryParameters().getFirst("aggregationUnit");
+// String aggregationValue = info.getQueryParameters().getFirst("aggregationValue");
+//
+// DataSeries result;
+// try {
+// if (aggregationUnit != null && aggregationValue != null) {
+// result = dataLakeManagement.getEventsFromNow(index, unit, value, aggregationUnit,
+// Integer.parseInt(aggregationValue));
+// } else {
+// result = dataLakeManagement.getEventsFromNowAutoAggregation(index, unit, value);
+// }
+// return Response.ok(result).build();
+// } catch (RuntimeException e) {
+// return constructErrorMessage(new Notification(e.getMessage(), ""));
+// }
+// }
+//
+// @GET
+// @Produces(MediaType.APPLICATION_JSON)
+// @Path("/data/{index}/{startdate}/{enddate}")
+// public Response getAllData(@Context UriInfo info,
+// @PathParam("index") String index,
+// @PathParam("startdate") long startdate,
+// @PathParam("enddate") long enddate) {
+//
+// String aggregationUnit = info.getQueryParameters().getFirst("aggregationUnit");
+// String aggregationValue = info.getQueryParameters().getFirst("aggregationValue");
+//
+// DataSeries result;
+//
+// try {
+// if (aggregationUnit != null && aggregationValue != null) {
+// result = dataLakeManagement.getEvents(index, startdate, enddate, aggregationUnit,
+// Integer.parseInt(aggregationValue));
+//
+// } else {
+// result = dataLakeManagement.getEventsAutoAggregation(index, startdate, enddate);
+// }
+// return Response.ok(result).build();
+// } catch (RuntimeException e) {
+// return constructErrorMessage(new Notification(e.getMessage(), ""));
+// }
+// }
+//
+// @GET
+// @Produces(MediaType.APPLICATION_JSON)
+// @Path("/data/{index}/{startdate}/{enddate}/grouping/{groupingTag}")
+// public Response getAllDataGrouping(@Context UriInfo info,
+// @PathParam("index") String index,
+// @PathParam("startdate") long startdate,
+// @PathParam("enddate") long enddate,
+// @PathParam("groupingTag") String groupingTag) {
+//
+// String aggregationUnit = info.getQueryParameters().getFirst("aggregationUnit");
+// String aggregationValue = info.getQueryParameters().getFirst("aggregationValue");
+//
+// SPQueryResult result;
+// try {
+// if (aggregationUnit != null && aggregationValue != null) {
+// result = dataLakeManagement.getEvents(index, startdate, enddate, aggregationUnit,
+// Integer.parseInt(aggregationValue), groupingTag);
+// } else {
+// result = dataLakeManagement.getEventsAutoAggregation(index, startdate, enddate, groupingTag);
+// }
+// return Response.ok(result).build();
+// } catch (RuntimeException e) {
+// return constructErrorMessage(new Notification(e.getMessage(), ""));
+// }
+// }
+//
+// @DELETE
+// @Produces(MediaType.APPLICATION_JSON)
+// @Path("/data/delete/all")
+// public Response removeAllData() {
+//
+// boolean result = dataLakeManagement.removeAllDataFromDataLake();
+//
+// return Response.ok(result).build();
+// }
+//
+// @GET
+// @Produces(MediaType.APPLICATION_OCTET_STREAM)
+// @Path("/data/{index}/{startdate}/{enddate}/download")
+// public Response downloadData(@PathParam("index") String index, @QueryParam("format") String format,
+// @PathParam("startdate") long start, @PathParam("enddate") long end) {
+// StreamingOutput streamingOutput = output -> dataLakeManagement.getAllEvents(index, format, start, end, output);
+//
+// return Response.ok(streamingOutput, MediaType.APPLICATION_OCTET_STREAM).
+// header("Content-Disposition", "attachment; filename=\"datalake." + format + "\"")
+// .build();
+// }
+//
+// @GET
+// @Path("/data/image/{route}/file")
+// @Produces("image/png")
+// public Response getImage(@PathParam("route") String fileRoute) throws IOException {
+// return ok(dataLakeManagement.getImage(fileRoute));
+// }
+//
+// @POST
+// @Path("/data/image/{route}/coco")
+// public void saveImageCoco(@PathParam("route") String fileRoute, String data) throws IOException {
+// dataLakeManagement.saveImageCoco(fileRoute, data);
+// }
+//
+// @GET
+// @Path("/data/image/{route}/coco")
+// @Produces("application/json")
+// public Response getImageCoco(@PathParam("route") String fileRoute) throws IOException {
+// return ok(dataLakeManagement.getImageCoco(fileRoute));
+// }
+//
+// @POST
+// @Produces(MediaType.TEXT_PLAIN)
+// @Path("/data/{index}/{startdate}/{enddate}/labeling/{column}/{timestampColumn}")
+// public Response labelData(@Context UriInfo info,
+// @PathParam("index") String index,
+// @PathParam("startdate") long startdate,
+// @PathParam("enddate") long enddate,
+// @PathParam("column") String column,
+// @PathParam("timestampColumn") String timestampColumn) {
+//
+// String label = info.getQueryParameters().getFirst("label");
+// this.dataLakeManagement.updateLabels(index, column, startdate, enddate, label, timestampColumn);
+//
+// return Response.ok("Successfully updated database.", MediaType.TEXT_PLAIN).build();
+// }
+//
+//
}
diff --git a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java
index 1589b4f..05b3d8d 100644
--- a/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java
+++ b/streampipes-platform-services/src/main/java/org/apache/streampipes/ps/DataLakeResourceV4.java
@@ -29,7 +29,8 @@ import org.apache.streampipes.dataexplorer.DataLakeManagementV4;
import org.apache.streampipes.dataexplorer.v4.ProvidedQueryParams;
import org.apache.streampipes.model.datalake.DataLakeConfiguration;
import org.apache.streampipes.model.datalake.DataLakeMeasure;
-import org.apache.streampipes.model.datalake.DataResult;
+import org.apache.streampipes.model.datalake.DataSeries;
+import org.apache.streampipes.model.datalake.SpQueryResult;
import org.apache.streampipes.rest.impl.AbstractRestResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -84,7 +85,7 @@ public class DataLakeResourceV4 extends AbstractRestResource {
, @Parameter(in = ParameterIn.QUERY, description = "start date for slicing operation") @QueryParam("startDate") Long startDate
, @Parameter(in = ParameterIn.QUERY, description = "end date for slicing operation") @QueryParam("endDate") Long endDate) {
- DataResult result = this.dataLakeManagement.deleteData(measurementID, startDate, endDate);
+ SpQueryResult result = this.dataLakeManagement.deleteData(measurementID, startDate, endDate);
return ok();
}
@@ -129,7 +130,7 @@ public class DataLakeResourceV4 extends AbstractRestResource {
@Operation(summary = "Get data from a single measurement series by a given id", tags = {"Data Lake"},
responses = {
@ApiResponse(responseCode = "400", description = "Measurement series with given id and requested query specification not found"),
- @ApiResponse(responseCode = "200", description = "requested data", content = @Content(schema = @Schema(implementation = DataResult.class)))})
+ @ApiResponse(responseCode = "200", description = "requested data", content = @Content(schema = @Schema(implementation = DataSeries.class)))})
public Response getData(@Parameter(in = ParameterIn.PATH, description = "username", required = true) @PathParam("username") String username
, @Parameter(in = ParameterIn.PATH, description = "the id of the measurement series", required = true) @PathParam("measurementID") String measurementID
, @Parameter(in = ParameterIn.QUERY, description = "the columns to be selected (comma-separated)") @QueryParam(QP_COLUMNS) String columns
@@ -154,7 +155,7 @@ public class DataLakeResourceV4 extends AbstractRestResource {
} else {
ProvidedQueryParams sanitizedParams = populate(measurementID, queryParams);
try {
- DataResult result = this.dataLakeManagement.getData(sanitizedParams);
+ SpQueryResult result = this.dataLakeManagement.getData(sanitizedParams);
return ok(result);
} catch (IllegalArgumentException e) {
return badRequest(e.getMessage());
@@ -168,7 +169,7 @@ public class DataLakeResourceV4 extends AbstractRestResource {
@Operation(summary = "Download data from a single measurement series by a given id", tags = {"Data Lake"},
responses = {
@ApiResponse(responseCode = "400", description = "Measurement series with given id and requested query specification not found"),
- @ApiResponse(responseCode = "200", description = "requested data", content = @Content(schema = @Schema(implementation = DataResult.class)))})
+ @ApiResponse(responseCode = "200", description = "requested data", content = @Content(schema = @Schema(implementation = DataSeries.class)))})
public Response downloadData(@Parameter(in = ParameterIn.PATH, description = "username", required = true) @PathParam("username") String username
, @Parameter(in = ParameterIn.PATH, description = "the id of the measurement series", required = true) @PathParam("measurementID") String measurementID
, @Parameter(in = ParameterIn.QUERY, description = "the columns to be selected (comma-separated)") @QueryParam(QP_COLUMNS) String columns
diff --git a/ui/cypress/support/utils/UserUtils.ts b/ui/cypress/support/utils/UserUtils.ts
index d22a751..b9b26e2 100644
--- a/ui/cypress/support/utils/UserUtils.ts
+++ b/ui/cypress/support/utils/UserUtils.ts
@@ -18,5 +18,5 @@
export class UserUtils {
public static testUserName = 'test@streampipes.apache.org';
- public static testUserPassword = 'test1234';
+ public static testUserPassword = '1234';
}
diff --git a/ui/src/app/app-image-labeling/app-image-labeling.component.ts b/ui/src/app/app-image-labeling/app-image-labeling.component.ts
index a7f4415..4fbb53c 100644
--- a/ui/src/app/app-image-labeling/app-image-labeling.component.ts
+++ b/ui/src/app/app-image-labeling/app-image-labeling.component.ts
@@ -17,17 +17,15 @@
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { DatalakeRestService } from '../core-services/datalake/datalake-rest.service';
-import { DataLakeMeasure, EventPropertyUnion, EventSchema } from '../core-model/gen/streampipes-model';
-import { CocoFormat } from '../core-model/coco/Coco.format';
-import { DataResult } from '../core-model/datalake/DataResult';
+import { DataLakeMeasure, EventPropertyUnion, EventSchema, SpQueryResult } from '../core-model/gen/streampipes-model';
import { DateRange } from '../core-model/datalake/DateRange';
@Component({
- selector: 'app-image-labeling',
- templateUrl: './app-image-labeling.component.html',
- styleUrls: ['./app-image-labeling.component.css']
+ selector: 'app-image-labeling',
+ templateUrl: './app-image-labeling.component.html',
+ styleUrls: ['./app-image-labeling.component.css']
})
-export class AppImageLabelingComponent implements OnInit {
+export class AppImageLabelingComponent implements OnInit {
public imagesRoutes = [];
@@ -44,13 +42,13 @@ export class AppImageLabelingComponent implements OnInit {
}
ngOnInit() {
- this.appOpened.emit(true);
- this.restService.getAllInfos().subscribe(res => {
- this.dataLakeMeasures = res;
- this.selectedMeasure = res[0];
- this.updateData();
- }
- );
+ // this.appOpened.emit(true);
+ // this.restService.getAllInfos().subscribe(res => {
+ // this.dataLakeMeasures = res;
+ // this.selectedMeasure = res[0];
+ // this.updateData();
+ // }
+ // );
}
changeMeasure(newMeasure) {
@@ -65,17 +63,17 @@ export class AppImageLabelingComponent implements OnInit {
this.dataLakeRestService.getDataAutoAggregation(
this.selectedMeasure.measureName, dateRange.startDate.getTime(), dateRange.endDate.getTime())
.subscribe(
- (res: DataResult) => {
+ (res: SpQueryResult) => {
- this.imageProperty = this.getImageProperties(this.selectedMeasure.eventSchema)[0].runtimeName;
+ const series = res.allDataSeries[0];
+ this.imageProperty = this.getImageProperties(this.selectedMeasure.eventSchema)[0].runtimeName;
// this.availableImageData = res;
this.imagesRoutes = [];
- if (res.rows !== null) {
+ if (series.rows !== null) {
const imageField = res.headers.findIndex(name => name === this.imageProperty);
- res.rows.forEach(row => {
+ series.rows.forEach(row => {
this.imagesRoutes.push(row[imageField]);
});
-
}
}
);
diff --git a/ui/src/app/configuration/datalake-configuration/datalake-configuration.component.ts b/ui/src/app/configuration/datalake-configuration/datalake-configuration.component.ts
index 71c7b7a..2c92fdb 100644
--- a/ui/src/app/configuration/datalake-configuration/datalake-configuration.component.ts
+++ b/ui/src/app/configuration/datalake-configuration/datalake-configuration.component.ts
@@ -30,6 +30,7 @@ import { PanelType } from '../../core-ui/dialog/base-dialog/base-dialog.model';
import { DialogService } from '../../core-ui/dialog/base-dialog/base-dialog.service';
import { DeleteDatalakeIndexComponent } from '../dialog/delete-datalake-index/delete-datalake-index-dialog.component';
import { FieldConfig } from '../../data-explorer/models/dataview-dashboard.model';
+import { SpQueryResult } from '../../core-model/gen/streampipes-model';
@Component({
selector: 'sp-datalake-configuration',
@@ -82,8 +83,11 @@ export class DatalakeConfigurationComponent implements OnInit {
const field: FieldConfig = { runtimeName: property.runtimeName, aggregations: ['COUNT'], selected: true, numeric: false };
this.datalakeRestService.getData(
measurement.measureName,
- this.buildQ(field)).subscribe(res => {
- res.rows !== null ? entry.events = res.rows[0][1] : entry.events = 0;
+ this.buildQ(field)).subscribe((res: SpQueryResult) => {
+ entry.events = 0;
+ res.allDataSeries.forEach(series => {
+ entry.events = entry.events + series.total;
+ });
});
this.availableMeasurements.push(entry);
diff --git a/ui/src/app/core-model/datalake/DataResult.ts b/ui/src/app/core-model/datalake/DataResult.ts
deleted file mode 100644
index c142be1..0000000
--- a/ui/src/app/core-model/datalake/DataResult.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-export class DataResult {
- sourceIndex: number;
- measureName: string;
- total: number;
- headers: string[];
- rows: any[];
- labels: string[];
-}
diff --git a/ui/src/app/core-model/datalake/GroupedDataResult.ts b/ui/src/app/core-model/datalake/GroupedDataResult.ts
deleted file mode 100644
index 977ab92..0000000
--- a/ui/src/app/core-model/datalake/GroupedDataResult.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-import {DataResult} from './DataResult';
-
-export class GroupedDataResult {
- total: number;
- dataResults: Map<string, DataResult>;
-}
\ No newline at end of file
diff --git a/ui/src/app/core-model/gen/streampipes-model.ts b/ui/src/app/core-model/gen/streampipes-model.ts
index 83e24e3..d8b4904 100644
--- a/ui/src/app/core-model/gen/streampipes-model.ts
+++ b/ui/src/app/core-model/gen/streampipes-model.ts
@@ -19,7 +19,7 @@
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
-// Generated using typescript-generator version 2.27.744 on 2021-09-16 14:42:05.
+// Generated using typescript-generator version 2.27.744 on 2021-09-24 15:10:23.
export class AbstractStreamPipesEntity {
'@class': 'org.apache.streampipes.model.base.AbstractStreamPipesEntity' | 'org.apache.streampipes.model.base.NamedStreamPipesEntity' | 'org.apache.streampipes.model.connect.adapter.AdapterDescription' | 'org.apache.streampipes.model.connect.adapter.AdapterSetDescription' | 'org.apache.streampipes.model.connect.adapter.GenericAdapterSetDescription' | 'org.apache.streampipes.model.connect.adapter.SpecificAdapterSetDescription' | 'org.apache.streampipes.model.connect.adapter.AdapterStream [...]
@@ -1049,6 +1049,25 @@ export class DataProcessorType {
}
}
+export class DataSeries {
+ headers: string[];
+ rows: any[][];
+ tags: { [index: string]: string };
+ total: number;
+
+ static fromData(data: DataSeries, target?: DataSeries): DataSeries {
+ if (!data) {
+ return data;
+ }
+ const instance = target || new DataSeries();
+ instance.total = data.total;
+ instance.rows = __getCopyArrayFn(__getCopyArrayFn(__identity<any>()))(data.rows);
+ instance.tags = __getCopyObjectFn(__identity<string>())(data.tags);
+ instance.headers = __getCopyArrayFn(__identity<string>())(data.headers);
+ return instance;
+ }
+}
+
export class Message {
elementName: string;
notifications: Notification[];
@@ -2061,6 +2080,22 @@ export class Option extends UnnamedStreamPipesEntity {
}
}
+export class PageResult extends DataSeries {
+ page: number;
+ pageSum: number;
+
+ static fromData(data: PageResult, target?: PageResult): PageResult {
+ if (!data) {
+ return data;
+ }
+ const instance = target || new PageResult();
+ super.fromData(data, instance);
+ instance.page = data.page;
+ instance.pageSum = data.pageSum;
+ return instance;
+ }
+}
+
export class PersistedDataStream {
measureName: string;
pipelineId: string;
@@ -2769,8 +2804,27 @@ export class SpDataSet extends SpDataStream {
instance.datasetInvocationId = data.datasetInvocationId;
instance.correspondingPipeline = data.correspondingPipeline;
instance.selectedEndpointUrl = data.selectedEndpointUrl;
- instance.brokerHostname = data.brokerHostname;
instance.actualTopicName = data.actualTopicName;
+ instance.brokerHostname = data.brokerHostname;
+ return instance;
+ }
+}
+
+export class SpQueryResult {
+ allDataSeries: DataSeries[];
+ headers: string[];
+ sourceIndex: number;
+ total: number;
+
+ static fromData(data: SpQueryResult, target?: SpQueryResult): SpQueryResult {
+ if (!data) {
+ return data;
+ }
+ const instance = target || new SpQueryResult();
+ instance.total = data.total;
+ instance.headers = __getCopyArrayFn(__identity<string>())(data.headers);
+ instance.allDataSeries = __getCopyArrayFn(DataSeries.fromData)(data.allDataSeries);
+ instance.sourceIndex = data.sourceIndex;
return instance;
}
}
diff --git a/ui/src/app/core-services/datalake/DatalakeQueryParameterBuilder.ts b/ui/src/app/core-services/datalake/DatalakeQueryParameterBuilder.ts
index be91ef9..d104d7b 100644
--- a/ui/src/app/core-services/datalake/DatalakeQueryParameterBuilder.ts
+++ b/ui/src/app/core-services/datalake/DatalakeQueryParameterBuilder.ts
@@ -17,10 +17,7 @@
*/
import { DatalakeQueryParameters } from './DatalakeQueryParameters';
-import {
- DataExplorerField,
- FieldConfig, SelectedFilter
-} from '../../data-explorer/models/dataview-dashboard.model';
+import { FieldConfig, SelectedFilter } from '../../data-explorer/models/dataview-dashboard.model';
export class DatalakeQueryParameterBuilder {
@@ -65,15 +62,9 @@ export class DatalakeQueryParameterBuilder {
return this;
}
- public withGrouping(groupBy: string,
- aggregationFunction: string,
- aggregationTimeUnit: string,
- aggregationTimeValue: number): DatalakeQueryParameterBuilder {
-
- this.queryParams.groupBy = groupBy;
- this.queryParams.aggregationFunction = aggregationFunction;
- this.queryParams.timeInterval = aggregationTimeValue + aggregationTimeUnit;
-
+ public withGrouping(groupBy: FieldConfig[]): DatalakeQueryParameterBuilder {
+ const groupByRuntimeNames = groupBy.map(property => property.runtimeName);
+ this.queryParams.groupBy = groupByRuntimeNames.toString();
return this;
}
@@ -114,13 +105,13 @@ export class DatalakeQueryParameterBuilder {
} else {
column.aggregations.forEach(agg => {
finalColumns.push('['
- + column.runtimeName
- + ';'
- + agg
- + ';'
- + agg.toLowerCase()
- + '_'
- + column.runtimeName + ']');
+ + column.runtimeName
+ + ';'
+ + agg
+ + ';'
+ + agg.toLowerCase()
+ + '_'
+ + column.runtimeName + ']');
});
}
});
diff --git a/ui/src/app/core-services/datalake/datalake-rest.service.ts b/ui/src/app/core-services/datalake/datalake-rest.service.ts
index 15652ab..57d8e27 100644
--- a/ui/src/app/core-services/datalake/datalake-rest.service.ts
+++ b/ui/src/app/core-services/datalake/datalake-rest.service.ts
@@ -16,14 +16,11 @@
*
*/
-import { HttpClient, HttpParams, HttpRequest } from '@angular/common/http';
+import { HttpClient, HttpRequest } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
-import { DataResult } from '../../core-model/datalake/DataResult';
-import { GroupedDataResult } from '../../core-model/datalake/GroupedDataResult';
-import { PageResult } from '../../core-model/datalake/PageResult';
import { AuthStatusService } from '../../services/auth-status.service';
-import { DataLakeMeasure } from '../../core-model/gen/streampipes-model';
+import { DataLakeMeasure, SpQueryResult } from '../../core-model/gen/streampipes-model';
import { map } from 'rxjs/operators';
import { DatalakeQueryParameters } from './DatalakeQueryParameters';
@@ -58,11 +55,11 @@ export class DatalakeRestService {
}));
}
- getData(index, startDate, endDate, aggregationTimeUnit, aggregationValue): Observable<DataResult> {
+ getData(index, startDate, endDate, aggregationTimeUnit, aggregationValue): Observable<SpQueryResult> {
const timeInterval = aggregationValue + aggregationTimeUnit;
const url = this.dataLakeUrlV4 + '/measurements/' + index;
- const queryParams: DatalakeQueryParameters = this.getQueryParameter(
+ const queryParams: DatalakeQueryParameters = this.getQueryParameter(
startDate,
endDate,
undefined,
@@ -76,18 +73,18 @@ export class DatalakeRestService {
);
// @ts-ignore
- return this.http.get<DataResult>(url, {
+ return this.http.get<SpQueryResult>(url, {
// @ts-ignore
- params: queryParams,
+ params: queryParams
});
}
- getGroupedData(index, startDate, endDate, aggregationTimeUnit, aggregationValue, groupingTag): Observable<DataResult> {
+ getGroupedData(index, startDate, endDate, aggregationTimeUnit, aggregationValue, groupingTag): Observable<SpQueryResult> {
const timeInterval = aggregationValue + aggregationTimeUnit;
const url = this.dataLakeUrlV4 + '/measurements/' + index;
- const queryParams: DatalakeQueryParameters = this.getQueryParameter(
+ const queryParams: DatalakeQueryParameters = this.getQueryParameter(
startDate,
endDate,
undefined,
@@ -103,18 +100,18 @@ export class DatalakeRestService {
// @ts-ignore
return this.http.get<GroupedDataResult>(url, {
// @ts-ignore
- params: queryParams,
+ params: queryParams
});
}
getDataAutoAggregation(index, startDate, endDate) {
- return this.http.get<DataResult>(this.dataLakeUrlV3 + '/data/' + index + '/' + startDate + '/' + endDate);
+ return this.http.get<SpQueryResult>(this.dataLakeUrlV3 + '/data/' + index + '/' + startDate + '/' + endDate);
}
downloadRawData(index, format) {
const url = this.dataLakeUrlV4 + '/measurements/' + index + '/download?format=' + format;
- const request = new HttpRequest('GET', url, {
+ const request = new HttpRequest('GET', url, {
reportProgress: true,
responseType: 'text'
});
@@ -126,7 +123,7 @@ export class DatalakeRestService {
const url = this.dataLakeUrlV4 + '/measurements/' + index + '/download?format=' + format +
'&startDate=' + startDate + '&endDate=' + endDate;
- const request = new HttpRequest('GET', url, {
+ const request = new HttpRequest('GET', url, {
reportProgress: true,
responseType: 'text'
});
@@ -136,7 +133,7 @@ export class DatalakeRestService {
getDataPage(index, itemsPerPage, page) {
const url = this.dataLakeUrlV4 + '/measurements/' + index;
- const queryParams: DatalakeQueryParameters = this.getQueryParameter(
+ const queryParams: DatalakeQueryParameters = this.getQueryParameter(
undefined,
undefined,
undefined,
@@ -150,16 +147,16 @@ export class DatalakeRestService {
);
// @ts-ignore
- return this.http.get<DataResult>(url, {
+ return this.http.get<SpQueryResult>(url, {
// @ts-ignore
- params: queryParams,
+ params: queryParams
});
}
getDataPageWithoutPage(index, itemsPerPage) {
const url = this.dataLakeUrlV4 + '/measurements/' + index;
- const queryParams: DatalakeQueryParameters = this.getQueryParameter(
+ const queryParams: DatalakeQueryParameters = this.getQueryParameter(
undefined,
undefined,
undefined,
@@ -173,11 +170,12 @@ export class DatalakeRestService {
);
// @ts-ignore
- return this.http.get<DataResult>(url, {
+ return this.http.get<SpQueryResult>(url, {
// @ts-ignore
- params: queryParams,
+ params: queryParams
});
}
+
getImageUrl(imageRoute) {
return this.dataLakeUrlV3 + '/data/image/' + imageRoute + '/file';
}
@@ -196,7 +194,7 @@ export class DatalakeRestService {
saveLabelsInDatabase(index, labelColumn, startDate, endDate, label, timestampColumn) {
const request = new HttpRequest('POST', this.dataLakeUrlV3 + '/data/' + index + '/' + startDate + '/' +
- endDate + '/labeling/' + labelColumn + '/' + timestampColumn + '?label=' + label , {}, {
+ endDate + '/labeling/' + labelColumn + '/' + timestampColumn + '?label=' + label, {}, {
reportProgress: true,
responseType: 'text'
});
diff --git a/ui/src/app/core-ui/image/image.component.ts b/ui/src/app/core-ui/image/image.component.ts
index 1e1b408..46ae4a9 100644
--- a/ui/src/app/core-ui/image/image.component.ts
+++ b/ui/src/app/core-ui/image/image.component.ts
@@ -16,8 +16,8 @@
*
*/
-import {Component, Input, OnInit} from '@angular/core';
-import {DataResult} from "../../core-model/datalake/DataResult";
+import { Component, Input, OnInit } from '@angular/core';
+import { SpQueryResult } from '../../core-model/gen/streampipes-model';
@Component({
selector: 'sp-image',
@@ -27,7 +27,7 @@ import {DataResult} from "../../core-model/datalake/DataResult";
export class ImageComponent implements OnInit {
@Input()
- availableImageData: DataResult;
+ availableImageData: SpQueryResult;
constructor() {
@@ -38,5 +38,4 @@ export class ImageComponent implements OnInit {
}
-
}
diff --git a/ui/src/app/data-explorer/components/designer-panel/data-settings/data-explorer-widget-data-settings.component.html b/ui/src/app/data-explorer/components/designer-panel/data-settings/data-explorer-widget-data-settings.component.html
index 8d2ba7b..dd0ff45 100644
--- a/ui/src/app/data-explorer/components/designer-panel/data-settings/data-explorer-widget-data-settings.component.html
+++ b/ui/src/app/data-explorer/components/designer-panel/data-settings/data-explorer-widget-data-settings.component.html
@@ -118,6 +118,11 @@
*ngIf="sourceConfig.queryType && sourceConfig.measure">
<sp-filter-selection-panel [sourceConfig]="sourceConfig"></sp-filter-selection-panel>
</div>
+ <div fxLayout="column" fxFlex="100" class="data-explorer-options-panel"
+ *ngIf="sourceConfig.queryType && sourceConfig.measure">
+ <sp-group-selection-panel [sourceConfig]="sourceConfig"
+ [widgetId]="widgetId"></sp-group-selection-panel>
+ </div>
<div>
</div>
diff --git a/ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.html b/ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.html
new file mode 100644
index 0000000..f61be31
--- /dev/null
+++ b/ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.html
@@ -0,0 +1,39 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+<div fxLayout="column">
+ <div fxLayout="row" fxLayoutAlign="start center">
+ <span class="data-explorer-header">Group By</span>
+ <div fxLayout="row" fxLayoutAlign="start center">
+ <button mat-button mat-raised-button color="accent" class="small-button"
+ style="margin-right:10px;"
+ (click)="selectAllFields()">Select all
+ </button>
+ <button mat-button mat-raised-button class="small-button mat-basic"
+ style="margin-right:10px;"
+ (click)="deselectAllFields()">Deselect all
+ </button>
+ </div>
+ </div>
+ <div fxLayout="column" class="field-scroll-panel">
+ <div fxLayout="column"
+ *ngFor="let groupByField of sourceConfig.queryConfig.groupBy">
+ <sp-field-selection [field]="groupByField" [sourceConfig]="sourceConfig" [widgetId]="widgetId">
+ </sp-field-selection>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/ui/src/app/core-model/datalake/PageResult.ts b/ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.scss
similarity index 85%
rename from ui/src/app/core-model/datalake/PageResult.ts
rename to ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.scss
index a42d9a4..41ecef0 100644
--- a/ui/src/app/core-model/datalake/PageResult.ts
+++ b/ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.scss
@@ -14,11 +14,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
- */
-
-import {DataResult} from './DataResult';
-
-export class PageResult extends DataResult{
- page: number;
- pageSum: number;
-}
\ No newline at end of file
+ */
\ No newline at end of file
diff --git a/ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.ts b/ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.ts
new file mode 100644
index 0000000..95932e7
--- /dev/null
+++ b/ui/src/app/data-explorer/components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.ts
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import { Component, Input, OnInit } from '@angular/core';
+import { FieldConfig, SourceConfig } from '../../../../models/dataview-dashboard.model';
+import { DataExplorerFieldProviderService } from '../../../../services/data-explorer-field-provider-service';
+import { WidgetConfigurationService } from '../../../../services/widget-configuration.service';
+import { EventPropertyUnion } from '../../../../../core-model/gen/streampipes-model';
+
+@Component({
+ selector: 'sp-group-selection-panel',
+ templateUrl: './group-selection-panel.component.html',
+ styleUrls: ['./group-selection-panel.component.scss']
+})
+export class GroupSelectionPanelComponent implements OnInit {
+
+ @Input() sourceConfig: SourceConfig;
+ @Input() widgetId: string;
+
+ constructor(private fieldProvider: DataExplorerFieldProviderService,
+ private widgetConfigService: WidgetConfigurationService) {
+ }
+
+ ngOnInit() {
+ this.applyDefaultFields();
+ }
+
+ applyDefaultFields() {
+ this.sourceConfig.queryConfig.groupBy = [];
+ this.addAllFields();
+ }
+
+ addAllFields() {
+ this.sourceConfig.measure.eventSchema.eventProperties.forEach(property => {
+ if (this.fieldProvider.isDimensionProperty(property)) {
+ this.addField(property);
+ }
+ });
+ }
+
+ selectAllFields() {
+ this.selectFields(true);
+ }
+
+ deselectAllFields() {
+ this.selectFields(false);
+ }
+
+ selectFields(selected: boolean) {
+ this.sourceConfig.queryConfig.groupBy.forEach(field => field.selected = selected);
+ this.widgetConfigService.notify({ widgetId: this.widgetId, refreshData: true, refreshView: true });
+ }
+
+ addField(property: EventPropertyUnion) {
+ const selection: FieldConfig = { runtimeName: property.runtimeName, selected: false, numeric: this.fieldProvider.isNumber(property) };
+ this.sourceConfig.queryConfig.groupBy.push(selection);
+ }
+
+}
diff --git a/ui/src/app/data-explorer/components/widgets/base/base-data-explorer-widget.ts b/ui/src/app/data-explorer/components/widgets/base/base-data-explorer-widget.ts
index ddc5950..25ddbc4 100644
--- a/ui/src/app/data-explorer/components/widgets/base/base-data-explorer-widget.ts
+++ b/ui/src/app/data-explorer/components/widgets/base/base-data-explorer-widget.ts
@@ -16,29 +16,15 @@
*
*/
-import {
- Directive,
- EventEmitter,
- Input,
- OnChanges,
- OnDestroy,
- OnInit,
- Output,
- SimpleChanges
-} from '@angular/core';
+import { Directive, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges } from '@angular/core';
import { GridsterItem, GridsterItemComponent } from 'angular-gridster2';
-import { DataExplorerWidgetModel } from '../../../../core-model/gen/streampipes-model';
+import { DataExplorerWidgetModel, SpQueryResult } from '../../../../core-model/gen/streampipes-model';
import { WidgetConfigurationService } from '../../../services/widget-configuration.service';
import { DashboardItem, TimeSettings } from '../../../../dashboard/models/dashboard.model';
import { ResizeService } from '../../../services/resize.service';
import { DatalakeRestService } from '../../../../platform-services/apis/datalake-rest.service';
import { DataViewQueryGeneratorService } from '../../../services/data-view-query-generator.service';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
-import {
- DataExplorerDataConfig,
- DataExplorerField,
- FieldProvider
-} from '../../../models/dataview-dashboard.model';
+import { DataExplorerDataConfig, DataExplorerField, FieldProvider } from '../../../models/dataview-dashboard.model';
import { zip } from 'rxjs';
import { DataExplorerFieldProviderService } from '../../../services/data-explorer-field-provider-service';
@@ -104,7 +90,7 @@ export abstract class BaseDataExplorerWidget<T extends DataExplorerWidgetModel>
}
ngOnDestroy(): void {
- //this.widgetConfigurationService.configurationChangedSubject.unsubscribe();
+ // this.widgetConfigurationService.configurationChangedSubject.unsubscribe();
}
public removeWidget() {
@@ -130,16 +116,16 @@ export abstract class BaseDataExplorerWidget<T extends DataExplorerWidgetModel>
public updateData() {
this.beforeDataFetched();
const observables = this
- .dataViewQueryGeneratorService
- .generateObservables(
- this.timeSettings.startTime,
- this.timeSettings.endTime,
- this.dataExplorerWidget.dataConfig as DataExplorerDataConfig
- );
+ .dataViewQueryGeneratorService
+ .generateObservables(
+ this.timeSettings.startTime,
+ this.timeSettings.endTime,
+ this.dataExplorerWidget.dataConfig as DataExplorerDataConfig
+ );
this.timerCallback.emit(true);
zip(...observables).subscribe(results => {
results.forEach((result, index) => result.sourceIndex = index);
- this.onDataReceived(results);
+ this.onDataReceived(results[0]);
this.refreshView();
this.timerCallback.emit(false);
});
@@ -150,14 +136,14 @@ export abstract class BaseDataExplorerWidget<T extends DataExplorerWidgetModel>
}
getColumnIndex(field: DataExplorerField,
- data: DataResult) {
+ data: SpQueryResult) {
return data.headers.indexOf(field.fullDbName);
}
protected updateFieldSelection(fieldSelection: DataExplorerField[],
- addedFields: DataExplorerField[],
- removedFields: DataExplorerField[],
- filterFunction: (field: DataExplorerField) => boolean): DataExplorerField[] {
+ addedFields: DataExplorerField[],
+ removedFields: DataExplorerField[],
+ filterFunction: (field: DataExplorerField) => boolean): DataExplorerField[] {
const fields = fieldSelection.filter(field => !(removedFields.find(rm => rm.fullDbName === field.fullDbName)));
addedFields.forEach(field => {
if (filterFunction(field)) {
@@ -168,10 +154,10 @@ export abstract class BaseDataExplorerWidget<T extends DataExplorerWidgetModel>
}
protected updateSingleField(fieldSelection: DataExplorerField,
- availableFields: DataExplorerField[],
- addedFields: DataExplorerField[],
- removedFields: DataExplorerField[],
- filterFunction: (field: DataExplorerField) => boolean): DataExplorerField {
+ availableFields: DataExplorerField[],
+ addedFields: DataExplorerField[],
+ removedFields: DataExplorerField[],
+ filterFunction: (field: DataExplorerField) => boolean): DataExplorerField {
let result = fieldSelection;
if (removedFields.find(rf => rf.fullDbName === fieldSelection.fullDbName)) {
const existingFields = availableFields.concat(addedFields);
@@ -187,7 +173,7 @@ export abstract class BaseDataExplorerWidget<T extends DataExplorerWidgetModel>
public abstract beforeDataFetched();
- public abstract onDataReceived(dataResults: DataResult[]);
+ public abstract onDataReceived(spQueryResult: SpQueryResult);
public abstract onResize(width: number, height: number);
diff --git a/ui/src/app/data-explorer/components/widgets/density/density-chart-widget.component.ts b/ui/src/app/data-explorer/components/widgets/density/density-chart-widget.component.ts
index 20c39fd..59c561b 100644
--- a/ui/src/app/data-explorer/components/widgets/density/density-chart-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/density/density-chart-widget.component.ts
@@ -21,11 +21,11 @@ import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
import { DatalakeRestService } from '../../../../platform-services/apis/datalake-rest.service';
import { WidgetConfigurationService } from '../../../services/widget-configuration.service';
import { ResizeService } from '../../../services/resize.service';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
import { DensityChartWidgetModel } from './model/density-chart-widget.model';
import { DataViewQueryGeneratorService } from '../../../services/data-view-query-generator.service';
import { DataExplorerFieldProviderService } from '../../../services/data-explorer-field-provider-service';
import { DataExplorerField } from '../../../models/dataview-dashboard.model';
+import { SpQueryResult } from '../../../../core-model/gen/streampipes-model';
@Component({
selector: 'sp-data-explorer-density-chart-widget',
@@ -76,7 +76,7 @@ export class DensityChartWidgetComponent extends BaseDataExplorerWidget<DensityC
},
autosize: true,
plot_bgcolor: '#fff',
- paper_bgcolor: '#fff',
+ paper_bgcolor: '#fff'
},
config: {
modeBarButtonsToRemove: ['lasso2d', 'select2d', 'toggleSpikelines', 'toImage'],
@@ -87,7 +87,7 @@ export class DensityChartWidgetComponent extends BaseDataExplorerWidget<DensityC
};
constructor(dataLakeRestService: DatalakeRestService,
- widgetConfigurationService: WidgetConfigurationService,
+ widgetConfigurationService: WidgetConfigurationService,
resizeService: ResizeService,
dataViewQueryGeneratorService: DataViewQueryGeneratorService,
fieldProvider: DataExplorerFieldProviderService) {
@@ -98,13 +98,13 @@ export class DensityChartWidgetComponent extends BaseDataExplorerWidget<DensityC
this.updateAppearance();
}
- prepareData(result: DataResult) {
+ prepareData(result: SpQueryResult) {
const xIndex = this.getColumnIndex(this.dataExplorerWidget.visualizationConfig.firstField, result);
const yIndex = this.getColumnIndex(this.dataExplorerWidget.visualizationConfig.secondField, result);
- this.data[0].x = this.transform(result.rows, xIndex);
- this.data[1].x = this.transform(result.rows, xIndex);
- this.data[0].y = this.transform(result.rows, yIndex);
- this.data[1].y = this.transform(result.rows, yIndex);
+ this.data[0].x = this.transform(result.allDataSeries[0].rows, xIndex);
+ this.data[1].x = this.transform(result.allDataSeries[0].rows, xIndex);
+ this.data[0].y = this.transform(result.allDataSeries[0].rows, yIndex);
+ this.data[1].y = this.transform(result.allDataSeries[0].rows, yIndex);
}
transform(rows, index: number): any[] {
@@ -128,28 +128,28 @@ export class DensityChartWidgetComponent extends BaseDataExplorerWidget<DensityC
beforeDataFetched() {
}
- onDataReceived(dataResults: DataResult[]) {
- this.prepareData(dataResults[0]);
+ onDataReceived(spQueryResult: SpQueryResult) {
+ this.prepareData(spQueryResult);
this.updateAppearance();
}
handleUpdatedFields(addedFields: DataExplorerField[], removedFields: DataExplorerField[]) {
this.dataExplorerWidget.visualizationConfig.firstField =
- this.triggerFieldUpdate(this.dataExplorerWidget.visualizationConfig.firstField, addedFields, removedFields);
+ this.triggerFieldUpdate(this.dataExplorerWidget.visualizationConfig.firstField, addedFields, removedFields);
this.dataExplorerWidget.visualizationConfig.secondField =
- this.triggerFieldUpdate(this.dataExplorerWidget.visualizationConfig.secondField, addedFields, removedFields);
+ this.triggerFieldUpdate(this.dataExplorerWidget.visualizationConfig.secondField, addedFields, removedFields);
}
triggerFieldUpdate(selected: DataExplorerField,
addedFields: DataExplorerField[],
removedFields: DataExplorerField[]): DataExplorerField {
return this.updateSingleField(
- selected,
- this.fieldProvider.numericFields,
- addedFields,
- removedFields,
- (field) => field.fieldCharacteristics.numeric
+ selected,
+ this.fieldProvider.numericFields,
+ addedFields,
+ removedFields,
+ (field) => field.fieldCharacteristics.numeric
);
}
diff --git a/ui/src/app/data-explorer/components/widgets/histogram/histogram-chart-widget.component.ts b/ui/src/app/data-explorer/components/widgets/histogram/histogram-chart-widget.component.ts
index 707e500..194a7a8 100644
--- a/ui/src/app/data-explorer/components/widgets/histogram/histogram-chart-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/histogram/histogram-chart-widget.component.ts
@@ -21,11 +21,11 @@ import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
import { DatalakeRestService } from '../../../../platform-services/apis/datalake-rest.service';
import { WidgetConfigurationService } from '../../../services/widget-configuration.service';
import { ResizeService } from '../../../services/resize.service';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
import { HistogramChartWidgetModel } from './model/histogram-chart-widget.model';
import { DataViewQueryGeneratorService } from '../../../services/data-view-query-generator.service';
import { DataExplorerFieldProviderService } from '../../../services/data-explorer-field-provider-service';
import { DataExplorerField } from '../../../models/dataview-dashboard.model';
+import { SpQueryResult } from '../../../../core-model/gen/streampipes-model';
@Component({
selector: 'sp-data-explorer-histogram-chart-widget',
@@ -70,9 +70,9 @@ export class HistogramChartWidgetComponent extends BaseDataExplorerWidget<Histog
this.updateAppearance();
}
- prepareData(result: DataResult) {
+ prepareData(result: SpQueryResult) {
const index = this.getColumnIndex(this.dataExplorerWidget.visualizationConfig.selectedProperty, result);
- const varX = this.transform(result.rows, index);
+ const varX = this.transform(result.allDataSeries[0].rows, index);
this.data = [{
x: varX,
@@ -99,24 +99,24 @@ export class HistogramChartWidgetComponent extends BaseDataExplorerWidget<Histog
beforeDataFetched() {
}
- onDataReceived(dataResults: DataResult[]) {
- this.prepareData(dataResults[0]);
+ onDataReceived(spQueryResult: SpQueryResult) {
+ this.prepareData(spQueryResult);
}
handleUpdatedFields(addedFields: DataExplorerField[], removedFields: DataExplorerField[]) {
this.dataExplorerWidget.visualizationConfig.selectedProperty =
- this.triggerFieldUpdate(this.dataExplorerWidget.visualizationConfig.selectedProperty, addedFields, removedFields);
+ this.triggerFieldUpdate(this.dataExplorerWidget.visualizationConfig.selectedProperty, addedFields, removedFields);
}
triggerFieldUpdate(selected: DataExplorerField,
addedFields: DataExplorerField[],
removedFields: DataExplorerField[]): DataExplorerField {
return this.updateSingleField(
- selected,
- this.fieldProvider.allFields,
- addedFields,
- removedFields,
- (field) => true
+ selected,
+ this.fieldProvider.allFields,
+ addedFields,
+ removedFields,
+ (field) => true
);
}
diff --git a/ui/src/app/data-explorer/components/widgets/image/image-widget.component.ts b/ui/src/app/data-explorer/components/widgets/image/image-widget.component.ts
index 65f6da7..2db3d40 100644
--- a/ui/src/app/data-explorer/components/widgets/image/image-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/image/image-widget.component.ts
@@ -18,9 +18,8 @@
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { MatSort } from '@angular/material/sort';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
-import { EventPropertyUnion, EventSchema } from '../../../../core-model/gen/streampipes-model';
+import { EventPropertyUnion, EventSchema, SpQueryResult } from '../../../../core-model/gen/streampipes-model';
import { ImageWidgetModel } from './model/image-widget.model';
import { WidgetConfigurationService } from '../../../services/widget-configuration.service';
import { ResizeService } from '../../../services/resize.service';
@@ -82,13 +81,13 @@ export class ImageWidgetComponent extends BaseDataExplorerWidget<ImageWidgetMode
this.dataLakeRestService.getData(
this.dataExplorerWidget.dataConfig.sourceConfigs[0].measureName, this.buildQuery())
.subscribe(
- (res: DataResult) => {
+ (res: SpQueryResult) => {
// this.availableImageData = res;
this.showIsLoadingData = false;
this.imagesRoutes = [];
- if (res.rows !== null) {
+ if (res.allDataSeries[0].rows !== null) {
const imageField = res.headers.findIndex(name => name === this.selectedColumn.runtimeName);
- res.rows.forEach(row => {
+ res.allDataSeries[0].rows.forEach(row => {
this.imagesRoutes.push(row[imageField]);
});
}
@@ -109,7 +108,7 @@ export class ImageWidgetComponent extends BaseDataExplorerWidget<ImageWidgetMode
beforeDataFetched() {
}
- onDataReceived(dataResults: DataResult[]) {
+ onDataReceived(spQueryResult: SpQueryResult) {
}
handleUpdatedFields(addedFields: DataExplorerField[], removedFields: DataExplorerField[]) {
diff --git a/ui/src/app/data-explorer/components/widgets/indicator/indicator-chart-widget.component.ts b/ui/src/app/data-explorer/components/widgets/indicator/indicator-chart-widget.component.ts
index 265a7af..c93cb1a 100644
--- a/ui/src/app/data-explorer/components/widgets/indicator/indicator-chart-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/indicator/indicator-chart-widget.component.ts
@@ -21,11 +21,11 @@ import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
import { DatalakeRestService } from '../../../../platform-services/apis/datalake-rest.service';
import { WidgetConfigurationService } from '../../../services/widget-configuration.service';
import { ResizeService } from '../../../services/resize.service';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
import { IndicatorChartWidgetModel } from './model/indicator-chart-widget.model';
import { DataViewQueryGeneratorService } from '../../../services/data-view-query-generator.service';
import { DataExplorerFieldProviderService } from '../../../services/data-explorer-field-provider-service';
import { DataExplorerField } from '../../../models/dataview-dashboard.model';
+import { SpQueryResult } from '../../../../core-model/gen/streampipes-model';
@Component({
selector: 'sp-data-explorer-indicator-chart-widget',
@@ -39,9 +39,9 @@ export class IndicatorChartWidgetComponent extends BaseDataExplorerWidget<Indica
type: 'indicator',
mode: 'number+delta',
value: 400,
- number: {prefix: ''},
- delta: {position: 'top', reference: 320},
- domain: {x: [0, 1], y: [0, 1]}
+ number: { prefix: '' },
+ delta: { position: 'top', reference: 320 },
+ domain: { x: [0, 1], y: [0, 1] }
}
];
@@ -54,14 +54,14 @@ export class IndicatorChartWidgetComponent extends BaseDataExplorerWidget<Indica
autosize: true,
plot_bgcolor: '#fff',
paper_bgcolor: '#fff',
- margin: {t: 0, b: 0, l: 0, r: 0},
- grid: {rows: 2, columns: 2, pattern: 'independent'},
+ margin: { t: 0, b: 0, l: 0, r: 0 },
+ grid: { rows: 2, columns: 2, pattern: 'independent' },
template: {
data: {
indicator: [
{
mode: 'number+delta',
- delta: {reference: 90}
+ delta: { reference: 90 }
}
]
}
@@ -88,12 +88,12 @@ export class IndicatorChartWidgetComponent extends BaseDataExplorerWidget<Indica
this.updateAppearance();
}
- prepareData(numberResult: DataResult, deltaResult?: DataResult) {
+ prepareData(numberResult: SpQueryResult, deltaResult?: SpQueryResult) {
const valueIndex = this.getColumnIndex(this.dataExplorerWidget.visualizationConfig.valueField, numberResult);
- this.data[0].value = numberResult.total > 0 ? numberResult.rows[0][valueIndex] : '-';
+ this.data[0].value = numberResult.total > 0 ? numberResult.allDataSeries[0].rows[0][valueIndex] : '-';
if (deltaResult) {
const deltaIndex = this.getColumnIndex(this.dataExplorerWidget.visualizationConfig.deltaField, numberResult);
- this.data[0].delta.reference = numberResult.total > 0 ? deltaResult.rows[0][deltaIndex] : '-';
+ this.data[0].delta.reference = numberResult.total > 0 ? deltaResult.allDataSeries[0].rows[0][deltaIndex] : '-';
}
}
@@ -113,27 +113,27 @@ export class IndicatorChartWidgetComponent extends BaseDataExplorerWidget<Indica
this.data[0].mode = this.dataExplorerWidget.visualizationConfig.showDelta ? 'number+delta' : 'number';
}
- onDataReceived(dataResults: DataResult[]) {
- this.prepareData(dataResults[0]);
+ onDataReceived(spQueryResult: SpQueryResult) {
+ this.prepareData(spQueryResult);
}
handleUpdatedFields(addedFields: DataExplorerField[], removedFields: DataExplorerField[]) {
this.dataExplorerWidget.visualizationConfig.valueField =
- this.triggerFieldUpdate(this.dataExplorerWidget.visualizationConfig.valueField, addedFields, removedFields);
+ this.triggerFieldUpdate(this.dataExplorerWidget.visualizationConfig.valueField, addedFields, removedFields);
this.dataExplorerWidget.visualizationConfig.deltaField =
- this.triggerFieldUpdate(this.dataExplorerWidget.visualizationConfig.deltaField, addedFields, removedFields);
+ this.triggerFieldUpdate(this.dataExplorerWidget.visualizationConfig.deltaField, addedFields, removedFields);
}
triggerFieldUpdate(selected: DataExplorerField,
addedFields: DataExplorerField[],
removedFields: DataExplorerField[]): DataExplorerField {
return this.updateSingleField(
- selected,
- this.fieldProvider.numericFields,
- addedFields,
- removedFields,
- (field) => field.fieldCharacteristics.numeric
+ selected,
+ this.fieldProvider.numericFields,
+ addedFields,
+ removedFields,
+ (field) => field.fieldCharacteristics.numeric
);
}
diff --git a/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-widget.component.ts b/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-widget.component.ts
index 141eb70..46587f7 100644
--- a/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-widget.component.ts
@@ -17,8 +17,6 @@
*/
import { Component, OnInit } from '@angular/core';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
-import { GroupedDataResult } from '../../../../core-model/datalake/GroupedDataResult';
import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
import { ResizeService } from '../../../services/resize.service';
import { LineChartWidgetModel } from './model/line-chart-widget.model';
@@ -27,6 +25,7 @@ import { DatalakeRestService } from '../../../../platform-services/apis/datalake
import { DataViewQueryGeneratorService } from '../../../services/data-view-query-generator.service';
import { DataExplorerFieldProviderService } from '../../../services/data-explorer-field-provider-service';
import { DataExplorerField } from '../../../models/dataview-dashboard.model';
+import { SpQueryResult } from '../../../../core-model/gen/streampipes-model';
@Component({
selector: 'sp-data-explorer-line-chart-widget',
@@ -67,7 +66,7 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget<LineChartWi
plot_bgcolor: '#fff',
paper_bgcolor: '#fff',
xaxis: {
- type: 'date',
+ type: 'date'
},
yaxis: {
fixedrange: true
@@ -112,14 +111,14 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget<LineChartWi
}
],
direction: 'left',
- pad: {'r': 10, 't': 10},
+ pad: { 'r': 10, 't': 10 },
showactive: true,
type: 'buttons',
x: 0.0,
xanchor: 'left',
y: 1.3,
yanchor: 'top',
- font: {color: this.dataExplorerWidget.baseAppearanceConfig.textColor},
+ font: { color: this.dataExplorerWidget.baseAppearanceConfig.textColor },
bgcolor: this.dataExplorerWidget.baseAppearanceConfig.backgroundColor,
bordercolor: '#000'
}];
@@ -136,62 +135,62 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget<LineChartWi
});
}
- private processNonGroupedData(dataResult: DataResult,
- sourceIndex: number) {
- if (dataResult.total === 0) {
+ private processNonGroupedData(spQueryResult: SpQueryResult
+ ) {
+ if (spQueryResult.total === 0) {
this.setShownComponents(true, false, false);
} else {
- this.data = this.transformData(dataResult, sourceIndex);
+ this.data = this.transformData(spQueryResult, spQueryResult.sourceIndex);
this.setShownComponents(false, true, false);
}
}
- private processGroupedData(res: GroupedDataResult) {
- if (res.total === 0) {
- this.setShownComponents(true, false, false);
- } else {
- const tmp = this.transformGroupedData(res, this.fieldProvider.primaryTimestampField.runtimeName);
- this.data = this.displayGroupedData(tmp);
-
- this.setShownComponents(false, true, false);
- }
- }
-
- displayGroupedData(transformedData: GroupedDataResult) {
- const tmp = [];
-
- const groupNames = Object.keys(transformedData.dataResults);
- for (const groupName of groupNames) {
- const value = transformedData.dataResults[groupName];
- this.dataExplorerWidget.visualizationConfig.yKeys.forEach(key => {
- value.rows.forEach(serie => {
- if (serie.name === key) {
- serie.name = groupName + ' ' + serie.name;
- tmp.push(serie);
- }
- });
- });
-
- if (this.dataExplorerWidget.visualizationConfig.showCountValue) {
- let containsCount = false;
- value.rows.forEach(serie => {
- if (serie.name.startsWith('count') && !containsCount) {
- serie.name = groupName + ' count';
- tmp.push(serie);
- containsCount = true;
- }
- });
- }
- }
- return tmp;
- }
-
- transformData(data: DataResult,
+ // private processGroupedData(res: GroupedDataResult) {
+ // if (res.total === 0) {
+ // this.setShownComponents(true, false, false);
+ // } else {
+ // const tmp = this.transformGroupedData(res, this.fieldProvider.primaryTimestampField.runtimeName);
+ // this.data = this.displayGroupedData(tmp);
+ //
+ // this.setShownComponents(false, true, false);
+ // }
+ // }
+
+ // displayGroupedData(transformedData: GroupedDataResult) {
+ // const tmp = [];
+ //
+ // const groupNames = Object.keys(transformedData.dataResults);
+ // for (const groupName of groupNames) {
+ // const value = transformedData.dataResults[groupName];
+ // this.dataExplorerWidget.visualizationConfig.yKeys.forEach(key => {
+ // value.rows.forEach(serie => {
+ // if (serie.name === key) {
+ // serie.name = groupName + ' ' + serie.name;
+ // tmp.push(serie);
+ // }
+ // });
+ // });
+ //
+ // if (this.dataExplorerWidget.visualizationConfig.showCountValue) {
+ // let containsCount = false;
+ // value.rows.forEach(serie => {
+ // if (serie.name.startsWith('count') && !containsCount) {
+ // serie.name = groupName + ' count';
+ // tmp.push(serie);
+ // containsCount = true;
+ // }
+ // });
+ // }
+ // }
+ // return tmp;
+ // }
+
+ transformData(data: SpQueryResult,
sourceIndex: number): any[] {
const columnsContainingNumbers = this.dataExplorerWidget.visualizationConfig.selectedLineChartProperties
- .filter(f => this.fieldProvider.numericFields.find(field => field.fullDbName === f.fullDbName));
+ .filter(f => this.fieldProvider.numericFields.find(field => field.fullDbName === f.fullDbName));
const columnsContainingStrings = this.dataExplorerWidget.visualizationConfig.selectedLineChartProperties
- .filter(f => this.fieldProvider.nonNumericFields.find(field => field.fullDbName === f.fullDbName));
+ .filter(f => this.fieldProvider.nonNumericFields.find(field => field.fullDbName === f.fullDbName));
const indexXkey = 0;
const tmpLineChartTraces: any[] = [];
@@ -216,7 +215,7 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget<LineChartWi
});
// fill line chart traces with data
- data.rows.forEach(row => {
+ data.allDataSeries[0].rows.forEach(row => {
this.dataExplorerWidget.visualizationConfig.selectedLineChartProperties.forEach(field => {
const columnIndex = this.getColumnIndex(field, data);
tmpLineChartTraces[field.fullDbName].x.push(new Date(row[indexXkey]));
@@ -226,15 +225,15 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget<LineChartWi
return Object.values(tmpLineChartTraces);
}
- transformGroupedData(data: GroupedDataResult, xKey: string): GroupedDataResult {
- // TODO not yet supported after refactoring
- for (const key in data.dataResults) {
- const dataResult = data.dataResults[key];
- this.data = this.transformData(dataResult, 0);
- }
-
- return data;
- }
+ // transformGroupedData(data: GroupedDataResult, xKey: string): GroupedDataResult {
+ // // TODO not yet supported after refactoring
+ // for (const key in data.dataResults) {
+ // const dataResult = data.dataResults[key];
+ // this.data = this.transformData(dataResult, 0);
+ // }
+ //
+ // return data;
+ // }
setStartX(startX: string) {
this.selectedStartX = startX;
@@ -268,21 +267,22 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget<LineChartWi
this.setShownComponents(false, false, true);
}
- onDataReceived(dataResults: DataResult[]) {
+ onDataReceived(spQueryResult: SpQueryResult) {
this.data = [];
- dataResults.forEach((result, index) => {
- this.processNonGroupedData(result, index);
- });
+ this.processNonGroupedData(spQueryResult);
+ // spQueryResult.allDataSeries.forEach((result, index) => {
+ // this.processNonGroupedData(result, index);
+ // });
}
handleUpdatedFields(addedFields: DataExplorerField[],
removedFields: DataExplorerField[]) {
this.dataExplorerWidget.visualizationConfig.selectedLineChartProperties =
- this.updateFieldSelection(
- this.dataExplorerWidget.visualizationConfig.selectedLineChartProperties,
- addedFields,
- removedFields,
- (field) => field.fieldCharacteristics.numeric
- );
+ this.updateFieldSelection(
+ this.dataExplorerWidget.visualizationConfig.selectedLineChartProperties,
+ addedFields,
+ removedFields,
+ (field) => field.fieldCharacteristics.numeric
+ );
}
}
diff --git a/ui/src/app/data-explorer/components/widgets/pie/pie-chart-widget.component.ts b/ui/src/app/data-explorer/components/widgets/pie/pie-chart-widget.component.ts
index a4f53aa..025b800 100644
--- a/ui/src/app/data-explorer/components/widgets/pie/pie-chart-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/pie/pie-chart-widget.component.ts
@@ -21,11 +21,11 @@ import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
import { DatalakeRestService } from '../../../../platform-services/apis/datalake-rest.service';
import { WidgetConfigurationService } from '../../../services/widget-configuration.service';
import { ResizeService } from '../../../services/resize.service';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
import { PieChartWidgetModel } from './model/pie-chart-widget.model';
import { DataViewQueryGeneratorService } from '../../../services/data-view-query-generator.service';
import { DataExplorerFieldProviderService } from '../../../services/data-explorer-field-provider-service';
import { DataExplorerField } from '../../../models/dataview-dashboard.model';
+import { SpQueryResult } from '../../../../core-model/gen/streampipes-model';
@Component({
selector: 'sp-data-explorer-pie-chart-widget',
@@ -72,16 +72,17 @@ export class PieChartWidgetComponent extends BaseDataExplorerWidget<PieChartWidg
this.updateAppearance();
}
- prepareData(results: DataResult[]) {
+ prepareData(spQueryResult: SpQueryResult) {
+ const series = spQueryResult.allDataSeries[0];
const finalLabels: string[] = [];
const finalValues: number[] = [];
const values: Map<string, number> = new Map();
const field = this.dataExplorerWidget.visualizationConfig.selectedProperty;
const index = field.sourceIndex;
- if (results[index]) {
- const rowIndex = this.getColumnIndex(field, results[index]);
- results[index].rows.forEach(row => {
+ if (series.total[index]) {
+ const rowIndex = this.getColumnIndex(field, series.total[index]);
+ series.total[index].rows.forEach(row => {
const value = row[rowIndex].toString();
if (!values.has(value)) {
values.set(value, 0);
@@ -118,13 +119,13 @@ export class PieChartWidgetComponent extends BaseDataExplorerWidget<PieChartWidg
beforeDataFetched() {
}
- onDataReceived(dataResults: DataResult[]) {
- this.prepareData(dataResults);
+ onDataReceived(spQueryResult: SpQueryResult) {
+ this.prepareData(spQueryResult);
}
handleUpdatedFields(addedFields: DataExplorerField[], removedFields: DataExplorerField[]) {
this.dataExplorerWidget.visualizationConfig.selectedProperty =
- this.triggerFieldUpdate(this.dataExplorerWidget.visualizationConfig.selectedProperty, addedFields, removedFields);
+ this.triggerFieldUpdate(this.dataExplorerWidget.visualizationConfig.selectedProperty, addedFields, removedFields);
}
@@ -132,11 +133,11 @@ export class PieChartWidgetComponent extends BaseDataExplorerWidget<PieChartWidg
addedFields: DataExplorerField[],
removedFields: DataExplorerField[]): DataExplorerField {
return this.updateSingleField(
- selected,
- this.fieldProvider.numericFields,
- addedFields,
- removedFields,
- (field) => field.fieldCharacteristics.numeric
+ selected,
+ this.fieldProvider.numericFields,
+ addedFields,
+ removedFields,
+ (field) => field.fieldCharacteristics.numeric
);
}
diff --git a/ui/src/app/data-explorer/components/widgets/table/table-widget.component.ts b/ui/src/app/data-explorer/components/widgets/table/table-widget.component.ts
index 1fd986f..2578ad1 100644
--- a/ui/src/app/data-explorer/components/widgets/table/table-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/table/table-widget.component.ts
@@ -19,7 +19,6 @@
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
-import { DataResult } from '../../../../core-model/datalake/DataResult';
import { BaseDataExplorerWidget } from '../base/base-data-explorer-widget';
import { TableWidgetModel } from './model/table-widget.model';
import { DatalakeRestService } from '../../../../platform-services/apis/datalake-rest.service';
@@ -28,6 +27,7 @@ import { ResizeService } from '../../../services/resize.service';
import { DataViewQueryGeneratorService } from '../../../services/data-view-query-generator.service';
import { DataExplorerFieldProviderService } from '../../../services/data-explorer-field-provider-service';
import { DataExplorerField } from '../../../models/dataview-dashboard.model';
+import { SpQueryResult } from '../../../../core-model/gen/streampipes-model';
@Component({
selector: 'sp-data-explorer-table-widget',
@@ -55,14 +55,17 @@ export class TableWidgetComponent extends BaseDataExplorerWidget<TableWidgetMode
this.columnNames = ['time'].concat(this.dataExplorerWidget.visualizationConfig.selectedColumns.map(c => c.fullDbName));
}
- transformData(data: DataResult) {
+ transformData(spQueryResult: SpQueryResult) {
const result = [];
- if (data.total === 0) {
+ if (spQueryResult.total === 0) {
this.setShownComponents(true, false, false);
} else {
- data.rows.forEach(row =>
- result.push(this.createTableObject(data.headers, row))
- );
+ spQueryResult.allDataSeries.forEach(series => {
+ series.rows.forEach(row =>
+ result.push(this.createTableObject(spQueryResult.headers, row))
+ );
+ });
+
this.setShownComponents(false, true, false);
}
return result;
@@ -109,20 +112,20 @@ export class TableWidgetComponent extends BaseDataExplorerWidget<TableWidgetMode
this.setShownComponents(false, false, true);
}
- onDataReceived(dataResults: DataResult[]) {
+ onDataReceived(spQueryResult: SpQueryResult) {
this.columnNames = ['time'].concat(this.dataExplorerWidget.visualizationConfig.selectedColumns.map(c => c.fullDbName));
- this.dataSource.data = [...this.transformData(dataResults[0])];
+ this.dataSource.data = this.transformData(spQueryResult);
}
handleUpdatedFields(addedFields: DataExplorerField[],
removedFields: DataExplorerField[]) {
this.dataExplorerWidget.visualizationConfig.selectedColumns =
- this.updateFieldSelection(
- this.dataExplorerWidget.visualizationConfig.selectedColumns,
- addedFields,
- removedFields,
- (field) => true
- );
+ this.updateFieldSelection(
+ this.dataExplorerWidget.visualizationConfig.selectedColumns,
+ addedFields,
+ removedFields,
+ (field) => true
+ );
this.columnNames = ['time'].concat(this.dataExplorerWidget.visualizationConfig.selectedColumns.map(c => c.fullDbName));
}
diff --git a/ui/src/app/data-explorer/data-explorer.module.ts b/ui/src/app/data-explorer/data-explorer.module.ts
index 6970556..164db03 100644
--- a/ui/src/app/data-explorer/data-explorer.module.ts
+++ b/ui/src/app/data-explorer/data-explorer.module.ts
@@ -82,6 +82,7 @@ import { FieldSelectionComponent } from './components/designer-panel/data-settin
import { FilterSelectionPanelComponent } from './components/designer-panel/data-settings/filter-selection-panel/filter-selection-panel.component';
import { SelectPropertyComponent } from './components/widgets/utils/select-property/select-property.component';
import { DataExplorerVisualisationSettingsComponent } from './components/designer-panel/visualisation-settings/data-explorer-visualisation-settings.component';
+import { GroupSelectionPanelComponent } from './components/designer-panel/data-settings/group-selection-panel/group-selection-panel.component';
export const MY_NATIVE_FORMATS = {
fullPickerInput: {
@@ -161,7 +162,8 @@ export const MY_NATIVE_FORMATS = {
TableWidgetComponent,
TableWidgetConfigComponent,
TimeRangeSelectorComponent,
- DataExplorerVisualisationSettingsComponent
+ DataExplorerVisualisationSettingsComponent,
+ GroupSelectionPanelComponent
],
providers: [
DatalakeRestService,
diff --git a/ui/src/app/data-explorer/models/dataview-dashboard.model.ts b/ui/src/app/data-explorer/models/dataview-dashboard.model.ts
index 068d2a5..1b1e399 100644
--- a/ui/src/app/data-explorer/models/dataview-dashboard.model.ts
+++ b/ui/src/app/data-explorer/models/dataview-dashboard.model.ts
@@ -57,11 +57,11 @@ export interface DataExplorerField {
}
export interface FieldConfig {
- runtimeName: string;
- aggregations?: string[];
- alias?: string;
- selected: boolean;
- numeric: boolean;
+ runtimeName: string;
+ aggregations?: string[];
+ alias?: string;
+ selected: boolean;
+ numeric: boolean;
}
export interface SelectedFilter {
@@ -74,6 +74,7 @@ export interface SelectedFilter {
export interface QueryConfig {
selectedFilters: SelectedFilter[];
fields?: FieldConfig[];
+ groupBy?: FieldConfig[];
limit?: number;
page?: number;
order?: 'ASC' | 'DESC';
diff --git a/ui/src/app/data-explorer/services/data-view-query-generator.service.ts b/ui/src/app/data-explorer/services/data-view-query-generator.service.ts
index aeaecc1..5ca298e 100644
--- a/ui/src/app/data-explorer/services/data-view-query-generator.service.ts
+++ b/ui/src/app/data-explorer/services/data-view-query-generator.service.ts
@@ -19,10 +19,10 @@
import { Injectable } from '@angular/core';
import { DataExplorerDataConfig, SourceConfig } from '../models/dataview-dashboard.model';
import { DatalakeQueryParameterBuilder } from '../../core-services/datalake/DatalakeQueryParameterBuilder';
-import { DataResult } from '../../core-model/datalake/DataResult';
import { Observable } from 'rxjs';
import { DatalakeQueryParameters } from '../../core-services/datalake/DatalakeQueryParameters';
import { DatalakeRestService } from '../../platform-services/apis/datalake-rest.service';
+import { SpQueryResult } from '../../core-model/gen/streampipes-model';
@Injectable()
@@ -34,12 +34,12 @@ export class DataViewQueryGeneratorService {
generateObservables(startTime: number,
endTime: number,
- dataConfig: DataExplorerDataConfig): Observable<DataResult>[] {
+ dataConfig: DataExplorerDataConfig): Observable<SpQueryResult>[] {
return dataConfig
- .sourceConfigs
- .map(sourceConfig => this.dataLakeRestService
- .getData(sourceConfig.measureName, this.generateQuery(startTime, endTime, sourceConfig)));
+ .sourceConfigs
+ .map(sourceConfig => this.dataLakeRestService
+ .getData(sourceConfig.measureName, this.generateQuery(startTime, endTime, sourceConfig)));
}
generateQuery(startTime: number,
@@ -49,10 +49,17 @@ export class DataViewQueryGeneratorService {
const queryConfig = sourceConfig.queryConfig;
queryBuilder.withColumnFilter(
- queryConfig.fields.filter(f => f.selected),
- sourceConfig.queryType === 'aggregated' || sourceConfig.queryType === 'single'
+ queryConfig.fields.filter(f => f.selected),
+ sourceConfig.queryType === 'aggregated' || sourceConfig.queryType === 'single'
);
+ if (sourceConfig.queryConfig.groupBy !== undefined) {
+ const selectedGroupByFields = sourceConfig.queryConfig.groupBy.filter(field => field.selected);
+ if (selectedGroupByFields.length > 0) {
+ queryBuilder.withGrouping(sourceConfig.queryConfig.groupBy);
+ }
+ }
+
if (sourceConfig.queryType === 'single') {
queryBuilder.withLimit(1);
} else if (sourceConfig.queryType === 'raw') {
diff --git a/ui/src/app/platform-services/apis/datalake-rest.service.ts b/ui/src/app/platform-services/apis/datalake-rest.service.ts
index f94f1b3..22093c1 100644
--- a/ui/src/app/platform-services/apis/datalake-rest.service.ts
+++ b/ui/src/app/platform-services/apis/datalake-rest.service.ts
@@ -20,12 +20,9 @@ import { Injectable } from '@angular/core';
import { HttpClient, HttpRequest } from '@angular/common/http';
import { AuthStatusService } from '../../services/auth-status.service';
import { Observable } from 'rxjs';
-import { DataLakeMeasure } from '../../core-model/gen/streampipes-model';
+import { DataLakeMeasure, PageResult, SpQueryResult } from '../../core-model/gen/streampipes-model';
import { map } from 'rxjs/operators';
-import { DataResult } from '../../core-model/datalake/DataResult';
import { DatalakeQueryParameters } from '../../core-services/datalake/DatalakeQueryParameters';
-import { PageResult } from '../../core-model/datalake/PageResult';
-import { GroupedDataResult } from '../../core-model/datalake/GroupedDataResult';
@Injectable()
export class DatalakeRestService {
@@ -49,55 +46,46 @@ export class DatalakeRestService {
}
getData(index: string,
- queryParams: DatalakeQueryParameters): Observable<DataResult> {
+ queryParams: DatalakeQueryParameters): Observable<SpQueryResult> {
const url = this.dataLakeUrl + '/measurements/' + index;
// @ts-ignore
- return this.http.get<DataResult>(url, { params: queryParams });
+ return this.http.get<SpQueryResult>(url, { params: queryParams });
}
- // getData(index, startDate, endDate, columns, aggregationFunction, aggregationTimeUnit, aggregationTimeValue): Observable<DataResult> {
- // const timeInterval = aggregationTimeValue + aggregationTimeUnit;
- //
- // const queryParams: DatalakeQueryParameters = this.getQueryParameters(columns, startDate, endDate, undefined, undefined,
- // undefined, undefined, undefined, aggregationFunction, timeInterval);
- //
- // // @ts-ignore
- // return this.http.get<DataResult>(url, {params: queryParams});
- // }
getPagedData(index: string, itemsPerPage: number, page: number, columns?: string, order?: string): Observable<PageResult> {
const url = this.dataLakeUrl + '/measurements/' + index;
const queryParams: DatalakeQueryParameters = this.getQueryParameters(columns, undefined, undefined, page,
- itemsPerPage, undefined, undefined, order, undefined, undefined);
+ itemsPerPage, undefined, undefined, order, undefined, undefined);
// @ts-ignore
- return this.http.get<PageResult>(url, {params: queryParams});
+ return this.http.get<PageResult>(url, { params: queryParams });
}
- getGroupedData(index: string, groupingTags: string, aggregationFunction?: string, columns?: string, startDate?: number, endDate?:
- number, aggregationTimeUnit?: string, aggregationTimeValue?: number, order?: string, limit?: number):
- Observable<GroupedDataResult> {
-
- const url = this.dataLakeUrl + '/measurements/' + index;
- let _aggregationFunction = 'mean';
- let timeInterval = '2000ms';
-
- if (aggregationFunction) {
- _aggregationFunction = aggregationFunction;
- }
-
- if (aggregationTimeUnit && aggregationTimeValue) {
- timeInterval = aggregationTimeValue + aggregationTimeUnit;
- }
-
- const queryParams: DatalakeQueryParameters = this.getQueryParameters(columns, startDate, endDate, undefined, limit,
- undefined, groupingTags, order, _aggregationFunction, timeInterval);
-
- // @ts-ignore
- return this.http.get<GroupedDataResult>(url, { params: queryParams });
- }
+ // getGroupedData(index: string, groupingTags: string, aggregationFunction?: string, columns?: string, startDate?: number, endDate?:
+ // number, aggregationTimeUnit?: string, aggregationTimeValue?: number, order?: string, limit?: number):
+ // Observable<SpQueryResult> {
+ //
+ // const url = this.dataLakeUrl + '/measurements/' + index;
+ // let _aggregationFunction = 'mean';
+ // let timeInterval = '2000ms';
+ //
+ // if (aggregationFunction) {
+ // _aggregationFunction = aggregationFunction;
+ // }
+ //
+ // if (aggregationTimeUnit && aggregationTimeValue) {
+ // timeInterval = aggregationTimeValue + aggregationTimeUnit;
+ // }
+ //
+ // const queryParams: DatalakeQueryParameters = this.getQueryParameters(columns, startDate, endDate, undefined, limit,
+ // undefined, groupingTags, order, _aggregationFunction, timeInterval);
+ //
+ // // @ts-ignore
+ // return this.http.get<GroupedDataResult>(url, { params: queryParams });
+ // }
downloadRawData(index, format) {
const url = this.dataLakeUrl + '/measurements/' + index + '/download?format=' + format;