Exemple #1
0
        private void CreateColumnRefs()
        {
            List <ColumnRefBinding> tableColumnRefs = new List <ColumnRefBinding>();

            if (!(_definition is DerivedTableBinding) && !(_definition is CommonTableBinding))
            {
                // Create special row column ref

                ColumnRefBinding rowColumnRefBinding = CreateRowColumnRefBinding(this);
                tableColumnRefs.Add(rowColumnRefBinding);
            }

            // Create all column refs.

            foreach (ColumnBinding columnDefinition in _definition.Columns)
            {
                ColumnRefBinding columnRefBinding = new ColumnRefBinding(this, columnDefinition);

                RowBufferEntry rowBufferEntry = new RowBufferEntry(columnRefBinding.ColumnBinding.DataType);
                rowBufferEntry.Name = columnRefBinding.GetFullName();

                ColumnValueDefinition columnValueDefinition = new ColumnValueDefinition();
                columnValueDefinition.Target           = rowBufferEntry;
                columnValueDefinition.ColumnRefBinding = columnRefBinding;

                columnRefBinding.ValueDefinition = columnValueDefinition;
                tableColumnRefs.Add(columnRefBinding);
            }

            // Assign column refs to table ref.

            _columnRefs = tableColumnRefs.ToArray();
        }
Exemple #2
0
        private static ColumnRefBinding CreateRowColumnRefBinding(TableRefBinding tableRefBinding)
        {
            RowColumnBinding rowColumnBinding    = new RowColumnBinding(tableRefBinding.TableBinding);
            ColumnRefBinding rowColumnRefBinding = new ColumnRefBinding(tableRefBinding, rowColumnBinding);

            RowBufferEntry rowColumnBufferEntry = new RowBufferEntry(rowColumnRefBinding.ColumnBinding.DataType);

            rowColumnBufferEntry.Name = rowColumnRefBinding.TableRefBinding.Name;

            ColumnValueDefinition rowColumnValueDefinition = new ColumnValueDefinition();

            rowColumnValueDefinition.Target           = rowColumnBufferEntry;
            rowColumnValueDefinition.ColumnRefBinding = rowColumnRefBinding;

            rowColumnRefBinding.ValueDefinition = rowColumnValueDefinition;
            return(rowColumnRefBinding);
        }
Exemple #3
0
        private void PushOuterReferences(object[] rowBuffer, JoinAlgebraNode node)
        {
            if (node.OuterReferences != null && node.OuterReferences.Length > 0)
            {
                // Important: We cannot use node.OuterReferences as argument for BoundRowBufferEntrySet().
                // The replacment strategy below will replace occurences to the entries by their index
                // within the array. Therefore we need an array with the same layout as the row buffer.

                RowBufferEntry[] outerReferences = new RowBufferEntry[node.Left.OutputList.Length];
                for (int i = 0; i < outerReferences.Length; i++)
                {
                    if (ArrayHelpers.Contains(node.OuterReferences, node.Left.OutputList[i]))
                    {
                        outerReferences[i] = node.Left.OutputList[i];
                    }
                }

                BoundRowBufferEntrySet bufferEntrySet = new BoundRowBufferEntrySet(rowBuffer, outerReferences);
                _outerReferenceStack.Push(bufferEntrySet);
            }
        }
Exemple #4
0
        private static RuntimeValueOutput GetDefinedValue(RowBufferEntry[] outputList, RowBufferEntry rowBufferEntry)
        {
            RuntimeValueOutput result = new RuntimeValueOutput();

            result.TargetIndex = Array.IndexOf(outputList, rowBufferEntry);
            return(result);
        }