Class JdbcToArrowConfig

java.lang.Object
org.apache.arrow.adapter.jdbc.JdbcToArrowConfig

public final class JdbcToArrowConfig extends Object
This class configures the JDBC-to-Arrow conversion process.

The allocator is used to construct the VectorSchemaRoot, and the calendar is used to define the time zone of any ArrowType.Timestamp fields that are created during the conversion. Neither field may be null.

If the includeMetadata flag is set, the Arrow field metadata will contain information from the corresponding ResultSetMetaData that was used to create the FieldType of the corresponding FieldVector.

If there are any Types.ARRAY fields in the ResultSet, the corresponding JdbcFieldInfo for the array's contents must be defined here. Unfortunately, the sub-type information cannot be retrieved from all JDBC implementations (H2 for example, returns Types.NULL for the array sub-type), so it must be configured here. The column index or name can be used to map to a JdbcFieldInfo, and that will be used for the conversion.

  • Field Details

  • Method Details

    • getCalendar

      public Calendar getCalendar()
      The calendar to use when defining Arrow Timestamp fields and retrieving Date, Time, or Timestamp data types from the ResultSet, or null if not converting.
      Returns:
      the calendar.
    • getAllocator

      public BufferAllocator getAllocator()
      The Arrow memory allocator.
      Returns:
      the allocator.
    • shouldIncludeMetadata

      public boolean shouldIncludeMetadata()
      Whether to include JDBC ResultSet field metadata in the Arrow Schema field metadata.
      Returns:
      true to include field metadata, false to exclude it.
    • getTargetBatchSize

      public int getTargetBatchSize()
      Get the target batch size for partial read.
    • isReuseVectorSchemaRoot

      public boolean isReuseVectorSchemaRoot()
      Get whether it is allowed to reuse the vector schema root.
    • getJdbcToArrowTypeConverter

      public Function<JdbcFieldInfo,ArrowType> getJdbcToArrowTypeConverter()
      Gets the mapping between JDBC type information to Arrow type.
    • getJdbcConsumerGetter

      public JdbcToArrowConfig.JdbcConsumerFactory getJdbcConsumerGetter()
      Gets the JDBC consumer getter.
    • getArraySubTypeByColumnIndex

      public JdbcFieldInfo getArraySubTypeByColumnIndex(int index)
      Returns the array sub-type JdbcFieldInfo defined for the provided column index.
      Parameters:
      index - The ResultSetMetaData column index of an Types.ARRAY type.
      Returns:
      The JdbcFieldInfo for that array's sub-type, or null if not defined.
    • getArraySubTypeByColumnName

      public JdbcFieldInfo getArraySubTypeByColumnName(String name)
      Returns the array sub-type JdbcFieldInfo defined for the provided column name.
      Parameters:
      name - The ResultSetMetaData column name of an Types.ARRAY type.
      Returns:
      The JdbcFieldInfo for that array's sub-type, or null if not defined.
    • getExplicitTypeByColumnIndex

      public JdbcFieldInfo getExplicitTypeByColumnIndex(int index)
      Returns the type JdbcFieldInfo explicitly defined for the provided column index.
      Parameters:
      index - The ResultSetMetaData column index to evaluate for explicit type mapping.
      Returns:
      The JdbcFieldInfo defined for the column, or null if not defined.
    • getExplicitTypeByColumnName

      public JdbcFieldInfo getExplicitTypeByColumnName(String name)
      Returns the type JdbcFieldInfo explicitly defined for the provided column name.
      Parameters:
      name - The ResultSetMetaData column name to evaluate for explicit type mapping.
      Returns:
      The JdbcFieldInfo defined for the column, or null if not defined.
    • getSchemaMetadata

      public Map<String,String> getSchemaMetadata()
      Return schema level metadata or null if not provided.
    • getColumnMetadataByColumnIndex

      public Map<Integer,Map<String,String>> getColumnMetadataByColumnIndex()
      Return metadata from columnIndex->meta map on per field basis or null if not provided.
    • getBigDecimalRoundingMode

      public RoundingMode getBigDecimalRoundingMode()