Examples of LazyTuple


Examples of org.apache.tajo.storage.LazyTuple

      if(!isCompress()){
        offset = this.tupleOffsets[currentIdx];
      }

      byte[][] cells = Bytes.splitPreserveAllTokens(tuples[currentIdx++], delimiter, targetColumnIndexes);
      return new LazyTuple(schema, cells, offset);
    } catch (Throwable t) {
      LOG.error(t.getMessage(), t);
    }
    return null;
  }
View Full Code Here

Examples of org.apache.tajo.storage.LazyTuple

  public void testSimpleEval(String query, String [] expected) throws IOException {
    testEval(null, null, null, query, expected);
  }

  public void testEval(Schema schema, String tableName, String csvTuple, String query, String [] expected) throws IOException {
    LazyTuple lazyTuple;
    VTuple vtuple  = null;
    Schema inputSchema = null;
    if (schema != null) {
      inputSchema = (Schema) schema.clone();
      inputSchema.setQualifier(tableName, true);

      int targetIdx [] = new int[inputSchema.getColumnNum()];
      for (int i = 0; i < targetIdx.length; i++) {
        targetIdx[i] = i;
      }

      lazyTuple = new LazyTuple(inputSchema, Bytes.splitPreserveAllTokens(csvTuple.getBytes(), ',', targetIdx), 0);
      vtuple = new VTuple(inputSchema.getColumnNum());
      for (int i = 0; i < inputSchema.getColumnNum(); i++) {
        // If null value occurs, null datum is manually inserted to an input tuple.
        if (lazyTuple.get(i) instanceof TextDatum && lazyTuple.getText(i).asChars().equals("")) {
          vtuple.put(i, NullDatum.get());
        } else {
          vtuple.put(i, lazyTuple.get(i));
        }
      }
      cat.addTable(new TableDescImpl(tableName, inputSchema, CatalogProtos.StoreType.CSV, new Options(), CommonTestingUtil.getTestDir()));
    }
View Full Code Here

Examples of org.apache.tajo.storage.LazyTuple

        expected, ',', true);
  }

  public void testEval(Schema schema, String tableName, String csvTuple, String query, String [] expected,
                       char delimiter, boolean condition) throws IOException {
    LazyTuple lazyTuple;
    VTuple vtuple  = null;
    String qualifiedTableName =
        CatalogUtil.buildFQName(DEFAULT_DATABASE_NAME,
            tableName != null ? CatalogUtil.normalizeIdentifier(tableName) : null);
    Schema inputSchema = null;
    if (schema != null) {
      inputSchema = SchemaUtil.clone(schema);
      inputSchema.setQualifier(qualifiedTableName);

      int targetIdx [] = new int[inputSchema.size()];
      for (int i = 0; i < targetIdx.length; i++) {
        targetIdx[i] = i;
      }

      lazyTuple =
          new LazyTuple(inputSchema, Bytes.splitPreserveAllTokens(csvTuple.getBytes(), delimiter, targetIdx),0);
      vtuple = new VTuple(inputSchema.size());
      for (int i = 0; i < inputSchema.size(); i++) {
        // If null value occurs, null datum is manually inserted to an input tuple.
        if (lazyTuple.get(i) instanceof TextDatum && lazyTuple.get(i).asChars().equals("")) {
          vtuple.put(i, NullDatum.get());
        } else {
          vtuple.put(i, lazyTuple.get(i));
        }
      }
      cat.createTable(new TableDesc(qualifiedTableName, inputSchema,
          CatalogProtos.StoreType.CSV, new Options(), CommonTestingUtil.getTestDir()));
    }
View Full Code Here

Examples of org.apache.tajo.storage.LazyTuple

      if(!isCompress()){
        offset = this.tupleOffsets[currentIdx];
      }

      byte[][] cells = Bytes.splitPreserveAllTokens(tuples[currentIdx++], delimiter, targetColumnIndexes);
      return new LazyTuple(schema, cells, offset);
    } catch (Throwable t) {
      LOG.error(t.getMessage(), t);
    }
    return null;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.