remove 'using std::...' and other from header files Adding 'using ...' into header files is not a good idea. In particular, it confuses the include-what-you-use tool so it gives strange and incorrect suggestions. Most likely, there is a bug in the tool as is, but let's at least not contradict our C++ style guide and remove those 'using ...' from the header files.
This patch does not contain any functional changes. Change-Id: Iea777af2d881abdb593f9e6f667e613cca8b2fd3 Reviewed-on: http://gerrit.cloudera.org:8080/7628 Reviewed-by: Dan Burkert <danburk...@apache.org> Tested-by: Alexey Serbin <aser...@cloudera.com> Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/154b07de Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/154b07de Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/154b07de Branch: refs/heads/master Commit: 154b07de73ca2b949fceacef6798411dc4a3c6eb Parents: b0839fc Author: Alexey Serbin <ale...@apache.org> Authored: Tue Aug 8 14:11:52 2017 -0700 Committer: Alexey Serbin <aser...@cloudera.com> Committed: Thu Aug 10 00:01:03 2017 +0000 ---------------------------------------------------------------------- .../benchmarks/tpch/line_item_tsv_importer.h | 6 +- src/kudu/benchmarks/tpch/rpc_line_item_dao.cc | 3 + src/kudu/benchmarks/tpch/tpch1.cc | 6 +- src/kudu/benchmarks/tpch/tpch_real_world.cc | 3 + src/kudu/benchmarks/wal_hiccup.cc | 1 + src/kudu/cfile/binary_prefix_block.cc | 1 + src/kudu/cfile/block_pointer.h | 7 +- src/kudu/cfile/bloomfile-test-base.h | 7 +- src/kudu/cfile/bloomfile-test.cc | 1 + src/kudu/cfile/bloomfile.cc | 2 + src/kudu/cfile/cfile-test-base.h | 10 +- src/kudu/cfile/cfile-test.cc | 2 + src/kudu/cfile/cfile_reader.cc | 4 +- src/kudu/cfile/cfile_reader.h | 6 +- src/kudu/cfile/cfile_writer.cc | 2 + src/kudu/cfile/cfile_writer.h | 13 +- src/kudu/cfile/encoding-test.cc | 13 +- src/kudu/cfile/index-test.cc | 7 +- src/kudu/cfile/index_block.cc | 8 +- src/kudu/cfile/index_block.h | 7 +- src/kudu/cfile/index_btree.cc | 2 + src/kudu/cfile/mt-bloomfile-test.cc | 2 +- src/kudu/cfile/plain_block.h | 2 +- src/kudu/cfile/type_encodings.cc | 9 +- src/kudu/client/batcher.cc | 2 + src/kudu/client/client-test-util.cc | 6 +- src/kudu/client/meta_cache.cc | 1 + src/kudu/client/scanner-internal.h | 2 +- src/kudu/client/schema.cc | 1 + src/kudu/client/table-internal.cc | 2 + src/kudu/clock/hybrid_clock-test.cc | 4 +- src/kudu/clock/hybrid_clock.cc | 7 +- src/kudu/clock/logical_clock.cc | 3 +- src/kudu/codegen/row_projector.h | 4 +- src/kudu/common/column_predicate-test.cc | 2 + src/kudu/common/column_predicate.cc | 1 + src/kudu/common/encoded_key-test.cc | 2 + src/kudu/common/encoded_key.cc | 1 + src/kudu/common/encoded_key.h | 8 +- src/kudu/common/generic_iterators-test.cc | 2 + src/kudu/common/generic_iterators.cc | 3 +- src/kudu/common/generic_iterators.h | 12 +- src/kudu/common/iterator.h | 2 +- src/kudu/common/key_encoder.cc | 2 +- src/kudu/common/key_util-test.cc | 4 +- src/kudu/common/partial_row-test.cc | 2 + src/kudu/common/partial_row.cc | 1 + src/kudu/common/partition.cc | 2 +- src/kudu/common/partition.h | 2 +- src/kudu/common/partition_pruner.cc | 2 +- src/kudu/common/row.h | 19 +-- src/kudu/common/row_changelist-test.cc | 5 +- src/kudu/common/row_changelist.cc | 1 + src/kudu/common/row_changelist.h | 2 +- src/kudu/common/row_operations-test.cc | 2 + src/kudu/common/row_operations.cc | 1 + src/kudu/common/scan_spec-test.cc | 2 + src/kudu/common/scan_spec.cc | 1 + src/kudu/common/scan_spec.h | 4 +- src/kudu/common/schema-test.cc | 1 + src/kudu/common/schema.cc | 6 +- src/kudu/common/schema.h | 74 +++++----- src/kudu/common/timestamp.cc | 2 +- src/kudu/common/types.cc | 1 + src/kudu/common/types.h | 41 +++--- src/kudu/common/wire_protocol-test-util.h | 2 +- src/kudu/common/wire_protocol-test.cc | 1 + src/kudu/common/wire_protocol.cc | 3 +- src/kudu/common/wire_protocol.h | 4 +- src/kudu/consensus/consensus-test-util.h | 30 ++-- src/kudu/consensus/consensus_peers-test.cc | 1 + src/kudu/consensus/consensus_peers.cc | 6 +- src/kudu/consensus/consensus_queue-test.cc | 2 + src/kudu/consensus/consensus_queue.cc | 4 +- src/kudu/consensus/log-test-base.h | 94 ++++++------ src/kudu/consensus/log-test.cc | 5 + src/kudu/consensus/log.h | 6 +- src/kudu/consensus/log_anchor_registry-test.cc | 1 + src/kudu/consensus/log_cache-test.cc | 2 + src/kudu/consensus/log_cache.cc | 2 + src/kudu/consensus/log_index.cc | 1 + src/kudu/consensus/log_reader.cc | 2 + src/kudu/consensus/log_util.cc | 3 +- src/kudu/consensus/mt-log-test.cc | 3 + src/kudu/consensus/quorum_util.cc | 7 +- src/kudu/consensus/raft_consensus.cc | 4 +- .../consensus/raft_consensus_quorum-test.cc | 8 +- src/kudu/consensus/time_manager-test.cc | 4 +- src/kudu/consensus/time_manager.cc | 7 +- src/kudu/fs/block_manager.h | 2 +- src/kudu/fs/data_dirs.cc | 1 + src/kudu/fs/data_dirs.h | 8 +- src/kudu/fs/fs-test-util.h | 2 +- src/kudu/fs/fs_manager.cc | 4 +- src/kudu/gutil/int128.h | 1 - src/kudu/gutil/map-util.h | 38 +++-- src/kudu/gutil/stl_util.h | 47 +++--- src/kudu/gutil/stringprintf.cc | 4 +- src/kudu/gutil/stringprintf.h | 12 +- src/kudu/gutil/strings/escaping.cc | 6 +- src/kudu/gutil/strings/escaping.h | 118 ++++++++------- src/kudu/gutil/strings/human_readable.cc | 2 + src/kudu/gutil/strings/human_readable.h | 37 +++-- src/kudu/gutil/strings/join.cc | 5 + src/kudu/gutil/strings/join.h | 122 ++++++++-------- src/kudu/gutil/strings/numbers.h | 120 ++++++++-------- src/kudu/gutil/strings/serialize.h | 88 ++++++------ src/kudu/gutil/strings/split.cc | 12 +- src/kudu/gutil/strings/split.h | 144 +++++++++---------- src/kudu/gutil/strings/split_internal.h | 17 +-- src/kudu/gutil/strings/strcat.cc | 2 + src/kudu/gutil/strings/strcat.h | 67 +++++---- src/kudu/gutil/strings/stringpiece.h | 2 +- src/kudu/gutil/strings/strip.h | 43 +++--- src/kudu/gutil/strings/substitute.cc | 2 + src/kudu/gutil/strings/substitute.h | 9 +- src/kudu/gutil/strings/util.h | 34 ++--- src/kudu/gutil/strtoint.h | 5 +- src/kudu/gutil/type_traits.h | 2 - src/kudu/gutil/walltime.cc | 8 +- src/kudu/gutil/walltime.h | 1 - src/kudu/integration-tests/all_types-itest.cc | 1 + src/kudu/integration-tests/alter_table-test.cc | 1 + .../client-negotiation-failover-itest.cc | 2 +- .../integration-tests/client-stress-test.cc | 2 + src/kudu/integration-tests/cluster_itest_util.h | 4 +- src/kudu/integration-tests/cluster_verifier.cc | 2 +- src/kudu/integration-tests/cluster_verifier.h | 4 +- .../create-table-stress-test.cc | 2 + .../integration-tests/disk_reservation-itest.cc | 1 + .../exactly_once_writes-itest.cc | 7 +- .../integration-tests/external_mini_cluster.cc | 1 + .../flex_partitioning-itest.cc | 2 + .../integration-tests/internal_mini_cluster.cc | 4 +- .../integration-tests/linked_list-test-util.h | 17 +-- src/kudu/integration-tests/linked_list-test.cc | 2 + .../integration-tests/master_migration-itest.cc | 1 + .../master_replication-itest.cc | 1 + .../integration-tests/raft_consensus-itest.cc | 3 + src/kudu/integration-tests/security-itest.cc | 1 + src/kudu/integration-tests/tablet_copy-itest.cc | 2 +- src/kudu/integration-tests/test_workload.cc | 6 +- src/kudu/integration-tests/ts_itest-base.h | 112 +++++++-------- src/kudu/integration-tests/ts_recovery-itest.cc | 3 +- .../ts_tablet_manager-itest.cc | 2 + .../update_scan_delta_compact-test.cc | 3 + src/kudu/master/catalog_manager-test.cc | 6 +- src/kudu/master/catalog_manager.cc | 3 +- src/kudu/master/catalog_manager.h | 4 +- src/kudu/master/master-path-handlers.cc | 2 +- src/kudu/master/master-test-util.h | 2 +- src/kudu/master/master-test.cc | 5 + src/kudu/master/master.cc | 1 + src/kudu/master/sys_catalog-test.cc | 1 + src/kudu/master/sys_catalog.cc | 3 +- src/kudu/master/sys_catalog.h | 2 +- src/kudu/master/ts_descriptor.cc | 2 + src/kudu/rpc/exactly_once_rpc-test.cc | 1 + src/kudu/rpc/inbound_call.cc | 1 + src/kudu/rpc/mt-rpc-test.cc | 1 + src/kudu/rpc/negotiation-test.cc | 1 + src/kudu/rpc/negotiation.cc | 1 + src/kudu/rpc/outbound_call.cc | 2 + src/kudu/rpc/remote_method.cc | 2 +- src/kudu/rpc/request_tracker.cc | 3 +- src/kudu/rpc/result_tracker.cc | 3 + src/kudu/rpc/result_tracker.h | 2 +- src/kudu/rpc/retriable_rpc.h | 2 +- src/kudu/rpc/rpc-test-base.h | 8 +- src/kudu/rpc/rpc.cc | 1 + src/kudu/rpc/rpc_context.cc | 1 + src/kudu/rpc/rpc_stub-test.cc | 2 + src/kudu/rpc/rpcz_store.cc | 5 +- src/kudu/rpc/sasl_common.cc | 1 + src/kudu/rpc/sasl_common.h | 4 +- src/kudu/rpc/server_negotiation.cc | 1 + src/kudu/rpc/service_pool.cc | 2 + src/kudu/security/cert-test.cc | 1 + src/kudu/security/cert.cc | 1 + src/kudu/security/openssl_util.cc | 1 + src/kudu/security/openssl_util.h | 2 +- src/kudu/security/openssl_util_bio.h | 6 +- src/kudu/security/simple_acl.cc | 1 + src/kudu/security/test/mini_kdc.cc | 1 + src/kudu/security/tls_context.cc | 1 + src/kudu/security/token-test.cc | 2 + src/kudu/server/default-path-handlers.cc | 1 + src/kudu/server/pprof-path-handlers.cc | 1 + src/kudu/server/rpc_server-test.cc | 1 + src/kudu/server/rpcz-path-handler.cc | 1 + src/kudu/server/tracing-path-handlers.cc | 1 + src/kudu/server/webserver-test.cc | 1 + src/kudu/server/webui_util.cc | 1 + .../tablet/all_types-scan-correctness-test.cc | 2 + src/kudu/tablet/cbtree-test.cc | 9 +- src/kudu/tablet/cfile_set-test.cc | 2 + src/kudu/tablet/cfile_set.cc | 6 + src/kudu/tablet/cfile_set.h | 36 +++-- src/kudu/tablet/compaction-test.cc | 2 + src/kudu/tablet/compaction.cc | 3 + src/kudu/tablet/compaction.h | 16 ++- src/kudu/tablet/compaction_policy.cc | 4 +- src/kudu/tablet/composite-pushdown-test.cc | 3 + src/kudu/tablet/concurrent_btree.h | 10 +- src/kudu/tablet/delta_compaction.cc | 1 + src/kudu/tablet/delta_iterator_merger.h | 6 +- src/kudu/tablet/delta_key.h | 2 +- src/kudu/tablet/delta_stats.cc | 1 + src/kudu/tablet/delta_store.cc | 1 + src/kudu/tablet/delta_store.h | 6 +- src/kudu/tablet/delta_tracker.cc | 2 + src/kudu/tablet/delta_tracker.h | 8 +- src/kudu/tablet/deltafile-test.cc | 2 + src/kudu/tablet/deltafile.cc | 2 + src/kudu/tablet/deltafile.h | 13 +- src/kudu/tablet/deltamemstore-test.cc | 2 + src/kudu/tablet/deltamemstore.cc | 2 + src/kudu/tablet/deltamemstore.h | 8 +- src/kudu/tablet/diskrowset-test-base.h | 26 ++-- src/kudu/tablet/diskrowset-test.cc | 2 + src/kudu/tablet/diskrowset.cc | 1 + src/kudu/tablet/key_value_test_schema.h | 4 +- src/kudu/tablet/local_tablet_writer.h | 2 +- src/kudu/tablet/lock_manager-test.cc | 3 +- src/kudu/tablet/lock_manager.cc | 2 + src/kudu/tablet/major_delta_compaction-test.cc | 2 + src/kudu/tablet/memrowset-test.cc | 2 + src/kudu/tablet/memrowset.cc | 2 + src/kudu/tablet/memrowset.h | 8 +- src/kudu/tablet/mock-rowsets.h | 2 +- .../tablet/mt-rowset_delta_compaction-test.cc | 1 + src/kudu/tablet/multi_column_writer.cc | 2 +- src/kudu/tablet/mutation.cc | 4 +- src/kudu/tablet/mutation.h | 2 +- src/kudu/tablet/mvcc.cc | 5 +- src/kudu/tablet/mvcc.h | 4 +- src/kudu/tablet/row_op.cc | 2 +- src/kudu/tablet/rowset.cc | 2 + src/kudu/tablet/rowset.h | 10 +- src/kudu/tablet/rowset_info.cc | 1 + src/kudu/tablet/rowset_metadata.cc | 2 +- src/kudu/tablet/rowset_metadata.h | 4 +- src/kudu/tablet/rowset_tree-test.cc | 1 + src/kudu/tablet/rowset_tree.cc | 1 + src/kudu/tablet/svg_dump.cc | 1 + src/kudu/tablet/tablet-harness.h | 14 +- src/kudu/tablet/tablet-pushdown-test.cc | 3 + src/kudu/tablet/tablet-schema-test.cc | 3 + src/kudu/tablet/tablet-test-base.h | 42 +++--- src/kudu/tablet/tablet-test-util.h | 46 +++--- src/kudu/tablet/tablet-test.cc | 2 + src/kudu/tablet/tablet.cc | 2 + src/kudu/tablet/tablet.h | 6 +- src/kudu/tablet/tablet_bootstrap.cc | 1 + src/kudu/tablet/tablet_history_gc-test.cc | 3 + src/kudu/tablet/tablet_metadata.cc | 2 + src/kudu/tablet/tablet_mm_ops-test.cc | 4 +- src/kudu/tablet/tablet_replica-test.cc | 1 + src/kudu/tablet/tablet_replica.cc | 2 + .../transactions/alter_schema_transaction.cc | 1 + .../tablet/transactions/transaction_driver.cc | 1 + .../tablet/transactions/transaction_tracker.cc | 1 + .../tablet/transactions/write_transaction.cc | 2 + src/kudu/tools/color.cc | 4 +- src/kudu/tools/ksck-test.cc | 1 + src/kudu/tools/ksck.cc | 2 + src/kudu/tools/ksck.h | 14 +- src/kudu/tools/kudu-admin-test.cc | 2 +- src/kudu/tools/kudu-tool-test.cc | 2 + src/kudu/tools/kudu-ts-cli-test.cc | 2 + src/kudu/tools/tool_action.cc | 1 + src/kudu/tools/tool_action_local_replica.cc | 4 +- src/kudu/tools/tool_action_master.cc | 1 + src/kudu/tools/tool_action_pbc.cc | 1 + src/kudu/tools/tool_action_tserver.cc | 1 + src/kudu/tserver/heartbeater.cc | 2 + src/kudu/tserver/scanners.cc | 2 + src/kudu/tserver/scanners.h | 2 +- src/kudu/tserver/tablet_copy-test-base.h | 4 +- src/kudu/tserver/tablet_copy_client-test.cc | 2 + src/kudu/tserver/tablet_copy_service-test.cc | 2 + src/kudu/tserver/tablet_copy_service.cc | 2 + src/kudu/tserver/tablet_copy_service.h | 2 +- .../tserver/tablet_copy_source_session-test.cc | 1 + src/kudu/tserver/tablet_copy_source_session.cc | 2 + src/kudu/tserver/tablet_server-test-base.h | 22 +-- src/kudu/tserver/tablet_server-test.cc | 1 + src/kudu/tserver/tablet_server.cc | 1 + src/kudu/tserver/tablet_service.cc | 1 + src/kudu/tserver/ts_tablet_manager-test.cc | 3 + src/kudu/tserver/ts_tablet_manager.h | 4 +- src/kudu/tserver/tserver-path-handlers.cc | 4 +- src/kudu/twitter-demo/insert_consumer.cc | 8 +- src/kudu/twitter-demo/parser-test.cc | 3 + src/kudu/twitter-demo/parser.cc | 6 +- src/kudu/twitter-demo/twitter-schema.h | 10 +- src/kudu/twitter-demo/twitter_streamer.cc | 1 + src/kudu/twitter-demo/twitter_streamer.h | 4 +- src/kudu/util/cache-test.cc | 4 +- src/kudu/util/cache.cc | 7 +- src/kudu/util/compression/compression_codec.cc | 2 +- src/kudu/util/crc-test.cc | 2 +- src/kudu/util/debug-util.cc | 13 +- src/kudu/util/debug/trace_event_impl.cc | 1 + src/kudu/util/env-test.cc | 1 + src/kudu/util/env_posix.cc | 16 +-- src/kudu/util/env_util-test.cc | 1 + src/kudu/util/env_util.cc | 1 + src/kudu/util/failure_detector.cc | 5 +- src/kudu/util/file_cache-stress-test.cc | 1 + src/kudu/util/flags.cc | 1 + src/kudu/util/group_varint-test.cc | 2 +- src/kudu/util/interval_tree-test.cc | 3 +- src/kudu/util/kernel_stack_watchdog.cc | 5 +- src/kudu/util/knapsack_solver-test.cc | 1 + src/kudu/util/locks.cc | 4 + src/kudu/util/locks.h | 4 - src/kudu/util/maintenance_manager-test.cc | 1 + src/kudu/util/maintenance_manager.cc | 4 +- src/kudu/util/memcmpable_varint-test.cc | 20 ++- src/kudu/util/memory/arena-test.cc | 1 + src/kudu/util/memory/arena.h | 6 +- src/kudu/util/memory/memory.h | 29 ++-- src/kudu/util/mt-metrics-test.cc | 1 + src/kudu/util/net/net_util-test.cc | 3 + src/kudu/util/net/net_util.cc | 1 + src/kudu/util/net/sockaddr.cc | 5 +- src/kudu/util/net/socket.cc | 4 +- src/kudu/util/nvm_cache.cc | 1 + src/kudu/util/object_pool.h | 14 +- src/kudu/util/oid_generator.cc | 1 + src/kudu/util/os-util.cc | 2 + src/kudu/util/pb_util.h | 17 ++- src/kudu/util/protoc-gen-insertions.cc | 1 + src/kudu/util/random-test.cc | 16 ++- src/kudu/util/spinlock_profiling-test.cc | 4 +- src/kudu/util/stopwatch.h | 2 +- src/kudu/util/thread.cc | 2 + src/kudu/util/threadpool.cc | 6 +- src/kudu/util/trace.cc | 7 +- 340 files changed, 1377 insertions(+), 1169 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/benchmarks/tpch/line_item_tsv_importer.h ---------------------------------------------------------------------- diff --git a/src/kudu/benchmarks/tpch/line_item_tsv_importer.h b/src/kudu/benchmarks/tpch/line_item_tsv_importer.h index 6045286..517b522 100644 --- a/src/kudu/benchmarks/tpch/line_item_tsv_importer.h +++ b/src/kudu/benchmarks/tpch/line_item_tsv_importer.h @@ -36,7 +36,7 @@ static const char* const kPipeSeparator = "|"; // Utility class used to parse the lineitem tsv file class LineItemTsvImporter { public: - explicit LineItemTsvImporter(const string &path) : in_(path.c_str()), + explicit LineItemTsvImporter(const std::string &path) : in_(path.c_str()), updated_(false) { CHECK(in_.is_open()) << "not able to open input file: " << path; } @@ -127,8 +127,8 @@ class LineItemTsvImporter { CHECK_OK(row->SetDouble(col_idx, number)); } std::ifstream in_; - vector<StringPiece> columns_; - string line_, tmp_; + std::vector<StringPiece> columns_; + std::string line_, tmp_; bool updated_, done_; }; } // namespace kudu http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/benchmarks/tpch/rpc_line_item_dao.cc ---------------------------------------------------------------------- diff --git a/src/kudu/benchmarks/tpch/rpc_line_item_dao.cc b/src/kudu/benchmarks/tpch/rpc_line_item_dao.cc index 4b5e7d5..e0574ae 100644 --- a/src/kudu/benchmarks/tpch/rpc_line_item_dao.cc +++ b/src/kudu/benchmarks/tpch/rpc_line_item_dao.cc @@ -37,6 +37,9 @@ DEFINE_bool(tpch_cache_blocks_when_scanning, true, "Whether the scanners should cache the blocks that are read or not"); +using std::string; +using std::vector; + namespace kudu { using client::KuduInsert; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/benchmarks/tpch/tpch1.cc ---------------------------------------------------------------------- diff --git a/src/kudu/benchmarks/tpch/tpch1.cc b/src/kudu/benchmarks/tpch/tpch1.cc index 369a08e..816afc9 100644 --- a/src/kudu/benchmarks/tpch/tpch1.cc +++ b/src/kudu/benchmarks/tpch/tpch1.cc @@ -95,14 +95,16 @@ DEFINE_int32(tpch_max_batch_size, 1000, DEFINE_string(table_name, "lineitem", "The table name to write/read"); +using std::string; +using std::unordered_map; +using std::vector; + namespace kudu { using client::KuduColumnSchema; using client::KuduRowResult; using client::KuduSchema; -using std::unordered_map; - struct Result { int32_t l_quantity; double l_extendedprice; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/benchmarks/tpch/tpch_real_world.cc ---------------------------------------------------------------------- diff --git a/src/kudu/benchmarks/tpch/tpch_real_world.cc b/src/kudu/benchmarks/tpch/tpch_real_world.cc index 6374132..291e721 100644 --- a/src/kudu/benchmarks/tpch/tpch_real_world.cc +++ b/src/kudu/benchmarks/tpch/tpch_real_world.cc @@ -103,6 +103,9 @@ DEFINE_string(tpch_partition_strategy, "range", "tablets. This is less ideal, but more faithfully represents a lot of write " "workloads."); +using std::string; +using std::vector; + namespace kudu { using client::KuduRowResult; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/benchmarks/wal_hiccup.cc ---------------------------------------------------------------------- diff --git a/src/kudu/benchmarks/wal_hiccup.cc b/src/kudu/benchmarks/wal_hiccup.cc index e1525c8..faf5e5d 100644 --- a/src/kudu/benchmarks/wal_hiccup.cc +++ b/src/kudu/benchmarks/wal_hiccup.cc @@ -56,6 +56,7 @@ DEFINE_bool(page_align_wal_writes, false, "write to the fake WAL with exactly 4KB writes to never cross pages"); using std::string; +using std::vector; namespace kudu { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/binary_prefix_block.cc ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/binary_prefix_block.cc b/src/kudu/cfile/binary_prefix_block.cc index 97749bc..0895f36 100644 --- a/src/kudu/cfile/binary_prefix_block.cc +++ b/src/kudu/cfile/binary_prefix_block.cc @@ -35,6 +35,7 @@ namespace kudu { namespace cfile { using kudu::coding::AppendGroupVarInt32; +using std::string; using strings::Substitute; //////////////////////////////////////////////////////////// http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/block_pointer.h ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/block_pointer.h b/src/kudu/cfile/block_pointer.h index 3e29f17..0c4554c 100644 --- a/src/kudu/cfile/block_pointer.h +++ b/src/kudu/cfile/block_pointer.h @@ -26,9 +26,8 @@ #include "kudu/util/coding.h" #include "kudu/util/status.h" -namespace kudu { namespace cfile { - -using std::string; +namespace kudu { +namespace cfile { class BlockPointer { public: @@ -46,7 +45,7 @@ class BlockPointer { offset_(offset), size_(size) {} - string ToString() const { + std::string ToString() const { return strings::Substitute("offset=$0 size=$1", offset_, size_); } http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/bloomfile-test-base.h ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/bloomfile-test-base.h b/src/kudu/cfile/bloomfile-test-base.h index 774de92..ea88136 100644 --- a/src/kudu/cfile/bloomfile-test-base.h +++ b/src/kudu/cfile/bloomfile-test-base.h @@ -40,9 +40,6 @@ DEFINE_bool(benchmark_should_hit, false, "Set to true for the benchmark to query namespace kudu { namespace cfile { -using fs::ReadableBlock; -using fs::WritableBlock; - static const int kKeyShift = 2; class BloomFileTestBase : public KuduTest { @@ -70,7 +67,7 @@ class BloomFileTestBase : public KuduTest { } void WriteTestBloomFile() { - std::unique_ptr<WritableBlock> sink; + std::unique_ptr<fs::WritableBlock> sink; ASSERT_OK(fs_manager_->CreateNewBlock({}, &sink)); block_id_ = sink->id(); @@ -90,7 +87,7 @@ class BloomFileTestBase : public KuduTest { } Status OpenBloomFile() { - std::unique_ptr<ReadableBlock> source; + std::unique_ptr<fs::ReadableBlock> source; RETURN_NOT_OK(fs_manager_->OpenBlock(block_id_, &source)); return BloomFileReader::Open(std::move(source), ReaderOptions(), &bfr_); http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/bloomfile-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/bloomfile-test.cc b/src/kudu/cfile/bloomfile-test.cc index 57e1ee2..6b385a9 100644 --- a/src/kudu/cfile/bloomfile-test.cc +++ b/src/kudu/cfile/bloomfile-test.cc @@ -24,6 +24,7 @@ namespace kudu { namespace cfile { using fs::CountingReadableBlock; +using fs::ReadableBlock; using std::unique_ptr; class BloomFileTest : public BloomFileTestBase { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/bloomfile.cc ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/bloomfile.cc b/src/kudu/cfile/bloomfile.cc index 7d69ac1..5fa1665 100644 --- a/src/kudu/cfile/bloomfile.cc +++ b/src/kudu/cfile/bloomfile.cc @@ -33,7 +33,9 @@ DECLARE_bool(cfile_lazy_open); +using std::string; using std::unique_ptr; +using std::vector; namespace kudu { namespace cfile { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/cfile-test-base.h ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/cfile-test-base.h b/src/kudu/cfile/cfile-test-base.h index fa49a99..c4240fe 100644 --- a/src/kudu/cfile/cfile-test-base.h +++ b/src/kudu/cfile/cfile-test-base.h @@ -42,10 +42,6 @@ DEFINE_int32(cfile_test_block_size, 1024, "Default is low to stress code, but can be set higher for " "performance testing"); -using kudu::fs::ReadableBlock; -using kudu::fs::WritableBlock; -using std::unique_ptr; - namespace kudu { namespace cfile { @@ -349,7 +345,7 @@ class CFileTestBase : public KuduTest { int num_entries, uint32_t flags, BlockId* block_id) { - unique_ptr<WritableBlock> sink; + std::unique_ptr<fs::WritableBlock> sink; ASSERT_OK(fs_manager_->CreateNewBlock({}, &sink)); *block_id = sink->id(); WriterOptions opts; @@ -463,9 +459,9 @@ void ReadBinaryFile(CFileIterator* iter, int* count) { void TimeReadFile(FsManager* fs_manager, const BlockId& block_id, size_t *count_ret) { Status s; - unique_ptr<fs::ReadableBlock> source; + std::unique_ptr<fs::ReadableBlock> source; ASSERT_OK(fs_manager->OpenBlock(block_id, &source)); - unique_ptr<CFileReader> reader; + std::unique_ptr<CFileReader> reader; ASSERT_OK(CFileReader::Open(std::move(source), ReaderOptions(), &reader)); gscoped_ptr<CFileIterator> iter; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/cfile-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/cfile-test.cc b/src/kudu/cfile/cfile-test.cc index dc29a62..4afb5a4 100644 --- a/src/kudu/cfile/cfile-test.cc +++ b/src/kudu/cfile/cfile-test.cc @@ -50,7 +50,9 @@ METRIC_DECLARE_counter(block_cache_hits_caching); METRIC_DECLARE_entity(server); using std::shared_ptr; +using std::string; using std::unique_ptr; +using std::vector; using strings::Substitute; namespace kudu { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/cfile_reader.cc ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/cfile_reader.cc b/src/kudu/cfile/cfile_reader.cc index bc00359..93c0788 100644 --- a/src/kudu/cfile/cfile_reader.cc +++ b/src/kudu/cfile/cfile_reader.cc @@ -56,8 +56,10 @@ DEFINE_bool(cfile_verify_checksums, true, TAG_FLAG(cfile_verify_checksums, evolving); using kudu::fs::ReadableBlock; -using strings::Substitute; +using std::string; using std::unique_ptr; +using std::vector; +using strings::Substitute; namespace kudu { namespace cfile { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/cfile_reader.h ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/cfile_reader.h b/src/kudu/cfile/cfile_reader.h index f7a108c..1517771 100644 --- a/src/kudu/cfile/cfile_reader.h +++ b/src/kudu/cfile/cfile_reader.h @@ -110,7 +110,7 @@ class CFileReader { // // Note that this implementation is currently O(n), so should not be used // in a hot path. - bool GetMetadataEntry(const string &key, string *val); + bool GetMetadataEntry(const std::string &key, std::string *val); // Can be called before Init(). uint64_t file_size() const { @@ -428,7 +428,7 @@ class CFileIterator : public ColumnIterator { return first_row_idx() + num_rows_in_block_ - 1; } - string ToString() const; + std::string ToString() const; }; // Seek the given PreparedBlock to the given index within it. @@ -468,7 +468,7 @@ class CFileIterator : public ColumnIterator { // Data blocks that contain data relevant to the currently Prepared // batch of rows. // These pointers are allocated from the prepared_block_pool_ below. - vector<PreparedBlock *> prepared_blocks_; + std::vector<PreparedBlock *> prepared_blocks_; ObjectPool<PreparedBlock> prepared_block_pool_; typedef ObjectPool<PreparedBlock>::scoped_ptr pblock_pool_scoped_ptr; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/cfile_writer.cc ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/cfile_writer.cc b/src/kudu/cfile/cfile_writer.cc index 5ca7f3d..cfc934a 100644 --- a/src/kudu/cfile/cfile_writer.cc +++ b/src/kudu/cfile/cfile_writer.cc @@ -71,8 +71,10 @@ using google::protobuf::RepeatedPtrField; using kudu::fs::ScopedWritableBlockCloser; using kudu::fs::WritableBlock; using std::accumulate; +using std::pair; using std::string; using std::unique_ptr; +using std::vector; namespace kudu { namespace cfile { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/cfile_writer.h ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/cfile_writer.h b/src/kudu/cfile/cfile_writer.h index 5766684..8b6ac57 100644 --- a/src/kudu/cfile/cfile_writer.h +++ b/src/kudu/cfile/cfile_writer.h @@ -22,7 +22,6 @@ #include <memory> #include <string> -#include <unordered_map> #include <utility> #include <vector> @@ -46,7 +45,6 @@ namespace kudu { class Arena; namespace cfile { -using std::unordered_map; class BlockPointer; class BTreeInfoPB; @@ -142,7 +140,7 @@ class CFileWriter { // // validx_prev should be a Slice pointing to the last key of the previous block. // It will be used to optimize the value index entry for the block. - Status AppendRawBlock(const vector<Slice> &data_slices, + Status AppendRawBlock(const std::vector<Slice> &data_slices, size_t ordinal_pos, const void *validx_curr, const Slice &validx_prev, @@ -168,7 +166,8 @@ class CFileWriter { std::string ToString() const { return block_->id().ToString(); } // Wrapper for AddBlock() to append the dictionary block to the end of a Cfile. - Status AppendDictBlock(const vector<Slice> &data_slices, BlockPointer *block_ptr, + Status AppendDictBlock(const std::vector<Slice> &data_slices, + BlockPointer *block_ptr, const char *name_for_log) { return AddBlock(data_slices, block_ptr, name_for_log); } @@ -181,11 +180,11 @@ class CFileWriter { // Append the given block into the file. // // Sets *block_ptr to correspond to the newly inserted block. - Status AddBlock(const vector<Slice> &data_slices, + Status AddBlock(const std::vector<Slice> &data_slices, BlockPointer *block_ptr, const char *name_for_log); - Status WriteRawData(const vector<Slice>& data); + Status WriteRawData(const std::vector<Slice>& data); Status FinishCurDataBlock(); @@ -222,7 +221,7 @@ class CFileWriter { faststring tmp_buf_; // Metadata which has been added to the writer but not yet flushed. - vector<pair<string, string> > unflushed_metadata_; + std::vector<std::pair<std::string, std::string> > unflushed_metadata_; gscoped_ptr<BlockBuilder> data_block_; gscoped_ptr<IndexTreeBuilder> posidx_builder_; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/encoding-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/encoding-test.cc b/src/kudu/cfile/encoding-test.cc index 7c12854..8dfd602 100644 --- a/src/kudu/cfile/encoding-test.cc +++ b/src/kudu/cfile/encoding-test.cc @@ -42,6 +42,7 @@ #include "kudu/util/test_macros.h" #include "kudu/util/test_util.h" +using std::string; using std::unique_ptr; using std::vector; @@ -77,7 +78,7 @@ class TestEncoding : public KuduTest { int num_items, const char *fmt_str) { vector<unique_ptr<string>> to_insert; - std::vector<Slice> slices; + vector<Slice> slices; for (uint i = 0; i < num_items; i++) { to_insert.emplace_back(new string(StringPrintf(fmt_str, i))); slices.emplace_back(to_insert.back()->data()); @@ -416,7 +417,7 @@ class TestEncoding : public KuduTest { ASSERT_EQ(kOrdinalPosBase, pbd.GetFirstRowId()); ASSERT_EQ(0, pbd.GetCurrentIndex()); - std::vector<CppType> decoded; + vector<CppType> decoded; decoded.resize(size); ColumnBlock dst_block(GetTypeInfo(Type), nullptr, &decoded[0], size, &arena_); @@ -496,7 +497,7 @@ class TestEncoding : public KuduTest { srand(123); - std::vector<CppType> to_insert; + vector<CppType> to_insert; Random rd(SeedRandom()); for (int i = 0; i < 10003; i++) { int64_t val = rd.Next64() % std::numeric_limits<CppType>::max(); @@ -532,7 +533,7 @@ class TestEncoding : public KuduTest { ASSERT_EQ(kOrdinalPosBase, ibd.GetFirstRowId()); - std::vector<CppType> decoded; + vector<CppType> decoded; decoded.resize(to_insert.size()); ColumnBlock dst_block(GetTypeInfo(IntType), nullptr, @@ -598,7 +599,7 @@ class TestEncoding : public KuduTest { srand(123); - std::vector<uint8_t> to_insert; + vector<uint8_t> to_insert; for (int i = 0; i < 10003; ) { int run_size = random() % 100; bool val = random() % 2; @@ -619,7 +620,7 @@ class TestEncoding : public KuduTest { ASSERT_EQ(kOrdinalPosBase, bd.GetFirstRowId()); - std::vector<uint8_t> decoded; + vector<uint8_t> decoded; decoded.resize(to_insert.size()); ColumnBlock dst_block(GetTypeInfo(BOOL), nullptr, http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/index-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/index-test.cc b/src/kudu/cfile/index-test.cc index c245d51..f0d457c 100644 --- a/src/kudu/cfile/index-test.cc +++ b/src/kudu/cfile/index-test.cc @@ -15,6 +15,8 @@ // specific language governing permissions and limitations // under the License. +#include <string> + #include <gtest/gtest.h> #include "kudu/cfile/cfile_writer.h" @@ -24,10 +26,11 @@ #include "kudu/util/status.h" #include "kudu/util/test_macros.h" -namespace kudu { namespace cfile { +namespace kudu { +namespace cfile { Status SearchInReaderString(const IndexBlockReader &reader, - string search_key, + std::string search_key, BlockPointer *ptr, Slice *match) { static faststring dst; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/index_block.cc ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/index_block.cc b/src/kudu/cfile/index_block.cc index 9ce3888..904be7e 100644 --- a/src/kudu/cfile/index_block.cc +++ b/src/kudu/cfile/index_block.cc @@ -15,8 +15,11 @@ // specific language governing permissions and limitations // under the License. -#include "kudu/cfile/cfile_writer.h" #include "kudu/cfile/index_block.h" + +#include <string> + +#include "kudu/cfile/cfile_writer.h" #include "kudu/gutil/strings/substitute.h" #include "kudu/util/pb_util.h" #include "kudu/util/protobuf_util.h" @@ -146,7 +149,8 @@ Status IndexBlockReader::Parse(const Slice &data) { size_t max_size = trailer_size_ptr - data_.data(); if (trailer_size <= 0 || trailer_size > max_size) { - string err = strings::Substitute("invalid index block trailer size: $0", trailer_size); + std::string err = strings::Substitute( + "invalid index block trailer size: $0", trailer_size); return Status::Corruption(err); } http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/index_block.h ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/index_block.h b/src/kudu/cfile/index_block.h index 139ccf6..1817b66 100644 --- a/src/kudu/cfile/index_block.h +++ b/src/kudu/cfile/index_block.h @@ -19,7 +19,6 @@ #define KUDU_CFILE_INDEX_BLOCK_H #include <glog/logging.h> -#include <string> #include <vector> #include "kudu/common/types.h" @@ -32,10 +31,6 @@ namespace kudu { namespace cfile { -using std::string; -using std::vector; -using kudu::DataTypeTraits; - // Forward decl. class IndexBlockIterator; @@ -94,7 +89,7 @@ class IndexBlockBuilder { bool is_leaf_; faststring buffer_; - vector<uint32_t> entry_offsets_; + std::vector<uint32_t> entry_offsets_; }; class IndexBlockReader { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/index_btree.cc ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/index_btree.cc b/src/kudu/cfile/index_btree.cc index c31c915..54d8739 100644 --- a/src/kudu/cfile/index_btree.cc +++ b/src/kudu/cfile/index_btree.cc @@ -24,6 +24,8 @@ #include "kudu/common/key_encoder.h" #include "kudu/util/debug-util.h" +using std::vector; + namespace kudu { namespace cfile { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/mt-bloomfile-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/mt-bloomfile-test.cc b/src/kudu/cfile/mt-bloomfile-test.cc index 91b03d3..ac0bd98 100644 --- a/src/kudu/cfile/mt-bloomfile-test.cc +++ b/src/kudu/cfile/mt-bloomfile-test.cc @@ -33,7 +33,7 @@ TEST_F(MTBloomFileTest, Benchmark) { ASSERT_NO_FATAL_FAILURE(WriteTestBloomFile()); ASSERT_OK(OpenBloomFile()); - vector<scoped_refptr<kudu::Thread> > threads; + std::vector<scoped_refptr<kudu::Thread> > threads; for (int i = 0; i < FLAGS_benchmark_num_threads; i++) { scoped_refptr<kudu::Thread> new_thread; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/plain_block.h ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/plain_block.h b/src/kudu/cfile/plain_block.h index 9fcca2f..a878e58 100644 --- a/src/kudu/cfile/plain_block.h +++ b/src/kudu/cfile/plain_block.h @@ -132,7 +132,7 @@ class PlainBlockDecoder final : public BlockDecoder { if (data_.size() != kPlainBlockHeaderSize + num_elems_ * size_of_type) { return Status::Corruption( - string("unexpected data size. ") + "\nFirst 100 bytes: " + std::string("unexpected data size. ") + "\nFirst 100 bytes: " + HexDump( Slice(data_.data(), (data_.size() < 100 ? data_.size() : 100)))); http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/cfile/type_encodings.cc ---------------------------------------------------------------------- diff --git a/src/kudu/cfile/type_encodings.cc b/src/kudu/cfile/type_encodings.cc index 4cc9e7c..85035c6 100644 --- a/src/kudu/cfile/type_encodings.cc +++ b/src/kudu/cfile/type_encodings.cc @@ -32,12 +32,13 @@ #include "kudu/common/types.h" #include "kudu/gutil/strings/substitute.h" -namespace kudu { -namespace cfile { - -using std::unordered_map; +using std::make_pair; +using std::pair; using std::shared_ptr; +using std::unordered_map; +namespace kudu { +namespace cfile { template<DataType Type, EncodingType Encoding> struct DataTypeEncodingTraits {}; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/client/batcher.cc ---------------------------------------------------------------------- diff --git a/src/kudu/client/batcher.cc b/src/kudu/client/batcher.cc index 6999835..2fe4bf0 100644 --- a/src/kudu/client/batcher.cc +++ b/src/kudu/client/batcher.cc @@ -59,8 +59,10 @@ using std::pair; using std::set; using std::shared_ptr; +using std::string; using std::unique_ptr; using std::unordered_map; +using std::vector; using strings::Substitute; namespace kudu { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/client/client-test-util.cc ---------------------------------------------------------------------- diff --git a/src/kudu/client/client-test-util.cc b/src/kudu/client/client-test-util.cc index 32a4020..c44e813 100644 --- a/src/kudu/client/client-test-util.cc +++ b/src/kudu/client/client-test-util.cc @@ -17,6 +17,7 @@ #include "kudu/client/client-test-util.h" +#include <string> #include <vector> #include <glog/logging.h> @@ -26,13 +27,16 @@ #include "kudu/util/test_macros.h" #include "kudu/util/test_util.h" +using std::string; +using std::vector; + namespace kudu { namespace client { void LogSessionErrorsAndDie(const sp::shared_ptr<KuduSession>& session, const Status& s) { CHECK(!s.ok()); - std::vector<KuduError*> errors; + vector<KuduError*> errors; ElementDeleter d(&errors); bool overflow; session->GetPendingErrors(&errors, &overflow); http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/client/meta_cache.cc ---------------------------------------------------------------------- diff --git a/src/kudu/client/meta_cache.cc b/src/kudu/client/meta_cache.cc index 5c57356..fecac55 100644 --- a/src/kudu/client/meta_cache.cc +++ b/src/kudu/client/meta_cache.cc @@ -50,6 +50,7 @@ using std::map; using std::set; using std::shared_ptr; using std::string; +using std::vector; using strings::Substitute; namespace kudu { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/client/scanner-internal.h ---------------------------------------------------------------------- diff --git a/src/kudu/client/scanner-internal.h b/src/kudu/client/scanner-internal.h index 4ca99f2..1100408 100644 --- a/src/kudu/client/scanner-internal.h +++ b/src/kudu/client/scanner-internal.h @@ -281,7 +281,7 @@ class KuduScanBatch::Data { return KuduRowResult(projection_, &direct_data_[offset]); } - void ExtractRows(vector<KuduScanBatch::RowPtr>* rows); + void ExtractRows(std::vector<KuduScanBatch::RowPtr>* rows); void Clear(); http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/client/schema.cc ---------------------------------------------------------------------- diff --git a/src/kudu/client/schema.cc b/src/kudu/client/schema.cc index bcf24b6..9ffb1a4 100644 --- a/src/kudu/client/schema.cc +++ b/src/kudu/client/schema.cc @@ -40,6 +40,7 @@ MAKE_ENUM_LIMITS(kudu::client::KuduColumnSchema::DataType, kudu::client::KuduColumnSchema::INT8, kudu::client::KuduColumnSchema::BOOL); +using std::string; using std::unordered_map; using std::vector; using strings::Substitute; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/client/table-internal.cc ---------------------------------------------------------------------- diff --git a/src/kudu/client/table-internal.cc b/src/kudu/client/table-internal.cc index b3f3258..ebed838 100644 --- a/src/kudu/client/table-internal.cc +++ b/src/kudu/client/table-internal.cc @@ -19,6 +19,8 @@ #include <string> +using std::string; + namespace kudu { namespace client { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/clock/hybrid_clock-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/clock/hybrid_clock-test.cc b/src/kudu/clock/hybrid_clock-test.cc index caea024..baed9d8 100644 --- a/src/kudu/clock/hybrid_clock-test.cc +++ b/src/kudu/clock/hybrid_clock-test.cc @@ -16,6 +16,8 @@ // under the License. #include <algorithm> +#include <vector> + #include <glog/logging.h> #include <gtest/gtest.h> @@ -266,7 +268,7 @@ void StresserThread(HybridClock* clock, AtomicBool* stop) { // Regression test for KUDU-953: if threads are updating and polling the // clock concurrently, the clock should still never run backwards. TEST_F(HybridClockTest, TestClockDoesntGoBackwardsWithUpdates) { - vector<scoped_refptr<kudu::Thread> > threads; + std::vector<scoped_refptr<kudu::Thread> > threads; AtomicBool stop(false); for (int i = 0; i < 4; i++) { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/clock/hybrid_clock.cc ---------------------------------------------------------------------- diff --git a/src/kudu/clock/hybrid_clock.cc b/src/kudu/clock/hybrid_clock.cc index f62b3f5..4841814 100644 --- a/src/kudu/clock/hybrid_clock.cc +++ b/src/kudu/clock/hybrid_clock.cc @@ -37,6 +37,10 @@ #include "kudu/util/metrics.h" #include "kudu/util/status.h" +using kudu::Status; +using std::string; +using strings::Substitute; + DEFINE_int32(max_clock_sync_error_usec, 10 * 1000 * 1000, // 10 secs "Maximum allowed clock synchronization error as reported by NTP " "before the server will abort."); @@ -71,9 +75,6 @@ METRIC_DEFINE_gauge_uint64(server, hybrid_clock_error, kudu::MetricUnit::kMicroseconds, "Server clock maximum error."); -using kudu::Status; -using strings::Substitute; - namespace kudu { namespace clock { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/clock/logical_clock.cc ---------------------------------------------------------------------- diff --git a/src/kudu/clock/logical_clock.cc b/src/kudu/clock/logical_clock.cc index 8be4843..dc6c6ef 100644 --- a/src/kudu/clock/logical_clock.cc +++ b/src/kudu/clock/logical_clock.cc @@ -35,6 +35,7 @@ METRIC_DEFINE_gauge_uint64(server, logical_clock_timestamp, using base::subtle::Atomic64; using base::subtle::Barrier_AtomicIncrement; using base::subtle::NoBarrier_CompareAndSwap; +using base::subtle::NoBarrier_Load; Timestamp LogicalClock::Now() { return Timestamp(Barrier_AtomicIncrement(&now_, 1)); @@ -97,7 +98,7 @@ void LogicalClock::RegisterMetrics(const scoped_refptr<MetricEntity>& metric_ent ->AutoDetachToLastValue(&metric_detacher_); } -string LogicalClock::Stringify(Timestamp timestamp) { +std::string LogicalClock::Stringify(Timestamp timestamp) { return strings::Substitute("L: $0", timestamp.ToUint64()); } http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/codegen/row_projector.h ---------------------------------------------------------------------- diff --git a/src/kudu/codegen/row_projector.h b/src/kudu/codegen/row_projector.h index e3e935d..5a03c48 100644 --- a/src/kudu/codegen/row_projector.h +++ b/src/kudu/codegen/row_projector.h @@ -127,10 +127,10 @@ class RowProjector { "Base schema row: ", base_schema()->DebugRow(src_row)); } - const vector<ProjectionIdxMapping>& base_cols_mapping() const { + const std::vector<ProjectionIdxMapping>& base_cols_mapping() const { return projector_.base_cols_mapping(); } - const vector<size_t>& projection_defaults() const { + const std::vector<size_t>& projection_defaults() const { return projector_.projection_defaults(); } bool is_identity() const { return projector_.is_identity(); } http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/column_predicate-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/column_predicate-test.cc b/src/kudu/common/column_predicate-test.cc index d5d471c..a5660e9 100644 --- a/src/kudu/common/column_predicate-test.cc +++ b/src/kudu/common/column_predicate-test.cc @@ -27,6 +27,8 @@ #include "kudu/common/types.h" #include "kudu/util/test_util.h" +using std::vector; + namespace kudu { class TestColumnPredicate : public KuduTest { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/column_predicate.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/column_predicate.cc b/src/kudu/common/column_predicate.cc index 2131b4e..fca091a 100644 --- a/src/kudu/common/column_predicate.cc +++ b/src/kudu/common/column_predicate.cc @@ -27,6 +27,7 @@ #include "kudu/util/memory/arena.h" using std::move; +using std::string; using std::vector; namespace kudu { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/encoded_key-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/encoded_key-test.cc b/src/kudu/common/encoded_key-test.cc index cc3122e..e67366e 100644 --- a/src/kudu/common/encoded_key-test.cc +++ b/src/kudu/common/encoded_key-test.cc @@ -27,6 +27,8 @@ #include "kudu/util/test_util.h" #include "kudu/util/test_macros.h" +using std::string; + namespace kudu { #define EXPECT_ROWKEY_EQ(schema, expected, enc_key) \ http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/encoded_key.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/encoded_key.cc b/src/kudu/common/encoded_key.cc index e016bdb..e11f2dc 100644 --- a/src/kudu/common/encoded_key.cc +++ b/src/kudu/common/encoded_key.cc @@ -26,6 +26,7 @@ namespace kudu { using std::string; +using std::vector; EncodedKey::EncodedKey(faststring* data, http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/encoded_key.h ---------------------------------------------------------------------- diff --git a/src/kudu/common/encoded_key.h b/src/kudu/common/encoded_key.h index 2a60654..24e7591 100644 --- a/src/kudu/common/encoded_key.h +++ b/src/kudu/common/encoded_key.h @@ -36,7 +36,7 @@ class EncodedKey { // in which case raw_keys represents the supplied prefix of a // composite key. EncodedKey(faststring *data, - vector<const void *> *raw_keys, + std::vector<const void *> *raw_keys, size_t num_key_cols); static gscoped_ptr<EncodedKey> FromContiguousRow(const ConstContiguousRow& row); @@ -57,7 +57,7 @@ class EncodedKey { const Slice &encoded_key() const { return encoded_key_; } - const vector<const void *> &raw_keys() const { return raw_keys_; } + const std::vector<const void *> &raw_keys() const { return raw_keys_; } size_t num_key_columns() const { return num_key_cols_; } @@ -85,7 +85,7 @@ class EncodedKey { const int num_key_cols_; Slice encoded_key_; gscoped_ptr<uint8_t[]> data_; - vector<const void *> raw_keys_; + std::vector<const void *> raw_keys_; }; // A builder for encoded key: creates an encoded key from @@ -110,7 +110,7 @@ class EncodedKeyBuilder { faststring encoded_key_; const size_t num_key_cols_; size_t idx_; - vector<const void *> raw_keys_; + std::vector<const void *> raw_keys_; }; } // namespace kudu http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/generic_iterators-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/generic_iterators-test.cc b/src/kudu/common/generic_iterators-test.cc index 7b16fb2..db04feb 100644 --- a/src/kudu/common/generic_iterators-test.cc +++ b/src/kudu/common/generic_iterators-test.cc @@ -40,6 +40,8 @@ DEFINE_int32(num_iters, 1, "Number of times to run merge"); namespace kudu { using std::shared_ptr; +using std::string; +using std::vector; static const Schema kIntSchema({ ColumnSchema("val", UINT32) }, 1); http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/generic_iterators.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/generic_iterators.cc b/src/kudu/common/generic_iterators.cc index 2634a77..3808241 100644 --- a/src/kudu/common/generic_iterators.cc +++ b/src/kudu/common/generic_iterators.cc @@ -40,8 +40,9 @@ using std::remove_if; using std::shared_ptr; using std::sort; using std::string; -using std::unique_ptr; using std::tuple; +using std::unique_ptr; +using std::vector; DEFINE_bool(materializing_iterator_do_pushdown, true, "Should MaterializingIterator do predicate pushdown"); http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/generic_iterators.h ---------------------------------------------------------------------- diff --git a/src/kudu/common/generic_iterators.h b/src/kudu/common/generic_iterators.h index cb5a14a..f9d795e 100644 --- a/src/kudu/common/generic_iterators.h +++ b/src/kudu/common/generic_iterators.h @@ -51,7 +51,7 @@ class MergeIterator : public RowwiseIterator { virtual bool HasNext() const OVERRIDE; - virtual string ToString() const OVERRIDE; + virtual std::string ToString() const OVERRIDE; virtual const Schema& schema() const OVERRIDE; @@ -79,7 +79,7 @@ class MergeIterator : public RowwiseIterator { // Statistics (keyed by projection column index) accumulated so far by any // fully-consumed sub-iterators. - vector<IteratorStats> finished_iter_stats_by_col_; + std::vector<IteratorStats> finished_iter_stats_by_col_; // The number of iterators, used by ToString(). const int num_orig_iters_; @@ -110,7 +110,7 @@ class UnionIterator : public RowwiseIterator { bool HasNext() const OVERRIDE; - string ToString() const OVERRIDE; + std::string ToString() const OVERRIDE; const Schema &schema() const OVERRIDE { CHECK(initted_); @@ -149,7 +149,7 @@ class UnionIterator : public RowwiseIterator { // Statistics (keyed by projection column index) accumulated so far by any // fully-consumed sub-iterators. - vector<IteratorStats> finished_iter_stats_by_col_; + std::vector<IteratorStats> finished_iter_stats_by_col_; // When the underlying iterators are initialized, each needs its own // copy of the scan spec in order to do its own pushdown calculations, etc. @@ -173,7 +173,7 @@ class MaterializingIterator : public RowwiseIterator { bool HasNext() const OVERRIDE; - string ToString() const OVERRIDE; + std::string ToString() const OVERRIDE; const Schema &schema() const OVERRIDE { return iter_->schema(); @@ -227,7 +227,7 @@ class PredicateEvaluatingIterator : public RowwiseIterator { bool HasNext() const OVERRIDE; - string ToString() const OVERRIDE; + std::string ToString() const OVERRIDE; const Schema &schema() const OVERRIDE { return base_iter_->schema(); http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/iterator.h ---------------------------------------------------------------------- diff --git a/src/kudu/common/iterator.h b/src/kudu/common/iterator.h index 0fb3cc7..8c5105e 100644 --- a/src/kudu/common/iterator.h +++ b/src/kudu/common/iterator.h @@ -54,7 +54,7 @@ class IteratorBase { virtual bool HasNext() const = 0; // Return a string representation of this iterator, suitable for debug output. - virtual string ToString() const = 0; + virtual std::string ToString() const = 0; // Return the schema for the rows which this iterator produces. virtual const Schema &schema() const = 0; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/key_encoder.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/key_encoder.cc b/src/kudu/common/key_encoder.cc index 453e8c7..565584c 100644 --- a/src/kudu/common/key_encoder.cc +++ b/src/kudu/common/key_encoder.cc @@ -90,7 +90,7 @@ const bool IsTypeAllowableInKey(const TypeInfo* typeinfo) { ////------------------------------------------------------------ template -const KeyEncoder<string>& GetKeyEncoder(const TypeInfo* typeinfo); +const KeyEncoder<std::string>& GetKeyEncoder(const TypeInfo* typeinfo); template const KeyEncoder<faststring>& GetKeyEncoder(const TypeInfo* typeinfo); http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/key_util-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/key_util-test.cc b/src/kudu/common/key_util-test.cc index b6c71f3..5a8766f 100644 --- a/src/kudu/common/key_util-test.cc +++ b/src/kudu/common/key_util-test.cc @@ -151,9 +151,9 @@ TEST_F(KeyUtilTest, TestTryDecrementCell) { } { ColumnSchema col_int32("a", INT32); - int32_t orig = numeric_limits<int32_t>::min(); + int32_t orig = std::numeric_limits<int32_t>::min(); EXPECT_EQ(key_util::TryDecrementCell(col_int32, &orig), false); - EXPECT_EQ(orig, numeric_limits<int32_t>::min()); + EXPECT_EQ(orig, std::numeric_limits<int32_t>::min()); } { ColumnSchema col_bool("a", BOOL); http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/partial_row-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/partial_row-test.cc b/src/kudu/common/partial_row-test.cc index 561f50a..0ade8f8 100644 --- a/src/kudu/common/partial_row-test.cc +++ b/src/kudu/common/partial_row-test.cc @@ -24,6 +24,8 @@ #include "kudu/common/schema.h" #include "kudu/util/test_util.h" +using std::string; + namespace kudu { class PartialRowTest : public KuduTest { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/partial_row.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/partial_row.cc b/src/kudu/common/partial_row.cc index d3957c2..7b8a5c8 100644 --- a/src/kudu/common/partial_row.cc +++ b/src/kudu/common/partial_row.cc @@ -31,6 +31,7 @@ #include "kudu/util/memory/overwrite.h" #include "kudu/util/status.h" +using std::string; using strings::Substitute; namespace kudu { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/partition.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/partition.cc b/src/kudu/common/partition.cc index 593d554..e6ef4e0 100644 --- a/src/kudu/common/partition.cc +++ b/src/kudu/common/partition.cc @@ -367,7 +367,7 @@ Status PartitionSchema::CreatePartitions(const vector<KuduPartialRow>& split_row partitions->swap(new_partitions); } - unordered_set<int> range_column_idxs; + std::unordered_set<int> range_column_idxs; for (const ColumnId& column_id : range_schema_.column_ids) { int column_idx = schema.find_column_by_id(column_id); if (column_idx == Schema::kColumnNotFound) { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/partition.h ---------------------------------------------------------------------- diff --git a/src/kudu/common/partition.h b/src/kudu/common/partition.h index efc90a2..6be01d4 100644 --- a/src/kudu/common/partition.h +++ b/src/kudu/common/partition.h @@ -289,7 +289,7 @@ class PartitionSchema { // Private templated helper for EncodeKey. template<typename Row> - Status EncodeKeyImpl(const Row& row, string* buf) const; + Status EncodeKeyImpl(const Row& row, std::string* buf) const; // Returns true if all of the columns in the range partition key are unset in // the row. http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/partition_pruner.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/partition_pruner.cc b/src/kudu/common/partition_pruner.cc index ac157a9..e6184f2 100644 --- a/src/kudu/common/partition_pruner.cc +++ b/src/kudu/common/partition_pruner.cc @@ -137,7 +137,7 @@ void EncodeRangeKeysFromPredicates(const Schema& schema, // Arenas must be at least the minimum chunk size, and we require at least // enough space for the range key columns. - Arena arena(max<size_t>(Arena::kMinimumChunkSize, schema.key_byte_size()), 4096); + Arena arena(std::max<size_t>(Arena::kMinimumChunkSize, schema.key_byte_size()), 4096); uint8_t* buf = static_cast<uint8_t*>(CHECK_NOTNULL(arena.AllocateBytes(schema.key_byte_size()))); ContiguousRow row(&schema, buf); http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/row.h ---------------------------------------------------------------------- diff --git a/src/kudu/common/row.h b/src/kudu/common/row.h index cb68bb9..d34b8dc 100644 --- a/src/kudu/common/row.h +++ b/src/kudu/common/row.h @@ -186,14 +186,17 @@ class RowProjector { // Returns the mapping between base schema and projection schema columns // first: is the projection column index, second: is the base_schema index - const vector<ProjectionIdxMapping>& base_cols_mapping() const { return base_cols_mapping_; } - + const std::vector<ProjectionIdxMapping>& base_cols_mapping() const { + return base_cols_mapping_; + } // Returns the projection indexes of the columns to add with a default value. // // These are columns which are present in 'projection_' but not in 'base_schema', // and for which 'projection' has a default. - const vector<size_t>& projection_defaults() const { return projection_defaults_; } + const std::vector<size_t>& projection_defaults() const { + return projection_defaults_; + } private: friend class Schema; @@ -246,8 +249,8 @@ class RowProjector { private: DISALLOW_COPY_AND_ASSIGN(RowProjector); - vector<ProjectionIdxMapping> base_cols_mapping_; - vector<size_t> projection_defaults_; + std::vector<ProjectionIdxMapping> base_cols_mapping_; + std::vector<size_t> projection_defaults_; const Schema* base_schema_; const Schema* projection_; @@ -569,7 +572,7 @@ class RowBuilder { AddSlice(slice); } - void AddString(const string &str) { + void AddString(const std::string &str) { CheckNextType(STRING); AddSlice(str); } @@ -579,7 +582,7 @@ class RowBuilder { AddSlice(slice); } - void AddBinary(const string &str) { + void AddBinary(const std::string &str) { CheckNextType(BINARY); AddSlice(str); } @@ -690,7 +693,7 @@ class RowBuilder { Advance(); } - void AddSlice(const string &str) { + void AddSlice(const std::string &str) { uint8_t *in_arena = arena_.AddSlice(str); CHECK(in_arena) << "could not allocate space in arena"; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/row_changelist-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/row_changelist-test.cc b/src/kudu/common/row_changelist-test.cc index 6b934a2..3a1902d 100644 --- a/src/kudu/common/row_changelist-test.cc +++ b/src/kudu/common/row_changelist-test.cc @@ -28,10 +28,11 @@ #include "kudu/util/test_macros.h" #include "kudu/util/test_util.h" -namespace kudu { - +using std::string; using strings::Substitute; +namespace kudu { + class TestRowChangeList : public KuduTest { public: TestRowChangeList() : http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/row_changelist.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/row_changelist.cc b/src/kudu/common/row_changelist.cc index cd73d46..4d933cd 100644 --- a/src/kudu/common/row_changelist.cc +++ b/src/kudu/common/row_changelist.cc @@ -27,6 +27,7 @@ #include "kudu/util/coding-inl.h" #include "kudu/util/faststring.h" +using std::string; using strings::Substitute; using strings::SubstituteAndAppend; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/row_changelist.h ---------------------------------------------------------------------- diff --git a/src/kudu/common/row_changelist.h b/src/kudu/common/row_changelist.h index d6e2f3b..bc05b48 100644 --- a/src/kudu/common/row_changelist.h +++ b/src/kudu/common/row_changelist.h @@ -107,7 +107,7 @@ class RowChangeList { const Slice &slice() const { return encoded_data_; } // Return a string form of this changelist. - string ToString(const Schema &schema) const; + std::string ToString(const Schema &schema) const; bool is_reinsert() const { DCHECK_GT(encoded_data_.size(), 0); http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/row_operations-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/row_operations-test.cc b/src/kudu/common/row_operations-test.cc index 4b957db..27f025a 100644 --- a/src/kudu/common/row_operations-test.cc +++ b/src/kudu/common/row_operations-test.cc @@ -26,6 +26,8 @@ #include "kudu/util/test_util.h" using std::shared_ptr; +using std::string; +using std::vector; using strings::Substitute; using strings::SubstituteAndAppend; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/row_operations.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/row_operations.cc b/src/kudu/common/row_operations.cc index 388225a..0fb1142 100644 --- a/src/kudu/common/row_operations.cc +++ b/src/kudu/common/row_operations.cc @@ -28,6 +28,7 @@ #include "kudu/util/slice.h" using std::string; +using std::vector; using strings::Substitute; namespace kudu { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/scan_spec-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/scan_spec-test.cc b/src/kudu/common/scan_spec-test.cc index be218a6..3e1e55f 100644 --- a/src/kudu/common/scan_spec-test.cc +++ b/src/kudu/common/scan_spec-test.cc @@ -31,6 +31,8 @@ #include "kudu/util/test_macros.h" #include "kudu/util/test_util.h" +using std::vector; + namespace kudu { class TestScanSpec : public KuduTest { http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/scan_spec.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/scan_spec.cc b/src/kudu/common/scan_spec.cc index 98a99e4..40804ef 100644 --- a/src/kudu/common/scan_spec.cc +++ b/src/kudu/common/scan_spec.cc @@ -31,6 +31,7 @@ using std::any_of; using std::max; using std::move; +using std::pair; using std::string; using std::vector; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/scan_spec.h ---------------------------------------------------------------------- diff --git a/src/kudu/common/scan_spec.h b/src/kudu/common/scan_spec.h index 4951b0b..bc1efc2 100644 --- a/src/kudu/common/scan_spec.h +++ b/src/kudu/common/scan_spec.h @@ -103,10 +103,10 @@ class ScanSpec { return exclusive_upper_bound_key_; } - const string& lower_bound_partition_key() const { + const std::string& lower_bound_partition_key() const { return lower_bound_partition_key_; } - const string& exclusive_upper_bound_partition_key() const { + const std::string& exclusive_upper_bound_partition_key() const { return exclusive_upper_bound_partition_key_; } http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/schema-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/schema-test.cc b/src/kudu/common/schema-test.cc index 85c96da..a3554cc 100644 --- a/src/kudu/common/schema-test.cc +++ b/src/kudu/common/schema-test.cc @@ -33,6 +33,7 @@ namespace kudu { namespace tablet { +using std::string; using std::unordered_map; using std::vector; using strings::Substitute; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/schema.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/schema.cc b/src/kudu/common/schema.cc index c17ac31..a708d24 100644 --- a/src/kudu/common/schema.cc +++ b/src/kudu/common/schema.cc @@ -28,9 +28,11 @@ #include "kudu/util/status.h" #include "kudu/common/row.h" -namespace kudu { - +using std::string; using std::unordered_set; +using std::vector; + +namespace kudu { // In a new schema, we typically would start assigning column IDs at 0. However, this // makes it likely that in many test cases, the column IDs and the column indexes are http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/schema.h ---------------------------------------------------------------------- diff --git a/src/kudu/common/schema.h b/src/kudu/common/schema.h index a06581f..2de0c42 100644 --- a/src/kudu/common/schema.h +++ b/src/kudu/common/schema.h @@ -51,10 +51,6 @@ namespace kudu { -using std::vector; -using std::unordered_map; -using std::unordered_set; - // The ID of a column. Each column in a table has a unique ID. struct ColumnId { explicit ColumnId(int32_t t_) : t(t_) {} @@ -95,7 +91,7 @@ struct ColumnStorageAttributes { cfile_block_size(0) { } - string ToString() const; + std::string ToString() const; EncodingType encoding; CompressionType compression; @@ -158,7 +154,7 @@ class ColumnSchema { // ColumnSchema col_c("c", INT32, false, &default_i32); // Slice default_str("Hello"); // ColumnSchema col_d("d", STRING, false, &default_str); - ColumnSchema(string name, DataType type, bool is_nullable = false, + ColumnSchema(std::string name, DataType type, bool is_nullable = false, const void* read_default = NULL, const void* write_default = NULL, ColumnStorageAttributes attributes = ColumnStorageAttributes()) @@ -182,17 +178,17 @@ class ColumnSchema { return is_nullable_; } - const string &name() const { + const std::string &name() const { return name_; } // Return a string identifying this column, including its // name. - string ToString() const; + std::string ToString() const; // Same as above, but only including the type information. // For example, "STRING NOT NULL". - string TypeToString() const; + std::string TypeToString() const; // Returns true if the column has a read default value bool has_read_default() const { @@ -297,8 +293,8 @@ class ColumnSchema { // Stringify the given cell. This just stringifies the cell contents, // and doesn't include the column name or type. - string Stringify(const void *cell) const { - string ret; + std::string Stringify(const void *cell) const { + std::string ret; type_info_->AppendDebugStringForValue(cell, &ret); return ret; } @@ -329,11 +325,11 @@ class ColumnSchema { private: friend class SchemaBuilder; - void set_name(const string& name) { + void set_name(const std::string& name) { name_ = name; } - string name_; + std::string name_; const TypeInfo *type_info_; bool is_nullable_; // use shared_ptr since the ColumnSchema is always copied around. @@ -383,7 +379,7 @@ class Schema { // empty schema and then use Reset(...) so that errors can be // caught. If an invalid schema is passed to this constructor, an // assertion will be fired! - Schema(const vector<ColumnSchema>& cols, + Schema(const std::vector<ColumnSchema>& cols, int key_columns) : name_to_index_bytes_(0), // TODO: C++11 provides a single-arg constructor @@ -400,8 +396,8 @@ class Schema { // empty schema and then use Reset(...) so that errors can be // caught. If an invalid schema is passed to this constructor, an // assertion will be fired! - Schema(const vector<ColumnSchema>& cols, - const vector<ColumnId>& ids, + Schema(const std::vector<ColumnSchema>& cols, + const std::vector<ColumnId>& ids, int key_columns) : name_to_index_bytes_(0), // TODO: C++11 provides a single-arg constructor @@ -415,7 +411,7 @@ class Schema { // Reset this Schema object to the given schema. // If this fails, the Schema object is left in an inconsistent // state and may not be used. - Status Reset(const vector<ColumnSchema>& cols, int key_columns) { + Status Reset(const std::vector<ColumnSchema>& cols, int key_columns) { std::vector<ColumnId> ids; return Reset(cols, ids, key_columns); } @@ -423,8 +419,8 @@ class Schema { // Reset this Schema object to the given schema. // If this fails, the Schema object is left in an inconsistent // state and may not be used. - Status Reset(const vector<ColumnSchema>& cols, - const vector<ColumnId>& ids, + Status Reset(const std::vector<ColumnSchema>& cols, + const std::vector<ColumnId>& ids, int key_columns); // Return the number of bytes needed to represent a single row of this schema, without @@ -553,7 +549,7 @@ class Schema { // in a way suitable for debugging. This isn't currently optimized // so should be avoided in hot paths. template<class RowType> - string DebugRow(const RowType& row) const { + std::string DebugRow(const RowType& row) const { DCHECK_SCHEMA_EQ(*this, *row.schema()); return DebugRowColumns(row, num_columns()); } @@ -562,7 +558,7 @@ class Schema { // key-compatible with this one. Per above, this is not for use in // hot paths. template<class RowType> - string DebugRowKey(const RowType& row) const { + std::string DebugRowKey(const RowType& row) const { DCHECK_KEY_PROJECTION_SCHEMA_EQ(*this, *row.schema()); return DebugRowColumns(row, num_key_columns()); } @@ -587,7 +583,7 @@ class Schema { START_KEY, END_KEY }; - string DebugEncodedRowKey(Slice encoded_key, StartOrEnd start_or_end) const; + std::string DebugEncodedRowKey(Slice encoded_key, StartOrEnd start_or_end) const; // Compare two rows of this schema. template<class RowTypeA, class RowTypeB> @@ -610,9 +606,9 @@ class Schema { // TODO this should probably be cached since the key projection // is not supposed to change, for a single schema. Schema CreateKeyProjection() const { - vector<ColumnSchema> key_cols(cols_.begin(), + std::vector<ColumnSchema> key_cols(cols_.begin(), cols_.begin() + num_key_columns_); - vector<ColumnId> col_ids; + std::vector<ColumnId> col_ids; if (!col_ids_.empty()) { col_ids.assign(col_ids_.begin(), col_ids_.begin() + num_key_columns_); } @@ -668,7 +664,7 @@ class Schema { // Stringify this Schema. This is not particularly efficient, // so should only be used when necessary for output. - string ToString() const; + std::string ToString() const; // Return true if the schemas have exactly the same set of columns // and respective types. @@ -803,7 +799,7 @@ class Schema { // row. template<class RowType> std::string DebugRowColumns(const RowType& row, int num_columns) const { - string ret; + std::string ret; ret.append("("); for (size_t col_idx = 0; col_idx < num_columns; col_idx++) { @@ -819,11 +815,11 @@ class Schema { friend class SchemaBuilder; - vector<ColumnSchema> cols_; + std::vector<ColumnSchema> cols_; size_t num_key_columns_; ColumnId max_col_id_; - vector<ColumnId> col_ids_; - vector<size_t> col_offsets_; + std::vector<ColumnId> col_ids_; + std::vector<size_t> col_offsets_; // The keys of this map are StringPiece references to the actual name members of the // ColumnSchema objects inside cols_. This avoids an extra copy of those strings, @@ -834,7 +830,7 @@ class Schema { // measure its memory footprint. int64_t name_to_index_bytes_; typedef STLCountingAllocator<std::pair<const StringPiece, size_t> > NameToIndexMapAllocator; - typedef unordered_map< + typedef std::unordered_map< StringPiece, size_t, std::hash<StringPiece>, @@ -886,27 +882,27 @@ class SchemaBuilder { Schema Build() const { return Schema(cols_, col_ids_, num_key_columns_); } Schema BuildWithoutIds() const { return Schema(cols_, num_key_columns_); } - Status AddKeyColumn(const string& name, DataType type); + Status AddKeyColumn(const std::string& name, DataType type); Status AddColumn(const ColumnSchema& column, bool is_key); - Status AddColumn(const string& name, DataType type) { + Status AddColumn(const std::string& name, DataType type) { return AddColumn(name, type, false, NULL, NULL); } - Status AddNullableColumn(const string& name, DataType type) { + Status AddNullableColumn(const std::string& name, DataType type) { return AddColumn(name, type, true, NULL, NULL); } - Status AddColumn(const string& name, + Status AddColumn(const std::string& name, DataType type, bool is_nullable, const void *read_default, const void *write_default); - Status RemoveColumn(const string& name); + Status RemoveColumn(const std::string& name); - Status RenameColumn(const string& old_name, const string& new_name); + Status RenameColumn(const std::string& old_name, const std::string& new_name); Status ApplyColumnSchemaDelta(const ColumnSchemaDelta& col_delta); @@ -914,9 +910,9 @@ class SchemaBuilder { DISALLOW_COPY_AND_ASSIGN(SchemaBuilder); ColumnId next_id_; - vector<ColumnId> col_ids_; - vector<ColumnSchema> cols_; - unordered_set<string> col_names_; + std::vector<ColumnId> col_ids_; + std::vector<ColumnSchema> cols_; + std::unordered_set<std::string> col_names_; size_t num_key_columns_; }; http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/timestamp.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/timestamp.cc b/src/kudu/common/timestamp.cc index 106210d..a9b07ff 100644 --- a/src/kudu/common/timestamp.cc +++ b/src/kudu/common/timestamp.cc @@ -39,7 +39,7 @@ void Timestamp::EncodeTo(faststring* dst) const { PutMemcmpableVarint64(dst, v); } -string Timestamp::ToString() const { +std::string Timestamp::ToString() const { return strings::Substitute("$0", v); } http://git-wip-us.apache.org/repos/asf/kudu/blob/154b07de/src/kudu/common/types.cc ---------------------------------------------------------------------- diff --git a/src/kudu/common/types.cc b/src/kudu/common/types.cc index f55c4e6..1248516 100644 --- a/src/kudu/common/types.cc +++ b/src/kudu/common/types.cc @@ -24,6 +24,7 @@ #include "kudu/util/logging.h" using std::shared_ptr; +using std::string; using std::unordered_map; namespace kudu {