Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backticks escaping #828

Open
wants to merge 238 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
238 commits
Select commit Hold shift + click to select a range
fcf1729
added inferredSequenceType property and access methods to Expression …
mario-arduini Oct 12, 2020
b335000
Set up InferTypeVisitor and used for basic numeric and string primitives
mario-arduini Oct 12, 2020
c104414
added findCommonSuperType method on ItemType, added CommaExpression i…
mario-arduini Oct 12, 2020
f9e61dc
added boolean, null, variableReference, array and object constructors
mario-arduini Oct 12, 2020
c1f4233
in ItemType partially corrected isSubtypeOf, added isStaticallyCastab…
mario-arduini Oct 13, 2020
486948d
added visitAdditiveExpr to type inference, added int index to ItemTyp…
mario-arduini Oct 14, 2020
3021aba
added unary expression inference, and isNumeric() function to itemType
mario-arduini Oct 14, 2020
f1ecf68
corrected ItemType to include missing atomic types in subtypeOf and m…
mario-arduini Oct 16, 2020
5117278
added static type inference for logic expressions, added hasEffective…
mario-arduini Oct 16, 2020
a73c280
fixed isSubtypeOf in SeuenceType and added Arity subtypeOf function, …
mario-arduini Oct 19, 2020
5e5f864
added XPST0005 error checks and corrected behaviours of typing and ar…
mario-arduini Oct 19, 2020
dbad0bf
added comparison expression type inference and utility to check if ty…
mario-arduini Oct 19, 2020
3eccd99
added configuration to static context
mario-arduini Oct 21, 2020
f0f0b97
completed primary expressions and added subtypeOfOrCanBePromotedTo fu…
mario-arduini Oct 21, 2020
55b3d71
InferTypeVisitor now use StaticContext instead of Void as argument to…
mario-arduini Oct 23, 2020
099221f
variable declaration and reference now store null if type was not spe…
mario-arduini Oct 24, 2020
ffb0716
added flag to turn on static analysis and flag to debug type inference
mario-arduini Oct 24, 2020
bb87d83
small correction for context and comparison expression and to effecti…
mario-arduini Oct 24, 2020
3a3c697
visited trycatch, conditional and typeswitch expressions, added least…
mario-arduini Oct 24, 2020
f4bfdf1
added range and concat expression, fixed warning for unqualified acce…
mario-arduini Oct 25, 2020
b73fea7
added quantified expression, now translation visitor set null in the …
mario-arduini Oct 25, 2020
b466f25
added array lookup, object lookup and array unboxing expressions, als…
mario-arduini Oct 25, 2020
74559fa
renamed PredicateExpression to FilterExpression and associated visit …
mario-arduini Oct 25, 2020
96b1662
added filter expression type inference
mario-arduini Oct 25, 2020
3b20250
added statically known function signatures in the static context duri…
mario-arduini Oct 25, 2020
16c8a1b
added type inference for switch and dynamic function call expressions
mario-arduini Oct 27, 2020
282439a
added type inference for simple map expression
mario-arduini Oct 27, 2020
82e33ed
item* now has no effective boolean value
mario-arduini Oct 27, 2020
f76282c
started type inference on flowrExpression, covered returnClause and l…
mario-arduini Oct 27, 2020
ee1b518
added orderBy and where clause type inference processing
mario-arduini Oct 27, 2020
87e2a77
added for clause processing in type inference, changed translate visi…
mario-arduini Oct 28, 2020
d6a84a0
added group by clause type inference processing, translation visitor …
mario-arduini Oct 28, 2020
7ecc3e0
corrected working behaviour of flowr expression to account for ForCla…
mario-arduini Oct 29, 2020
a9afbec
corrected for clause element type inference based on allowing empty f…
mario-arduini Oct 29, 2020
809118d
refactored code to perform basic null and empty sequence inferred typ…
mario-arduini Nov 4, 2020
665ff28
added JNTY0004 error to Switch clause and empty sequence check to var…
mario-arduini Nov 6, 2020
67a8442
spotless + added "statically is" expression in grammar, abstract node…
mario-arduini Nov 6, 2020
d7343de
spotless
mario-arduini Nov 6, 2020
7d36883
fixed grammar document
mario-arduini Nov 6, 2020
28e1562
added 'statically is' visitor in static type inference
mario-arduini Nov 6, 2020
fe4a4f2
renamed expression "is statically"
mario-arduini Nov 6, 2020
ab562c2
small fixes
mario-arduini Nov 10, 2020
8b7a7f2
test infrastructure for type inference
mario-arduini Nov 10, 2020
4cbb763
primary and comma expression tests
mario-arduini Nov 10, 2020
74ddc93
added RBTY0001 error code
mario-arduini Nov 11, 2020
cfbf458
Merge branch 'static-treat-expression' into research-project-mario-ar…
mario-arduini Nov 11, 2020
85e4652
added typing expressions tests
mario-arduini Nov 11, 2020
048abc4
added arithmetic tests
mario-arduini Nov 11, 2020
ec5aee8
added logic and misc tests
mario-arduini Nov 11, 2020
d39a411
postfix, quantified and map expressions static types tests
mario-arduini Nov 11, 2020
6f403d7
added comparison expression static type tests
mario-arduini Nov 11, 2020
516addd
added control static type tests
mario-arduini Nov 12, 2020
664af48
added flwor static type tests
mario-arduini Nov 12, 2020
612968b
Merge branch 'master' into merging-master
mario-arduini Nov 15, 2020
5bd596c
Merge branch 'master' into research-project-mario-arduini
mario-arduini Nov 15, 2020
a1809a7
started basic native let clause
mario-arduini Nov 15, 2020
3281ce7
added support for string concat
mario-arduini Nov 15, 2020
b504e36
added struct info and context, and unboxing and array lookup expressions
mario-arduini Nov 19, 2020
41c5190
small test fixes
mario-arduini Nov 19, 2020
1f44df0
new exception thrown in generate native query if it is not possible f…
mario-arduini Nov 22, 2020
45ece32
spotless
mario-arduini Nov 22, 2020
225dba0
remove treat expression, don't go into that can of worms
mario-arduini Nov 22, 2020
f62926e
started testing gitlab CI
mario-arduini Nov 22, 2020
1167e4a
testing maven installation
mario-arduini Nov 22, 2020
ab8fd90
added step to install wget
mario-arduini Nov 22, 2020
b0b0653
test fix
mario-arduini Nov 22, 2020
81fc3b1
gitlab ci fix
mario-arduini Nov 22, 2020
1aa1540
gitlab ci fix
mario-arduini Nov 22, 2020
02bf3d8
gitlab ci use new docker image
mario-arduini Nov 23, 2020
f171f6e
gitlab ci try to assemble and test
mario-arduini Nov 23, 2020
a60f291
added all tests to gitlab ci
mario-arduini Nov 23, 2020
1564a9a
testing split in mutliple jobs
mario-arduini Nov 23, 2020
50faf51
added all parallel tests and change to tagged docker image
mario-arduini Nov 23, 2020
accde7b
switched to untagged image
mario-arduini Nov 23, 2020
4ee95a0
fixed tag
mario-arduini Nov 23, 2020
fdf0fad
fixed variable declaration in static tests
mario-arduini Nov 24, 2020
1a7ee08
fix quantified type inference, single arity version of inferred type …
mario-arduini Nov 24, 2020
046ff72
where clause affect flwor clause arity by including possibility of zero
mario-arduini Nov 24, 2020
d8cade2
added checks for JNTY0004 error
mario-arduini Nov 24, 2020
fb91b88
integer is now subtype of decimal as by spec, and when checking varia…
mario-arduini Nov 24, 2020
4eb69d1
fixed comparison static type now deals properly with general comparis…
mario-arduini Nov 24, 2020
9b5bd6d
added optional inferred arity in value comparison type inference when…
mario-arduini Nov 24, 2020
b9f9734
fixed bug in setting returning arity in filter expression
mario-arduini Nov 24, 2020
38d2ba6
fixed bug in array and object lookup static typing, now return item i…
mario-arduini Nov 24, 2020
f5a204d
fixed castable inference bug
mario-arduini Nov 24, 2020
16e133d
fixed multiplication type inference for duration */div numeric
mario-arduini Nov 24, 2020
b139dc4
added smart branch inference to conditional expression
mario-arduini Nov 24, 2020
4368c05
fixed bug in switch inference for cases and test arities
mario-arduini Nov 24, 2020
9578e5c
minor fixes
mario-arduini Nov 24, 2020
de32a43
spotless
mario-arduini Nov 24, 2020
e0c4135
added control tests with multiple branches
mario-arduini Nov 24, 2020
9729634
corrected castable and cast static behaviour to raiseatomization erro…
mario-arduini Nov 26, 2020
10e2256
small fixes in dynamic function static test, plus spotless and log fo…
mario-arduini Dec 1, 2020
ed66c8f
fixed bug in multiplicative expression, duration * numeric not allowe…
mario-arduini Dec 1, 2020
6d6c567
added function test to the grammar
mario-arduini Dec 1, 2020
dfe3eaa
refactored huge addition and subtraction table into easier to read co…
mario-arduini Dec 1, 2020
2c6e645
removed unused index attribute from itemtype
mario-arduini Dec 1, 2020
f3ec9f3
refactored itemType to separate it from AtomicItemType
mario-arduini Dec 1, 2020
1fbb492
added function item type
mario-arduini Dec 2, 2020
33bf008
refactored to use the new FunctionItemType
mario-arduini Dec 2, 2020
64919b7
completely substituted ItemType.functionItem
mario-arduini Dec 3, 2020
6308381
Merge.
ghislainfourny Dec 3, 2020
f89e19f
Merge branch 'master' into StaticTyping
ghislainfourny Dec 4, 2020
6ad6712
fix in incrementArities
mario-arduini Dec 7, 2020
8ad3078
added function hierarchy in subtypes
mario-arduini Dec 7, 2020
9e7b9d0
added NativeClauseContext and removed Exception for native clause opt…
mario-arduini Dec 7, 2020
a9f4abe
removed array unboxing iterator in let clause optimization
mario-arduini Dec 7, 2020
e17a7ea
added schema checks to lookup operations
mario-arduini Dec 8, 2020
f1039c0
added support for variable lookup
mario-arduini Dec 8, 2020
961a835
refactor selectPart into resultQuery
mario-arduini Dec 10, 2020
8c68800
added whereclause native approach
mario-arduini Dec 10, 2020
ea4b32c
added mapping for numeric literals
mario-arduini Dec 10, 2020
8a429ff
native comparison and logical operations
mario-arduini Dec 10, 2020
71a6e46
added support dynamic context variable reference
mario-arduini Dec 10, 2020
dd0cf6b
added check for binary type in variable reference
mario-arduini Dec 14, 2020
c1249d8
added for native query
mario-arduini Dec 14, 2020
6158308
Merge branch 'research-project-mario-arduini' into merging-master
mario-arduini Dec 14, 2020
acf1079
merged master conflicts
mario-arduini Dec 14, 2020
d1044b8
resolved conflicts
mario-arduini Dec 15, 2020
679155a
added orderby native optimization
mario-arduini Dec 16, 2020
5a9d291
added non-tested properly group by native optimization
mario-arduini Dec 29, 2020
fb5b539
solved superficial git-pointed conflicts
mario-arduini Dec 29, 2020
f3ba44f
after merge compilable again
mario-arduini Dec 29, 2020
9f7a5fe
passing all tests and spotless
mario-arduini Dec 29, 2020
440dffa
corrected group by behaviour
mario-arduini Dec 29, 2020
5b87ef4
added and tested for clause without allowing empty, no positional var…
mario-arduini Dec 30, 2020
fe44d93
added support for nested unboxing operations
mario-arduini Dec 30, 2020
0bc4149
added support for native allowing empty
mario-arduini Jan 2, 2021
9f476c4
added support for positional variables in native clause both allowing…
mario-arduini Jan 2, 2021
1e5866b
spotless
mario-arduini Jan 4, 2021
9544e85
removed try/catch for order by and where
mario-arduini Jan 4, 2021
ab84e98
removed try/catch for native let, group and for
mario-arduini Jan 4, 2021
cfedf0f
added sequence type to let spark iterator
mario-arduini Jan 5, 2021
41653bf
started new generic let udf
mario-arduini Jan 5, 2021
f77bf9a
setup custom udf for string, integer, decimal and double
mario-arduini Jan 5, 2021
291e260
completed first version of let UDF to native types
mario-arduini Jan 5, 2021
e1a6d13
fixed special case for integer ordering with native
mario-arduini Jan 11, 2021
98aa1b0
spotless
mario-arduini Jan 11, 2021
82c225c
fixed biginteger to int conversion issue on generic let udf
mario-arduini Jan 11, 2021
7d479f6
Merge.
ghislainfourny Jan 12, 2021
9597026
setup new test for native flwor optimization
mario-arduini Jan 13, 2021
b64ac0e
arrayunboxing tests
mario-arduini Jan 13, 2021
d36a738
actually it was array lookups
mario-arduini Jan 13, 2021
876dcb3
added object-lookup tests
mario-arduini Jan 13, 2021
630fd69
fix on escaping native object lookup, added backtick test
mario-arduini Jan 13, 2021
bbc1130
fixed dynamic variable reference in lokups
mario-arduini Jan 13, 2021
f97056e
fixed case of variable redeclaration checking on flwor clause schema
mario-arduini Jan 13, 2021
dbd88d2
added test for redeclaration
mario-arduini Jan 13, 2021
5eb350a
added support for backtick in keys through escaping with uuid
mario-arduini Feb 3, 2021
e0be6e6
added return type to native clause context, fixed error in backtick e…
mario-arduini Feb 4, 2021
0673e7b
fixed conflicts except for grammar
mario-arduini Feb 4, 2021
2ae6e6e
fixed grammar to include is statically
mario-arduini Feb 4, 2021
c2efeaa
compilable
mario-arduini Feb 4, 2021
68309cb
fixed code to use anyfunction in functionItemType
mario-arduini Feb 4, 2021
73a585d
fix order by integer
mario-arduini Feb 4, 2021
17a8cf3
fixed quantified test
mario-arduini Feb 4, 2021
a9b4a51
spotless
mario-arduini Feb 4, 2021
34a0e38
fix static typing inference, null is comparable with any type and add…
mario-arduini Feb 8, 2021
05d8b8e
test '1' = 1 for spark jsoniq behavior mismatch
mario-arduini Feb 8, 2021
dc9849d
ItemType to interface
mario-arduini Feb 8, 2021
435fc47
added 'item' itemtype
mario-arduini Feb 8, 2021
efa6c4a
completed item type refactoring, added builtin types catalogue
mario-arduini Feb 8, 2021
60a0726
corrected semantics of class item type testing for atomic item types …
mario-arduini Feb 9, 2021
bdd6e1e
turned backtick escaping into a flag
mario-arduini Feb 11, 2021
0bbf400
spotless
mario-arduini Feb 11, 2021
91dc23f
added function test parsing in grammar
mario-arduini Feb 13, 2021
bf05473
added all static type and native flwor tests to CI
mario-arduini Feb 13, 2021
b5c855c
spotless
mario-arduini Feb 13, 2021
b3f8b1b
fix on CI
mario-arduini Feb 13, 2021
b23be48
itemtype interface renaming and added itemtype factory
mario-arduini Feb 14, 2021
c908521
copied over jsound and ignored in tracking
mario-arduini Feb 15, 2021
c6364f9
added jsound package but not tracked
mario-arduini Feb 15, 2021
6ef1d7c
integrated general and atomic facets in itemtype interface
mario-arduini Feb 16, 2021
08a46bf
Merge back.
ghislainfourny Feb 16, 2021
11c38f1
added user defined atomic type concrete implementation and small rename
mario-arduini Feb 17, 2021
48b3ae6
cleaned interface about throwing exceptions and supported operations,…
mario-arduini Feb 22, 2021
9c533e7
added facets class to set derived item type facets
mario-arduini Feb 22, 2021
b209b7a
added enum and constraints facets
mario-arduini Feb 22, 2021
6bbad35
integrated object item type
mario-arduini Feb 22, 2021
3170ddc
refactored item type to throw error on get facet by default
mario-arduini Feb 22, 2021
36847d5
added array item type
mario-arduini Feb 22, 2021
88bb806
removed constraints facet from array since it is not allowed
mario-arduini Feb 22, 2021
0acb064
added to dataframe function to atomic types and generic item
mario-arduini Feb 22, 2021
275c244
added json item type, extended base type to all and added type tree d…
mario-arduini Feb 23, 2021
d8206a9
added union item type
mario-arduini Feb 23, 2021
258866b
fixed missing method in union type
mario-arduini Feb 23, 2021
738f3aa
corrected json item namespace
mario-arduini Mar 1, 2021
e69a082
compiled again by integrating what is needed so far from JSound
mario-arduini Mar 1, 2021
431294a
fixed isSubtypeOf relation to account for union types
mario-arduini Mar 1, 2021
f7c3c3a
corrected derived types like daytime/yearmonth durations type and res…
mario-arduini Mar 1, 2021
8941f60
spotless
mario-arduini Mar 1, 2021
99060c4
corrected tricky bug on spark runtime tests
mario-arduini Mar 2, 2021
583b5b7
spotless
mario-arduini Mar 2, 2021
2d49f5f
merged .gitignore conflict
mario-arduini Mar 2, 2021
ecc602c
removed TypeOrReference class in favor of directly using ItemType
mario-arduini Mar 3, 2021
2fc1c2d
added parquet support and tested object type creation
mario-arduini Mar 3, 2021
4ce639c
added object lookup complete inference
mario-arduini Mar 3, 2021
3b2ff08
fix on constant integers in order by
mario-arduini Mar 26, 2021
c2ba2e3
set object item type generated from spark struct type as closed
mario-arduini Mar 26, 2021
17324fb
spotless
mario-arduini Mar 30, 2021
990dd32
fixed conflicts
mario-arduini Mar 30, 2021
986cd4b
solved conflicts and passing all tests
mario-arduini Mar 30, 2021
048b44a
spotless
mario-arduini Mar 30, 2021
8e16a53
Merge.
ghislainfourny Apr 1, 2021
05c3e3a
Merge branch 'master' of github.com:RumbleDB/rumble into StaticTyping
ghislainfourny Apr 1, 2021
8e36529
Merge branch 'master' into StaticTyping
ghislainfourny Apr 1, 2021
c2f3e15
Merge branch 'master' into StaticTyping
ghislainfourny Apr 7, 2021
ee5bc11
Merge branch 'master' into StaticTyping
ghislainfourny Apr 8, 2021
90bc519
Merge branch 'master' of github.com:RumbleDB/rumble into StaticTyping
ghislainfourny Apr 8, 2021
fa6cdf2
Merge.
ghislainfourny Apr 8, 2021
05a6b51
Fix imports.
ghislainfourny Apr 8, 2021
c6cfe1c
Fix imports.
ghislainfourny Apr 8, 2021
9d3c0c2
Fix diff.
ghislainfourny Apr 8, 2021
89591c5
Take over from master.
ghislainfourny Apr 8, 2021
d8f6375
Revert catalogue.
ghislainfourny Apr 9, 2021
a728621
Merge.
ghislainfourny Apr 9, 2021
25a7700
Merge.
ghislainfourny Apr 9, 2021
db12e3b
Merge branch 'master' of github.com:RumbleDB/rumble into StaticTyping
ghislainfourny Apr 12, 2021
bbdb916
Fix.
ghislainfourny Apr 12, 2021
a1e5ff4
Restore file.
ghislainfourny Apr 12, 2021
87948c4
Restore.
ghislainfourny Apr 12, 2021
3e0eb05
Restore.
ghislainfourny Apr 12, 2021
874161b
Restore.
ghislainfourny Apr 12, 2021
ceda474
Restore.
ghislainfourny Apr 12, 2021
3e259cd
Fix.
ghislainfourny Apr 12, 2021
e0d68ed
Fix.
ghislainfourny Apr 12, 2021
1553bc5
Fix warnings.
ghislainfourny Apr 12, 2021
29c0fa5
Merge.
ghislainfourny Apr 12, 2021
08100b1
Merge branch 'master' into StaticTyping
ghislainfourny Apr 12, 2021
af5b4f6
Merge branch 'master' into StaticTyping
ghislainfourny Apr 12, 2021
b6a9e25
Merge branch 'master' into StaticTyping
ghislainfourny Apr 13, 2021
4cdfe29
Merge back.
ghislainfourny Apr 13, 2021
ca7c59f
Take over.
ghislainfourny Apr 13, 2021
0c9ca79
Fix.
ghislainfourny Apr 13, 2021
9696b45
Merge back.
ghislainfourny Apr 13, 2021
79bd410
Merge branch 'master' into StaticTyping
ghislainfourny Apr 13, 2021
adbfd1e
Merge.
ghislainfourny Apr 14, 2021
70c58e4
Merge branch 'master' into StaticTyping
ghislainfourny Apr 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ public RuntimeIterator visitFlowrExpression(FlworExpression expression, RuntimeI
argument
),
expression.getReturnClause().getHighestExecutionMode(this.visitorConfig),
expression.getReturnClause().getMetadata()
expression.getReturnClause().getMetadata(),
this.config.escapeBackticks()
);
runtimeIterator.setStaticContext(expression.getStaticContext());
return runtimeIterator;
Expand All @@ -236,7 +237,8 @@ private RuntimeTupleIterator visitFlowrClause(
forClause.isAllowEmpty(),
assignmentIterator,
forClause.getHighestExecutionMode(this.visitorConfig),
clause.getMetadata()
clause.getMetadata(),
this.config.escapeBackticks()
);
} else if (clause instanceof LetClause) {
LetClause letClause = (LetClause) clause;
Expand All @@ -247,7 +249,8 @@ private RuntimeTupleIterator visitFlowrClause(
letClause.getActualSequenceType(),
assignmentIterator,
letClause.getHighestExecutionMode(this.visitorConfig),
clause.getMetadata()
clause.getMetadata(),
this.config.escapeBackticks()
);
} else if (clause instanceof GroupByClause) {
List<GroupByClauseSparkIteratorExpression> groupingExpressions = new ArrayList<>();
Expand Down Expand Up @@ -306,7 +309,8 @@ private RuntimeTupleIterator visitFlowrClause(
previousIterator,
this.visit(((WhereClause) clause).getWhereExpression(), argument),
clause.getHighestExecutionMode(this.visitorConfig),
clause.getMetadata()
clause.getMetadata(),
this.config.escapeBackticks()
);
} else if (clause instanceof CountClause) {
return new CountClauseSparkIterator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public class ForClauseSparkIterator extends RuntimeTupleIterator {
private RuntimeIterator assignmentIterator;
private boolean allowingEmpty;
private DataFrameContext dataFrameContext;
private final boolean escapeBackticks;

// Computation state
private transient DynamicContext tupleContext; // re-use same DynamicContext object for efficiency
Expand All @@ -97,7 +98,8 @@ public ForClauseSparkIterator(
boolean allowingEmpty,
RuntimeIterator assignmentIterator,
ExecutionMode executionMode,
ExceptionMetadata iteratorMetadata
ExceptionMetadata iteratorMetadata,
boolean escapeBackticks
) {
super(child, executionMode, iteratorMetadata);
this.variableName = variableName;
Expand All @@ -106,6 +108,7 @@ public ForClauseSparkIterator(
this.allowingEmpty = allowingEmpty;
this.assignmentIterator.getVariableDependencies();
this.dataFrameContext = new DataFrameContext();
this.escapeBackticks = escapeBackticks;
}

public Name getVariableName() {
Expand Down Expand Up @@ -412,7 +415,8 @@ private Dataset<Row> getDataFrameFromJoin(
this.variableName,
this.positionalVariableName,
Name.CONTEXT_ITEM,
getMetadata()
getMetadata(),
this.escapeBackticks
);
}

Expand All @@ -427,7 +431,8 @@ public static Dataset<Row> joinInputTupleWithSequenceOnPredicate(
Name forVariableName,
Name positionalVariableName,
Name sequenceVariableName,
ExceptionMetadata metadata
ExceptionMetadata metadata,
boolean escapeBackticks
) {
String inputDFTableName = "inputTuples";
String expressionDFTableName = "sequenceExpression";
Expand Down Expand Up @@ -472,7 +477,8 @@ public static Dataset<Row> joinInputTupleWithSequenceOnPredicate(
Name.CONTEXT_POSITION,
false,
context,
startingClauseDependencies
startingClauseDependencies,
escapeBackticks
);
variablesInExpressionSideTuple.add(sequenceVariableName);
variablesInExpressionSideTuple.add(Name.CONTEXT_POSITION);
Expand All @@ -485,7 +491,8 @@ public static Dataset<Row> joinInputTupleWithSequenceOnPredicate(
null,
false,
context,
startingClauseDependencies
startingClauseDependencies,
escapeBackticks
);
variablesInExpressionSideTuple.add(sequenceVariableName);
}
Expand Down Expand Up @@ -1004,7 +1011,8 @@ private Dataset<Row> getDataFrameStartingClause(
this.positionalVariableName,
this.allowingEmpty,
context,
parentProjection
parentProjection,
this.escapeBackticks
);
}

Expand All @@ -1026,12 +1034,19 @@ public static Dataset<Row> getDataFrameStartingClause(
Name positionalVariableName,
boolean allowingEmpty,
DynamicContext context,
Map<Name, DynamicContext.VariableDependency> outputDependencies
Map<Name, DynamicContext.VariableDependency> outputDependencies,
boolean escapeBackticks
) {
Dataset<Row> df = null;;
if (iterator.isDataFrame()) {
Dataset<Row> rows = iterator.getDataFrame(context);

// escape backticks (`)
if (escapeBackticks) {
rows = rows.sparkSession()
.createDataFrame(rows.rdd(), FlworDataFrameUtils.escapeSchema(rows.schema(), false));
}

rows.createOrReplaceTempView("assignment");
if (DataFrameUtils.isSequenceOfObjects(rows)) {
String[] fields = rows.schema().fieldNames();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,22 @@ public class LetClauseSparkIterator extends RuntimeTupleIterator {
private RuntimeIterator assignmentIterator;
private DynamicContext tupleContext; // re-use same DynamicContext object for efficiency
private FlworTuple nextLocalTupleResult;
private final boolean escapeBackticks;

public LetClauseSparkIterator(
RuntimeTupleIterator child,
Name variableName,
SequenceType sequenceType,
RuntimeIterator assignmentIterator,
ExecutionMode executionMode,
ExceptionMetadata iteratorMetadata
ExceptionMetadata iteratorMetadata,
boolean escapeBackticks
) {
super(child, executionMode, iteratorMetadata);
this.variableName = variableName;
this.sequenceType = sequenceType;
this.assignmentIterator = assignmentIterator;
this.escapeBackticks = escapeBackticks;
}

@Override
Expand Down Expand Up @@ -319,7 +322,8 @@ public Dataset<Row> getDataFrameAsJoin(
null,
false,
context,
sequenceDependencies
sequenceDependencies,
this.escapeBackticks
);

System.err.println("[INFO] Rumble detected an equi-join in the left clause.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,19 @@ public class ReturnClauseSparkIterator extends HybridRuntimeIterator {
private DynamicContext tupleContext; // re-use same DynamicContext object for efficiency
private RuntimeIterator expression;
private Item nextResult;
private final boolean escapeBackticks;

public ReturnClauseSparkIterator(
RuntimeTupleIterator child,
RuntimeIterator expression,
ExecutionMode executionMode,
ExceptionMetadata iteratorMetadata
ExceptionMetadata iteratorMetadata,
boolean escapeBackticks
) {
super(Collections.singletonList(expression), executionMode, iteratorMetadata);
this.child = child;
this.expression = expression;
this.escapeBackticks = escapeBackticks;
}

@Override
Expand Down Expand Up @@ -109,6 +112,12 @@ public JavaRDD<Item> getRDDAux(DynamicContext context) {
}
}
Dataset<Row> df = this.child.getDataFrame(context, projection);

// unescape backticks (`)
if (this.escapeBackticks) {
df = df.sparkSession().createDataFrame(df.rdd(), FlworDataFrameUtils.escapeSchema(df.schema(), true));
}

StructType oldSchema = df.schema();
List<String> UDFcolumns = FlworDataFrameUtils.getColumnNames(
oldSchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,19 @@ public class WhereClauseSparkIterator extends RuntimeTupleIterator {
private RuntimeIterator expression;
private DynamicContext tupleContext; // re-use same DynamicContext object for efficiency
private FlworTuple nextLocalTupleResult;
private final boolean escapeBackticks;

public WhereClauseSparkIterator(
RuntimeTupleIterator child,
RuntimeIterator whereExpression,
ExecutionMode executionMode,
ExceptionMetadata iteratorMetadata
ExceptionMetadata iteratorMetadata,
boolean escapeBackticks
) {
super(child, executionMode, iteratorMetadata);
this.expression = whereExpression;
this.expression.getVariableDependencies();
this.escapeBackticks = escapeBackticks;
}

@Override
Expand Down Expand Up @@ -191,7 +194,8 @@ public Dataset<Row> getDataFrame(
forVariable,
null,
forVariable,
getMetadata()
getMetadata(),
this.escapeBackticks
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public static boolean doesItemTypeMatchItem(ItemType itemType, Item itemToMatch)
if (itemType.equals(BuiltinTypesCatalogue.base64BinaryItem)) {
return itemToMatch.isBase64Binary();
}
if (itemType.isFunctionItemType()) {
if (itemType.equals(BuiltinTypesCatalogue.anyFunctionItem)) {
return itemToMatch.isFunction();
}
throw new OurBadException("Type unrecognized: " + itemType);
Expand Down