indigophox commented on code in PR #34817: URL: https://github.com/apache/arrow/pull/34817#discussion_r1421010861
########## 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: > I -think-, unless there are broken edge cases for this in Proto, the most straightforward thing here would be to handle a value variant that maps to an unset `oneof` over the wire. (a) I think we can add that later though and (b) does that sound sane (both the impl and feasibility of deferring it for now)? @lidavidm any objections to this idea before it moves ahead, "unset" options using the VALUE_NOT_SET case over the wire and presumably then I think SessionOptionValue{static_cast<std::string>(NULL)} and having a visit(Void) overload in Javaland—again unless you have other suggestions for those details? -- 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]
