fix(python): render field types as SQL strings, not Rust Debug - #786
Open
jackylee-ch wants to merge 1 commit into
Open
fix(python): render field types as SQL strings, not Rust Debug#786jackylee-ch wants to merge 1 commit into
jackylee-ch wants to merge 1 commit into
Conversation
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.
PyDataField.field_type()returns RustDebugoutput — a column declaredVARCHAR(10)reads back asVarchar(VarCharType { length: 10, nullable: true }).The in-place
TODO(#284 follow-up)names the cause:DataTypehas no enum-levelDisplay, so there was nothing to call.Only 10 of the 23 variants carried a leaf
Display. This adds the other ninescalars and the four constructed types, then the dispatch. The constructed formats
fill Java's
FORMATwith the children's own SQL strings (ARRAY<%s>,MAP<%s, %s>,MULTISET<%s>,ROW<%s>), so a child'sNOT NULLsits inside thebrackets and the outer one after them;
ROWrenders fields likeDataField.asSQLString— escaped name, type, thenCOMMENT '...'. Every keywordand format string was checked against the Java class rather than inferred.
The dispatch also retires
VectorType::element_sql_name, a private table of sevenprimitive names with
unreachable!()for the rest, which existed only because thisdispatch did not.
cargo test -p pypaimon_rustcannot link libpython here, so the binding iscompile-checked locally and its behaviour left to
integration (python).The rendering is covered by unit tests in
paimon.