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

SAMZA-2375, SAMZA-2376: Add display name to UdfMetadata and handle trailing semi-colons #1214

Merged
merged 2 commits into from
Nov 11, 2019

Conversation

atoomula
Copy link
Contributor

@atoomula atoomula commented Nov 7, 2019

No description provided.

Copy link

@gauravrkulkarni gauravrkulkarni left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -32,6 +32,7 @@
public class UdfMetadata {

private final String name;
private final String displayName;

Choose a reason for hiding this comment

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

Might want to add a comment/example explaining the difference between name and displayName (if this isn't a well know samza concept)?

@@ -32,6 +32,7 @@
public class UdfMetadata {

private final String name;
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be better to rename the field name to something more meaningful(like udfLogicalName or something else).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a description of what this field means. Well, it is just udf name. For UdfMetadata, it should not matter whether it is logicalName or a physicalName, it is just the name that the udf will be referred as. I feel name is appropriate. What do you think ?

@@ -45,6 +46,8 @@ public UdfMetadata(String name, String description, Method udfMethod, Config udf
SamzaSqlFieldType returnType, boolean disableArgCheck) {
// Udfs are case insensitive
this.name = name.toUpperCase();
// Let's also store the original name for display purposes.
this.displayName = name;
Copy link
Contributor

Choose a reason for hiding this comment

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

This POJO already has hashcode and equals implemented in it. Are we planning to account for this new field in them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be ok not to account for the new field as name is already accounted for and we expect udfs to be anyways case insensitive.

@@ -101,6 +101,8 @@ public String getSql() {
public static QueryInfo parseQuery(String sql) {
Planner planner = createPlanner();
SqlNode sqlNode;
// Remove trailing semi-colons
sql = sql.replaceAll(";+$", "");
Copy link
Contributor

@shanthoosh shanthoosh Nov 7, 2019

Choose a reason for hiding this comment

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

Would be great if we can extract the regex to match the semi-colon into a appropriately named constant to improve readability. Also, if possible, we can enrich the comment as-to why the removal was required.

Copy link
Contributor

@shanthoosh shanthoosh left a comment

Choose a reason for hiding this comment

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

LGTM

@shanthoosh shanthoosh merged commit 6aacee2 into apache:master Nov 11, 2019
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.

3 participants