Merge lp:~mmcm/akiban-server/query-bindings into lp:~akiban-technologies/akiban-server/trunk

Proposed by Mike McMahon
Status: Merged
Approved by: Nathan Williams
Approved revision: 2698
Merged at revision: 2689
Proposed branch: lp:~mmcm/akiban-server/query-bindings
Merge into: lp:~akiban-technologies/akiban-server/trunk
Diff against target: 14387 lines (+2222/-1614)
272 files modified
src/main/java/com/akiban/qp/exec/UpdatePlannable.java (+2/-1)
src/main/java/com/akiban/qp/expression/ExpressionRow.java (+4/-1)
src/main/java/com/akiban/qp/expression/IndexBound.java (+4/-3)
src/main/java/com/akiban/qp/expression/RowBasedUnboundExpressions.java (+5/-4)
src/main/java/com/akiban/qp/expression/UnboundExpressions.java (+2/-1)
src/main/java/com/akiban/qp/loadableplan/DirectObjectPlan.java (+2/-1)
src/main/java/com/akiban/qp/loadableplan/std/DumpGroupLoadablePlan.java (+14/-11)
src/main/java/com/akiban/qp/loadableplan/std/PersistitCLILoadablePlan.java (+8/-5)
src/main/java/com/akiban/qp/memoryadapter/MemoryAdapter.java (+3/-2)
src/main/java/com/akiban/qp/operator/API.java (+2/-2)
src/main/java/com/akiban/qp/operator/Aggregate_Partial.java (+5/-5)
src/main/java/com/akiban/qp/operator/AncestorLookup_Default.java (+4/-4)
src/main/java/com/akiban/qp/operator/AncestorLookup_Nested.java (+5/-5)
src/main/java/com/akiban/qp/operator/BranchLookup_Default.java (+4/-4)
src/main/java/com/akiban/qp/operator/BranchLookup_Nested.java (+5/-5)
src/main/java/com/akiban/qp/operator/ChainedCursor.java (+2/-2)
src/main/java/com/akiban/qp/operator/Count_Default.java (+4/-4)
src/main/java/com/akiban/qp/operator/Count_TableStatus.java (+4/-4)
src/main/java/com/akiban/qp/operator/Delete_Default.java (+4/-4)
src/main/java/com/akiban/qp/operator/Delete_Returning.java (+4/-4)
src/main/java/com/akiban/qp/operator/Distinct_Partial.java (+4/-4)
src/main/java/com/akiban/qp/operator/EmitBoundRow_Nested.java (+5/-5)
src/main/java/com/akiban/qp/operator/ExecutionBase.java (+3/-1)
src/main/java/com/akiban/qp/operator/Filter_Default.java (+4/-4)
src/main/java/com/akiban/qp/operator/Flatten_HKeyOrdered.java (+4/-4)
src/main/java/com/akiban/qp/operator/GroupScan_Default.java (+12/-11)
src/main/java/com/akiban/qp/operator/HKeyUnion_Ordered.java (+6/-6)
src/main/java/com/akiban/qp/operator/IfEmpty_Default.java (+7/-5)
src/main/java/com/akiban/qp/operator/IndexScan_Default.java (+5/-5)
src/main/java/com/akiban/qp/operator/Insert_Default.java (+4/-4)
src/main/java/com/akiban/qp/operator/Insert_Returning.java (+4/-4)
src/main/java/com/akiban/qp/operator/Intersect_Ordered.java (+6/-6)
src/main/java/com/akiban/qp/operator/Limit_Default.java (+8/-8)
src/main/java/com/akiban/qp/operator/Map_NestedLoops.java (+7/-7)
src/main/java/com/akiban/qp/operator/Operator.java (+1/-1)
src/main/java/com/akiban/qp/operator/OperatorExecutionBase.java (+2/-2)
src/main/java/com/akiban/qp/operator/Product_NestedLoops.java (+7/-7)
src/main/java/com/akiban/qp/operator/Project_Default.java (+5/-5)
src/main/java/com/akiban/qp/operator/QueryBindings.java (+110/-0)
src/main/java/com/akiban/qp/operator/QueryContext.java (+11/-83)
src/main/java/com/akiban/qp/operator/QueryContextBase.java (+5/-156)
src/main/java/com/akiban/qp/operator/Select_BloomFilter.java (+11/-11)
src/main/java/com/akiban/qp/operator/Select_HKeyOrdered.java (+10/-6)
src/main/java/com/akiban/qp/operator/Sort_General.java (+5/-5)
src/main/java/com/akiban/qp/operator/Sort_InsertionLimited.java (+7/-5)
src/main/java/com/akiban/qp/operator/SorterToCursorAdapter.java (+4/-1)
src/main/java/com/akiban/qp/operator/SparseArrayQueryBindings.java (+184/-0)
src/main/java/com/akiban/qp/operator/StoreAdapter.java (+2/-0)
src/main/java/com/akiban/qp/operator/UnionAll_Default.java (+5/-5)
src/main/java/com/akiban/qp/operator/Union_Ordered.java (+6/-6)
src/main/java/com/akiban/qp/operator/UpdateFunction.java (+2/-1)
src/main/java/com/akiban/qp/operator/Update_Default.java (+5/-5)
src/main/java/com/akiban/qp/operator/Update_Returning.java (+5/-5)
src/main/java/com/akiban/qp/operator/Using_BloomFilter.java (+7/-7)
src/main/java/com/akiban/qp/operator/ValuesScan_Default.java (+5/-5)
src/main/java/com/akiban/qp/persistitadapter/OperatorBasedRowCollector.java (+5/-1)
src/main/java/com/akiban/qp/persistitadapter/PersistitAdapter.java (+4/-2)
src/main/java/com/akiban/qp/persistitadapter/PersistitIndexCursor.java (+4/-1)
src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursor.java (+10/-6)
src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorMixedOrder.java (+9/-6)
src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorSpatial_InBox.java (+9/-7)
src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorSpatial_NearPoint.java (+8/-6)
src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorUnidirectional.java (+13/-9)
src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorUnidirectionalLexicographic.java (+7/-4)
src/main/java/com/akiban/qp/persistitadapter/indexcursor/MemorySorter.java (+5/-1)
src/main/java/com/akiban/qp/persistitadapter/indexcursor/OldSorterAdapter.java (+2/-1)
src/main/java/com/akiban/qp/persistitadapter/indexcursor/PValueSorterAdapter.java (+3/-1)
src/main/java/com/akiban/qp/persistitadapter/indexcursor/PersistitSorter.java (+6/-2)
src/main/java/com/akiban/qp/persistitadapter/indexcursor/SorterAdapter.java (+4/-3)
src/main/java/com/akiban/qp/row/BindableRow.java (+5/-4)
src/main/java/com/akiban/qp/row/ProjectedRow.java (+9/-3)
src/main/java/com/akiban/server/expression/ExpressionEvaluation.java (+8/-1)
src/main/java/com/akiban/server/expression/std/AbstractCompositeExpressionEvaluation.java (+15/-0)
src/main/java/com/akiban/server/expression/std/AbstractNoArgExpressionEvaluation.java (+5/-0)
src/main/java/com/akiban/server/expression/std/AbstractUnaryExpressionEvaluation.java (+8/-0)
src/main/java/com/akiban/server/expression/std/BoundFieldExpression.java (+6/-1)
src/main/java/com/akiban/server/expression/std/ColumnExpression.java (+5/-0)
src/main/java/com/akiban/server/expression/std/FieldExpression.java (+5/-0)
src/main/java/com/akiban/server/expression/std/LiteralExpression.java (+5/-0)
src/main/java/com/akiban/server/expression/std/SequenceCurrentValueExpression.java (+7/-0)
src/main/java/com/akiban/server/expression/std/SequenceNextValueExpression.java (+7/-0)
src/main/java/com/akiban/server/expression/std/ValueSourceExpression.java (+6/-0)
src/main/java/com/akiban/server/expression/std/VariableExpression.java (+8/-3)
src/main/java/com/akiban/server/expression/subquery/AnySubqueryExpression.java (+1/-0)
src/main/java/com/akiban/server/expression/subquery/ResultSetSubqueryExpression.java (+9/-2)
src/main/java/com/akiban/server/expression/subquery/ScalarSubqueryExpression.java (+1/-0)
src/main/java/com/akiban/server/expression/subquery/SubqueryExpressionEvaluation.java (+17/-2)
src/main/java/com/akiban/server/service/dxl/BasicDDLFunctions.java (+6/-2)
src/main/java/com/akiban/server/service/externaldata/ExternalDataServiceImpl.java (+5/-3)
src/main/java/com/akiban/server/service/restdml/DMLProcessor.java (+9/-11)
src/main/java/com/akiban/server/service/restdml/DeleteProcessor.java (+2/-2)
src/main/java/com/akiban/server/service/restdml/InsertProcessor.java (+7/-7)
src/main/java/com/akiban/server/service/restdml/ModelBuilder.java (+9/-4)
src/main/java/com/akiban/server/service/restdml/UpsertProcessor.java (+5/-5)
src/main/java/com/akiban/server/service/restdml/UpsertRowUpdateFunction.java (+3/-1)
src/main/java/com/akiban/server/service/text/FullTextIndexServiceImpl.java (+6/-3)
src/main/java/com/akiban/server/service/text/FullTextQueryBuilder.java (+10/-7)
src/main/java/com/akiban/server/service/text/FullTextQueryExpression.java (+2/-1)
src/main/java/com/akiban/server/service/text/IndexScan_FullText.java (+3/-2)
src/main/java/com/akiban/server/store/AbstractStore.java (+8/-4)
src/main/java/com/akiban/server/store/StoreGIMaintenance.java (+10/-8)
src/main/java/com/akiban/server/types3/texpressions/AnySubqueryTExpression.java (+1/-0)
src/main/java/com/akiban/server/types3/texpressions/ContextualEvaluation.java (+5/-0)
src/main/java/com/akiban/server/types3/texpressions/ResultSetSubqueryTExpression.java (+9/-2)
src/main/java/com/akiban/server/types3/texpressions/ScalarSubqueryTExpression.java (+1/-0)
src/main/java/com/akiban/server/types3/texpressions/SubqueryTEvaluateble.java (+17/-2)
src/main/java/com/akiban/server/types3/texpressions/TCastExpression.java (+6/-0)
src/main/java/com/akiban/server/types3/texpressions/TComparisonExpressionBase.java (+7/-0)
src/main/java/com/akiban/server/types3/texpressions/TEvaluatableExpression.java (+2/-0)
src/main/java/com/akiban/server/types3/texpressions/TNullExpression.java (+5/-0)
src/main/java/com/akiban/server/types3/texpressions/TPreparedBoundField.java (+6/-1)
src/main/java/com/akiban/server/types3/texpressions/TPreparedFunction.java (+10/-0)
src/main/java/com/akiban/server/types3/texpressions/TPreparedLiteral.java (+5/-0)
src/main/java/com/akiban/server/types3/texpressions/TPreparedParameter.java (+8/-1)
src/main/java/com/akiban/sql/embedded/ExecutableDDLStatement.java (+3/-1)
src/main/java/com/akiban/sql/embedded/ExecutableJavaMethod.java (+4/-2)
src/main/java/com/akiban/sql/embedded/ExecutableJavaRoutine.java (+5/-3)
src/main/java/com/akiban/sql/embedded/ExecutableLoadableOperator.java (+11/-10)
src/main/java/com/akiban/sql/embedded/ExecutableModifyOperatorStatement.java (+3/-2)
src/main/java/com/akiban/sql/embedded/ExecutableQueryOperatorStatement.java (+3/-2)
src/main/java/com/akiban/sql/embedded/ExecutableScriptBindingsRoutine.java (+3/-2)
src/main/java/com/akiban/sql/embedded/ExecutableScriptFunctionJavaRoutine.java (+3/-2)
src/main/java/com/akiban/sql/embedded/ExecutableStatement.java (+2/-1)
src/main/java/com/akiban/sql/embedded/JDBCPreparedStatement.java (+13/-10)
src/main/java/com/akiban/sql/embedded/JDBCStatement.java (+22/-15)
src/main/java/com/akiban/sql/optimizer/ExpressionRowUpdateFunction.java (+4/-1)
src/main/java/com/akiban/sql/pg/PostgresBoundQueryContext.java (+12/-2)
src/main/java/com/akiban/sql/pg/PostgresCloseCursorStatement.java (+3/-1)
src/main/java/com/akiban/sql/pg/PostgresCopyInStatement.java (+2/-1)
src/main/java/com/akiban/sql/pg/PostgresCopyOutStatement.java (+4/-3)
src/main/java/com/akiban/sql/pg/PostgresCursorGenerator.java (+2/-1)
src/main/java/com/akiban/sql/pg/PostgresDDLStatement.java (+3/-1)
src/main/java/com/akiban/sql/pg/PostgresDeclareStatement.java (+3/-1)
src/main/java/com/akiban/sql/pg/PostgresEmulatedMetaDataStatement.java (+2/-1)
src/main/java/com/akiban/sql/pg/PostgresExecuteStatement.java (+5/-4)
src/main/java/com/akiban/sql/pg/PostgresExplainStatement.java (+3/-1)
src/main/java/com/akiban/sql/pg/PostgresFetchStatement.java (+3/-1)
src/main/java/com/akiban/sql/pg/PostgresJavaMethod.java (+3/-2)
src/main/java/com/akiban/sql/pg/PostgresJavaRoutine.java (+8/-5)
src/main/java/com/akiban/sql/pg/PostgresLoadableDirectObjectPlan.java (+6/-5)
src/main/java/com/akiban/sql/pg/PostgresLoadableOperator.java (+4/-3)
src/main/java/com/akiban/sql/pg/PostgresLoadablePlan.java (+8/-7)
src/main/java/com/akiban/sql/pg/PostgresModifyOperatorStatement.java (+5/-4)
src/main/java/com/akiban/sql/pg/PostgresOperatorStatement.java (+4/-4)
src/main/java/com/akiban/sql/pg/PostgresPrepareStatement.java (+3/-1)
src/main/java/com/akiban/sql/pg/PostgresQueryContext.java (+3/-2)
src/main/java/com/akiban/sql/pg/PostgresScriptBindingsRoutine.java (+3/-2)
src/main/java/com/akiban/sql/pg/PostgresScriptFunctionJavaRoutine.java (+3/-2)
src/main/java/com/akiban/sql/pg/PostgresServerConnection.java (+24/-16)
src/main/java/com/akiban/sql/pg/PostgresServerStatement.java (+3/-1)
src/main/java/com/akiban/sql/pg/PostgresSessionStatement.java (+2/-1)
src/main/java/com/akiban/sql/pg/PostgresStatement.java (+3/-1)
src/main/java/com/akiban/sql/script/ScriptBindingsRoutine.java (+4/-2)
src/main/java/com/akiban/sql/script/ScriptBindingsRoutineExpression.java (+3/-1)
src/main/java/com/akiban/sql/script/ScriptBindingsRoutineTExpression.java (+3/-1)
src/main/java/com/akiban/sql/script/ScriptFunctionJavaRoutine.java (+3/-1)
src/main/java/com/akiban/sql/script/ScriptFunctionJavaRoutineExpression.java (+3/-1)
src/main/java/com/akiban/sql/script/ScriptFunctionJavaRoutineTExpression.java (+3/-1)
src/main/java/com/akiban/sql/server/ServerCallInvocation.java (+15/-12)
src/main/java/com/akiban/sql/server/ServerJavaMethod.java (+3/-1)
src/main/java/com/akiban/sql/server/ServerJavaMethodExpression.java (+3/-1)
src/main/java/com/akiban/sql/server/ServerJavaMethodTExpression.java (+3/-1)
src/main/java/com/akiban/sql/server/ServerJavaRoutine.java (+6/-2)
src/main/java/com/akiban/sql/server/ServerJavaRoutineExpressionEvaluation.java (+9/-4)
src/main/java/com/akiban/sql/server/ServerJavaRoutineTExpression.java (+15/-4)
src/main/java/com/akiban/sql/server/ServerQueryContext.java (+1/-0)
src/main/java/com/akiban/sql/server/ServerRoutineInvocation.java (+2/-1)
src/main/java/com/akiban/sql/server/ServerValueDecoder.java (+7/-6)
src/test/java/com/akiban/qp/loadableplan/std/PersistitCLILoadablePlanIT.java (+11/-9)
src/test/java/com/akiban/qp/operator/OperatorTestHelper.java (+5/-1)
src/test/java/com/akiban/qp/operator/TimeOperator.java (+5/-5)
src/test/java/com/akiban/server/expression/std/ComposedExpressionTestBase.java (+8/-3)
src/test/java/com/akiban/server/expression/std/ExprUtil.java (+5/-0)
src/test/java/com/akiban/server/service/text/FullTextIndexServiceIT.java (+11/-8)
src/test/java/com/akiban/server/test/ExpressionGenerators.java (+6/-0)
src/test/java/com/akiban/server/test/costmodel/CostModelBase.java (+2/-0)
src/test/java/com/akiban/server/test/costmodel/DistinctCT.java (+2/-1)
src/test/java/com/akiban/server/test/costmodel/FlattenCT.java (+2/-1)
src/test/java/com/akiban/server/test/costmodel/HKeyUnionCT.java (+2/-1)
src/test/java/com/akiban/server/test/costmodel/IntersectCT.java (+2/-1)
src/test/java/com/akiban/server/test/costmodel/MapCT.java (+2/-1)
src/test/java/com/akiban/server/test/costmodel/ProductCT.java (+4/-3)
src/test/java/com/akiban/server/test/costmodel/ProjectCT.java (+2/-1)
src/test/java/com/akiban/server/test/costmodel/SelectCT.java (+2/-1)
src/test/java/com/akiban/server/test/costmodel/Select_BloomFilterCT.java (+2/-1)
src/test/java/com/akiban/server/test/costmodel/SortCT.java (+3/-2)
src/test/java/com/akiban/server/test/costmodel/SortWithLimitCT.java (+2/-1)
src/test/java/com/akiban/server/test/costmodel/TreeScanCT.java (+4/-3)
src/test/java/com/akiban/server/test/it/dxl/AlterTableBasicIT.java (+8/-2)
src/test/java/com/akiban/server/test/it/qp/AncestorLookup_DefaultIT.java (+22/-22)
src/test/java/com/akiban/server/test/it/qp/AncestorLookup_NestedIT.java (+7/-6)
src/test/java/com/akiban/server/test/it/qp/BranchLookup_DefaultIT.java (+14/-14)
src/test/java/com/akiban/server/test/it/qp/BranchLookup_NestedIT.java (+7/-6)
src/test/java/com/akiban/server/test/it/qp/ConcurrentUpdateIT.java (+6/-4)
src/test/java/com/akiban/server/test/it/qp/CountIT.java (+2/-2)
src/test/java/com/akiban/server/test/it/qp/DeleteIT.java (+4/-4)
src/test/java/com/akiban/server/test/it/qp/Distinct_Partial_CaseInsensitive_IT.java (+13/-12)
src/test/java/com/akiban/server/test/it/qp/FilterIT.java (+7/-7)
src/test/java/com/akiban/server/test/it/qp/FlattenIT.java (+12/-12)
src/test/java/com/akiban/server/test/it/qp/FlattenLeftJoinIT.java (+14/-13)
src/test/java/com/akiban/server/test/it/qp/GroupIndexRowIT.java (+2/-1)
src/test/java/com/akiban/server/test/it/qp/GroupIndexScanIT.java (+3/-1)
src/test/java/com/akiban/server/test/it/qp/GroupScanIT.java (+5/-5)
src/test/java/com/akiban/server/test/it/qp/GroupSkipScanIT.java (+3/-2)
src/test/java/com/akiban/server/test/it/qp/HKeyUnion_OrderedIT.java (+13/-12)
src/test/java/com/akiban/server/test/it/qp/IfEmptyIT.java (+4/-4)
src/test/java/com/akiban/server/test/it/qp/IndexRowAndAncestorIT.java (+8/-7)
src/test/java/com/akiban/server/test/it/qp/IndexScanBoundedIT.java (+2/-1)
src/test/java/com/akiban/server/test/it/qp/IndexScanIT.java (+44/-44)
src/test/java/com/akiban/server/test/it/qp/IndexScanInvolvingUndeclaredColumnsIT.java (+2/-1)
src/test/java/com/akiban/server/test/it/qp/IndexScanJumpBoundedIT.java (+66/-65)
src/test/java/com/akiban/server/test/it/qp/IndexScanJumpUnboundedIT.java (+17/-16)
src/test/java/com/akiban/server/test/it/qp/IndexScanLexicographicIT.java (+2/-1)
src/test/java/com/akiban/server/test/it/qp/IndexScanNullIT.java (+2/-1)
src/test/java/com/akiban/server/test/it/qp/IndexScanUnboundedIT.java (+24/-23)
src/test/java/com/akiban/server/test/it/qp/InsertIT.java (+4/-4)
src/test/java/com/akiban/server/test/it/qp/Intersect_OrderedByteArrayComparisonIT.java (+25/-24)
src/test/java/com/akiban/server/test/it/qp/Intersect_OrderedIT.java (+49/-48)
src/test/java/com/akiban/server/test/it/qp/Intersect_OrderedSkipScanIT.java (+89/-88)
src/test/java/com/akiban/server/test/it/qp/Intersect_OrderedVsHKeyColumnEquivalenceIT.java (+2/-1)
src/test/java/com/akiban/server/test/it/qp/LimitIT.java (+10/-10)
src/test/java/com/akiban/server/test/it/qp/Map_NestedLoopsIT.java (+5/-5)
src/test/java/com/akiban/server/test/it/qp/MultiCursorIT.java (+1/-0)
src/test/java/com/akiban/server/test/it/qp/MultiIndexCrossBranchIT.java (+13/-12)
src/test/java/com/akiban/server/test/it/qp/NWaySkipScanIT.java (+25/-24)
src/test/java/com/akiban/server/test/it/qp/NonRootPKIndexScanIT.java (+11/-10)
src/test/java/com/akiban/server/test/it/qp/OperatorIT.java (+12/-12)
src/test/java/com/akiban/server/test/it/qp/OperatorITBase.java (+6/-3)
src/test/java/com/akiban/server/test/it/qp/OrphanResolutionIT.java (+3/-2)
src/test/java/com/akiban/server/test/it/qp/ParentAndChildSkipScanIT.java (+5/-4)
src/test/java/com/akiban/server/test/it/qp/Product3WayIT.java (+4/-3)
src/test/java/com/akiban/server/test/it/qp/Product_NestedLoopsIT.java (+3/-3)
src/test/java/com/akiban/server/test/it/qp/ProjectIT.java (+3/-3)
src/test/java/com/akiban/server/test/it/qp/QueryTimeoutIT.java (+8/-8)
src/test/java/com/akiban/server/test/it/qp/SelectIT.java (+3/-3)
src/test/java/com/akiban/server/test/it/qp/Select_BloomFilterIT.java (+10/-9)
src/test/java/com/akiban/server/test/it/qp/Select_BloomFilter_CaseInsensitive_IT.java (+10/-9)
src/test/java/com/akiban/server/test/it/qp/SkipScanPerformanceIT.java (+3/-2)
src/test/java/com/akiban/server/test/it/qp/Sort_GeneralIT.java (+14/-14)
src/test/java/com/akiban/server/test/it/qp/Sort_General_LargeKeyIT.java (+2/-1)
src/test/java/com/akiban/server/test/it/qp/Sort_General_RandomIT.java (+2/-1)
src/test/java/com/akiban/server/test/it/qp/Sort_InsertionLimitedIT.java (+16/-16)
src/test/java/com/akiban/server/test/it/qp/Sort_MixedColumnTypesIT.java (+3/-1)
src/test/java/com/akiban/server/test/it/qp/SpatialLatLonGroupIndexScanIT.java (+10/-9)
src/test/java/com/akiban/server/test/it/qp/SpatialLatLonTableIndexScanIT.java (+20/-19)
src/test/java/com/akiban/server/test/it/qp/UnionAll_DefaultIT.java (+6/-5)
src/test/java/com/akiban/server/test/it/qp/Union_OrderedIT.java (+12/-11)
src/test/java/com/akiban/server/test/it/qp/UniqueIndexJumpUnboundedCompositeKeyIT.java (+2/-1)
src/test/java/com/akiban/server/test/it/qp/UniqueIndexScanIT.java (+53/-52)
src/test/java/com/akiban/server/test/it/qp/UniqueIndexScanJumpBoundedUnboundedWithNulls2IT.java (+2/-1)
src/test/java/com/akiban/server/test/it/qp/UniqueIndexScanJumpBoundedWithNullsIT.java (+2/-1)
src/test/java/com/akiban/server/test/it/qp/UniqueIndexScanJumpUnboundedIT.java (+17/-16)
src/test/java/com/akiban/server/test/it/qp/UniqueIndexScanJumpUnboundedWithNullsIT.java (+2/-1)
src/test/java/com/akiban/server/test/it/qp/UniqueIndexScanUnboundedIT.java (+24/-23)
src/test/java/com/akiban/server/test/it/qp/UniqueIndexUpdateIT.java (+6/-5)
src/test/java/com/akiban/server/test/it/qp/UpdateIT.java (+15/-14)
src/test/java/com/akiban/server/test/it/routines/TestDirectAsync.java (+7/-4)
src/test/java/com/akiban/server/test/it/routines/TestDirectPlan.java (+7/-4)
src/test/java/com/akiban/server/test/it/sort/MemorySorterIT.java (+3/-1)
src/test/java/com/akiban/server/test/it/sort/PersistitSorterIT.java (+3/-1)
src/test/java/com/akiban/server/test/it/sort/PersistitSorterOverflowIT.java (+4/-2)
src/test/java/com/akiban/server/test/it/sort/SorterITBase.java (+5/-2)
src/test/java/com/akiban/server/test/pt/AggregatePT.java (+20/-14)
src/test/java/com/akiban/server/test/pt/gi/GIUpdateProfilePT.java (+4/-1)
src/test/java/com/akiban/server/test/pt/qp/GroupScanProfilePT.java (+2/-1)
src/test/java/com/akiban/server/test/pt/qp/HKeyChangePropagationCascadedKeysProfilePT.java (+4/-2)
src/test/java/com/akiban/server/test/pt/qp/HKeyChangePropagationProfilePT.java (+8/-6)
src/test/java/com/akiban/server/test/pt/qp/IndexScanPT.java (+2/-1)
src/test/java/com/akiban/server/test/pt/qp/QPProfilePTBase.java (+2/-0)
src/test/java/com/akiban/server/test/pt/qp/SimpleJoinPT.java (+2/-1)
src/test/java/com/akiban/server/test/pt/qp/SortPT.java (+2/-1)
src/test/java/com/akiban/sql/pg/DumpGroupLoadablePlanIT.java (+9/-7)
To merge this branch: bzr merge lp:~mmcm/akiban-server/query-bindings
Reviewer Review Type Date Requested Status
Nathan Williams Approve
Review via email: mp+173843@code.launchpad.net

Description of the change

Split off QueryBindings from QueryContext.

All the binding-related methods are on the new object and the context is now just the context proper, giving access to the current date, connection environment, etc. A context does not have any bindings, even at top level, but for convenience it can create them using the only implementation class yet.

A majority of methods that take a context now need a context and bindings, or have a similar method that takes the other one. This makes the diff pretty large, but fairly stylized.

Because the bindings have pretty much the same lifetime as the context, and there is only ever one set per context, this would all be pointless if it did not set the stage for more changes, which will allow for a stream of contexts along the same path as the stream of rows.

The next branch will change many of these same places again for the streams. If you could prefer, I can mark this WIP and remove the prereq from the other branch so that they only need to be reviewed once. However, the next branch has more substantial changes to the semantics, so I myself think it's clearer this way.

Also there is no urgency in getting this in, if we want to wait until the latency hiding that will actually make use of it all is working.

To post a comment you must log in.
Revision history for this message
Nathan Williams (nwilliams) wrote :

Looks as described, with the same type of changes everywhere.

