Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-6745

UDF without parameters cannot be validated when use default conformance

    XMLWordPrintableJSON

Details

    Description

      Reproduce:

      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";
          }
      

      This demo can run in Calcite 1.38.0, but will throw exceptions in the main branch version of Calcite.

      Attachments

        Issue Links

          Activity

            People

              duanzhengqiang Zhengqiang Duan
              hongyuguo hongyu guo
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: