XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.26.0
    • None
    • core
    • None

    Description

      It turns out RelBuilder#relOptSchema is often null.
      For instance,

      public abstract class RelOptRuleCall {
        public RelBuilder builder() {
          return rule.relBuilderFactory.create(rel(0).getCluster(), /* schema= */ null);
        }
      

      It leads to NPE in user code.
      I suggest either populate relOptSchema with root schema by default or remove the field to avoid confusion for those who would try scan(...) method.

      It might make sense to add RelOptSchema parameter to scan(Iterable<String>) method as well.

      Sample use case:

          @Override
          public void onMatch(RelOptRuleCall call) {
              List<String> indexName = ...;
              RelBuilder relBuilder = call.builder()
                      .scan(indexName);
      
      Caused by: java.lang.NullPointerException
      	at org.apache.calcite.tools.RelBuilder.scan(RelBuilder.java:1094)
      	at com.github.vlsi.mat.calcite.schema.objects.InstanceAccessByClassIdRule.onMatch(InstanceAccessByClassIdRule.java:44)
      	at org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:229)
      	... 75 more
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            vladimirsitnikov Vladimir Sitnikov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: