hongyu guo created CALCITE-6745:
-----------------------------------

             Summary: UDF without parameters cannot be validated
                 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


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)

Reply via email to