Skip to content

Conversation

@loserwang1024
Copy link
Contributor

Purpose

Linked issue: close #2500

Brief change log

Tests

API and Format

Documentation

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a string-to-DataType parser to simplify programmatic type definitions in Fluss. The implementation addresses issue #2500, which highlighted the complexity of creating nested row types using Java code by enabling users to parse types from strings instead.

Changes:

  • Added DataTypeParser class with tokenization and parsing logic for converting string representations to DataType objects
  • Exposed DataTypes.parse(String) as the public API entry point
  • Added comprehensive test suite covering various type parsing scenarios and error cases

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 19 comments.

File Description
fluss-common/src/main/java/org/apache/fluss/types/DataTypeParser.java New parser implementation with tokenizer and recursive descent parser for DataType strings
fluss-common/src/main/java/org/apache/fluss/types/DataTypes.java Added public parse() method that delegates to DataTypeParser
fluss-common/src/test/java/org/apache/fluss/types/DataTypeParserTests.java Comprehensive test suite covering parsing, serialization round-trips, and error messages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +56 to +59
TestSpec.forString("DEC(10, 3)").expectType(new DecimalType(10, 3)),
TestSpec.forString("NUMERIC(10, 3)").expectType(new DecimalType(10, 3)),
TestSpec.forString("TINYINT").expectType(new TinyIntType()),
TestSpec.forString("SMALLINT").expectType(new SmallIntType()),
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This TODO comment suggests there's unfinished work regarding exception handling for "TIMESTAMP WITH TIME ZONE". Either implement the test case or document why this type is not supported and remove the TODO.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parse Datatype from String in fluss client.

1 participant