avantgardnerio commented on code in PR #33961:
URL: https://github.com/apache/arrow/pull/33961#discussion_r1092481994


##########
java/flight/flight-sql-jdbc-driver/src/main/java/org/apache/arrow/driver/jdbc/utils/ConvertUtils.java:
##########
@@ -37,6 +45,114 @@ public final class ConvertUtils {
   private ConvertUtils() {
   }
 
+  static boolean isSigned(ArrowType.ArrowTypeID type) {
+    switch (type) {
+      case Int:
+      case FloatingPoint:
+      case Decimal:
+      case Interval:
+      case Duration:
+        return true;
+    }
+    return false;
+  }
+
+  static int toJdbcType(ArrowType.ArrowTypeID type) {
+    switch (type) {
+      case Null:
+        return JDBCType.NULL.ordinal();
+      case Struct:
+        return JDBCType.STRUCT.ordinal();
+      case List:
+      case LargeList:
+      case FixedSizeList:
+        return JDBCType.ARRAY.ordinal();
+      case Int:
+        return JDBCType.INTEGER.ordinal();
+      case FloatingPoint:
+        return JDBCType.FLOAT.ordinal();
+      case Utf8:
+      case LargeUtf8:
+        return JDBCType.VARCHAR.ordinal();
+      case Binary:
+      case LargeBinary:
+        return JDBCType.VARBINARY.ordinal();
+      case FixedSizeBinary:
+        return JDBCType.BINARY.ordinal();
+      case Bool:
+        return JDBCType.BOOLEAN.ordinal();
+      case Decimal:
+        return JDBCType.DECIMAL.ordinal();
+      case Date:
+        return JDBCType.DATE.ordinal();
+      case Time:
+        return JDBCType.TIME.ordinal();
+      case Timestamp:
+      case Interval:
+      case Duration:
+        return JDBCType.TIMESTAMP.ordinal();
+    }
+    return JDBCType.OTHER.ordinal();
+  }
+
+  static String getClassName(ArrowType.ArrowTypeID type) {
+    switch (type) {
+      case List:
+      case LargeList:
+      case FixedSizeList:
+        return ArrayList.class.getCanonicalName();
+      case Map:
+        return HashMap.class.getCanonicalName();
+      case Int:
+        return int.class.getCanonicalName();
+      case FloatingPoint:
+        return float.class.getCanonicalName();
+      case Utf8:
+      case LargeUtf8:
+        return String.class.getCanonicalName();
+      case Binary:
+      case LargeBinary:
+      case FixedSizeBinary:
+        return byte[].class.getCanonicalName();
+      case Bool:
+        return boolean.class.getCanonicalName();
+      case Decimal:
+        return BigDecimal.class.getCanonicalName();
+      case Date:
+        return Date.class.getCanonicalName();
+      case Time:
+        return Time.class.getCanonicalName();
+      case Timestamp:
+      case Interval:
+      case Duration:
+        return Timestamp.class.getCanonicalName();
+    }
+    return null;

Review Comment:
   FlightSql schema are quite the superset of JDBC, so the mapping of deeply 
nested structs and such should probably be a subsequent PR?



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