Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,6 @@ public O visit(Expression.BinaryLiteral expr, C context) throws E {
return visitFallback(expr, context);
}

/**
* Visits a time literal.
*
* @param expr the time literal
* @param context the visitation context
* @return the visit result
* @throws E if visitation fails
*/
@Override
public O visit(Expression.TimeLiteral expr, C context) throws E {
return visitFallback(expr, context);
}

/**
* Visits a precision time literal.
*
Expand All @@ -191,32 +178,6 @@ public O visit(Expression.DateLiteral expr, C context) throws E {
return visitFallback(expr, context);
}

/**
* Visits a timestamp literal.
*
* @param expr the timestamp literal
* @param context the visitation context
* @return the visit result
* @throws E if visitation fails
*/
@Override
public O visit(Expression.TimestampLiteral expr, C context) throws E {
return visitFallback(expr, context);
}

/**
* Visits a timestamp-with-time-zone literal.
*
* @param expr the timestamp TZ literal
* @param context the visitation context
* @return the visit result
* @throws E if visitation fails
*/
@Override
public O visit(Expression.TimestampTZLiteral expr, C context) throws E {
return visitFallback(expr, context);
}

/**
* Visits a precision timestamp literal.
*
Expand Down
104 changes: 0 additions & 104 deletions core/src/main/java/io/substrait/expression/Expression.java
Original file line number Diff line number Diff line change
Expand Up @@ -421,75 +421,6 @@ public <R, C extends VisitationContext, E extends Throwable> R accept(
}
}

/**
* @deprecated {@link TimestampLiteral} is deprecated in favor of {@link
* PrecisionTimestampLiteral}
*/
@Value.Immutable
@Deprecated
abstract class TimestampLiteral implements Literal {
/**
* Returns the timestamp value of this literal in microseconds since epoch.
*
* @return the timestamp value
*/
public abstract long value();

@Override
public Type getType() {
return Type.withNullability(nullable()).TIMESTAMP;
}

/**
* Creates a new builder for constructing a TimestampLiteral.
*
* @return a new builder instance
*/
public static ImmutableExpression.TimestampLiteral.Builder builder() {
return ImmutableExpression.TimestampLiteral.builder();
}

@Override
public <R, C extends VisitationContext, E extends Throwable> R accept(
ExpressionVisitor<R, C, E> visitor, C context) throws E {
return visitor.visit(this, context);
}
}

/**
* @deprecated {@link TimeLiteral} is deprecated in favor of {@link PrecisionTimeLiteral}
*/
@Value.Immutable
@Deprecated
abstract class TimeLiteral implements Literal {
/**
* Returns the time value of this literal in microseconds since midnight.
*
* @return the time value
*/
public abstract long value();

@Override
public Type getType() {
return Type.withNullability(nullable()).TIME;
}

/**
* Creates a new builder for constructing a TimeLiteral.
*
* @return a new builder instance
*/
public static ImmutableExpression.TimeLiteral.Builder builder() {
return ImmutableExpression.TimeLiteral.builder();
}

@Override
public <R, C extends VisitationContext, E extends Throwable> R accept(
ExpressionVisitor<R, C, E> visitor, C context) throws E {
return visitor.visit(this, context);
}
}

/** Represents a time literal with configurable precision. */
@Value.Immutable
abstract class PrecisionTimeLiteral implements Literal {
Expand Down Expand Up @@ -559,41 +490,6 @@ public <R, C extends VisitationContext, E extends Throwable> R accept(
}
}

/**
* @deprecated {@link TimestampTZLiteral} is deprecated in favor of {@link
* PrecisionTimestampTZLiteral}
*/
@Value.Immutable
@Deprecated
abstract class TimestampTZLiteral implements Literal {
/**
* Returns the timestamp with timezone value of this literal in microseconds since epoch.
*
* @return the timestamp value
*/
public abstract long value();

@Override
public Type getType() {
return Type.withNullability(nullable()).TIMESTAMP_TZ;
}

/**
* Creates a new builder for constructing a TimestampTZLiteral.
*
* @return a new builder instance
*/
public static ImmutableExpression.TimestampTZLiteral.Builder builder() {
return ImmutableExpression.TimestampTZLiteral.builder();
}

@Override
public <R, C extends VisitationContext, E extends Throwable> R accept(
ExpressionVisitor<R, C, E> visitor, C context) throws E {
return visitor.visit(this, context);
}
}

