Class GoogleSheetsStoragePlugin

java.lang.Object
org.apache.drill.exec.store.AbstractStoragePlugin
org.apache.drill.exec.store.googlesheets.GoogleSheetsStoragePlugin
All Implemented Interfaces:
AutoCloseable, SchemaFactory, StoragePlugin

public class GoogleSheetsStoragePlugin extends AbstractStoragePlugin
  • Constructor Details

  • Method Details

    • initializeOauthTokenTable

      public void initializeOauthTokenTable(SchemaConfig schemaConfig)
    • getDataStore

      public com.google.api.client.util.store.DataStore<com.google.api.client.auth.oauth2.StoredCredential> getDataStore(String username)
    • registerSchemas

      public void registerSchemas(SchemaConfig schemaConfig, org.apache.calcite.schema.SchemaPlus parent)
      Description copied from interface: SchemaFactory
      Register the schemas provided by this SchemaFactory implementation under the given parent schema.
      Parameters:
      schemaConfig - Configuration for schema objects.
      parent - Reference to parent schema.
    • getTokenTable

      public PersistentTokenTable getTokenTable()
    • getPhysicalScan

      public AbstractGroupScan getPhysicalScan(String userName, JSONOptions selection, SessionOptionManager options) throws IOException
      Description copied from interface: StoragePlugin
      Get the physical scan operator for the particular GroupScan (read) node.
      Specified by:
      getPhysicalScan in interface StoragePlugin
      Overrides:
      getPhysicalScan in class AbstractStoragePlugin
      Parameters:
      userName - User whom to impersonate when reading the contents as part of Scan.
      selection - The configured storage engine specific selection.
      options - (optional) session options
      Returns:
      The physical scan operator for the particular GroupScan (read) node.
      Throws:
      IOException
    • getPhysicalScan

      public AbstractGroupScan getPhysicalScan(String userName, JSONOptions selection, SessionOptionManager options, MetadataProviderManager metadataProviderManager) throws IOException
      Description copied from interface: StoragePlugin
      Get the physical scan operator for the particular GroupScan (read) node.
      Specified by:
      getPhysicalScan in interface StoragePlugin
      Overrides:
      getPhysicalScan in class AbstractStoragePlugin
      Parameters:
      userName - User whom to impersonate when reading the contents as part of Scan.
      selection - The configured storage engine specific selection.
      options - (optional) session options
      metadataProviderManager - manager for handling metadata providers
      Returns:
      The physical scan operator for the particular GroupScan (read) node.
      Throws:
      IOException
    • getPhysicalScan

      public AbstractGroupScan getPhysicalScan(String userName, JSONOptions selection, List<SchemaPath> columns) throws IOException
      Description copied from interface: StoragePlugin
      Get the physical scan operator for the particular GroupScan (read) node.
      Specified by:
      getPhysicalScan in interface StoragePlugin
      Overrides:
      getPhysicalScan in class AbstractStoragePlugin
      Parameters:
      userName - User whom to impersonate when reading the contents as part of Scan.
      selection - The configured storage engine specific selection.
      columns - (optional) The list of column names to scan from the data source.
      Returns:
      The physical scan operator for the particular GroupScan (read) node.
      Throws:
      IOException
    • getPhysicalScan

      public AbstractGroupScan getPhysicalScan(String userName, JSONOptions selection) throws IOException
      Description copied from interface: StoragePlugin
      Get the physical scan operator for the particular GroupScan (read) node.
      Specified by:
      getPhysicalScan in interface StoragePlugin
      Overrides:
      getPhysicalScan in class AbstractStoragePlugin
      Parameters:
      userName - User whom to impersonate when when reading the contents as part of Scan.
      selection - The configured storage engine specific selection.
      Returns:
      The physical scan operator for the particular GroupScan (read) node.
      Throws:
      IOException
    • getPhysicalScan

      public AbstractGroupScan getPhysicalScan(String userName, JSONOptions selection, List<SchemaPath> columns, SessionOptionManager options, MetadataProviderManager metadataProviderManager) throws IOException
      Description copied from interface: StoragePlugin
      Get the physical scan operator for the particular GroupScan (read) node.
      Specified by:
      getPhysicalScan in interface StoragePlugin
      Overrides:
      getPhysicalScan in class AbstractStoragePlugin
      Parameters:
      userName - User whom to impersonate when reading the contents as part of Scan.
      selection - The configured storage engine specific selection.
      columns - (optional) The list of column names to scan from the data source.
      options - (optional) session options
      metadataProviderManager - manager for handling metadata providers
      Returns:
      The physical scan operator for the particular GroupScan (read) node.
      Throws:
      IOException
    • getOptimizerRules

      public Set<? extends org.apache.calcite.plan.RelOptRule> getOptimizerRules(OptimizerRulesContext optimizerContext, PlannerPhase phase)
      Description copied from interface: StoragePlugin
      An implementation of this method will return one or more specialized rules that Drill query optimizer can leverage in physical space. Otherwise, it should return an empty set.
      Returns:
      an empty set or a set of plugin specific physical optimizer rules.
    • getConfig

      public StoragePluginConfig getConfig()
      Description copied from interface: StoragePlugin
      Method returns a Jackson serializable object that extends a StoragePluginConfig.
      Returns:
      an extension of StoragePluginConfig
    • initializeTokenTableForTesting

      public void initializeTokenTableForTesting()
      This function is only used for testing and creates the necessary token tables. Note that the token tables still need to be populated.
    • supportsWrite

      public boolean supportsWrite()
      Description copied from interface: StoragePlugin
      Indicates if Drill can write a table to this format (e.g. as JSON, csv, etc.).
      Specified by:
      supportsWrite in interface StoragePlugin
      Overrides:
      supportsWrite in class AbstractStoragePlugin
    • supportsInsert

      public boolean supportsInsert()
      Description copied from interface: StoragePlugin
      Indicates if Drill can insert to a table to this plugin.
      Specified by:
      supportsInsert in interface StoragePlugin
      Overrides:
      supportsInsert in class AbstractStoragePlugin
    • getSheetsService

      public com.google.api.services.sheets.v4.Sheets getSheetsService(String queryUser)
      This method gets (and caches) the Google Service needed for API calls.
      Returns:
      An authenticated Sheets Google Sheets service.
    • getDriveService

      public com.google.api.services.drive.Drive getDriveService(String queryUser)
      This method gets (and caches) the Google Drive Service needed for mapping Google Sheet names to file tokens.
      Parameters:
      queryUser - A String of the current query user.
      Returns:
      A validated and authenticated Drive instance.