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

ASF GitHub Bot commented on FLINK-5884:
---------------------------------------

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

    https://github.com/apache/flink/pull/3808#discussion_r114808765
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/fieldExpression.scala
 ---
    @@ -150,3 +133,30 @@ case class WindowReference(name: String) extends 
Attribute {
         }
       }
     }
    +
    +abstract class TimeAttribute(val expression: Expression)
    +  extends UnaryExpression
    +  with NamedExpression {
    +
    +  override private[flink] def child: Expression = expression
    +
    +  override private[flink] def name: String = expression match {
    +    case UnresolvedFieldReference(name) => name
    +    case _ => throw new ValidationException("Unresolved field reference 
expected.")
    +  }
    +
    +  override private[flink] def toAttribute: Attribute =
    +    throw new UnsupportedOperationException("Time attribute can not be 
used solely.")
    +}
    +
    +case class RowtimeAttribute(expr: Expression) extends TimeAttribute(expr) {
    --- End diff --
    
    I think we should not allow `TimeAttribute` in batch environments.
    In stream environments, there are different cases to distinguish:
    - rowtime on new attribute (i.e., defining it as an additional attribute at 
the end): Adds a new logical attribute to the schema
    - rowtime on existing attribute: Replaces the existing (physical) attribute 
with a new logical attribute. The reason is that data might contain a timestamp 
attribute which should be replaced by the logical timestamp attribute. If we 
would only allow to define rowtime on non-existing attributes, we would have 
two timestamp attributes, one that can be used as a time indicator and one that 
can't. I agree, this is not a super nice solution, but the best we could think 
of. Please let us know if you have a better idea. Btw. I expect most queries to 
consume data from TableSources. Those won't have this problem.
    - proctime on new field (i.e., defining it as an additional attribute at 
the end): adds a new logical attribute
    - proctime on existing field: should be forbidden, IMO.


> Integrate time indicators for Table API & SQL
> ---------------------------------------------
>
>                 Key: FLINK-5884
>                 URL: https://issues.apache.org/jira/browse/FLINK-5884
>             Project: Flink
>          Issue Type: New Feature
>          Components: Table API & SQL
>            Reporter: Timo Walther
>            Assignee: Timo Walther
>            Priority: Blocker
>             Fix For: 1.3.0
>
>
> We already discussed the need for a proper integration of time indicators 
> (event-time or processing-time) for both the Table API & SQL on the ML:
> http://apache-flink-mailing-list-archive.1008284.n3.nabble.com/DISCUSS-Table-API-SQL-indicators-for-event-and-processing-time-tp15927.html
> This issue will track the progress. I will work on a design document how we 
> can solve this issue.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to