Given the likelihood for conflicts and very low risk, pushing it through now makes sense to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/main/java/com/akiban/qp/exec/UpdatePlannable.java'
2--- src/main/java/com/akiban/qp/exec/UpdatePlannable.java 2013-03-22 20:05:57 +0000
3+++ src/main/java/com/akiban/qp/exec/UpdatePlannable.java 2013-07-09 23:55:31 +0000
4@@ -17,8 +17,9 @@
5
6 package com.akiban.qp.exec;
7
8+import com.akiban.qp.operator.QueryBindings;
9 import com.akiban.qp.operator.QueryContext;
10
11 public interface UpdatePlannable extends Plannable {
12- UpdateResult run(QueryContext context);
13+ UpdateResult run(QueryContext context, QueryBindings bindings);
14 }
15
16=== modified file 'src/main/java/com/akiban/qp/expression/ExpressionRow.java'
17--- src/main/java/com/akiban/qp/expression/ExpressionRow.java 2013-03-22 20:05:57 +0000
18+++ src/main/java/com/akiban/qp/expression/ExpressionRow.java 2013-07-09 23:55:31 +0000
19@@ -20,6 +20,7 @@
20 import java.util.ArrayList;
21 import java.util.List;
22
23+import com.akiban.qp.operator.QueryBindings;
24 import com.akiban.qp.operator.QueryContext;
25 import com.akiban.qp.row.AbstractRow;
26 import com.akiban.qp.row.HKey;
27@@ -40,7 +41,7 @@
28 private List<? extends TPreparedExpression> pExpressions;
29 private List<TEvaluatableExpression> pEvaluations;
30
31- public ExpressionRow(RowType rowType, QueryContext context, List<? extends Expression> expressions,
32+ public ExpressionRow(RowType rowType, QueryContext context, QueryBindings bindings, List<? extends Expression> expressions,
33 List<? extends TPreparedExpression> pExpressions) {
34 this.rowType = rowType;
35 this.expressions = expressions;
36@@ -51,6 +52,7 @@
37 for (TPreparedExpression expression : pExpressions) {
38 TEvaluatableExpression evaluation = expression.build();
39 evaluation.with(context);
40+ evaluation.with(bindings);
41 this.pEvaluations.add(evaluation);
42 }
43 }
44@@ -62,6 +64,7 @@
45 }
46 ExpressionEvaluation evaluation = expression.evaluation();
47 evaluation.of(context);
48+ evaluation.of(bindings);
49 this.evaluations.add(evaluation);
50 }
51 }
52
53=== modified file 'src/main/java/com/akiban/qp/expression/IndexBound.java'
54--- src/main/java/com/akiban/qp/expression/IndexBound.java 2013-03-22 20:05:57 +0000
55+++ src/main/java/com/akiban/qp/expression/IndexBound.java 2013-07-09 23:55:31 +0000
56@@ -17,6 +17,7 @@
57
58 package com.akiban.qp.expression;
59
60+import com.akiban.qp.operator.QueryBindings;
61 import com.akiban.qp.operator.QueryContext;
62 import com.akiban.server.api.dml.ColumnSelector;
63 import com.akiban.server.explain.ExplainContext;
64@@ -29,9 +30,9 @@
65 return String.valueOf(unboundExpressions);
66 }
67
68- public BoundExpressions boundExpressions(QueryContext context)
69+ public BoundExpressions boundExpressions(QueryContext context, QueryBindings bindings)
70 {
71- return unboundExpressions.get(context);
72+ return unboundExpressions.get(context, bindings);
73 }
74
75 public ColumnSelector columnSelector()
76@@ -64,7 +65,7 @@
77 private static class PreBoundExpressions implements UnboundExpressions {
78
79 @Override
80- public BoundExpressions get(QueryContext context) {
81+ public BoundExpressions get(QueryContext context, QueryBindings bindings) {
82 return expressions;
83 }
84
85
86=== modified file 'src/main/java/com/akiban/qp/expression/RowBasedUnboundExpressions.java'
87--- src/main/java/com/akiban/qp/expression/RowBasedUnboundExpressions.java 2013-03-22 20:05:57 +0000
88+++ src/main/java/com/akiban/qp/expression/RowBasedUnboundExpressions.java 2013-07-09 23:55:31 +0000
89@@ -19,6 +19,7 @@
90
91 import com.akiban.qp.operator.API;
92 import com.akiban.qp.operator.ExpressionGenerator;
93+import com.akiban.qp.operator.QueryBindings;
94 import com.akiban.qp.operator.QueryContext;
95 import com.akiban.qp.rowtype.RowType;
96 import com.akiban.server.explain.Attributes;
97@@ -35,8 +36,8 @@
98
99 public final class RowBasedUnboundExpressions implements UnboundExpressions {
100 @Override
101- public BoundExpressions get(QueryContext context) {
102- return new ExpressionsAndBindings(rowType, expressions, pExprs, context);
103+ public BoundExpressions get(QueryContext context, QueryBindings bindings) {
104+ return new ExpressionsAndBindings(rowType, expressions, pExprs, context, bindings);
105 }
106
107 @Override
108@@ -106,9 +107,9 @@
109 }
110
111 ExpressionsAndBindings(RowType rowType, List<Expression> expressions, List<TPreparedExpression> pExprs,
112- QueryContext context)
113+ QueryContext context, QueryBindings bindings)
114 {
115- expressionRow = new ExpressionRow(rowType, context, expressions, pExprs);
116+ expressionRow = new ExpressionRow(rowType, context, bindings, expressions, pExprs);
117 }
118
119 private final ExpressionRow expressionRow;
120
121=== modified file 'src/main/java/com/akiban/qp/expression/UnboundExpressions.java'
122--- src/main/java/com/akiban/qp/expression/UnboundExpressions.java 2013-03-22 20:05:57 +0000
123+++ src/main/java/com/akiban/qp/expression/UnboundExpressions.java 2013-07-09 23:55:31 +0000
124@@ -17,11 +17,12 @@
125
126 package com.akiban.qp.expression;
127
128+import com.akiban.qp.operator.QueryBindings;
129 import com.akiban.qp.operator.QueryContext;
130 import com.akiban.server.explain.ExplainContext;
131 import com.akiban.server.explain.CompoundExplainer;
132
133 public interface UnboundExpressions {
134- BoundExpressions get(QueryContext context);
135+ BoundExpressions get(QueryContext context, QueryBindings bindings);
136 CompoundExplainer getExplainer(ExplainContext context);
137 }
138
139=== modified file 'src/main/java/com/akiban/qp/loadableplan/DirectObjectPlan.java'
140--- src/main/java/com/akiban/qp/loadableplan/DirectObjectPlan.java 2013-03-22 20:05:57 +0000
141+++ src/main/java/com/akiban/qp/loadableplan/DirectObjectPlan.java 2013-07-09 23:55:31 +0000
142@@ -17,12 +17,13 @@
143
144 package com.akiban.qp.loadableplan;
145
146+import com.akiban.qp.operator.QueryBindings;
147 import com.akiban.qp.operator.QueryContext;
148
149 /** A plan that uses a {@link DirectObjectCursor}. */
150 public abstract class DirectObjectPlan
151 {
152- public abstract DirectObjectCursor cursor(QueryContext context);
153+ public abstract DirectObjectCursor cursor(QueryContext context, QueryBindings bindings);
154
155 public enum OutputMode { TABLE, COPY_WITH_NEWLINE, COPY };
156
157
158=== modified file 'src/main/java/com/akiban/qp/loadableplan/std/DumpGroupLoadablePlan.java'
159--- src/main/java/com/akiban/qp/loadableplan/std/DumpGroupLoadablePlan.java 2013-03-22 20:05:57 +0000
160+++ src/main/java/com/akiban/qp/loadableplan/std/DumpGroupLoadablePlan.java 2013-07-09 23:55:31 +0000
161@@ -24,6 +24,7 @@
162 import com.akiban.qp.loadableplan.LoadableDirectObjectPlan;
163 import com.akiban.qp.operator.BindingNotSetException;
164 import com.akiban.qp.operator.Cursor;
165+import com.akiban.qp.operator.QueryBindings;
166 import com.akiban.qp.operator.QueryContext;
167 import com.akiban.qp.row.Row;
168 import com.akiban.qp.rowtype.RowType;
169@@ -48,8 +49,8 @@
170 return new DirectObjectPlan() {
171
172 @Override
173- public DirectObjectCursor cursor(QueryContext context) {
174- return new DumpGroupDirectObjectCursor(context);
175+ public DirectObjectCursor cursor(QueryContext context, QueryBindings bindings) {
176+ return new DumpGroupDirectObjectCursor(context, bindings);
177 }
178
179 @Override
180@@ -65,6 +66,7 @@
181
182 public static class DumpGroupDirectObjectCursor extends DirectObjectCursor {
183 private final QueryContext context;
184+ private final QueryBindings bindings;
185 private UserTable rootTable;
186 private Cursor cursor;
187 private Map<UserTable,Integer> tableSizes;
188@@ -72,8 +74,9 @@
189 private GroupRowFormatter formatter;
190 private int messagesSent;
191
192- public DumpGroupDirectObjectCursor(QueryContext context) {
193+ public DumpGroupDirectObjectCursor(QueryContext context, QueryBindings bindings) {
194 this.context = context;
195+ this.bindings = bindings;
196 }
197
198 @Override
199@@ -81,18 +84,18 @@
200 String currentSchema = context.getCurrentSchema();
201 String schemaName, tableName;
202 if (Types3Switch.ON) {
203- if (context.getPValue(0).isNull())
204+ if (bindings.getPValue(0).isNull())
205 schemaName = currentSchema;
206 else
207- schemaName = context.getPValue(0).getString();
208- tableName = context.getPValue(1).getString();
209+ schemaName = bindings.getPValue(0).getString();
210+ tableName = bindings.getPValue(1).getString();
211 }
212 else {
213- if (context.getValue(0).isNull())
214+ if (bindings.getValue(0).isNull())
215 schemaName = currentSchema;
216 else
217- schemaName = context.getValue(0).getString();
218- tableName = context.getValue(1).getString();
219+ schemaName = bindings.getValue(0).getString();
220+ tableName = bindings.getValue(1).getString();
221 }
222 rootTable = context.getStore().schema().ais()
223 .getUserTable(schemaName, tableName);
224@@ -106,10 +109,10 @@
225 int insertMaxRowCount;
226 try {
227 if (Types3Switch.ON) {
228- insertMaxRowCount = context.getPValue(2).getInt32();
229+ insertMaxRowCount = bindings.getPValue(2).getInt32();
230 }
231 else {
232- insertMaxRowCount = (int)context.getValue(2).getLong();
233+ insertMaxRowCount = (int)bindings.getValue(2).getLong();
234 }
235 }
236 catch (BindingNotSetException ex) {
237
238=== modified file 'src/main/java/com/akiban/qp/loadableplan/std/PersistitCLILoadablePlan.java'
239--- src/main/java/com/akiban/qp/loadableplan/std/PersistitCLILoadablePlan.java 2013-03-22 20:05:57 +0000
240+++ src/main/java/com/akiban/qp/loadableplan/std/PersistitCLILoadablePlan.java 2013-07-09 23:55:31 +0000
241@@ -27,6 +27,7 @@
242 import com.akiban.qp.loadableplan.DirectObjectPlan;
243 import com.akiban.qp.loadableplan.LoadableDirectObjectPlan;
244 import com.akiban.qp.operator.BindingNotSetException;
245+import com.akiban.qp.operator.QueryBindings;
246 import com.akiban.qp.operator.QueryContext;
247 import com.akiban.qp.persistitadapter.PersistitAdapter;
248 import com.akiban.server.error.AkibanInternalException;
249@@ -48,8 +49,8 @@
250 return new DirectObjectPlan() {
251
252 @Override
253- public DirectObjectCursor cursor(QueryContext context) {
254- return new PersistitCliDirectObjectCursor(context);
255+ public DirectObjectCursor cursor(QueryContext context, QueryBindings bindings) {
256+ return new PersistitCliDirectObjectCursor(context, bindings);
257 }
258
259 @Override
260@@ -61,6 +62,7 @@
261
262 public static class PersistitCliDirectObjectCursor extends DirectObjectCursor {
263 final QueryContext context;
264+ final QueryBindings bindings;
265 final Persistit db;
266 final Session session;
267 boolean done = false;
268@@ -68,8 +70,9 @@
269 long taskId;
270 ArrayList<String> messages = new ArrayList<>();
271
272- public PersistitCliDirectObjectCursor(QueryContext context) {
273+ public PersistitCliDirectObjectCursor(QueryContext context, QueryBindings bindings) {
274 this.context = context;
275+ this.bindings = bindings;
276 this.db = ((PersistitAdapter)context.getStore()).persistit().getDb();
277 this.session = context.getSession();
278 }
279@@ -81,9 +84,9 @@
280 String carg;
281 try {
282 if (Types3Switch.ON)
283- carg = context.getPValue(i).getString();
284+ carg = bindings.getPValue(i).getString();
285 else
286- carg = context.getValue(i).getString();
287+ carg = bindings.getValue(i).getString();
288 } catch (BindingNotSetException ex) {
289 break;
290 }
291
292=== modified file 'src/main/java/com/akiban/qp/memoryadapter/MemoryAdapter.java'
293--- src/main/java/com/akiban/qp/memoryadapter/MemoryAdapter.java 2013-07-05 21:42:55 +0000
294+++ src/main/java/com/akiban/qp/memoryadapter/MemoryAdapter.java 2013-07-09 23:55:31 +0000
295@@ -26,6 +26,7 @@
296 import com.akiban.qp.operator.Cursor;
297 import com.akiban.qp.operator.GroupCursor;
298 import com.akiban.qp.operator.IndexScanSelector;
299+import com.akiban.qp.operator.QueryBindings;
300 import com.akiban.qp.operator.QueryContext;
301 import com.akiban.qp.operator.StoreAdapter;
302 import com.akiban.qp.operator.API.Ordering;
303@@ -71,7 +72,7 @@
304 }
305
306 @Override
307- public Cursor newIndexCursor(QueryContext context, Index index,
308+ public Cursor newIndexCursor(QueryContext context, QueryBindings bindings, Index index,
309 IndexKeyRange keyRange, Ordering ordering,
310 IndexScanSelector scanSelector, boolean usePValues) {
311
312@@ -92,7 +93,7 @@
313 }
314
315 @Override
316- public Sorter createSorter(QueryContext context, Cursor input, RowType rowType,
317+ public Sorter createSorter(QueryContext context, QueryBindings bindings, Cursor input, RowType rowType,
318 Ordering ordering, SortOption sortOption, InOutTap loadTap) {
319 throw new UnsupportedOperationException();
320 }
321
322=== modified file 'src/main/java/com/akiban/qp/operator/API.java'
323--- src/main/java/com/akiban/qp/operator/API.java 2013-07-02 21:23:43 +0000
324+++ src/main/java/com/akiban/qp/operator/API.java 2013-07-09 23:55:31 +0000
325@@ -738,10 +738,10 @@
326
327 // Execution interface
328
329- public static Cursor cursor(Operator root, QueryContext context)
330+ public static Cursor cursor(Operator root, QueryContext context, QueryBindings bindings)
331 {
332 // if all they need is the wrapped cursor, create it directly
333- return new ChainedCursor(context, root.cursor(context));
334+ return new ChainedCursor(context, bindings, root.cursor(context, bindings));
335 }
336
337 // Options
338
339=== modified file 'src/main/java/com/akiban/qp/operator/Aggregate_Partial.java'
340--- src/main/java/com/akiban/qp/operator/Aggregate_Partial.java 2013-03-22 20:05:57 +0000
341+++ src/main/java/com/akiban/qp/operator/Aggregate_Partial.java 2013-07-09 23:55:31 +0000
342@@ -165,7 +165,7 @@
343 // Operator interface
344
345 @Override
346- protected Cursor cursor(QueryContext context) {
347+ protected Cursor cursor(QueryContext context, QueryBindings bindings) {
348 final List<Aggregator> aggregators;
349 if (aggregatorFactories != null) {
350 aggregators = new ArrayList<>();
351@@ -182,7 +182,7 @@
352 aggregators = null;
353 }
354 return new AggregateCursor(
355- context,
356+ context, bindings,
357 aggregators
358 );
359 }
360@@ -641,10 +641,10 @@
361
362 // AggregateCursor interface
363
364- private AggregateCursor(QueryContext context,
365+ private AggregateCursor(QueryContext context, QueryBindings bindings,
366 List<Aggregator> aggregators) {
367- super(context);
368- this.inputCursor = inputOperator.cursor(context);
369+ super(context, bindings);
370+ this.inputCursor = inputOperator.cursor(context, bindings);
371 this.aggregators = aggregators;
372 if (aggregators != null) {
373 keyValues = new ArrayList<>();
374
375=== modified file 'src/main/java/com/akiban/qp/operator/AncestorLookup_Default.java'
376--- src/main/java/com/akiban/qp/operator/AncestorLookup_Default.java 2013-03-22 20:05:57 +0000
377+++ src/main/java/com/akiban/qp/operator/AncestorLookup_Default.java 2013-07-09 23:55:31 +0000
378@@ -131,9 +131,9 @@
379 }
380
381 @Override
382- protected Cursor cursor(QueryContext context)
383+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
384 {
385- return new Execution(context, inputOperator.cursor(context));
386+ return new Execution(context, bindings, inputOperator.cursor(context, bindings));
387 }
388
389 @Override
390@@ -333,9 +333,9 @@
391
392 // Execution interface
393
394- Execution(QueryContext context, Cursor input)
395+ Execution(QueryContext context, QueryBindings bindings, Cursor input)
396 {
397- super(context);
398+ super(context, bindings);
399 this.input = input;
400 // Why + 1: Because the input row (whose ancestors get discovered) also goes into pending.
401 this.pending = new PendingRows(ancestors.size() + 1);
402
403=== modified file 'src/main/java/com/akiban/qp/operator/AncestorLookup_Nested.java'
404--- src/main/java/com/akiban/qp/operator/AncestorLookup_Nested.java 2013-03-22 20:05:57 +0000
405+++ src/main/java/com/akiban/qp/operator/AncestorLookup_Nested.java 2013-07-09 23:55:31 +0000
406@@ -129,9 +129,9 @@
407 }
408
409 @Override
410- protected Cursor cursor(QueryContext context)
411+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
412 {
413- return new Execution(context);
414+ return new Execution(context, bindings);
415 }
416
417 @Override
418@@ -245,7 +245,7 @@
419 TAP_OPEN.in();
420 try {
421 CursorLifecycle.checkIdle(this);
422- Row rowFromBindings = context.getRow(inputBindingPosition);
423+ Row rowFromBindings = bindings.getRow(inputBindingPosition);
424 if (LOG_EXECUTION) {
425 LOG.debug("AncestorLookup_Nested: open using {}", rowFromBindings);
426 }
427@@ -320,9 +320,9 @@
428
429 // Execution interface
430
431- Execution(QueryContext context)
432+ Execution(QueryContext context, QueryBindings bindings)
433 {
434- super(context);
435+ super(context, bindings);
436 this.pending = new PendingRows(ancestors.size() + 1);
437 this.ancestorCursor = adapter().newGroupCursor(group);
438 }
439
440=== modified file 'src/main/java/com/akiban/qp/operator/BranchLookup_Default.java'
441--- src/main/java/com/akiban/qp/operator/BranchLookup_Default.java 2013-03-22 20:05:57 +0000
442+++ src/main/java/com/akiban/qp/operator/BranchLookup_Default.java 2013-07-09 23:55:31 +0000
443@@ -162,9 +162,9 @@
444 }
445
446 @Override
447- public Cursor cursor(QueryContext context)
448+ public Cursor cursor(QueryContext context, QueryBindings bindings)
449 {
450- return new Execution(context, inputOperator.cursor(context));
451+ return new Execution(context, bindings, inputOperator.cursor(context, bindings));
452 }
453
454 @Override
455@@ -407,9 +407,9 @@
456
457 // Execution interface
458
459- Execution(QueryContext context, Cursor input)
460+ Execution(QueryContext context, QueryBindings bindings, Cursor input)
461 {
462- super(context);
463+ super(context, bindings);
464 this.inputCursor = input;
465 this.lookupCursor = adapter().newGroupCursor(group);
466 this.lookupRowHKey = adapter().newHKey(outputRowType.hKey());
467
468=== modified file 'src/main/java/com/akiban/qp/operator/BranchLookup_Nested.java'
469--- src/main/java/com/akiban/qp/operator/BranchLookup_Nested.java 2013-03-22 20:05:57 +0000
470+++ src/main/java/com/akiban/qp/operator/BranchLookup_Nested.java 2013-07-09 23:55:31 +0000
471@@ -148,9 +148,9 @@
472 }
473
474 @Override
475- public Cursor cursor(QueryContext context)
476+ public Cursor cursor(QueryContext context, QueryBindings bindings)
477 {
478- return new Execution(context);
479+ return new Execution(context, bindings);
480 }
481
482 @Override
483@@ -295,7 +295,7 @@
484 TAP_OPEN.in();
485 try {
486 CursorLifecycle.checkIdle(this);
487- Row rowFromBindings = context.getRow(inputBindingPosition);
488+ Row rowFromBindings = bindings.getRow(inputBindingPosition);
489 if (LOG_EXECUTION) {
490 LOG.debug("BranchLookup_Nested: open using {}", rowFromBindings);
491 }
492@@ -383,9 +383,9 @@
493
494 // Execution interface
495
496- Execution(QueryContext context)
497+ Execution(QueryContext context, QueryBindings bindings)
498 {
499- super(context);
500+ super(context, bindings);
501 this.cursor = adapter().newGroupCursor(group);
502 this.hKey = adapter().newHKey(outputRowType.hKey());
503 }
504
505=== modified file 'src/main/java/com/akiban/qp/operator/ChainedCursor.java'
506--- src/main/java/com/akiban/qp/operator/ChainedCursor.java 2013-03-22 20:05:57 +0000
507+++ src/main/java/com/akiban/qp/operator/ChainedCursor.java 2013-07-09 23:55:31 +0000
508@@ -24,8 +24,8 @@
509 {
510 protected final Cursor input;
511
512- protected ChainedCursor(QueryContext context, Cursor input) {
513- super(context);
514+ protected ChainedCursor(QueryContext context, QueryBindings bindings, Cursor input) {
515+ super(context, bindings);
516 this.input = input;
517 }
518
519
520=== modified file 'src/main/java/com/akiban/qp/operator/Count_Default.java'
521--- src/main/java/com/akiban/qp/operator/Count_Default.java 2013-03-22 20:05:57 +0000
522+++ src/main/java/com/akiban/qp/operator/Count_Default.java 2013-07-09 23:55:31 +0000
523@@ -93,9 +93,9 @@
524 }
525
526 @Override
527- protected Cursor cursor(QueryContext context)
528+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
529 {
530- return new Execution(context, inputOperator.cursor(context));
531+ return new Execution(context, bindings, inputOperator.cursor(context, bindings));
532 }
533
534 @Override
535@@ -241,9 +241,9 @@
536
537 // Execution interface
538
539- Execution(QueryContext context, Cursor input)
540+ Execution(QueryContext context, QueryBindings bindings, Cursor input)
541 {
542- super(context);
543+ super(context, bindings);
544 this.input = input;
545 }
546
547
548=== modified file 'src/main/java/com/akiban/qp/operator/Count_TableStatus.java'
549--- src/main/java/com/akiban/qp/operator/Count_TableStatus.java 2013-06-10 15:32:10 +0000
550+++ src/main/java/com/akiban/qp/operator/Count_TableStatus.java 2013-07-09 23:55:31 +0000
551@@ -86,9 +86,9 @@
552 // Operator interface
553
554 @Override
555- protected Cursor cursor(QueryContext context)
556+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
557 {
558- return new Execution(context);
559+ return new Execution(context, bindings);
560 }
561
562 @Override
563@@ -219,9 +219,9 @@
564
565 // Execution interface
566
567- Execution(QueryContext context)
568+ Execution(QueryContext context, QueryBindings bindings)
569 {
570- super(context);
571+ super(context, bindings);
572 }
573
574 // Object state
575
576=== modified file 'src/main/java/com/akiban/qp/operator/Delete_Default.java'
577--- src/main/java/com/akiban/qp/operator/Delete_Default.java 2013-03-22 20:05:57 +0000
578+++ src/main/java/com/akiban/qp/operator/Delete_Default.java 2013-07-09 23:55:31 +0000
579@@ -117,8 +117,8 @@
580 }
581
582 @Override
583- public UpdateResult run(QueryContext context) {
584- return new Execution(context, inputOperator.cursor(context)).run();
585+ public UpdateResult run(QueryContext context, QueryBindings bindings) {
586+ return new Execution(context, bindings, inputOperator.cursor(context, bindings)).run();
587 }
588
589 @Override
590@@ -174,9 +174,9 @@
591 return new StandardUpdateResult(seen, modified);
592 }
593
594- protected Execution(QueryContext queryContext, Cursor input)
595+ protected Execution(QueryContext queryContext, QueryBindings bindings, Cursor input)
596 {
597- super(queryContext);
598+ super(queryContext, bindings);
599 this.input = input;
600 }
601
602
603=== modified file 'src/main/java/com/akiban/qp/operator/Delete_Returning.java'
604--- src/main/java/com/akiban/qp/operator/Delete_Returning.java 2013-03-22 20:05:57 +0000
605+++ src/main/java/com/akiban/qp/operator/Delete_Returning.java 2013-07-09 23:55:31 +0000
606@@ -84,8 +84,8 @@
607
608
609 @Override
610- protected Cursor cursor(QueryContext context) {
611- return new Execution(context, inputOperator.cursor(context));
612+ protected Cursor cursor(QueryContext context, QueryBindings bindings) {
613+ return new Execution(context, bindings, inputOperator.cursor(context, bindings));
614 }
615
616 @Override
617@@ -210,9 +210,9 @@
618
619 // Execution interface
620
621- Execution(QueryContext context, Cursor input)
622+ Execution(QueryContext context, QueryBindings bindings, Cursor input)
623 {
624- super(context);
625+ super(context, bindings);
626 this.input = input;
627 }
628
629
630=== modified file 'src/main/java/com/akiban/qp/operator/Distinct_Partial.java'
631--- src/main/java/com/akiban/qp/operator/Distinct_Partial.java 2013-03-22 20:05:57 +0000
632+++ src/main/java/com/akiban/qp/operator/Distinct_Partial.java 2013-07-09 23:55:31 +0000
633@@ -102,9 +102,9 @@
634 }
635
636 @Override
637- protected Cursor cursor(QueryContext context)
638+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
639 {
640- return new Execution(context, inputOperator.cursor(context), usePValue);
641+ return new Execution(context, bindings, inputOperator.cursor(context, bindings), usePValue);
642 }
643
644 @Override
645@@ -240,9 +240,9 @@
646
647 // Execution interface
648
649- Execution(QueryContext context, Cursor input, boolean usePValue)
650+ Execution(QueryContext context, QueryBindings bindings, Cursor input, boolean usePValue)
651 {
652- super(context);
653+ super(context, bindings);
654 this.input = input;
655
656 nfields = distinctType.nFields();
657
658=== modified file 'src/main/java/com/akiban/qp/operator/EmitBoundRow_Nested.java'
659--- src/main/java/com/akiban/qp/operator/EmitBoundRow_Nested.java 2013-03-22 20:05:57 +0000
660+++ src/main/java/com/akiban/qp/operator/EmitBoundRow_Nested.java 2013-07-09 23:55:31 +0000
661@@ -92,9 +92,9 @@
662 }
663
664 @Override
665- protected Cursor cursor(QueryContext context)
666+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
667 {
668- return new Execution(context, inputOperator.cursor(context));
669+ return new Execution(context, bindings, inputOperator.cursor(context, bindings));
670 }
671
672 @Override
673@@ -199,7 +199,7 @@
674 }
675 else {
676 assert (row.rowType() == inputRowType);
677- Row rowFromBindings = context.getRow(bindingPosition);
678+ Row rowFromBindings = bindings.getRow(bindingPosition);
679 assert (rowFromBindings.rowType() == boundRowType);
680 if (boundRowType == outputRowType) {
681 row = rowFromBindings;
682@@ -256,9 +256,9 @@
683
684 // Execution interface
685
686- Execution(QueryContext context, Cursor input)
687+ Execution(QueryContext context, QueryBindings bindings, Cursor input)
688 {
689- super(context);
690+ super(context, bindings);
691 this.input = input;
692 }
693
694
695=== modified file 'src/main/java/com/akiban/qp/operator/ExecutionBase.java'
696--- src/main/java/com/akiban/qp/operator/ExecutionBase.java 2013-03-22 20:05:57 +0000
697+++ src/main/java/com/akiban/qp/operator/ExecutionBase.java 2013-07-09 23:55:31 +0000
698@@ -36,12 +36,14 @@
699 context.checkQueryCancelation();
700 }
701
702- public ExecutionBase(QueryContext context)
703+ public ExecutionBase(QueryContext context, QueryBindings bindings)
704 {
705 this.context = context;
706+ this.bindings = bindings;
707 }
708
709 protected QueryContext context;
710+ protected QueryBindings bindings;
711
712 protected static final boolean LOG_EXECUTION = false;
713 protected static final boolean TAP_NEXT_ENABLED = false;
714
715=== modified file 'src/main/java/com/akiban/qp/operator/Filter_Default.java'
716--- src/main/java/com/akiban/qp/operator/Filter_Default.java 2013-03-22 20:05:57 +0000
717+++ src/main/java/com/akiban/qp/operator/Filter_Default.java 2013-07-09 23:55:31 +0000
718@@ -93,9 +93,9 @@
719 }
720
721 @Override
722- protected Cursor cursor(QueryContext context)
723+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
724 {
725- return new Execution(context, inputOperator.cursor(context));
726+ return new Execution(context, bindings, inputOperator.cursor(context, bindings));
727 }
728
729 @Override
730@@ -216,9 +216,9 @@
731
732 // Execution interface
733
734- Execution(QueryContext context, Cursor input)
735+ Execution(QueryContext context, QueryBindings bindings, Cursor input)
736 {
737- super(context);
738+ super(context, bindings);
739 this.input = input;
740 }
741
742
743=== modified file 'src/main/java/com/akiban/qp/operator/Flatten_HKeyOrdered.java'
744--- src/main/java/com/akiban/qp/operator/Flatten_HKeyOrdered.java 2013-05-24 21:45:54 +0000
745+++ src/main/java/com/akiban/qp/operator/Flatten_HKeyOrdered.java 2013-07-09 23:55:31 +0000
746@@ -179,9 +179,9 @@
747 // Operator interface
748
749 @Override
750- protected Cursor cursor(QueryContext context)
751+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
752 {
753- return new Execution(context, inputOperator.cursor(context));
754+ return new Execution(context, bindings, inputOperator.cursor(context, bindings));
755 }
756
757 @Override
758@@ -410,9 +410,9 @@
759
760 // Execution interface
761
762- Execution(QueryContext context, Cursor input)
763+ Execution(QueryContext context, QueryBindings bindings, Cursor input)
764 {
765- super(context);
766+ super(context, bindings);
767 this.input = input;
768 this.leftJoinHKey = adapter().newHKey(childType.hKey());
769 }
770
771=== modified file 'src/main/java/com/akiban/qp/operator/GroupScan_Default.java'
772--- src/main/java/com/akiban/qp/operator/GroupScan_Default.java 2013-03-22 20:05:57 +0000
773+++ src/main/java/com/akiban/qp/operator/GroupScan_Default.java 2013-07-09 23:55:31 +0000
774@@ -88,9 +88,9 @@
775 // Operator interface
776
777 @Override
778- protected Cursor cursor(QueryContext context)
779+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
780 {
781- return new Execution(context, cursorCreator);
782+ return new Execution(context, bindings, cursorCreator);
783 }
784
785 // GroupScan_Default interface
786@@ -198,10 +198,10 @@
787
788 // Execution interface
789
790- Execution(QueryContext context, GroupCursorCreator cursorCreator)
791+ Execution(QueryContext context, QueryBindings bindings, GroupCursorCreator cursorCreator)
792 {
793- super(context);
794- this.cursor = cursorCreator.cursor(context);
795+ super(context, bindings);
796+ this.cursor = cursorCreator.cursor(context, bindings);
797 }
798
799 // Object state
800@@ -211,7 +211,7 @@
801
802 static interface GroupCursorCreator
803 {
804- Cursor cursor(QueryContext context);
805+ Cursor cursor(QueryContext context, QueryBindings bindings);
806
807 Group group();
808
809@@ -254,7 +254,7 @@
810 // GroupCursorCreator interface
811
812 @Override
813- public Cursor cursor(QueryContext context)
814+ public Cursor cursor(QueryContext context, QueryBindings bindings)
815 {
816 return context.getStore(group().getRoot()).newGroupCursor(group());
817 }
818@@ -281,9 +281,9 @@
819 // GroupCursorCreator interface
820
821 @Override
822- public Cursor cursor(QueryContext context)
823+ public Cursor cursor(QueryContext context, QueryBindings bindings)
824 {
825- return new HKeyBoundCursor(context,
826+ return new HKeyBoundCursor(context, bindings,
827 context.getStore(group().getRoot()).newGroupCursor(group()),
828 hKeyBindingPosition,
829 deep,
830@@ -367,13 +367,14 @@
831 }
832
833 HKeyBoundCursor(QueryContext context,
834+ QueryBindings bindings,
835 GroupCursor input,
836 int hKeyBindingPosition,
837 boolean deep,
838 UserTable hKeyType,
839 UserTable shortenUntil)
840 {
841- super(context, input);
842+ super(context, bindings, input);
843 this.input = input;
844 this.hKeyBindingPosition = hKeyBindingPosition;
845 this.deep = deep;
846@@ -382,7 +383,7 @@
847 }
848
849 private HKey getHKeyFromBindings() {
850- return context.getHKey(hKeyBindingPosition);
851+ return bindings.getHKey(hKeyBindingPosition);
852 }
853
854 private final GroupCursor input;
855
856=== modified file 'src/main/java/com/akiban/qp/operator/HKeyUnion_Ordered.java'
857--- src/main/java/com/akiban/qp/operator/HKeyUnion_Ordered.java 2013-03-22 20:05:57 +0000
858+++ src/main/java/com/akiban/qp/operator/HKeyUnion_Ordered.java 2013-07-09 23:55:31 +0000
859@@ -86,9 +86,9 @@
860 // Operator interface
861
862 @Override
863- protected Cursor cursor(QueryContext context)
864+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
865 {
866- return new Execution(context);
867+ return new Execution(context, bindings);
868 }
869
870 @Override
871@@ -310,11 +310,11 @@
872
873 // Execution interface
874
875- Execution(QueryContext context)
876+ Execution(QueryContext context, QueryBindings bindings)
877 {
878- super(context);
879- leftInput = left.cursor(context);
880- rightInput = right.cursor(context);
881+ super(context, bindings);
882+ leftInput = left.cursor(context, bindings);
883+ rightInput = right.cursor(context, bindings);
884 hKeyCache = new HKeyCache<>(context.getStore());
885 }
886
887
888=== modified file 'src/main/java/com/akiban/qp/operator/IfEmpty_Default.java'
889--- src/main/java/com/akiban/qp/operator/IfEmpty_Default.java 2013-03-22 20:05:57 +0000
890+++ src/main/java/com/akiban/qp/operator/IfEmpty_Default.java 2013-07-09 23:55:31 +0000
891@@ -116,9 +116,9 @@
892 // Operator interface
893
894 @Override
895- protected Cursor cursor(QueryContext context)
896+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
897 {
898- return new Execution(context);
899+ return new Execution(context, bindings);
900 }
901
902 @Override
903@@ -318,10 +318,10 @@
904
905 // Execution interface
906
907- Execution(QueryContext context)
908+ Execution(QueryContext context, QueryBindings bindings)
909 {
910- super(context);
911- this.input = inputOperator.cursor(context);
912+ super(context, bindings);
913+ this.input = inputOperator.cursor(context, bindings);
914 if (pExpressions != null) {
915 this.oEvaluations = null;
916 this.pEvaluations = new ArrayList<>(pExpressions.size());
917@@ -349,6 +349,7 @@
918 for (int i = 0; i < nFields; i++) {
919 TEvaluatableExpression outerJoinRowColumnEvaluation = pEvaluations.get(i);
920 outerJoinRowColumnEvaluation.with(context);
921+ outerJoinRowColumnEvaluation.with(bindings);
922 outerJoinRowColumnEvaluation.evaluate();
923 PValueTargets.copyFrom(
924 outerJoinRowColumnEvaluation.resultValue(),
925@@ -359,6 +360,7 @@
926 for (int i = 0; i < nFields; i++) {
927 ExpressionEvaluation outerJoinRowColumnEvaluation = oEvaluations.get(i);
928 outerJoinRowColumnEvaluation.of(context);
929+ outerJoinRowColumnEvaluation.of(bindings);
930 valuesHolderRow.holderAt(i).copyFrom(outerJoinRowColumnEvaluation.eval());
931 }
932 }
933
934=== modified file 'src/main/java/com/akiban/qp/operator/IndexScan_Default.java'
935--- src/main/java/com/akiban/qp/operator/IndexScan_Default.java 2013-03-22 20:05:57 +0000
936+++ src/main/java/com/akiban/qp/operator/IndexScan_Default.java 2013-07-09 23:55:31 +0000
937@@ -163,9 +163,9 @@
938 // Operator interface
939
940 @Override
941- protected Cursor cursor(QueryContext context)
942+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
943 {
944- return new Execution(context);
945+ return new Execution(context, bindings);
946 }
947
948 // IndexScan_Default interface
949@@ -353,11 +353,11 @@
950
951 // Execution interface
952
953- Execution(QueryContext context)
954+ Execution(QueryContext context, QueryBindings bindings)
955 {
956- super(context);
957+ super(context, bindings);
958 UserTable table = (UserTable)index.rootMostTable();
959- this.cursor = adapter(table).newIndexCursor(context, index, indexKeyRange, ordering, scanSelector, usePValues);
960+ this.cursor = adapter(table).newIndexCursor(context, bindings, index, indexKeyRange, ordering, scanSelector, usePValues);
961 }
962
963 // Object state
964
965=== modified file 'src/main/java/com/akiban/qp/operator/Insert_Default.java'
966--- src/main/java/com/akiban/qp/operator/Insert_Default.java 2013-07-07 19:23:59 +0000
967+++ src/main/java/com/akiban/qp/operator/Insert_Default.java 2013-07-09 23:55:31 +0000
968@@ -85,8 +85,8 @@
969 }
970
971 @Override
972- public UpdateResult run(QueryContext context) {
973- return new Execution(context, inputOperator.cursor(context)).run();
974+ public UpdateResult run(QueryContext context, QueryBindings bindings) {
975+ return new Execution(context, bindings, inputOperator.cursor(context, bindings)).run();
976 }
977
978 @Override
979@@ -163,9 +163,9 @@
980 return new StandardUpdateResult(seen, modified);
981 }
982
983- protected Execution(QueryContext queryContext, Cursor input)
984+ protected Execution(QueryContext queryContext, QueryBindings queryBindings, Cursor input)
985 {
986- super(queryContext);
987+ super(queryContext, queryBindings);
988 this.input = input;
989 }
990
991
992=== modified file 'src/main/java/com/akiban/qp/operator/Insert_Returning.java'
993--- src/main/java/com/akiban/qp/operator/Insert_Returning.java 2013-07-07 19:23:59 +0000
994+++ src/main/java/com/akiban/qp/operator/Insert_Returning.java 2013-07-09 23:55:31 +0000
995@@ -82,8 +82,8 @@
996 public class Insert_Returning extends Operator {
997
998 @Override
999- protected Cursor cursor(QueryContext context) {
1000- return new Execution(context, inputOperator.cursor(context));
1001+ protected Cursor cursor(QueryContext context, QueryBindings bindings) {
1002+ return new Execution(context, bindings, inputOperator.cursor(context, bindings));
1003 }
1004
1005 @Override
1006@@ -214,9 +214,9 @@
1007
1008 // Execution interface
1009
1010- Execution(QueryContext context, Cursor input)
1011+ Execution(QueryContext context, QueryBindings bindings, Cursor input)
1012 {
1013- super(context);
1014+ super(context, bindings);
1015 this.input = input;
1016 }
1017
1018
1019=== modified file 'src/main/java/com/akiban/qp/operator/Intersect_Ordered.java'
1020--- src/main/java/com/akiban/qp/operator/Intersect_Ordered.java 2013-03-22 20:05:57 +0000
1021+++ src/main/java/com/akiban/qp/operator/Intersect_Ordered.java 2013-07-09 23:55:31 +0000
1022@@ -118,9 +118,9 @@
1023 // Operator interface
1024
1025 @Override
1026- protected Cursor cursor(QueryContext context)
1027+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
1028 {
1029- return new Execution(context);
1030+ return new Execution(context, bindings);
1031 }
1032
1033 @Override
1034@@ -409,11 +409,11 @@
1035
1036 // Execution interface
1037
1038- Execution(QueryContext context)
1039+ Execution(QueryContext context, QueryBindings bindings)
1040 {
1041- super(context);
1042- leftInput = left.cursor(context);
1043- rightInput = right.cursor(context);
1044+ super(context, bindings);
1045+ leftInput = left.cursor(context, bindings);
1046+ rightInput = right.cursor(context, bindings);
1047 }
1048
1049 // For use by this class
1050
1051=== modified file 'src/main/java/com/akiban/qp/operator/Limit_Default.java'
1052--- src/main/java/com/akiban/qp/operator/Limit_Default.java 2013-03-22 20:05:57 +0000
1053+++ src/main/java/com/akiban/qp/operator/Limit_Default.java 2013-07-09 23:55:31 +0000
1054@@ -87,8 +87,8 @@
1055 // Operator interface
1056
1057 @Override
1058- protected Cursor cursor(QueryContext context) {
1059- return new Execution(context, inputOperator.cursor(context));
1060+ protected Cursor cursor(QueryContext context, QueryBindings bindings) {
1061+ return new Execution(context, bindings, inputOperator.cursor(context, bindings));
1062 }
1063
1064 // Plannable interface
1065@@ -199,12 +199,12 @@
1066 closed = false;
1067 if (isSkipBinding()) {
1068 if (usePVals) {
1069- PValueSource value = context.getPValue(skip());
1070+ PValueSource value = bindings.getPValue(skip());
1071 if (!value.isNull())
1072 this.skipLeft = value.getInt32();
1073 }
1074 else {
1075- ValueSource value = context.getValue(skip());
1076+ ValueSource value = bindings.getValue(skip());
1077 if (!value.isNull())
1078 this.skipLeft = (int)Extractors.getLongExtractor(AkType.LONG).getLong(value);
1079 }
1080@@ -216,7 +216,7 @@
1081 throw new NegativeLimitException("OFFSET", skipLeft);
1082 if (isLimitBinding()) {
1083 if (usePVals) {
1084- PValueSource value = context.getPValue(limit());
1085+ PValueSource value = bindings.getPValue(limit());
1086 if (value.isNull())
1087 this.limitLeft = Integer.MAX_VALUE;
1088 else {
1089@@ -229,7 +229,7 @@
1090 }
1091 }
1092 else {
1093- ValueSource value = context.getValue(limit());
1094+ ValueSource value = bindings.getValue(limit());
1095 if (value.isNull())
1096 this.limitLeft = Integer.MAX_VALUE;
1097 else
1098@@ -326,8 +326,8 @@
1099 }
1100
1101 // Execution interface
1102- Execution(QueryContext context, Cursor input) {
1103- super(context, input);
1104+ Execution(QueryContext context, QueryBindings bindings, Cursor input) {
1105+ super(context, bindings, input);
1106 }
1107
1108 // object state
1109
1110=== modified file 'src/main/java/com/akiban/qp/operator/Map_NestedLoops.java'
1111--- src/main/java/com/akiban/qp/operator/Map_NestedLoops.java 2013-03-22 20:05:57 +0000
1112+++ src/main/java/com/akiban/qp/operator/Map_NestedLoops.java 2013-07-09 23:55:31 +0000
1113@@ -85,9 +85,9 @@
1114 // Operator interface
1115
1116 @Override
1117- protected Cursor cursor(QueryContext context)
1118+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
1119 {
1120- return new Execution(context);
1121+ return new Execution(context, bindings);
1122 }
1123
1124 @Override
1125@@ -244,11 +244,11 @@
1126
1127 // Execution interface
1128
1129- Execution(QueryContext context)
1130+ Execution(QueryContext context, QueryBindings bindings)
1131 {
1132- super(context);
1133- this.outerInput = outerInputOperator.cursor(context);
1134- this.innerInput = innerInputOperator.cursor(context);
1135+ super(context, bindings);
1136+ this.outerInput = outerInputOperator.cursor(context, bindings);
1137+ this.innerInput = innerInputOperator.cursor(context, bindings);
1138 }
1139
1140 // For use by this class
1141@@ -276,7 +276,7 @@
1142 private void startNewInnerLoop(Row row)
1143 {
1144 innerInput.close();
1145- context.setRow(inputBindingPosition, row);
1146+ bindings.setRow(inputBindingPosition, row);
1147 innerInput.open();
1148 }
1149
1150
1151=== modified file 'src/main/java/com/akiban/qp/operator/Operator.java'
1152--- src/main/java/com/akiban/qp/operator/Operator.java 2013-05-24 21:45:54 +0000
1153+++ src/main/java/com/akiban/qp/operator/Operator.java 2013-07-09 23:55:31 +0000
1154@@ -69,7 +69,7 @@
1155 return Collections.emptyList();
1156 }
1157
1158- protected abstract Cursor cursor(QueryContext context);
1159+ protected abstract Cursor cursor(QueryContext context, QueryBindings bindings);
1160
1161 @Override
1162 public String describePlan()
1163
1164=== modified file 'src/main/java/com/akiban/qp/operator/OperatorExecutionBase.java'
1165--- src/main/java/com/akiban/qp/operator/OperatorExecutionBase.java 2013-03-22 20:05:57 +0000
1166+++ src/main/java/com/akiban/qp/operator/OperatorExecutionBase.java 2013-07-09 23:55:31 +0000
1167@@ -81,8 +81,8 @@
1168 }
1169 }
1170
1171- protected OperatorExecutionBase(QueryContext context)
1172+ protected OperatorExecutionBase(QueryContext context, QueryBindings bindings)
1173 {
1174- super(context);
1175+ super(context, bindings);
1176 }
1177 }
1178
1179=== modified file 'src/main/java/com/akiban/qp/operator/Product_NestedLoops.java'
1180--- src/main/java/com/akiban/qp/operator/Product_NestedLoops.java 2013-03-22 20:05:57 +0000
1181+++ src/main/java/com/akiban/qp/operator/Product_NestedLoops.java 2013-07-09 23:55:31 +0000
1182@@ -123,9 +123,9 @@
1183 // Operator interface
1184
1185 @Override
1186- protected Cursor cursor(QueryContext context)
1187+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
1188 {
1189- return new Execution(context);
1190+ return new Execution(context, bindings);
1191 }
1192
1193 @Override
1194@@ -303,11 +303,11 @@
1195
1196 // Execution interface
1197
1198- Execution(QueryContext context)
1199+ Execution(QueryContext context, QueryBindings bindings)
1200 {
1201- super(context);
1202- this.outerInput = outerInputOperator.cursor(context);
1203- this.innerRows = new InnerRows(innerInputOperator.cursor(context));
1204+ super(context, bindings);
1205+ this.outerInput = outerInputOperator.cursor(context, bindings);
1206+ this.innerRows = new InnerRows(innerInputOperator.cursor(context, bindings));
1207 }
1208
1209 // For use by this class
1210@@ -368,7 +368,7 @@
1211 public void newBranchRow(Row branchRow)
1212 {
1213 close();
1214- context.setRow(inputBindingPosition, branchRow);
1215+ bindings.setRow(inputBindingPosition, branchRow);
1216 innerInput.open();
1217 rows.clear();
1218 Row row;
1219
1220=== modified file 'src/main/java/com/akiban/qp/operator/Project_Default.java'
1221--- src/main/java/com/akiban/qp/operator/Project_Default.java 2013-03-22 20:05:57 +0000
1222+++ src/main/java/com/akiban/qp/operator/Project_Default.java 2013-07-09 23:55:31 +0000
1223@@ -88,9 +88,9 @@
1224 // Operator interface
1225
1226 @Override
1227- protected Cursor cursor(QueryContext context)
1228+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
1229 {
1230- return new Execution(context, inputOperator.cursor(context));
1231+ return new Execution(context, bindings, inputOperator.cursor(context, bindings));
1232 }
1233
1234 @Override
1235@@ -238,7 +238,7 @@
1236 if ((inputRow = input.next()) != null) {
1237 projectedRow =
1238 inputRow.rowType() == rowType
1239- ? new ProjectedRow(projectType, inputRow, context, projections, pEvalExpr, tInstances)
1240+ ? new ProjectedRow(projectType, inputRow, context, bindings, projections, pEvalExpr, tInstances)
1241 : inputRow;
1242 }
1243 if (projectedRow == null) {
1244@@ -296,9 +296,9 @@
1245
1246 // Execution interface
1247
1248- Execution(QueryContext context, Cursor input)
1249+ Execution(QueryContext context, QueryBindings bindings, Cursor input)
1250 {
1251- super(context);
1252+ super(context, bindings);
1253 this.input = input;
1254 // one list of evaluatables per execution
1255 if (pExpressions != null)
1256
1257=== added file 'src/main/java/com/akiban/qp/operator/QueryBindings.java'
1258--- src/main/java/com/akiban/qp/operator/QueryBindings.java 1970-01-01 00:00:00 +0000
1259+++ src/main/java/com/akiban/qp/operator/QueryBindings.java 2013-07-09 23:55:31 +0000
1260@@ -0,0 +1,110 @@
1261+/**
1262+ * Copyright (C) 2009-2013 Akiban Technologies, Inc.
1263+ *
1264+ * This program is free software: you can redistribute it and/or modify
1265+ * it under the terms of the GNU Affero General Public License as published by
1266+ * the Free Software Foundation, either version 3 of the License, or
1267+ * (at your option) any later version.
1268+ *
1269+ * This program is distributed in the hope that it will be useful,
1270+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1271+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1272+ * GNU Affero General Public License for more details.
1273+ *
1274+ * You should have received a copy of the GNU Affero General Public License
1275+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1276+ */
1277+
1278+package com.akiban.qp.operator;
1279+
1280+import com.akiban.qp.row.HKey;
1281+import com.akiban.qp.row.Row;
1282+import com.akiban.server.types.AkType;
1283+import com.akiban.server.types.ValueSource;
1284+import com.akiban.server.types3.pvalue.PValueSource;
1285+import com.akiban.util.BloomFilter;
1286+
1287+/** The bindings associated with the execution of a query.
1288+ * This includes query parameters (? markers) as well as current values for iteration.
1289+ * More than one QueryBindings may be active at the same time if
1290+ * iteration is being done in parallel for pipelining.
1291+ */
1292+public interface QueryBindings
1293+{
1294+ public PValueSource getPValue(int index);
1295+
1296+ public void setPValue(int index, PValueSource value);
1297+
1298+ /**
1299+ * Gets the value bound to the given index.
1300+ * @param index the index to look up
1301+ * @return the value at that index
1302+ * @throws BindingNotSetException if the given index wasn't set
1303+ */
1304+ public ValueSource getValue(int index);
1305+
1306+ /**
1307+ * Bind a value to the given index.
1308+ * @param index the index to set
1309+ * @param value the value to assign
1310+ */
1311+ public void setValue(int index, ValueSource value);
1312+
1313+ /**
1314+ * Bind a value to the given index.
1315+ * @param index the index to set
1316+ * @param value the value to assign
1317+ * @param type the type to convert the value to for binding
1318+ */
1319+ public void setValue(int index, ValueSource value, AkType type);
1320+
1321+ /**
1322+ * Gets the row bound to the given index.
1323+ * @param index the index to look up
1324+ * @return the row at that index
1325+ * @throws BindingNotSetException if the given index wasn't set
1326+ */
1327+ public Row getRow(int index);
1328+
1329+ /**
1330+ * Bind a row to the given index.
1331+ * @param index the index to set
1332+ * @param row the row to assign
1333+ */
1334+ public void setRow(int index, Row row);
1335+
1336+ /**
1337+ * Gets the hKey bound to the given index.
1338+ * @param index the index to look up
1339+ * @return the hKey at that index
1340+ * @throws BindingNotSetException if the given index wasn't set
1341+ */
1342+ public HKey getHKey(int index);
1343+
1344+ /**
1345+ * Bind an hkey to the given index.
1346+ * @param index the index to set
1347+ * @param hKey the hKey to assign
1348+ */
1349+ public void setHKey(int index, HKey hKey);
1350+
1351+ /**
1352+ * Gets the bloom filter bound to the given index.
1353+ * @param index the index to look up
1354+ * @return the bloom filter at that index
1355+ * @throws BindingNotSetException if the given index wasn't set
1356+ */
1357+ public BloomFilter getBloomFilter(int index);
1358+
1359+ /**
1360+ * Bind a bloom filter to the given index.
1361+ * @param index the index to set
1362+ * @param filter the bloom filter to assign
1363+ */
1364+ public void setBloomFilter(int index, BloomFilter filter);
1365+
1366+ /**
1367+ * Clear all bindings.
1368+ */
1369+ public void clear();
1370+}
1371
1372=== modified file 'src/main/java/com/akiban/qp/operator/QueryContext.java'
1373--- src/main/java/com/akiban/qp/operator/QueryContext.java 2013-03-22 20:05:57 +0000
1374+++ src/main/java/com/akiban/qp/operator/QueryContext.java 2013-07-09 23:55:31 +0000
1375@@ -19,98 +19,21 @@
1376
1377 import com.akiban.ais.model.TableName;
1378 import com.akiban.ais.model.UserTable;
1379-import com.akiban.qp.row.HKey;
1380 import com.akiban.qp.row.Row;
1381 import com.akiban.server.service.ServiceManager;
1382 import com.akiban.server.service.session.Session;
1383 import com.akiban.server.error.ErrorCode;
1384 import com.akiban.server.error.InvalidOperationException;
1385-import com.akiban.server.types.AkType;
1386-import com.akiban.server.types.ValueSource;
1387-import com.akiban.server.types3.pvalue.PValueSource;
1388-import com.akiban.util.BloomFilter;
1389
1390 import java.util.Date;
1391
1392-public interface QueryContext
1393+/** The context for the execution of a query.
1394+ * Associated the query with the running environment.
1395+ * The context is global for the whole query; it does not change for
1396+ * different iteration values at different places in the query.
1397+ */
1398+public interface QueryContext
1399 {
1400- public PValueSource getPValue(int index);
1401-
1402- public void setPValue(int index, PValueSource value);
1403-
1404- /**
1405- * Gets the value bound to the given index.
1406- * @param index the index to look up
1407- * @return the value at that index
1408- * @throws BindingNotSetException if the given index wasn't set
1409- */
1410- public ValueSource getValue(int index);
1411-
1412- /**
1413- * Bind a value to the given index.
1414- * @param index the index to set
1415- * @param value the value to assign
1416- */
1417- public void setValue(int index, ValueSource value);
1418-
1419- /**
1420- * Bind a value to the given index.
1421- * @param index the index to set
1422- * @param value the value to assign
1423- * @param type the type to convert the value to for binding
1424- */
1425- public void setValue(int index, ValueSource value, AkType type);
1426-
1427- /**
1428- * Gets the row bound to the given index.
1429- * @param index the index to look up
1430- * @return the row at that index
1431- * @throws BindingNotSetException if the given index wasn't set
1432- */
1433- public Row getRow(int index);
1434-
1435- /**
1436- * Bind a row to the given index.
1437- * @param index the index to set
1438- * @param row the row to assign
1439- */
1440- public void setRow(int index, Row row);
1441-
1442- /**
1443- * Gets the hKey bound to the given index.
1444- * @param index the index to look up
1445- * @return the hKey at that index
1446- * @throws BindingNotSetException if the given index wasn't set
1447- */
1448- public HKey getHKey(int index);
1449-
1450- /**
1451- * Bind an hkey to the given index.
1452- * @param index the index to set
1453- * @param hKey the hKey to assign
1454- */
1455- public void setHKey(int index, HKey hKey);
1456-
1457- /**
1458- * Gets the bloom filter bound to the given index.
1459- * @param index the index to look up
1460- * @return the bloom filter at that index
1461- * @throws BindingNotSetException if the given index wasn't set
1462- */
1463- public BloomFilter getBloomFilter(int index);
1464-
1465- /**
1466- * Bind a bloom filter to the given index.
1467- * @param index the index to set
1468- * @param filter the bloom filter to assign
1469- */
1470- public void setBloomFilter(int index, BloomFilter filter);
1471-
1472- /**
1473- * Clear all bindings.
1474- */
1475- public void clear();
1476-
1477 /**
1478 * Get the store associated with this query.
1479 */
1480@@ -203,4 +126,9 @@
1481 * @throws NoSuchSequenceException if the name does not exist in the system.
1482 */
1483 public long sequenceCurrentValue(TableName sequence);
1484+
1485+ /**
1486+ * Create a new empty set of bindings.
1487+ */
1488+ public QueryBindings createBindings();
1489 }
1490
1491=== modified file 'src/main/java/com/akiban/qp/operator/QueryContextBase.java'
1492--- src/main/java/com/akiban/qp/operator/QueryContextBase.java 2013-03-22 20:05:57 +0000
1493+++ src/main/java/com/akiban/qp/operator/QueryContextBase.java 2013-07-09 23:55:31 +0000
1494@@ -17,176 +17,20 @@
1495
1496 package com.akiban.qp.operator;
1497
1498-import com.akiban.qp.row.HKey;
1499 import com.akiban.qp.row.Row;
1500 import com.akiban.server.error.*;
1501-import com.akiban.server.types.AkType;
1502-import com.akiban.server.types.ValueSource;
1503-import com.akiban.server.types.conversion.Converters;
1504-import com.akiban.server.types.util.ValueHolder;
1505-import com.akiban.server.types3.pvalue.PValue;
1506-import com.akiban.server.types3.pvalue.PValueSource;
1507-import com.akiban.server.types3.pvalue.PValueTargets;
1508-import com.akiban.util.BloomFilter;
1509-import com.akiban.util.SparseArray;
1510
1511-import java.math.BigDecimal;
1512-import java.math.BigInteger;
1513 import java.util.Date;
1514
1515 public abstract class QueryContextBase implements QueryContext
1516 {
1517- private SparseArray<Object> bindings = new SparseArray<>();
1518 // startTimeMsec is used to control query timeouts.
1519 private final long startTimeMsec = System.currentTimeMillis();
1520 private long queryTimeoutMsec = Long.MAX_VALUE;
1521
1522- @Override
1523- public String toString() {
1524- return getClass().getSimpleName() + "[" + bindings.describeElements() + "]";
1525- }
1526-
1527 /* QueryContext interface */
1528
1529 @Override
1530- public PValueSource getPValue(int index) {
1531- if (!bindings.isDefined(index))
1532- throw new BindingNotSetException(index);
1533- return (PValueSource)bindings.get(index);
1534- }
1535-
1536- /*
1537- * (non-Javadoc)
1538- * @see com.akiban.qp.operator.QueryContext#setPValue(int, com.akiban.server.types3.pvalue.PValueSource)
1539- * This makes a copy of the PValueSource value, rather than simply
1540- * storing the reference. The assumption is the PValueSource parameter
1541- * will be reused by the caller as rows are processed, so the QueryContext
1542- * needs to keep a copy of the underlying value.
1543- *
1544- */
1545- @Override
1546- public void setPValue(int index, PValueSource value) {
1547- PValue holder = null;
1548- if (bindings.isDefined(index)) {
1549- holder = (PValue)bindings.get(index);
1550- if (holder.tInstance() != value.tInstance())
1551- holder = null;
1552- }
1553- if (holder == null) {
1554- holder = new PValue(value.tInstance());
1555- bindings.set(index, holder);
1556- }
1557- PValueTargets.copyFrom(value, holder);
1558- }
1559-
1560- @Override
1561- public ValueSource getValue(int index) {
1562- if (!bindings.isDefined(index))
1563- throw new BindingNotSetException(index);
1564- return (ValueSource)bindings.get(index);
1565- }
1566-
1567- @Override
1568- public void setValue(int index, ValueSource value, AkType type)
1569- {
1570- ValueHolder holder;
1571- if (bindings.isDefined(index))
1572- holder = (ValueHolder)bindings.get(index);
1573- else {
1574- holder = new ValueHolder();
1575- bindings.set(index, holder);
1576- }
1577-
1578- holder.expectType(type);
1579- try
1580- {
1581- Converters.convert(value, holder);
1582- }
1583- catch (InvalidDateFormatException e)
1584- {
1585- errorCase(e, holder);
1586- }
1587- catch (InconvertibleTypesException e)
1588- {
1589- errorCase(e, holder);
1590- }
1591- catch (InvalidCharToNumException e)
1592- {
1593- errorCase(e, holder);
1594- }
1595- }
1596-
1597- private void errorCase (InvalidOperationException e, ValueHolder holder)
1598- {
1599- warnClient(e);
1600- switch(holder.getConversionType())
1601- {
1602- case DECIMAL: holder.putDecimal(BigDecimal.ZERO); break;
1603- case U_BIGINT: holder.putUBigInt(BigInteger.ZERO); break;
1604- case LONG:
1605- case U_INT:
1606- case INT: holder.putRaw(holder.getConversionType(), 0L); break;
1607- case U_DOUBLE:
1608- case DOUBLE: holder.putRaw(holder.getConversionType(), 0.0d);
1609- case U_FLOAT:
1610- case FLOAT: holder.putRaw(holder.getConversionType(), 0.0f); break;
1611- case TIME: holder.putTime(0L);
1612- default: holder.putNull();
1613-
1614- }
1615- }
1616-
1617- @Override
1618- public void setValue(int index, ValueSource value)
1619- {
1620- setValue(index, value, value.getConversionType());
1621- }
1622-
1623- @Override
1624- public Row getRow(int index) {
1625- if (!bindings.isDefined(index))
1626- throw new BindingNotSetException(index);
1627- return (Row)bindings.get(index);
1628- }
1629-
1630- @Override
1631- public void setRow(int index, Row row)
1632- {
1633- // TODO: Should this use a RowHolder or will that make things worse?
1634- bindings.set(index, row);
1635- }
1636-
1637- @Override
1638- public HKey getHKey(int index) {
1639- if (!bindings.isDefined(index))
1640- throw new BindingNotSetException(index);
1641- return (HKey)bindings.get(index);
1642- }
1643-
1644- @Override
1645- public void setHKey(int index, HKey hKey)
1646- {
1647- bindings.set(index, hKey);
1648- }
1649-
1650- @Override
1651- public BloomFilter getBloomFilter(int index) {
1652- if (!bindings.isDefined(index))
1653- throw new BindingNotSetException(index);
1654- return (BloomFilter)bindings.get(index);
1655- }
1656-
1657- @Override
1658- public void setBloomFilter(int index, BloomFilter filter) {
1659- bindings.set(index, filter);
1660- }
1661-
1662- @Override
1663- public void clear() {
1664- bindings.clear();
1665- }
1666-
1667- @Override
1668 public Date getCurrentDate() {
1669 return new Date();
1670 }
1671@@ -232,4 +76,9 @@
1672 public void checkConstraints(Row row, boolean usePValues) throws InvalidOperationException {
1673 row.rowType().constraintChecker().checkConstraints(row, usePValues);
1674 }
1675+
1676+ @Override
1677+ public QueryBindings createBindings() {
1678+ return new SparseArrayQueryBindings();
1679+ }
1680 }
1681
1682=== modified file 'src/main/java/com/akiban/qp/operator/Select_BloomFilter.java'
1683--- src/main/java/com/akiban/qp/operator/Select_BloomFilter.java 2013-03-22 20:05:57 +0000
1684+++ src/main/java/com/akiban/qp/operator/Select_BloomFilter.java 2013-07-09 23:55:31 +0000
1685@@ -101,12 +101,12 @@
1686 }
1687
1688 @Override
1689- protected Cursor cursor(QueryContext context)
1690+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
1691 {
1692 if (tFields == null)
1693- return new Execution<>(context, fields, oldExpressionsAdapater);
1694+ return new Execution<>(context, bindings, fields, oldExpressionsAdapater);
1695 else
1696- return new Execution<>(context, tFields, newExpressionsAdapter);
1697+ return new Execution<>(context, bindings, tFields, newExpressionsAdapter);
1698 }
1699
1700 @Override
1701@@ -243,8 +243,8 @@
1702 TAP_OPEN.in();
1703 try {
1704 CursorLifecycle.checkIdle(this);
1705- filter = context.getBloomFilter(bindingPosition);
1706- context.setBloomFilter(bindingPosition, null);
1707+ filter = bindings.getBloomFilter(bindingPosition);
1708+ bindings.setBloomFilter(bindingPosition, null);
1709 inputCursor.open();
1710 idle = false;
1711 } finally {
1712@@ -324,12 +324,12 @@
1713
1714 // Execution interface
1715
1716- <EXPR> Execution(QueryContext context,
1717+ <EXPR> Execution(QueryContext context, QueryBindings bindings,
1718 List<? extends EXPR> expressions, ExpressionAdapter<EXPR,E> adapter)
1719 {
1720- super(context);
1721- this.inputCursor = input.cursor(context);
1722- this.onPositiveCursor = onPositive.cursor(context);
1723+ super(context, bindings);
1724+ this.inputCursor = input.cursor(context, bindings);
1725+ this.onPositiveCursor = onPositive.cursor(context, bindings);
1726 this.adapter = adapter;
1727 for (EXPR field : expressions) {
1728 E eval = adapter.evaluate(field, context);
1729@@ -359,13 +359,13 @@
1730 // occurs during next().
1731 TAP_CHECK.in();
1732 try {
1733- context.setRow(bindingPosition, row);
1734+ bindings.setRow(bindingPosition, row);
1735 onPositiveCursor.open();
1736 try {
1737 return onPositiveCursor.next() != null;
1738 } finally {
1739 onPositiveCursor.close();
1740- context.setRow(bindingPosition, null);
1741+ bindings.setRow(bindingPosition, null);
1742 }
1743 } finally {
1744 TAP_CHECK.out();
1745
1746=== modified file 'src/main/java/com/akiban/qp/operator/Select_HKeyOrdered.java'
1747--- src/main/java/com/akiban/qp/operator/Select_HKeyOrdered.java 2013-03-22 20:05:57 +0000
1748+++ src/main/java/com/akiban/qp/operator/Select_HKeyOrdered.java 2013-07-09 23:55:31 +0000
1749@@ -102,9 +102,9 @@
1750 }
1751
1752 @Override
1753- protected Cursor cursor(QueryContext context)
1754+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
1755 {
1756- return new Execution(context, inputOperator.cursor(context));
1757+ return new Execution(context, bindings, inputOperator.cursor(context, bindings));
1758 }
1759
1760 @Override
1761@@ -188,10 +188,14 @@
1762 try {
1763 CursorLifecycle.checkIdle(this);
1764 input.open();
1765- if (evaluation == null)
1766+ if (evaluation == null) {
1767 pEvaluation.with(context);
1768- else
1769+ pEvaluation.with(bindings);
1770+ }
1771+ else {
1772 evaluation.of(context);
1773+ evaluation.of(bindings);
1774+ }
1775 idle = false;
1776 } finally {
1777 TAP_OPEN.out();
1778@@ -302,9 +306,9 @@
1779
1780 // Execution interface
1781
1782- Execution(QueryContext context, Cursor input)
1783+ Execution(QueryContext context, QueryBindings bindings, Cursor input)
1784 {
1785- super(context);
1786+ super(context, bindings);
1787 this.input = input;
1788 if (predicate == null) {
1789 this.evaluation = null;
1790
1791=== modified file 'src/main/java/com/akiban/qp/operator/Sort_General.java'
1792--- src/main/java/com/akiban/qp/operator/Sort_General.java 2013-06-06 19:56:32 +0000
1793+++ src/main/java/com/akiban/qp/operator/Sort_General.java 2013-07-09 23:55:31 +0000
1794@@ -92,9 +92,9 @@
1795 }
1796
1797 @Override
1798- protected Cursor cursor(QueryContext context)
1799+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
1800 {
1801- return new Execution(context, inputOperator.cursor(context));
1802+ return new Execution(context, bindings, inputOperator.cursor(context, bindings));
1803 }
1804
1805 @Override
1806@@ -164,7 +164,7 @@
1807 try {
1808 CursorLifecycle.checkIdle(this);
1809 input.open();
1810- output = new SorterToCursorAdapter(adapter(), context, input, sortType, ordering, sortOption, TAP_LOAD);
1811+ output = new SorterToCursorAdapter(adapter(), context, bindings, input, sortType, ordering, sortOption, TAP_LOAD);
1812 output.open();
1813 } finally {
1814 TAP_OPEN.out();
1815@@ -243,9 +243,9 @@
1816
1817 // Execution interface
1818
1819- Execution(QueryContext context, Cursor input)
1820+ Execution(QueryContext context, QueryBindings bindings, Cursor input)
1821 {
1822- super(context);
1823+ super(context, bindings);
1824 this.input = input;
1825 }
1826
1827
1828=== modified file 'src/main/java/com/akiban/qp/operator/Sort_InsertionLimited.java'
1829--- src/main/java/com/akiban/qp/operator/Sort_InsertionLimited.java 2013-04-30 23:01:23 +0000
1830+++ src/main/java/com/akiban/qp/operator/Sort_InsertionLimited.java 2013-07-09 23:55:31 +0000
1831@@ -104,9 +104,9 @@
1832 }
1833
1834 @Override
1835- protected Cursor cursor(QueryContext context)
1836+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
1837 {
1838- return new Execution(context, inputOperator.cursor(context));
1839+ return new Execution(context, bindings, inputOperator.cursor(context, bindings));
1840 }
1841
1842 @Override
1843@@ -185,8 +185,10 @@
1844 CursorLifecycle.checkIdle(this);
1845 input.open();
1846 state = State.FILLING;
1847- for (TEvaluatableExpression eval : tEvaluations)
1848+ for (TEvaluatableExpression eval : tEvaluations) {
1849 eval.with(context);
1850+ eval.with(bindings);
1851+ }
1852 sorted = new TreeSet<>();
1853 } finally {
1854 TAP_OPEN.out();
1855@@ -333,9 +335,9 @@
1856
1857 // Execution interface
1858
1859- Execution(QueryContext context, Cursor input)
1860+ Execution(QueryContext context, QueryBindings bindings, Cursor input)
1861 {
1862- super(context);
1863+ super(context, bindings);
1864 this.input = input;
1865 int nsort = ordering.sortColumns();
1866 tEvaluations = new ArrayList<>(nsort);
1867
1868=== modified file 'src/main/java/com/akiban/qp/operator/SorterToCursorAdapter.java'
1869--- src/main/java/com/akiban/qp/operator/SorterToCursorAdapter.java 2013-06-06 14:38:02 +0000
1870+++ src/main/java/com/akiban/qp/operator/SorterToCursorAdapter.java 2013-07-09 23:55:31 +0000
1871@@ -35,7 +35,7 @@
1872 public void open()
1873 {
1874 CursorLifecycle.checkIdle(this);
1875- sorter = adapter.createSorter(context, input, rowType, ordering, sortOption, loadTap);
1876+ sorter = adapter.createSorter(context, bindings, input, rowType, ordering, sortOption, loadTap);
1877 cursor = sorter.sort();
1878 cursor.open();
1879 }
1880@@ -98,6 +98,7 @@
1881
1882 public SorterToCursorAdapter(StoreAdapter adapter,
1883 QueryContext context,
1884+ QueryBindings bindings,
1885 Cursor input,
1886 RowType rowType,
1887 API.Ordering ordering,
1888@@ -106,6 +107,7 @@
1889 {
1890 this.adapter = adapter;
1891 this.context = context;
1892+ this.bindings = bindings;
1893 this.input = input;
1894 this.rowType = rowType;
1895 this.ordering = ordering;
1896@@ -115,6 +117,7 @@
1897
1898 private final StoreAdapter adapter;
1899 private final QueryContext context;
1900+ private final QueryBindings bindings;
1901 private final Cursor input;
1902 private final RowType rowType;
1903 private final API.Ordering ordering;
1904
1905=== added file 'src/main/java/com/akiban/qp/operator/SparseArrayQueryBindings.java'
1906--- src/main/java/com/akiban/qp/operator/SparseArrayQueryBindings.java 1970-01-01 00:00:00 +0000
1907+++ src/main/java/com/akiban/qp/operator/SparseArrayQueryBindings.java 2013-07-09 23:55:31 +0000
1908@@ -0,0 +1,184 @@
1909+/**
1910+ * Copyright (C) 2009-2013 Akiban Technologies, Inc.
1911+ *
1912+ * This program is free software: you can redistribute it and/or modify
1913+ * it under the terms of the GNU Affero General Public License as published by
1914+ * the Free Software Foundation, either version 3 of the License, or
1915+ * (at your option) any later version.
1916+ *
1917+ * This program is distributed in the hope that it will be useful,
1918+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1919+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1920+ * GNU Affero General Public License for more details.
1921+ *
1922+ * You should have received a copy of the GNU Affero General Public License
1923+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1924+ */
1925+
1926+package com.akiban.qp.operator;
1927+
1928+import com.akiban.qp.row.HKey;
1929+import com.akiban.qp.row.Row;
1930+import com.akiban.server.error.*;
1931+import com.akiban.server.types.AkType;
1932+import com.akiban.server.types.ValueSource;
1933+import com.akiban.server.types.conversion.Converters;
1934+import com.akiban.server.types.util.ValueHolder;
1935+import com.akiban.server.types3.pvalue.PValue;
1936+import com.akiban.server.types3.pvalue.PValueSource;
1937+import com.akiban.server.types3.pvalue.PValueTargets;
1938+import com.akiban.util.BloomFilter;
1939+import com.akiban.util.SparseArray;
1940+
1941+import java.math.BigDecimal;
1942+import java.math.BigInteger;
1943+
1944+public class SparseArrayQueryBindings implements QueryBindings
1945+{
1946+ private SparseArray<Object> bindings = new SparseArray<>();
1947+
1948+ @Override
1949+ public String toString() {
1950+ return getClass().getSimpleName() + "[" + bindings.describeElements() + "]";
1951+ }
1952+
1953+ /* QueryBindings interface */
1954+
1955+ @Override
1956+ public PValueSource getPValue(int index) {
1957+ if (!bindings.isDefined(index))
1958+ throw new BindingNotSetException(index);
1959+ return (PValueSource)bindings.get(index);
1960+ }
1961+
1962+ /*
1963+ * (non-Javadoc)
1964+ * @see com.akiban.qp.operator.QueryContext#setPValue(int, com.akiban.server.types3.pvalue.PValueSource)
1965+ * This makes a copy of the PValueSource value, rather than simply
1966+ * storing the reference. The assumption is the PValueSource parameter
1967+ * will be reused by the caller as rows are processed, so the QueryContext
1968+ * needs to keep a copy of the underlying value.
1969+ *
1970+ */
1971+ @Override
1972+ public void setPValue(int index, PValueSource value) {
1973+ PValue holder = null;
1974+ if (bindings.isDefined(index)) {
1975+ holder = (PValue)bindings.get(index);
1976+ if (holder.tInstance() != value.tInstance())
1977+ holder = null;
1978+ }
1979+ if (holder == null) {
1980+ holder = new PValue(value.tInstance());
1981+ bindings.set(index, holder);
1982+ }
1983+ PValueTargets.copyFrom(value, holder);
1984+ }
1985+
1986+ @Override
1987+ public ValueSource getValue(int index) {
1988+ if (!bindings.isDefined(index))
1989+ throw new BindingNotSetException(index);
1990+ return (ValueSource)bindings.get(index);
1991+ }
1992+
1993+ @Override
1994+ public void setValue(int index, ValueSource value, AkType type)
1995+ {
1996+ ValueHolder holder;
1997+ if (bindings.isDefined(index))
1998+ holder = (ValueHolder)bindings.get(index);
1999+ else {
2000+ holder = new ValueHolder();
2001+ bindings.set(index, holder);
2002+ }
2003+
2004+ holder.expectType(type);
2005+ try
2006+ {
2007+ Converters.convert(value, holder);
2008+ }
2009+ catch (InvalidDateFormatException e)
2010+ {
2011+ errorCase(e, holder);
2012+ }
2013+ catch (InconvertibleTypesException e)
2014+ {
2015+ errorCase(e, holder);
2016+ }
2017+ catch (InvalidCharToNumException e)
2018+ {
2019+ errorCase(e, holder);
2020+ }
2021+ }
2022+
2023+ private void errorCase (InvalidOperationException e, ValueHolder holder)
2024+ {
2025+ //warnClient(e);
2026+ switch(holder.getConversionType())
2027+ {
2028+ case DECIMAL: holder.putDecimal(BigDecimal.ZERO); break;
2029+ case U_BIGINT: holder.putUBigInt(BigInteger.ZERO); break;
2030+ case LONG:
2031+ case U_INT:
2032+ case INT: holder.putRaw(holder.getConversionType(), 0L); break;
2033+ case U_DOUBLE:
2034+ case DOUBLE: holder.putRaw(holder.getConversionType(), 0.0d);
2035+ case U_FLOAT:
2036+ case FLOAT: holder.putRaw(holder.getConversionType(), 0.0f); break;
2037+ case TIME: holder.putTime(0L);
2038+ default: holder.putNull();
2039+
2040+ }
2041+ }
2042+
2043+ @Override
2044+ public void setValue(int index, ValueSource value)
2045+ {
2046+ setValue(index, value, value.getConversionType());
2047+ }
2048+
2049+ @Override
2050+ public Row getRow(int index) {
2051+ if (!bindings.isDefined(index))
2052+ throw new BindingNotSetException(index);
2053+ return (Row)bindings.get(index);
2054+ }
2055+
2056+ @Override
2057+ public void setRow(int index, Row row)
2058+ {
2059+ // TODO: Should this use a RowHolder or will that make things worse?
2060+ bindings.set(index, row);
2061+ }
2062+
2063+ @Override
2064+ public HKey getHKey(int index) {
2065+ if (!bindings.isDefined(index))
2066+ throw new BindingNotSetException(index);
2067+ return (HKey)bindings.get(index);
2068+ }
2069+
2070+ @Override
2071+ public void setHKey(int index, HKey hKey)
2072+ {
2073+ bindings.set(index, hKey);
2074+ }
2075+
2076+ @Override
2077+ public BloomFilter getBloomFilter(int index) {
2078+ if (!bindings.isDefined(index))
2079+ throw new BindingNotSetException(index);
2080+ return (BloomFilter)bindings.get(index);
2081+ }
2082+
2083+ @Override
2084+ public void setBloomFilter(int index, BloomFilter filter) {
2085+ bindings.set(index, filter);
2086+ }
2087+
2088+ @Override
2089+ public void clear() {
2090+ bindings.clear();
2091+ }
2092+}
2093
2094=== modified file 'src/main/java/com/akiban/qp/operator/StoreAdapter.java'
2095--- src/main/java/com/akiban/qp/operator/StoreAdapter.java 2013-07-07 19:23:59 +0000
2096+++ src/main/java/com/akiban/qp/operator/StoreAdapter.java 2013-07-09 23:55:31 +0000
2097@@ -53,6 +53,7 @@
2098 public abstract GroupCursor newGroupCursor(Group group);
2099
2100 public abstract Cursor newIndexCursor(QueryContext context,
2101+ QueryBindings bindings,
2102 Index index,
2103 IndexKeyRange keyRange,
2104 API.Ordering ordering,
2105@@ -73,6 +74,7 @@
2106 public abstract void deleteRow (Row oldRow, boolean usePValues, boolean cascadeDelete);
2107
2108 public abstract Sorter createSorter(QueryContext context,
2109+ QueryBindings bindings,
2110 Cursor input,
2111 RowType rowType,
2112 API.Ordering ordering,
2113
2114=== modified file 'src/main/java/com/akiban/qp/operator/UnionAll_Default.java'
2115--- src/main/java/com/akiban/qp/operator/UnionAll_Default.java 2013-03-22 20:05:57 +0000
2116+++ src/main/java/com/akiban/qp/operator/UnionAll_Default.java 2013-07-09 23:55:31 +0000
2117@@ -101,8 +101,8 @@
2118 }
2119
2120 @Override
2121- protected Cursor cursor(QueryContext context) {
2122- return new Execution(context);
2123+ protected Cursor cursor(QueryContext context, QueryBindings bindings) {
2124+ return new Execution(context, bindings);
2125 }
2126
2127 UnionAll_Default(Operator input1, RowType input1Type, Operator input2, RowType input2Type, boolean usePValues) {
2128@@ -299,9 +299,9 @@
2129 return destroyed;
2130 }
2131
2132- private Execution(QueryContext context)
2133+ private Execution(QueryContext context, QueryBindings bindings)
2134 {
2135- super(context);
2136+ super(context, bindings);
2137 cursors = new Cursor[inputs.size()];
2138 }
2139
2140@@ -353,7 +353,7 @@
2141 private Cursor cursor(int i)
2142 {
2143 if (cursors[i] == null) {
2144- cursors[i] = inputs.get(i).cursor(context);
2145+ cursors[i] = inputs.get(i).cursor(context, bindings);
2146 }
2147 return cursors[i];
2148 }
2149
2150=== modified file 'src/main/java/com/akiban/qp/operator/Union_Ordered.java'
2151--- src/main/java/com/akiban/qp/operator/Union_Ordered.java 2013-03-22 20:05:57 +0000
2152+++ src/main/java/com/akiban/qp/operator/Union_Ordered.java 2013-07-09 23:55:31 +0000
2153@@ -95,9 +95,9 @@
2154 // Operator interface
2155
2156 @Override
2157- protected Cursor cursor(QueryContext context)
2158+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
2159 {
2160- return new Execution(context);
2161+ return new Execution(context, bindings);
2162 }
2163
2164 @Override
2165@@ -311,11 +311,11 @@
2166
2167 // Execution interface
2168
2169- Execution(QueryContext context)
2170+ Execution(QueryContext context, QueryBindings bindings)
2171 {
2172- super(context);
2173- leftInput = left.cursor(context);
2174- rightInput = right.cursor(context);
2175+ super(context, bindings);
2176+ leftInput = left.cursor(context, bindings);
2177+ rightInput = right.cursor(context, bindings);
2178 }
2179
2180 // For use by this class
2181
2182=== modified file 'src/main/java/com/akiban/qp/operator/UpdateFunction.java'
2183--- src/main/java/com/akiban/qp/operator/UpdateFunction.java 2013-03-22 20:05:57 +0000
2184+++ src/main/java/com/akiban/qp/operator/UpdateFunction.java 2013-07-09 23:55:31 +0000
2185@@ -24,10 +24,11 @@
2186 * Updates the given row by returning another row with the required modifications.
2187 * @param original the original row, which will remain untouched
2188 * @param context the query context for evaluation
2189+ * @param bindings the variable bindings for evaluation
2190 * @return a row of the same type as the original, but different fields
2191 * @throws IllegalArgumentException if the row could not be updated
2192 * (ie, if {@linkplain #rowIsSelected(Row)} returned {@code false})
2193 */
2194- Row evaluate(Row original, QueryContext context);
2195+ Row evaluate(Row original, QueryContext context, QueryBindings bindings);
2196 boolean usePValues();
2197 }
2198
2199=== modified file 'src/main/java/com/akiban/qp/operator/Update_Default.java'
2200--- src/main/java/com/akiban/qp/operator/Update_Default.java 2013-03-22 20:05:57 +0000
2201+++ src/main/java/com/akiban/qp/operator/Update_Default.java 2013-07-09 23:55:31 +0000
2202@@ -109,8 +109,8 @@
2203 // UpdatePlannable interface
2204
2205 @Override
2206- public UpdateResult run(QueryContext context) {
2207- return new Execution(context, inputOperator.cursor(context)).run();
2208+ public UpdateResult run(QueryContext context, QueryBindings bindings) {
2209+ return new Execution(context, bindings, inputOperator.cursor(context, bindings)).run();
2210 }
2211
2212 // Plannable interface
2213@@ -173,7 +173,7 @@
2214 checkQueryCancelation();
2215 ++seen;
2216 if (updateFunction.rowIsSelected(oldRow)) {
2217- Row newRow = updateFunction.evaluate(oldRow, context);
2218+ Row newRow = updateFunction.evaluate(oldRow, context, bindings);
2219 context.checkConstraints(newRow, usePValues);
2220 adapter().updateRow(oldRow, newRow, usePValues);
2221 if (LOG_EXECUTION && LOG.isDebugEnabled()) {
2222@@ -193,9 +193,9 @@
2223 return new StandardUpdateResult(seen, modified);
2224 }
2225
2226- public Execution(QueryContext queryContext, Cursor input)
2227+ public Execution(QueryContext queryContext, QueryBindings bindings, Cursor input)
2228 {
2229- super(queryContext);
2230+ super(queryContext, bindings);
2231 this.input = input;
2232 }
2233
2234
2235=== modified file 'src/main/java/com/akiban/qp/operator/Update_Returning.java'
2236--- src/main/java/com/akiban/qp/operator/Update_Returning.java 2013-03-22 20:05:57 +0000
2237+++ src/main/java/com/akiban/qp/operator/Update_Returning.java 2013-07-09 23:55:31 +0000
2238@@ -94,8 +94,8 @@
2239 }
2240
2241 @Override
2242- protected Cursor cursor(QueryContext context) {
2243- return new Execution(context, inputOperator.cursor(context));
2244+ protected Cursor cursor(QueryContext context, QueryBindings bindings) {
2245+ return new Execution(context, bindings, inputOperator.cursor(context, bindings));
2246 }
2247
2248 public Update_Returning (Operator inputOperator, UpdateFunction updateFunction, boolean usePvals) {
2249@@ -153,7 +153,7 @@
2250 Row inputRow;
2251 Row newRow = null;
2252 if ((inputRow = input.next()) != null) {
2253- newRow = updateFunction.evaluate(inputRow, context);
2254+ newRow = updateFunction.evaluate(inputRow, context, bindings);
2255 context.checkConstraints(newRow, usePValues);
2256 adapter().updateRow(inputRow, newRow, usePValues);
2257 }
2258@@ -208,9 +208,9 @@
2259
2260 // Execution interface
2261
2262- Execution(QueryContext context, Cursor input)
2263+ Execution(QueryContext context, QueryBindings bindings, Cursor input)
2264 {
2265- super(context);
2266+ super(context, bindings);
2267 this.input = input;
2268 }
2269
2270
2271=== modified file 'src/main/java/com/akiban/qp/operator/Using_BloomFilter.java'
2272--- src/main/java/com/akiban/qp/operator/Using_BloomFilter.java 2013-03-22 20:05:57 +0000
2273+++ src/main/java/com/akiban/qp/operator/Using_BloomFilter.java 2013-07-09 23:55:31 +0000
2274@@ -95,9 +95,9 @@
2275 }
2276
2277 @Override
2278- protected Cursor cursor(QueryContext context)
2279+ protected Cursor cursor(QueryContext context, QueryBindings bindings)
2280 {
2281- return new Execution(context, streamInput.cursor(context));
2282+ return new Execution(context, bindings, streamInput.cursor(context, bindings));
2283 }
2284
2285 @Override
2286@@ -184,7 +184,7 @@
2287 TAP_OPEN.in();
2288 try {
2289 BloomFilter filter = loadBloomFilter();
2290- context.setBloomFilter(filterBindingPosition, filter);
2291+ bindings.setBloomFilter(filterBindingPosition, filter);
2292 input.open();
2293 } finally {
2294 TAP_OPEN.out();
2295@@ -221,7 +221,7 @@
2296 {
2297 close();
2298 input.destroy();
2299- context.setBloomFilter(filterBindingPosition, null);
2300+ bindings.setBloomFilter(filterBindingPosition, null);
2301 }
2302
2303 @Override
2304@@ -244,9 +244,9 @@
2305
2306 // Execution interface
2307
2308- Execution(QueryContext context, Cursor input)
2309+ Execution(QueryContext context, QueryBindings bindings, Cursor input)
2310 {
2311- super(context);
2312+ super(context, bindings);
2313 this.input = input;
2314 }
2315
2316@@ -268,7 +268,7 @@
2317 {
2318 int fields = filterRowType.nFields();
2319 int rows = 0;
2320- Cursor loadCursor = filterInput.cursor(context);
2321+ Cursor loadCursor = filterInput.cursor(context, bindings);
2322 loadCursor.open();
2323 Row row;
2324 while ((row = loadCursor.next()) != null) {
2325
2326=== modified file 'src/main/java/com/akiban/qp/operator/ValuesScan_Default.java'
2327--- src/main/java/com/akiban/qp/operator/ValuesScan_Default.java 2013-03-22 20:05:57 +0000
2328+++ src/main/java/com/akiban/qp/operator/ValuesScan_Default.java 2013-07-09 23:55:31 +0000
2329@@ -77,8 +77,8 @@
2330 }
2331
2332 @Override
2333- protected Cursor cursor(QueryContext context) {
2334- return new Execution(context, rows);
2335+ protected Cursor cursor(QueryContext context, QueryBindings bindings) {
2336+ return new Execution(context, bindings, rows);
2337 }
2338
2339 @Override
2340@@ -123,8 +123,8 @@
2341 private Iterator<? extends BindableRow> iter;
2342 private boolean destroyed = false;
2343
2344- public Execution (QueryContext context, Collection<? extends BindableRow> rows) {
2345- super(context);
2346+ public Execution (QueryContext context, QueryBindings bindings, Collection<? extends BindableRow> rows) {
2347+ super(context, bindings);
2348 this.rows = rows;
2349 }
2350
2351@@ -145,7 +145,7 @@
2352 }
2353 Row output;
2354 if (iter != null && iter.hasNext()) {
2355- output = iter.next().bind(context);
2356+ output = iter.next().bind(context, bindings);
2357 } else {
2358 close();
2359 output = null;
2360
2361=== modified file 'src/main/java/com/akiban/qp/persistitadapter/OperatorBasedRowCollector.java'
2362--- src/main/java/com/akiban/qp/persistitadapter/OperatorBasedRowCollector.java 2013-05-20 14:18:40 +0000
2363+++ src/main/java/com/akiban/qp/persistitadapter/OperatorBasedRowCollector.java 2013-07-09 23:55:31 +0000
2364@@ -22,6 +22,8 @@
2365 import com.akiban.qp.operator.Cursor;
2366 import com.akiban.qp.operator.Limit;
2367 import com.akiban.qp.operator.Operator;
2368+import com.akiban.qp.operator.QueryBindings;
2369+import com.akiban.qp.operator.QueryContext;
2370 import com.akiban.qp.operator.SimpleQueryContext;
2371 import com.akiban.qp.operator.StoreAdapter;
2372 import com.akiban.qp.row.AbstractRow;
2373@@ -65,7 +67,9 @@
2374 if (cursor != null) {
2375 throw new IllegalStateException("cursor is already open");
2376 }
2377- cursor = cursor(operator, new SimpleQueryContext(adapter));
2378+ QueryContext context = new SimpleQueryContext(adapter);
2379+ QueryBindings bindings = context.createBindings();
2380+ cursor = cursor(operator, context, bindings);
2381 cursor.open();
2382 // closed was initialized to true, because hasMore is checked before open. (This is due to scan being
2383 // spread across possibly multiple requests.) Now set closed to false for the actual scanning of rows.
2384
2385=== modified file 'src/main/java/com/akiban/qp/persistitadapter/PersistitAdapter.java'
2386--- src/main/java/com/akiban/qp/persistitadapter/PersistitAdapter.java 2013-07-07 19:04:43 +0000
2387+++ src/main/java/com/akiban/qp/persistitadapter/PersistitAdapter.java 2013-07-09 23:55:31 +0000
2388@@ -71,10 +71,11 @@
2389 }
2390
2391 @Override
2392- public Cursor newIndexCursor(QueryContext context, Index index, IndexKeyRange keyRange, API.Ordering ordering,
2393+ public Cursor newIndexCursor(QueryContext context, QueryBindings bindings, Index index, IndexKeyRange keyRange, API.Ordering ordering,
2394 IndexScanSelector selector, boolean usePValues)
2395 {
2396 return new PersistitIndexCursor(context,
2397+ bindings,
2398 schema.indexRowType(index),
2399 keyRange,
2400 ordering,
2401@@ -84,13 +85,14 @@
2402
2403 @Override
2404 public Sorter createSorter(QueryContext context,
2405+ QueryBindings bindings,
2406 Cursor input,
2407 RowType rowType,
2408 API.Ordering ordering,
2409 API.SortOption sortOption,
2410 InOutTap loadTap)
2411 {
2412- return new PersistitSorter(context, input, rowType, ordering, sortOption, loadTap);
2413+ return new PersistitSorter(context, bindings, input, rowType, ordering, sortOption, loadTap);
2414 }
2415
2416 @Override
2417
2418=== modified file 'src/main/java/com/akiban/qp/persistitadapter/PersistitIndexCursor.java'
2419--- src/main/java/com/akiban/qp/persistitadapter/PersistitIndexCursor.java 2013-06-28 15:04:00 +0000
2420+++ src/main/java/com/akiban/qp/persistitadapter/PersistitIndexCursor.java 2013-07-09 23:55:31 +0000
2421@@ -106,6 +106,7 @@
2422 // For use by this package
2423
2424 PersistitIndexCursor(QueryContext context,
2425+ QueryBindings bindings,
2426 IndexRowType indexRowType,
2427 IndexKeyRange keyRange,
2428 API.Ordering ordering,
2429@@ -115,13 +116,14 @@
2430 this.keyRange = keyRange;
2431 this.ordering = ordering;
2432 this.context = context;
2433+ this.bindings = bindings;
2434 this.indexRowType = indexRowType;
2435 this.isTableIndex = indexRowType.index().isTableIndex();
2436 this.usePValues = usePValues;
2437 this.selector = selector;
2438 this.idle = true;
2439 this.rowState = context.getStore().createIterationHelper(indexRowType);
2440- this.indexCursor = IndexCursor.create(context, keyRange, ordering, rowState, usePValues);
2441+ this.indexCursor = IndexCursor.create(context, bindings, keyRange, ordering, rowState, usePValues);
2442 }
2443
2444 // For use by this class
2445@@ -129,6 +131,7 @@
2446 // Object state
2447
2448 private final QueryContext context;
2449+ private final QueryBindings bindings;
2450 private final IndexRowType indexRowType;
2451 private final IndexKeyRange keyRange;
2452 private final API.Ordering ordering;
2453
2454=== modified file 'src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursor.java'
2455--- src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursor.java 2013-06-27 21:06:53 +0000
2456+++ src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursor.java 2013-07-09 23:55:31 +0000
2457@@ -21,6 +21,7 @@
2458 import com.akiban.qp.operator.API;
2459 import com.akiban.qp.operator.Cursor;
2460 import com.akiban.qp.operator.CursorLifecycle;
2461+import com.akiban.qp.operator.QueryBindings;
2462 import com.akiban.qp.operator.QueryContext;
2463 import com.akiban.qp.operator.StoreAdapter;
2464 import com.akiban.qp.row.Row;
2465@@ -118,6 +119,7 @@
2466 // IndexCursor interface
2467
2468 public static IndexCursor create(QueryContext context,
2469+ QueryBindings bindings,
2470 IndexKeyRange keyRange,
2471 API.Ordering ordering,
2472 IterationHelper iterationHelper,
2473@@ -130,20 +132,21 @@
2474 return
2475 keyRange != null && keyRange.spatial()
2476 ? keyRange.hi() == null
2477- ? IndexCursorSpatial_NearPoint.create(context, iterationHelper, keyRange)
2478- : IndexCursorSpatial_InBox.create(context, iterationHelper, keyRange)
2479+ ? IndexCursorSpatial_NearPoint.create(context, bindings, iterationHelper, keyRange)
2480+ : IndexCursorSpatial_InBox.create(context, bindings, iterationHelper, keyRange)
2481 : ordering.allAscending() || ordering.allDescending()
2482 ? (keyRange != null && keyRange.lexicographic()
2483- ? IndexCursorUnidirectionalLexicographic.create(context, iterationHelper, keyRange, ordering, adapter)
2484- : IndexCursorUnidirectional.create(context, iterationHelper, keyRange, ordering, adapter))
2485- : IndexCursorMixedOrder.create(context, iterationHelper, keyRange, ordering, adapter);
2486+ ? IndexCursorUnidirectionalLexicographic.create(context, bindings, iterationHelper, keyRange, ordering, adapter)
2487+ : IndexCursorUnidirectional.create(context, bindings, iterationHelper, keyRange, ordering, adapter))
2488+ : IndexCursorMixedOrder.create(context, bindings, iterationHelper, keyRange, ordering, adapter);
2489 }
2490
2491 // For use by subclasses
2492
2493- protected IndexCursor(QueryContext context, IterationHelper iterationHelper)
2494+ protected IndexCursor(QueryContext context, QueryBindings bindings, IterationHelper iterationHelper)
2495 {
2496 this.context = context;
2497+ this.bindings = bindings;
2498 this.adapter = context.getStore();
2499 this.iterationHelper = iterationHelper;
2500 }
2501@@ -156,6 +159,7 @@
2502 // Object state
2503
2504 protected final QueryContext context;
2505+ protected final QueryBindings bindings;
2506 protected final StoreAdapter adapter;
2507 protected final IterationHelper iterationHelper;
2508 private boolean idle = true;
2509
2510=== modified file 'src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorMixedOrder.java'
2511--- src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorMixedOrder.java 2013-06-27 21:06:53 +0000
2512+++ src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorMixedOrder.java 2013-07-09 23:55:31 +0000
2513@@ -24,6 +24,7 @@
2514 import com.akiban.qp.expression.IndexBound;
2515 import com.akiban.qp.expression.IndexKeyRange;
2516 import com.akiban.qp.operator.API;
2517+import com.akiban.qp.operator.QueryBindings;
2518 import com.akiban.qp.operator.QueryContext;
2519 import com.akiban.qp.persistitadapter.indexrow.PersistitIndexRow;
2520 import com.akiban.qp.persistitadapter.indexrow.PersistitIndexRowBuffer;
2521@@ -180,12 +181,13 @@
2522 // IndexCursorMixedOrder interface
2523
2524 public static <S, E> IndexCursorMixedOrder<S, E> create(QueryContext context,
2525+ QueryBindings bindings,
2526 IterationHelper iterationHelper,
2527 IndexKeyRange keyRange,
2528 API.Ordering ordering,
2529 SortKeyAdapter<S, E> sortKeyAdapter)
2530 {
2531- return new IndexCursorMixedOrder<>(context, iterationHelper, keyRange, ordering, sortKeyAdapter);
2532+ return new IndexCursorMixedOrder<>(context, bindings, iterationHelper, keyRange, ordering, sortKeyAdapter);
2533 }
2534
2535 public void initializeScanStates()
2536@@ -198,8 +200,8 @@
2537 keyRange == null /* sorting */ ? Integer.MAX_VALUE :
2538 index().isUnique() ? index().getKeyColumns().size() : index().getAllColumns().size();
2539 while (f < min(loBoundColumns, maxSegments)) {
2540- BoundExpressions lo = keyRange.lo().boundExpressions(context);
2541- BoundExpressions hi = keyRange.hi().boundExpressions(context);
2542+ BoundExpressions lo = keyRange.lo().boundExpressions(context, bindings);
2543+ BoundExpressions hi = keyRange.hi().boundExpressions(context, bindings);
2544 S loSource = sortKeyAdapter.get(lo, f);
2545 S hiSource = sortKeyAdapter.get(hi, f);
2546 /*
2547@@ -275,12 +277,13 @@
2548 // For use by subclasses
2549
2550 protected IndexCursorMixedOrder(QueryContext context,
2551+ QueryBindings bindings,
2552 IterationHelper iterationHelper,
2553 IndexKeyRange keyRange,
2554 API.Ordering ordering,
2555 SortKeyAdapter<S, E> sortKeyAdapter)
2556 {
2557- super(context, iterationHelper);
2558+ super(context, bindings, iterationHelper);
2559 this.keyRange = keyRange;
2560 this.ordering = ordering;
2561 this.ascending = new boolean[ordering.sortColumns()];
2562@@ -375,8 +378,8 @@
2563 assert endKey != null : index();
2564 IndexBound lo = keyRange.lo();
2565 IndexBound hi = keyRange.hi();
2566- BoundExpressions loExpressions = lo.boundExpressions(context);
2567- BoundExpressions hiExpressions = hi.boundExpressions(context);
2568+ BoundExpressions loExpressions = lo.boundExpressions(context, bindings);
2569+ BoundExpressions hiExpressions = hi.boundExpressions(context, bindings);
2570 int nColumns = keyRange.boundColumns();
2571 clear(startKey);
2572 clear(endKey);
2573
2574=== modified file 'src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorSpatial_InBox.java'
2575--- src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorSpatial_InBox.java 2013-06-27 21:06:53 +0000
2576+++ src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorSpatial_InBox.java 2013-07-09 23:55:31 +0000
2577@@ -22,6 +22,7 @@
2578 import com.akiban.qp.expression.IndexBound;
2579 import com.akiban.qp.expression.IndexKeyRange;
2580 import com.akiban.qp.operator.API;
2581+import com.akiban.qp.operator.QueryBindings;
2582 import com.akiban.qp.operator.QueryContext;
2583 import com.akiban.qp.row.Row;
2584 import com.akiban.qp.rowtype.IndexRowType;
2585@@ -84,17 +85,18 @@
2586 // IndexCursorSpatial_InBox interface
2587
2588 public static IndexCursorSpatial_InBox create(QueryContext context,
2589+ QueryBindings bindings,
2590 IterationHelper iterationHelper,
2591 IndexKeyRange keyRange)
2592 {
2593- return new IndexCursorSpatial_InBox(context, iterationHelper, keyRange);
2594+ return new IndexCursorSpatial_InBox(context, bindings, iterationHelper, keyRange);
2595 }
2596
2597 // For use by this class
2598
2599- private IndexCursorSpatial_InBox(QueryContext context, IterationHelper iterationHelper, IndexKeyRange keyRange)
2600+ private IndexCursorSpatial_InBox(QueryContext context, QueryBindings bindings, IterationHelper iterationHelper, IndexKeyRange keyRange)
2601 {
2602- super(context, iterationHelper);
2603+ super(context, bindings, iterationHelper);
2604 assert keyRange.spatial();
2605 this.multiCursor = new MultiCursor();
2606 this.iterationHelper = iterationHelper;
2607@@ -114,7 +116,7 @@
2608 IterationHelper rowState = adapter.createIterationHelper(keyRange.indexRowType());
2609 if (Types3Switch.ON) {
2610 IndexCursorUnidirectional<PValueSource> zIntervalCursor =
2611- new IndexCursorUnidirectional<>(context,
2612+ new IndexCursorUnidirectional<>(context, bindings,
2613 rowState,
2614 zKeyRange,
2615 zOrdering,
2616@@ -123,7 +125,7 @@
2617 }
2618 else {
2619 IndexCursorUnidirectional<ValueSource> zIntervalCursor =
2620- new IndexCursorUnidirectional<>(context,
2621+ new IndexCursorUnidirectional<>(context, bindings,
2622 rowState,
2623 zKeyRange,
2624 zOrdering,
2625@@ -139,8 +141,8 @@
2626 Index index = keyRange.indexRowType().index();
2627 IndexBound loBound = keyRange.lo();
2628 IndexBound hiBound = keyRange.hi();
2629- BoundExpressions loExpressions = loBound.boundExpressions(context);
2630- BoundExpressions hiExpressions = hiBound.boundExpressions(context);
2631+ BoundExpressions loExpressions = loBound.boundExpressions(context, bindings);
2632+ BoundExpressions hiExpressions = hiBound.boundExpressions(context, bindings);
2633 // Only 2d, lat/lon supported for now
2634 BigDecimal xLo, xHi, yLo, yHi;
2635 if (Types3Switch.ON) {
2636
2637=== modified file 'src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorSpatial_NearPoint.java'
2638--- src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorSpatial_NearPoint.java 2013-06-27 21:06:53 +0000
2639+++ src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorSpatial_NearPoint.java 2013-07-09 23:55:31 +0000
2640@@ -23,6 +23,7 @@
2641 import com.akiban.qp.expression.IndexKeyRange;
2642 import com.akiban.qp.operator.API;
2643 import com.akiban.qp.operator.Cursor;
2644+import com.akiban.qp.operator.QueryBindings;
2645 import com.akiban.qp.operator.QueryContext;
2646 import com.akiban.qp.row.Row;
2647 import com.akiban.qp.rowtype.IndexRowType;
2648@@ -112,17 +113,18 @@
2649 // IndexCursorSpatial_InBox interface
2650
2651 public static IndexCursorSpatial_NearPoint create(QueryContext context,
2652+ QueryBindings bindings,
2653 IterationHelper iterationHelper,
2654 IndexKeyRange keyRange)
2655 {
2656- return new IndexCursorSpatial_NearPoint(context, iterationHelper, keyRange);
2657+ return new IndexCursorSpatial_NearPoint(context, bindings, iterationHelper, keyRange);
2658 }
2659
2660 // For use by this class
2661
2662- private IndexCursorSpatial_NearPoint(QueryContext context, IterationHelper iterationHelper, IndexKeyRange keyRange)
2663+ private IndexCursorSpatial_NearPoint(QueryContext context, QueryBindings bindings, IterationHelper iterationHelper, IndexKeyRange keyRange)
2664 {
2665- super(context, iterationHelper);
2666+ super(context, bindings, iterationHelper);
2667 assert keyRange.spatial();
2668 this.iterationHelper = iterationHelper;
2669 IndexRowType physicalIndexRowType = keyRange.indexRowType().physicalRowType();
2670@@ -133,7 +135,7 @@
2671 // The index column selector needs to select all the columns before the z column, and the z column itself.
2672 IndexRowPrefixSelector indexColumnSelector = new IndexRowPrefixSelector(latColumn + 1);
2673 IndexBound loBound = keyRange.lo();
2674- BoundExpressions loExpressions = loBound.boundExpressions(context);
2675+ BoundExpressions loExpressions = loBound.boundExpressions(context, bindings);
2676 // Compute z-value at beginning of forward and backward scans
2677 TInstance latInstance = index.getAllColumns().get(latColumn).getColumn().tInstance();
2678 TInstance lonInstance = index.getAllColumns().get(lonColumn).getColumn().tInstance();
2679@@ -181,12 +183,12 @@
2680 upOrdering.append((TPreparedExpression)null, true);
2681 downOrdering.append((TPreparedExpression)null, false);
2682 }
2683- geCursor = new IndexCursorUnidirectional<>(context,
2684+ geCursor = new IndexCursorUnidirectional<>(context, bindings,
2685 geRowState,
2686 geKeyRange,
2687 upOrdering,
2688 PValueSortKeyAdapter.INSTANCE);
2689- ltCursor = new IndexCursorUnidirectional<>(context,
2690+ ltCursor = new IndexCursorUnidirectional<>(context, bindings,
2691 ltRowState,
2692 ltKeyRange,
2693 downOrdering,
2694
2695=== modified file 'src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorUnidirectional.java'
2696--- src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorUnidirectional.java 2013-06-27 21:06:53 +0000
2697+++ src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorUnidirectional.java 2013-07-09 23:55:31 +0000
2698@@ -25,6 +25,7 @@
2699 import com.akiban.qp.expression.IndexBound;
2700 import com.akiban.qp.expression.IndexKeyRange;
2701 import com.akiban.qp.operator.API;
2702+import com.akiban.qp.operator.QueryBindings;
2703 import com.akiban.qp.operator.QueryContext;
2704 import com.akiban.qp.persistitadapter.SpatialHelper;
2705 import com.akiban.qp.persistitadapter.indexrow.PersistitIndexRow;
2706@@ -139,6 +140,7 @@
2707 // IndexCursorUnidirectional interface
2708
2709 public static <S> IndexCursorUnidirectional<S> create(QueryContext context,
2710+ QueryBindings bindings,
2711 IterationHelper iterationHelper,
2712 IndexKeyRange keyRange,
2713 API.Ordering ordering,
2714@@ -146,19 +148,20 @@
2715 {
2716 return
2717 keyRange == null // occurs if we're doing a sort (PersistitSorter)
2718- ? new IndexCursorUnidirectional<>(context, iterationHelper, ordering, sortKeyAdapter)
2719- : new IndexCursorUnidirectional<>(context, iterationHelper, keyRange, ordering, sortKeyAdapter);
2720+ ? new IndexCursorUnidirectional<>(context, bindings, iterationHelper, ordering, sortKeyAdapter)
2721+ : new IndexCursorUnidirectional<>(context, bindings, iterationHelper, keyRange, ordering, sortKeyAdapter);
2722 }
2723
2724 // For use by this subclasses
2725
2726 protected IndexCursorUnidirectional(QueryContext context,
2727+ QueryBindings bindings,
2728 IterationHelper iterationHelper,
2729 IndexKeyRange keyRange,
2730 API.Ordering ordering,
2731 SortKeyAdapter<S, ?> sortKeyAdapter)
2732 {
2733- super(context, iterationHelper);
2734+ super(context, bindings, iterationHelper);
2735 // end state never changes. start state can change on a jump, so it is set in initializeCursor.
2736 this.endBoundColumns = keyRange.boundColumns();
2737 this.endKey = endBoundColumns == 0 ? null : adapter.takeIndexRow(keyRange.indexRowType());
2738@@ -173,8 +176,8 @@
2739 startKey.append(startBoundary);
2740 } else {
2741 // Check constraints on start and end
2742- BoundExpressions loExpressions = lo.boundExpressions(context);
2743- BoundExpressions hiExpressions = hi.boundExpressions(context);
2744+ BoundExpressions loExpressions = lo.boundExpressions(context, bindings);
2745+ BoundExpressions hiExpressions = hi.boundExpressions(context, bindings);
2746 for (int f = 0; f < endBoundColumns - 1; f++) {
2747 keyAdapter.checkConstraints(loExpressions, hiExpressions, f, collators, tInstances);
2748 }
2749@@ -202,8 +205,8 @@
2750 lo and hi to be null, so write null, not Key.AFTER to endKey.
2751 */
2752 // Construct start and end keys
2753- BoundExpressions startExpressions = start.boundExpressions(context);
2754- BoundExpressions endExpressions = end.boundExpressions(context);
2755+ BoundExpressions startExpressions = start.boundExpressions(context, bindings);
2756+ BoundExpressions endExpressions = end.boundExpressions(context, bindings);
2757 // startBoundColumns == endBoundColumns because jump() hasn't been called.
2758 // If it had we'd be in reevaluateBoundaries, not here.
2759 assert startBoundColumns == endBoundColumns;
2760@@ -296,7 +299,7 @@
2761 startKey.append(startBoundary);
2762 } else {
2763 // Construct start key
2764- BoundExpressions startExpressions = start.boundExpressions(context);
2765+ BoundExpressions startExpressions = start.boundExpressions(context, bindings);
2766 S[] startValues = keyAdapter.createSourceArray(startBoundColumns);
2767 for (int f = 0; f < startBoundColumns; f++) {
2768 startValues[f] = keyAdapter.get(startExpressions, f);
2769@@ -480,11 +483,12 @@
2770 }
2771
2772 private IndexCursorUnidirectional(QueryContext context,
2773+ QueryBindings bindings,
2774 IterationHelper iterationHelper,
2775 API.Ordering ordering,
2776 SortKeyAdapter<S, ?> sortKeyAdapter)
2777 {
2778- super(context, iterationHelper);
2779+ super(context, bindings, iterationHelper);
2780 this.keyRange = null;
2781 this.ordering = ordering;
2782 if (ordering.allAscending()) {
2783
2784=== modified file 'src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorUnidirectionalLexicographic.java'
2785--- src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorUnidirectionalLexicographic.java 2013-03-22 20:05:57 +0000
2786+++ src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorUnidirectionalLexicographic.java 2013-07-09 23:55:31 +0000
2787@@ -20,6 +20,7 @@
2788 import com.akiban.qp.expression.BoundExpressions;
2789 import com.akiban.qp.expression.IndexKeyRange;
2790 import com.akiban.qp.operator.API;
2791+import com.akiban.qp.operator.QueryBindings;
2792 import com.akiban.qp.operator.QueryContext;
2793 import com.persistit.Key;
2794
2795@@ -30,23 +31,25 @@
2796 // IndexCursorUnidirectional interface
2797
2798 public static <S> IndexCursorUnidirectionalLexicographic<S> create(QueryContext context,
2799+ QueryBindings bindings,
2800 IterationHelper iterationHelper,
2801 IndexKeyRange keyRange,
2802 API.Ordering ordering,
2803 SortKeyAdapter<S, ?> sortKeyAdapter)
2804 {
2805- return new IndexCursorUnidirectionalLexicographic<>(context, iterationHelper, keyRange, ordering, sortKeyAdapter);
2806+ return new IndexCursorUnidirectionalLexicographic<>(context, bindings, iterationHelper, keyRange, ordering, sortKeyAdapter);
2807 }
2808
2809 // For use by this class
2810
2811 private IndexCursorUnidirectionalLexicographic(QueryContext context,
2812+ QueryBindings bindings,
2813 IterationHelper iterationHelper,
2814 IndexKeyRange keyRange,
2815 API.Ordering ordering,
2816 SortKeyAdapter<S, ?> sortKeyAdapter)
2817 {
2818- super(context, iterationHelper, keyRange, ordering, sortKeyAdapter);
2819+ super(context, bindings, iterationHelper, keyRange, ordering, sortKeyAdapter);
2820 }
2821
2822 @Override
2823@@ -56,7 +59,7 @@
2824 if (startBoundColumns == 0 || start == null) {
2825 startKey.append(startBoundary);
2826 } else {
2827- startExpressions = start.boundExpressions(context);
2828+ startExpressions = start.boundExpressions(context, bindings);
2829 clearStart();
2830 for (int f = 0; f < startBoundColumns; f++) {
2831 if (start.columnSelector().includesColumn(f)) {
2832@@ -69,7 +72,7 @@
2833 if (endBoundColumns == 0 || end == null) {
2834 endKey = null;
2835 } else {
2836- endExpressions = end.boundExpressions(context);
2837+ endExpressions = end.boundExpressions(context, bindings);
2838 clearEnd();
2839 for (int f = 0; f < endBoundColumns; f++) {
2840 if (end.columnSelector().includesColumn(f)) {
2841
2842=== modified file 'src/main/java/com/akiban/qp/persistitadapter/indexcursor/MemorySorter.java'
2843--- src/main/java/com/akiban/qp/persistitadapter/indexcursor/MemorySorter.java 2013-06-07 19:06:29 +0000
2844+++ src/main/java/com/akiban/qp/persistitadapter/indexcursor/MemorySorter.java 2013-07-09 23:55:31 +0000
2845@@ -20,6 +20,7 @@
2846 import com.akiban.qp.operator.API;
2847 import com.akiban.qp.operator.Cursor;
2848 import com.akiban.qp.operator.CursorLifecycle;
2849+import com.akiban.qp.operator.QueryBindings;
2850 import com.akiban.qp.operator.QueryContext;
2851 import com.akiban.qp.persistitadapter.Sorter;
2852 import com.akiban.qp.row.Row;
2853@@ -73,6 +74,7 @@
2854 private final List<Integer> orderChanges;
2855
2856 private final QueryContext context;
2857+ private final QueryBindings bindings;
2858 private final Cursor input;
2859 private final API.Ordering ordering;
2860 private final Key key;
2861@@ -80,6 +82,7 @@
2862 private final SorterAdapter<?, ?, ?> sorterAdapter;
2863
2864 public MemorySorter(QueryContext context,
2865+ QueryBindings bindings,
2866 Cursor input,
2867 RowType rowType,
2868 API.Ordering ordering,
2869@@ -88,13 +91,14 @@
2870 Key key)
2871 {
2872 this.context = context;
2873+ this.bindings = bindings;
2874 this.input = input;
2875 this.ordering = ordering.copy();
2876 this.key = key;
2877 this.loadTap = loadTap;
2878 this.sorterAdapter = new PValueSorterAdapter();
2879 // Note: init may change this.ordering
2880- sorterAdapter.init(rowType, this.ordering, this.key, null, this.context, sortOption);
2881+ sorterAdapter.init(rowType, this.ordering, this.key, null, this.context, this.bindings, sortOption);
2882 // Explicitly use input ordering to avoid appended field
2883 this.orderChanges = new ArrayList<>();
2884 List<Comparator<KeyState>> comparators = new ArrayList<>();
2885
2886=== modified file 'src/main/java/com/akiban/qp/persistitadapter/indexcursor/OldSorterAdapter.java'
2887--- src/main/java/com/akiban/qp/persistitadapter/indexcursor/OldSorterAdapter.java 2013-04-30 23:01:23 +0000
2888+++ src/main/java/com/akiban/qp/persistitadapter/indexcursor/OldSorterAdapter.java 2013-07-09 23:55:31 +0000
2889@@ -17,6 +17,7 @@
2890 package com.akiban.qp.persistitadapter.indexcursor;
2891
2892 import com.akiban.qp.operator.API;
2893+import com.akiban.qp.operator.QueryBindings;
2894 import com.akiban.qp.operator.QueryContext;
2895 import com.akiban.qp.row.Row;
2896 import com.akiban.qp.row.ValuesHolderRow;
2897@@ -60,7 +61,7 @@
2898 }
2899
2900 @Override
2901- protected ExpressionEvaluation evaluation(API.Ordering ordering, QueryContext context, int i) {
2902+ protected ExpressionEvaluation evaluation(API.Ordering ordering, QueryContext context, QueryBindings bindings, int i) {
2903 throw new IllegalStateException("types3 off");
2904 }
2905
2906
2907=== modified file 'src/main/java/com/akiban/qp/persistitadapter/indexcursor/PValueSorterAdapter.java'
2908--- src/main/java/com/akiban/qp/persistitadapter/indexcursor/PValueSorterAdapter.java 2013-04-30 23:01:23 +0000
2909+++ src/main/java/com/akiban/qp/persistitadapter/indexcursor/PValueSorterAdapter.java 2013-07-09 23:55:31 +0000
2910@@ -17,6 +17,7 @@
2911 package com.akiban.qp.persistitadapter.indexcursor;
2912
2913 import com.akiban.qp.operator.API;
2914+import com.akiban.qp.operator.QueryBindings;
2915 import com.akiban.qp.operator.QueryContext;
2916 import com.akiban.qp.row.Row;
2917 import com.akiban.qp.row.ValuesHolderRow;
2918@@ -60,9 +61,10 @@
2919 }
2920
2921 @Override
2922- protected TEvaluatableExpression evaluation(API.Ordering ordering, QueryContext context, int i) {
2923+ protected TEvaluatableExpression evaluation(API.Ordering ordering, QueryContext context, QueryBindings bindings, int i) {
2924 TEvaluatableExpression evaluation = ordering.tExpression(i).build();
2925 evaluation.with(context);
2926+ evaluation.with(bindings);
2927 return evaluation;
2928 }
2929
2930
2931=== modified file 'src/main/java/com/akiban/qp/persistitadapter/indexcursor/PersistitSorter.java'
2932--- src/main/java/com/akiban/qp/persistitadapter/indexcursor/PersistitSorter.java 2013-06-27 21:06:53 +0000
2933+++ src/main/java/com/akiban/qp/persistitadapter/indexcursor/PersistitSorter.java 2013-07-09 23:55:31 +0000
2934@@ -19,6 +19,7 @@
2935
2936 import com.akiban.qp.operator.API;
2937 import com.akiban.qp.operator.Cursor;
2938+import com.akiban.qp.operator.QueryBindings;
2939 import com.akiban.qp.operator.QueryContext;
2940 import com.akiban.qp.persistitadapter.PersistitAdapter;
2941 import com.akiban.qp.persistitadapter.Sorter;
2942@@ -65,6 +66,7 @@
2943 public class PersistitSorter implements Sorter
2944 {
2945 public PersistitSorter(QueryContext context,
2946+ QueryBindings bindings,
2947 Cursor input,
2948 RowType rowType,
2949 API.Ordering ordering,
2950@@ -73,6 +75,7 @@
2951 {
2952 this.usePValues = Types3Switch.ON;
2953 this.context = context;
2954+ this.bindings = bindings;
2955 this.adapter = (PersistitAdapter)context.getStore();
2956 this.input = input;
2957 this.rowType = rowType;
2958@@ -85,7 +88,7 @@
2959 sorterAdapter = usePValues
2960 ? new PValueSorterAdapter()
2961 : new OldSorterAdapter();
2962- sorterAdapter.init(this.rowType, this.ordering, key, value, this.context, sortOption);
2963+ sorterAdapter.init(this.rowType, this.ordering, key, value, this.context, this.bindings, sortOption);
2964 iterationHelper = new SorterIterationHelper(sorterAdapter.createValueAdapter());
2965 this.loadTap = loadTap;
2966
2967@@ -144,7 +147,7 @@
2968 private Cursor cursor()
2969 {
2970 exchange.clear();
2971- return IndexCursor.create(context, null, ordering, iterationHelper, usePValues);
2972+ return IndexCursor.create(context, bindings, null, ordering, iterationHelper, usePValues);
2973 }
2974
2975 private void createKey(Row row)
2976@@ -189,6 +192,7 @@
2977 final RowType rowType;
2978 final API.Ordering ordering;
2979 final QueryContext context;
2980+ final QueryBindings bindings;
2981 final Key key;
2982 final Value value;
2983 final int rowFields;
2984
2985=== modified file 'src/main/java/com/akiban/qp/persistitadapter/indexcursor/SorterAdapter.java'
2986--- src/main/java/com/akiban/qp/persistitadapter/indexcursor/SorterAdapter.java 2013-03-22 20:05:57 +0000
2987+++ src/main/java/com/akiban/qp/persistitadapter/indexcursor/SorterAdapter.java 2013-07-09 23:55:31 +0000
2988@@ -18,6 +18,7 @@
2989
2990 import com.akiban.qp.operator.API;
2991 import com.akiban.qp.operator.API.Ordering;
2992+import com.akiban.qp.operator.QueryBindings;
2993 import com.akiban.qp.operator.QueryContext;
2994 import com.akiban.qp.row.Row;
2995 import com.akiban.qp.row.ValuesHolderRow;
2996@@ -38,7 +39,7 @@
2997 keyTarget = sortKeyAdapter.createTarget();
2998 }
2999
3000- public void init(RowType rowType, Ordering ordering, Key key, Value value, QueryContext context,
3001+ public void init(RowType rowType, Ordering ordering, Key key, Value value, QueryContext context, QueryBindings bindings,
3002 API.SortOption sortOption)
3003 {
3004
3005@@ -69,7 +70,7 @@
3006 for (int i = 0; i < nsort; i++) {
3007 initTypes(ordering, i, oOrderingTypes, tOrderingTypes);
3008 orderingCollators[i] = ordering.collator(i);
3009- V evaluation = evaluation(ordering, context, i);
3010+ V evaluation = evaluation(ordering, context, bindings, i);
3011 evaluations.add(evaluation);
3012 }
3013 }
3014@@ -100,7 +101,7 @@
3015
3016 protected abstract void initTypes(RowType rowType, AkType[] ofFieldTypes, TInstance[] tFieldTypes, int i);
3017 protected abstract void initTypes(Ordering ordering, int i, AkType[] akTypes, TInstance[] tInstances);
3018- protected abstract V evaluation(Ordering ordering, QueryContext context, int i);
3019+ protected abstract V evaluation(Ordering ordering, QueryContext context, QueryBindings bindings, int i);
3020 protected abstract S evaluateRow(V evaluation, Row row);
3021 protected abstract void attachValueTarget(Value value);
3022
3023
3024=== modified file 'src/main/java/com/akiban/qp/row/BindableRow.java'
3025--- src/main/java/com/akiban/qp/row/BindableRow.java 2013-03-22 20:05:57 +0000
3026+++ src/main/java/com/akiban/qp/row/BindableRow.java 2013-07-09 23:55:31 +0000
3027@@ -20,6 +20,7 @@
3028 import com.akiban.qp.expression.ExpressionRow;
3029 import com.akiban.qp.operator.API;
3030 import com.akiban.qp.operator.ExpressionGenerator;
3031+import com.akiban.qp.operator.QueryBindings;
3032 import com.akiban.qp.operator.QueryContext;
3033 import com.akiban.qp.rowtype.RowType;
3034 import com.akiban.server.explain.*;
3035@@ -83,7 +84,7 @@
3036
3037 // BindableRow instance interface
3038
3039- public abstract Row bind(QueryContext context);
3040+ public abstract Row bind(QueryContext context, QueryBindings bindings);
3041 public abstract CompoundExplainer getExplainer(ExplainContext context);
3042
3043 private static ImmutableRow strictCopy(Row input, boolean usePValues) {
3044@@ -104,8 +105,8 @@
3045
3046 private static class BindingExpressions extends BindableRow {
3047 @Override
3048- public Row bind(QueryContext context) {
3049- return new ExpressionRow(rowType, context, expressions, pExprs);
3050+ public Row bind(QueryContext context, QueryBindings bindings) {
3051+ return new ExpressionRow(rowType, context, bindings, expressions, pExprs);
3052 }
3053
3054 @Override
3055@@ -263,7 +264,7 @@
3056
3057 private static class Delegating extends BindableRow {
3058 @Override
3059- public Row bind(QueryContext context) {
3060+ public Row bind(QueryContext context, QueryBindings bindings) {
3061 return row;
3062 }
3063
3064
3065=== modified file 'src/main/java/com/akiban/qp/row/ProjectedRow.java'
3066--- src/main/java/com/akiban/qp/row/ProjectedRow.java 2013-03-22 20:05:57 +0000
3067+++ src/main/java/com/akiban/qp/row/ProjectedRow.java 2013-07-09 23:55:31 +0000
3068@@ -17,6 +17,7 @@
3069
3070 package com.akiban.qp.row;
3071
3072+import com.akiban.qp.operator.QueryBindings;
3073 import com.akiban.qp.operator.QueryContext;
3074 import com.akiban.qp.rowtype.ProjectedRowType;
3075 import com.akiban.qp.rowtype.RowType;
3076@@ -96,8 +97,9 @@
3077 public PValueSource pvalue(int index) {
3078 TEvaluatableExpression evaluatableExpression = pEvaluatableExpressions.get(index);
3079 if (!evaluated[index]) {
3080+ evaluatableExpression.with(context);
3081+ evaluatableExpression.with(bindings);
3082 evaluatableExpression.with(row);
3083- evaluatableExpression.with(context);
3084 evaluatableExpression.evaluate();
3085 evaluated[index] = true;
3086 }
3087@@ -129,14 +131,16 @@
3088 public ProjectedRow(ProjectedRowType rowType,
3089 Row row,
3090 QueryContext context,
3091+ QueryBindings bindings,
3092 List<? extends Expression> expressions,
3093 List<TEvaluatableExpression> pEvaluatableExprs,
3094 List<? extends TInstance> tInstances)
3095 {
3096 this.context = context;
3097+ this.bindings = bindings;
3098 this.rowType = rowType;
3099 this.row = row;
3100- this.evaluations = createEvaluations(expressions, row, context);
3101+ this.evaluations = createEvaluations(expressions, row, context, bindings);
3102 this.pEvaluatableExpressions = pEvaluatableExprs;
3103 if (pEvaluatableExpressions == null)
3104 evaluated = null;
3105@@ -176,7 +180,7 @@
3106 // For use by this class
3107
3108 private List<ExpressionEvaluation> createEvaluations(List<? extends Expression> expressions,
3109- Row row, QueryContext context)
3110+ Row row, QueryContext context, QueryBindings bindings)
3111 {
3112 if (expressions == null)
3113 return null;
3114@@ -185,6 +189,7 @@
3115 for (int i = 0; i < n; i++) {
3116 ExpressionEvaluation evaluation = expressions.get(i).evaluation();
3117 evaluation.of(context);
3118+ evaluation.of(bindings);
3119 evaluation.of(row);
3120 result.add(evaluation);
3121 }
3122@@ -209,6 +214,7 @@
3123 // Object state
3124
3125 private final QueryContext context;
3126+ private final QueryBindings bindings;
3127 private final ProjectedRowType rowType;
3128 private final Row row;
3129 private final List<ExpressionEvaluation> evaluations;
3130
3131=== modified file 'src/main/java/com/akiban/server/expression/ExpressionEvaluation.java'
3132--- src/main/java/com/akiban/server/expression/ExpressionEvaluation.java 2013-03-22 20:05:57 +0000
3133+++ src/main/java/com/akiban/server/expression/ExpressionEvaluation.java 2013-07-09 23:55:31 +0000
3134@@ -17,6 +17,7 @@
3135
3136 package com.akiban.server.expression;
3137
3138+import com.akiban.qp.operator.QueryBindings;
3139 import com.akiban.qp.operator.QueryContext;
3140 import com.akiban.qp.row.Row;
3141 import com.akiban.server.types.ValueSource;
3142@@ -74,11 +75,17 @@
3143
3144 /**
3145 * Binds this evaluation to a query context
3146- * @param context the query context to use to access storage and bindings
3147+ * @param context the query context to use to access storage and state
3148 */
3149 void of(QueryContext context);
3150
3151 /**
3152+ * Binds this evaluation to a query bindings
3153+ * @param bindings the query binding to use to access bound values
3154+ */
3155+ void of(QueryBindings bindings);
3156+
3157+ /**
3158 * Gets a ValueSource that represents this evaluation. The returned ValueSource is mutable, and may change
3159 * if you call either {@code of} method <em>or</em> let the bound (input) QueryContext or Row change. The ValueSource
3160 * may be lazily evaluated, too.
3161
3162=== modified file 'src/main/java/com/akiban/server/expression/std/AbstractCompositeExpressionEvaluation.java'
3163--- src/main/java/com/akiban/server/expression/std/AbstractCompositeExpressionEvaluation.java 2013-03-22 20:05:57 +0000
3164+++ src/main/java/com/akiban/server/expression/std/AbstractCompositeExpressionEvaluation.java 2013-07-09 23:55:31 +0000
3165@@ -17,6 +17,7 @@
3166
3167 package com.akiban.server.expression.std;
3168
3169+import com.akiban.qp.operator.QueryBindings;
3170 import com.akiban.qp.operator.QueryContext;
3171 import com.akiban.qp.row.Row;
3172 import com.akiban.server.expression.ExpressionEvaluation;
3173@@ -48,6 +49,15 @@
3174 }
3175
3176 @Override
3177+ public void of(QueryBindings bindings)
3178+ {
3179+ for (int i = 0; i < nChildren; i++) {
3180+ children.get(i).of(bindings);
3181+ }
3182+ this.bindings = bindings;
3183+ }
3184+
3185+ @Override
3186 public void destroy()
3187 {
3188 for (int i = 0; i < nChildren; i++) {
3189@@ -105,10 +115,15 @@
3190 return context;
3191 }
3192
3193+ protected QueryBindings queryBindings() {
3194+ return bindings;
3195+ }
3196+
3197 // object state
3198
3199 private final List<? extends ExpressionEvaluation> children;
3200 private final int nChildren;
3201 private ValueHolder valueHolder;
3202 private QueryContext context;
3203+ private QueryBindings bindings;
3204 }
3205
3206=== modified file 'src/main/java/com/akiban/server/expression/std/AbstractNoArgExpressionEvaluation.java'
3207--- src/main/java/com/akiban/server/expression/std/AbstractNoArgExpressionEvaluation.java 2013-03-22 20:05:57 +0000
3208+++ src/main/java/com/akiban/server/expression/std/AbstractNoArgExpressionEvaluation.java 2013-07-09 23:55:31 +0000
3209@@ -17,6 +17,7 @@
3210
3211 package com.akiban.server.expression.std;
3212
3213+import com.akiban.qp.operator.QueryBindings;
3214 import com.akiban.qp.operator.QueryContext;
3215 import com.akiban.qp.row.Row;
3216 import com.akiban.server.expression.ExpressionEvaluation;
3217@@ -32,6 +33,10 @@
3218 }
3219
3220 @Override
3221+ public void of(QueryBindings bindings) {
3222+ }
3223+
3224+ @Override
3225 public void acquire() {
3226 }
3227
3228
3229=== modified file 'src/main/java/com/akiban/server/expression/std/AbstractUnaryExpressionEvaluation.java'
3230--- src/main/java/com/akiban/server/expression/std/AbstractUnaryExpressionEvaluation.java 2013-03-22 20:05:57 +0000
3231+++ src/main/java/com/akiban/server/expression/std/AbstractUnaryExpressionEvaluation.java 2013-07-09 23:55:31 +0000
3232@@ -17,6 +17,7 @@
3233
3234 package com.akiban.server.expression.std;
3235
3236+import com.akiban.qp.operator.QueryBindings;
3237 import com.akiban.qp.operator.QueryContext;
3238 import com.akiban.qp.row.Row;
3239 import com.akiban.server.expression.ExpressionEvaluation;
3240@@ -37,6 +38,12 @@
3241 }
3242
3243 @Override
3244+ public void of(QueryBindings bindings) {
3245+ operandEvaluation.of(bindings);
3246+ this.bindings = bindings;
3247+ }
3248+
3249+ @Override
3250 public void destroy() {
3251 operandEvaluation.destroy();
3252 }
3253@@ -81,4 +88,5 @@
3254 private final ExpressionEvaluation operandEvaluation;
3255 private ValueHolder valueHolder;
3256 private QueryContext context;
3257+ private QueryBindings bindings;
3258 }
3259
3260=== modified file 'src/main/java/com/akiban/server/expression/std/BoundFieldExpression.java'
3261--- src/main/java/com/akiban/server/expression/std/BoundFieldExpression.java 2013-03-22 20:05:57 +0000
3262+++ src/main/java/com/akiban/server/expression/std/BoundFieldExpression.java 2013-07-09 23:55:31 +0000
3263@@ -18,6 +18,7 @@
3264 package com.akiban.server.expression.std;
3265
3266 import com.akiban.qp.exec.Plannable;
3267+import com.akiban.qp.operator.QueryBindings;
3268 import com.akiban.qp.operator.QueryContext;
3269 import com.akiban.qp.row.Row;
3270 import com.akiban.server.explain.CompoundExplainer;
3271@@ -107,7 +108,11 @@
3272
3273 @Override
3274 public void of(QueryContext context) {
3275- fieldExpressionEvaluation.of(context.getRow(rowBindingPosition));
3276+ }
3277+
3278+ @Override
3279+ public void of(QueryBindings bindings) {
3280+ fieldExpressionEvaluation.of(bindings.getRow(rowBindingPosition));
3281 }
3282
3283 @Override
3284
3285=== modified file 'src/main/java/com/akiban/server/expression/std/ColumnExpression.java'
3286--- src/main/java/com/akiban/server/expression/std/ColumnExpression.java 2013-03-22 20:05:57 +0000
3287+++ src/main/java/com/akiban/server/expression/std/ColumnExpression.java 2013-07-09 23:55:31 +0000
3288@@ -19,6 +19,7 @@
3289
3290 import com.akiban.ais.model.Column;
3291 import com.akiban.qp.exec.Plannable;
3292+import com.akiban.qp.operator.QueryBindings;
3293 import com.akiban.qp.operator.QueryContext;
3294 import com.akiban.qp.row.Row;
3295 import com.akiban.server.explain.CompoundExplainer;
3296@@ -116,6 +117,10 @@
3297 }
3298
3299 @Override
3300+ public void of(QueryBindings bindings) {
3301+ }
3302+
3303+ @Override
3304 public ValueSource eval() {
3305 if (row == null)
3306 throw new IllegalStateException("haven't seen a row to target");
3307
3308=== modified file 'src/main/java/com/akiban/server/expression/std/FieldExpression.java'
3309--- src/main/java/com/akiban/server/expression/std/FieldExpression.java 2013-03-22 20:05:57 +0000
3310+++ src/main/java/com/akiban/server/expression/std/FieldExpression.java 2013-07-09 23:55:31 +0000
3311@@ -18,6 +18,7 @@
3312 package com.akiban.server.expression.std;
3313
3314 import com.akiban.qp.exec.Plannable;
3315+import com.akiban.qp.operator.QueryBindings;
3316 import com.akiban.qp.operator.QueryContext;
3317 import com.akiban.qp.row.Row;
3318 import com.akiban.qp.rowtype.RowType;
3319@@ -131,6 +132,10 @@
3320 }
3321
3322 @Override
3323+ public void of(QueryBindings bindings) {
3324+ }
3325+
3326+ @Override
3327 public ValueSource eval() {
3328 if (row == null)
3329 throw new IllegalStateException("haven't seen a row to target");
3330
3331=== modified file 'src/main/java/com/akiban/server/expression/std/LiteralExpression.java'
3332--- src/main/java/com/akiban/server/expression/std/LiteralExpression.java 2013-03-22 20:05:57 +0000
3333+++ src/main/java/com/akiban/server/expression/std/LiteralExpression.java 2013-07-09 23:55:31 +0000
3334@@ -18,6 +18,7 @@
3335 package com.akiban.server.expression.std;
3336
3337 import com.akiban.qp.exec.Plannable;
3338+import com.akiban.qp.operator.QueryBindings;
3339 import com.akiban.qp.operator.QueryContext;
3340 import com.akiban.qp.row.Row;
3341 import com.akiban.server.explain.Explainer;
3342@@ -155,6 +156,10 @@
3343 }
3344
3345 @Override
3346+ public void of(QueryBindings bindings) {
3347+ }
3348+
3349+ @Override
3350 public ValueSource eval() {
3351 return valueSource;
3352 }
3353
3354=== modified file 'src/main/java/com/akiban/server/expression/std/SequenceCurrentValueExpression.java'
3355--- src/main/java/com/akiban/server/expression/std/SequenceCurrentValueExpression.java 2013-03-22 20:05:57 +0000
3356+++ src/main/java/com/akiban/server/expression/std/SequenceCurrentValueExpression.java 2013-07-09 23:55:31 +0000
3357@@ -18,6 +18,7 @@
3358 package com.akiban.server.expression.std;
3359
3360 import com.akiban.ais.model.TableName;
3361+import com.akiban.qp.operator.QueryBindings;
3362 import com.akiban.qp.operator.QueryContext;
3363 import com.akiban.qp.row.Row;
3364 import com.akiban.server.expression.Expression;
3365@@ -99,6 +100,12 @@
3366 }
3367
3368 @Override
3369+ public void of(QueryBindings bindings) {
3370+ super.of(bindings);
3371+ needAnother = true;
3372+ }
3373+
3374+ @Override
3375 public void of(Row row) {
3376 super.of(row);
3377 needAnother = true;
3378
3379=== modified file 'src/main/java/com/akiban/server/expression/std/SequenceNextValueExpression.java'
3380--- src/main/java/com/akiban/server/expression/std/SequenceNextValueExpression.java 2013-03-22 20:05:57 +0000
3381+++ src/main/java/com/akiban/server/expression/std/SequenceNextValueExpression.java 2013-07-09 23:55:31 +0000
3382@@ -18,6 +18,7 @@
3383 package com.akiban.server.expression.std;
3384
3385 import com.akiban.ais.model.TableName;
3386+import com.akiban.qp.operator.QueryBindings;
3387 import com.akiban.qp.operator.QueryContext;
3388 import com.akiban.qp.row.Row;
3389 import com.akiban.server.expression.Expression;
3390@@ -99,6 +100,12 @@
3391 }
3392
3393 @Override
3394+ public void of(QueryBindings bindings) {
3395+ super.of(bindings);
3396+ needAnother = true;
3397+ }
3398+
3399+ @Override
3400 public void of(Row row) {
3401 super.of(row);
3402 needAnother = true;
3403
3404=== modified file 'src/main/java/com/akiban/server/expression/std/ValueSourceExpression.java'
3405--- src/main/java/com/akiban/server/expression/std/ValueSourceExpression.java 2013-03-22 20:05:57 +0000
3406+++ src/main/java/com/akiban/server/expression/std/ValueSourceExpression.java 2013-07-09 23:55:31 +0000
3407@@ -18,6 +18,7 @@
3408 package com.akiban.server.expression.std;
3409
3410 import com.akiban.qp.exec.Plannable;
3411+import com.akiban.qp.operator.QueryBindings;
3412 import com.akiban.qp.operator.QueryContext;
3413 import com.akiban.qp.row.Row;
3414 import com.akiban.server.explain.CompoundExplainer;
3415@@ -118,6 +119,11 @@
3416 }
3417
3418 @Override
3419+ public void of(QueryBindings bindings)
3420+ {
3421+ }
3422+
3423+ @Override
3424 public ValueSource eval()
3425 {
3426 return valueSource;
3427
3428=== modified file 'src/main/java/com/akiban/server/expression/std/VariableExpression.java'
3429--- src/main/java/com/akiban/server/expression/std/VariableExpression.java 2013-03-22 20:05:57 +0000
3430+++ src/main/java/com/akiban/server/expression/std/VariableExpression.java 2013-07-09 23:55:31 +0000
3431@@ -18,6 +18,7 @@
3432 package com.akiban.server.expression.std;
3433
3434 import com.akiban.qp.exec.Plannable;
3435+import com.akiban.qp.operator.QueryBindings;
3436 import com.akiban.qp.operator.QueryContext;
3437 import com.akiban.qp.row.Row;
3438 import com.akiban.server.explain.CompoundExplainer;
3439@@ -106,12 +107,16 @@
3440
3441 @Override
3442 public void of(QueryContext context) {
3443- this.context = context;
3444+ }
3445+
3446+ @Override
3447+ public void of(QueryBindings bindings) {
3448+ this.bindings = bindings;
3449 }
3450
3451 @Override
3452 public ValueSource eval() {
3453- return context.getValue(position);
3454+ return bindings.getValue(position);
3455 }
3456
3457 @Override
3458@@ -137,7 +142,7 @@
3459
3460 private final AkType type;
3461 private final int position;
3462- private QueryContext context;
3463+ private QueryBindings bindings;
3464 private int ownedBy = 0;
3465 }
3466 }
3467
3468=== modified file 'src/main/java/com/akiban/server/expression/subquery/AnySubqueryExpression.java'
3469--- src/main/java/com/akiban/server/expression/subquery/AnySubqueryExpression.java 2013-03-22 20:05:57 +0000
3470+++ src/main/java/com/akiban/server/expression/subquery/AnySubqueryExpression.java 2013-07-09 23:55:31 +0000
3471@@ -74,6 +74,7 @@
3472 @Override
3473 public ValueSource doEval() {
3474 expressionEvaluation.of(queryContext());
3475+ expressionEvaluation.of(queryBindings());
3476 Boolean result = Boolean.FALSE;
3477 BooleanExtractor extractor = Extractors.getBooleanExtractor();
3478 while (true) {
3479
3480=== modified file 'src/main/java/com/akiban/server/expression/subquery/ResultSetSubqueryExpression.java'
3481--- src/main/java/com/akiban/server/expression/subquery/ResultSetSubqueryExpression.java 2013-03-22 20:05:57 +0000
3482+++ src/main/java/com/akiban/server/expression/subquery/ResultSetSubqueryExpression.java 2013-07-09 23:55:31 +0000
3483@@ -20,6 +20,7 @@
3484 import com.akiban.qp.operator.API;
3485 import com.akiban.qp.operator.Cursor;
3486 import com.akiban.qp.operator.Operator;
3487+import com.akiban.qp.operator.QueryBindings;
3488 import com.akiban.qp.operator.QueryContext;
3489 import com.akiban.qp.row.Row;
3490 import com.akiban.qp.rowtype.RowType;
3491@@ -65,6 +66,11 @@
3492 }
3493
3494 @Override
3495+ public void of(QueryBindings bindings) {
3496+ this.bindings = bindings;
3497+ }
3498+
3499+ @Override
3500 public void of(Row row) {
3501 if (row.rowType() != outerRowType) {
3502 throw new IllegalArgumentException("wrong row type: " + outerRowType +
3503@@ -75,8 +81,8 @@
3504
3505 @Override
3506 public ValueSource eval() {
3507- context.setRow(bindingPosition, outerRow);
3508- Cursor cursor = API.cursor(subquery, context);
3509+ bindings.setRow(bindingPosition, outerRow);
3510+ Cursor cursor = API.cursor(subquery, context, bindings);
3511 cursor.open();
3512 return new ValueHolder(AkType.RESULT_SET, cursor);
3513 }
3514@@ -110,6 +116,7 @@
3515 private final RowType outerRowType;
3516 private final int bindingPosition;
3517 private QueryContext context;
3518+ private QueryBindings bindings;
3519 private Row outerRow;
3520 }
3521
3522
3523=== modified file 'src/main/java/com/akiban/server/expression/subquery/ScalarSubqueryExpression.java'
3524--- src/main/java/com/akiban/server/expression/subquery/ScalarSubqueryExpression.java 2013-03-22 20:05:57 +0000
3525+++ src/main/java/com/akiban/server/expression/subquery/ScalarSubqueryExpression.java 2013-07-09 23:55:31 +0000
3526@@ -76,6 +76,7 @@
3527 if (row == null)
3528 return NullValueSource.only();
3529 expressionEvaluation.of(queryContext());
3530+ expressionEvaluation.of(queryBindings());
3531 expressionEvaluation.of(row);
3532 // Make a copy of the value evaluated right now, rather
3533 // than holding on to the row from the subquery cursor
3534
3535=== modified file 'src/main/java/com/akiban/server/expression/subquery/SubqueryExpressionEvaluation.java'
3536--- src/main/java/com/akiban/server/expression/subquery/SubqueryExpressionEvaluation.java 2013-03-22 20:05:57 +0000
3537+++ src/main/java/com/akiban/server/expression/subquery/SubqueryExpressionEvaluation.java 2013-07-09 23:55:31 +0000
3538@@ -20,6 +20,7 @@
3539 import com.akiban.qp.operator.API;
3540 import com.akiban.qp.operator.Cursor;
3541 import com.akiban.qp.operator.Operator;
3542+import com.akiban.qp.operator.QueryBindings;
3543 import com.akiban.qp.operator.QueryContext;
3544 import com.akiban.qp.row.Row;
3545 import com.akiban.qp.rowtype.RowType;
3546@@ -31,7 +32,13 @@
3547 @Override
3548 public void of(QueryContext context) {
3549 this.context = context;
3550- this.cursor = API.cursor(subquery, context);
3551+ cursor = null;
3552+ }
3553+
3554+ @Override
3555+ public void of(QueryBindings bindings) {
3556+ this.bindings = bindings;
3557+ cursor = null;
3558 }
3559
3560 @Override
3561@@ -45,7 +52,10 @@
3562
3563 @Override
3564 public final ValueSource eval() {
3565- context.setRow(bindingPosition, outerRow);
3566+ bindings.setRow(bindingPosition, outerRow);
3567+ if (cursor == null) {
3568+ cursor = API.cursor(subquery, context, bindings);
3569+ }
3570 cursor.open();
3571 try {
3572 return doEval();
3573@@ -88,6 +98,10 @@
3574 return context;
3575 }
3576
3577+ protected QueryBindings queryBindings() {
3578+ return bindings;
3579+ }
3580+
3581 protected Row next() {
3582 Row row = cursor.next();
3583 if ((row != null) &&
3584@@ -113,6 +127,7 @@
3585 private final int bindingPosition;
3586 private Cursor cursor;
3587 private QueryContext context;
3588+ private QueryBindings bindings;
3589 private Row outerRow;
3590
3591 }
3592
3593=== modified file 'src/main/java/com/akiban/server/service/dxl/BasicDDLFunctions.java'
3594--- src/main/java/com/akiban/server/service/dxl/BasicDDLFunctions.java 2013-07-07 19:27:17 +0000
3595+++ src/main/java/com/akiban/server/service/dxl/BasicDDLFunctions.java 2013-07-09 23:55:31 +0000
3596@@ -50,6 +50,7 @@
3597 import com.akiban.ais.util.TableChangeValidatorException;
3598 import com.akiban.qp.operator.API;
3599 import com.akiban.qp.operator.Operator;
3600+import com.akiban.qp.operator.QueryBindings;
3601 import com.akiban.qp.operator.QueryContext;
3602 import com.akiban.qp.operator.QueryContextBase;
3603 import com.akiban.qp.operator.SimpleQueryContext;
3604@@ -292,12 +293,13 @@
3605 final RowType oldSourceType = oldSchema.userTableRowType(origTable);
3606 final StoreAdapter adapter = store().createAdapter(session, oldSchema);
3607 final QueryContext queryContext = new ShimContext(adapter, context);
3608+ final QueryBindings queryBindings = queryContext.createBindings();
3609
3610 Operator plan = filter_Default(
3611 groupScan_Default(origTable.getGroup()),
3612 Collections.singleton(oldSourceType)
3613 );
3614- com.akiban.qp.operator.Cursor cursor = API.cursor(plan, queryContext);
3615+ com.akiban.qp.operator.Cursor cursor = API.cursor(plan, queryContext, queryBindings);
3616
3617 cursor.open();
3618 try {
3619@@ -369,6 +371,7 @@
3620 // Build transformation
3621 final StoreAdapter adapter = store().createAdapter(session, origSchema);
3622 final QueryContext queryContext = new ShimContext(adapter, context);
3623+ final QueryBindings queryBindings = queryContext.createBindings();
3624
3625 final AkibanInformationSchema newAIS = getAIS(session);
3626 final UserTable newTable = newAIS.getUserTable(newDefinition.getName());
3627@@ -474,7 +477,7 @@
3628
3629 for(UserTable root : roots) {
3630 Operator plan = groupScan_Default(root.getGroup());
3631- com.akiban.qp.operator.Cursor cursor = API.cursor(plan, queryContext);
3632+ com.akiban.qp.operator.Cursor cursor = API.cursor(plan, queryContext, queryBindings);
3633 cursor.open();
3634 try {
3635 Row oldRow;
3636@@ -486,6 +489,7 @@
3637 newRow = new ProjectedRow(newTableType,
3638 oldRow,
3639 queryContext,
3640+ queryBindings,
3641 projections,
3642 ProjectedRow.createTEvaluatableExpressions(pProjections),
3643 TInstance.createTInstances(pProjections));
3644
3645=== modified file 'src/main/java/com/akiban/server/service/externaldata/ExternalDataServiceImpl.java'
3646--- src/main/java/com/akiban/server/service/externaldata/ExternalDataServiceImpl.java 2013-06-12 21:51:17 +0000
3647+++ src/main/java/com/akiban/server/service/externaldata/ExternalDataServiceImpl.java 2013-07-09 23:55:31 +0000
3648@@ -25,10 +25,11 @@
3649 import com.akiban.qp.operator.API;
3650 import com.akiban.qp.operator.Cursor;
3651 import com.akiban.qp.operator.Operator;
3652+import com.akiban.qp.operator.QueryBindings;
3653 import com.akiban.qp.operator.QueryContext;
3654-import com.akiban.qp.rowtype.RowType;
3655 import com.akiban.qp.operator.SimpleQueryContext;
3656 import com.akiban.qp.operator.StoreAdapter;
3657+import com.akiban.qp.rowtype.RowType;
3658 import com.akiban.qp.rowtype.Schema;
3659 import com.akiban.server.api.dml.scan.NewRow;
3660 import com.akiban.server.api.DMLFunctions;
3661@@ -118,6 +119,7 @@
3662 return serviceManager;
3663 }
3664 };
3665+ QueryBindings queryBindings = queryContext.createBindings();
3666 JsonRowWriter json = new JsonRowWriter(new TableRowTracker(table, depth));
3667 WriteTableRow rowWriter = new WriteTableRow();
3668 AkibanAppender appender = AkibanAppender.of(writer);
3669@@ -128,7 +130,7 @@
3670 transactionService.beginTransaction(session);
3671 transaction = true;
3672 }
3673- cursor = API.cursor(plan, queryContext);
3674+ cursor = API.cursor(plan, queryContext, queryBindings);
3675 appender.append("[");
3676 boolean begun = false;
3677
3678@@ -140,7 +142,7 @@
3679 for (int i = 0; i < key.size(); i++) {
3680 String akey = key.get(i);
3681 pvalue.putString(akey, null);
3682- queryContext.setPValue(i, pvalue);
3683+ queryBindings.setPValue(i, pvalue);
3684 }
3685 if (json.writeRows(cursor, appender, begun ? ",\n" : "\n", rowWriter))
3686 begun = true;
3687
3688=== modified file 'src/main/java/com/akiban/server/service/restdml/DMLProcessor.java'
3689--- src/main/java/com/akiban/server/service/restdml/DMLProcessor.java 2013-06-11 16:32:59 +0000
3690+++ src/main/java/com/akiban/server/service/restdml/DMLProcessor.java 2013-07-09 23:55:31 +0000
3691@@ -24,6 +24,7 @@
3692 import com.akiban.ais.model.Column;
3693 import com.akiban.ais.model.TableName;
3694 import com.akiban.ais.model.UserTable;
3695+import com.akiban.qp.operator.QueryBindings;
3696 import com.akiban.qp.operator.QueryContext;
3697 import com.akiban.qp.operator.StoreAdapter;
3698 import com.akiban.qp.rowtype.Schema;
3699@@ -59,7 +60,7 @@
3700 return column;
3701 }
3702
3703- protected void setValue (QueryContext queryContext, Column column, String value) {
3704+ protected void setValue (QueryBindings queryBindings, Column column, String value) {
3705 PValue pvalue = null;
3706 if (value == null) {
3707 pvalue = new PValue(MString.varchar());
3708@@ -67,7 +68,7 @@
3709 } else {
3710 pvalue = new PValue(MString.varcharFor(value), value);
3711 }
3712- queryContext.setPValue(column.getPosition(), pvalue);
3713+ queryBindings.setPValue(column.getPosition(), pvalue);
3714
3715 }
3716
3717@@ -81,6 +82,7 @@
3718 public TableName tableName;
3719 public UserTable table;
3720 public QueryContext queryContext;
3721+ public QueryBindings queryBindings;
3722 public Session session;
3723 public Map<Column, PValueSource> pkValues;
3724 public Map<Column, String> allValues;
3725@@ -94,20 +96,16 @@
3726 this.session = session;
3727 this.schema = SchemaCache.globalSchema(ais);
3728 this.table = getTable();
3729- this.queryContext = newQueryContext();
3730+ this.queryContext = new RestQueryContext(getAdapter());
3731+ this.queryBindings = queryContext.createBindings();
3732 allValues = new HashMap<>();
3733+ setColumnsNull (queryBindings, table);
3734 }
3735
3736 protected AkibanInformationSchema ais() {
3737 return ais;
3738 }
3739
3740- private QueryContext newQueryContext () {
3741- QueryContext queryContext = new RestQueryContext(getAdapter());
3742- setColumnsNull (queryContext, table);
3743- return queryContext;
3744- }
3745-
3746 private StoreAdapter getAdapter() {
3747 // no writing to the memory tables.
3748 if (table.hasMemoryTableFactory())
3749@@ -127,11 +125,11 @@
3750 }
3751 return table;
3752 }
3753- protected void setColumnsNull (QueryContext queryContext, UserTable table) {
3754+ protected void setColumnsNull (QueryBindings queryBindings, UserTable table) {
3755 for (Column column : table.getColumns()) {
3756 PValue pvalue = new PValue (column.tInstance());
3757 pvalue.putNull();
3758- queryContext.setPValue(column.getPosition(), pvalue);
3759+ queryBindings.setPValue(column.getPosition(), pvalue);
3760 }
3761 }
3762 }
3763
3764=== modified file 'src/main/java/com/akiban/server/service/restdml/DeleteProcessor.java'
3765--- src/main/java/com/akiban/server/service/restdml/DeleteProcessor.java 2013-06-11 16:32:59 +0000
3766+++ src/main/java/com/akiban/server/service/restdml/DeleteProcessor.java 2013-07-09 23:55:31 +0000
3767@@ -67,13 +67,13 @@
3768
3769 try {
3770 Operator delete = deleteGenerator.get(tableName);
3771- cursor = API.cursor(delete, context.queryContext);
3772+ cursor = API.cursor(delete, context.queryContext, context.queryBindings);
3773
3774 for (List<String> key : pks) {
3775 for (int i = 0; i < key.size(); i++) {
3776 String akey = key.get(i);
3777 pvalue.putString(akey, null);
3778- context.queryContext.setPValue(i, pvalue);
3779+ context.queryBindings.setPValue(i, pvalue);
3780 }
3781
3782 cursor.open();
3783
3784=== modified file 'src/main/java/com/akiban/server/service/restdml/InsertProcessor.java'
3785--- src/main/java/com/akiban/server/service/restdml/InsertProcessor.java 2013-06-11 16:32:59 +0000
3786+++ src/main/java/com/akiban/server/service/restdml/InsertProcessor.java 2013-07-09 23:55:31 +0000
3787@@ -143,9 +143,9 @@
3788 private void setValue (String field, JsonNode node, ProcessContext context) {
3789 Column column = getColumn (context.table, field);
3790 if (node.isNull()) {
3791- setValue (context.queryContext, column, null);
3792+ setValue (context.queryBindings, column, null);
3793 } else {
3794- setValue (context.queryContext, column, node.asText());
3795+ setValue (context.queryBindings, column, node.asText());
3796 }
3797 }
3798
3799@@ -162,17 +162,17 @@
3800 int pos = join.getMatchingChild(entry.getKey()).getPosition();
3801 PValue fkValue = getFKPvalue (entry.getValue());
3802
3803- if (context.queryContext.getPValue(pos).isNull()) {
3804- context.queryContext.setPValue(join.getMatchingChild(entry.getKey()).getPosition(), fkValue);
3805- } else if (TClass.compare (context.queryContext.getPValue(pos).tInstance(),
3806- context.queryContext.getPValue(pos),
3807+ if (context.queryBindings.getPValue(pos).isNull()) {
3808+ context.queryBindings.setPValue(join.getMatchingChild(entry.getKey()).getPosition(), fkValue);
3809+ } else if (TClass.compare (context.queryBindings.getPValue(pos).tInstance(),
3810+ context.queryBindings.getPValue(pos),
3811 fkValue.tInstance(),
3812 fkValue) != 0) {
3813 throw new FKValueMismatchException (join.getMatchingChild(entry.getKey()).getName());
3814 }
3815 }
3816 }
3817- Cursor cursor = API.cursor(insert, context.queryContext);
3818+ Cursor cursor = API.cursor(insert, context.queryContext, context.queryBindings);
3819 JsonRowWriter writer = new JsonRowWriter(new TableRowTracker(context.table, 0));
3820 WriteCapturePKRow rowWriter = new WriteCapturePKRow();
3821 writer.writeRows(cursor, appender, context.anyUpdates ? "\n" : "", rowWriter);
3822
3823=== modified file 'src/main/java/com/akiban/server/service/restdml/ModelBuilder.java'
3824--- src/main/java/com/akiban/server/service/restdml/ModelBuilder.java 2013-06-11 16:32:59 +0000
3825+++ src/main/java/com/akiban/server/service/restdml/ModelBuilder.java 2013-07-09 23:55:31 +0000
3826@@ -27,6 +27,7 @@
3827 import com.akiban.qp.operator.API;
3828 import com.akiban.qp.operator.Cursor;
3829 import com.akiban.qp.operator.Operator;
3830+import com.akiban.qp.operator.QueryBindings;
3831 import com.akiban.qp.operator.QueryContext;
3832 import com.akiban.qp.operator.SimpleQueryContext;
3833 import com.akiban.qp.operator.StoreAdapter;
3834@@ -130,14 +131,15 @@
3835 List<List<String>> keys = PrimaryKeyParser.parsePrimaryKeys(identifiers, table.getPrimaryKey().getIndex());
3836 Operator plan = PlanGenerator.generateBranchPlan(ais, table);
3837 QueryContext context = queryContext(session, ais);
3838- Cursor cursor = API.cursor(plan, context);
3839+ QueryBindings bindings = context.createBindings();
3840+ Cursor cursor = API.cursor(plan, context, bindings);
3841 boolean first = true;
3842 writer.append('[');
3843 for(List<String> pk : keys) {
3844 for(int i = 0; i < pk.size(); i++) {
3845 PValue pvalue = new PValue(MString.varchar());
3846 pvalue.putString(pk.get(i), null);
3847- context.setPValue(i, pvalue);
3848+ bindings.setPValue(i, pvalue);
3849 }
3850 first = scanCursor(writer, cursor, first);
3851 }
3852@@ -307,7 +309,8 @@
3853 );
3854 StoreAdapter adapter = store.createAdapter(session, schema);
3855 QueryContext queryContext = new SimpleQueryContext(adapter);
3856- Cursor cursor = API.cursor(plan, queryContext);
3857+ QueryBindings queryBindings = queryContext.createBindings();
3858+ Cursor cursor = API.cursor(plan, queryContext, queryBindings);
3859 cursor.open();
3860 try {
3861 return cursor.next();
3862@@ -324,7 +327,9 @@
3863 private Cursor groupScanCursor(Session session, TableName tableName) {
3864 UserTable table = ddlFunctions.getUserTable(session, tableName);
3865 Operator plan = PlanGenerator.generateScanPlan(table.getAIS(), table);
3866- return API.cursor(plan, queryContext(session, table.getAIS()));
3867+ QueryContext queryContext = queryContext(session, table.getAIS());
3868+ QueryBindings queryBindings = queryContext.createBindings();
3869+ return API.cursor(plan, queryContext, queryBindings);
3870 }
3871
3872 private boolean scanCursor(PrintWriter writer, Cursor cursor, boolean first) throws IOException {
3873
3874=== modified file 'src/main/java/com/akiban/server/service/restdml/UpsertProcessor.java'
3875--- src/main/java/com/akiban/server/service/restdml/UpsertProcessor.java 2013-06-11 16:32:59 +0000
3876+++ src/main/java/com/akiban/server/service/restdml/UpsertProcessor.java 2013-07-09 23:55:31 +0000
3877@@ -90,7 +90,7 @@
3878 }
3879 if (arrayElement.isObject()) {
3880 processRow (arrayElement, appender, context);
3881- context.queryContext.clear();
3882+ context.queryBindings.clear();
3883 context.allValues.clear();
3884 }
3885 // else throw Bad Json Format Exception
3886@@ -151,10 +151,10 @@
3887 return null;
3888 }
3889 pvalue.putString(context.allValues.get(column), null);
3890- context.queryContext.setPValue(i, pvalue);
3891+ context.queryBindings.setPValue(i, pvalue);
3892 i++;
3893 }
3894- cursor = API.cursor(plan, context.queryContext);
3895+ cursor = API.cursor(plan, context.queryContext, context.queryBindings);
3896 cursor.open();
3897 return cursor.next();
3898 } finally {
3899@@ -179,14 +179,14 @@
3900 } else {
3901 pvalue.putString(context.allValues.get(column), null);
3902 }
3903- context.queryContext.setPValue(i, pvalue);
3904+ context.queryBindings.setPValue(i, pvalue);
3905 upList.add(column);
3906 i++;
3907 }
3908 }
3909
3910 Operator update = updateGenerator.create(context.tableName,upList);
3911- Cursor cursor = API.cursor(update, context.queryContext);
3912+ Cursor cursor = API.cursor(update, context.queryContext, context.queryBindings);
3913 JsonRowWriter writer = new JsonRowWriter(new TableRowTracker(context.table, 0));
3914 WriteCapturePKRow rowWriter = new WriteCapturePKRow();
3915 writer.writeRows(cursor, appender, "\n", rowWriter);
3916
3917=== modified file 'src/main/java/com/akiban/server/service/restdml/UpsertRowUpdateFunction.java'
3918--- src/main/java/com/akiban/server/service/restdml/UpsertRowUpdateFunction.java 2013-04-12 04:21:35 +0000
3919+++ src/main/java/com/akiban/server/service/restdml/UpsertRowUpdateFunction.java 2013-07-09 23:55:31 +0000
3920@@ -18,6 +18,7 @@
3921
3922 import java.util.List;
3923
3924+import com.akiban.qp.operator.QueryBindings;
3925 import com.akiban.qp.operator.QueryContext;
3926 import com.akiban.qp.operator.UpdateFunction;
3927 import com.akiban.qp.row.OverlayingRow;
3928@@ -53,7 +54,7 @@
3929 }
3930
3931 @Override
3932- public Row evaluate(Row original, QueryContext context) {
3933+ public Row evaluate(Row original, QueryContext context, QueryBindings bindings) {
3934 OverlayingRow result = new OverlayingRow(original, pExpressions != null);
3935 int nfields = rowType.nFields();
3936 for (int i = 0; i < nfields; i++) {
3937@@ -62,6 +63,7 @@
3938 TEvaluatableExpression evaluation = expression.build();
3939 evaluation.with(original);
3940 evaluation.with(context);
3941+ evaluation.with(bindings);
3942 evaluation.evaluate();
3943 result.overlay(i, evaluation.resultValue());
3944 }
3945
3946=== modified file 'src/main/java/com/akiban/server/service/text/FullTextIndexServiceImpl.java'
3947--- src/main/java/com/akiban/server/service/text/FullTextIndexServiceImpl.java 2013-07-02 21:57:02 +0000
3948+++ src/main/java/com/akiban/server/service/text/FullTextIndexServiceImpl.java 2013-07-09 23:55:31 +0000
3949@@ -25,6 +25,7 @@
3950 import com.akiban.qp.operator.API;
3951 import com.akiban.qp.operator.Cursor;
3952 import com.akiban.qp.operator.Operator;
3953+import com.akiban.qp.operator.QueryBindings;
3954 import com.akiban.qp.operator.QueryContext;
3955 import com.akiban.qp.operator.SimpleQueryContext;
3956 import com.akiban.qp.operator.StoreAdapter;
3957@@ -252,12 +253,13 @@
3958 if (adapter == null)
3959 adapter = store.createAdapter(session, index.getSchema());
3960 QueryContext queryContext = new SimpleQueryContext(adapter);
3961+ QueryBindings queryBindings = queryContext.createBindings();
3962 IndexWriter writer = indexer.getWriter();
3963
3964 Cursor cursor = null;
3965 boolean success = false;
3966 try(RowIndexer rowIndexer = new RowIndexer(index, writer, false)) {
3967- cursor = API.cursor(plan, queryContext);
3968+ cursor = API.cursor(plan, queryContext, queryBindings);
3969 long count = rowIndexer.indexRows(cursor);
3970 writer.commit();
3971 success = true;
3972@@ -284,6 +286,7 @@
3973 if (adapter == null)
3974 adapter = store.createAdapter(session, indexInfo.getSchema());
3975 QueryContext queryContext = new SimpleQueryContext(adapter);
3976+ QueryBindings queryBindings = queryContext.createBindings();
3977 HKeyCache<com.akiban.qp.row.HKey> cache = new HKeyCache<>(adapter);
3978 IndexWriter writer = indexInfo.getIndexer().getWriter();
3979
3980@@ -296,8 +299,8 @@
3981 while(it.hasNext()) {
3982 byte[] row = it.next();
3983 HKeyRow hkeyRow = toHKeyRow(row, indexInfo.getHKeyRowType(), adapter, cache);
3984- queryContext.setRow(0, hkeyRow);
3985- cursor = API.cursor(operator, queryContext);
3986+ queryBindings.setRow(0, hkeyRow);
3987+ cursor = API.cursor(operator, queryContext, queryBindings);
3988 rowIndexer.updateDocument(cursor, row);
3989 it.remove();
3990 }
3991
3992=== modified file 'src/main/java/com/akiban/server/service/text/FullTextQueryBuilder.java'
3993--- src/main/java/com/akiban/server/service/text/FullTextQueryBuilder.java 2013-03-22 20:05:57 +0000
3994+++ src/main/java/com/akiban/server/service/text/FullTextQueryBuilder.java 2013-07-09 23:55:31 +0000
3995@@ -21,6 +21,7 @@
3996 import com.akiban.ais.model.FullTextIndex;
3997 import com.akiban.ais.model.IndexColumn;
3998 import com.akiban.ais.model.IndexName;
3999+import com.akiban.qp.operator.QueryBindings;
4000 import com.akiban.qp.operator.QueryContext;
4001 import com.akiban.qp.rowtype.RowType;
4002 import com.akiban.qp.rowtype.Schema;
4003@@ -103,7 +104,7 @@
4004 }
4005
4006 @Override
4007- public Query getQuery(QueryContext context) {
4008+ public Query getQuery(QueryContext context, QueryBindings bindings) {
4009 return query;
4010 }
4011
4012@@ -137,7 +138,7 @@
4013 }
4014 return new FullTextQueryExpression() {
4015 @Override
4016- public Query getQuery(QueryContext context) {
4017+ public Query getQuery(QueryContext context, QueryBindings bindings) {
4018 return infos.parseQuery(context, indexName, fieldName, query);
4019 }
4020
4021@@ -160,9 +161,10 @@
4022 final String fieldName = (defaultField == null) ? null : defaultField.getColumn().getName();
4023 return new FullTextQueryExpression() {
4024 @Override
4025- public Query getQuery(QueryContext context) {
4026+ public Query getQuery(QueryContext context, QueryBindings bindings) {
4027 TEvaluatableExpression qeval = qexpr.build();
4028 qeval.with(context);
4029+ qeval.with(bindings);
4030 qeval.evaluate();
4031 if (qeval.resultValue().isNull())
4032 return null;
4033@@ -195,9 +197,10 @@
4034 final String fieldName = checkFieldForMatch(field);
4035 return new FullTextQueryExpression() {
4036 @Override
4037- public Query getQuery(QueryContext context) {
4038+ public Query getQuery(QueryContext context, QueryBindings bindings) {
4039 TEvaluatableExpression qeval = qexpr.build();
4040 qeval.with(context);
4041+ qeval.with(bindings);
4042 qeval.evaluate();
4043 if (qeval.resultValue().isNull())
4044 return null;
4045@@ -243,7 +246,7 @@
4046 FullTextQueryExpression result =
4047 new FullTextQueryExpression() {
4048 @Override
4049- public Query getQuery(QueryContext context) {
4050+ public Query getQuery(QueryContext context, QueryBindings bindings) {
4051 BooleanQuery query = new BooleanQuery();
4052 for (int i = 0; i < queries.size(); i++) {
4053 BooleanClause.Occur occur;
4054@@ -260,7 +263,7 @@
4055 default:
4056 throw new IllegalArgumentException(types.get(i).toString());
4057 }
4058- query.add(queries.get(i).getQuery(context), occur);
4059+ query.add(queries.get(i).getQuery(context, bindings), occur);
4060 }
4061 return query;
4062 }
4063@@ -281,7 +284,7 @@
4064 }
4065 };
4066 if (isConstant) {
4067- return new Constant(result.getQuery(buildContext));
4068+ return new Constant(result.getQuery(buildContext, null));
4069 }
4070 else {
4071 return result;
4072
4073=== modified file 'src/main/java/com/akiban/server/service/text/FullTextQueryExpression.java'
4074--- src/main/java/com/akiban/server/service/text/FullTextQueryExpression.java 2013-03-22 20:05:57 +0000
4075+++ src/main/java/com/akiban/server/service/text/FullTextQueryExpression.java 2013-07-09 23:55:31 +0000
4076@@ -17,6 +17,7 @@
4077
4078 package com.akiban.server.service.text;
4079
4080+import com.akiban.qp.operator.QueryBindings;
4081 import com.akiban.qp.operator.QueryContext;
4082 import com.akiban.server.explain.Explainable;
4083
4084@@ -26,5 +27,5 @@
4085 * parsed from a string, or built up from expressions.
4086 */
4087 public interface FullTextQueryExpression extends Explainable {
4088- public Query getQuery(QueryContext context);
4089+ public Query getQuery(QueryContext context, QueryBindings bindings);
4090 }
4091
4092=== modified file 'src/main/java/com/akiban/server/service/text/IndexScan_FullText.java'
4093--- src/main/java/com/akiban/server/service/text/IndexScan_FullText.java 2013-03-22 20:05:57 +0000
4094+++ src/main/java/com/akiban/server/service/text/IndexScan_FullText.java 2013-07-09 23:55:31 +0000
4095@@ -20,6 +20,7 @@
4096 import com.akiban.ais.model.IndexName;
4097 import com.akiban.qp.operator.Cursor;
4098 import com.akiban.qp.operator.Operator;
4099+import com.akiban.qp.operator.QueryBindings;
4100 import com.akiban.qp.operator.QueryContext;
4101 import com.akiban.qp.rowtype.RowType;
4102 import com.akiban.server.explain.*;
4103@@ -52,8 +53,8 @@
4104 }
4105
4106 @Override
4107- protected Cursor cursor(QueryContext context) {
4108- Query query = queryExpression.getQuery(context);
4109+ protected Cursor cursor(QueryContext context, QueryBindings bindings) {
4110+ Query query = queryExpression.getQuery(context, bindings);
4111 FullTextIndexService service = context.getServiceManager().getServiceByClass(FullTextIndexService.class);
4112 return service.searchIndex(context, index, query, limit);
4113 }
4114
4115=== modified file 'src/main/java/com/akiban/server/store/AbstractStore.java'
4116--- src/main/java/com/akiban/server/store/AbstractStore.java 2013-07-07 19:27:17 +0000
4117+++ src/main/java/com/akiban/server/store/AbstractStore.java 2013-07-09 23:55:31 +0000
4118@@ -34,6 +34,7 @@
4119 import com.akiban.qp.operator.Cursor;
4120 import com.akiban.qp.operator.GroupCursor;
4121 import com.akiban.qp.operator.Operator;
4122+import com.akiban.qp.operator.QueryBindings;
4123 import com.akiban.qp.operator.QueryContext;
4124 import com.akiban.qp.operator.SimpleQueryContext;
4125 import com.akiban.qp.operator.StoreAdapter;
4126@@ -758,9 +759,10 @@
4127 }
4128 if(!groupIndexes.isEmpty()) {
4129 QueryContext context = new SimpleQueryContext(adapter);
4130+ QueryBindings bindings = context.createBindings();
4131 for(GroupIndex groupIndex : groupIndexes) {
4132 runMaintenancePlan(
4133- context,
4134+ context, bindings,
4135 groupIndex,
4136 StoreGIMaintenancePlans.groupIndexCreationPlan(adapter.schema(), groupIndex),
4137 StoreGIHandler.forBuilding(this, adapter),
4138@@ -1192,14 +1194,15 @@
4139 Operator plan = PlanGenerator.generateBranchPlan(ais, uTable);
4140
4141 QueryContext queryContext = new SimpleQueryContext(adapter);
4142- Cursor cursor = API.cursor(plan, queryContext);
4143+ QueryBindings queryBindings = queryContext.createBindings();
4144+ Cursor cursor = API.cursor(plan, queryContext, queryBindings);
4145
4146 List<Column> lookupCols = uTable.getPrimaryKeyIncludingInternal().getColumns();
4147 RowDataPValueSource pSource = new RowDataPValueSource();
4148 for(int i = 0; i < lookupCols.size(); ++i) {
4149 Column col = lookupCols.get(i);
4150 pSource.bind(col.getFieldDef(), rowData);
4151- queryContext.setPValue(i, pSource);
4152+ queryBindings.setPValue(i, pSource);
4153 }
4154 try {
4155 Row row;
4156@@ -1288,11 +1291,12 @@
4157 }
4158
4159 private static void runMaintenancePlan(QueryContext context,
4160+ QueryBindings bindings,
4161 GroupIndex groupIndex,
4162 Operator rootOperator,
4163 StoreGIHandler handler,
4164 StoreGIHandler.Action action) {
4165- Cursor cursor = API.cursor(rootOperator, context);
4166+ Cursor cursor = API.cursor(rootOperator, context, bindings);
4167 cursor.open();
4168 try {
4169 Row row;
4170
4171=== modified file 'src/main/java/com/akiban/server/store/StoreGIMaintenance.java'
4172--- src/main/java/com/akiban/server/store/StoreGIMaintenance.java 2013-06-21 23:27:44 +0000
4173+++ src/main/java/com/akiban/server/store/StoreGIMaintenance.java 2013-07-09 23:55:31 +0000
4174@@ -25,6 +25,7 @@
4175 import com.akiban.qp.operator.API;
4176 import com.akiban.qp.operator.Cursor;
4177 import com.akiban.qp.operator.Operator;
4178+import com.akiban.qp.operator.QueryBindings;
4179 import com.akiban.qp.operator.QueryContext;
4180 import com.akiban.qp.operator.SimpleQueryContext;
4181 import com.akiban.qp.operator.StoreAdapter;
4182@@ -65,9 +66,10 @@
4183 if (planOperator == null)
4184 return;
4185 QueryContext context = new SimpleQueryContext(adapter);
4186+ QueryBindings bindings = context.createBindings();
4187 List<Column> lookupCols = rowType.userTable().getPrimaryKeyIncludingInternal().getColumns();
4188
4189- context.setHKey(StoreGIMaintenance.HKEY_BINDING_POSITION, hKey);
4190+ bindings.setHKey(StoreGIMaintenance.HKEY_BINDING_POSITION, hKey);
4191
4192 // Copy the values into the array bindings
4193 RowDataValueSource source = new RowDataValueSource();
4194@@ -79,10 +81,10 @@
4195 source.bind(col.getFieldDef(), forRow);
4196
4197 // New types
4198- if (Types3Switch.ON) context.setPValue(bindingsIndex, pSource);
4199- else context.setValue(bindingsIndex, source);
4200+ if (Types3Switch.ON) bindings.setPValue(bindingsIndex, pSource);
4201+ else bindings.setValue(bindingsIndex, source);
4202 }
4203- cursor = API.cursor(planOperator, context);
4204+ cursor = API.cursor(planOperator, context, bindings);
4205 RUN_TAP.in();
4206 runTapEntered = true;
4207 cursor.open();
4208@@ -98,7 +100,7 @@
4209 Index.JoinType giJoin = groupIndex.getJoinType();
4210 switch (giJoin) {
4211 case LEFT:
4212- if (row.rowType().equals(storePlan.leftHalf) && useInvertType(action, context) &&
4213+ if (row.rowType().equals(storePlan.leftHalf) && useInvertType(action, context, bindings) &&
4214 !skipCascadeRow(action, row, handler)) {
4215 Row outerRow = new FlattenedRow(storePlan.topLevelFlattenType, row, null, row.hKey());
4216 doAction(invert(action), handler, outerRow);
4217@@ -106,7 +108,7 @@
4218 }
4219 break;
4220 case RIGHT:
4221- if (row.rowType().equals(storePlan.rightHalf) && useInvertType(action, context) &&
4222+ if (row.rowType().equals(storePlan.rightHalf) && useInvertType(action, context, bindings) &&
4223 !skipCascadeRow(action, row, handler)) {
4224 Row outerRow = new FlattenedRow(storePlan.topLevelFlattenType, null, row, row.hKey());
4225 doAction(invert(action), handler, outerRow);
4226@@ -144,7 +146,7 @@
4227 row.rowType().typeComposition().tables().contains(handler.getSourceTable());
4228 }
4229
4230- private boolean useInvertType(StoreGIHandler.Action action, QueryContext context) {
4231+ private boolean useInvertType(StoreGIHandler.Action action, QueryContext context, QueryBindings bindings) {
4232 switch (groupIndex.getJoinType()) {
4233 case LEFT:
4234 switch (action) {
4235@@ -155,7 +157,7 @@
4236 case DELETE:
4237 if (siblingsLookup == null)
4238 return false;
4239- Cursor siblingsCounter = API.cursor(siblingsLookup, context);
4240+ Cursor siblingsCounter = API.cursor(siblingsLookup, context, bindings);
4241 SIBLING_ALL_TAP.in();
4242 try {
4243 siblingsCounter.open();
4244
4245=== modified file 'src/main/java/com/akiban/server/types3/texpressions/AnySubqueryTExpression.java'
4246--- src/main/java/com/akiban/server/types3/texpressions/AnySubqueryTExpression.java 2013-03-22 20:05:57 +0000
4247+++ src/main/java/com/akiban/server/types3/texpressions/AnySubqueryTExpression.java 2013-07-09 23:55:31 +0000
4248@@ -61,6 +61,7 @@
4249 @Override
4250 protected void doEval(PValueTarget out) {
4251 evaluation.with(queryContext());
4252+ evaluation.with(queryBindings());
4253 Boolean result = Boolean.FALSE;
4254 while (true) {
4255 Row row = next();
4256
4257=== modified file 'src/main/java/com/akiban/server/types3/texpressions/ContextualEvaluation.java'
4258--- src/main/java/com/akiban/server/types3/texpressions/ContextualEvaluation.java 2013-03-22 20:05:57 +0000
4259+++ src/main/java/com/akiban/server/types3/texpressions/ContextualEvaluation.java 2013-07-09 23:55:31 +0000
4260@@ -17,6 +17,7 @@
4261
4262 package com.akiban.server.types3.texpressions;
4263
4264+import com.akiban.qp.operator.QueryBindings;
4265 import com.akiban.qp.operator.QueryContext;
4266 import com.akiban.qp.row.Row;
4267 import com.akiban.server.types3.TInstance;
4268@@ -35,6 +36,10 @@
4269 }
4270
4271 @Override
4272+ public void with(QueryBindings bindings) {
4273+ }
4274+
4275+ @Override
4276 public PValueSource resultValue() {
4277 if (readyValue == null)
4278 throw new IllegalStateException("haven't evaluated since having seen a new context");
4279
4280=== modified file 'src/main/java/com/akiban/server/types3/texpressions/ResultSetSubqueryTExpression.java'
4281--- src/main/java/com/akiban/server/types3/texpressions/ResultSetSubqueryTExpression.java 2013-03-22 20:05:57 +0000
4282+++ src/main/java/com/akiban/server/types3/texpressions/ResultSetSubqueryTExpression.java 2013-07-09 23:55:31 +0000
4283@@ -20,6 +20,7 @@
4284 import com.akiban.qp.operator.API;
4285 import com.akiban.qp.operator.Cursor;
4286 import com.akiban.qp.operator.Operator;
4287+import com.akiban.qp.operator.QueryBindings;
4288 import com.akiban.qp.operator.QueryContext;
4289 import com.akiban.qp.row.Row;
4290 import com.akiban.qp.rowtype.RowType;
4291@@ -39,8 +40,8 @@
4292
4293 @Override
4294 public void evaluate() {
4295- context.setRow(bindingPosition, outerRow);
4296- Cursor cursor = API.cursor(subquery, context);
4297+ bindings.setRow(bindingPosition, outerRow);
4298+ Cursor cursor = API.cursor(subquery, context, bindings);
4299 cursor.open();
4300 pvalue.putObject(cursor);
4301 }
4302@@ -59,6 +60,11 @@
4303 this.context = context;
4304 }
4305
4306+ @Override
4307+ public void with(QueryBindings bindings) {
4308+ this.bindings = bindings;
4309+ }
4310+
4311 InnerEvaluation(Operator subquery, RowType outerRowType, int bindingPosition)
4312 {
4313 this.subquery = subquery;
4314@@ -72,6 +78,7 @@
4315 private final int bindingPosition;
4316 private final PValue pvalue;
4317 private QueryContext context;
4318+ private QueryBindings bindings;
4319 private Row outerRow;
4320 }
4321
4322
4323=== modified file 'src/main/java/com/akiban/server/types3/texpressions/ScalarSubqueryTExpression.java'
4324--- src/main/java/com/akiban/server/types3/texpressions/ScalarSubqueryTExpression.java 2013-03-22 20:05:57 +0000
4325+++ src/main/java/com/akiban/server/types3/texpressions/ScalarSubqueryTExpression.java 2013-07-09 23:55:31 +0000
4326@@ -52,6 +52,7 @@
4327 TEvaluatableExpression eval = expression.build();
4328
4329 eval.with(queryContext());
4330+ eval.with(queryBindings());
4331 eval.with(row);
4332
4333 // evaluate the result
4334
4335=== modified file 'src/main/java/com/akiban/server/types3/texpressions/SubqueryTEvaluateble.java'
4336--- src/main/java/com/akiban/server/types3/texpressions/SubqueryTEvaluateble.java 2013-03-22 20:05:57 +0000
4337+++ src/main/java/com/akiban/server/types3/texpressions/SubqueryTEvaluateble.java 2013-07-09 23:55:31 +0000
4338@@ -20,6 +20,7 @@
4339 import com.akiban.qp.operator.API;
4340 import com.akiban.qp.operator.Cursor;
4341 import com.akiban.qp.operator.Operator;
4342+import com.akiban.qp.operator.QueryBindings;
4343 import com.akiban.qp.operator.QueryContext;
4344 import com.akiban.qp.row.Row;
4345 import com.akiban.qp.rowtype.RowType;
4346@@ -38,7 +39,10 @@
4347
4348 @Override
4349 public void evaluate() {
4350- context.setRow(bindingPosition, outerRow);
4351+ bindings.setRow(bindingPosition, outerRow);
4352+ if (cursor == null) {
4353+ cursor = API.cursor(subquery, context, bindings);
4354+ }
4355 cursor.open();
4356 try {
4357 doEval(pvalue);
4358@@ -60,7 +64,13 @@
4359 @Override
4360 public void with(QueryContext context) {
4361 this.context = context;
4362- this.cursor = API.cursor(subquery, context);
4363+ cursor = null;
4364+ }
4365+
4366+ @Override
4367+ public void with(QueryBindings bindings) {
4368+ this.bindings = bindings;
4369+ cursor = null;
4370 }
4371
4372 protected abstract void doEval(PValueTarget out);
4373@@ -69,6 +79,10 @@
4374 return context;
4375 }
4376
4377+ protected QueryBindings queryBindings() {
4378+ return bindings;
4379+ }
4380+
4381 protected Row next() {
4382 Row row = cursor.next();
4383 if ((row != null) &&
4384@@ -96,5 +110,6 @@
4385 private final PValue pvalue;
4386 private Cursor cursor;
4387 private QueryContext context;
4388+ private QueryBindings bindings;
4389 private Row outerRow;
4390 }
4391
4392=== modified file 'src/main/java/com/akiban/server/types3/texpressions/TCastExpression.java'
4393--- src/main/java/com/akiban/server/types3/texpressions/TCastExpression.java 2013-03-22 20:05:57 +0000
4394+++ src/main/java/com/akiban/server/types3/texpressions/TCastExpression.java 2013-07-09 23:55:31 +0000
4395@@ -17,6 +17,7 @@
4396
4397 package com.akiban.server.types3.texpressions;
4398
4399+import com.akiban.qp.operator.QueryBindings;
4400 import com.akiban.qp.operator.QueryContext;
4401 import com.akiban.qp.row.Row;
4402 import com.akiban.server.explain.*;
4403@@ -125,6 +126,11 @@
4404 this.executionContext.setQueryContext(context);
4405 }
4406
4407+ @Override
4408+ public void with(QueryBindings bindings) {
4409+ inputEval.with(bindings);
4410+ }
4411+
4412 private CastEvaluation(TEvaluatableExpression inputEval, TCast cast,
4413 TInstance sourceInstance, TInstance targetInstance, QueryContext preptimeContext)
4414 {
4415
4416=== modified file 'src/main/java/com/akiban/server/types3/texpressions/TComparisonExpressionBase.java'
4417--- src/main/java/com/akiban/server/types3/texpressions/TComparisonExpressionBase.java 2013-03-22 20:05:57 +0000
4418+++ src/main/java/com/akiban/server/types3/texpressions/TComparisonExpressionBase.java 2013-07-09 23:55:31 +0000
4419@@ -17,6 +17,7 @@
4420
4421 package com.akiban.server.types3.texpressions;
4422
4423+import com.akiban.qp.operator.QueryBindings;
4424 import com.akiban.qp.operator.QueryContext;
4425 import com.akiban.qp.row.Row;
4426 import com.akiban.server.explain.*;
4427@@ -172,6 +173,12 @@
4428 right.with(context);
4429 }
4430
4431+ @Override
4432+ public void with(QueryBindings bindings) {
4433+ left.with(bindings);
4434+ right.with(bindings);
4435+ }
4436+
4437 private CompareEvaluation(TInstance leftInstance, TEvaluatableExpression left,
4438 TInstance rightInstance, TEvaluatableExpression right)
4439 {
4440
4441=== modified file 'src/main/java/com/akiban/server/types3/texpressions/TEvaluatableExpression.java'
4442--- src/main/java/com/akiban/server/types3/texpressions/TEvaluatableExpression.java 2013-03-22 20:05:57 +0000
4443+++ src/main/java/com/akiban/server/types3/texpressions/TEvaluatableExpression.java 2013-07-09 23:55:31 +0000
4444@@ -17,6 +17,7 @@
4445
4446 package com.akiban.server.types3.texpressions;
4447
4448+import com.akiban.qp.operator.QueryBindings;
4449 import com.akiban.qp.operator.QueryContext;
4450 import com.akiban.qp.row.Row;
4451 import com.akiban.server.types3.pvalue.PValueSource;
4452@@ -29,4 +30,5 @@
4453
4454 void with(Row row);
4455 void with(QueryContext context);
4456+ void with(QueryBindings bindings);
4457 }
4458
4459=== modified file 'src/main/java/com/akiban/server/types3/texpressions/TNullExpression.java'
4460--- src/main/java/com/akiban/server/types3/texpressions/TNullExpression.java 2013-03-22 20:05:57 +0000
4461+++ src/main/java/com/akiban/server/types3/texpressions/TNullExpression.java 2013-07-09 23:55:31 +0000
4462@@ -17,6 +17,7 @@
4463
4464 package com.akiban.server.types3.texpressions;
4465
4466+import com.akiban.qp.operator.QueryBindings;
4467 import com.akiban.qp.operator.QueryContext;
4468 import com.akiban.qp.row.Row;
4469 import com.akiban.server.explain.*;
4470@@ -81,6 +82,10 @@
4471 public void with(QueryContext context) {
4472 }
4473
4474+ @Override
4475+ public void with(QueryBindings bindings) {
4476+ }
4477+
4478 private InnerEvaluation(TInstance underlying) {
4479 this.valueSource = PValueSources.getNullSource(underlying);
4480 }
4481
4482=== modified file 'src/main/java/com/akiban/server/types3/texpressions/TPreparedBoundField.java'
4483--- src/main/java/com/akiban/server/types3/texpressions/TPreparedBoundField.java 2013-03-22 20:05:57 +0000
4484+++ src/main/java/com/akiban/server/types3/texpressions/TPreparedBoundField.java 2013-07-09 23:55:31 +0000
4485@@ -17,6 +17,7 @@
4486
4487 package com.akiban.server.types3.texpressions;
4488
4489+import com.akiban.qp.operator.QueryBindings;
4490 import com.akiban.qp.operator.QueryContext;
4491 import com.akiban.qp.row.Row;
4492 import com.akiban.qp.rowtype.RowType;
4493@@ -86,7 +87,11 @@
4494
4495 @Override
4496 public void with(QueryContext context) {
4497- fieldEvaluation.with(context.getRow(rowPosition));
4498+ }
4499+
4500+ @Override
4501+ public void with(QueryBindings bindings) {
4502+ fieldEvaluation.with(bindings.getRow(rowPosition));
4503 }
4504
4505 private InnerEvaluation(TEvaluatableExpression fieldEvaluation, int rowPosition) {
4506
4507=== modified file 'src/main/java/com/akiban/server/types3/texpressions/TPreparedFunction.java'
4508--- src/main/java/com/akiban/server/types3/texpressions/TPreparedFunction.java 2013-03-22 20:05:57 +0000
4509+++ src/main/java/com/akiban/server/types3/texpressions/TPreparedFunction.java 2013-07-09 23:55:31 +0000
4510@@ -17,6 +17,7 @@
4511
4512 package com.akiban.server.types3.texpressions;
4513
4514+import com.akiban.qp.operator.QueryBindings;
4515 import com.akiban.qp.operator.QueryContext;
4516 import com.akiban.qp.row.Row;
4517 import com.akiban.server.explain.*;
4518@@ -132,6 +133,15 @@
4519 }
4520
4521 @Override
4522+ public void with(QueryBindings bindings) {
4523+ for (int i = 0, inputsSize = inputs.size(); i < inputsSize; i++) {
4524+ TEvaluatableExpression input = inputs.get(i);
4525+ input.with(bindings);
4526+ inputValues[i] = null;
4527+ }
4528+ }
4529+
4530+ @Override
4531 public PValueSource resultValue() {
4532 return resultValue;
4533 }
4534
4535=== modified file 'src/main/java/com/akiban/server/types3/texpressions/TPreparedLiteral.java'
4536--- src/main/java/com/akiban/server/types3/texpressions/TPreparedLiteral.java 2013-03-22 20:05:57 +0000
4537+++ src/main/java/com/akiban/server/types3/texpressions/TPreparedLiteral.java 2013-07-09 23:55:31 +0000
4538@@ -17,6 +17,7 @@
4539
4540 package com.akiban.server.types3.texpressions;
4541
4542+import com.akiban.qp.operator.QueryBindings;
4543 import com.akiban.qp.operator.QueryContext;
4544 import com.akiban.qp.row.Row;
4545 import com.akiban.server.explain.*;
4546@@ -102,6 +103,10 @@
4547 public void with(QueryContext context) {
4548 }
4549
4550+ @Override
4551+ public void with(QueryBindings bindings) {
4552+ }
4553+
4554 private Evaluation(PValueSource value) {
4555 this.value = value;
4556 }
4557
4558=== modified file 'src/main/java/com/akiban/server/types3/texpressions/TPreparedParameter.java'
4559--- src/main/java/com/akiban/server/types3/texpressions/TPreparedParameter.java 2013-03-22 20:05:57 +0000
4560+++ src/main/java/com/akiban/server/types3/texpressions/TPreparedParameter.java 2013-07-09 23:55:31 +0000
4561@@ -17,6 +17,7 @@
4562
4563 package com.akiban.server.types3.texpressions;
4564
4565+import com.akiban.qp.operator.QueryBindings;
4566 import com.akiban.qp.operator.QueryContext;
4567 import com.akiban.qp.row.Row;
4568 import com.akiban.server.explain.*;
4569@@ -78,7 +79,7 @@
4570 public void evaluate() {
4571 if (!pValue.hasAnyValue()) { // only need to compute this once
4572 TClass tClass = tInstance.typeClass();
4573- PValueSource inSource = context.getPValue(position);
4574+ PValueSource inSource = bindings.getPValue(position);
4575 // TODO need a better execution context thinger
4576 TExecutionContext executionContext = new TExecutionContext(
4577 null,
4578@@ -102,6 +103,11 @@
4579 this.context = context;
4580 }
4581
4582+ @Override
4583+ public void with(QueryBindings bindings) {
4584+ this.bindings = bindings;
4585+ }
4586+
4587 private InnerEvaluation(int position, TInstance tInstance) {
4588 this.position = position;
4589 this.tInstance = tInstance;
4590@@ -111,6 +117,7 @@
4591 private final int position;
4592 private final PValue pValue;
4593 private QueryContext context;
4594+ private QueryBindings bindings;
4595 private final TInstance tInstance;
4596 }
4597 }
4598
4599=== modified file 'src/main/java/com/akiban/sql/embedded/ExecutableDDLStatement.java'
4600--- src/main/java/com/akiban/sql/embedded/ExecutableDDLStatement.java 2013-03-22 20:05:57 +0000
4601+++ src/main/java/com/akiban/sql/embedded/ExecutableDDLStatement.java 2013-07-09 23:55:31 +0000
4602@@ -17,6 +17,8 @@
4603
4604 package com.akiban.sql.embedded;
4605
4606+import com.akiban.qp.operator.QueryBindings;
4607+
4608 import com.akiban.sql.aisddl.AISDDL;
4609 import com.akiban.sql.parser.DDLStatementNode;
4610 import static com.akiban.server.service.dxl.DXLFunctionsHook.DXLFunction;
4611@@ -32,7 +34,7 @@
4612 }
4613
4614 @Override
4615- public ExecuteResults execute(EmbeddedQueryContext context) {
4616+ public ExecuteResults execute(EmbeddedQueryContext context, QueryBindings bindings) {
4617 context.lock(DXLFunction.UNSPECIFIED_DDL_WRITE);
4618 try {
4619 AISDDL.execute(ddl, sql, context);
4620
4621=== modified file 'src/main/java/com/akiban/sql/embedded/ExecutableJavaMethod.java'
4622--- src/main/java/com/akiban/sql/embedded/ExecutableJavaMethod.java 2013-03-22 20:05:57 +0000
4623+++ src/main/java/com/akiban/sql/embedded/ExecutableJavaMethod.java 2013-07-09 23:55:31 +0000
4624@@ -21,6 +21,8 @@
4625 import com.akiban.sql.server.ServerJavaMethod;
4626 import com.akiban.sql.server.ServerJavaRoutine;
4627
4628+import com.akiban.qp.operator.QueryBindings;
4629+
4630 import java.lang.reflect.Method;
4631
4632 class ExecutableJavaMethod extends ExecutableJavaRoutine
4633@@ -44,8 +46,8 @@
4634 }
4635
4636 @Override
4637- protected ServerJavaRoutine javaRoutine(EmbeddedQueryContext context) {
4638- return new ServerJavaMethod(context, invocation, method);
4639+ protected ServerJavaRoutine javaRoutine(EmbeddedQueryContext context, QueryBindings bindings) {
4640+ return new ServerJavaMethod(context, bindings, invocation, method);
4641 }
4642
4643 }
4644
4645=== modified file 'src/main/java/com/akiban/sql/embedded/ExecutableJavaRoutine.java'
4646--- src/main/java/com/akiban/sql/embedded/ExecutableJavaRoutine.java 2013-03-22 20:05:57 +0000
4647+++ src/main/java/com/akiban/sql/embedded/ExecutableJavaRoutine.java 2013-07-09 23:55:31 +0000
4648@@ -21,6 +21,8 @@
4649 import com.akiban.sql.server.ServerJavaRoutine;
4650 import com.akiban.sql.server.ServerCallContextStack;
4651
4652+import com.akiban.qp.operator.QueryBindings;
4653+
4654 import java.sql.ResultSet;
4655 import java.sql.SQLException;
4656 import java.util.Queue;
4657@@ -33,12 +35,12 @@
4658 super(invocation, parameterMetaData);
4659 }
4660
4661- protected abstract ServerJavaRoutine javaRoutine(EmbeddedQueryContext context);
4662+ protected abstract ServerJavaRoutine javaRoutine(EmbeddedQueryContext context, QueryBindings bindings);
4663
4664 @Override
4665- public ExecuteResults execute(EmbeddedQueryContext context) {
4666+ public ExecuteResults execute(EmbeddedQueryContext context, QueryBindings bindings) {
4667 Queue<ResultSet> resultSets = null;
4668- ServerJavaRoutine call = javaRoutine(context);
4669+ ServerJavaRoutine call = javaRoutine(context, bindings);
4670 call.push();
4671 boolean success = false;
4672 try {
4673
4674=== modified file 'src/main/java/com/akiban/sql/embedded/ExecutableLoadableOperator.java'
4675--- src/main/java/com/akiban/sql/embedded/ExecutableLoadableOperator.java 2013-03-22 20:05:57 +0000
4676+++ src/main/java/com/akiban/sql/embedded/ExecutableLoadableOperator.java 2013-07-09 23:55:31 +0000
4677@@ -21,6 +21,8 @@
4678
4679 import com.akiban.qp.loadableplan.LoadableOperator;
4680 import com.akiban.qp.loadableplan.LoadablePlan;
4681+import com.akiban.qp.operator.QueryBindings;
4682+import com.akiban.qp.operator.SparseArrayQueryBindings;
4683 import com.akiban.server.error.UnsupportedSQLException;
4684 import com.akiban.server.types3.TInstance;
4685 import com.akiban.server.types3.Types3Switch;
4686@@ -61,11 +63,11 @@
4687 }
4688
4689 @Override
4690- public ExecuteResults execute(EmbeddedQueryContext context) {
4691- context = setParameters(context, invocation);
4692+ public ExecuteResults execute(EmbeddedQueryContext context, QueryBindings bindings) {
4693+ bindings = setParameters(bindings, invocation);
4694 ServerCallContextStack.push(context, invocation);
4695 try {
4696- return super.execute(context);
4697+ return super.execute(context, bindings);
4698 }
4699 finally {
4700 ServerCallContextStack.pop(context, invocation);
4701@@ -88,19 +90,18 @@
4702 return new JDBCResultSetMetaData(columns);
4703 }
4704
4705- protected static EmbeddedQueryContext setParameters(EmbeddedQueryContext context, ServerCallInvocation invocation) {
4706+ protected static QueryBindings setParameters(QueryBindings bindings, ServerCallInvocation invocation) {
4707 if (!invocation.parametersInOrder()) {
4708 if (invocation.hasParameters()) {
4709- EmbeddedQueryContext calleeContext =
4710- new EmbeddedQueryContext(context.getServer());
4711- invocation.copyParameters(context, calleeContext, Types3Switch.ON);
4712- context = calleeContext;
4713+ QueryBindings calleeBindings = new SparseArrayQueryBindings();
4714+ invocation.copyParameters(bindings, calleeBindings, Types3Switch.ON);
4715+ bindings = calleeBindings;
4716 }
4717 else {
4718- invocation.copyParameters(null, context, Types3Switch.ON);
4719+ invocation.copyParameters(null, bindings, Types3Switch.ON);
4720 }
4721 }
4722- return context;
4723+ return bindings;
4724 }
4725
4726 }
4727
4728=== modified file 'src/main/java/com/akiban/sql/embedded/ExecutableModifyOperatorStatement.java'
4729--- src/main/java/com/akiban/sql/embedded/ExecutableModifyOperatorStatement.java 2013-03-22 20:05:57 +0000
4730+++ src/main/java/com/akiban/sql/embedded/ExecutableModifyOperatorStatement.java 2013-07-09 23:55:31 +0000
4731@@ -21,6 +21,7 @@
4732 import com.akiban.qp.operator.Cursor;
4733 import com.akiban.qp.operator.CursorLifecycle;
4734 import com.akiban.qp.operator.Operator;
4735+import com.akiban.qp.operator.QueryBindings;
4736 import com.akiban.qp.row.ImmutableRow;
4737 import com.akiban.qp.row.ProjectedRow;
4738 import com.akiban.qp.row.Row;
4739@@ -51,7 +52,7 @@
4740 }
4741
4742 @Override
4743- public ExecuteResults execute(EmbeddedQueryContext context) {
4744+ public ExecuteResults execute(EmbeddedQueryContext context, QueryBindings bindings) {
4745 int updateCount = 0;
4746 SpoolCursor returningRows = null;
4747 if (resultSetMetaData != null)
4748@@ -63,7 +64,7 @@
4749 Cursor cursor = null;
4750 RuntimeException runtimeException = null;
4751 try {
4752- cursor = API.cursor(resultOperator, context);
4753+ cursor = API.cursor(resultOperator, context, bindings);
4754 cursor.open();
4755 Row row;
4756 while ((row = cursor.next()) != null) {
4757
4758=== modified file 'src/main/java/com/akiban/sql/embedded/ExecutableQueryOperatorStatement.java'
4759--- src/main/java/com/akiban/sql/embedded/ExecutableQueryOperatorStatement.java 2013-03-22 20:05:57 +0000
4760+++ src/main/java/com/akiban/sql/embedded/ExecutableQueryOperatorStatement.java 2013-07-09 23:55:31 +0000
4761@@ -20,6 +20,7 @@
4762 import com.akiban.qp.operator.API;
4763 import com.akiban.qp.operator.Cursor;
4764 import com.akiban.qp.operator.Operator;
4765+import com.akiban.qp.operator.QueryBindings;
4766 import com.akiban.sql.optimizer.plan.CostEstimate;
4767
4768 class ExecutableQueryOperatorStatement extends ExecutableOperatorStatement
4769@@ -35,10 +36,10 @@
4770 }
4771
4772 @Override
4773- public ExecuteResults execute(EmbeddedQueryContext context) {
4774+ public ExecuteResults execute(EmbeddedQueryContext context, QueryBindings bindings) {
4775 Cursor cursor = null;
4776 try {
4777- cursor = API.cursor(resultOperator, context);
4778+ cursor = API.cursor(resultOperator, context, bindings);
4779 cursor.open();
4780 ExecuteResults result = new ExecuteResults(cursor);
4781 cursor = null;
4782
4783=== modified file 'src/main/java/com/akiban/sql/embedded/ExecutableScriptBindingsRoutine.java'
4784--- src/main/java/com/akiban/sql/embedded/ExecutableScriptBindingsRoutine.java 2013-03-22 20:05:57 +0000
4785+++ src/main/java/com/akiban/sql/embedded/ExecutableScriptBindingsRoutine.java 2013-07-09 23:55:31 +0000
4786@@ -17,6 +17,7 @@
4787
4788 package com.akiban.sql.embedded;
4789
4790+import com.akiban.qp.operator.QueryBindings;
4791 import com.akiban.server.service.routines.ScriptEvaluator;
4792 import com.akiban.server.service.routines.ScriptPool;
4793 import com.akiban.sql.script.ScriptBindingsRoutine;
4794@@ -45,8 +46,8 @@
4795 }
4796
4797 @Override
4798- protected ServerJavaRoutine javaRoutine(EmbeddedQueryContext context) {
4799- return new ScriptBindingsRoutine(context, invocation, pool);
4800+ protected ServerJavaRoutine javaRoutine(EmbeddedQueryContext context, QueryBindings bindings) {
4801+ return new ScriptBindingsRoutine(context, bindings, invocation, pool);
4802 }
4803
4804 }
4805
4806=== modified file 'src/main/java/com/akiban/sql/embedded/ExecutableScriptFunctionJavaRoutine.java'
4807--- src/main/java/com/akiban/sql/embedded/ExecutableScriptFunctionJavaRoutine.java 2013-03-22 20:05:57 +0000
4808+++ src/main/java/com/akiban/sql/embedded/ExecutableScriptFunctionJavaRoutine.java 2013-07-09 23:55:31 +0000
4809@@ -17,6 +17,7 @@
4810
4811 package com.akiban.sql.embedded;
4812
4813+import com.akiban.qp.operator.QueryBindings;
4814 import com.akiban.server.service.routines.ScriptInvoker;
4815 import com.akiban.server.service.routines.ScriptPool;
4816 import com.akiban.sql.script.ScriptFunctionJavaRoutine;
4817@@ -45,8 +46,8 @@
4818 }
4819
4820 @Override
4821- protected ServerJavaRoutine javaRoutine(EmbeddedQueryContext context) {
4822- return new ScriptFunctionJavaRoutine(context, invocation, pool);
4823+ protected ServerJavaRoutine javaRoutine(EmbeddedQueryContext context, QueryBindings bindings) {
4824+ return new ScriptFunctionJavaRoutine(context, bindings, invocation, pool);
4825 }
4826
4827 }
4828
4829=== modified file 'src/main/java/com/akiban/sql/embedded/ExecutableStatement.java'
4830--- src/main/java/com/akiban/sql/embedded/ExecutableStatement.java 2013-03-22 20:05:57 +0000
4831+++ src/main/java/com/akiban/sql/embedded/ExecutableStatement.java 2013-07-09 23:55:31 +0000
4832@@ -17,11 +17,12 @@
4833
4834 package com.akiban.sql.embedded;
4835
4836+import com.akiban.qp.operator.QueryBindings;
4837 import com.akiban.sql.server.ServerStatement;
4838
4839 abstract class ExecutableStatement implements ServerStatement
4840 {
4841- public abstract ExecuteResults execute(EmbeddedQueryContext context);
4842+ public abstract ExecuteResults execute(EmbeddedQueryContext context, QueryBindings bindings);
4843
4844 public JDBCResultSetMetaData getResultSetMetaData() {
4845 return null;
4846
4847=== modified file 'src/main/java/com/akiban/sql/embedded/JDBCPreparedStatement.java'
4848--- src/main/java/com/akiban/sql/embedded/JDBCPreparedStatement.java 2013-03-22 20:05:57 +0000
4849+++ src/main/java/com/akiban/sql/embedded/JDBCPreparedStatement.java 2013-07-09 23:55:31 +0000
4850@@ -17,6 +17,7 @@
4851
4852 package com.akiban.sql.embedded;
4853
4854+import com.akiban.qp.operator.QueryBindings;
4855 import com.akiban.server.types.AkType;
4856 import com.akiban.server.types.ValueSource;
4857 import com.akiban.server.types3.TInstance;
4858@@ -33,8 +34,9 @@
4859
4860 public class JDBCPreparedStatement extends JDBCStatement implements PreparedStatement
4861 {
4862- protected ExecutableStatement executableStatement;
4863- protected EmbeddedQueryContext context;
4864+ protected final ExecutableStatement executableStatement;
4865+ protected final EmbeddedQueryContext context;
4866+ protected final QueryBindings bindings;
4867 protected final Values values = new Values();
4868
4869 protected JDBCPreparedStatement(JDBCConnection connection,
4870@@ -42,6 +44,7 @@
4871 super(connection);
4872 this.executableStatement = executableStatement;
4873 context = new EmbeddedQueryContext(this);
4874+ bindings = context.createBindings();
4875 }
4876
4877 protected class Values extends ServerJavaValues {
4878@@ -57,22 +60,22 @@
4879
4880 @Override
4881 protected ValueSource getValue(int index) {
4882- return context.getValue(index);
4883+ return bindings.getValue(index);
4884 }
4885
4886 @Override
4887 protected void setValue(int index, ValueSource source, AkType akType) {
4888- context.setValue(index, source, akType);
4889+ bindings.setValue(index, source, akType);
4890 }
4891
4892 @Override
4893 protected PValueSource getPValue(int index) {
4894- return context.getPValue(index);
4895+ return bindings.getPValue(index);
4896 }
4897
4898 @Override
4899 protected void setPValue(int index, PValueSource source) {
4900- context.setPValue(index, source);
4901+ bindings.setPValue(index, source);
4902 }
4903
4904 @Override
4905@@ -105,12 +108,12 @@
4906
4907 @Override
4908 public ResultSet executeQuery() throws SQLException {
4909- return executeQueryInternal(executableStatement, context);
4910+ return executeQueryInternal(executableStatement, context, bindings);
4911 }
4912
4913 @Override
4914 public int executeUpdate() throws SQLException {
4915- return executeUpdateInternal(executableStatement, context);
4916+ return executeUpdateInternal(executableStatement, context, bindings);
4917 }
4918
4919 @Override
4920@@ -294,7 +297,7 @@
4921
4922 @Override
4923 public void clearParameters() throws SQLException {
4924- context.clear();
4925+ bindings.clear();
4926 }
4927
4928 @Override
4929@@ -314,7 +317,7 @@
4930
4931 @Override
4932 public boolean execute() throws SQLException {
4933- return executeInternal(executableStatement, context);
4934+ return executeInternal(executableStatement, context, bindings);
4935 }
4936
4937 @Override
4938
4939=== modified file 'src/main/java/com/akiban/sql/embedded/JDBCStatement.java'
4940--- src/main/java/com/akiban/sql/embedded/JDBCStatement.java 2013-03-22 20:05:57 +0000
4941+++ src/main/java/com/akiban/sql/embedded/JDBCStatement.java 2013-07-09 23:55:31 +0000
4942@@ -17,6 +17,8 @@
4943
4944 package com.akiban.sql.embedded;
4945
4946+import com.akiban.qp.operator.QueryBindings;
4947+
4948 import java.sql.*;
4949 import java.util.ArrayList;
4950 import java.util.Queue;
4951@@ -41,18 +43,21 @@
4952 this.connection = connection;
4953 }
4954
4955- public boolean executeInternal(ExecutableStatement stmt, EmbeddedQueryContext context)
4956+ public boolean executeInternal(ExecutableStatement stmt, EmbeddedQueryContext context, QueryBindings bindings)
4957 throws SQLException {
4958 if (context == null) {
4959 if (stmt.getParameterMetaData() != null)
4960 throw new JDBCException("Statement requires parameters; must prepare");
4961 context = new EmbeddedQueryContext(this);
4962 }
4963+ if (bindings == null) {
4964+ bindings = context.createBindings();
4965+ }
4966 boolean hasResultSet = false;
4967 connection.beforeExecuteStatement(stmt);
4968 boolean success = false;
4969 try {
4970- ExecuteResults results = stmt.execute(context);
4971+ ExecuteResults results = stmt.execute(context, bindings);
4972 currentUpdateCount = results.getUpdateCount();
4973 if (results.getCursor() != null) {
4974 JDBCResultSet resultSet = new JDBCResultSet(this, stmt.getResultSetMetaData(), results.getCursor());
4975@@ -88,17 +93,19 @@
4976 }
4977
4978 public ResultSet executeQueryInternal(ExecutableStatement stmt,
4979- EmbeddedQueryContext context)
4980+ EmbeddedQueryContext context,
4981+ QueryBindings bindings)
4982 throws SQLException {
4983- boolean hasResultSet = executeInternal(stmt, context);
4984+ boolean hasResultSet = executeInternal(stmt, context, bindings);
4985 if (!hasResultSet) throw new JDBCException("Statement is not SELECT");
4986 return getResultSet();
4987 }
4988
4989 public int executeUpdateInternal(ExecutableStatement stmt,
4990- EmbeddedQueryContext context)
4991+ EmbeddedQueryContext context,
4992+ QueryBindings bindings)
4993 throws SQLException {
4994- boolean hasResultSet = executeInternal(stmt, context);
4995+ boolean hasResultSet = executeInternal(stmt, context, bindings);
4996 if (hasResultSet) throw new JDBCException("Statement is SELECT");
4997 return getUpdateCount();
4998 }
4999@@ -141,12 +148,12 @@
5000
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches