in flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/ArrowDatabaseMetadata.java [1163:1201]
static Integer getDecimalDigits(final ArrowType fieldType) {
// We aren't setting DECIMAL_DIGITS for Float/Double as their precision and scale are variable.
if (fieldType instanceof ArrowType.Decimal) {
final ArrowType.Decimal thisDecimal = (ArrowType.Decimal) fieldType;
return thisDecimal.getScale();
} else if (fieldType instanceof ArrowType.Int) {
return NO_DECIMAL_DIGITS;
} else if (fieldType instanceof ArrowType.Timestamp) {
switch (((ArrowType.Timestamp) fieldType).getUnit()) {
case SECOND:
return NO_DECIMAL_DIGITS;
case MILLISECOND:
return DECIMAL_DIGITS_TIME_MILLISECONDS;
case MICROSECOND:
return DECIMAL_DIGITS_TIME_MICROSECONDS;
case NANOSECOND:
return DECIMAL_DIGITS_TIME_NANOSECONDS;
default:
break;
}
} else if (fieldType instanceof ArrowType.Time) {
switch (((ArrowType.Time) fieldType).getUnit()) {
case SECOND:
return NO_DECIMAL_DIGITS;
case MILLISECOND:
return DECIMAL_DIGITS_TIME_MILLISECONDS;
case MICROSECOND:
return DECIMAL_DIGITS_TIME_MICROSECONDS;
case NANOSECOND:
return DECIMAL_DIGITS_TIME_NANOSECONDS;
default:
break;
}
} else if (fieldType instanceof ArrowType.Date) {
return NO_DECIMAL_DIGITS;
}
return null;
}