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

Make Schema and Table SPIs simpler to implement, and make them re-usable across connections

    Details

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

      Description

      Currently you can only create a Schema when you have a QueryProvider, and the usual implementation of QueryProvider is an OptiqConnection. Thus you have to build a Schema for each connection. The reason for this is that each Table implements Queryable, and therefore needs to contain sufficient information that you can call enumerator() on any Table.

      Also, if a Schema is to be long-lived, it cannot own a type-factory. One of the important functions of RelDataTypeFactory is to convert types to canonical form: for two instances of RelDataType t1 and t2 created by the same type factory, t1.equals(t2) if and only if t1 == t2. But if type factory is long-lived, the list of canonized types can build up and behave like a memory leak.

      Proposed changes:

      • remove Schema.getTypeFactory() and Schema.getQueryProvider() methods;
      • Table would no longer implement Queryable;
      • add a new method Table.toQueryable(QueryProvider);
      • add a interface Type, with method RelDataType Type.toOptiqType(RelDataTypeFactory)
      • change Table.getRowType() to return Type, not RelDataType.

      The changes to the type system allow tables to represent their type in whichever way is best for their domain. The toOptiqType method is called within the context of a statement, and can therefore use a type factory to canonize the RelDataType objects it returns. But optiq does not require or expect that Type instances are canonical.

      ---------------- Imported from GitHub ----------------
      Url: https://github.com/julianhyde/optiq/issues/106
      Created by: julianhyde
      Labels:
      Created at: Tue Dec 17 21:34:07 CET 2013
      State: closed

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: