Package org.apache.tajo.storage

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


  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

        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

      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

Related Classes of org.apache.tajo.storage.LazyTuple

Copyright © 2018 www.massapicom. 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.