Skip to content

[CALCITE-3987] Coerce NUMERIC to INTERVAL_DAY in DATE arithmetic#1984

Closed
dasch-1 wants to merge 1 commit intoapache:masterfrom
dasch-1:date_numeric_3987
Closed

[CALCITE-3987] Coerce NUMERIC to INTERVAL_DAY in DATE arithmetic#1984
dasch-1 wants to merge 1 commit intoapache:masterfrom
dasch-1:date_numeric_3987

Conversation

@dasch-1
Copy link
Contributor

@dasch-1 dasch-1 commented May 18, 2020

No description provided.

}
SqlCall call = binding.getCall();
SqlNumericLiteral numeric = (SqlNumericLiteral) call.getOperandList().get(numericIndex);
SqlIntervalQualifier qualifier =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you make sure the numeric operand is a literal ? Could it be another expression ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just add a CAST there, let the planner decide how to translate to interval value.

expr("CURRENT_DATE+1")
.withConformance(SqlConformanceEnum.BABEL).ok();
expr("1+CURRENT_DATE")
.withConformance(SqlConformanceEnum.BABEL).ok();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We better also check the type.

@dasch-1 dasch-1 closed this May 26, 2020
@dasch-1 dasch-1 deleted the date_numeric_3987 branch May 26, 2020 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants