[
https://issues.apache.org/jira/browse/CALCITE-6745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17910460#comment-17910460
]
Zhengqiang Duan commented on CALCITE-6745:
------------------------------------------
I read the comment in https://issues.apache.org/jira/browse/CALCITE-6566, and
we should make calcite default conformance compatible with Foo() and Foo
function syntax.
The PI function in CALCITE-6566 faces the same problem, and needs to support
both PI and PI() with default conformance configuration. I referred to the
implementation of PI function and readjusted SqlSyntax judgment logic.
[~hongyuguo] [~mbudiu] If you have time, please help review this change, thank
you very much.
> UDF without parameters cannot be validated when use default conformance
> -----------------------------------------------------------------------
>
> Key: CALCITE-6745
> URL: https://issues.apache.org/jira/browse/CALCITE-6745
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.39.0
> Reporter: hongyu guo
> Assignee: Zhengqiang Duan
> Priority: Major
> Labels: pull-request-available
>
> Reproduce:
> {code:java}
> public static void main(String[] args) throws Exception {
> Schema schema = new AbstractSchema() {
> @Override
> protected Map<String, Table> getTableMap() {
> return Map.of();
> }
> };
> Properties info = new Properties();
>
> info.setProperty(CalciteConnectionProperty.DEFAULT_NULL_COLLATION.camelName(),
> NullCollation.LAST.name());
>
> info.setProperty(CalciteConnectionProperty.CASE_SENSITIVE.camelName(),
> "false");
> Connection connection = DriverManager.getConnection("jdbc:calcite:",
> info);
> CalciteConnection calciteConnection =
> connection.unwrap(CalciteConnection.class);
> SchemaPlus rootSchema = calciteConnection.getRootSchema();
> rootSchema.add("test", schema);
> rootSchema.add("TEST_FUNC", ScalarFunctionImpl.create(Main.class,
> "testFunc"));
> Statement stat = connection.createStatement();
> ResultSet resultSet = stat.executeQuery("select test_func()");
> resultSet.next();
> String res = resultSet.getString(1);
> System.out.println(res);
> }
> public static String testFunc() {
> return "testFunc";
> }
> {code}
> This demo can run in Calcite 1.38.0, but will throw exceptions in the main
> branch version of Calcite.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)