Skip to content

Commit

Permalink
rename DateTimeZone to DateTimeOffset.
Browse files Browse the repository at this point in the history
  • Loading branch information
codemzs committed Aug 19, 2018
1 parent bc530e9 commit e0d66b0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
20 changes: 10 additions & 10 deletions src/Microsoft.ML.Core/Data/ColumnType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ public bool IsDateTimeZone
{
get
{
if (!(this is DateTimeZoneType))
if (!(this is DateTimeOffsetType))
return false;
// DateTimeZoneType is a singleton.
Contracts.Assert(this == DateTimeZoneType.Instance);
// DateTimeOffsetType is a singleton.
Contracts.Assert(this == DateTimeOffsetType.Instance);
return true;
}
}
Expand Down Expand Up @@ -319,7 +319,7 @@ public static PrimitiveType FromKind(DataKind kind)
if (kind == DataKind.DT)
return DateTimeType.Instance;
if (kind == DataKind.DZ)
return DateTimeZoneType.Instance;
return DateTimeOffsetType.Instance;
return NumberType.FromKind(kind);
}
}
Expand Down Expand Up @@ -623,20 +623,20 @@ public override string ToString()
}
}

public sealed class DateTimeZoneType : PrimitiveType
public sealed class DateTimeOffsetType : PrimitiveType
{
private static volatile DateTimeZoneType _instance;
public static DateTimeZoneType Instance
private static volatile DateTimeOffsetType _instance;
public static DateTimeOffsetType Instance
{
get
{
if (_instance == null)
Interlocked.CompareExchange(ref _instance, new DateTimeZoneType(), null);
Interlocked.CompareExchange(ref _instance, new DateTimeOffsetType(), null);
return _instance;
}
}

private DateTimeZoneType()
private DateTimeOffsetType()
: base(typeof(DateTimeOffset), DataKind.DZ)
{
}
Expand All @@ -645,7 +645,7 @@ public override bool Equals(ColumnType other)
{
if (other == this)
return true;
Contracts.Assert(!(other is DateTimeZoneType));
Contracts.Assert(!(other is DateTimeOffsetType));
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.Data/DataLoadSave/Binary/CodecFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public CodecFactory(IHostEnvironment env, MemoryStreamPool memPool = null)
RegisterSimpleCodec(new DvTextCodec(this));
RegisterSimpleCodec(new BoolCodec(this));
RegisterSimpleCodec(new DateTimeCodec(this));
RegisterSimpleCodec(new DateTimeZoneCodec(this));
RegisterSimpleCodec(new DateTimeOffsetCodec(this));
RegisterSimpleCodec(new UnsafeTypeCodec<UInt128>(this));

// Register the old boolean reading codec.
Expand Down
12 changes: 6 additions & 6 deletions src/Microsoft.ML.Data/DataLoadSave/Binary/Codecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -666,12 +666,12 @@ public override void Get(ref DateTime value)
}
}

private sealed class DateTimeZoneCodec : SimpleCodec<DateTimeOffset>
private sealed class DateTimeOffsetCodec : SimpleCodec<DateTimeOffset>
{
private readonly MadeObjectPool<long[]> _longBufferPool;

public DateTimeZoneCodec(CodecFactory factory)
: base(factory, DateTimeZoneType.Instance)
public DateTimeOffsetCodec(CodecFactory factory)
: base(factory, DateTimeOffsetType.Instance)
{
_longBufferPool = new MadeObjectPool<long[]>(() => null);
}
Expand All @@ -691,7 +691,7 @@ private sealed class Writer : ValueWriterBase<DateTimeOffset>
private List<long> _offsets;
private List<long> _ticks;

public Writer(DateTimeZoneCodec codec, Stream stream)
public Writer(DateTimeOffsetCodec codec, Stream stream)
: base(codec.Factory, stream)
{
_offsets = new List<long>();
Expand Down Expand Up @@ -725,15 +725,15 @@ public override long GetCommitLengthEstimate()

private sealed class Reader : ValueReaderBase<DateTimeOffset>
{
private readonly DateTimeZoneCodec _codec;
private readonly DateTimeOffsetCodec _codec;

private readonly int _entries;
private long[] _offsets;
private long[] _ticks;
private int _index;
private bool _disposed;

public Reader(DateTimeZoneCodec codec, Stream stream, int items)
public Reader(DateTimeOffsetCodec codec, Stream stream, int items)
: base(codec.Factory, stream)
{
_codec = codec;
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.Parquet/ParquetLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ private ColumnType ConvertFieldType(DataType parquetType)
case DataType.Decimal:
return NumberType.R8;
case DataType.DateTimeOffset:
return DateTimeZoneType.Instance;
return DateTimeOffsetType.Instance;
case DataType.Interval:
return TimeSpanType.Instance;
default:
Expand Down

0 comments on commit e0d66b0

Please sign in to comment.