[
https://issues.apache.org/jira/browse/FLINK-4294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15434592#comment-15434592
]
ASF GitHub Bot commented on FLINK-4294:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/2319#discussion_r76024507
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/api/scala/table/expressionDsl.scala
---
@@ -223,10 +223,28 @@ trait ImplicitExpressionOperations {
*/
def toTime = Cast(expr, SqlTimeTypeInfo.TIME)
- /**
+ /**
* Parses a timestamp String in the form "yy-mm-dd hh:mm:ss.fff" to a
SQL Timestamp.
*/
def toTimestamp = Cast(expr, SqlTimeTypeInfo.TIMESTAMP)
+
+ /**
+ * Accesses the field of a Flink composite type (such as Tuple, POJO,
etc.) by name and
+ * returns it's value.
+ *
+ * @param name name of the field (similar to Flink's field expressions)
+ * @return value of the field
+ */
+ def getField(name: String) = GetCompositeField(expr, name)
--- End diff --
Unfortunately, `'address$*` does not work because `*` is not a valid
character for Scala symbols :-(
> Allow access of composite type fields
> -------------------------------------
>
> Key: FLINK-4294
> URL: https://issues.apache.org/jira/browse/FLINK-4294
> Project: Flink
> Issue Type: New Feature
> Components: Table API & SQL
> Reporter: Timo Walther
> Assignee: Timo Walther
>
> Currently all Flink CompositeTypes are treated as GenericRelDataTypes. It
> would be better to access individual fields of composite types, too. e.g.
> {code}
> SELECT composite.name FROM composites
> SELECT tuple.f0 FROM tuples
> 'f0.getField(0)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)