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 2020/06/04 07:42:47 UTC
[incubator-streampipes-extensions] branch dev updated: Fix
[STREAMPIPES-155] SplitArray controller produces wrong output schema
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-extensions.git
The following commit(s) were added to refs/heads/dev by this push:
new a2949fd Fix [STREAMPIPES-155] SplitArray controller produces wrong output schema
a2949fd is described below
commit a2949fd417cdc67f0fe2aefde667db8b8941f52e
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Thu Jun 4 09:42:03 2020 +0200
Fix [STREAMPIPES-155] SplitArray controller produces wrong output schema
---
.../jvm/processor/array/split/SplitArray.java | 2 +-
.../jvm/processor/array/split/SplitArrayController.java | 14 +++++++++-----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/array/split/SplitArray.java b/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/array/split/SplitArray.java
index 5eb1f7a..e7cbfa9 100644
--- a/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/array/split/SplitArray.java
+++ b/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/array/split/SplitArray.java
@@ -67,7 +67,7 @@ public class SplitArray implements EventProcessor<SplitArrayParameters> {
outEvent.addField(key.getValue());
}
} else {
- outEvent.addField("value", field);
+ outEvent.addField(SplitArrayController.VALUE, field);
}
for (String propertyName : keepProperties) {
diff --git a/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/array/split/SplitArrayController.java b/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/array/split/SplitArrayController.java
index 5c3bbba..8f346b4 100644
--- a/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/array/split/SplitArrayController.java
+++ b/streampipes-processors-transformation-jvm/src/main/java/org/apache/streampipes/processors/transformation/jvm/processor/array/split/SplitArrayController.java
@@ -22,9 +22,7 @@ import org.apache.streampipes.commons.exceptions.SpRuntimeException;
import org.apache.streampipes.container.api.ResolvesContainerProvidedOutputStrategy;
import org.apache.streampipes.model.graph.DataProcessorDescription;
import org.apache.streampipes.model.graph.DataProcessorInvocation;
-import org.apache.streampipes.model.schema.EventProperty;
-import org.apache.streampipes.model.schema.EventSchema;
-import org.apache.streampipes.model.schema.PropertyScope;
+import org.apache.streampipes.model.schema.*;
import org.apache.streampipes.sdk.builder.ProcessingElementBuilder;
import org.apache.streampipes.sdk.builder.StreamRequirementsBuilder;
import org.apache.streampipes.sdk.extractor.ProcessingElementParameterExtractor;
@@ -44,6 +42,7 @@ public class SplitArrayController extends StandaloneEventProcessingDeclarer<Spli
public static final String KEEP_PROPERTIES_ID = "keep";
public static final String ARRAY_FIELD_ID = "array-field";
+ public static final String VALUE = "array_value";
@Override
public DataProcessorDescription declareModel() {
@@ -80,10 +79,15 @@ public class SplitArrayController extends StandaloneEventProcessingDeclarer<Spli
List<String> keepPropertySelectors = extractor.mappingPropertyValues(KEEP_PROPERTIES_ID);
List<EventProperty> outProperties = new ArrayList<>();
- EventProperty arrayProperty = extractor.getEventPropertyBySelector(arrayFieldSelector);
+ EventPropertyList arrayProperty = (EventPropertyList) extractor.getEventPropertyBySelector(arrayFieldSelector);
+ EventProperty newProperty = arrayProperty.getEventProperty();
+ newProperty.setRuntimeName(VALUE);
+ newProperty.setLabel("Array Value");
+ newProperty.setDescription("Contains values of the array. Created by Split Array processor.");
+
List<EventProperty> keepProperties = extractor.getEventPropertiesBySelector
(keepPropertySelectors);
- outProperties.add(arrayProperty);
+ outProperties.add(newProperty);
outProperties.addAll(keepProperties);
return new EventSchema(outProperties);