You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/10/14 06:27:52 UTC
[GitHub] [iceberg] HeartSaVioR opened a new pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
HeartSaVioR opened a new pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611
I've found the type compatibility being asymmetric among the cases, and it required me to look into the code to find the conversions (TypeToSparkType, SparkTypeToType).
Given the conversions won't change frequently, it'd be nice to document the conversions so that end users don't feel surprised. This would be also helpful if end users consider using same Iceberg table across components - end users will have a clear view of the types when they create an Iceberg table from Spark, when they read an Iceberg table from Spark, when they write to the Iceberg table via Spark.
Probably it might be ideal to have such type compatibility matrixes for all supported components, so that end users can look into these matrixes and check type issues on interop.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] HeartSaVioR commented on a change in pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
HeartSaVioR commented on a change in pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611#discussion_r505998465
##########
File path: site/docs/spark.md
##########
@@ -728,3 +730,82 @@ spark.read.format("iceberg").load("db.table.files").show(truncate = false)
// Hadoop path table
spark.read.format("iceberg").load("hdfs://nn:8020/path/to/table#files").show(truncate = false)
```
+
+## Type compatibility
+
+Spark and Iceberg support different set of types. Iceberg does the type conversion automatically, but not for all combinations,
+so you may want to understand the type conversion in Iceberg in prior to design the types of columns in your tables.
+
+### Spark type to Iceberg type on creating table
+
+This type conversion table describes how Spark types are converted to the Iceberg types. The conversion applies on creating Iceberg table via Spark without using Iceberg core API.
+
+| Spark | Iceberg | Notes |
+|-----------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| short | integer | |
+| byte | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| timestamp | timestamp with timezone | |
+| string | string | |
+| char | string | |
+| varchar | string | |
+| binary | binary | |
Review comment:
OK thanks for the opinion. I consolidated tables on create and write. Actually I tried to consolidate all of three tables, but it seemed a bit confusing as directions on conversion are opposite. Please take a look again. Thanks!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] HeartSaVioR commented on a change in pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
HeartSaVioR commented on a change in pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611#discussion_r505133043
##########
File path: site/docs/spark.md
##########
@@ -728,3 +730,82 @@ spark.read.format("iceberg").load("db.table.files").show(truncate = false)
// Hadoop path table
spark.read.format("iceberg").load("hdfs://nn:8020/path/to/table#files").show(truncate = false)
```
+
+## Type compatibility
+
+Spark and Iceberg support different set of types. Iceberg does the type conversion automatically, but not for all combinations,
+so you may want to understand the type conversion in Iceberg in prior to design the types of columns in your tables.
+
+### Spark type to Iceberg type on creating table
+
+This type conversion table describes how Spark types are converted to the Iceberg types. The conversion applies on creating Iceberg table via Spark without using Iceberg core API.
+
+| Spark | Iceberg | Notes |
+|-----------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| short | integer | |
+| byte | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| timestamp | timestamp with timezone | |
+| string | string | |
+| char | string | |
+| varchar | string | |
+| binary | binary | |
Review comment:
Yeah I had to split read and write because of UUID, but if we don't mind about UUID then it'll be closely symmetric. I'll try to consolidate twos into one.
I still think we'd better having two different matrixes for create table and read/write (consolidated, Iceberg types to (->) Spark types), because in many cases the type to pivot on create table in Spark is Spark type (as these types are what end users need to type in), while the type to pivot on read/write table in any engines is Iceberg type. I thought the type to pivot on write to table is engine's column type but I changed my mind as the types of columns are Iceberg types hence end users need to think based on these types.
It might be arguable that end users need to think about the final type of the column (Iceberg type) when creating table, which might end up with pivoting Iceberg type on create table. I don't have a strong opinion, as it's also a valid opinion, but there might be also someone who wants to see the Iceberg table as Spark's world of view (restrict the usage to Spark only) and don't want to concern about Iceberg types.
Either of the direction would be fine for me. WDYT?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] HeartSaVioR commented on a change in pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
HeartSaVioR commented on a change in pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611#discussion_r505134224
##########
File path: site/docs/spark.md
##########
@@ -728,3 +730,82 @@ spark.read.format("iceberg").load("db.table.files").show(truncate = false)
// Hadoop path table
spark.read.format("iceberg").load("hdfs://nn:8020/path/to/table#files").show(truncate = false)
```
+
+## Type compatibility
+
+Spark and Iceberg support different set of types. Iceberg does the type conversion automatically, but not for all combinations,
+so you may want to understand the type conversion in Iceberg in prior to design the types of columns in your tables.
+
+### Spark type to Iceberg type on creating table
+
+This type conversion table describes how Spark types are converted to the Iceberg types. The conversion applies on creating Iceberg table via Spark without using Iceberg core API.
+
+| Spark | Iceberg | Notes |
+|-----------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| short | integer | |
+| byte | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| timestamp | timestamp with timezone | |
+| string | string | |
+| char | string | |
+| varchar | string | |
+| binary | binary | |
+| decimal | decimal | |
+| struct | struct | |
+| array | list | |
+| map | map | |
+
+The type conversion is asymmetric: this table doesn't represent the types of Iceberg Spark can "read" from, or "write" to.
+The following sections describe the feasibility on read/write for Iceberg type from Spark.
+
+### Iceberg to Spark on reading from Iceberg table
+
+| Iceberg | Spark | Note |
+|----------------------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| time | N/A | |
+| timestamp with timezone | timestamp | |
+| timestamp without timezone | N/A | |
Review comment:
Honestly I wasn't too concerned about timestamp (I tried my best to consider the type as epoch based on UTC) so no strong opinion here. If we'd like to also support this (probably adjusting to the TZ in Spark?) it might be also good to do vice versa, so that read and write are symmetric.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] HeartSaVioR commented on a change in pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
HeartSaVioR commented on a change in pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611#discussion_r505134224
##########
File path: site/docs/spark.md
##########
@@ -728,3 +730,82 @@ spark.read.format("iceberg").load("db.table.files").show(truncate = false)
// Hadoop path table
spark.read.format("iceberg").load("hdfs://nn:8020/path/to/table#files").show(truncate = false)
```
+
+## Type compatibility
+
+Spark and Iceberg support different set of types. Iceberg does the type conversion automatically, but not for all combinations,
+so you may want to understand the type conversion in Iceberg in prior to design the types of columns in your tables.
+
+### Spark type to Iceberg type on creating table
+
+This type conversion table describes how Spark types are converted to the Iceberg types. The conversion applies on creating Iceberg table via Spark without using Iceberg core API.
+
+| Spark | Iceberg | Notes |
+|-----------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| short | integer | |
+| byte | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| timestamp | timestamp with timezone | |
+| string | string | |
+| char | string | |
+| varchar | string | |
+| binary | binary | |
+| decimal | decimal | |
+| struct | struct | |
+| array | list | |
+| map | map | |
+
+The type conversion is asymmetric: this table doesn't represent the types of Iceberg Spark can "read" from, or "write" to.
+The following sections describe the feasibility on read/write for Iceberg type from Spark.
+
+### Iceberg to Spark on reading from Iceberg table
+
+| Iceberg | Spark | Note |
+|----------------------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| time | N/A | |
+| timestamp with timezone | timestamp | |
+| timestamp without timezone | N/A | |
Review comment:
Honestly I wasn't too concerned about timestamp (I tried my best to consider the type as epoch based on UTC) so no strong opinion here. If we'd like to also support this (probably adjusting to the TZ in Spark?) it might be also valid to do vice versa, so that read and write are symmetric.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue commented on a change in pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611#discussion_r504795180
##########
File path: site/docs/spark.md
##########
@@ -728,3 +730,82 @@ spark.read.format("iceberg").load("db.table.files").show(truncate = false)
// Hadoop path table
spark.read.format("iceberg").load("hdfs://nn:8020/path/to/table#files").show(truncate = false)
```
+
+## Type compatibility
+
+Spark and Iceberg support different set of types. Iceberg does the type conversion automatically, but not for all combinations,
+so you may want to understand the type conversion in Iceberg in prior to design the types of columns in your tables.
+
+### Spark type to Iceberg type on creating table
+
+This type conversion table describes how Spark types are converted to the Iceberg types. The conversion applies on creating Iceberg table via Spark without using Iceberg core API.
+
+| Spark | Iceberg | Notes |
+|-----------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| short | integer | |
+| byte | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| timestamp | timestamp with timezone | |
+| string | string | |
+| char | string | |
+| varchar | string | |
+| binary | binary | |
Review comment:
I see, you've created two separate tables. I think I would probably combine them with notes about create vs write instead of having two. That would be more confusing because readers would need to choose which one they need.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue commented on pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
rdblue commented on pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611#issuecomment-721354388
Thanks, @HeartSaVioR! I'm okay with adding two tables if you think it's going to be helpful. I merged this and it should go out when we push docs for 0.10.0. Thank you!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue commented on a change in pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611#discussion_r505957204
##########
File path: site/docs/spark.md
##########
@@ -728,3 +730,82 @@ spark.read.format("iceberg").load("db.table.files").show(truncate = false)
// Hadoop path table
spark.read.format("iceberg").load("hdfs://nn:8020/path/to/table#files").show(truncate = false)
```
+
+## Type compatibility
+
+Spark and Iceberg support different set of types. Iceberg does the type conversion automatically, but not for all combinations,
+so you may want to understand the type conversion in Iceberg in prior to design the types of columns in your tables.
+
+### Spark type to Iceberg type on creating table
+
+This type conversion table describes how Spark types are converted to the Iceberg types. The conversion applies on creating Iceberg table via Spark without using Iceberg core API.
+
+| Spark | Iceberg | Notes |
+|-----------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| short | integer | |
+| byte | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| timestamp | timestamp with timezone | |
+| string | string | |
+| char | string | |
+| varchar | string | |
+| binary | binary | |
Review comment:
I think that having multiple tables causes users to need to look carefully for what is different between them, and increases what they need to pay attention to ("which table do I need?"). I'd like to have as few of these as possible. So I'd remove UUID and add notes for any differences between create and write.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] findepi commented on a change in pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
findepi commented on a change in pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611#discussion_r678201399
##########
File path: site/docs/spark.md
##########
@@ -728,3 +730,82 @@ spark.read.format("iceberg").load("db.table.files").show(truncate = false)
// Hadoop path table
spark.read.format("iceberg").load("hdfs://nn:8020/path/to/table#files").show(truncate = false)
```
+
+## Type compatibility
+
+Spark and Iceberg support different set of types. Iceberg does the type conversion automatically, but not for all combinations,
+so you may want to understand the type conversion in Iceberg in prior to design the types of columns in your tables.
+
+### Spark type to Iceberg type on creating table
+
+This type conversion table describes how Spark types are converted to the Iceberg types. The conversion applies on creating Iceberg table via Spark without using Iceberg core API.
+
+| Spark | Iceberg | Notes |
+|-----------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| short | integer | |
+| byte | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| timestamp | timestamp with timezone | |
+| string | string | |
+| char | string | |
+| varchar | string | |
+| binary | binary | |
+| decimal | decimal | |
+| struct | struct | |
+| array | list | |
+| map | map | |
+
+The type conversion is asymmetric: this table doesn't represent the types of Iceberg Spark can "read" from, or "write" to.
+The following sections describe the feasibility on read/write for Iceberg type from Spark.
+
+### Iceberg to Spark on reading from Iceberg table
+
+| Iceberg | Spark | Note |
+|----------------------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| time | <N/A> | |
+| timestamp with timezone | timestamp | |
+| timestamp without timezone | <N/A> | |
+| string | string | |
+| uuid | string | |
Review comment:
Followed up at https://github.com/trinodb/trino/issues/6663 and on the mailing list.
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] HeartSaVioR commented on pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
HeartSaVioR commented on pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611#issuecomment-721365810
Thanks for understanding, and thanks again for reviewing and merging!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] HeartSaVioR commented on a change in pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
HeartSaVioR commented on a change in pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611#discussion_r505133043
##########
File path: site/docs/spark.md
##########
@@ -728,3 +730,82 @@ spark.read.format("iceberg").load("db.table.files").show(truncate = false)
// Hadoop path table
spark.read.format("iceberg").load("hdfs://nn:8020/path/to/table#files").show(truncate = false)
```
+
+## Type compatibility
+
+Spark and Iceberg support different set of types. Iceberg does the type conversion automatically, but not for all combinations,
+so you may want to understand the type conversion in Iceberg in prior to design the types of columns in your tables.
+
+### Spark type to Iceberg type on creating table
+
+This type conversion table describes how Spark types are converted to the Iceberg types. The conversion applies on creating Iceberg table via Spark without using Iceberg core API.
+
+| Spark | Iceberg | Notes |
+|-----------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| short | integer | |
+| byte | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| timestamp | timestamp with timezone | |
+| string | string | |
+| char | string | |
+| varchar | string | |
+| binary | binary | |
Review comment:
Yeah I had to split read and write because of UUID, but if we don't mind about UUID then it'll be closely symmetric. I'll try to consolidate twos into one.
I still think we'd better have two different matrixes for create table and read/write (consolidated, Iceberg types to (->) Spark types), because in many cases the type to pivot on create table in Spark is Spark type (as these types are what end users need to type in), while the type to pivot on read/write table in any engines is Iceberg type. I thought the type to pivot on write to table is engine's column type but I changed my mind as the types of columns are Iceberg types hence end users need to think based on these types.
It might be arguable that end users need to think about the final type of the column (Iceberg type) when creating table, which might end up with pivoting Iceberg type on create table. I don't have a strong opinion, as it's also a valid opinion, but there might be also someone who wants to see the Iceberg table as Spark's world of view (restrict the usage to Spark only) and don't want to concern about Iceberg types.
Either of the direction would be fine for me. WDYT?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue commented on a change in pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611#discussion_r511171662
##########
File path: site/docs/spark.md
##########
@@ -728,3 +730,62 @@ spark.read.format("iceberg").load("db.table.files").show(truncate = false)
// Hadoop path table
spark.read.format("iceberg").load("hdfs://nn:8020/path/to/table#files").show(truncate = false)
```
+
+## Type compatibility
+
+Spark and Iceberg support different set of types. Iceberg does the type conversion automatically, but not for all combinations,
+so you may want to understand the type conversion in Iceberg in prior to design the types of columns in your tables.
+
+### Spark type to Iceberg type
+
+This type conversion table describes how Spark types are converted to the Iceberg types. The conversion applies on both creating Iceberg table and writing to Iceberg table via Spark.
+
+| Spark | Iceberg | Notes |
+|-----------------|-------------------------|-------|
+| boolean | boolean | |
+| short | integer | |
+| byte | integer | |
+| integer | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| timestamp | timestamp with timezone | |
+| char | string | |
+| varchar | string | |
+| string | string | |
+| binary | binary | |
+| decimal | decimal | |
+| struct | struct | |
+| array | list | |
+| map | map | |
+
+!!! Note
+ The table is based on representing conversion during creating table. In fact, broader supports are applied on write. Here're some points on write:
+
+ * Iceberg numeric types (`integer`, `long`, `float`, `double`, `decimal`) support promotion during writes. e.g. You can write Spark types `short`, `byte`, `integer`, `long` to Iceberg type `long`.
+ * You can write to Iceberg `fixed` type using Spark `binary` type. Note that assertion on the length will be performed.
+
+### Iceberg type to Spark type
+
+This type conversion table describes how Iceberg types are converted to the Spark types. The conversion applies on reading from Iceberg table via Spark.
+
+| Iceberg | Spark | Note |
+|----------------------------|-------------------------|---------------|
+| boolean | boolean | |
+| integer | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| time | | Not supported |
+| timestamp with timezone | timestamp | |
+| timestamp without timezone | | Not supported |
Review comment:
I think this could be merged with the table above by adding lines for time, timestamp without time zone, and fixed. What do you think about that? It would be a lot less documentation and the "notes" column above would be used. Right now, it's blank.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue merged pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
rdblue merged pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue commented on a change in pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611#discussion_r504793940
##########
File path: site/docs/spark.md
##########
@@ -728,3 +730,82 @@ spark.read.format("iceberg").load("db.table.files").show(truncate = false)
// Hadoop path table
spark.read.format("iceberg").load("hdfs://nn:8020/path/to/table#files").show(truncate = false)
```
+
+## Type compatibility
+
+Spark and Iceberg support different set of types. Iceberg does the type conversion automatically, but not for all combinations,
+so you may want to understand the type conversion in Iceberg in prior to design the types of columns in your tables.
+
+### Spark type to Iceberg type on creating table
+
+This type conversion table describes how Spark types are converted to the Iceberg types. The conversion applies on creating Iceberg table via Spark without using Iceberg core API.
+
+| Spark | Iceberg | Notes |
+|-----------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| short | integer | |
+| byte | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| timestamp | timestamp with timezone | |
+| string | string | |
+| char | string | |
+| varchar | string | |
+| binary | binary | |
+| decimal | decimal | |
+| struct | struct | |
+| array | list | |
+| map | map | |
+
+The type conversion is asymmetric: this table doesn't represent the types of Iceberg Spark can "read" from, or "write" to.
+The following sections describe the feasibility on read/write for Iceberg type from Spark.
+
+### Iceberg to Spark on reading from Iceberg table
+
+| Iceberg | Spark | Note |
+|----------------------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| time | N/A | |
+| timestamp with timezone | timestamp | |
+| timestamp without timezone | N/A | |
Review comment:
Should we convert timestamp without zone to timestamp in Spark when reading?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] HeartSaVioR commented on a change in pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
HeartSaVioR commented on a change in pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611#discussion_r512456035
##########
File path: site/docs/spark.md
##########
@@ -728,3 +730,62 @@ spark.read.format("iceberg").load("db.table.files").show(truncate = false)
// Hadoop path table
spark.read.format("iceberg").load("hdfs://nn:8020/path/to/table#files").show(truncate = false)
```
+
+## Type compatibility
+
+Spark and Iceberg support different set of types. Iceberg does the type conversion automatically, but not for all combinations,
+so you may want to understand the type conversion in Iceberg in prior to design the types of columns in your tables.
+
+### Spark type to Iceberg type
+
+This type conversion table describes how Spark types are converted to the Iceberg types. The conversion applies on both creating Iceberg table and writing to Iceberg table via Spark.
+
+| Spark | Iceberg | Notes |
+|-----------------|-------------------------|-------|
+| boolean | boolean | |
+| short | integer | |
+| byte | integer | |
+| integer | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| timestamp | timestamp with timezone | |
+| char | string | |
+| varchar | string | |
+| string | string | |
+| binary | binary | |
+| decimal | decimal | |
+| struct | struct | |
+| array | list | |
+| map | map | |
+
+!!! Note
+ The table is based on representing conversion during creating table. In fact, broader supports are applied on write. Here're some points on write:
+
+ * Iceberg numeric types (`integer`, `long`, `float`, `double`, `decimal`) support promotion during writes. e.g. You can write Spark types `short`, `byte`, `integer`, `long` to Iceberg type `long`.
+ * You can write to Iceberg `fixed` type using Spark `binary` type. Note that assertion on the length will be performed.
+
+### Iceberg type to Spark type
+
+This type conversion table describes how Iceberg types are converted to the Spark types. The conversion applies on reading from Iceberg table via Spark.
+
+| Iceberg | Spark | Note |
+|----------------------------|-------------------------|---------------|
+| boolean | boolean | |
+| integer | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| time | | Not supported |
+| timestamp with timezone | timestamp | |
+| timestamp without timezone | | Not supported |
Review comment:
Personally I feel more confusing if I have to look into table via `->` direction in some cases and `<-` direction in some other cases, with considering notes to determine asymmetric behavior.
e.g. If we consider conversion from Spark to Iceberg, multiple Spark types are converted with one Iceberg type, but for sure it's not true for opposite direction. That said, we need to leave special mark representing the opposite case, which Spark type is the result of conversion for one Iceberg type.
The more we consolidate, the less intuitive the table would be. The read case doesn't require any explanation on the table, and once we consolidate this into create/write, explanations for create/write would make confusions even on read case.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue commented on a change in pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611#discussion_r504794196
##########
File path: site/docs/spark.md
##########
@@ -728,3 +730,82 @@ spark.read.format("iceberg").load("db.table.files").show(truncate = false)
// Hadoop path table
spark.read.format("iceberg").load("hdfs://nn:8020/path/to/table#files").show(truncate = false)
```
+
+## Type compatibility
+
+Spark and Iceberg support different set of types. Iceberg does the type conversion automatically, but not for all combinations,
+so you may want to understand the type conversion in Iceberg in prior to design the types of columns in your tables.
+
+### Spark type to Iceberg type on creating table
+
+This type conversion table describes how Spark types are converted to the Iceberg types. The conversion applies on creating Iceberg table via Spark without using Iceberg core API.
+
+| Spark | Iceberg | Notes |
+|-----------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| short | integer | |
+| byte | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| timestamp | timestamp with timezone | |
+| string | string | |
+| char | string | |
+| varchar | string | |
+| binary | binary | |
+| decimal | decimal | |
+| struct | struct | |
+| array | list | |
+| map | map | |
+
+The type conversion is asymmetric: this table doesn't represent the types of Iceberg Spark can "read" from, or "write" to.
+The following sections describe the feasibility on read/write for Iceberg type from Spark.
+
+### Iceberg to Spark on reading from Iceberg table
+
+| Iceberg | Spark | Note |
+|----------------------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| time | <N/A> | |
+| timestamp with timezone | timestamp | |
+| timestamp without timezone | <N/A> | |
+| string | string | |
+| uuid | string | |
Review comment:
We should ignore UUID for now. No engines support it and we are considering whether we should remove it from the spec.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rdblue commented on a change in pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
rdblue commented on a change in pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611#discussion_r504793706
##########
File path: site/docs/spark.md
##########
@@ -728,3 +730,82 @@ spark.read.format("iceberg").load("db.table.files").show(truncate = false)
// Hadoop path table
spark.read.format("iceberg").load("hdfs://nn:8020/path/to/table#files").show(truncate = false)
```
+
+## Type compatibility
+
+Spark and Iceberg support different set of types. Iceberg does the type conversion automatically, but not for all combinations,
+so you may want to understand the type conversion in Iceberg in prior to design the types of columns in your tables.
+
+### Spark type to Iceberg type on creating table
+
+This type conversion table describes how Spark types are converted to the Iceberg types. The conversion applies on creating Iceberg table via Spark without using Iceberg core API.
+
+| Spark | Iceberg | Notes |
+|-----------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| short | integer | |
+| byte | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| timestamp | timestamp with timezone | |
+| string | string | |
+| char | string | |
+| varchar | string | |
+| binary | binary | |
Review comment:
Binary can be written to a fixed column. It will be validated at write time.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] HeartSaVioR commented on a change in pull request #1611: DOCS: describe type compatibility between Spark and Iceberg
Posted by GitBox <gi...@apache.org>.
HeartSaVioR commented on a change in pull request #1611:
URL: https://github.com/apache/iceberg/pull/1611#discussion_r504432849
##########
File path: site/docs/spark.md
##########
@@ -728,3 +730,82 @@ spark.read.format("iceberg").load("db.table.files").show(truncate = false)
// Hadoop path table
spark.read.format("iceberg").load("hdfs://nn:8020/path/to/table#files").show(truncate = false)
```
+
+## Type compatibility
+
+Spark and Iceberg support different set of types. Iceberg does the type conversion automatically, but not for all combinations,
+so you may want to understand the type conversion in Iceberg in prior to design the types of columns in your tables.
+
+### Spark type to Iceberg type on creating table
+
+This type conversion table describes how Spark types are converted to the Iceberg types. The conversion applies on creating Iceberg table via Spark without using Iceberg core API.
+
+| Spark | Iceberg | Notes |
+|-----------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| short | integer | |
+| byte | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| timestamp | timestamp with timezone | |
+| string | string | |
+| char | string | |
+| varchar | string | |
+| binary | binary | |
+| decimal | decimal | |
+| struct | struct | |
+| array | list | |
+| map | map | |
+
+The type conversion is asymmetric: this table doesn't represent the types of Iceberg Spark can "read" from, or "write" to.
+The following sections describe the feasibility on read/write for Iceberg type from Spark.
+
+### Iceberg to Spark on reading from Iceberg table
+
+| Iceberg | Spark | Note |
+|----------------------------|-------------------------|-------|
+| boolean | boolean | |
+| integer | integer | |
+| long | long | |
+| float | float | |
+| double | double | |
+| date | date | |
+| time | <N/A> | |
+| timestamp with timezone | timestamp | |
+| timestamp without timezone | <N/A> | |
+| string | string | |
+| uuid | string | |
Review comment:
While I simply put uuid -> string based on the implementation of TypeToSparkType, I failed to verify this as it looks to be really tricky to write UUID column.
It doesn't look possible to write UUID column from Spark. Even adding UUID type to SUPPORTED_PRIMITIVES in DataTest leads multiple tests failing.
Is there any known way to write UUID column, or it'd be better to simply remove uuid 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org