Skip to content

[Bug]: SHOW CREATE TABLE loses filepath and S3 options for hive-partitioned external tables #24372

Closed

Description

@Ariznawlll

Bug Description

SHOW CREATE TABLE on a hive-partitioned external table (both local INFILE and URL s3option) outputs an incomplete DDL that cannot be used to recreate the table:

  1. FILEPATH is empty ('')
  2. For S3 tables: all S3 connection options (endpoint, bucket, access_key_id, region, provider) are lost
  3. For S3 tables: URL s3option{...} is shown as INFILE{...}

The table itself works correctly for queries — only the DDL metadata output is wrong.

Reproduction Steps

Case 1: Local INFILE table

CREATE EXTERNAL TABLE test_show_ddl (
    id INT,
    part_id INT
) INFILE{'filepath'='/data/test/', 'format'='parquet', 'hive_partitioning'='true', 'hive_partition_columns'='part_id'}
  FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';

SHOW CREATE TABLE test_show_ddl;

Expected: FILEPATH='/data/test/' in output
Actual: FILEPATH='' — filepath is empty

Case 2: S3 (MinIO) table

CREATE EXTERNAL TABLE test_show_ddl_s3 (
    id INT,
    part_id INT
) URL s3option {
    'endpoint'          = 'http://<minio-host>',
    'access_key_id'     = '<ak>',
    'secret_access_key' = '<sk>',
    'bucket'            = 'my-bucket',
    'filepath'          = 'data/test/',
    'region'            = 'us-east-1',
    'provider'          = 'minio',
    'format'            = 'parquet',
    'hive_partitioning' = 'true',
    'hive_partition_columns' = 'part_id'
};

SHOW CREATE TABLE test_show_ddl_s3;

Expected: DDL with URL s3option{...} including endpoint, bucket, filepath, region, provider (secret_access_key can be masked)
Actual:

) INFILE{'FILEPATH'='','COMPRESSION'='','FORMAT'='parquet','JSONDATA'='','HIVE_PARTITIONING'='true','HIVE_PARTITION_COLUMNS'='part_id'}

All S3 options lost, shown as INFILE instead of URL s3option, filepath empty.

Impact

  • Cannot use SHOW CREATE TABLE output to recreate/migrate external tables
  • Affects backup/restore workflows
  • Affects documentation/audit of existing table definitions

Environment

  • MO version: main branch (git: 7efe429)
  • Both local INFILE and S3 tables are affected
  • Query functionality is NOT affected — tables read data correctly

