@@ -40,17 +40,19 @@ function makeKey(
40
40
const DEPENDENT_PREDICATES_REGEXP = ( ( ) => {
41
41
const regexps = [
42
42
// SCAN id
43
- String . raw `SCAN\s+([0-9a-zA-Z:#_]+)\s` ,
43
+ String . raw `SCAN\s+([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\` )\s` ,
44
44
// JOIN id WITH id
45
- String . raw `JOIN\s+([0-9a-zA-Z:#_]+)\s+WITH\s+([0-9a-zA-Z:#_]+)\s` ,
45
+ String . raw `JOIN\s+([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\` )\s+WITH\s+([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\` )\s` ,
46
46
// AGGREGATE id, id
47
- String . raw `AGGREGATE\s+([0-9a-zA-Z:#_]+)\s*,\s+([0-9a-zA-Z:#_]+)` ,
47
+ String . raw `AGGREGATE\s+([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\` )\s*,\s+([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\` )` ,
48
48
// id AND NOT id
49
- String . raw `([0-9a-zA-Z:#_]+)\s+AND\s+NOT\s+([0-9a-zA-Z:#_]+)` ,
49
+ String . raw `([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\` )\s+AND\s+NOT\s+([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\` )` ,
50
50
// INVOKE HIGHER-ORDER RELATION rel ON <id, ..., id>
51
- String . raw `INVOKE\s+HIGHER-ORDER\s+RELATION\s[^\s]+\sON\s+<([0-9a-zA-Z:#_<>]+)((?:,[0-9a-zA-Z:#_<>]+)*)>` ,
51
+ String . raw `INVOKE\s+HIGHER-ORDER\s+RELATION\s[^\s]+\sON\s+<([0-9a-zA-Z:#_<>]+|\`[^\`\r\n]*\` )((?:,[0-9a-zA-Z:#_<>]+|,\`[^\`\r\n]*\` )*)>` ,
52
52
// SELECT id
53
- String . raw `SELECT\s+([0-9a-zA-Z:#_]+)` ,
53
+ String . raw `SELECT\s+([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\`)` ,
54
+ // REWRITE id WITH
55
+ String . raw `REWRITE\s+([0-9a-zA-Z:#_]+|\`[^\`\r\n]*\`)\s+WITH\s` ,
54
56
] ;
55
57
return new RegExp (
56
58
`${ String . raw `\{[0-9]+\}\s+[0-9a-zA-Z]+\s=\s(?:` + regexps . join ( "|" ) } )` ,
@@ -65,7 +67,12 @@ function getDependentPredicates(operations: string[]): I.List<string> {
65
67
. rest ( ) // Skip the first group as it's just the entire string
66
68
. filter ( ( x ) => ! ! x && ! x . match ( "r[0-9]+|PRIMITIVE" ) ) // Only keep the references to predicates.
67
69
. flatMap ( ( x ) => x . split ( "," ) ) // Group 2 in the INVOKE HIGHER_ORDER RELATION case is a comma-separated list of identifiers.
68
- . filter ( ( x ) => ! ! x ) ; // Remove empty strings
70
+ . filter ( ( x ) => ! ! x ) // Remove empty strings
71
+ . map ( ( x ) =>
72
+ x . startsWith ( "`" ) && x . endsWith ( "`" )
73
+ ? x . substring ( 1 , x . length - 1 )
74
+ : x ,
75
+ ) ; // Remove quotes from quoted identifiers
69
76
} else {
70
77
return I . List ( ) ;
71
78
}
0 commit comments