Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
public static class HrSchema { public final Employee[] emps = 0; public final Department[] depts = 0; } Class.forName("org.apache.calcite.jdbc.Driver"); Properties info = new Properties(); info.setProperty("lex", "JAVA"); Connection connection = DriverManager.getConnection("jdbc:calcite:", info); CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class); SchemaPlus rootSchema = calciteConnection.getRootSchema(); Schema schema = new ReflectiveSchema(new HrSchema()); rootSchema.add("hr", schema); Statement statement = calciteConnection.createStatement(); ResultSet resultSet = statement.executeQuery( "select d.deptno, min(e.empid)\n" + "from hr.emps as e\n" + "join hr.depts as d\n" + " on e.deptno = d.deptno\n" + "group by d.deptno\n" + "having count(*) > 1"); print(resultSet); resultSet.close(); statement.close(); connection.close();
Currently, the data of emps and depts are both 0, and it is not reasonable to not create a new object. We can create new Employee[0] and add some data, which may be more reasonable.
Attachments
Issue Links
- links to