/** Represents a timestamp literal with configurable precision. */
@Value.Immutable
abstract class PrecisionTimestampLiteral implements Literal {
Expand Down
102 changes: 0 additions & 102 deletions core/src/main/java/io/substrait/expression/ExpressionCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import io.substrait.util.DecimalUtil;
import java.math.BigDecimal;
import java.nio.ByteBuffer;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneOffset;
Expand Down Expand Up @@ -162,19 +161,6 @@ public static Expression.DateLiteral date(boolean nullable, int value) {
return Expression.DateLiteral.builder().nullable(nullable).value(value).build();
}

/**
* Creates a time literal expression.
*
* @param nullable whether the literal can be null
* @param value the time value in microseconds since midnight
* @return a TimeLiteral expression
* @deprecated Time is deprecated in favor of PrecisionTime
*/
@Deprecated
public static Expression.TimeLiteral time(boolean nullable, long value) {
return Expression.TimeLiteral.builder().nullable(nullable).value(value).build();
}

/**
* Creates a precision time literal expression.
*
Expand Down Expand Up @@ -209,94 +195,6 @@ public static Expression.PrecisionTimeLiteral precisionTime(boolean nullable, Lo
return precisionTime(nullable, epochNano, 9);
}

/**
* Creates a timestamp literal expression.
*
* @param nullable whether the literal can be null
* @param value the timestamp value in microseconds since epoch
* @return a TimestampLiteral expression
* @deprecated Timestamp is deprecated in favor of PrecisionTimestamp
*/
@Deprecated
public static Expression.TimestampLiteral timestamp(boolean nullable, long value) {
return Expression.TimestampLiteral.builder().nullable(nullable).value(value).build();
}

/**
* Creates a timestamp literal expression from a LocalDateTime.
*
* @param nullable whether the literal can be null
* @param value the LocalDateTime value (interpreted as UTC)
* @return a TimestampLiteral expression
* @deprecated Timestamp is deprecated in favor of PrecisionTimestamp
*/
@Deprecated
public static Expression.TimestampLiteral timestamp(boolean nullable, LocalDateTime value) {
long epochMicro =
TimeUnit.SECONDS.toMicros(value.toEpochSecond(ZoneOffset.UTC))
+ TimeUnit.NANOSECONDS.toMicros(value.getNano());
return timestamp(nullable, epochMicro);
}

/**
* Creates a timestamp literal expression from date/time components.
*
* @param nullable whether the literal can be null
* @param year the year
* @param month the month (1-12)
* @param dayOfMonth the day of month (1-31)
* @param hour the hour (0-23)
* @param minute the minute (0-59)
* @param second the second (0-59)
* @param micros the microseconds (0-999999)
* @return a TimestampLiteral expression
* @deprecated Timestamp is deprecated in favor of PrecisionTimestamp
*/
@Deprecated
public static Expression.TimestampLiteral timestamp(
boolean nullable,
int year,
int month,
int dayOfMonth,
int hour,
int minute,
int second,
int micros) {
return timestamp(
nullable,
LocalDateTime.of(year, month, dayOfMonth, hour, minute, second)
.withNano((int) TimeUnit.MICROSECONDS.toNanos(micros)));
}

/**
* Creates a timestamp with timezone literal expression.
*
* @param nullable whether the literal can be null
* @param value the timestamp value in microseconds since epoch
* @return a TimestampTZLiteral expression
* @deprecated TimestampTZ is deprecated in favor of PrecisionTimestampTZ
*/
@Deprecated
public static Expression.TimestampTZLiteral timestampTZ(boolean nullable, long value) {
return Expression.TimestampTZLiteral.builder().nullable(nullable).value(value).build();
}

/**
* Creates a timestamp with timezone literal expression from an Instant.
*
* @param nullable whether the literal can be null
* @param value the Instant value
* @return a TimestampTZLiteral expression
* @deprecated TimestampTZ is deprecated in favor of PrecisionTimestampTZ
*/
@Deprecated
public static Expression.TimestampTZLiteral timestampTZ(boolean nullable, Instant value) {
long epochMicro =
TimeUnit.SECONDS.toMicros(value.getEpochSecond())
+ TimeUnit.NANOSECONDS.toMicros(value.getNano());
return timestampTZ(nullable, epochMicro);
}

/**
* Creates a precision timestamp literal expression.
*
Expand Down
30 changes: 0 additions & 30 deletions core/src/main/java/io/substrait/expression/ExpressionVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,6 @@ public interface ExpressionVisitor<R, C extends VisitationContext, E extends Thr
*/
R visit(Expression.BinaryLiteral expr, C context) throws E;

/**
* Visit a time literal.
*
* @param expr the time literal
* @param context visitation context
* @return visit result
* @throws E on visit failure
*/
R visit(Expression.TimeLiteral expr, C context) throws E;

/**
* Visit a precision time literal.
*
Expand All @@ -141,26 +131,6 @@ public interface ExpressionVisitor<R, C extends VisitationContext, E extends Thr
*/
R visit(Expression.DateLiteral expr, C context) throws E;

/**
* Visit a timestamp literal.
*
* @param expr the timestamp literal
* @param context visitation context
* @return visit result
* @throws E on visit failure
*/
R visit(Expression.TimestampLiteral expr, C context) throws E;

/**
* Visit a timestamp-with-timezone literal.
*
* @param expr the timestamp TZ literal
* @param context visitation context
* @return visit result
* @throws E on visit failure
*/
R visit(Expression.TimestampTZLiteral expr, C context) throws E;

/**
* Visit a precision timestamp literal.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,6 @@ public Expression visit(
return lit(bldr -> bldr.setNullable(expr.nullable()).setBinary(expr.value()));
}

@Override
public Expression visit(
io.substrait.expression.Expression.TimeLiteral expr, EmptyVisitationContext context) {
return lit(bldr -> bldr.setNullable(expr.nullable()).setTime(expr.value()));
}

@Override
public Expression visit(
io.substrait.expression.Expression.PrecisionTimeLiteral expr,
Expand All @@ -203,18 +197,6 @@ public Expression visit(
return lit(bldr -> bldr.setNullable(expr.nullable()).setDate(expr.value()));
}

@Override
public Expression visit(
io.substrait.expression.Expression.TimestampLiteral expr, EmptyVisitationContext context) {
return lit(bldr -> bldr.setNullable(expr.nullable()).setTimestamp(expr.value()));
}

@Override
public Expression visit(
io.substrait.expression.Expression.TimestampTZLiteral expr, EmptyVisitationContext context) {
return lit(bldr -> bldr.setNullable(expr.nullable()).setTimestampTz(expr.value()));
}

@Override
public Expression visit(
io.substrait.expression.Expression.PrecisionTimestampLiteral expr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,10 +478,6 @@ public Expression.Literal from(io.substrait.proto.Expression.Literal literal) {
return ExpressionCreator.string(literal.getNullable(), literal.getString());
case BINARY:
return ExpressionCreator.binary(literal.getNullable(), literal.getBinary());
case TIMESTAMP:
return ExpressionCreator.timestamp(literal.getNullable(), literal.getTimestamp());
case TIMESTAMP_TZ:
return ExpressionCreator.timestampTZ(literal.getNullable(), literal.getTimestampTz());
case PRECISION_TIMESTAMP:
return ExpressionCreator.precisionTimestamp(
literal.getNullable(),
Expand All @@ -494,8 +490,6 @@ public Expression.Literal from(io.substrait.proto.Expression.Literal literal) {
literal.getPrecisionTimestampTz().getPrecision());
case DATE:
return ExpressionCreator.date(literal.getNullable(), literal.getDate());
case TIME:
return ExpressionCreator.time(literal.getNullable(), literal.getTime());
case PRECISION_TIME:
return ExpressionCreator.precisionTime(
literal.getNullable(),
Expand Down
Loading
Loading