Sergey Nuyanzin created CALCITE-5613:
----------------------------------------

             Summary: Add assert for number of args for metadata methods at 
CacheGeneratorUtil
                 Key: CALCITE-5613
                 URL: https://issues.apache.org/jira/browse/CALCITE-5613
             Project: Calcite
          Issue Type: Improvement
          Components: core
    Affects Versions: 1.34.0
            Reporter: Sergey Nuyanzin


The problem is that it implicitly implies that method should have 2+ args based 
on 
{{org.apache.calcite.rel.metadata.janino.CacheGeneratorUtil.CacheKeyStrategy#safeArgList}}.

At the same time different libs like JaCoCo could generate extra methods like 
{{private static boolean[] 
org.apache.calcite.rel.metadata.BuiltInMetadata$Predicates$Handler.$jacocoInit()}}.

It took several hours to realize it.... since currently it complains like
{noformat}
java.lang.IllegalArgumentException: fromIndex(2) > toIndex(0)
        at 
java.base/java.util.AbstractList.subListRangeCheck(AbstractList.java:509)
        at java.base/java.util.AbstractList.subList(AbstractList.java:497)
        at 
org.apache.calcite.rel.metadata.janino.CacheGeneratorUtil$CacheKeyStrategy$1.safeArgList(CacheGeneratorUtil.java:213)
        at 
org.apache.calcite.rel.metadata.janino.CacheGeneratorUtil$CacheKeyStrategy$1.cacheKeyBlock(CacheGeneratorUtil.java:205)
...
{noformat}

The idea is to put assert something like that
{code:java}
assert method.getParameterCount() >= 2 : method.toString();
{code}
to simplify the process of finding the root cause



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to