예제 #1
0
    public DateTime GetDateTime(int columnIndex)
    {
        var column = Schema.GetColumn(columnIndex);
        var type   = column.Type;

        if (type == KuduType.UnixtimeMicros)
        {
            CheckValue(columnIndex);
            ReadOnlySpan <byte> data = GetRowAllocColumn(columnIndex, 8);
            return(KuduEncoder.DecodeDateTime(data));
        }
        else if (type == KuduType.Date)
        {
            CheckValue(columnIndex);
            ReadOnlySpan <byte> data = GetRowAllocColumn(columnIndex, 4);
            return(KuduEncoder.DecodeDate(data));
        }

        return(KuduTypeValidation.ThrowException <DateTime>(column,
                                                            KuduTypeFlags.UnixtimeMicros |
                                                            KuduTypeFlags.Date));
    }