Skip to content

Commit

Permalink
[MINOR][TESTS] Add a helper function for spark.table in dsl
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?
Add a helper function for `spark.table` in dsl

### Why are the changes needed?
to be used in tests

### Does this PR introduce _any_ user-facing change?
no, test only

### How was this patch tested?
ci

### Was this patch authored or co-authored using generative AI tooling?
no

Closes #46717 from zhengruifeng/dsl_read.

Authored-by: Ruifeng Zheng <[email protected]>
Signed-off-by: Ruifeng Zheng <[email protected]>
  • Loading branch information
zhengruifeng committed May 23, 2024
1 parent 14d3f44 commit 4a471cc
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,21 @@ package object dsl {
def sql(sqlText: String): Relation = {
Relation.newBuilder().setSql(SQL.newBuilder().setQuery(sqlText)).build()
}

def table(name: String): Relation = {
proto.Relation
.newBuilder()
.setRead(
proto.Read
.newBuilder()
.setNamedTable(
proto.Read.NamedTable
.newBuilder()
.setUnparsedIdentifier(name)
.build())
.build())
.build()
}
}

implicit class DslNAFunctions(val logicalPlan: Relation) {
Expand Down

0 comments on commit 4a471cc

Please sign in to comment.