Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-175

Modify Schema SPI to allow caching



    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:


      The Schema SPI provides tables, table functions, and sub-schemas via getTableNames, getTable, getTableFunctionNames, getTableFunctions, getSubSchemaNames, getSubSchema. And AbstractSchema additionally provides getTableMap(), getTableFunctionMap(), getSubSchemaMap().

      However, we do not specify what should happen if the schema changes; for example, what `CsvSchema` should do it someone adds a .csv file to the directory. Should it re-derive every time? Should optiq assume that the map never changes, and therefore can build a cache?

      This is especially relevant when handling case-insensitive name resolution. The above methods are (and will remain) case-sensitive. So the only way to find out whether there is a case-insensitive match for a table (or table-function or sub-schema) is to read all keys in the map. We would like to build a cache, but we need to make sure that the cache does not overstay its welcome.

      We could add the following method to `Schema`:

      /** Returns whether the contents of the schema (tables, table functions and

      • sub-schemas) have changed since a given system time. If this method
      • returns true, Optiq will rebuild the cache that it built at {@code time}


      • The default implementation in {@link AbstractSchema}

        always returns

      • {@code false}

        . */
        boolean contentsHaveChangedSince(long time);

      and a default implementation in `AbstractSchema`.

      ---------------- Imported from GitHub ----------------
      Url: https://github.com/julianhyde/optiq/issues/175
      Created by: julianhyde
      Labels: enhancement,
      Created at: Mon Mar 10 23:26:54 CET 2014
      State: closed




            • Assignee:
              github-import GitHub Import
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: