Skip to content

Commit

Permalink
Remove some unused fields, parameters and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Sep 19, 2022
1 parent e736d78 commit 18d875f
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 38 deletions.
Expand Up @@ -142,7 +142,6 @@ public void validate(Properties properties)
getValue(properties);
}

protected static final Predicate<Properties> REQUIRED = properties -> true;
protected static final Predicate<Properties> NOT_REQUIRED = properties -> false;

protected static final Predicate<Properties> ALLOWED = properties -> true;
Expand Down
Expand Up @@ -31,7 +31,6 @@
import io.trino.type.DateTimes;
import org.joda.time.DateTime;
import org.joda.time.DateTimeField;
import org.joda.time.DateTimeZone;
import org.joda.time.Days;
import org.joda.time.LocalDate;
import org.joda.time.chrono.ISOChronology;
Expand Down Expand Up @@ -650,23 +649,6 @@ public static long parseDuration(@SqlType("varchar(x)") Slice duration)
}
}

// HACK WARNING!
// This method does calculate difference between timezone offset on current date (session start)
// and 1970-01-01 (same timezone). This is used to be able to avoid using fixed offset TZ for
// places where TZ offset is explicitly accessed (namely AT TIME ZONE).
// DateTimeFormatter does format specified instance in specified time zone calculating offset for
// that time zone based on provided instance. As Trino TIME type is represented as millis since
// 00:00.000 of some day UTC, we always use timezone offset that was valid on 1970-01-01.
// Best effort without changing representation of TIME WITH TIME ZONE is to use offset of the timezone
// based on session start time.
// By adding this difference to instance that we would like to convert to other TZ, we can
// get exact value of utcMillis for current session start time.
// Silent assumption is made, that no changes in TZ offsets were done on 1970-01-01.
public static long valueToSessionTimeZoneOffsetDiff(long epochMillis, DateTimeZone timeZone)
{
return timeZone.getOffset(0) - timeZone.getOffset(epochMillis);
}

@ScalarFunction("to_milliseconds")
@SqlType(StandardTypes.BIGINT)
public static long toMilliseconds(@SqlType(StandardTypes.INTERVAL_DAY_TO_SECOND) long value)
Expand Down
Expand Up @@ -16,7 +16,6 @@
import io.airlift.slice.Slice;
import io.trino.spi.connector.ConnectorSession;
import io.trino.spi.function.Description;
import io.trino.spi.function.LiteralParameter;
import io.trino.spi.function.LiteralParameters;
import io.trino.spi.function.ScalarFunction;
import io.trino.spi.function.SqlType;
Expand Down Expand Up @@ -45,7 +44,7 @@ public static Slice format(ConnectorSession session, @SqlType("timestamp(p)") lo

@LiteralParameters({"x", "p"})
@SqlType(StandardTypes.VARCHAR)
public static Slice format(@LiteralParameter("p") long precision, ConnectorSession session, @SqlType("timestamp(p)") LongTimestamp timestamp, @SqlType("varchar(x)") Slice formatString)
public static Slice format(ConnectorSession session, @SqlType("timestamp(p)") LongTimestamp timestamp, @SqlType("varchar(x)") Slice formatString)
{
// Currently, date formatting only supports up to millis, so anything in the microsecond fraction is irrelevant
return format(session, timestamp.getEpochMicros(), formatString);
Expand Down
Expand Up @@ -391,11 +391,6 @@ private ColumnPositionsList(OrcColumnId columnId, OrcTypeKind columnType, List<I
this.positionsList = ImmutableList.copyOf(requireNonNull(positionsList, "positionsList is null"));
}

public int getIndex()
{
return index;
}

public boolean hasNextPosition()
{
return index < positionsList.size();
Expand Down
Expand Up @@ -76,7 +76,6 @@ public abstract class AbstractHiveAcidWriters
private final OrcFileWriterFactory orcFileWriterFactory;
private final Configuration configuration;
protected final ConnectorSession session;
protected final HiveType hiveRowType;
private final AcidOperation updateKind;
private final Properties hiveAcidSchema;
protected final Block hiveRowTypeNullsBlock;
Expand Down Expand Up @@ -111,7 +110,6 @@ public AbstractHiveAcidWriters(
this.configuration = requireNonNull(configuration, "configuration is null");
this.session = requireNonNull(session, "session is null");
checkArgument(transaction.isTransactional(), "Not in a transaction: %s", transaction);
this.hiveRowType = requireNonNull(hiveRowType, "hiveRowType is null");
this.updateKind = requireNonNull(updateKind, "updateKind is null");
this.hiveAcidSchema = createAcidSchema(hiveRowType);
this.hiveRowTypeNullsBlock = nativeValueToBlock(hiveRowType.getType(typeManager), null);
Expand Down
Expand Up @@ -51,16 +51,6 @@ public String getBenchmarkName()
return benchmarkName;
}

protected int getWarmupIterations()
{
return warmupIterations;
}

protected int getMeasuredIterations()
{
return measuredIterations;
}

/**
* Initialize any state necessary to run benchmark. This is run once at start up.
*/
Expand Down

0 comments on commit 18d875f

Please sign in to comment.