-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[WIP][Table Model] Support DESCRIBE QUERY for relational metadata extraction #17270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -80,6 +80,7 @@ | |||||||||||||||||||||||||||||||||||||
| import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.Delete; | ||||||||||||||||||||||||||||||||||||||
| import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.DeleteDevice; | ||||||||||||||||||||||||||||||||||||||
| import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.DereferenceExpression; | ||||||||||||||||||||||||||||||||||||||
| import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.DescribeQuery; | ||||||||||||||||||||||||||||||||||||||
| import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.DescribeTable; | ||||||||||||||||||||||||||||||||||||||
| import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.DropColumn; | ||||||||||||||||||||||||||||||||||||||
| import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.DropDB; | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -850,6 +851,22 @@ protected Scope visitExplain(Explain node, Optional<Scope> context) { | |||||||||||||||||||||||||||||||||||||
| return visitQuery((Query) node.getStatement(), context); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||||||||||||||||
| protected Scope visitDescribeQuery(DescribeQuery node, Optional<Scope> context) { | ||||||||||||||||||||||||||||||||||||||
| analysis.setFinishQueryAfterAnalyze(); | ||||||||||||||||||||||||||||||||||||||
| Scope scope = visitQuery(node.getQuery(), context); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| RelationType outputDescriptor = analysis.getOutputDescriptor(); | ||||||||||||||||||||||||||||||||||||||
| for (Field field : outputDescriptor.getVisibleFields()) { | ||||||||||||||||||||||||||||||||||||||
| String name = field.getName().orElse("unknown"); | ||||||||||||||||||||||||||||||||||||||
| String type = field.getType().toString(); | ||||||||||||||||||||||||||||||||||||||
| System.out.println("DESCRIBE_DEBUG: Column=" + name + ", Type=" + type); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+859
to
+865
|
||||||||||||||||||||||||||||||||||||||
| RelationType outputDescriptor = analysis.getOutputDescriptor(); | |
| for (Field field : outputDescriptor.getVisibleFields()) { | |
| String name = field.getName().orElse("unknown"); | |
| String type = field.getType().toString(); | |
| System.out.println("DESCRIBE_DEBUG: Column=" + name + ", Type=" + type); | |
| } | |
| // Retrieve output descriptor for the analyzed inner query | |
| RelationType outputDescriptor = analysis.getOutputDescriptor(node.getQuery()); | |
| for (Field field : outputDescriptor.getVisibleFields()) { | |
| String name = field.getName().orElse("unknown"); | |
| String type = field.getType().toString(); | |
| System.out.println("DESCRIBE_DEBUG: Column=" + name + ", Type=" + type); | |
| } | |
| // Assign a scope to the DescribeQuery node when it is the root statement | |
| if (!context.isPresent()) { | |
| analysis.setScope(node, scope); | |
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,81 @@ | ||||||||||||||||||
| /* | ||||||||||||||||||
| * Licensed to the Apache Software Foundation (ASF) under one | ||||||||||||||||||
| * or more contributor license agreements. See the NOTICE file | ||||||||||||||||||
| * distributed with this work for additional information | ||||||||||||||||||
| * regarding copyright ownership. The ASF licenses this file | ||||||||||||||||||
| * to you under the Apache License, Version 2.0 (the | ||||||||||||||||||
| * License"); you may not use this file except in compliance | ||||||||||||||||||
|
||||||||||||||||||
| * License"); you may not use this file except in compliance | |
| * "License"); you may not use this file except in compliance |
Copilot
AI
Mar 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
equals uses single-line if statements without braces (e.g., if (this == obj) return true;). This violates the repo Checkstyle NeedBraces rule and will fail style checks. Add braces for these conditionals.
| if (this == obj) return true; | |
| if (obj == null || getClass() != obj.getClass()) return false; | |
| if (this == obj) { | |
| return true; | |
| } | |
| if (obj == null || getClass() != obj.getClass()) { | |
| return false; | |
| } |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -914,6 +914,7 @@ queryStatement | |||
| : query #statementDefault | ||||
| | EXPLAIN query #explain | ||||
| | EXPLAIN ANALYZE VERBOSE? query #explainAnalyze | ||||
| | DESCRIBE QUERY query #describeQuery | ||||
|
||||
| | DESCRIBE QUERY query #describeQuery |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid
System.out.printlnin the analyzer path. This will write to stdout for every DESCRIBE and can be noisy in production; use the project logger at an appropriate level or store the extracted column metadata inAnalysisfor the planner/operator to consume instead of printing.