Skip to content

Commit

Permalink
[hotfix] [table] Remove wrong ISO references for timestamp extraction
Browse files Browse the repository at this point in the history
The docs and timestamp extractors mention ISO timestamps, however, according
to ISO 8601 timestamps have a different format.
  • Loading branch information
twalthr committed Jul 26, 2018
1 parent ef0768b commit c503c21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions docs/dev/table/sourceSinks.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,7 @@ val source: KafkaTableSource = Kafka010JsonTableSource.builder()
Flink provides `TimestampExtractor` implementations for common use cases.
The following `TimestampExtractor` implementations are currently available:

* `ExistingField(fieldName)`: Extracts the value of a rowtime attribute from an existing `LONG` or `SQL_TIMESTAMP`, or ISO date formatted `STRING` field.
* One example of ISO date format would be '2018-05-28 12:34:56.000'.
* `ExistingField(fieldName)`: Extracts the value of a rowtime attribute from an existing `LONG`, `SQL_TIMESTAMP`, or timestamp formatted `STRING` field. One example of such a string would be '2018-05-28 12:34:56.000'.
* `StreamRecordTimestamp()`: Extracts the value of a rowtime attribute from the timestamp of the `DataStream` `StreamRecord`. Note, this `TimestampExtractor` is not available for batch table sources.

A custom `TimestampExtractor` can be defined by implementing the corresponding interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ import org.apache.flink.table.api.{Types, ValidationException}
import org.apache.flink.table.expressions.{Cast, Expression, ResolvedFieldReference}

/**
* Converts an existing [[Long]] or [[java.sql.Timestamp]], or
* ISO date formatted [[java.lang.String]] field into a rowtime attribute.
* Converts an existing [[Long]], [[java.sql.Timestamp]], or
* timestamp formatted [[java.lang.String]] field (e.g., "2018-05-28 12:34:56.000") into
* a rowtime attribute.
*
* @param field The field to convert into a rowtime attribute.
*/
Expand All @@ -47,8 +48,9 @@ final class ExistingField(val field: String) extends TimestampExtractor {
}

/**
* Returns an [[Expression]] that casts a [[Long]] or [[java.sql.Timestamp]], or
* ISO date formatted [[java.lang.String]] field into a rowtime attribute.
* Returns an [[Expression]] that casts a [[Long]], [[java.sql.Timestamp]], or
* timestamp formatted [[java.lang.String]] field (e.g., "2018-05-28 12:34:56.000")
* into a rowtime attribute.
*/
override def getExpression(fieldAccesses: Array[ResolvedFieldReference]): Expression = {
val fieldAccess: Expression = fieldAccesses(0)
Expand Down

0 comments on commit c503c21

Please sign in to comment.