[ 
https://issues.apache.org/jira/browse/BEAM-10027?focusedWorklogId=438271&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-438271
 ]

ASF GitHub Bot logged work on BEAM-10027:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 28/May/20 14:12
            Start Date: 28/May/20 14:12
    Worklog Time Spent: 10m 
      Work Description: rionmonster commented on a change in pull request 
#11761:
URL: https://github.com/apache/beam/pull/11761#discussion_r431866184



##########
File path: learning/katas/kotlin/Windowing/Adding 
Timestamp/WithTimestamps/src/org/apache/beam/learning/katas/windowing/addingtimestamp/withtimestamps/Task.kt
##########
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.learning.katas.windowing.addingtimestamp.withtimestamps
+
+import org.apache.beam.learning.katas.util.Log
+import org.apache.beam.sdk.Pipeline
+import org.apache.beam.sdk.options.PipelineOptionsFactory
+import org.apache.beam.sdk.transforms.Create
+import org.apache.beam.sdk.transforms.WithTimestamps
+import org.apache.beam.sdk.values.PCollection
+import org.joda.time.DateTime
+
+object Task {
+    @JvmStatic
+    fun main(args: Array<String>) {
+        val options = PipelineOptionsFactory.fromArgs(*args).create()
+        val pipeline = Pipeline.create(options)
+
+        val events = pipeline.apply(
+                Create.of(
+                        Event("1", "book-order", 
DateTime.parse("2019-06-01T00:00:00+00:00")),
+                        Event("2", "pencil-order", 
DateTime.parse("2019-06-02T00:00:00+00:00")),
+                        Event("3", "paper-order", 
DateTime.parse("2019-06-03T00:00:00+00:00")),
+                        Event("4", "pencil-order", 
DateTime.parse("2019-06-04T00:00:00+00:00")),
+                        Event("5", "book-order", 
DateTime.parse("2019-06-05T00:00:00+00:00"))
+                )
+        )
+
+        val output = applyTransform(events)
+
+        output.apply(Log.ofElements())
+
+        pipeline.run()
+    }
+
+    @JvmStatic
+    fun applyTransform(events: PCollection<Event>): PCollection<Event> {
+        return events.apply(WithTimestamps.of { event: Event -> 
event.date.toInstant() })

Review comment:
       This should be adjusted; I tested it through and it worked locally.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 438271)
    Time Spent: 10.5h  (was: 10h 20m)

> Support for Kotlin-based Beam Katas
> -----------------------------------
>
>                 Key: BEAM-10027
>                 URL: https://issues.apache.org/jira/browse/BEAM-10027
>             Project: Beam
>          Issue Type: Improvement
>          Components: katas
>            Reporter: Rion Williams
>            Assignee: Rion Williams
>            Priority: P2
>   Original Estimate: 8h
>          Time Spent: 10.5h
>  Remaining Estimate: 0h
>
> Currently, there are a series of examples available demonstrating the use of 
> Apache Beam with Kotlin. It would be nice to have support for the same Beam 
> Katas that exist for Python, Go, and Java to also support Kotlin. 
> The port itself shouldn't be that involved since it can still target the JVM, 
> so it would likely just require the inclusion for Kotlin dependencies and a 
> conversion for all of the existing Java examples. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to