Github user jihoonson commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/993#discussion_r60341436
  
    --- Diff: 
tajo-core/src/main/java/org/apache/tajo/engine/function/datetime/DatePartFromTimestamp.java
 ---
    @@ -59,8 +55,9 @@ public DatePartFromTimestamp() {
     
       @Override
       public void init(OverridableConf context, FunctionEval.ParamType [] 
types) {
    -    String timezoneId = context.get(SessionVars.TIMEZONE, 
TajoConstants.DEFAULT_SYSTEM_TIMEZONE);
    -    timezone = TimeZone.getTimeZone(timezoneId);
    +    if (!hasTimeZone()) {
    --- End diff --
    
    This function has some bugs.
    ```
    default> \d test
    
    table name: default.test
    table uri: hdfs://localhost:7020/tajo/warehouse/default/test
    store type: TEXT
    number of rows: 1
    volume: 40 B
    Options:
        'timezone'='Asia/Seoul'
        'text.delimiter'='|'
    
    schema: 
    t   TIME
    ts  TIMESTAMP
    d   DATE
    
    default> \set TIMEZONE GMT-9
    default> select ts from test;
    ts
    -------------------------------
    2015-04-30 21:01:23
    2016-04-30 22:02:33
    (2 rows, 0.016 sec, 0 B selected)
    default> select date_part('day', ts) from test;
    ?date_part
    -------------------------------
    1.0
    1.0
    (2 rows, 0.021 sec, 0 B selected)
    default> select date_part('hour', ts) from test;
    ?date_part
    -------------------------------
    15.0
    16.0
    (2 rows, 0.024 sec, 0 B selected)
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to