diff --git a/pom.xml b/pom.xml
index 565f2f7..fe2af36 100644
--- a/pom.xml
+++ b/pom.xml
@@ -317,7 +317,7 @@
true
lib
- <_exportcontents>io.cdap.delta.bigquery.*
+ <_exportcontents>io.cdap.delta.bigquery.*,io.cdap.delta.transformation.*
diff --git a/src/main/java/io/cdap/delta/transformation/MockColumnInfo.java b/src/main/java/io/cdap/delta/transformation/MockColumnInfo.java
new file mode 100644
index 0000000..011b2b8
--- /dev/null
+++ b/src/main/java/io/cdap/delta/transformation/MockColumnInfo.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2021 Cask Data, Inc.
+ *
+ * Licensed 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 io.cdap.delta.transformation;
+
+import io.cdap.transformation.api.ColumnInfo;
+
+/**
+ * Mock Column Info
+ */
+public class MockColumnInfo implements ColumnInfo {
+ private String name;
+
+ public MockColumnInfo(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+}
diff --git a/src/main/java/io/cdap/delta/transformation/MockColumnSchema.java b/src/main/java/io/cdap/delta/transformation/MockColumnSchema.java
new file mode 100644
index 0000000..6b2dd5d
--- /dev/null
+++ b/src/main/java/io/cdap/delta/transformation/MockColumnSchema.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright © 2021 Cask Data, Inc.
+ *
+ * Licensed 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 io.cdap.delta.transformation;
+
+import io.cdap.cdap.api.data.schema.Schema;
+import io.cdap.transformation.api.ColumnSchema;
+
+/**
+ * Mock Column Schema
+ */
+public class MockColumnSchema implements ColumnSchema {
+ private Schema.Field field;
+
+ public MockColumnSchema(Schema.Field field) {
+ this.field = field;
+ }
+
+ @Override
+ public Schema.Field getField() {
+ return field;
+ }
+}
diff --git a/src/main/java/io/cdap/delta/transformation/MockColumnValue.java b/src/main/java/io/cdap/delta/transformation/MockColumnValue.java
new file mode 100644
index 0000000..d909e3d
--- /dev/null
+++ b/src/main/java/io/cdap/delta/transformation/MockColumnValue.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2021 Cask Data, Inc.
+ *
+ * Licensed 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 io.cdap.delta.transformation;
+
+import io.cdap.transformation.api.ColumnValue;
+
+/**
+ * Mock Column Value
+ */
+public class MockColumnValue implements ColumnValue {
+ private Object value;
+
+ public MockColumnValue(Object value) {
+ this.value = value;
+ }
+
+ @Override
+ public Object getValue() {
+ return value;
+ }
+}
diff --git a/src/main/java/io/cdap/delta/transformation/MockRenameTransformation.java b/src/main/java/io/cdap/delta/transformation/MockRenameTransformation.java
new file mode 100644
index 0000000..a9dab7a
--- /dev/null
+++ b/src/main/java/io/cdap/delta/transformation/MockRenameTransformation.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright © 2021 Cask Data, Inc.
+ *
+ * Licensed 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 io.cdap.delta.transformation;
+
+import io.cdap.cdap.api.annotation.Name;
+import io.cdap.cdap.api.annotation.Plugin;
+import io.cdap.cdap.api.data.schema.Schema;
+import io.cdap.transformation.api.ColumnInfo;
+import io.cdap.transformation.api.ColumnSchema;
+import io.cdap.transformation.api.ColumnValue;
+import io.cdap.transformation.api.Transformation;
+import io.cdap.transformation.api.TransformationContext;
+import io.cdap.transformation.api.TransformationDefinitionContext;
+import io.cdap.transformation.api.TransformationSpec;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Mock rename transformation
+ */
+@Plugin(type = Transformation.PLUGIN_TYPE)
+@Name("rename")
+public class MockRenameTransformation implements Transformation {
+ private final MockRenameTransformationConfig config;
+ private String directive;
+ private String srcColumn;
+ private String tgtColumn;
+
+ public MockRenameTransformation(MockRenameTransformationConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ public void initialize(TransformationContext context) throws Exception {
+ }
+
+ private void parseDirective() {
+ String[] splits = directive.split(" ");
+ srcColumn = splits[1];
+ tgtColumn = splits[2];
+ }
+
+ @Override
+ public TransformationSpec define(TransformationDefinitionContext context) {
+ this.directive = context.getDirective();
+ parseDirective();
+ return getSecification();
+ }
+
+ @Override
+ public TransformationSpec getSecification() {
+ return new TransformationSpec() {
+ @Override
+ public List getInputColumns() {
+ return Arrays.asList(new MockColumnInfo(srcColumn));
+ }
+
+ @Override
+ public List getOutputColumns() {
+ return Arrays.asList(new MockColumnInfo(srcColumn));
+ }
+ };
+ }
+
+ @Override
+ public Map transformValue(Map input) throws Exception {
+ Object value = input.remove(srcColumn);
+ input.put(tgtColumn, new MockColumnValue(value));
+ return input;
+ }
+
+ @Override
+ public List transformSchema(Map input) throws Exception {
+
+
+ ColumnSchema schema = input.get(srcColumn);
+ return Arrays.asList(new MockColumnSchema(Schema.Field.of(tgtColumn, schema.getField().getSchema())));
+ }
+
+ @Override
+ public String getDirective() {
+ return directive;
+ }
+}
diff --git a/src/main/java/io/cdap/delta/transformation/MockRenameTransformationConfig.java b/src/main/java/io/cdap/delta/transformation/MockRenameTransformationConfig.java
new file mode 100644
index 0000000..8e31592
--- /dev/null
+++ b/src/main/java/io/cdap/delta/transformation/MockRenameTransformationConfig.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright © 2021 Cask Data, Inc.
+ *
+ * Licensed 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 io.cdap.delta.transformation;
+
+import io.cdap.cdap.api.plugin.PluginConfig;
+
+/**
+ * Config for Mock transformation
+ */
+public class MockRenameTransformationConfig extends PluginConfig {
+}