Repository navigation
[SPARK-48372][SPARK-45716][PYTHON] Implement StructType.treeString - #46685
Closed
zhengruifeng wants to merge 3 commits into
Closed
zhengruifeng wants to merge 3 commits into
zhengruifeng wants to merge 3 commits into
Conversation
xinrong-meng
approved these changes
May 21, 2024
Member
|
LGTM thank you! I found https://issues.apache.org/jira/browse/SPARK-45716 which we might want to close together later. |
StructType.treeStringStructType.treeString
HyukjinKwon
approved these changes
May 22, 2024
zhengruifeng
force-pushed
the
py_tree_string
branch
from
May 22, 2024 02:12
2e73a74 to
7aa0406
Compare
Contributor
Author
|
thanks, merged to master |
zhengruifeng
added a commit
that referenced
this pull request
May 23, 2024
…ypes ### What changes were proposed in this pull request? this PR is a follow up of #46685. ### Why are the changes needed? `StructType.treeString` uses `DataType.typeName` to generate the tree string, however, the `typeName` in python is a class method and can not return the same string for parameterized types. ``` In [2]: schema = StructType().add("c", CharType(10), True).add("v", VarcharType(10), True).add("d", DecimalType(10, 2), True).add("ym00", YearM ...: onthIntervalType(0, 0)).add("ym01", YearMonthIntervalType(0, 1)).add("ym11", YearMonthIntervalType(1, 1)) In [3]: print(schema.treeString()) root |-- c: char (nullable = true) |-- v: varchar (nullable = true) |-- d: decimal (nullable = true) |-- ym00: yearmonthinterval (nullable = true) |-- ym01: yearmonthinterval (nullable = true) |-- ym11: yearmonthinterval (nullable = true) ``` it should be ``` In [4]: print(schema.treeString()) root |-- c: char(10) (nullable = true) |-- v: varchar(10) (nullable = true) |-- d: decimal(10,2) (nullable = true) |-- ym00: interval year (nullable = true) |-- ym01: interval year to month (nullable = true) |-- ym11: interval month (nullable = true) ``` ### Does this PR introduce _any_ user-facing change? no, this feature was just added and not release out yet. ### How was this patch tested? added tests ### Was this patch authored or co-authored using generative AI tooling? no Closes #46711 from zhengruifeng/tree_string_fix. Authored-by: Ruifeng Zheng <ruifengz@apache.org> Signed-off-by: Ruifeng Zheng <ruifengz@apache.org>
zhengruifeng
added a commit
that referenced
this pull request
Jun 11, 2024
…thod ### What changes were proposed in this pull request? followup of #46685, to remove unused helper method ### Why are the changes needed? method `_tree_string` is no longer needed ### Does this PR introduce _any_ user-facing change? No, internal change only ### How was this patch tested? CI ### Was this patch authored or co-authored using generative AI tooling? No Closes #46936 from zhengruifeng/tree_string_followup. Authored-by: Ruifeng Zheng <ruifengz@apache.org> Signed-off-by: Ruifeng Zheng <ruifengz@apache.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Implement
StructType.treeStringWhy are the changes needed?
feature parity, this method is Scala-only before
Does this PR introduce any user-facing change?
yes
How was this patch tested?
added tests
Was this patch authored or co-authored using generative AI tooling?
no