Skip to content
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

[BUG] Column names unescaped during index creation. #84

Closed
Swiddis opened this issue Oct 19, 2023 · 4 comments
Closed

[BUG] Column names unescaped during index creation. #84

Swiddis opened this issue Oct 19, 2023 · 4 comments
Assignees
Labels
0.1.1 bug Something isn't working

Comments

@Swiddis
Copy link
Contributor

Swiddis commented Oct 19, 2023

What is the bug?
When trying to work with tables that have escaped column names, this escaping is thrown away during index creation.

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Create a table with column names that require escaping:
CREATE TABLE
  mys3.default.sample_table_dot_cols (`fields.name` string, `fields.count` int) USING PARQUET LOCATION 's3://sample-location/sample-dotcol';
  1. Then attempt to create an index on that table:
CREATE INDEX sample_index ON mys3.default.sample_table_dot_cols (`fields.name`, `fields.count`)
WITH
  (auto_refresh = true);
  1. Wait for query to fail and check logs, you'll see the error:
23/10/19 22:30:42 ERROR FlintJob: Fail to verify existing mapping or write result
org.apache.spark.sql.catalyst.parser.ParseException: 
Syntax error at or near '.': extra input '.'(line 1, pos 6)

== SQL ==
fields.name string not null,fields.count int not null
------^^^

Which indicates that at some point in internal processing (maybe in FlintSparkIndex.scala), the column names are being unescaped.

What is the expected behavior?
If the column name is escaped in the index creation query, it should be correctly handled. Alternatively, if escaping column names isn't supported, there should be an error on table creation.

What is your host/environment?

  • OS: Ubuntu
  • Version: 22.04
  • Plugins: plugin:observabilityDashboards@2.11.0, plugin:queryWorkbenchDashboards@2.11.0

Do you have any screenshots?
N/A

Do you have any additional context?
N/A

@Swiddis Swiddis added bug Something isn't working untriaged labels Oct 19, 2023
@dai-chen dai-chen self-assigned this Oct 20, 2023
@dai-chen
Copy link
Collaborator

May miss this logic. Will verify and fix it shortly. Thanks!

@dai-chen
Copy link
Collaborator

Working on PR to handle quoted table/MV/column name.

@dai-chen
Copy link
Collaborator

@Swiddis I can confirm Flint extension does unquote identifier automatically. Your error was actually thrown from Spark Application code. Wonder if you still have the error stack or more info. For now I didn't figure out which code is the root cause. cc: @kaituo

@dai-chen
Copy link
Collaborator

The issue should be fixed in PR above. Please verify. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.1.1 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants