Skip to content

Namanmahor/plat 427 unify the informationschema and olapinformationschema#9237

Open
NamanMahor wants to merge 26 commits into
mainfrom
namanmahor/plat-427-unify-the-informationschema-and-olapinformationschema
Open

Namanmahor/plat 427 unify the informationschema and olapinformationschema#9237
NamanMahor wants to merge 26 commits into
mainfrom
namanmahor/plat-427-unify-the-informationschema-and-olapinformationschema

Conversation

@NamanMahor
Copy link
Copy Markdown
Contributor

@NamanMahor NamanMahor commented Apr 15, 2026

PLAT-427: Unify the InformationSchema and OLAPInformationSchema interfaces

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@NamanMahor NamanMahor requested review from AdityaHegde and k-anshul May 4, 2026 03:54
@NamanMahor NamanMahor marked this pull request as ready for review May 4, 2026 03:54
@NamanMahor NamanMahor requested review from a team as code owners May 4, 2026 03:54
@AdityaHegde
Copy link
Copy Markdown
Collaborator

Thanks for the changes @NamanMahor , there wont be confusion on what to use now.

Do we also plan to also unify OLAPListTables and ListTables? Or will there be a follow up? These are the APIs mainly used as of now.

@NamanMahor
Copy link
Copy Markdown
Contributor Author

Thanks for the changes @NamanMahor , there wont be confusion on what to use now.

Do we also plan to also unify OLAPListTables and ListTables? Or will there be a follow up? These are the APIs mainly used as of now.

I will merge this PR and then After application change will remove OLAPListTables.

func (c *connection) LoadPhysicalSize(ctx context.Context, tables []*drivers.OlapTable) error {
// already populated in All and Lookup calls
func (c *connection) LoadPhysicalSize(ctx context.Context, tables []*drivers.TableInfo) error {
// already populated in Lookup calls
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct for ListTables. db.Schema seems to be populating size, ListTables is querying directly.

Found this while doing a sanity test on an existing duckdb project, old API returns size where new doesnt even with loadPhysicalSize: true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure will fix it.

}

if like != "" {
filter += " AND (LOWER(T.name) LIKE LOWER(?) OR CONCAT(T.database, '.', T.name) LIKE LOWER(?))"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed ? This seems like a breaking change ?

`, prefix, prefix)

db, err := c.getDB(ctx)
conn, err := c.getDB(ctx)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why rename from db to conn ?
conn gives an impression that it needs to be closed as well ?


func (c *connection) ListTables(ctx context.Context, database, databaseSchema string, pageSize uint32, pageToken string) ([]*drivers.TableInfo, string, error) {
// ListTables implements drivers.InformationSchema.
// DuckDB connections are bound to a single active database and schema, so the database and databaseSchema
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about motherduck ?

WHERE `

var args []any
q += "table_schema = ?"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is without any condition so why is this done separately(as compared to earlier change) ?

}
q += " AND table_name > ?"
args = append(args, startAfter)
q += " AND (table_schema > ? OR (table_schema = ? AND table_name > ?))"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the schema is always pinned to a single schema than why is this check required. Wouldn't the earlier table_schema be sufficient ?

}

func (c *connection) ListTables(ctx context.Context, database, databaseSchema string, pageSize uint32, pageToken string) ([]*drivers.TableInfo, string, error) {
func (c *connection) ListTables(ctx context.Context, database, databaseSchema, like string, pageSize uint32, pageToken string) ([]*drivers.TableInfo, string, error) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as made in other place as well. Schema is already pinned.

return nil, "", fmt.Errorf("like filter not supported")
}
// AllFromInformationSchema is a helper that drivers can use to implement All() by iterating ListDatabaseSchemas + ListTables.
func AllFromInformationSchema(ctx context.Context, like string, pageSize uint32, pageToken string, i InformationSchema) ([]*TableInfo, string, error) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has a somewhat weird implementation right now.
It list the schemas limited by the page size parameter and then searches in individual schemas.
I would expect an All API to fetch me all tables that match a pattern across all schemas/databases in a paginated fashion like clickhouse does on main.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants