@Override public void init() throws IOException { initChannel(); if (tupleBuffer == null) { tupleBuffer = new MemoryRowBlock(SchemaUtil.toDataTypes(schema), conf.getInt(READ_BUFFER_SIZE, DEFAULT_BUFFER_SIZE)); } else { tupleBuffer.clear(); } fetchNeeded = true; eos = false; super.init(); }
public void setSchema(Schema schema) { this.schema = SchemaUtil.clone(schema); }
public JoinEdge(JoinSpec joinSpec, JoinVertex leftVertex, JoinVertex rightVertex) { this.joinSpec = joinSpec; this.leftVertex = leftVertex; this.rightVertex = rightVertex; this.schema = SchemaUtil.merge(leftVertex.getSchema(), rightVertex.getSchema()); }
public JsonLineDeserializer(Schema schema, TableMeta meta, Column [] projected) { super(schema, meta); projectedPaths = SchemaUtil.convertColumnsToPaths(Lists.newArrayList(projected), true); types = SchemaUtil.buildTypeMap(schema.getAllColumns(), projectedPaths); timezone = TimeZone.getTimeZone(meta.getOption(StorageConstants.TIMEZONE, StorageUtil.TAJO_CONF.getSystemTimezone().getID())); }
factor *= (float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getSchema()) / (float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getLeftVertex().getSchema()); break; case RIGHT_OUTER: factor *= (float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getSchema()) / (float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getRightVertex().getSchema()); break; case FULL_OUTER: factor *= Math.max((float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getSchema()) / (float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getLeftVertex().getSchema()), (float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getSchema()) / (float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getRightVertex().getSchema())); break; case LEFT_ANTI: case LEFT_SEMI: factor *= DEFAULT_SELECTION_FACTOR * SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getSchema()) / (float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getLeftVertex().getSchema()); break; case INNER: * SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getSchema()) / (float)(SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getLeftVertex().getSchema()) + SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getRightVertex().getSchema())); break;
public JsonLineDeserializer(Schema schema, TableMeta meta, Column [] projected) { super(schema, meta); projectedPaths = SchemaUtil.convertColumnsToPaths(Lists.newArrayList(projected), true); types = SchemaUtil.buildTypeMap(schema.getAllColumns(), projectedPaths); timezone = TimeZone.getTimeZone(meta.getProperty(StorageConstants.TIMEZONE, StorageUtil.TAJO_CONF.getSystemTimezone().getID())); }
factor *= (float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getSchema()) / (float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getLeftVertex().getSchema()); break; case RIGHT_OUTER: factor *= (float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getSchema()) / (float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getRightVertex().getSchema()); break; case FULL_OUTER: factor *= Math.max((float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getSchema()) / (float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getLeftVertex().getSchema()), (float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getSchema()) / (float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getRightVertex().getSchema())); break; case LEFT_ANTI: case LEFT_SEMI: factor *= DEFAULT_SELECTION_FACTOR * SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getSchema()) / (float)SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getLeftVertex().getSchema()); break; case INNER: * SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getSchema()) / (float)(SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getLeftVertex().getSchema()) + SchemaUtil.estimateRowByteSizeWithSchema(joinEdge.getRightVertex().getSchema())); break;
@Override public void init() throws IOException { initChannel(); if (tupleBuffer == null) { tupleBuffer = new MemoryRowBlock(SchemaUtil.toDataTypes(schema), conf.getInt(READ_BUFFER_SIZE, DEFAULT_BUFFER_SIZE)); } else { tupleBuffer.clear(); } fetchNeeded = true; eos = false; super.init(); }
public JoinEdge(JoinSpec joinSpec, JoinVertex leftVertex, JoinVertex rightVertex) { this.joinSpec = joinSpec; this.leftVertex = leftVertex; this.rightVertex = rightVertex; this.schema = SchemaUtil.merge(leftVertex.getSchema(), rightVertex.getSchema()); }
public void setSchema(Schema schema) { this.schema = SchemaUtil.clone(schema); }
public JsonLineSerializer(Schema schema, TableMeta meta) { super(schema, meta); projectedPaths = SchemaUtil.convertColumnsToPaths(schema.getAllColumns(), true); types = SchemaUtil.buildTypeMap(schema.getAllColumns(), projectedPaths); timezone = TimeZone.getTimeZone(meta.getProperty(StorageConstants.TIMEZONE, StorageUtil.TAJO_CONF.getSystemTimezone().getID())); }
public SortIntersectExec(TaskAttemptContext context, PhysicalExec left, PhysicalExec right, boolean isDistinct) { super(context, left.getSchema(), right.getSchema(), left, right); TajoDataTypes.DataType[] leftTypes = SchemaUtil.toDataTypes(left.getSchema()); TajoDataTypes.DataType[] rightTypes = SchemaUtil.toDataTypes(right.getSchema()); if (!CatalogUtil.isMatchedFunction(Arrays.asList(leftTypes), Arrays.asList(rightTypes))) { throw new TajoInternalError("the both schemas are not compatible"); } comparator = new SetTupleComparator(left.getSchema(), right.getSchema()); this.isDistinct = isDistinct; }
public Schema getLogicalSchema() { if (hasPartition()) { Schema logicalSchema = SchemaUtil.merge(tableSchema, getPartitionMethod().getExpressionSchema()); logicalSchema.setQualifier(tableName); return logicalSchema; } else { return tableSchema; } }
public void init(String tableName, LogicalNode subQuery) { this.tableName = tableName; if (subQuery != null) { this.subQuery = subQuery; setOutSchema(SchemaUtil.clone(this.subQuery.getOutSchema())); setInSchema(SchemaUtil.clone(this.subQuery.getOutSchema())); getInSchema().setQualifier(this.tableName); getOutSchema().setQualifier(this.tableName); } }
public JsonLineSerializer(Schema schema, TableMeta meta) { super(schema, meta); projectedPaths = SchemaUtil.convertColumnsToPaths(schema.getAllColumns(), true); types = SchemaUtil.buildTypeMap(schema.getAllColumns(), projectedPaths); timezone = TimeZone.getTimeZone(meta.getOption(StorageConstants.TIMEZONE, StorageUtil.TAJO_CONF.getSystemTimezone().getID())); }
public SortIntersectExec(TaskAttemptContext context, PhysicalExec left, PhysicalExec right, boolean isDistinct) { super(context, left.getSchema(), right.getSchema(), left, right); TajoDataTypes.DataType[] leftTypes = SchemaUtil.toDataTypes(left.getSchema()); TajoDataTypes.DataType[] rightTypes = SchemaUtil.toDataTypes(right.getSchema()); if (!CatalogUtil.isMatchedFunction(Arrays.asList(leftTypes), Arrays.asList(rightTypes))) { throw new TajoInternalError("the both schemas are not compatible"); } comparator = new SetTupleComparator(left.getSchema(), right.getSchema()); this.isDistinct = isDistinct; }
public Schema getLogicalSchema() { if (hasPartition()) { Schema logicalSchema = SchemaUtil.merge(schema, getPartitionMethod().getExpressionSchema()); logicalSchema.setQualifier(tableName); return logicalSchema; } else { return schema; } }
public void init(String tableName, LogicalNode subQuery) { this.tableName = tableName; if (subQuery != null) { this.subQuery = subQuery; setOutSchema(SchemaUtil.clone(this.subQuery.getOutSchema())); setInSchema(SchemaUtil.clone(this.subQuery.getOutSchema())); getInSchema().setQualifier(this.tableName); getOutSchema().setQualifier(this.tableName); } }
final SettableFuture<MemoryRowBlock> future = SettableFuture.create(); if (rowBlock == null) { rowBlock = new MemoryRowBlock(SchemaUtil.toDataTypes(scanNode.getOutSchema()));
private LogicalNode createCartesianProduct(PlanContext context, LogicalNode left, LogicalNode right) throws TajoException { LogicalPlan plan = context.plan; QueryBlock block = context.queryBlock; Schema merged = SchemaUtil.merge(left.getOutSchema(), right.getOutSchema()); JoinNode join = plan.createNode(JoinNode.class); join.init(JoinType.CROSS, left, right); join.setInSchema(merged); block.addJoinType(join.getJoinType()); EvalNode evalNode; List<String> newlyEvaluatedExprs = new ArrayList<>(); for (Iterator<NamedExpr> it = block.namedExprsMgr.getIteratorForUnevaluatedExprs(); it.hasNext();) { NamedExpr namedExpr = it.next(); try { evalNode = exprAnnotator.createEvalNode(context, namedExpr.getExpr(), NameResolvingMode.LEGACY); if (EvalTreeUtil.findDistinctAggFunction(evalNode).size() == 0 && EvalTreeUtil.findWindowFunction(evalNode).size() == 0) { block.namedExprsMgr.markAsEvaluated(namedExpr.getAlias(), evalNode); newlyEvaluatedExprs.add(namedExpr.getAlias()); } } catch (UndefinedColumnException ve) {} } List<Target> targets = new ArrayList<>(PlannerUtil.schemaToTargets(merged)); for (String newAddedExpr : newlyEvaluatedExprs) { targets.add(block.namedExprsMgr.getTarget(newAddedExpr, true)); } join.setTargets(targets); return join; }