Skip to content

[Bug]: CTAS with bitwise aggregate functions infers schema differently from MySQL #24431

Closed

Description

@Ariznawlll

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

20346ca

Other Environment Information

- MO version: 8.0.30-MatrixOne-v
- MySQL version: 8.0.45
- Verify date: 2026-05-18

Actual Behavior

CREATE TABLE ... AS SELECT with bit_and/bit_or/bit_xor infers nullable/default differently from MySQL.

MO:

CREATE TABLE `bit02` (
  `bit_and(col2)` bigint unsigned DEFAULT NULL,
  `bit_or(col2)` bigint unsigned DEFAULT NULL,
  `bit_xor(col2)` bigint unsigned DEFAULT NULL
)

MySQL:

CREATE TABLE `bit02` (
  `bit_and(col2)` bigint unsigned NOT NULL DEFAULT '0',
  `bit_or(col2)` bigint unsigned NOT NULL DEFAULT '0',
  `bit_xor(col2)` bigint unsigned NOT NULL DEFAULT '0'
)

Expected Behavior

The CTAS result schema should be consistent with MySQL, especially nullability and default value of bitwise aggregate result columns.

Steps to Reproduce

drop table if exists bit02;
drop table if exists bit01;

create table bit01 (col1 char(1), col2 int);
insert into bit01 values ('a',111),('a',110),('a',100),('a',000),('b',001),('b',011);

create table bit02 as
select bit_and(col2), bit_or(col2), bit_xor(col2)
from bit01;

show create table bit02;
desc bit02;
select * from bit02;

Additional information

Split from #14792 after re-verification.

Activity

  1. Ariznawlll commented on May 18, 2026

    @Ariznawlll
    CollaboratorAuthor

    Closing in favor of summary tracker #24436. This issue was split from #14792 during re-verification and is now tracked centrally in #24436.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions