use of org.voltdb.expressions.AbstractExpression in project voltdb by VoltDB.
the class IndexScanPlanNode method resolveColumnIndexes.
@Override
public void resolveColumnIndexes() {
// IndexScanPlanNode has TVEs that need index resolution in
// several expressions.
// Collect all the TVEs in the AbstractExpression members.
List<TupleValueExpression> index_tves = new ArrayList<>();
index_tves.addAll(ExpressionUtil.getTupleValueExpressions(m_endExpression));
index_tves.addAll(ExpressionUtil.getTupleValueExpressions(m_initialExpression));
index_tves.addAll(ExpressionUtil.getTupleValueExpressions(m_skip_null_predicate));
// and update their indexes against the table schema
for (TupleValueExpression tve : index_tves) {
tve.setColumnIndexUsingSchema(m_tableSchema);
}
// Do the same for each search key expression.
for (AbstractExpression search_exp : m_searchkeyExpressions) {
index_tves = ExpressionUtil.getTupleValueExpressions(search_exp);
// and update their indexes against the table schema
for (TupleValueExpression tve : index_tves) {
tve.setColumnIndexUsingSchema(m_tableSchema);
}
}
// now do the common scan node work
super.resolveColumnIndexes();
}
use of org.voltdb.expressions.AbstractExpression in project voltdb by VoltDB.
the class LimitPlanNode method resolveColumnIndexes.
@Override
public void resolveColumnIndexes() {
// Need to order and resolve indexes of output columns
assert (m_children.size() == 1);
AbstractPlanNode childNode = m_children.get(0);
childNode.resolveColumnIndexes();
NodeSchema inputSchema = childNode.getOutputSchema();
for (SchemaColumn col : m_outputSchema.getColumns()) {
AbstractExpression colExpr = col.getExpression();
// At this point, they'd better all be TVEs.
assert (colExpr instanceof TupleValueExpression);
TupleValueExpression tve = (TupleValueExpression) colExpr;
tve.setColumnIndexUsingSchema(inputSchema);
}
m_outputSchema.sortByTveIndex();
}
use of org.voltdb.expressions.AbstractExpression in project voltdb by VoltDB.
the class TupleScanPlanNode method toJSONString.
@Override
public void toJSONString(JSONStringer stringer) throws JSONException {
super.toJSONString(stringer);
// Output the correlated parameter ids
stringer.key(Members.PARAM_IDX.name()).array();
for (AbstractExpression colExpr : m_columnList) {
assert (colExpr instanceof ParameterValueExpression);
ParameterValueExpression pve = (ParameterValueExpression) colExpr;
stringer.value(pve.getParameterIndex());
}
stringer.endArray();
}
use of org.voltdb.expressions.AbstractExpression in project voltdb by VoltDB.
the class TupleScanPlanNode method loadFromJSONObject.
@Override
public void loadFromJSONObject(JSONObject jobj, Database db) throws JSONException {
super.loadFromJSONObject(jobj, db);
if (jobj.has(Members.PARAM_IDX.name())) {
JSONArray paramIdxArray = jobj.getJSONArray(Members.PARAM_IDX.name());
int paramSize = paramIdxArray.length();
assert (m_outputSchema != null && paramSize == m_outputSchema.size());
for (int i = 0; i < paramSize; ++i) {
int paramIdx = paramIdxArray.getInt(i);
ParameterValueExpression pve = new ParameterValueExpression();
pve.setParameterIndex(paramIdx);
AbstractExpression expr = m_outputSchema.getColumns().get(i).getExpression();
pve.setValueSize(expr.getValueSize());
pve.setValueType(expr.getValueType());
m_columnList.add(pve);
}
}
}
use of org.voltdb.expressions.AbstractExpression in project voltdb by VoltDB.
the class TupleScanPlanNode method generateOutputSchema.
@Override
public void generateOutputSchema(Database db) {
if (m_tableSchema == null) {
m_tableSchema = new NodeSchema();
int columnIdx = 1;
for (AbstractExpression colExpr : m_columnList) {
assert (colExpr instanceof ParameterValueExpression);
ParameterValueExpression pve = (ParameterValueExpression) colExpr;
// must produce a tuple value expression for this column.
String columnName = "C" + Integer.toString(columnIdx);
TupleValueExpression tve = new TupleValueExpression(m_targetTableName, m_targetTableAlias, columnName, columnName, pve, columnIdx);
m_tableSchema.addColumn(m_targetTableName, m_targetTableAlias, columnName, columnName, tve);
++columnIdx;
}
m_outputSchema = m_tableSchema;
m_hasSignificantOutputSchema = true;
}
}
Aggregations