當前位置: 首頁>>代碼示例>>Java>>正文


Java Row.getTimestamp方法代碼示例

本文整理匯總了Java中com.datastax.driver.core.Row.getTimestamp方法的典型用法代碼示例。如果您正苦於以下問題:Java Row.getTimestamp方法的具體用法?Java Row.getTimestamp怎麽用?Java Row.getTimestamp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.datastax.driver.core.Row的用法示例。


在下文中一共展示了Row.getTimestamp方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: convertToEntityEvent

import com.datastax.driver.core.Row; //導入方法依賴的package包/類
static EntityEvent convertToEntityEvent(Row entityEventData) {
        EventKey eventKey = new EventKey(entityEventData.getString(CassandraEventRecorder.ENTITY_ID), entityEventData.getInt(CassandraEventRecorder.VERSION));
        String opId = entityEventData.getString(CassandraEventRecorder.OP_ID);
        String eventData = entityEventData.getString(CassandraEventRecorder.EVENT_DATA);
//            ObjectNode jsonNode = (ObjectNode) objectMapper.readTree(eventData);
/*            for (String indexedField : indexedFields) {
                if (entityEventData.getColumnDefinitions().contains(indexedField))
                    jsonNode.put(indexedField, entityEventData.getString(indexedField));
            }*/
        return new EntityEvent(eventKey, opId,
                entityEventData.getTimestamp(CassandraEventRecorder.OP_DATE),
                entityEventData.getString(CassandraEventRecorder.EVENT_TYPE),
                EventState.valueOf(entityEventData.getString(CassandraEventRecorder.STATUS)),
                entityEventData.getString(CassandraEventRecorder.AUDIT_INFO),
                eventData);
    }
 
開發者ID:kloiasoft,項目名稱:eventapis,代碼行數:17,代碼來源:CassandraViewQuery.java

示例2: getValue

import com.datastax.driver.core.Row; //導入方法依賴的package包/類
private Object getValue(Row musicRow, String colname) {
	ColumnDefinitions cdef = musicRow.getColumnDefinitions();
	String type = cdef.getType(colname).getName().toString().toUpperCase();
	switch (type) {
	case "BIGINT":
		return musicRow.getLong(colname);
	case "BOOLEAN":
		return musicRow.getBool(colname);
	case "BLOB":
		return musicRow.getBytes(colname);
	case "DOUBLE":
		return musicRow.getDouble(colname);
	case "INT":
		return musicRow.getInt(colname);
	case "TIMESTAMP":
		return musicRow.getTimestamp(colname);
	default:
		logger.error("UNEXPECTED COLUMN TYPE: columname="+colname+", columntype="+type);
		// fall thru
	case "VARCHAR":
		return musicRow.getString(colname);
	}
}
 
開發者ID:att,項目名稱:music,代碼行數:24,代碼來源:CassandraMixin.java

示例3: createRepairSegmentFromRow

import com.datastax.driver.core.Row; //導入方法依賴的package包/類
private static RepairSegment createRepairSegmentFromRow(Row segmentRow) {

    RepairSegment.Builder builder = RepairSegment.builder(
          new RingRange(
              new BigInteger(segmentRow.getVarint("start_token") + ""),
              new BigInteger(segmentRow.getVarint("end_token") + "")),
          segmentRow.getUUID("repair_unit_id"))
        .withRunId(segmentRow.getUUID("id"))
        .state(State.values()[segmentRow.getInt("segment_state")])
        .failCount(segmentRow.getInt("fail_count"));

    if (null != segmentRow.getString("coordinator_host")) {
      builder = builder.coordinatorHost(segmentRow.getString("coordinator_host"));
    }
    if (null != segmentRow.getTimestamp("segment_start_time")) {
      builder = builder.startTime(new DateTime(segmentRow.getTimestamp("segment_start_time")));
    }
    if (null != segmentRow.getTimestamp("segment_end_time")) {
      builder = builder.endTime(new DateTime(segmentRow.getTimestamp("segment_end_time")));
    }
    return builder.build(segmentRow.getUUID("segment_id"));
  }
 
開發者ID:thelastpickle,項目名稱:cassandra-reaper,代碼行數:23,代碼來源:CassandraStorage.java

示例4: getInstant

import com.datastax.driver.core.Row; //導入方法依賴的package包/類
private static Instant getInstant(Row row, String column) {
    if (row.getColumnDefinitions().contains(column)) {
        Date date = row.getTimestamp(column);
        return date != null ? date.toInstant() : null;
    }
    return null;
}
 
開發者ID:xm-online,項目名稱:xm-ms-timeline,代碼行數:8,代碼來源:TimelineMapper.java

示例5: migrate

import com.datastax.driver.core.Row; //導入方法依賴的package包/類
/**
 * fix nulls in the repair_run table
 */
public static void migrate(Session session) {
  LOG.warn("Removing NULLs in the repair_run table. This may take some minutes…");

  Statement getRepairSegmentsPrepStmt =
      new SimpleStatement(
              "SELECT id,segment_id,segment_state,segment_start_time,segment_end_time FROM repair_run")
          .setConsistencyLevel(ConsistencyLevel.QUORUM);

  PreparedStatement updateRepairSegmentPrepStmt = session
      .prepare("INSERT INTO repair_run (id,segment_id,segment_start_time,segment_end_time)  VALUES(?, ?, ?, ?)")
      .setConsistencyLevel(ConsistencyLevel.EACH_QUORUM);

  ResultSet resultSet = session.execute(getRepairSegmentsPrepStmt);
  int rowsRead = 0;
  for (Row row : resultSet) {
    resultSet.fetchMoreResults();
    boolean update = false;
    RepairSegment.State state = RepairSegment.State.values()[row.getInt("segment_state")];
    Date startTime = row.getTimestamp("segment_start_time");
    Date endTime = row.getTimestamp("segment_end_time");

    // startTime can only be unset if segment is NOT_STARTED
    if (RepairSegment.State.NOT_STARTED != state && null == startTime) {
      update = true;
      startTime = new Date(0);
    }

    // endTime can only be set if segment is DONE
    if (RepairSegment.State.DONE != state && null != endTime) {
      update = true;
      endTime = null;
    }

    // endTime must be set if segment is DONE
    if (RepairSegment.State.DONE == state && null == endTime) {
      update = true;
      endTime = startTime;
    }

    if (update) {
      session.executeAsync(
          updateRepairSegmentPrepStmt.bind(row.getUUID("id"), row.getUUID("segment_id"), startTime, endTime));
    }
    ++rowsRead;
    if (0 == rowsRead % 1000) {
      LOG.warn("rows read: " + rowsRead);
    }
  }

  LOG.warn("Removal of NULLs in the repair_run table completed.");
}
 
開發者ID:thelastpickle,項目名稱:cassandra-reaper,代碼行數:55,代碼來源:Migration009.java


注:本文中的com.datastax.driver.core.Row.getTimestamp方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。