Skip to content

Commit f63446f

Browse files
sdks/java: support non-ascii BigQuery table name (#33990)
* sdks/java: support Non-ASCI BigQuery table name * sdks/java: test support Non-ASCI BigQuery tb name
1 parent ca070b2 commit f63446f

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,22 @@ public class BigQueryIO {
586586
/** Regular expression that matches Dataset IDs. */
587587
private static final String DATASET_REGEXP = "[-\\w.]{1,1024}";
588588

589-
/** Regular expression that matches Table IDs. */
590-
private static final String TABLE_REGEXP = "[-\\w$@ ]{1,1024}";
589+
/**
590+
* Regular expression that matches BigQuery Table IDs.
591+
* Supports Unicode characters in categories:
592+
* - L (letter)
593+
* - M (mark)
594+
* - N (number)
595+
* As well as:
596+
* - Underscore (_)
597+
* - Dash (-)
598+
* - Dollar sign ($)
599+
* - At sign (@)
600+
* - Space
601+
*
602+
* The pattern requires 1-1024 characters matching these categories.
603+
*/
604+
private static final String TABLE_REGEXP = "[-_\\p{L}\\p{N}\\p{M}$@ ]{1,1024}";
591605

592606
/**
593607
* Matches table specifications in the form {@code "[project_id]:[dataset_id].[table_id]"} or

sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryHelpersTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public void testTableUrnParsing() {
8787
@Test
8888
public void testTableParsing_validPatterns() {
8989
BigQueryHelpers.parseTableSpec("a123-456:foo_bar.d");
90+
BigQueryHelpers.parseTableSpec("a123-456:foo_bar.ग्राहक");
9091
BigQueryHelpers.parseTableSpec("a12345:b.c");
9192
BigQueryHelpers.parseTableSpec("a1:b.c");
9293
BigQueryHelpers.parseTableSpec("b12345.c");

0 commit comments

Comments
 (0)