You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "xiangyuf (via GitHub)" <gi...@apache.org> on 2024/10/28 12:04:25 UTC

[PR] [spark] Support table options filter via SQL conf for Spark Engine [paimon]

xiangyuf opened a new pull request, #4393:
URL: https://github.com/apache/paimon/pull/4393

   ### Purpose
   
   <!-- Linking this pull request to the issue -->
   Linked issue: close #4371 
   
   <!-- What is the purpose of the change -->
   
   In some cases, users may want to use spark time travel by setting properties like set `spark.paimon.scan.tag-name=tag_3`. However, this property will take effect globally if the spark job read multiple tables at the same time.
   
   It would be better if we can support table options filter via sql conf for Spark Engine. So user can specify different time travel options for different table, like this:
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   
   - PaimonOptionsTest.scala
   
   ### API and Format
   
   ### Documentation
   


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

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


Re: [PR] [spark] Support table options via SQL conf for Spark Engine [paimon]

Posted by "Aitozi (via GitHub)" <gi...@apache.org>.
Aitozi commented on PR #4393:
URL: https://github.com/apache/paimon/pull/4393#issuecomment-2453017590

   > @Aitozi I’ve updated the dynamic global options format for Flink as `{config_key}` instead of `paimon.{config_key}`
   
   Get it, LGTM


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

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


