calcite icon indicating copy to clipboard operation
calcite copied to clipboard

[CALCITE-6912] Test showing a sample failure of Enumerable codes handling of byte[] columns

Open chrisdennis opened this issue 9 months ago • 3 comments

This test fails due to the impossible cast of byte[] to ByteString in the moveNext() method:

public org.apache.calcite.linq4j.Enumerable bind(final org.apache.calcite.DataContext root) {
  final org.apache.calcite.linq4j.Enumerable _inputEnumerable = org.apache.calcite.linq4j.Linq4j.asEnumerable(((org.apache.calcite.test.schemata.catchall.CatchallSchema) ((org.apache.calcite.adapter.java.ReflectiveSchema) root.getRootSchema().getSubSchema("s").unwrap(org.apache.calcite.adapter.java.ReflectiveSchema.class)).getTarget()).everyTypes).select(new org.apache.calcite.linq4j.function.Function1() {
    public org.apache.calcite.test.schemata.catchall.CatchallSchema.EveryType apply(org.apache.calcite.test.schemata.catchall.CatchallSchema.EveryType row) {
      return new org.apache.calcite.test.schemata.catchall.CatchallSchema.EveryType(
          row.primitiveBoolean,
          row.primitiveByte,
          row.primitiveChar,
          row.primitiveShort,
          row.primitiveInt,
          row.primitiveLong,
          row.primitiveFloat,
          row.primitiveDouble,
          row.wrapperBoolean,
          row.wrapperByte,
          row.wrapperCharacter,
          row.wrapperShort,
          row.wrapperInteger,
          row.wrapperLong,
          row.wrapperFloat,
          row.wrapperDouble,
          row.sqlDate,
          row.sqlTime,
          row.sqlTimestamp,
          row.utilDate,
          row.string,
          row.bigDecimal,
          row.list,
          row.bytes);
    }
    public Object apply(Object row) {
      return apply(
        (org.apache.calcite.test.schemata.catchall.CatchallSchema.EveryType) row);
    }
  }
  );
  return new org.apache.calcite.linq4j.AbstractEnumerable(){
      public org.apache.calcite.linq4j.Enumerator enumerator() {
        return new org.apache.calcite.linq4j.Enumerator(){
            public final org.apache.calcite.linq4j.Enumerator inputEnumerator = _inputEnumerable.enumerator();
            public void reset() {
              inputEnumerator.reset();
            }

            public boolean moveNext() {
              while (inputEnumerator.moveNext()) {
                final byte[] input_value = ((org.apache.calcite.test.schemata.catchall.CatchallSchema.EveryType) inputEnumerator.current()).bytes;
                final org.apache.calcite.avatica.util.ByteString cast_value = input_value == null ? null : (org.apache.calcite.avatica.util.ByteString) input_value;
                final byte[] value_dynamic_param = (byte[]) root.get("?0");
                final org.apache.calcite.avatica.util.ByteString cast_value0 = value_dynamic_param == null ? null : (org.apache.calcite.avatica.util.ByteString) value_dynamic_param;
                final Boolean binary_call_value = cast_value == null || cast_value0 == null ? null : Boolean.valueOf(org.apache.calcite.runtime.SqlFunctions.eq(cast_value, cast_value0));
                if (binary_call_value != null && org.apache.calcite.runtime.SqlFunctions.toBoolean(binary_call_value)) {
                  return true;
                }
              }
              return false;
            }

            public void close() {
              inputEnumerator.close();
            }

            public Object current() {
              return ((org.apache.calcite.test.schemata.catchall.CatchallSchema.EveryType) inputEnumerator.current()).primitiveBoolean;
            }

          };
      }

    };
}


public Class getElementType() {
  return boolean.class;
}

chrisdennis avatar Mar 25 '25 20:03 chrisdennis

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 90 days if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions.

github-actions[bot] avatar Apr 25 '25 03:04 github-actions[bot]

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 90 days if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions.

github-actions[bot] avatar Jun 28 '25 03:06 github-actions[bot]

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 90 days if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions.

github-actions[bot] avatar Oct 25 '25 03:10 github-actions[bot]