the-other-tim-brown commented on code in PR #995:
URL: https://github.com/apache/incubator-xtable/pull/995#discussion_r4674122629
##########
website/docs/how-to-index.md:
##########
@@ -36,35 +36,58 @@ datasets:
xtable.hudi.target.secondary.index.column: c_email_address
```
+Run the sync with the jar that fits the deployment:
+
+- The utilities jar runs `RunSync` as a standalone Java process, for example a
scheduled job or a
+ service outside Spark. It builds the index in a local Spark session on one
machine.
+- The Spark runtime jar runs `XTableSparkSync` on an existing Spark cluster,
so the index build is
+ distributed across the executors.
+
+```shell md title="shell"
+# utilities jar, built from source, which starts a local Spark session for the
+# index build. It bundles Spark 3.4, so add the Hudi Spark 3.4 bundle for the
+# Spark engine.
+java -cp
xtable-utilities/target/xtable-utilities_2.12-<version>-bundled.jar:hudi-spark3.4-bundle_2.12-1.2.1.jar
\
+ org.apache.xtable.utilities.RunSync \
+ --datasetConfig index_config.yaml
+
+# Spark runtime jar, on a Spark cluster
+$SPARK_HOME/bin/spark-submit \
+ --class org.apache.xtable.spark.XTableSparkSync \
+ --conf spark.serializer=org.apache.spark.serializer.KryoSerializer \
+ xtable-spark-runtime_2.12-0.5.0-incubating.jar \
+ --datasetconfig index_config.yaml
Review Comment:
is it `--datasetConfig`?
##########
website/docs/how-to-iceberg-table-format.md:
##########
@@ -0,0 +1,128 @@
+---
+sidebar_position: 5
+title: "Write Hudi tables as Iceberg tables"
+---
+
+# Write Hudi tables as Iceberg tables
+
+Apache Hudi 1.1 added pluggable table formats
([RFC-93](https://github.com/apache/hudi/blob/master/rfc/rfc-93/rfc-93.md)):
+a Hudi writer can keep the metadata of another table format next to its own,
in the same commit.
+Apache XTableâ„¢ (Incubating) provides the Apache Iceberg implementation in the
+`xtable-iceberg-pluggable-tf` module. With it, every Hudi write, clean,
rollback and savepoint
+also commits an Iceberg snapshot under the table base path, so the table reads
as a standard
+Iceberg table right after the write, without a separate sync job. When Hudi
archives instants,
+the module expires the Iceberg snapshots of those instants.
+
+The Iceberg metadata is the source of truth for the table. A Hudi commit is
visible only after its
+Iceberg snapshot is committed: a Hudi commit without an Iceberg snapshot is
treated as pending and
+is rolled back by the next write, and a failed Iceberg commit fails the Hudi
operation.
+
+## Setting up Spark
+
+The Iceberg table format requires Apache Hudi 1.2.x. In addition to the Hudi
Spark bundle, the
+Spark job needs the `xtable-iceberg-pluggable-tf` jar, its XTable dependencies
(`xtable-core`,
+`xtable-api` and `xtable-hudi-support-utils`) and the Iceberg Spark runtime.
The XTable jars are
+available on Maven Central from 0.5.0:
+
+```shell md title="shell"
+REPO=https://repo1.maven.org/maven2/org/apache/xtable
+VERSION=0.5.0-incubating
+curl -O
$REPO/xtable-iceberg-pluggable-tf_2.12/$VERSION/xtable-iceberg-pluggable-tf_2.12-$VERSION.jar
+curl -O $REPO/xtable-core_2.12/$VERSION/xtable-core_2.12-$VERSION.jar
+curl -O $REPO/xtable-api/$VERSION/xtable-api-$VERSION.jar
+curl -O
$REPO/xtable-hudi-support-utils/$VERSION/xtable-hudi-support-utils-$VERSION.jar
+```
+
+The XTable jars do not bundle Iceberg, so the Iceberg Spark runtime is
required. The Hudi writer
+uses it to commit each snapshot, and the same Spark session can read the table
as Iceberg. The
+example below is for Spark 3.5; use the Hudi and Iceberg bundles that match
the Spark version.
+
+```shell md title="shell"
+XTABLE_JARS=xtable-iceberg-pluggable-tf_2.12-$VERSION.jar,\
+xtable-core_2.12-$VERSION.jar,\
+xtable-api-$VERSION.jar,\
+xtable-hudi-support-utils-$VERSION.jar
+
+spark-shell \
+ --jars
$XTABLE_JARS,hudi-spark3.5-bundle_2.12-1.2.1.jar,iceberg-spark-runtime-3.5_2.12-1.9.2.jar
\
+ --conf spark.serializer=org.apache.spark.serializer.KryoSerializer \
+ --conf
spark.sql.extensions=org.apache.spark.sql.hudi.HoodieSparkSessionExtension \
+ --conf spark.kryo.registrator=org.apache.spark.HoodieSparkKryoRegistrar
+```
+
+`spark-submit` takes the same `--jars` and `--conf` options.
+
+:::caution Every writer needs the jars
+Hudi loads the table format through the Java `ServiceLoader`. When the
+`xtable-iceberg-pluggable-tf` jar is not on the classpath, Hudi does not fail:
it falls back to its
+native format, even when `hoodie.table.format` is `ICEBERG`. The commits of
that writer have no
+Iceberg snapshot, so the next writer that has the jars rolls them back. Add
the jars to every job
+that writes the table, including table services such as clean and clustering
that run in separate
+jobs.
+:::
+
+## Creating a table
+
+Set `hoodie.table.format=ICEBERG` on the first write. Hudi stores the format in
+`hoodie.properties`, so later writes do not repeat it. The Hudi metadata table
must stay off on
+every write (see [Limitations](#limitations)).
+
+```scala md title="scala"
+val basePath = "s3://example-warehouse/db/trips"
+
+df.write.format("hudi")
+ .option("hoodie.table.name", "trips")
+ .option("hoodie.datasource.write.recordkey.field", "id")
+ .option("hoodie.datasource.write.precombine.field", "ts")
Review Comment:
I think we use `hoodie.table.ordering.fields` now in Hudi?
--
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]