Build failed in Jenkins: Calcite ยป Calcite-snapshots #866

2024-04-11 Thread Apache Jenkins Server
See 


Changes:

[Tanner Clary] [CALCITE-2980] Implement the FORMAT clause of the CAST operator


--
[...truncated 300.58 KB...]
  public static SqlBasicAggFunction create(SqlKind kind,
^
:87:
 warning: no @param for operandTypeChecker
  public static SqlBasicAggFunction create(SqlKind kind,
^
:87:
 warning: no @return
  public static SqlBasicAggFunction create(SqlKind kind,
^
:94:
 warning: no @param for name
  public static SqlBasicAggFunction create(String name, SqlKind kind,
^
:94:
 warning: no @param for kind
  public static SqlBasicAggFunction create(String name, SqlKind kind,
^
:94:
 warning: no @param for returnTypeInference
  public static SqlBasicAggFunction create(String name, SqlKind kind,
^
:94:
 warning: no @param for operandTypeChecker
  public static SqlBasicAggFunction create(String name, SqlKind kind,
^
:94:
 warning: no @return
  public static SqlBasicAggFunction create(String name, SqlKind kind,
^
:147:
 warning: no @param for name
  public SqlAggFunction withName(String name) {
^
:147:
 warning: no @return
  public SqlAggFunction withName(String name) {
^
:165:
 warning: no @param for category
  public SqlBasicAggFunction withFunctionType(SqlFunctionCategory category) {
 ^
:165:
 warning: no @return
  public SqlBasicAggFunction withFunctionType(SqlFunctionCategory category) {
 ^

> Task :plus:javadoc
:98:
 warning: no @param for scaleFactor
  public TpcdsSchema(double scaleFactor) {
 ^
:120:
 warning: no @param for args
  public static void main(String[] args) {
 ^
2 warnings

> Task :plus:javadocJar

> Task :piglet:test
  8.9sec, org.apache.calcite.test.PigletTest > 
testValues()
  8.9sec, org.apache.calcite.test.PigRelBuilderTest 
> testGroup2()
 10.5sec,   22 completed,   0 failed,   0 skipped, 
org.apache.calcite.test.PigRelBuilderTest
 11.6sec, org.apache.calcite.test.PigRelExTest > 
testNegation()
 12.3sec, org.apache.calcite.test.PigRelOpTest > 
testLoadWithSchema()
  2.6sec, org.apache.calcite.test.PigScriptTest > 
testReadScript()
  2.6sec,1 completed,   0 failed,   0 skipped, 
org.apache.calcite.test.PigScriptTest
WARNING  14.8sec,   19 completed,   0 failed,   1 
skipped, org.apache.calcite.test.PigletTest
  3.2sec, org.apache.calcite.test.PigRelOpTest > 
testForEachNested()
  2.1sec, org.apache.calcite.test.PigRelExTest > 
testCast()
WARNING  

PRs to merge in 1.27

2024-04-11 Thread Mihai Budiu
Hello all contributors,

The number of open PRs in the Calcite queue has grown a lot, and it is very 
easy to overlook a PR which hasn't been merged quickly. If you have a PR which 
you think is ready for 1.37, please let us know, even if it hasn't received any 
reviews.

I know this from my personal experience, I have a handful of bug fixes which I 
was hoping to get into 1.37 which haven't been reviewed. I understand that too, 
I don't feel comfortable reviewing PRs for parts of the code which I don't know 
well. Perhaps the right way to do it is to explain in more details in the JIRA 
discussions what the PRs do, why, and how, to help guide the reviewers?

Mihai


volcano planner error

2024-04-11 Thread Hugh Pearse
Hello team,
I am currently following a tutorial on VolcanoPlanner called  "Assembling a
query optimizer with Apache Calcite"[1].
But I am facing an issue with an error thrown.

The following method works OK with CalciteAssert.SchemaSpec.HR
public RelNode costOptimize(RelNode relNode) {
// volcano planner
System.out.println("Logical plan:");
RelOptCluster cluster = relNode.getCluster();
VolcanoPlanner planner = (VolcanoPlanner) cluster.getPlanner();
RelTraitSet desiredTraits =
cluster.traitSet().replace(EnumerableConvention.INSTANCE);
relNode = planner.changeTraits(relNode, desiredTraits);
planner.setRoot(relNode);
RelNode optimized = planner.findBestExp();
RelWriter rw = new RelWriterImpl(new PrintWriter(System.out, true));
optimized.explain(rw);
return optimized;
}
It outputs the plan as expected.

But when I try to optimize one of my own tables, an implementation
of AbstractTable, the costOptimize method displays an error:
Logical plan:
Exception in thread "main" java.lang.AssertionError: Relational expression
rel#4:LogicalTableScan.NONE.[](table=[tutorial, role]) belongs to a
different planner than is currently being used.
at
org.apache.calcite.plan.volcano.VolcanoPlanner.registerImpl(VolcanoPlanner.java:1251)
at
org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:599)
at
org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:614)
at
org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:95)
at
org.apache.calcite.rel.AbstractRelNode.onRegister(AbstractRelNode.java:275)
at
org.apache.calcite.plan.volcano.VolcanoPlanner.registerImpl(VolcanoPlanner.java:1274)
at
org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:599)
at
org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:614)
at
org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:95)
at
org.apache.calcite.rel.AbstractRelNode.onRegister(AbstractRelNode.java:275)
at
org.apache.calcite.plan.volcano.VolcanoPlanner.registerImpl(VolcanoPlanner.java:1274)
at
org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:599)
at
org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:614)
at
org.apache.calcite.plan.volcano.VolcanoPlanner.changeTraits(VolcanoPlanner.java:499)
at hugh.App.costOptimize(App.java:274)

If I make the suggested fix ("belongs to a different planner than is
currently being used"[2]) to use RelNode.copy
public RelNode costOptimize(RelNode relNode) {
// volcano planner
System.out.println("Logical plan:");
RelOptCluster cluster = relNode.getCluster();
VolcanoPlanner planner = (VolcanoPlanner) cluster.getPlanner();
RelTraitSet desiredTraits =
cluster.traitSet().replace(EnumerableConvention.INSTANCE);
RelNode copy = relNode.copy(desiredTraits, List.of(relNode));
copy = planner.changeTraits(copy, desiredTraits);
planner.setRoot(copy);
RelNode optimized = planner.findBestExp();
RelWriter rw = new RelWriterImpl(new PrintWriter(System.out, true));
optimized.explain(rw);
return optimized;
}

It then throws a different error
Exception in thread "main" java.lang.AssertionError: Relational expression
rel#10:LogicalFilter.ENUMERABLE.[](input=LogicalFilter#6,condition==($1,
'Smith')) has calling-convention ENUMERABLE but does not implement the
required interface 'interface
org.apache.calcite.adapter.enumerable.EnumerableRel' of that convention
at
org.apache.calcite.plan.volcano.VolcanoPlanner.registerImpl(VolcanoPlanner.java:1265)
at
org.apache.calcite.plan.volcano.VolcanoPlanner.register(VolcanoPlanner.java:599)
at
org.apache.calcite.plan.volcano.VolcanoPlanner.ensureRegistered(VolcanoPlanner.java:614)
at
org.apache.calcite.plan.volcano.VolcanoPlanner.changeTraits(VolcanoPlanner.java:499)
at hugh.App.costOptimize(App.java:275)
at hugh.App.driver(App.java:567)
at hugh.App.main(App.java:574)

Any suggestions to get this working?

Kindest regards
From,
Hugh Pearse
Dublin.

References
1. "Assembling a query optimizer with Apache Calcite" -
https://www.querifylabs.com/blog/assembling-a-query-optimizer-with-apache-calcite
2. "belongs to a different planner than is currently being used" -
https://www.mail-archive.com/dev@calcite.apache.org/msg02939.html


[jira] [Created] (CALCITE-6362) JSON_OBJECT. Internal representation DATE values leaks into resulting JSON object

2024-04-11 Thread Maksim Zhuravkov (Jira)
Maksim Zhuravkov created CALCITE-6362:
-

 Summary: JSON_OBJECT. Internal representation DATE values leaks 
into resulting JSON object
 Key: CALCITE-6362
 URL: https://issues.apache.org/jira/browse/CALCITE-6362
 Project: Calcite
  Issue Type: Bug
Reporter: Maksim Zhuravkov


When a CAST function is used inside a JSON_OBJECT, then resulting JSON contains 
a number of days instead 

{code}
SELECT JSON_OBJECT('a': CAST('2010-01-01' AS DATE)) as c1;
 {"a":14610}
{code}

I expected to get a date in a string form as many databases do in such case:

Bigquery:
{code}
SELECT JSON_OBJECT('a', CAST('2010-01-10' AS DATE))

{"a":"2010-01-10"}
{code}

PostgreSQL
{code}
SELECT json_build_object('a', '2010-01-01'::DATE)

{"a":"2010-01-01"}
{code}

MySql
{code}
SELECT json_object('a', DATE '2010-01-01')

{"a": "2010-01-01"}
{code}







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