Re: [PR] [spark] Support table options filter via SQL conf for Spark Engine [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on PR #4393:
URL: https://github.com/apache/paimon/pull/4393#issuecomment-2443066925

   > Do we need to support the table with same name in different db/catalog? Just like flink's global option do. #2104
   
   I think we should find an unified way to unify Flink and Spark.


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

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


Re: [PR] [spark] Support table options via SQL conf for Spark Engine [paimon]

Posted by "xiangyuf (via GitHub)" <gi...@apache.org>.
xiangyuf commented on PR #4393:
URL: https://github.com/apache/paimon/pull/4393#issuecomment-2454265390

   > > @JingsongLi @Aitozi Hi, I've unified flink and spark to support both dynamic table options and global options: Global options format: Flink:`{config_key}` Spark: `spark.paimon.{config_key}`.
   > > Table options format: Flink:`paimon.${catalogName}.${dbName}.${tableName}.${config_key}` Spark: `spark.paimon.${dbName}.${tableName}.{config_key}`
   > > Dynamic table options will override global options if there are conflicts.
   > > WDYT?
   > 
   > Why flink contains ${catalogName}, but spark not
   
   @Zouxxyy Updated Spark table option format as:
   `spark.paimon.${catalogName}.${dbName}.${tableName}.${config_key}`


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

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


Re: [PR] [spark] Support table options via SQL conf for Spark Engine [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #4393:
URL: https://github.com/apache/paimon/pull/4393


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

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


Re: [PR] [spark] Support table options via SQL conf for Spark Engine [paimon]

Posted by "xiangyuf (via GitHub)" <gi...@apache.org>.
xiangyuf commented on PR #4393:
URL: https://github.com/apache/paimon/pull/4393#issuecomment-2451219113

   @JingsongLi @Aitozi 
   Hi, I've unified flink and spark to support both dynamic table options and global options: 
   Global options format: 
   Flink:`paimon.{config_key}`
   Spark: `spark.paimon.{config_key}`. 
   
   Table options format:
   Flink:`paimon.${catalogName}.${dbName}.${tableName}.${config_key}`. 
   Spark: `spark.paimon.${dbName}.${tableName}.{config_key}`. 
   
   Dynamic table options will override global options if there are conflicts.
   
   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.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [spark] Support table options filter via SQL conf for Spark Engine [paimon]

Posted by "Aitozi (via GitHub)" <gi...@apache.org>.
Aitozi commented on PR #4393:
URL: https://github.com/apache/paimon/pull/4393#issuecomment-2441768148

   Do we need to support the table with same name in different db/catalog? Just like flink's global option do. https://github.com/apache/paimon/pull/2104


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

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


Re: [PR] [spark] Support table options via SQL conf for Spark Engine [paimon]

Posted by "xiangyuf (via GitHub)" <gi...@apache.org>.
xiangyuf commented on PR #4393:
URL: https://github.com/apache/paimon/pull/4393#issuecomment-2452999970

   @Aitozi I’ve updated the dynamic global options format  for Flink as `{config_key}` instead of `paimon.{config_key}`
   


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

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


Re: [PR] [spark] Support table options via SQL conf for Spark Engine [paimon]

Posted by "Aitozi (via GitHub)" <gi...@apache.org>.
Aitozi commented on code in PR #4393:
URL: https://github.com/apache/paimon/pull/4393#discussion_r1826525483


##########
docs/content/flink/quick-start.md:
##########
@@ -269,16 +269,27 @@ SELECT * FROM ....;
 ## Setting dynamic options
 
 When interacting with the Paimon table, table options can be tuned without changing the options in the catalog. Paimon will extract job-level dynamic options and take effect in the current session.
-The dynamic option's key format is `paimon.${catalogName}.${dbName}.${tableName}.${config_key}`. The catalogName/dbName/tableName can be `*`, which means matching all the specific parts.
+The dynamic table option's key format is `paimon.${catalogName}.${dbName}.${tableName}.${config_key}`. The catalogName/dbName/tableName can be `*`, which means matching all the specific parts. 
+The dynamic global option's key format is `paimon.${config_key}`. Global options will take effect for all the tables. Table options will override global options if there are conflicts.
 
 For example:
 
 ```sql
+-- set scan.timestamp-millis=1697018249001 for all tables

Review Comment:
   no `paimon` prefix will also work ?



##########
docs/content/spark/auxiliary.md:
##########
@@ -29,7 +29,9 @@ under the License.
 ## Set / Reset
 The SET command sets a property, returns the value of an existing property or returns all SQLConf properties with value and meaning.
 The RESET command resets runtime configurations specific to the current session which were set via the SET command to their default values.
-To set paimon configs specifically, you need add the `spark.paimon.` prefix.
+To set dynamic options globally, you need add the `spark.paimon.` prefix. You can also set dynamic table options at this format: 
+`paimon.spark.${dbName}.${tableName}.${config_key}`. The dbName/tableName can be `*`, which means matching all the specific parts. Dynamic 

Review Comment:
   `spark.paimon`?



##########
docs/content/spark/auxiliary.md:
##########
@@ -40,6 +42,19 @@ SET spark.paimon.file.block-size=512M;
 
 -- reset conf
 RESET spark.paimon.file.block-size;
+      
+-- set scan.snapshot-id=1 for the table default.T
+SET paimon.spark.default.T.scan.snapshot-id=1;

Review Comment:
   `spark.paimon`?



##########
docs/content/flink/quick-start.md:
##########
@@ -269,16 +269,27 @@ SELECT * FROM ....;
 ## Setting dynamic options
 
 When interacting with the Paimon table, table options can be tuned without changing the options in the catalog. Paimon will extract job-level dynamic options and take effect in the current session.
-The dynamic option's key format is `paimon.${catalogName}.${dbName}.${tableName}.${config_key}`. The catalogName/dbName/tableName can be `*`, which means matching all the specific parts.
+The dynamic table option's key format is `paimon.${catalogName}.${dbName}.${tableName}.${config_key}`. The catalogName/dbName/tableName can be `*`, which means matching all the specific parts. 
+The dynamic global option's key format is `paimon.${config_key}`. Global options will take effect for all the tables. Table options will override global options if there are conflicts.
 
 For example:
 
 ```sql
+-- set scan.timestamp-millis=1697018249001 for all tables
+SET 'paimon.scan.timestamp-millis' = '1697018249001';
+SELECT * FROM T;
+
 -- set scan.timestamp-millis=1697018249000 for the table mycatalog.default.T
 SET 'paimon.mycatalog.default.T.scan.timestamp-millis' = '1697018249000';
 SELECT * FROM T;
 
 -- set scan.timestamp-millis=1697018249000 for the table default.T in any catalog
 SET 'paimon.*.default.T.scan.timestamp-millis' = '1697018249000';
 SELECT * FROM T;
+
+-- set scan.timestamp-millis=1697018249000 for the table mycatalog.default.T1

Review Comment:
   outdated?



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

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


Re: [PR] [spark] Support table options via SQL conf for Spark Engine [paimon]

Posted by "xiangyuf (via GitHub)" <gi...@apache.org>.
xiangyuf commented on PR #4393:
URL: https://github.com/apache/paimon/pull/4393#issuecomment-2454576546

   @Zouxxyy @JingsongLi CI has passed, please take a look.


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

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


Re: [PR] [spark] Support table options filter via SQL conf for Spark Engine [paimon]

Posted by "xiangyuf (via GitHub)" <gi...@apache.org>.
xiangyuf commented on PR #4393:
URL: https://github.com/apache/paimon/pull/4393#issuecomment-2443108471

   > > Do we need to support the table with same name in different db/catalog? Just like flink's global option do. #2104
   > 
   > I think we should find an unified way to unify Flink and Spark.
   
   @Aitozi @JingsongLi  Thx for reply. +1 for unify this.


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

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


Re: [PR] [spark] Support table options via SQL conf for Spark Engine [paimon]

Posted by "xiangyuf (via GitHub)" <gi...@apache.org>.
xiangyuf closed pull request #4393: [spark] Support table options via SQL conf for Spark Engine
URL: https://github.com/apache/paimon/pull/4393


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

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


Re: [PR] [spark] Support table options via SQL conf for Spark Engine [paimon]

Posted by "Zouxxyy (via GitHub)" <gi...@apache.org>.
Zouxxyy commented on code in PR #4393:
URL: https://github.com/apache/paimon/pull/4393#discussion_r1828872665


##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/SparkSource.scala:
##########
@@ -80,9 +82,15 @@ class SparkSource
   }
 
   private def loadTable(options: JMap[String, String]): DataTable = {
+    val path = CoreOptions.path(options)
     val catalogContext = CatalogContext.create(
-      Options.fromMap(mergeSQLConf(options)),
-      SparkSession.active.sessionState.newHadoopConf())
+      Options.fromMap(

Review Comment:
   For SparkSource loadTable, maybe we can just keep the original way, because it is simpler and more general through `spark.read.format("paimon").options()` to set table level config. And it is difficult to get catalogname and dbname 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.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

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


Re: [PR] [spark] Support table options via SQL conf for Spark Engine [paimon]

Posted by "Zouxxyy (via GitHub)" <gi...@apache.org>.
Zouxxyy commented on PR #4393:
URL: https://github.com/apache/paimon/pull/4393#issuecomment-2453933956

   > @JingsongLi @Aitozi Hi, I've unified flink and spark to support both dynamic table options and global options: Global options format: Flink:`{config_key}` Spark: `spark.paimon.{config_key}`.
   > 
   > Table options format: Flink:`paimon.${catalogName}.${dbName}.${tableName}.${config_key}` Spark: `spark.paimon.${dbName}.${tableName}.{config_key}`
   > 
   > Dynamic table options will override global options if there are conflicts.
   > 
   > WDYT?
   
   Why flink contains ${catalogName}, but spark not


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

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


Re: [PR] [spark] Support table options filter via SQL conf for Spark Engine [paimon]

Posted by "xiangyuf (via GitHub)" <gi...@apache.org>.
xiangyuf commented on PR #4393:
URL: https://github.com/apache/paimon/pull/4393#issuecomment-2441405163

   @YannByron @Aitozi  Hi, would you kindly review this


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

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


Re: [PR] [spark] Support table options filter via SQL conf for Spark Engine [paimon]

Posted by "xiangyuf (via GitHub)" <gi...@apache.org>.
xiangyuf commented on PR #4393:
URL: https://github.com/apache/paimon/pull/4393#issuecomment-2441423478

   + @Zouxxyy 


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

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


Re: [PR] [spark] Support table options via SQL conf for Spark Engine [paimon]

Posted by "xiangyuf (via GitHub)" <gi...@apache.org>.
xiangyuf commented on code in PR #4393:
URL: https://github.com/apache/paimon/pull/4393#discussion_r1826574169


##########
docs/content/flink/quick-start.md:
##########
@@ -269,16 +269,27 @@ SELECT * FROM ....;
 ## Setting dynamic options
 
 When interacting with the Paimon table, table options can be tuned without changing the options in the catalog. Paimon will extract job-level dynamic options and take effect in the current session.
-The dynamic option's key format is `paimon.${catalogName}.${dbName}.${tableName}.${config_key}`. The catalogName/dbName/tableName can be `*`, which means matching all the specific parts.
+The dynamic table option's key format is `paimon.${catalogName}.${dbName}.${tableName}.${config_key}`. The catalogName/dbName/tableName can be `*`, which means matching all the specific parts. 
+The dynamic global option's key format is `paimon.${config_key}`. Global options will take effect for all the tables. Table options will override global options if there are conflicts.
 
 For example:
 
 ```sql
+-- set scan.timestamp-millis=1697018249001 for all tables
+SET 'paimon.scan.timestamp-millis' = '1697018249001';
+SELECT * FROM T;
+
 -- set scan.timestamp-millis=1697018249000 for the table mycatalog.default.T
 SET 'paimon.mycatalog.default.T.scan.timestamp-millis' = '1697018249000';
 SELECT * FROM T;
 
 -- set scan.timestamp-millis=1697018249000 for the table default.T in any catalog
 SET 'paimon.*.default.T.scan.timestamp-millis' = '1697018249000';
 SELECT * FROM T;
+
+-- set scan.timestamp-millis=1697018249000 for the table mycatalog.default.T1

Review Comment:
   why outdated?



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

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


Re: [PR] [spark] Support table options via SQL conf for Spark Engine [paimon]

Posted by "xiangyuf (via GitHub)" <gi...@apache.org>.
xiangyuf commented on PR #4393:
URL: https://github.com/apache/paimon/pull/4393#issuecomment-2454273524

   > > @JingsongLi @Aitozi Hi, I've unified flink and spark to support both dynamic table options and global options: Global options format: Flink:`{config_key}` Spark: `spark.paimon.{config_key}`.
   > > Table options format: Flink:`paimon.${catalogName}.${dbName}.${tableName}.${config_key}` Spark: `spark.paimon.${dbName}.${tableName}.{config_key}`
   > > Dynamic table options will override global options if there are conflicts.
   > > WDYT?
   > 
   > Why flink contains ${catalogName}, but spark not
   
   @Zouxxyy I can update Spark Table Options as : 
   spark.paimon.${catalogName}.${dbName}.${tableName}.{config_key}
   
   But in most cases, the option would be  spark.paimon.paimon.db.table.k1 = v1


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

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