Michael Blow has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/2427

Change subject: [NO ISSUE] Serialize String [] options as JSON arrays
......................................................................

[NO ISSUE] Serialize String [] options as JSON arrays

Change-Id: I8e05c2b30b87597b5896318b5f3a4f755f889af4
---
M 
hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/config/IOptionType.java
M hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/pom.xml
M 
hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/OptionTypes.java
3 files changed, 8 insertions(+), 7 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/27/2427/1

diff --git 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/config/IOptionType.java
 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/config/IOptionType.java
index aee22c9..ba2b021 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/config/IOptionType.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/config/IOptionType.java
@@ -42,7 +42,7 @@
     }
 
     /**
-     * @return the value in a format suitable for serialized JSON
+     * Serializes the value as a field in the provided object node
      */
     void serializeJSONField(String fieldName, Object value, ObjectNode node);
 
diff --git 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/pom.xml 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/pom.xml
index cba5e19..bdb2aed 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/pom.xml
@@ -76,10 +76,6 @@
       <artifactId>commons-collections4</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-lang3</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-api</artifactId>
     </dependency>
diff --git 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/OptionTypes.java
 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/OptionTypes.java
index b188548..ae424b7 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/OptionTypes.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/config/OptionTypes.java
@@ -21,8 +21,8 @@
 import java.net.MalformedURLException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Stream;
 
-import org.apache.commons.lang3.StringUtils;
 import org.apache.hyracks.api.config.IOptionType;
 import org.apache.hyracks.util.StorageUtil;
 import org.apache.logging.log4j.Level;
@@ -305,7 +305,12 @@
 
         @Override
         public void serializeJSONField(String fieldName, Object value, 
ObjectNode node) {
-            node.put(fieldName, value == null ? null : 
StringUtils.join((String[]) value, ','));
+            if (value == null) {
+                node.putNull(fieldName);
+            } else {
+                ArrayNode array = node.putArray(fieldName);
+                Stream.of((String[]) value).forEachOrdered(array::add);
+            }
         }
     };
 

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2427
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8e05c2b30b87597b5896318b5f3a4f755f889af4
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <mb...@apache.org>

Reply via email to