Preserve quotedness for Identifier when formatting Query #80
Conversation
There was a problem hiding this comment.
It shouldn't be necessary to call toLowerCase(). The DereferenceExpression already deals with Identifiers
There was a problem hiding this comment.
In fact, I don't think the tryParseParts method needs to exist anymore in its current form.
There was a problem hiding this comment.
This is a little hard to read. I'd pull it out into a makeQualifiedName. Also, I'd structure it as:
List<Identifier> parts = Arrays.stream(fullName.split("\\."))
.map(Identifier::new)
.collect(Collectors.toList());
return QualifiedName.of(parts);There was a problem hiding this comment.
This can be changed to Arrays.stream(fullName.split("\\.")).xxx like the calls in TestSqlParser and formatted across multiple lines to make it more readable.
There was a problem hiding this comment.
This seems unnecessary. It looks like you could just do: new CreateView(node.getName(), ...) instead of trying to recreate the QualifiedName from the QualifiedObjectName that was derived from node.getName().
If you do that, you should also be able to remove MetadataUtil.getDelimitedList(), which I'm not fond of.
5eb61f5 to
0ca9718
Compare
martint
left a comment
There was a problem hiding this comment.
Looks good. Can you rebase and fix the merge conflicts? I'll merge it once that's taken care of.
0ca9718 to
14558fb
Compare
|
@martint I have updated the code and resolved the conflicts. |
|
@Praveen2112, there are some build failures. Can you take a look? |
14558fb to
be38a23
Compare
We maintain Identifier in QualifiedName for preserving its quotedness.
be38a23 to
70e6f1b
Compare
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error when we run prepare query of the syntax [prestodb#10739]. This PR solves that above issue. Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error when we run prepare query of the syntax [#10739]. This PR solves that above issue. Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com> Co-authored-by: imjalpreet <jalpreetnanda@gmail.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com> Co-authored-by: imjalpreet <jalpreetnanda@gmail.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com> Co-authored-by: imjalpreet <jalpreetnanda@gmail.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com> Co-authored-by: imjalpreet <jalpreetnanda@gmail.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com> Co-authored-by: imjalpreet <jalpreetnanda@gmail.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com> Co-authored-by: imjalpreet <jalpreetnanda@gmail.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com> Co-authored-by: imjalpreet <jalpreetnanda@gmail.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com> Co-authored-by: imjalpreet <jalpreetnanda@gmail.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com> Co-authored-by: imjalpreet <jalpreetnanda@gmail.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com> Co-authored-by: imjalpreet <jalpreetnanda@gmail.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com> Co-authored-by: imjalpreet <jalpreetnanda@gmail.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com> Co-authored-by: imjalpreet <jalpreetnanda@gmail.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com> Co-authored-by: imjalpreet <jalpreetnanda@gmail.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com> Co-authored-by: imjalpreet <jalpreetnanda@gmail.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com> Co-authored-by: imjalpreet <jalpreetnanda@gmail.com>
Cherry-pick of trinodb/trino#80 Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error if quoted table name is a reserved word Co-authored-by: praveenkrishna <praveenkrishna@tutanota.com> Co-authored-by: imjalpreet <jalpreetnanda@gmail.com>
Presto doesn't maintain the quotedness of an identifier when using SqlQueryFormatter so it results in throwing parsing error when we run prepare query of the syntax [https://github.com/prestodb/presto/issues/10739]. This PR solves that above issue