[
https://issues.apache.org/jira/browse/CALCITE-5613?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mihai Budiu resolved CALCITE-5613.
----------------------------------
Fix Version/s: 1.38.0
Resolution: Fixed
Fixed in
https://github.com/apache/calcite/commit/dac001d8ce7199e84f1148ea7bb57bc2dd83ea91
Thank you for the contribution, github user bpranava
> 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
> Priority: Trivial
> Labels: pull-request-available
> Fix For: 1.38.0
>
>
> 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)