wwj6591812 commented on code in PR #4459:
URL: https://github.com/apache/paimon/pull/4459#discussion_r1830253722


##########
paimon-common/src/main/java/org/apache/paimon/fs/FileStatus.java:
##########
@@ -56,4 +58,24 @@ public interface FileStatus {
      *     milliseconds since the epoch (UTC January 1, 1970).
      */
     long getModificationTime();
+
+    /**
+     * Get the last access time of the file.
+     *
+     * @return A long value representing the time the file was last accessed, 
measured in
+     *     milliseconds since the epoch (UTC January 1, 1970).
+     */
+    default long getAccessTime() {

Review Comment:
   I think getLatestAccessTime may better?



##########
paimon-core/src/main/java/org/apache/paimon/table/FileStoreTableFactory.java:
##########
@@ -124,6 +126,15 @@ public static FileStoreTable createWithoutFallbackBranch(
                                 fileIO, tablePath, tableSchema, 
catalogEnvironment)
                         : new PrimaryKeyFileStoreTable(
                                 fileIO, tablePath, tableSchema, 
catalogEnvironment);
-        return table.copy(dynamicOptions.toMap());
+        table = table.copy(dynamicOptions.toMap());
+        CoreOptions options = table.coreOptions();
+        if (options.type() == TableType.OBJECT_TABLE) {
+            table =
+                    ObjectTable.builder()
+                            .underlyingTable(table)
+                            .objectLocation(options.objectLocation())

Review Comment:
   Check options.objectLocation() is null?



##########
paimon-flink/paimon-flink-common/src/main/java/org/apache/paimon/flink/procedure/RefreshObjectTableProcedure.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.paimon.flink.procedure;
+
+import org.apache.paimon.catalog.Catalog;
+import org.apache.paimon.table.object.ObjectTable;
+
+import org.apache.flink.table.annotation.ArgumentHint;
+import org.apache.flink.table.annotation.DataTypeHint;
+import org.apache.flink.table.annotation.ProcedureHint;
+import org.apache.flink.table.procedure.ProcedureContext;
+import org.apache.flink.types.Row;
+
+/**
+ * Refresh Object Table procedure. Usage:
+ *
+ * <pre><code>
+ *  CALL sys.refresh_object_table('tableId')
+ * </code></pre>
+ */
+public class RefreshObjectTableProcedure extends ProcedureBase {

Review Comment:
   Add this to doc?



##########
paimon-core/src/main/java/org/apache/paimon/table/object/ObjectTable.java:
##########
@@ -0,0 +1,186 @@
+/*
+ * 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.paimon.table.object;
+
+import org.apache.paimon.manifest.ManifestCacheFilter;
+import org.apache.paimon.schema.TableSchema;
+import org.apache.paimon.table.DelegatedFileStoreTable;
+import org.apache.paimon.table.FileStoreTable;
+import org.apache.paimon.table.sink.BatchWriteBuilder;
+import org.apache.paimon.table.sink.StreamWriteBuilder;
+import org.apache.paimon.table.sink.TableCommitImpl;
+import org.apache.paimon.table.sink.TableWriteImpl;
+import org.apache.paimon.types.DataTypes;
+import org.apache.paimon.types.RowType;
+
+import java.util.HashSet;
+import java.util.Map;
+
+import static org.apache.paimon.utils.Preconditions.checkArgument;
+
+/**
+ * A object table refers to a directory that contains multiple objects 
(files), Object table
+ * provides metadata indexes for unstructured data objects in this directory. 
Allowing users to
+ * analyze unstructured data in Object Storage.
+ *
+ * <p>Object Table stores the metadata of objects in the underlying table.
+ */
+public interface ObjectTable extends FileStoreTable {
+
+    RowType SCHEMA =
+            RowType.builder()
+                    .field("path", DataTypes.STRING().notNull())
+                    .field("name", DataTypes.STRING().notNull())
+                    .field("length", DataTypes.BIGINT().notNull())
+                    .field("mtime", DataTypes.TIMESTAMP_LTZ_MILLIS())
+                    .field("atime", DataTypes.TIMESTAMP_LTZ_MILLIS())
+                    .field("owner", DataTypes.STRING().nullable())
+                    .field("generation", DataTypes.INT().nullable())
+                    .field("content_type", DataTypes.STRING().nullable())
+                    .field("storage_class", DataTypes.STRING().nullable())
+                    .field("md5_hash", DataTypes.STRING().nullable())
+                    .field("metadata_mtime", 
DataTypes.TIMESTAMP_LTZ_MILLIS().nullable())
+                    .field("metadata", DataTypes.MAP(DataTypes.STRING(), 
DataTypes.STRING()))
+                    .build()
+                    .notNull();
+
+    /** Object location in file system. */
+    String objectLocation();
+
+    /** Underlying table to store metadata. */
+    FileStoreTable underlyingTable();
+
+    long refresh();
+
+    @Override
+    ObjectTable copy(Map<String, String> dynamicOptions);
+
+    /** Create a new builder for {@link ObjectTable}. */
+    static ObjectTable.Builder builder() {
+        return new ObjectTable.Builder();
+    }
+
+    /** Builder for {@link ObjectTable}. */
+    class Builder {
+
+        private FileStoreTable underlyingTable;
+        private String objectLocation;
+
+        public ObjectTable.Builder underlyingTable(FileStoreTable 
underlyingTable) {
+            this.underlyingTable = underlyingTable;
+            checkArgument(
+                    new HashSet<>(SCHEMA.getFields())
+                            
.containsAll(underlyingTable.rowType().getFields()),
+                    "Schema of Object Table should be %s, but is %s.",
+                    SCHEMA,
+                    underlyingTable.rowType());
+            return this;
+        }
+
+        public ObjectTable.Builder objectLocation(String objectLocation) {
+            this.objectLocation = objectLocation;
+            return this;
+        }
+
+        public ObjectTable build() {
+            return new ObjectTableImpl(underlyingTable, objectLocation);
+        }
+    }
+
+    /** An implementation for {@link ObjectTable}. */
+    class ObjectTableImpl extends DelegatedFileStoreTable implements 
ObjectTable {
+
+        private final String objectLocation;
+
+        public ObjectTableImpl(FileStoreTable underlyingTable, String 
objectLocation) {
+            super(underlyingTable);
+            this.objectLocation = objectLocation;
+        }
+
+        @Override
+        public BatchWriteBuilder newBatchWriteBuilder() {
+            throw new UnsupportedOperationException("Object table does not 
support Write.");
+        }
+
+        @Override
+        public StreamWriteBuilder newStreamWriteBuilder() {
+            throw new UnsupportedOperationException("Object table does not 
support Write.");
+        }
+
+        @Override
+        public TableWriteImpl<?> newWrite(String commitUser) {
+            throw new UnsupportedOperationException("Object table does not 
support Write.");
+        }
+
+        @Override
+        public TableWriteImpl<?> newWrite(String commitUser, 
ManifestCacheFilter manifestFilter) {
+            throw new UnsupportedOperationException("Object table does not 
support Write.");
+        }
+
+        @Override
+        public TableCommitImpl newCommit(String commitUser) {
+            throw new UnsupportedOperationException("Object table does not 
support Write.");

Review Comment:
   Object table does not support Commit.



-- 
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: issues-unsubscr...@paimon.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to