Canner / wren-engine

🤖 The semantic engine for LLMs, bringing semantic context to AI agents. 🔥
https://getwren.ai/oss
Apache License 2.0
129 stars 34 forks source link

Having duplicated column on Trino metadata API #833

Closed onlyjackfrost closed 1 month ago

onlyjackfrost commented 1 month ago

Describe the bug When listing the Trino table metadata (API: /trino/metadata/tables) I'll get duplicate columns in each table. like below. I think each column should be unique

I host my Trino on local using docker and using the tpch tiny dataset.

[
    {
        "name": "tpch.tiny.customer",
        "columns": [
            {
                "name": "comment",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "comment",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "mktsegment",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "mktsegment",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "acctbal",
                "type": "DOUBLE",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "acctbal",
                "type": "DOUBLE",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "phone",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "phone",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "nationkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "nationkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "address",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "address",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "name",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "name",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "custkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "custkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            }
        ],
        "description": null,
        "properties": {
            "schema": "tiny",
            "catalog": "tpch",
            "table": "customer"
        },
        "primaryKey": ""
    },
    {
        "name": "tpch.tiny.orders",
        "columns": [
            {
                "name": "comment",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "shippriority",
                "type": "INTEGER",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "clerk",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "orderpriority",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "orderdate",
                "type": "DATE",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "totalprice",
                "type": "DOUBLE",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "orderstatus",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "custkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "orderkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            }
        ],
        "description": null,
        "properties": {
            "schema": "tiny",
            "catalog": "tpch",
            "table": "orders"
        },
        "primaryKey": ""
    },
    {
        "name": "tpch.tiny.lineitem",
        "columns": [
            {
                "name": "comment",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "shipmode",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "shipinstruct",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "receiptdate",
                "type": "DATE",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "commitdate",
                "type": "DATE",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "shipdate",
                "type": "DATE",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "linestatus",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "returnflag",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "tax",
                "type": "DOUBLE",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "discount",
                "type": "DOUBLE",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "extendedprice",
                "type": "DOUBLE",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "quantity",
                "type": "DOUBLE",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "linenumber",
                "type": "INTEGER",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "suppkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "partkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "orderkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            }
        ],
        "description": null,
        "properties": {
            "schema": "tiny",
            "catalog": "tpch",
            "table": "lineitem"
        },
        "primaryKey": ""
    },
    {
        "name": "tpch.tiny.part",
        "columns": [
            {
                "name": "comment",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "retailprice",
                "type": "DOUBLE",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "container",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "size",
                "type": "INTEGER",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "type",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "brand",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "mfgr",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "name",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "partkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            }
        ],
        "description": null,
        "properties": {
            "schema": "tiny",
            "catalog": "tpch",
            "table": "part"
        },
        "primaryKey": ""
    },
    {
        "name": "tpch.tiny.partsupp",
        "columns": [
            {
                "name": "comment",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "supplycost",
                "type": "DOUBLE",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "availqty",
                "type": "INTEGER",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "suppkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "partkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            }
        ],
        "description": null,
        "properties": {
            "schema": "tiny",
            "catalog": "tpch",
            "table": "partsupp"
        },
        "primaryKey": ""
    },
    {
        "name": "tpch.tiny.supplier",
        "columns": [
            {
                "name": "comment",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "acctbal",
                "type": "DOUBLE",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "phone",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "nationkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "address",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "name",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "suppkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            }
        ],
        "description": null,
        "properties": {
            "schema": "tiny",
            "catalog": "tpch",
            "table": "supplier"
        },
        "primaryKey": ""
    },
    {
        "name": "tpch.tiny.nation",
        "columns": [
            {
                "name": "comment",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "regionkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "name",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "nationkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            }
        ],
        "description": null,
        "properties": {
            "schema": "tiny",
            "catalog": "tpch",
            "table": "nation"
        },
        "primaryKey": ""
    },
    {
        "name": "tpch.tiny.region",
        "columns": [
            {
                "name": "comment",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "name",
                "type": "UNKNOWN",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            },
            {
                "name": "regionkey",
                "type": "BIGINT",
                "notNull": true,
                "description": null,
                "properties": null,
                "nestedColumns": null
            }
        ],
        "description": null,
        "properties": {
            "schema": "tiny",
            "catalog": "tpch",
            "table": "region"
        },
        "primaryKey": ""
    }
]

To Reproduce setup trino and ibis server request to /trino/metadata/tables API

Expected behavior Columns in each table should be unique.

Screenshots

image

Desktop (please complete the following information): mac m1

Wren AI Information