Package com.taobao.zeus.web.platform.client.module.tablemanager.model

Examples of com.taobao.zeus.web.platform.client.module.tablemanager.model.PartitionModel


    List<PartitionModel> pml = null;
    try {
      Table tb = tableManager.getTable(t.getName());
      if(tb.getPartitionKeysSize()<=0){
        //非分区表,添加一个默认分区
        PartitionModel pm = new PartitionModel();
        pm.setName("默认分区");
        pm.setCols(t.getCols());
        pm.setCompressed(true);
        pm.setFieldDelim(t.getFieldDelim());
        pm.setLineDelim(t.getLineDelim());
        pm.setInputFormat(t.getInputFormat());
        pm.setPath(t.getPath());
        pm.setSerDeClass(t.getSerDeClass());
        pml = new ArrayList<PartitionModel>(1);
        pml.add(pm);
        return pml;
      }
      List<Partition> pl = tableManager.getPartitions(t.getName(), 40);
      pml = new ArrayList<PartitionModel>(pl.size());

      for (Partition p : pl) {
        PartitionModel pm = new PartitionModel();
        StorageDescriptor sd = p.getSd();
        // 分区字段
        List<String> pks = new ArrayList<String>(
            tb.getPartitionKeysSize());
        Iterator<String> vi = p.getValuesIterator();
        // 拼接分区字段
        for (FieldSchema fs : tb.getPartitionKeys()) {
          pks.add(fs.getName() + "=" + vi.next());
        }
        pm.setPath(sd.getLocation());
        // 用'/'链接每个分区字段作为分区名
        pm.setName(StringUtils.join(pks.toArray(), '/'));
        pm.setSerDeClass(sd.getSerdeInfo().getSerializationLib());

        // 如果分隔符是数字,需要转义为对应的ascll字符
        String fieldDelim = tansToStringIfInt(sd.getSerdeInfo()
            .getParameters().get(FIELD_DELIMITER_KEY));
        String lineDelim = tansToStringIfInt(sd.getSerdeInfo()
            .getParameters().get(LINE_DELIMITER_KEY));
        pm.setFieldDelim(fieldDelim);
        pm.setLineDelim(lineDelim);

        pm.setCols(convert(sd.getCols()));
        pm.setInputFormat(sd.getInputFormat());
        pm.setCompressed(sd.isCompressed());
        pml.add(pm);
      }
    } catch (ZeusException e) {
      log.error("获取分区列表出错", e);
      throw new GwtException("获取分区列表出错", e);
View Full Code Here


    return grid;
  }

    private void downloadSelectPartition() {
        PartitionModel pm = grid.getSelectionModel().getSelectedItem();
        if (RootPanel.get("downloadiframe") != null) {
            Widget widgetFrame = (Widget) RootPanel
                    .get("downloadiframe");
            widgetFrame.removeFromParent();
        }
        Frame frame = new Frame(GWT.getHostPageBaseURL()
                + "partition_download.do" + "?path=" + pm.getPath()
                + "&table=" + panel.getTable().getName());
        frame.setVisible(false);
        frame.setSize("0px", "0px");
        RootPanel.get().add(frame);
    }
View Full Code Here

TOP

Related Classes of com.taobao.zeus.web.platform.client.module.tablemanager.model.PartitionModel

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.