[
https://issues.apache.org/jira/browse/BEAM-5203?focusedWorklogId=166597&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-166597
]
ASF GitHub Bot logged work on BEAM-5203:
----------------------------------------
Author: ASF GitHub Bot
Created on: 15/Nov/18 19:01
Start Date: 15/Nov/18 19:01
Worklog Time Spent: 10m
Work Description: amaliujia commented on a change in pull request #6996:
[BEAM-5203] expose PaneInfo and BoundedWindow as UDF
URL: https://github.com/apache/beam/pull/6996#discussion_r233969494
##########
File path:
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/udf/WindowUdfs.java
##########
@@ -0,0 +1,121 @@
+/*
+ * 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.sdk.extensions.sql.impl.udf;
+
+import com.google.auto.service.AutoService;
+import java.util.Collections;
+import
org.apache.beam.sdk.extensions.sql.impl.interpreter.BeamSqlExpressionEnvironment;
+import
org.apache.beam.sdk.extensions.sql.impl.interpreter.operator.BeamSqlExpression;
+import
org.apache.beam.sdk.extensions.sql.impl.interpreter.operator.BeamSqlPrimitive;
+import org.apache.beam.sdk.schemas.Schema;
+import org.apache.beam.sdk.transforms.windowing.GlobalWindow;
+import org.apache.beam.sdk.transforms.windowing.IntervalWindow;
+import org.apache.beam.sdk.values.Row;
+import org.apache.calcite.sql.type.SqlTypeName;
+import org.joda.time.Instant;
+
+/** /** UDFs to expose {@link } related on {@link
org.apache.beam.sdk.values.Row}. */
+@AutoService(BeamBuiltinFunctionProvider.class)
+public class WindowUdfs extends BeamBuiltinFunctionProvider {
+ @UDF(
+ funcName = "WINDOW_TYPE",
+ parameterArray = {},
+ returnType = Schema.TypeName.STRING
+ )
+ public String windowType() {
+ return "UNKNOWN";
+ }
+
+ @UDF(
+ funcName = "WINDOW_START",
+ parameterArray = {},
+ returnType = Schema.TypeName.DATETIME
+ )
+ public Instant windowStartTime() {
+ return Instant.now();
Review comment:
Is it intentional to return Instant.now?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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: 166597)
Time Spent: 1h 40m (was: 1.5h)
> expose PaneInfo and BoundedWindow as UDF
> ----------------------------------------
>
> Key: BEAM-5203
> URL: https://issues.apache.org/jira/browse/BEAM-5203
> Project: Beam
> Issue Type: Improvement
> Components: dsl-sql
> Reporter: Xu Mingmin
> Assignee: Xu Mingmin
> Priority: Major
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> besides adding new keywords in Calcite, there's an alternative way to expose
> PaneInfo and BoundedWindow of Row by UDF.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)