You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "iamhucong (via GitHub)" <gi...@apache.org> on 2026/08/12 11:26:01 UTC

[PR] Parse Hive column NOT NULL constraints [shardingsphere]

iamhucong opened a new pull request, #39428:
URL: https://github.com/apache/shardingsphere/pull/39428

   Fix Hive `CREATE TABLE` column nullability metadata.
   
   ### Problem
   
   The Hive grammar accepts column-level `NOT NULL`, but `HiveDDLStatementVisitor` always constructed `ColumnDefinitionSegment` with `notNull=false`. Existing Hive parser expectations therefore encoded the wrong metadata.
   
   Apache Hive documents enforced `NOT NULL` constraints since Hive 3.0.0: https://hive.apache.org/docs/latest/language/languagemanual-ddl/
   
   ### Change
   
   - Detect `notNullConstraint` in the existing `columnConstraintSpecification` AST.
   - Correct the existing Hive parser expectations for both focused and combined `NOT NULL` cases.
   - Add the ShardingSphere 5.5.4 bug-fix release note.
   
   ### Verification
   
   - RED: correcting the focused expected result produced the only failure among 775 Hive parser tests before the visitor change.
   - `InternalHiveParserIT`: 775 tests passed after correcting both affected expectations.
   - Hive parser module: 13 tests passed.
   - Spotless passed.
   - Checkstyle reported 0 violations.
   - `git diff --check` passed.
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


Re: [PR] Parse Hive column NOT NULL constraints [shardingsphere]

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


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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


Re: [PR] Parse Hive column NOT NULL constraints [shardingsphere]

Posted by "iamhucong (via GitHub)" <gi...@apache.org>.
iamhucong commented on PR #39428:
URL: https://github.com/apache/shardingsphere/pull/39428#issuecomment-5266170010

   ### Result
   
   **Review Result: Mergeable**
   
   The change correctly preserves Hive `CREATE TABLE` column-level `NOT NULL` metadata. I found no blocking code-correctness issues.
   
   ### Evidence
   
   - Reviewed public head: `312d05f07c8f54297a1b0995d900d5c4636e4356`.
   - Before this change, `HiveDDLStatementVisitor.visitColumnDefinition()` always constructed `ColumnDefinitionSegment` with `notNull=false`.
   - The new condition sets `notNull=true` only when an existing `columnConstraintSpecification` contains `notNullConstraint`.
   - The Hive grammar already defines:
     - `columnDefinition` with zero or more `columnConstraintSpecification` nodes.
     - `columnConstraintSpecification` containing `notNullConstraint`.
     - `notNullConstraint` matching exactly `NOT NULL`.
   - The Apache Hive LanguageManual DDL confirms that Hive supports and enforces `NOT NULL` constraints since Hive 3.0.0 and provides a column-level example: https://hive.apache.org/docs/latest/language/languagemanual-ddl/
   - The repository uses Hive JDBC 4.0.1, within the documented supported range.
   - Two existing Hive-only parser cases exercise the production parser path:
     - A focused `name STRING NOT NULL` case.
     - A combined-options case containing `NOT NULL`, a comment, and adjacent constraints.
   - `ColumnDefinitionAssert` directly compares `ColumnDefinitionSegment.isNotNull()`, and the binder preserves this value.
   - Sanitized local verification:
     - RED: the focused case was the only failure among 775 Hive parser tests after correcting its expected metadata and before the visitor fix.
     - The first GREEN run exposed the combined-options case as the only remaining incorrect expected result.
     - GREEN: all 775 Hive parser tests passed after correcting both affected expectations.
     - The Hive parser module passed all 13 tests.
     - Spotless passed.
     - Checkstyle reported 0 violations.
     - Triple-dot `git diff --check` passed.
   
   ### Coverage
   
   - Accounted for all 3 files in the authoritative GitHub changed-file list:
     - `parser/sql/engine/dialect/hive/src/main/java/org/apache/shardingsphere/sql/parser/engine/hive/visitor/statement/type/HiveDDLStatementVisitor.java`
     - `test/it/parser/src/main/resources/case/ddl/create-table.xml`
     - `RELEASE-NOTES.md`
   - The local triple-dot file list matched GitHub; merge base: `f30503159d1faf96350afda398995898b1d9c963`.
   - Reviewed the Hive DDL visitor entry path, grammar AST, default false boundary when no `NOT NULL` constraint exists, focused and combined syntax, shared `columnDefinition` use by `ADD/REPLACE COLUMNS`, binder propagation, metadata consumers, test assertion path, segment bounds, and the 5.5.4 release-note link.
   - `HiveDDLStatementVisitor` is an independent final dialect visitor; no shared grammar or other dialect behavior changes.
   - No public API, SPI, grammar, dependency, configuration, packaging, or generated-source contract changes.
   - Root-cause, blast-radius, tests/runtime/operations, and final full-scope convergence reviews completed with no unresolved evidence gaps.
   - This is a code-scope review only; CI was not reviewed.
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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