Skip to content

Commit

Permalink
sdks/java: support non-ascii BigQuery table name (#33990)
Browse files Browse the repository at this point in the history
* sdks/java: support Non-ASCI BigQuery table name

* sdks/java: test support Non-ASCI BigQuery tb name
  • Loading branch information
mohamedawnallah authored Feb 14, 2025
1 parent ca070b2 commit f63446f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,22 @@ public class BigQueryIO {
/** Regular expression that matches Dataset IDs. */
private static final String DATASET_REGEXP = "[-\\w.]{1,1024}";

/** Regular expression that matches Table IDs. */
private static final String TABLE_REGEXP = "[-\\w$@ ]{1,1024}";
/**
* Regular expression that matches BigQuery Table IDs.
* Supports Unicode characters in categories:
* - L (letter)
* - M (mark)
* - N (number)
* As well as:
* - Underscore (_)
* - Dash (-)
* - Dollar sign ($)
* - At sign (@)
* - Space
*
* The pattern requires 1-1024 characters matching these categories.
*/
private static final String TABLE_REGEXP = "[-_\\p{L}\\p{N}\\p{M}$@ ]{1,1024}";

/**
* Matches table specifications in the form {@code "[project_id]:[dataset_id].[table_id]"} or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public void testTableUrnParsing() {
@Test
public void testTableParsing_validPatterns() {
BigQueryHelpers.parseTableSpec("a123-456:foo_bar.d");
BigQueryHelpers.parseTableSpec("a123-456:foo_bar.ग्राहक");
BigQueryHelpers.parseTableSpec("a12345:b.c");
BigQueryHelpers.parseTableSpec("a1:b.c");
BigQueryHelpers.parseTableSpec("b12345.c");
Expand Down

0 comments on commit f63446f

Please sign in to comment.