That there are open bugs doesn’t imply that RelJson isn’t used for serious 
purposes. Just that it’s open source software. Bugs get fixed only when someone 
cares enough to fix them.

It is very useful to log bugs even if there is no guarantee that they will be 
immediately fixed. As a searchable issue repository, Jira is much more 
effective than the email archive.

I agree that you have discovered a bug. Please log it.

Julian


> On Jan 14, 2025, at 11:45 PM, stanilovsky evgeny <[email protected]> 
> wrote:
> 
> Hi, all !
> Whats the purpose for RelJson(Reader|Writer) classes, is it just an example 
> how RelNode`s can be serialized?
> If so - it answers my question.
> 
> But if it something more seems there is some bugs are present after [1] was 
> implemented,
> In particular NaN and Inf cannot be correctly deserialized, short reproducer 
> below, do i need to fill an issue?
> 
> Thanks !
> 
> place this into RelWriterTest
> ---
>  @Test void testInf() {
>      Frameworks.withPlanner((cluster, relOptSchema, rootSchema) -> {
>        final RexBuilder rexBuilder = cluster.getRexBuilder();
>        final FrameworkConfig config = RelBuilderTest.config().build();
>        final RelBuilder builder = RelBuilder.create(config);
> 
>        RelDataType doubleType = cluster.getTypeFactory().builder().add("name",
>            
> cluster.getTypeFactory().createSqlType(SqlTypeName.DOUBLE)).build();
> 
>        final RelDataType doubleTypeLit =
>            cluster.getTypeFactory().createSqlType(SqlTypeName.DOUBLE);
>        RexLiteral lit = 
> rexBuilder.makeApproxLiteral(Double.POSITIVE_INFINITY, // <---
>            doubleTypeLit);
>        RelNode vals = builder.values(Collections.nCopies(1, List.of(lit)), 
> doubleType).build();
> 
>        final RelJsonWriter writer = new RelJsonWriter();
>        vals.explain(writer);
>        String serialized = writer.asString();
> 
>        SchemaPlus schema = rootSchema.add("hr",
>            new ReflectiveSchema(new HrSchema()));
>        final RelJsonReader reader =
>            new RelJsonReader(cluster, relOptSchema, schema);
>        RelNode node;
>        try {
>          node = reader.read(serialized); // <- raised from here
>        } catch (IOException e) {
>          throw TestUtil.rethrow(e);
>        }
>        return RelOptUtil.dumpPlan("", node, SqlExplainFormat.TEXT,
>            SqlExplainLevel.EXPPLAN_ATTRIBUTES);
>      });
>  }
> ---
> will raise:
> com.fasterxml.jackson.core.JsonParseException: Non-standard token 'Infinity': 
> enable `JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS` to allow
> 
> [1] https://issues.apache.org/jira/browse/CALCITE-2067

Reply via email to