Skip to content

Commit 9ad5004

Browse files
authored
Fixed logic for isWildcard function (#1171)
## Description <!-- Provide a brief summary of the changes made and the issue they aim to address.--> ## Testing <!-- Describe how the changes have been tested--> ## Additional Notes to the Reviewer <!-- Share any additional context or insights that may help the reviewer understand the changes better. This could include challenges faced, limitations, or compromises made during the development process. Also, mention any areas of the code that you would like the reviewer to focus on specifically. -->
1 parent 1890da0 commit 9ad5004

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
- [PECOBLR-1131] Fix incorrect refetching of expired CloudFetch links when using Thrift protocol.
1313
- Fixed logging to respect params when the driver is shaded.
14+
- Fixed `isWildcard` to return true only when the value is `*`
1415

1516
---
1617
*Note: When making changes, please add your change under the appropriate section

src/main/java/com/databricks/jdbc/common/util/WildcardUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static boolean isNullOrWildcard(String s) {
3232
* @return true if the input string is wildcard
3333
*/
3434
public static boolean isWildcard(String s) {
35-
return s != null && s.contains(ASTERISK);
35+
return s != null && s.equals(ASTERISK);
3636
}
3737

3838
public static String jdbcPatternToHive(String pattern) {

src/test/java/com/databricks/jdbc/common/util/WildcardUtilTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ public void testJDBCToHiveConversion(
4242

4343
@Test
4444
public void testIsWildcard() {
45-
assertTrue(wildcardUtil.isWildcard("*Test*"));
45+
assertTrue(wildcardUtil.isWildcard("*"));
46+
assertFalse(wildcardUtil.isWildcard("*Test*"));
4647
assertFalse(wildcardUtil.isWildcard("Test"));
4748
assertFalse(wildcardUtil.isWildcard(null));
4849
}

0 commit comments

Comments
 (0)