[ 
https://issues.apache.org/jira/browse/CALCITE-6613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17887271#comment-17887271
 ] 

suibianwanwan commented on CALCITE-6613:
----------------------------------------

Sry, I slipped.

> Make the Background code examples in Calcite official documentation clearer
> ---------------------------------------------------------------------------
>
>                 Key: CALCITE-6613
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6613
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Caican Cai
>            Assignee: Caican Cai
>            Priority: Minor
>
> {code:java}
> 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();
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to