[ 
https://issues.apache.org/jira/browse/KUDU-2894?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16885784#comment-16885784
 ] 

wxmimperio commented on KUDU-2894:
----------------------------------

[~helifu]

*Hi, my schema like this,Looks like a UNIX time zone issue.*

!image-2019-07-16-10-28-33-293.png!
{code:java}
// cols
List<ColumnSchema> columns = new ArrayList<>();
columns.add(new ColumnSchema.ColumnSchemaBuilder("event_time", 
Type.UNIXTIME_MICROS)
        .key(true)
        .encoding(ColumnSchema.Encoding.BIT_SHUFFLE)
        .compressionAlgorithm(ColumnSchema.CompressionAlgorithm.SNAPPY)
        .build());
columns.add(new ColumnSchema.ColumnSchemaBuilder("_key", Type.INT32)
        .key(true)
        .encoding(ColumnSchema.Encoding.BIT_SHUFFLE)
        .compressionAlgorithm(ColumnSchema.CompressionAlgorithm.SNAPPY).build())

// create table
private static void createTable(KuduClient kuduClient, String tableName, 
List<ColumnSchema> columns) throws KuduException, ParseException {
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
    simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT+8"));
    if (checkTableExist(kuduClient, tableName)) {
        LOG.error(String.format("Table = %s already exists", tableName));
    } else {
        Schema schema = new Schema(columns);
        CreateTableOptions cto = new CreateTableOptions();
        List<String> hashKeys = new ArrayList<>(2);
        hashKeys.add("event_time");
        hashKeys.add("_key");
        int numBuckets = 3;
        cto.addHashPartitions(hashKeys, numBuckets);
        PartialRow startKey = schema.newPartialRow();
        startKey.addTimestamp("event_time", new 
Timestamp(simpleDateFormat.parse("2019-07-15").getTime()));
        PartialRow endKey = schema.newPartialRow();
        endKey.addTimestamp("event_time", new 
Timestamp(simpleDateFormat.parse("2019-07-16").getTime()));
        cto.addRangePartition(startKey, endKey);
        List<String> rangeKeys = new ArrayList<>();
        rangeKeys.add("event_time");
        cto.setRangePartitionColumns(rangeKeys);
        cto.setNumReplicas(3);
        cto.setWait(true);
        kuduClient.createTable(tableName, schema, cto);
        LOG.info(String.format("Create table %s", tableName));
    }
}
{code}

> How to modify the time zone of web ui
> -------------------------------------
>
>                 Key: KUDU-2894
>                 URL: https://issues.apache.org/jira/browse/KUDU-2894
>             Project: Kudu
>          Issue Type: Bug
>          Components: ui
>    Affects Versions: 1.8.0
>            Reporter: wxmimperio
>            Priority: Major
>         Attachments: image-2019-07-15-19-32-42-041.png, 
> image-2019-07-16-10-28-33-293.png
>
>
> !image-2019-07-15-19-32-42-041.png!
> I create partition with 2019-05-31 00:00:00——2019-06-01 00:00:00, it show 
> 2019-05-30 16:00:00——2019-05-31 16:00:00.
> 8 hours difference.
> However, the data time I inserted is correct, not the partition display.
> How to modify the time zone on the web interface?



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to