Tartarus0zm commented on code in PR #2086:
URL: https://github.com/apache/auron/pull/2086#discussion_r2936455152


##########
auron-flink-extension/auron-flink-runtime/src/main/java/org/apache/auron/flink/arrow/writers/TimeWriter.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * 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.auron.flink.arrow.writers;
+
+import org.apache.arrow.vector.BaseFixedWidthVector;
+import org.apache.arrow.vector.TimeMicroVector;
+import org.apache.arrow.vector.TimeMilliVector;
+import org.apache.arrow.vector.TimeNanoVector;
+import org.apache.arrow.vector.TimeSecVector;
+import org.apache.arrow.vector.ValueVector;
+import org.apache.flink.table.data.ArrayData;
+import org.apache.flink.table.data.RowData;
+
+/**
+ * {@link ArrowFieldWriter} for time values stored in Arrow time vectors.
+ *
+ * <p>Supports all four Arrow time precisions: {@link TimeSecVector}, {@link 
TimeMilliVector}, {@link
+ * TimeMicroVector}, and {@link TimeNanoVector}. Flink internally stores TIME 
values as milliseconds
+ * in an {@code int}; this writer converts to the target precision on write.
+ *
+ * <p>Use {@link #forRow(ValueVector)} when writing from {@link RowData} and 
{@link
+ * #forArray(ValueVector)} when writing from {@link ArrayData}.
+ *
+ * @param <T> the input data type
+ */
+public abstract class TimeWriter<T> extends ArrowFieldWriter<T> {
+
+    /** Creates a TimeWriter that reads from {@link RowData}. */
+    public static TimeWriter<RowData> forRow(ValueVector valueVector) {
+        return new TimeWriterForRow(valueVector);
+    }
+
+    /** Creates a TimeWriter that reads from {@link ArrayData}. */
+    public static TimeWriter<ArrayData> forArray(ValueVector valueVector) {
+        return new TimeWriterForArray(valueVector);
+    }
+
+    private TimeWriter(ValueVector valueVector) {
+        super(valueVector);

Review Comment:
   Why not check the type of `valuevector` here?



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to