- Notifications
You must be signed in to change notification settings - Fork 1
Expanding YQL Syntax support in sqlc engine #10
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
Conversation
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.
Pull Request Overview
This PR significantly expands YQL (Yandex Query Language) syntax support in the sqlc engine by implementing multiple statement types and enhancing the SELECT statement parser. The changes focus on adding comprehensive support for DDL operations, DML operations, and improving the robustness of SELECT statement parsing.
- Implements support for 14 new YQL statement types including ALTER TABLE, DO, and various user/group management statements
- Enhances SELECT statement parsing with support for UNION operations, ORDER BY, LIMIT/OFFSET, GROUP BY with ROLLUP/CUBE, and HAVING clauses
- Refactors utility functions to improve naming consistency and adds new parsing functions for table identifiers
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
internal/engine/ydb/utils.go | Refactors identifier parsing functions and adds new parseAnIdTable function |
internal/engine/ydb/convert.go | Implements converters for ALTER TABLE and DO statements, significantly enhances SELECT statement parsing with comprehensive clause support |
internal/engine/ydb/catalog_tests/select_test.go | Updates test cases to match new SELECT statement AST structure with additional fields |
internal/engine/ydb/catalog_tests/delete_test.go | Updates DELETE test case to include new SELECT statement fields |
Comments suppressed due to low confidence (1)
internal/engine/ydb/convert.go:1
- [nitpick] These error messages should be more descriptive about what the user should do. Consider messages like 'YDB: INTERSECT operation is not yet supported in this version' or provide guidance on alternatives.
package ydb
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Subtype: ast.AT_DropColumn, | ||
}) | ||
} | ||
case action.Alter_table_alter_column_drop_not_null() != nil: |
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.
как будто бы можно объединить с action.Alter_table_drop_column()
и избежать дублирования
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.
Кажется там будет больше геморроя их объединять 😄 . У них единственное общее та - an_id, который к тому же из разных структур достается, мне кажется бессмысленная оптимизация
} | ||
| ||
switch { | ||
case n.Call_action() != nil: |
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.
можно каждой ветке в switch
выделить по отдельному методу для упрощения кода
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.
Я на самом деле специально так сделал. В грамматике call_action и inline_action встречаются 1 раз - тут. И вот обычно, когда приходится обрабатывать такие одноразовые штуки, я прям так и записываю их, чтоб не путать человека, который в будущем код будет допиливать. Не знаю если честно, валиден такой подход или нет
pragma_stmt
select_stmt
named_nodes_stmt
create_table_stmt
drop_table_stmt
use_stmt
into_table_stmt
commit_stmt
update_stmt
delete_stmt
rollback_stmt
declare_stmt
import_stmt
export_stmt
alter_table_stmt
(upd)alter_external_table_stmt
do_stmt
(upd)define_action_or_subquery_stmt
if_stmt
for_stmt
values_stmt
create_user_stmt
alter_user_stmt
create_group_stmt
alter_group_stmt
drop_role_stmt
create_object_stmt
alter_object_stmt
drop_object_stmt
create_external_data_source_stmt
alter_external_data_source_stmt
drop_external_data_source_stmt
create_replication_stmt
drop_replication_stmt
create_topic_stmt
alter_topic_stmt
drop_topic_stmt
grant_permissions_stmt
revoke_permissions_stmt
alter_table_store_stmt
upsert_object_stmt
create_view_stmt
drop_view_stmt
alter_replication_stmt
create_resource_pool_stmt
alter_resource_pool_stmt
drop_resource_pool_stmt
create_backup_collection_stmt
alter_backup_collection_stmt
drop_backup_collection_stmt
analyze_stmt
create_resource_pool_classifier_stmt
alter_resource_pool_classifier_stmt
drop_resource_pool_classifier_stmt
backup_stmt
restore_stmt
alter_sequence_stmt
create_transfer_stmt
alter_transfer_stmt
drop_transfer_stmt
alter_database_stmt
show_create_table_stmt