-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### What changes were proposed in this pull request? Add `columnImpl` in API module ### Why are the changes needed? For client usage Fix: #1630 ### Does this PR introduce _any_ user-facing change? yes, the client now can use the helper method in `Column` API to get a column instance ### How was this patch tested? UTs added
- Loading branch information
Showing
3 changed files
with
182 additions
and
65 deletions.
There are no files selected for viewing
This file contains 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
34 changes: 34 additions & 0 deletions
34
api/src/test/java/com/datastrato/gravitino/rel/TestColumn.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2024 Datastrato Pvt Ltd. | ||
* This software is licensed under the Apache License version 2. | ||
*/ | ||
package com.datastrato.gravitino.rel; | ||
|
||
import com.datastrato.gravitino.rel.types.Types; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class TestColumn { | ||
@Test | ||
public void testColumn() { | ||
Column expectedColumn = | ||
Column.of("col_1", Types.ByteType.get(), null, true, false, Column.DEFAULT_VALUE_NOT_SET); | ||
|
||
Column actualColumn = Column.of("col_1", Types.ByteType.get()); | ||
Assertions.assertEquals(expectedColumn, actualColumn); | ||
|
||
actualColumn = Column.of("col_1", Types.ByteType.get(), null); | ||
Assertions.assertEquals(expectedColumn, actualColumn); | ||
} | ||
|
||
@Test | ||
public void testColumnException() { | ||
IllegalArgumentException exception = | ||
Assertions.assertThrows(IllegalArgumentException.class, () -> Column.of(null, null)); | ||
Assertions.assertEquals("Column name cannot be null", exception.getMessage()); | ||
|
||
exception = | ||
Assertions.assertThrows(IllegalArgumentException.class, () -> Column.of("col_1", null)); | ||
Assertions.assertEquals("Column data type cannot be null", exception.getMessage()); | ||
} | ||
} |
This file contains 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