All Superinterfaces:
BasicFileStore, ReadableTabularDataSource
All Known Implementing Classes:
ParquetFileStoreConnector

public interface ParquetFileStore extends BasicFileStore, ReadableTabularDataSource
ParquetFileStore defines the specific connector api for working with Apache Parquet files. A Parquet file holds a table of data organized by column. It ends with a footer that describes the schema of the table, the number of rows, how the values are stored and statistics about the values in each column. This interface provides access to the information in the footer.

It also provides access to the rows of data in the file, both through its own methods and by extending the standard interface for a tabular data source. Reading the data relies on the DuckDB JDBC driver being available at runtime - see isDataAccessAvailable(). The methods that return information from the footer do not need it.
  • Method Details

    • getFileMetadata

      Return the description of the file's contents from its footer.
      Returns:
      file metadata
      Throws:
      FileException - a problem accessing the file
      FileReadException - unable to read the file, or it is not a Parquet file that the connector can describe
    • getRecordCount

      long getRecordCount() throws FileException, FileReadException
      Return the number of rows in the file. This value comes from the footer, so the size of the file makes no difference to how long it takes.
      Specified by:
      getRecordCount in interface ReadableTabularDataSource
      Returns:
      count
      Throws:
      FileException - a problem accessing the file
      FileReadException - unable to read the file, or it is not a Parquet file that the connector can describe
    • getColumnNames

      List<String> getColumnNames() throws FileException, FileReadException
      Return the list of top-level column names in the file.
      Returns:
      a list of column names
      Throws:
      FileException - a problem accessing the file
      FileReadException - unable to read the file, or it is not a Parquet file that the connector can describe
    • isDataAccessAvailable

      boolean isDataAccessAvailable()
      Return whether the rows of data in the file can be read. This is true when the DuckDB JDBC driver is on the class path.
      Returns:
      boolean
    • readRecord

      List<String> readRecord(long rowNumber) throws FileException, FileReadException
      Return the requested row of data. The first row is row 0.
      Specified by:
      readRecord in interface ReadableTabularDataSource
      Parameters:
      rowNumber - long
      Returns:
      list of strings, each string is the value from a top-level column. A null value is returned as null. The value of a column that holds nested data is formatted as a string.
      Throws:
      FileException - a problem accessing the file
      FileReadException - unable to read the data, or the file does not include the requested row.
    • getValueCounts

      Map<String,Long> getValueCounts(String columnName, int maxDistinctValues) throws FileException, FileReadException
      Return how many times each value occurs in a top-level column, with the most frequent value first. Nulls are not included. This reads all the values in the column.
      Parameters:
      columnName - the name of a top-level column
      maxDistinctValues - the largest number of different values to return
      Returns:
      map of value to the number of times it occurs, or null if the column has more than the maximum number of different values
      Throws:
      FileException - a problem accessing the file
      FileReadException - unable to read the data