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

[FLINK-34312][table] Improve the handling of default node types for named parameters #24235

Merged
merged 6 commits into from
Feb 26, 2024

Conversation

hackergin
Copy link
Contributor

What is the purpose of the change

Improve the default node handing for named parameters.

Before SqlToRel, we can construct a DEFAULT operator with a return type that matches the argument type. This way, during the SqlToRel phase, there is no need for special handling of the DEFAULT node's type.

Brief change log

  • Introduce FlinkSqlCallBinding for handing rewrite the type of DEFAULT operator

Verifying this change

  • The current unit test can cover.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (no)
  • The serializers: (no)
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not documented)

@flinkbot
Copy link
Collaborator

flinkbot commented Jan 30, 2024

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Copy link
Member

@fsk119 fsk119 left a comment

Choose a reason for hiding this comment

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

Thanks for your update. I left some minor suggestions. cc @xuyangzhong

}
}
return false;
return !argumentTypes.isEmpty();
Copy link
Member

Choose a reason for hiding this comment

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

If the arugment types is empty, it means the function's parameter is fixed comparing to var-length parameters. At this point, I think it's better to align the concepts with calcite. What about isFixedParameters here and rename argumentTypes to fixedArgumentTypes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

return fixArgumentTypes.get(ordinal);
}

final RelDataType type = SqlTypeUtil.deriveType(this, operand);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fsk119 Here I made some modifications. Previously it was: If it is fixArgumentType, then return argumentType. In fact, there is a problem. We should only return argumentType if it is a DEFAULT node. Other nodes should still return the actual operand's type.

Copy link
Member

@fsk119 fsk119 left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +166 to +167
* <p>Lines 3739 ~ 3743, 6333 ~ 6339, Flink improves validating the SqlCall that uses named
* parameters, rearrange the order of sub-operands, and fill in missing operands with the default
Copy link
Contributor

Choose a reason for hiding this comment

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

can you please create a corresponding issue for Calcite to make it supported there as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the suggestion. I have created the corresponding JIRA ticket. You can find it at https://issues.apache.org/jira/browse/CALCITE-6245.

@fsk119 fsk119 merged commit 1070c6e into apache:master Feb 26, 2024
hanyuzheng7 pushed a commit to hanyuzheng7/flink that referenced this pull request May 6, 2024
…amed parameters (apache#24235)


Co-authored-by: Shengkai <1059623455@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants