Skip to content

Commit

Permalink
PHOENIX-1516 Add RAND() built-in function
Browse files Browse the repository at this point in the history
  • Loading branch information
jtaylor-sfdc committed Jan 24, 2015
1 parent 599030a commit 5518654
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Expand Up @@ -42,7 +42,7 @@
* *
* @since 0.1 * @since 0.1
*/ */
public class RowProjector implements Cloneable { public class RowProjector {
public static final RowProjector EMPTY_PROJECTOR = new RowProjector(Collections.<ColumnProjector>emptyList(),0, true); public static final RowProjector EMPTY_PROJECTOR = new RowProjector(Collections.<ColumnProjector>emptyList(),0, true);


private final List<? extends ColumnProjector> columnProjectors; private final List<? extends ColumnProjector> columnProjectors;
Expand Down Expand Up @@ -93,8 +93,7 @@ public RowProjector(List<? extends ColumnProjector> columnProjectors, int estima
this.cloneRequired = hasPerInvocationExpression; this.cloneRequired = hasPerInvocationExpression;
} }


@Override public RowProjector cloneIfNecessary() {
public RowProjector clone() {
if (!cloneRequired) { if (!cloneRequired) {
return this; return this;
} }
Expand Down
Expand Up @@ -192,7 +192,7 @@ protected MutationState mutate(StatementContext context, ResultIterator iterator
PhoenixStatement statement = new PhoenixStatement(connection); PhoenixStatement statement = new PhoenixStatement(connection);
// Clone the row projector as it's not thread safe and would be used simultaneously by // Clone the row projector as it's not thread safe and would be used simultaneously by
// multiple threads otherwise. // multiple threads otherwise.
return upsertSelect(statement, tableRef, projector.clone(), iterator, columnIndexes, pkSlotIndexes); return upsertSelect(statement, tableRef, projector.cloneIfNecessary(), iterator, columnIndexes, pkSlotIndexes);
} }


public void setRowProjector(RowProjector projector) { public void setRowProjector(RowProjector projector) {
Expand Down
Expand Up @@ -111,7 +111,7 @@ public void initialize(InputSplit split, TaskAttemptContext context) throws IOEx
this.resultIterator = iterator; this.resultIterator = iterator;
// Clone the row projector as it's not thread safe and would be used simultaneously by // Clone the row projector as it's not thread safe and would be used simultaneously by
// multiple threads otherwise. // multiple threads otherwise.
this.resultSet = new PhoenixResultSet(this.resultIterator, queryPlan.getProjector().clone(),queryPlan.getContext().getStatement()); this.resultSet = new PhoenixResultSet(this.resultIterator, queryPlan.getProjector().cloneIfNecessary(),queryPlan.getContext().getStatement());
} catch (SQLException e) { } catch (SQLException e) {
LOG.error(String.format(" Error [%s] initializing PhoenixRecordReader. ",e.getMessage())); LOG.error(String.format(" Error [%s] initializing PhoenixRecordReader. ",e.getMessage()));
Throwables.propagate(e); Throwables.propagate(e);
Expand Down

0 comments on commit 5518654

Please sign in to comment.