fix: 修复采集数据源时,表字段有sql保留字冲突的名称报错问题#532
Open
wangjie-zzz wants to merge 3 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses datasource initialization failures when table column names conflict with SQL reserved keywords by quoting identifiers when building SELECT column lists.
Changes:
- Added
SqlUtil.buildColumnsSql(...)to quote column identifiers based on datasource type (MySQL uses backticks, others use double quotes). - Updated
TableMetadataServiceto usebuildColumnsSql(...)when fetching table sample data.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
data-agent-management/src/main/java/com/alibaba/cloud/ai/dataagent/util/SqlUtil.java |
Adds a helper to build a quoted column list for SELECT statements. |
data-agent-management/src/main/java/com/alibaba/cloud/ai/dataagent/service/schema/TableMetadataService.java |
Uses the new helper when constructing sample-data queries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe what this PR does / why we need it
初始化数据源时,当有与sql保留字冲突的字段名称,会初始化失败
Does this pull request fix one issue?
Fixes #525
Describe how you did it
数据源采集在拼接字段时,根据数据源类型使用标识符包裹字段名:mysql+hive使用``标识,其他使用""标识(标准sql)
Describe how to verify it
可以采集一个有与sql保留字冲突字段名的表(例如desc字段)
Special notes for reviews