Skip to content

[Enhancement] More information for table schema open api #56800

@TangSiyang2001

Description

@TangSiyang2001

Search before asking

  • I had searched in the issues and found no similar issues.

Description

Doris has an open api to observe table schema information. See here.

Currently, schema information is attached to the response body, like below.

{
	"msg": "success",
	"code": 0,
	"data": {
		"properties": [{
			"type": "INT",
			"name": "k1",
			"comment": "",
			"aggregation_type":""
		}, {
			"type": "INT",
			"name": "k2",
			"comment": "",
			"aggregation_type":"MAX"
		}],
		"keysType":UNIQUE_KEYS,
		"status": 200
	},
	"count": 0
}

It would be better to show more details here, which would help a lot when debugging, especially column unique id and schema version.

Solution

  1. The related api logic is in org.apache.doris.httpv2.rest.TableSchemaAction.
  2. Column unique id is addressed in org.apache.doris.catalog.Column.
  3. Schema version is addressed in org.apache.doris.catalog.MaterializedIndexMeta

Attach column unique ids to column informantion in properties, and add a schema version field. Expected result may be like:

{
	"msg": "success",
	"code": 0,
	"data": {
		"properties": [{
			"column_uid" : "0",
			"type": "INT",
			"name": "k1",
			"comment": "",
			"aggregation_type":""
		}, {
			"column_uid" : "1",
			"type": "INT",
			"name": "k2",
			"comment": "",
			"aggregation_type":"MAX"
		}],
		"keysType":UNIQUE_KEYS,
                 "schema_version": 1
		"status": 200
	},
	"count": 0
}

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions