>From what I've been able to tell, surface-level functionally the below work
the same
but I'm wondering whether there are any differences/any scenarios to prefer
one to the other?

======================================
fun executeQuery(sql: String): ResultSet {
    val planner = Frameworks.getPlanner(frameworkConfig)
    val sqlNode = planner.parse(sql)
    val validated = planner.validate(sqlNode)
    val relRoot = planner.rel(validated).project()

    relRoot.cluster.planner.root = relRoot.cluster.planner.changeTraits(
        relRoot,
        relRoot.cluster.traitSet().replace(EnumerableConvention.INSTANCE)
    )
    val bestExp = relRoot.cluster.planner.findBestExp()

    val relRunner = connection.unwrap(RelRunner::class.java)
    return relRunner.prepareStatement(bestExp).executeQuery()
}

======================================
fun executeQuery(sql: String): ResultSet {
    val stmt = CalciteSchemaService.connection.createStatement()
    return stmt.executeQuery(sql)
}

Reply via email to