jduo commented on code in PR #34817:
URL: https://github.com/apache/arrow/pull/34817#discussion_r1416494543


##########
java/flight/flight-core/src/main/java/org/apache/arrow/flight/CloseSessionResult.java:
##########
@@ -0,0 +1,109 @@
+/*
+ * 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.arrow.flight;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+public class CloseSessionResult {
+  public enum Status {
+    /**
+     * The session close status is unknown. Servers should avoid using this 
value
+     * (send a NOT_FOUND error if the requested session is not known). Clients 
can
+     * retry the request.
+     */
+    UNSPECIFIED(Flight.CloseSessionResult.Status.UNSPECIFIED),
+    /**
+     * The session close request is complete.
+     */
+    CLOSED(Flight.CloseSessionResult.Status.CLOSED),
+    /**
+     * The session close request is in progress. The client may retry the 
request.
+     */
+    CLOSING(Flight.CloseSessionResult.Status.CLOSING),
+    /**
+     * The session is not closeable.
+     */
+    NOT_CLOSABLE(Flight.CloseSessionResult.Status.NOT_CLOSABLE),
+    ;
+
+    private static final Map<Flight.CloseSessionResult.Status, Status> 
mapFromProto;
+
+    static {
+      for (Status s : values()) mapFromProto.put(s.proto, s);

Review Comment:
   Isn't this just accessing Status.values()[s.ordinal]?



##########
java/flight/flight-core/src/main/java/org/apache/arrow/flight/SetSessionOptionsResult.java:
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.arrow.flight;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class SetSessionOptionsResult {
+  public enum Status {
+    /**
+     * The status of setting the option is unknown. Servers should avoid using 
this value
+     * (send a NOT_FOUND error if the requested session is not known). Clients 
can retry
+     * the request.
+      */
+    UNSPECIFIED(Flight.SetSessionOptionsResult.Status.UNSPECIFIED),
+    /**
+     * The session option setting completed successfully.
+     */
+    OK(Flight.SetSessionOptionsResult.Status.OK),
+    /**
+     * The given session option name was an alias for another option name.
+     */
+    OK_MAPPED(Flight.SetSessionOptionsResult.Status.OK_MAPPED),
+    /**
+     * The given session option name is invalid.
+     */
+    INVALID_NAME(Flight.SetSessionOptionsResult.Status.INVALID_NAME),
+    /**
+     * The session option value is invalid.
+     */
+    INVALID_VALUE(Flight.SetSessionOptionsResult.Status.INVALID_VALUE),
+    /**
+     * The session option cannot be set.
+     */
+    ERROR(Flight.SetSessionOptionsResult.Status.ERROR),
+    ;
+
+    private static final Map<Flight.SetSessionOptionsResult.Status, 
SetSessionOptionsResult.Status> mapFromProto;
+
+    static {
+      for (Status s : values()) mapFromProto.put(s.proto, s);
+    }
+
+    private final Flight.SetSessionOptionsResult.Status proto;
+
+    private Status(Flight.SetSessionOptionsResult.Status s) {
+      proto = s;
+    }
+
+    public static Status fromProtocol(Flight.SetSessionOptionsResult.Status s) 
{
+      return mapFromProto.get(s);
+    }
+
+    public Flight.SetSessionOptionsResult.Status toProtocol() {
+      return proto;
+    }
+  }
+
+  private final Map<String, Status> results;
+
+  public SetSessionOptionsResult(Map<String, Status> results) {
+    this.results = HashMap<String, Status>(results);
+  }
+
+  SetSessionOptionsResult(Flight.SetSessionOptionsResult proto) {
+    results = proto.getResults().entrySet().stream().collect(Collectors.toMap(
+        Map.Entry::getKey, e -> Status.fromProtocol(e.getValue())));
+  }
+
+  Map<String, Status> getResults() {
+    return Collections.unmodifiableMap(results);
+  }
+
+  Flight.SetSessionOptionsResult toProtocol() {
+    Flight.SetSessionOptionsResult.Builder b = 
Flight.SetSessionOptionsResult.newBuilder();
+    b.putAllResults(results.entrySet().stream().collect(Collectors.toMap(
+        Map.Entry::getKey, e->getValue().toProtocol())));

Review Comment:
   e -> getValue()



##########
java/flight/flight-core/src/main/java/org/apache/arrow/flight/CloseSessionRequest.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.arrow.flight;

Review Comment:
   Let's change the title of this pr to include [Java]



##########
java/flight/flight-core/src/main/java/org/apache/arrow/flight/CloseSessionRequest.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.arrow.flight;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+public class CloseSessionRequest {

Review Comment:
   A class comment is needed.



##########
java/flight/flight-core/src/main/java/org/apache/arrow/flight/SessionOptionValue.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * 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.arrow.flight;
+
+import org.apache.arrow.flight.impl.Flight;
+
+/**
+ * A union-like container interface for supported session option value types.
+ */
+public abstract class SessionOptionValue {
+    static SessionOptionValue fromProto(Flight.SessionOptionValue proto); {
+        switch(proto.getOptionValueCase()) {
+            case STRING_VALUE:
+                return new SessionOptionValueString(proto.getStringValue());
+                break;
+            case BOOL_VALUE:
+                return new SessionOptionValueBoolean(proto.getValue());
+                break;
+            case INT32_VALUE:
+                return new SessionOptionValueInt(proto.getInt32Value());
+                break;
+            case INT64_VALUE:
+                return new SessionOptionValueLong(proto.getInt64Value());
+                break;
+            case FLOAT_VALUE:
+                return new SessionOptionValueFloat(proto.getFloatValue());
+                break;
+            case DOUBLE_VALUE:
+                return new SessionOptionValueDouble(proto.getDoubleValue());
+                break;
+            case STRING_LIST_VALUE:
+                // FIXME PHOXME is this what's in the ProtocolStringList?
+                return new 
SessionOptionValueStringList(proto.getValueStringList().stream().collect(
+                    Collectors.toList(e -> 
google.protocol.StringValue.parseFrom(e).getValue())));
+                break;
+            default:
+                // Unreachable
+                 throw new IllegalArgumentException("");
+        }
+    }
+
+    /**
+     * Value access via a caller-provided visitor/functor.
+     */
+    abstract void visit(SessionOptionValueVisitor);
+
+    Flight.SessionOptionValue toProtocol() {
+        Flight.SessionOptionValue.Builder b = 
Flight.SessionOptionValue.newBuilder();
+        SessionOptionValueToProtocolVisitor visitor = new 
SessionOptionValueToProtocolVisitor(b);
+        this.visit(visitor);
+        return b.build();
+    }
+}
+
+class SessionOptionValueToProtocolVisitor implements SessionOptionValueVisitor 
{
+    final Flight.SessionOptionValue.Builder b;
+
+    SessionOptionValueVisitor(Flight.SessionOptionValue.Builder b) { this.b = 
b; }
+
+    Flight.SessionOptionValue visit(String value) {
+        b.setStringValue(value);

Review Comment:
   These functions need to return a value



##########
java/flight/flight-core/src/main/java/org/apache/arrow/flight/SessionOptionValueFactory.java:
##########
@@ -0,0 +1,106 @@
+/*
+ * 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.arrow.flight;
+
+import org.apache.arrow.flight.SessionOptionValue;
+
+public class SessionOptionValueFactory {
+    public static SessionOptionValue makeSessionOption(String value) {
+        return new SessionOptionValueString(value);
+    }
+
+    public static SessionOptionValue makeSessionOption(bool value) {
+        return new SessionOptionValueBool(value);
+    }
+
+    public static SessionOptionValue makeSessionOption(int value) {
+        return new SessionOptionValueInt(value);
+    }
+
+    public static SessionOptionValue makeSessionOption(long value) {
+        return new SessionOptionValueLong(value);
+    }
+
+    public static SessionOptionValue makeSessionOption(float value) {
+        return new SessionOptionValueFloat(value);
+    }
+
+    public static SessionOptionValue makeSessionOption(double value) {
+        return new SessionOptionValueDouble(value);
+    }
+
+    public static SessionOptionValue makeSessionOption(String[] value) {
+        return new SessionOptionValueStringList(value);
+    }
+}
+
+class SessionOptionValueString {

Review Comment:
   Are options nullable? Is there any way for a user to "unset" an option? For 
example they might want to do this to revert to a server-side default.



##########
java/flight/flight-core/src/main/java/org/apache/arrow/flight/SessionOptionValue.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * 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.arrow.flight;
+
+import org.apache.arrow.flight.impl.Flight;
+
+/**
+ * A union-like container interface for supported session option value types.
+ */
+public abstract class SessionOptionValue {
+    static SessionOptionValue fromProto(Flight.SessionOptionValue proto); {
+        switch(proto.getOptionValueCase()) {
+            case STRING_VALUE:
+                return new SessionOptionValueString(proto.getStringValue());
+                break;
+            case BOOL_VALUE:
+                return new SessionOptionValueBoolean(proto.getValue());
+                break;
+            case INT32_VALUE:
+                return new SessionOptionValueInt(proto.getInt32Value());
+                break;
+            case INT64_VALUE:
+                return new SessionOptionValueLong(proto.getInt64Value());
+                break;
+            case FLOAT_VALUE:
+                return new SessionOptionValueFloat(proto.getFloatValue());
+                break;
+            case DOUBLE_VALUE:
+                return new SessionOptionValueDouble(proto.getDoubleValue());
+                break;
+            case STRING_LIST_VALUE:
+                // FIXME PHOXME is this what's in the ProtocolStringList?
+                return new 
SessionOptionValueStringList(proto.getValueStringList().stream().collect(
+                    Collectors.toList(e -> 
google.protocol.StringValue.parseFrom(e).getValue())));
+                break;
+            default:
+                // Unreachable
+                 throw new IllegalArgumentException("");
+        }
+    }
+
+    /**
+     * Value access via a caller-provided visitor/functor.
+     */
+    abstract void visit(SessionOptionValueVisitor);
+
+    Flight.SessionOptionValue toProtocol() {
+        Flight.SessionOptionValue.Builder b = 
Flight.SessionOptionValue.newBuilder();
+        SessionOptionValueToProtocolVisitor visitor = new 
SessionOptionValueToProtocolVisitor(b);
+        this.visit(visitor);
+        return b.build();
+    }
+}
+
+class SessionOptionValueToProtocolVisitor implements SessionOptionValueVisitor 
{
+    final Flight.SessionOptionValue.Builder b;
+
+    SessionOptionValueVisitor(Flight.SessionOptionValue.Builder b) { this.b = 
b; }
+
+    Flight.SessionOptionValue visit(String value) {
+        b.setStringValue(value);
+    }
+
+    Flight.SessionOptionValue visit(boolean value) {
+        b.setBoolValue(value);
+    }
+
+    Flight.SessionOptionValue visit(int value) {
+        b.setIn32Value(value);
+    }
+
+    Flight.SessionOptionValue visit(long value) {
+        b.setInt64Value(value);
+    }
+
+    Flight.SessionOptionValue visit(float value) {
+        b.setFloatValue(value);
+    }
+
+    Flight.SessionOptionValue visit(double value) {
+        b.setDoubleValue(value);
+    }
+
+    Flight.SessionOptionValue visit(String[] value) {
+        Flight.SessionOptionValue.StringListValue pb_value;

Review Comment:
   Use java naming conventions



##########
java/flight/flight-core/src/main/java/org/apache/arrow/flight/CloseSessionRequest.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.arrow.flight;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+public class CloseSessionRequest {
+  public CloseSessionRequest() {}
+
+  CloseSessionRequest(Flight.CloseSessionRequest proto) {}
+
+  Flight.CloseSessionRequest toProtocol() {
+    Flight.CloseSessionRequest.Builder b = 
Flight.CloseSessionRequest.newBuilder();
+    return b.build();
+  }
+
+  /**
+   * Get the serialized form of this protocol message.
+   *
+   * <p>Intended to help interoperability by allowing non-Flight services to 
still return Flight types.
+   */
+  public ByteBuffer serialize() {
+    return ByteBuffer.wrap(toProtocol().toByteArray());

Review Comment:
   Should this return a singleton? There's no state here.



##########
java/flight/flight-core/src/main/java/org/apache/arrow/flight/SessionOptionValue.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * 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.arrow.flight;
+
+import org.apache.arrow.flight.impl.Flight;
+
+/**
+ * A union-like container interface for supported session option value types.
+ */
+public abstract class SessionOptionValue {
+    static SessionOptionValue fromProto(Flight.SessionOptionValue proto); {
+        switch(proto.getOptionValueCase()) {
+            case STRING_VALUE:
+                return new SessionOptionValueString(proto.getStringValue());
+                break;
+            case BOOL_VALUE:
+                return new SessionOptionValueBoolean(proto.getValue());
+                break;
+            case INT32_VALUE:
+                return new SessionOptionValueInt(proto.getInt32Value());
+                break;
+            case INT64_VALUE:
+                return new SessionOptionValueLong(proto.getInt64Value());
+                break;
+            case FLOAT_VALUE:
+                return new SessionOptionValueFloat(proto.getFloatValue());
+                break;
+            case DOUBLE_VALUE:
+                return new SessionOptionValueDouble(proto.getDoubleValue());
+                break;
+            case STRING_LIST_VALUE:
+                // FIXME PHOXME is this what's in the ProtocolStringList?
+                return new 
SessionOptionValueStringList(proto.getValueStringList().stream().collect(
+                    Collectors.toList(e -> 
google.protocol.StringValue.parseFrom(e).getValue())));
+                break;
+            default:
+                // Unreachable
+                 throw new IllegalArgumentException("");
+        }
+    }
+
+    /**
+     * Value access via a caller-provided visitor/functor.
+     */
+    abstract void visit(SessionOptionValueVisitor);

Review Comment:
   This should be "acceptVisitor".



##########
java/flight/flight-core/src/main/java/org/apache/arrow/flight/SessionOptionValue.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * 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.arrow.flight;
+
+import org.apache.arrow.flight.impl.Flight;
+
+/**
+ * A union-like container interface for supported session option value types.
+ */
+public abstract class SessionOptionValue {
+    static SessionOptionValue fromProto(Flight.SessionOptionValue proto); {
+        switch(proto.getOptionValueCase()) {
+            case STRING_VALUE:
+                return new SessionOptionValueString(proto.getStringValue());
+                break;
+            case BOOL_VALUE:
+                return new SessionOptionValueBoolean(proto.getValue());
+                break;
+            case INT32_VALUE:
+                return new SessionOptionValueInt(proto.getInt32Value());
+                break;
+            case INT64_VALUE:
+                return new SessionOptionValueLong(proto.getInt64Value());
+                break;
+            case FLOAT_VALUE:
+                return new SessionOptionValueFloat(proto.getFloatValue());
+                break;
+            case DOUBLE_VALUE:
+                return new SessionOptionValueDouble(proto.getDoubleValue());
+                break;
+            case STRING_LIST_VALUE:
+                // FIXME PHOXME is this what's in the ProtocolStringList?
+                return new 
SessionOptionValueStringList(proto.getValueStringList().stream().collect(
+                    Collectors.toList(e -> 
google.protocol.StringValue.parseFrom(e).getValue())));
+                break;
+            default:
+                // Unreachable
+                 throw new IllegalArgumentException("");
+        }
+    }
+
+    /**
+     * Value access via a caller-provided visitor/functor.
+     */
+    abstract void visit(SessionOptionValueVisitor);
+
+    Flight.SessionOptionValue toProtocol() {
+        Flight.SessionOptionValue.Builder b = 
Flight.SessionOptionValue.newBuilder();
+        SessionOptionValueToProtocolVisitor visitor = new 
SessionOptionValueToProtocolVisitor(b);
+        this.visit(visitor);
+        return b.build();
+    }
+}
+
+class SessionOptionValueToProtocolVisitor implements SessionOptionValueVisitor 
{
+    final Flight.SessionOptionValue.Builder b;
+
+    SessionOptionValueVisitor(Flight.SessionOptionValue.Builder b) { this.b = 
b; }
+
+    Flight.SessionOptionValue visit(String value) {
+        b.setStringValue(value);
+    }
+
+    Flight.SessionOptionValue visit(boolean value) {
+        b.setBoolValue(value);
+    }
+
+    Flight.SessionOptionValue visit(int value) {
+        b.setIn32Value(value);
+    }
+
+    Flight.SessionOptionValue visit(long value) {
+        b.setInt64Value(value);
+    }
+
+    Flight.SessionOptionValue visit(float value) {
+        b.setFloatValue(value);
+    }
+
+    Flight.SessionOptionValue visit(double value) {
+        b.setDoubleValue(value);
+    }
+
+    Flight.SessionOptionValue visit(String[] value) {
+        Flight.SessionOptionValue.StringListValue pb_value;
+        pb_value.addAllStringValues(value);
+        b.setValue(pb_value);
+    }
+}

Review Comment:
   Please add a newline to the end of the file.



##########
java/flight/flight-core/src/main/java/org/apache/arrow/flight/SetSessionOptionsRequest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.arrow.flight;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class SetSessionOptionsRequest {
+  private final Map<String, SessionOptionValue> session_options;
+
+  public SetSessionOptionsRequest(Map<String, SessionOptionValue> 
session_options) {
+    this.session_options = ConcurrentHashMap(session_options);

Review Comment:
   new ConcurrentHashMap.



##########
java/flight/flight-core/src/main/java/org/apache/arrow/flight/GetSessionOptionsResult.java:
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.arrow.flight;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class GetSessionOptionsResult {
+  private final Map<String, SessionOptionValue> session_options;
+
+  public GetSessionOptionsResult(Map<String, SessionOptionValue> 
session_options) {
+    this.session_options = new HashMap(session_options);
+  }
+
+  GetSessionOptionsResult(Flight.GetSessionOptionsResult proto) {
+    session_options = 
proto.getSessionOptions().entrySet().stream().collect(Collectors.toMap(Map

Review Comment:
   Use java variable naming convention (eg sessionOptions)



##########
java/flight/flight-core/src/main/java/org/apache/arrow/flight/SessionOptionValue.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * 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.arrow.flight;
+
+import org.apache.arrow.flight.impl.Flight;
+
+/**
+ * A union-like container interface for supported session option value types.
+ */
+public abstract class SessionOptionValue {
+    static SessionOptionValue fromProto(Flight.SessionOptionValue proto); {
+        switch(proto.getOptionValueCase()) {
+            case STRING_VALUE:
+                return new SessionOptionValueString(proto.getStringValue());
+                break;
+            case BOOL_VALUE:
+                return new SessionOptionValueBoolean(proto.getValue());
+                break;
+            case INT32_VALUE:
+                return new SessionOptionValueInt(proto.getInt32Value());
+                break;
+            case INT64_VALUE:
+                return new SessionOptionValueLong(proto.getInt64Value());
+                break;
+            case FLOAT_VALUE:
+                return new SessionOptionValueFloat(proto.getFloatValue());
+                break;
+            case DOUBLE_VALUE:
+                return new SessionOptionValueDouble(proto.getDoubleValue());
+                break;
+            case STRING_LIST_VALUE:
+                // FIXME PHOXME is this what's in the ProtocolStringList?
+                return new 
SessionOptionValueStringList(proto.getValueStringList().stream().collect(
+                    Collectors.toList(e -> 
google.protocol.StringValue.parseFrom(e).getValue())));
+                break;
+            default:
+                // Unreachable
+                 throw new IllegalArgumentException("");
+        }
+    }
+
+    /**
+     * Value access via a caller-provided visitor/functor.
+     */
+    abstract void visit(SessionOptionValueVisitor);

Review Comment:
   SessionOptionValueVisitor should probably be a generic and acceptVisitor() 
should return its result.



##########
java/flight/flight-core/src/main/java/org/apache/arrow/flight/SetSessionOptionsRequest.java:
##########
@@ -0,0 +1,76 @@
+/*
+ * 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.arrow.flight;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class SetSessionOptionsRequest {
+  private final Map<String, SessionOptionValue> session_options;
+
+  public SetSessionOptionsRequest(Map<String, SessionOptionValue> 
session_options) {
+    this.session_options = ConcurrentHashMap(session_options);

Review Comment:
   Why use a ConcurrentHashMap? It doesn't look like the map is even mutable 
after being passed to the constructor?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to