lidavidm commented on code in PR #61:
URL: https://github.com/apache/iceberg-cpp/pull/61#discussion_r2034342585


##########
src/iceberg/transform/transform_spec.h:
##########
@@ -0,0 +1,117 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+/// \file iceberg/transform/transform_spec.h
+
+#include <memory>
+#include <optional>
+
+#include "iceberg/arrow_c_data.h"
+#include "iceberg/type_fwd.h"
+
+namespace iceberg {
+/// \brief A specification for creating a TransformFunction instance.
+///
+/// This struct encapsulates all necessary information to describe a transform,
+/// including the type of the transform and any optional parameters it may 
require.
+/// It is used by the TransformFactory to instantiate the corresponding 
transform
+/// implementation.
+///
+/// For example:
+/// - A Bucket transform with 10 buckets: TransformType::kBucket, params = [10]
+/// - An Identity transform: TransformType::kIdentity, no parameters
+struct TransformSpec {
+  /// \brief The type of the transform (e.g., kBucket, kTruncate, kIdentity, 
etc.)
+  TransformType transform_type;
+
+  /// \brief Optional parameter values passed to the transform, represented as 
an
+  /// ArrowArray.
+  ///
+  /// For transforms that require parameters (e.g., Bucket(N)), this holds the 
arguments
+  /// as a primitive ArrowArray (e.g., INT32 for num_buckets or width).
+  /// If the transform does not require parameters, this will be std::nullopt.
+  std::optional<ArrowArray> params_opt;

Review Comment:
   Right, which is why I said 
   
   > you could split up the transform's type (aka the operation + 
parameters)[...]from the fully instantiated transform
   
   You could even still have something like TransformSpec, I'm just arguing 
that it might make more sense to directly instantiate a transform-like object 
(with parameters, without types), just like how a Field separates the 
(parameterized) Type out.



-- 
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...@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to