Skip to content

[SPARK-27103][SQL][MINOR] List SparkSql reserved keywords in alphabet order#23985

Closed
SongYadong wants to merge 2 commits intoapache:masterfrom
SongYadong:sql_reserved_alphabet
Closed

[SPARK-27103][SQL][MINOR] List SparkSql reserved keywords in alphabet order#23985
SongYadong wants to merge 2 commits intoapache:masterfrom
SongYadong:sql_reserved_alphabet

Conversation

@SongYadong
Copy link
Contributor

What changes were proposed in this pull request?

This PR tries to correct spark-sql reserved keywords' position in list if they are not in alphabetical order.
In test suite some repeated words are removed. Also some comments are added for remind.

How was this patch tested?

Existing unit tests.

"terminated", "timestamp", "tinyint", "to", "touch", "trailing", "transaction", "transactions",
"trigger", "true", "truncate", "unarchive", "undo", "uniontype", "unlock", "unset", "unsigned",
"update", "uri", "use", "user", "utc", "utctimestamp", "values", "view", "while", "with",
"work", "write", "year")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put them in alphabet order and remove some repeated words, including:
"int", "smallint", "double", "float", "timestamp", "binary", "boolean", "both", "current_date", "current_timestamp", "date"

"where", "having", "from", "to", "table", "with", "not")
val hiveStrictNonReservedKeyword = Seq("anti", "cross", "database", "except", "from", "full",
"having", "inner", "intersect", "join", "left", "natural", "not", "on", "right", "select",
"semi", "table", "to", "union", "where", "with")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put them in alphabet order and remove one repeated word: "from"

@SparkQA
Copy link

SparkQA commented Mar 6, 2019

Test build #4594 has finished for PR 23985 at commit aaf9f6d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member

cc @maropu

@maropu
Copy link
Member

maropu commented Mar 7, 2019

The change itself looks ok to me. But, I feel its a bit cumbersome to always keep this alphabetical order and duplicated entries easily happen by the current hard-to-check format (multiple keywords in a line).

For example, postgresql place a single keyword in a line: https://github.com/postgres/postgres/blob/277cb789836b5ddf81aabb80c2058268c70e2f36/src/backend/parser/gram.y#L14975 (this format makes the number of lines brow up though...)

@dongjoon-hyun
Copy link
Member

Is it a good time to transform into PostgrSQL style? For me, +1 for that kind of transition for the future.

cc @hvanhovell , too.

@SongYadong
Copy link
Contributor Author

Indeed it's clearer in PostgreSQL style. But that makes files too long. I'm not sure how to balance.

@srowen
Copy link
Member

srowen commented Mar 8, 2019

I don't mind letting this file grow long if it helps readability by adopting PostgreSQL style.
I don't think it has to block the cleanup here, in any event.

@SongYadong
Copy link
Contributor Author

I got it. Let me try now.

@SongYadong
Copy link
Contributor Author

Updated.
cc @srowen @dongjoon-hyun @maropu

@viirya
Copy link
Member

viirya commented Mar 8, 2019

Looks good. For such change, it might be worth creating a JIRA for this.

@SongYadong
Copy link
Contributor Author

@viirya thanks. I will do that.

@SongYadong SongYadong changed the title [SQL][MINOR] List SparkSql reserved keywords in alphabet order [SPARK-27103][SQL][MINOR] List SparkSql reserved keywords in alphabet order Mar 8, 2019
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM, too. Merged to master.
Thank you, @SongYadong , @srowen , @maropu , @viirya .

@SongYadong
Copy link
Contributor Author

Thanks for review. @srowen @dongjoon-hyun @maropu @viirya

mccheah pushed a commit to palantir/spark that referenced this pull request Jun 6, 2019
… order

## What changes were proposed in this pull request?

This PR tries to correct spark-sql reserved keywords' position in list if they are not in alphabetical order.
In test suite some repeated words are removed. Also some comments are added for remind.

## How was this patch tested?

Existing unit tests.

Closes apache#23985 from SongYadong/sql_reserved_alphabet.

Authored-by: SongYadong <song.yadong1@zte.com.cn>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants