sshkvar commented on a change in pull request #2757:
URL: https://github.com/apache/iceberg/pull/2757#discussion_r660704487



##########
File path: spark/src/main/java/org/apache/iceberg/spark/SparkUtil.java
##########
@@ -20,21 +20,38 @@
 package org.apache.iceberg.spark;
 
 import java.util.List;
+import java.util.Map;
 import java.util.function.BiFunction;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 import org.apache.iceberg.PartitionField;
 import org.apache.iceberg.PartitionSpec;
+import org.apache.iceberg.Schema;
 import org.apache.iceberg.Table;
 import org.apache.iceberg.hadoop.HadoopFileIO;
 import org.apache.iceberg.io.FileIO;
 import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
 import org.apache.iceberg.transforms.Transform;
 import org.apache.iceberg.transforms.UnknownTransform;
+import org.apache.iceberg.types.TypeUtil;
+import org.apache.iceberg.types.Types;
 import org.apache.iceberg.util.Pair;
+import org.apache.spark.sql.RuntimeConfig;
 import org.apache.spark.util.SerializableConfiguration;
 
 public class SparkUtil {
+
+  public static final String 
HANDLE_TIMESTAMP_WITHOUT_TIMEZONE_SESSION_PROPERTY =
+          "spark.sql.iceberg.convert-timestamp-without-timezone";
+  public static final String TIMESTAMP_WITHOUT_TIMEZONE_ERROR = 
String.format("Cannot handle timestamp without" +
+          " timezone fields in Spark. Spark does not natively support this 
type but if you would like to handle all" +
+          " timestamps as timestamp with timezone set '%s' to true. This will 
not change the underlying values stored" +
+          " but will change their displayed values in Spark. For more 
information please see" +
+          " 
https://docs.databricks.com/spark/latest/dataframes-datasets/dates-timestamps.html#ansi-sql-and";
 +
+          "-spark-sql-timestamps", 
HANDLE_TIMESTAMP_WITHOUT_TIMEZONE_SESSION_PROPERTY);
+  public static final String READ_TIMESTAMP_AS_TIMESTAMP_WITHOUT_TIMEZONE =

Review comment:
       we have 1 property which responsible for reading and writing 
`HANDLE_TIMESTAMP_WITHOUT_TIMEZONE_SESSION_PROPERTY `
   
   this property `READ_TIMESTAMP_AS_TIMESTAMP_WITHOUT_TIMEZONE` is responsible 
for converting spark `Timestamp` type to iceberg type. Depends on this property 
we will have `Types.TimestampType.withZone()` or 
`Types.TimestampType.withoutZone()`




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to