[ 
https://issues.apache.org/jira/browse/CALCITE-3228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chunwei Lei updated CALCITE-3228:
---------------------------------
    Description: 
The following test can reproduce the issue.

 
{code:java}
// FrameworksTest.java
 @Test public void testMinMax() throws Exception {
 Table table = new TableImpl();
 final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
 SchemaPlus schema = rootSchema.add("x", new AbstractSchema());
 schema.add("MYTABLE", table);
 List<RelTraitDef> traitDefs = new ArrayList<>();
 traitDefs.add(ConventionTraitDef.INSTANCE);
 traitDefs.add(RelDistributionTraitDef.INSTANCE);
 SqlParser.Config parserConfig =
 SqlParser.configBuilder(SqlParser.Config.DEFAULT)
 .setCaseSensitive(false)
 .build();
final FrameworkConfig config = Frameworks.newConfigBuilder()
 .parserConfig(parserConfig)
 .defaultSchema(schema)
 .traitDefs(traitDefs)
 // define the rules you want to apply
 .ruleSets(
 RuleSets.ofList(AbstractConverter.ExpandConversionRule.INSTANCE, 
ProjectTableScanRule.INSTANCE))
 .programs(Programs.ofRules(Programs.RULE_SET))
 .build();
executeQuery(config, " select min(id) as mi, max(id) as ma from mytable where 
id=1 group by id",
 CalciteSystemProperty.DEBUG.value());
 }
{code}
 

This is from 
[https://lists.apache.org/thread.html/67cb614ddd123a9092fdf37ace279eb563838b045a5554ad0005f030@%3Cdev.calcite.apache.org%3E]

 

  was:
The following test can reproduce the issue.

 
{code:java}
// FrameworksTest.java
 @Test public void testMinMax() throws Exception {
 Table table = new TableImpl();
 final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
 SchemaPlus schema = rootSchema.add("x", new AbstractSchema());
 schema.add("MYTABLE", table);
 List<RelTraitDef> traitDefs = new ArrayList<>();
 traitDefs.add(ConventionTraitDef.INSTANCE);
 traitDefs.add(RelDistributionTraitDef.INSTANCE);
 SqlParser.Config parserConfig =
 SqlParser.configBuilder(SqlParser.Config.DEFAULT)
 .setCaseSensitive(false)
 .build();
final FrameworkConfig config = Frameworks.newConfigBuilder()
 .parserConfig(parserConfig)
 .defaultSchema(schema)
 .traitDefs(traitDefs)
 // define the rules you want to apply
 .ruleSets(
 RuleSets.ofList(AbstractConverter.ExpandConversionRule.INSTANCE, 
ProjectTableScanRule.INSTANCE))
 .programs(Programs.ofRules(Programs.RULE_SET))
 .build();
executeQuery(config, " select min(id) as mi, max(id) as ma from mytable where 
id=1 group by id",
 CalciteSystemProperty.DEBUG.value());
 }
{code}
 


> Error while applying rule ProjectScanRule: interpreter
> ------------------------------------------------------
>
>                 Key: CALCITE-3228
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3228
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Chunwei Lei
>            Assignee: Danny Chan
>            Priority: Critical
>             Fix For: 1.21.0
>
>         Attachments: CALCITE-3228.patch, TestCalcite.java
>
>
> The following test can reproduce the issue.
>  
> {code:java}
> // FrameworksTest.java
>  @Test public void testMinMax() throws Exception {
>  Table table = new TableImpl();
>  final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
>  SchemaPlus schema = rootSchema.add("x", new AbstractSchema());
>  schema.add("MYTABLE", table);
>  List<RelTraitDef> traitDefs = new ArrayList<>();
>  traitDefs.add(ConventionTraitDef.INSTANCE);
>  traitDefs.add(RelDistributionTraitDef.INSTANCE);
>  SqlParser.Config parserConfig =
>  SqlParser.configBuilder(SqlParser.Config.DEFAULT)
>  .setCaseSensitive(false)
>  .build();
> final FrameworkConfig config = Frameworks.newConfigBuilder()
>  .parserConfig(parserConfig)
>  .defaultSchema(schema)
>  .traitDefs(traitDefs)
>  // define the rules you want to apply
>  .ruleSets(
>  RuleSets.ofList(AbstractConverter.ExpandConversionRule.INSTANCE, 
> ProjectTableScanRule.INSTANCE))
>  .programs(Programs.ofRules(Programs.RULE_SET))
>  .build();
> executeQuery(config, " select min(id) as mi, max(id) as ma from mytable where 
> id=1 group by id",
>  CalciteSystemProperty.DEBUG.value());
>  }
> {code}
>  
> This is from 
> [https://lists.apache.org/thread.html/67cb614ddd123a9092fdf37ace279eb563838b045a5554ad0005f030@%3Cdev.calcite.apache.org%3E]
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to