Activity

  1. added
    severity/s0
    on May 13, 2026
  2. added theissue type on May 13, 2026
  3. added this to the MO-202605 milestone on May 13, 2026
  4. Ariznawlll commented on May 21, 2026

    @Ariznawlll
    CollaboratorAuthor

    Verified on latest main.

    Commit: 726bf23
    Server check: select git_version(); => 726bf23

    Test process:

    1. Built mo-service from this commit with make build.
    2. Started MO with ./mo-service -launch ./etc/launch/launch.toml.
    3. Connected through MySQL on 127.0.0.1:6001.
    4. Tested both local INFILE hive external table and S3 URL hive external table.

    Test SQL:

    show create table hive_single;
    show create table s3_hive_show;

    Actual result:
    Local table keeps FILEPATH, FORMAT=parquet, HIVE_PARTITIONING=true, HIVE_PARTITION_COLUMNS=year.
    S3 table keeps endpoint, masked credentials, bucket, filepath, provider, format, hive_partitioning and hive_partition_columns.

    Example S3 output contains:

    URL s3option{'endpoint'='http://minio.local', ... 'bucket'='my-bucket','filepath'='data/test/','provider'='minio','format'='parquet','hive_partitioning'='true','hive_partition_columns'='part_id'}
    

    Result: PASS. SHOW CREATE TABLE preserves hive partition and external table options.

  5. Ariznawlll commented on May 21, 2026

    @Ariznawlll
    CollaboratorAuthor

    3.0-dev verification update

    Verified on commit: 77e514a (origin/3.0-dev, git_version() = 77e514a)
    MO start method: built mo-service with Go 1.25.10, then started a clean local cluster via ./mo-service -launch /private/tmp/mo-launch-3dev/launch.toml, using isolated data-dir /private/tmp/mo-data-3dev.

    SQL case:

    • show create table for local hive external table created with INFILE + hive_partitioning/hive_partition_columns
    • show create table for S3 hive external table created with URL s3option including filepath/format/hive_partitioning/hive_partition_columns

    Result:

    • Local show create preserved FILEPATH, FORMAT='parquet', HIVE_PARTITIONING='true', HIVE_PARTITION_COLUMNS='year'
    • S3 show create preserved endpoint/bucket/filepath/format/hive_partitioning/hive_partition_columns, with access keys masked

    Conclusion: PASS on 3.0-dev. SHOW CREATE keeps hive partition options.

  6. Ariznawlll commented on May 21, 2026

    @Ariznawlll
    CollaboratorAuthor

    4.0-dev verification update

    Verified on commit: 3b24795 (origin/4.0-dev, git_version() = 3b24795)
    MO start method: built mo-service with Go 1.25.10, then started a clean local cluster via ./mo-service -launch /private/tmp/mo-launch-4dev/launch.toml, using isolated data-dir /private/tmp/mo-data-4dev-3b24795fa.

    SQL case:

    • show create table for local hive external table created with INFILE + filepath/format/hive_partitioning/hive_partition_columns
    • show create table for S3 hive external table created with URL s3option including endpoint/bucket/filepath/format/hive_partitioning/hive_partition_columns

    Result:

    • Local SHOW CREATE output preserved FORMAT/HIVE_PARTITIONING/HIVE_PARTITION_COLUMNS, but FILEPATH became empty: FILEPATH=''
    • S3 SHOW CREATE output was rendered as INFILE with FILEPATH='', and did not preserve URL s3option endpoint/bucket/access options

    Conclusion: FAIL on 4.0-dev. SHOW CREATE does not preserve filepath/S3 options correctly.

  7. Ariznawlll commented on May 25, 2026

    @Ariznawlll
    CollaboratorAuthor

    Verified on latest 4.0-dev.

    Commit:

    • 1936a09ea (1936a09ea927a9ca686e4c949df94d4d487c25bd)

    Environment:

    • Local MO built from origin/4.0-dev
    • select git_version(); returned 1936a09ea

    Validation:
    Ran SHOW CREATE TABLE for both local hive-partitioned Parquet external table and S3 external table.

    Results:

    1. Local INFILE table preserves filepath:
    INFILE{'FILEPATH'='/data/test/','COMPRESSION'='','FORMAT'='parquet','JSONDATA'='','HIVE_PARTITIONING'='true','HIVE_PARTITION_COLUMNS'='part_id'}
    
    1. S3 table keeps URL s3option and S3 options:
    URL s3option{'endpoint'='http://minio.local','region'='us-east-1','access_key_id'='******','secret_access_key'='******','bucket'='my-bucket','filepath'='data/test/','provider'='minio','format'='parquet','hive_partitioning'='true','hive_partition_columns'='part_id'}
    

    The filepath and S3 options are no longer lost. This issue is verified as fixed on 4.0-dev.

  8. Ariznawlll commented on Oct 19, 2026

    @Ariznawlll
    CollaboratorAuthor

    补充当前 MatrixOne main 75ff736835c3d00d40dc00a0a1d3b11129388e5b 回归:无需 Hive 分区,普通本地 CSV 外部表也有相同问题。

    CREATE EXTERNAL TABLE e(id INT,v VARCHAR(20))
      INFILE{'filepath'='/private/tmp/mo-explore-run-20261019/modump_external_rows.csv'}
      FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
    SELECT * FROM e ORDER BY id; -- 1,alpha / 2,beta
    SHOW CREATE TABLE e;

    SHOW CREATE TABLE 的关键部分实际为:

    INFILE{'FILEPATH'='','COMPRESSION'='','FORMAT'='csv','JSONDATA'=''}

    按该输出重建会报 ERROR 20300 (HY000): invalid configuration: the jsondata '' is not supported。三个独立新库的导出文件均记录空 FILEPATH。mo-dump 直接消费该 DDL,因此即使另修工具的可执行注释问题(matrixorigin/mo_dump#52),外部表仍无法恢复文件引用。请复核此 issue 关闭后普通外部表路径仍未解决的原因。

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

Metadata

Metadata

Assignees

Labels

phase/testingseverity/s0

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions