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


##########
java/flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/utils/ArrowToJdbcUtils.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * 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.driver.jdbc.utils;
+
+import java.math.BigDecimal;
+import java.sql.Date;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.apache.arrow.vector.types.pojo.ArrowType;
+
+/**
+ * Helper class to convert Arrow types to JDBC required values.
+ */
+class ArrowToJdbcUtils {
+  static boolean isSigned(ArrowType type) {
+    switch (type.getTypeID()) {
+      case Int:
+      case FloatingPoint:
+      case Decimal:
+      case Interval:
+      case Duration:
+        return true;
+      default:
+        return false;
+    }
+  }
+
+  static int toJdbcType(ArrowType type) {
+    switch (type.getTypeID()) {
+      case Null:
+        return Types.NULL;
+      case Struct:
+        return Types.STRUCT;
+      case List:
+      case LargeList:
+      case FixedSizeList:
+        return Types.ARRAY;
+      case Int:
+        return ((ArrowType.Int) type).getBitWidth() == 64 ? Types.BIGINT : 
Types.INTEGER;

Review Comment:
   Should this switch on getBitWidth() as well to return SmallInt and Tinyint?



-- 
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