Commit f6cbbff 1 parent ebfd6c6 commit f6cbbff Copy full SHA for f6cbbff
File tree 2 files changed +119
-0
lines changed
2 files changed +119
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ fn sql_keywords() -> &'static HashSet<&'static str> {
23
23
m. extend ( SQLITE_KEYWORDS ) ;
24
24
m. extend ( POSTGRES_KEYWORDS ) ;
25
25
m. extend ( DUCKDB_KEYWORDS ) ;
26
+ m. extend ( BIGQUERY_KEYWORDS ) ;
26
27
27
28
let reverse_index: HashMap < & Keyword , usize > = ALL_KEYWORDS_INDEX
28
29
. iter ( )
@@ -390,6 +391,107 @@ const DUCKDB_KEYWORDS: &[&str] = &[
390
391
"WITH" ,
391
392
] ;
392
393
394
+ // source reserved keywords GoogleSQL
395
+ // <https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#reserved_keywords>
396
+ const BIGQUERY_KEYWORDS : & [ & str ] = & [
397
+ "ALL" ,
398
+ "AND" ,
399
+ "ANY" ,
400
+ "ARRAY" ,
401
+ "AS" ,
402
+ "ASC" ,
403
+ "ASSERT_ROWS_MODIFIED" ,
404
+ "AT" ,
405
+ "BETWEEN" ,
406
+ "BY" ,
407
+ "CASE" ,
408
+ "CAST" ,
409
+ "COLLATE" ,
410
+ "CONTAINS" ,
411
+ "CREATE" ,
412
+ "CROSS" ,
413
+ "CUBE" ,
414
+ "CURRENT" ,
415
+ "DEFAULT" ,
416
+ "DEFINE" ,
417
+ "DESC" ,
418
+ "DISTINCT" ,
419
+ "ELSE" ,
420
+ "END" ,
421
+ "ENUM" ,
422
+ "ESCAPE" ,
423
+ "EXCEPT" ,
424
+ "EXCLUDE" ,
425
+ "EXISTS" ,
426
+ "EXTRACT" ,
427
+ "FALSE" ,
428
+ "FETCH" ,
429
+ "FOLLOWING" ,
430
+ "FOR" ,
431
+ "FROM" ,
432
+ "FULL" ,
433
+ "GROUP" ,
434
+ "GROUPING" ,
435
+ "GROUPS" ,
436
+ "HASH" ,
437
+ "HAVING" ,
438
+ "IF" ,
439
+ "IGNORE" ,
440
+ "IN" ,
441
+ "INNER" ,
442
+ "INTERSECT" ,
443
+ "INTERVAL" ,
444
+ "INTO" ,
445
+ "IS" ,
446
+ "JOIN" ,
447
+ "LATERAL" ,
448
+ "LEFT" ,
449
+ "LIKE" ,
450
+ "LIMIT" ,
451
+ "LOOKUP" ,
452
+ "MERGE" ,
453
+ "NATURAL" ,
454
+ "NEW" ,
455
+ "NO" ,
456
+ "NOT" ,
457
+ "NULL" ,
458
+ "NULLS" ,
459
+ "OF" ,
460
+ "ON" ,
461
+ "OR" ,
462
+ "ORDER" ,
463
+ "OUTER" ,
464
+ "OVER" ,
465
+ "PARTITION" ,
466
+ "PRECEDING" ,
467
+ "PROTO" ,
468
+ "QUALIFY" ,
469
+ "RANGE" ,
470
+ "RECURSIVE" ,
471
+ "RESPECT" ,
472
+ "RIGHT" ,
473
+ "ROLLUP" ,
474
+ "ROWS" ,
475
+ "SELECT" ,
476
+ "SET" ,
477
+ "SOME" ,
478
+ "STRUCT" ,
479
+ "TABLESAMPLE" ,
480
+ "THEN" ,
481
+ "TO" ,
482
+ "TREAT" ,
483
+ "TRUE" ,
484
+ "UNBOUNDED" ,
485
+ "UNION" ,
486
+ "UNNEST" ,
487
+ "USING" ,
488
+ "WHEN" ,
489
+ "WHERE" ,
490
+ "WINDOW" ,
491
+ "WITH" ,
492
+ "WITHIN" ,
493
+ ] ;
494
+
393
495
#[ test]
394
496
fn test_sql_keywords ( ) {
395
497
assert ! ( is_keyword( "from" ) ) ;
Original file line number Diff line number Diff line change @@ -1092,6 +1092,23 @@ fn test_quoting_05() {
1092
1092
"# ) ;
1093
1093
}
1094
1094
1095
+ #[ test]
1096
+ fn test_quoting_06 ( ) {
1097
+ let prql = "
1098
+ prql target:sql.bigquery
1099
+
1100
+ from `some_dataset.demo`
1101
+ select {`hash`}
1102
+ " ;
1103
+
1104
+ assert_snapshot ! ( compile( prql) . unwrap( ) , @r#"
1105
+ SELECT
1106
+ `hash`
1107
+ FROM
1108
+ `some_dataset.demo`
1109
+ "# ) ;
1110
+ }
1111
+
1095
1112
#[ test]
1096
1113
fn test_sorts_01 ( ) {
1097
1114
assert_snapshot ! ( ( compile( r###"
You can’t perform that action at this time.
0 commit comments