当前位置: 首页>>代码示例>>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;未经允许,请勿转载。