Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
vkorukanti committed Aug 21, 2023
1 parent 0dba974 commit 4736839
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 249 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package io.delta.kernel.expressions;

import java.math.BigDecimal;
import java.sql.Date;
import java.util.Collections;
import java.util.List;

Expand All @@ -39,7 +38,6 @@
import io.delta.kernel.types.TimestampType;

import static io.delta.kernel.internal.util.InternalUtils.checkArgument;
import static io.delta.kernel.utils.Utils.daysSinceEpoch;

/**
* A literal value.
Expand All @@ -57,11 +55,8 @@
* </p>
*/
public final class Literal implements Expression {
public static final Literal TRUE = Literal.of(true);
public static final Literal FALSE = Literal.of(false);

/**
* Create a boolean {@link Literal} object
* Create a {@code boolean} type {@link Literal} object
*
* @param value boolean value
* @return a {@link Literal} with data type {@link BooleanType}
Expand Down Expand Up @@ -136,11 +131,12 @@ public static Literal of(byte[] value) {
}

/**
* @return a {@link Literal} with data type {@link DateType}
* @param numOfDaysSinceEpochUTC Number of days since the epoch in UTC timezone.
* @return a {@link Literal} with data type {@link BooleanType}
* @l Create a {@code date} type {@link Literal}.
*/
public static Literal of(Date value) {
int numOfDaysSinceEpoch = daysSinceEpoch(value);
return new Literal(numOfDaysSinceEpoch, DateType.INSTANCE);
public static Literal ofDate(int numOfDaysSinceEpochUTC) {
return new Literal(numOfDaysSinceEpochUTC, DateType.INSTANCE);
}

/**
Expand All @@ -164,6 +160,9 @@ public static Literal of(BigDecimal value, int precision, int scale) {
}

/**
* Create {@code null} literl.
*
* @param dataType {@link DataType} of the null literal.
* @return a null {@link Literal} with the given data type
*/
public static Literal ofNull(DataType dataType) {
Expand Down Expand Up @@ -205,6 +204,12 @@ public Object value() {
return value;
}

/**
* Get the datatype of the literal object. Datatype lets the caller interpret the value of the
* literal object returned by {@link #value}
*
* @return Datatype of the literal object.
*/
public DataType dataType() {
return dataType;
}
Expand Down

This file was deleted.

0 comments on commit 4736839

Please sign in to comment.