Replies: 4 comments 4 replies
-
My two cents. If an identifier is from a catalog namespace and is a valid ANSI SQL/MySQL identifier, then it can be left unquoted, otherwise it must be surrounded by back ticks. This applies to table name, column name, and catalog-specific functions. If an identifier is for a SQL construct, then it follows ANSI SQL/MySQL rules. This applies to table aliases, column aliases, and user-defined functions. If an identifier is a plugin-specific construct, then it follows ANSI SQL/MySQL rules. This would be a breaking change, but it's easy to understand. |
Beta Was this translation helpful? Give feedback.
-
@MaxKsyunz Thanks for bringing up this topic!
Could you give more details or link some issues here? I recall there are some issue due to same identifier rule for table and column. But I'm not sure if you're referring to the same problem.
Currently SQL identifier is defined in ANTLR grammar. No matter which catalog, any name mismatched has to be quoted. Are you proposing to extend what can be matched by current identifier rule to accommodate S3 and Prometheus?
What do you mean by coming from a catalog? As I understand in ANSI SQL, every database object is under a schema of a catalog/database. |
Beta Was this translation helpful? Give feedback.
-
There are limitations for index name: link. So,
|
Beta Was this translation helpful? Give feedback.
-
Interesting topic! I think the plugin should expose an implementation of some type of SQL that's unambiguously defined, i.e. ANSI SQL (or another standard), and follow the identifier conventions of that standard, and not OpenSearch. That of course assumes that the standard can be a superset of OpenSearch identifiers, such as through quoting. The other way around (identifiers are defined by OpenSearch) would mean that some parts of the language are borrowed from one system (e.g. |
Beta Was this translation helpful? Give feedback.
-
SQL plugin uses identifiers in several different places. In each case we try to be as liberal as possible but sometimes that results in unexpected parser behaviour.
With support for different catalogs on the way, each with unique identifier rules, now is a good time to write down what constitutes a valid identifier in SQL plugin.
These are the different namespaces involved:
Here're a few cases to consider. For each case,
<placeholder>
denotes an identifier.Catalog name
SELECT * FROM <catalog>.tableA
Table name
SELECT * FROM <table>
Column name
SELECT <columnName> FROM tableA
Column alias
SELECT columnA AS <alias> FROM tableA
Table alias
SELECT columnA FROM tableA AS <tableAlias>
SQL standard function call
SELECT <function>(....) FROM tableA
Catalog-specific function call
`SELECT * FROM tableA WHERE (....)
User-defined function call
SELECT <function>(...) FROM tableA
Beta Was this translation helpful? Give feedback.
All reactions