Details

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

      Description

      Currently, the easiest way for a Table to return results is to implement TranslatableTable, and in the toRel method return a RelNode. That RelNode is typically a sub-class of TableAccessRelBase and implements itself by generating Java code, which must be compiled an executed.

      We propose an interfaces so that a Table can return results directly.

      import net.hydromatic.avatica.Cursor;
      import org.eigenbase.util.Pair;
      import net.hydromatic.optiq.Table;
      import org.eigenbase.rex.RexNode;
      import org.eigenbase.reltype.RelDataTypeField;
      
      interface CursorableTable extends Table {
        /** Returns a cursor over the rows in this Table. */
        Cursor scan();
      }
      
      interface ProjectableCursorableTable extends Table {
        /** Given a list of filters and a list of fields to project, returns a
         * cursor over the rows in this Table and a list of filters that it
         * could not implement.
         *
         * <p>The cursor must implement the projects and any filters not
         * in the list. */
        Pair<Cursor, List<RexNode>> projectFilterScan(List<RexNode> filters, List<RelDataTypeField> projects);
      }
      

      Cursor is a simple API to implement.

      A table that implements the CursorableTable SPI does not need to implement TranslatableTable, and so can return its results without doing any code generation.

      The ProjectableCursorableTable SPI is also optional and goes further; it allows Calcite to push down simple projects and filters without the Table implementor writing any rules or code-generation code. If the implementation of the SPI cannot handle a particular filter, it just returns it, and Calcite will add its own filter to implement it.

        Issue Links

          Activity

          Hide
          julianhyde Julian Hyde added a comment -

          It's possible the fix also fixes OPTIQ-397. Check when the fix is ready.

          Show
          julianhyde Julian Hyde added a comment - It's possible the fix also fixes OPTIQ-397 . Check when the fix is ready.
          Hide
          vladimirsitnikov Vladimir Sitnikov added a comment -

          Julian, I guess you've just commented a wrong issue.
          How come another SPI fixes "SELECT DISTINCT * gives ClassCastException at runtime"?

          Show
          vladimirsitnikov Vladimir Sitnikov added a comment - Julian, I guess you've just commented a wrong issue. How come another SPI fixes "SELECT DISTINCT * gives ClassCastException at runtime"?
          Hide
          julianhyde Julian Hyde added a comment -

          I got the right issue. I fixed how the enumerable code-generation converts between row types of Object[], Object, Row and <Synthetic class>. It's there in https://github.com/julianhyde/optiq/commits/optiq-436. It might not solve OPTIQ-397, but it's worth checking when I push to master.

          Show
          julianhyde Julian Hyde added a comment - I got the right issue. I fixed how the enumerable code-generation converts between row types of Object[], Object, Row and <Synthetic class>. It's there in https://github.com/julianhyde/optiq/commits/optiq-436 . It might not solve OPTIQ-397 , but it's worth checking when I push to master.
          Show
          julianhyde Julian Hyde added a comment - Fixed in http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/263640ff .
          Hide
          julianhyde Julian Hyde added a comment -

          Bulk update closing "fixed" issues that are more than a year old.

          Show
          julianhyde Julian Hyde added a comment - Bulk update closing "fixed" issues that are more than a year old.

            People

            • Assignee:
              julianhyde Julian Hyde
              Reporter:
              julianhyde Julian Hyde
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development