Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DB24A20049C for ; Fri, 11 Aug 2017 17:06:20 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D95DB16D5DC; Fri, 11 Aug 2017 15:06:20 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id AC95A16D5D9 for ; Fri, 11 Aug 2017 17:06:18 +0200 (CEST) Received: (qmail 20723 invoked by uid 500); 11 Aug 2017 15:06:06 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 18585 invoked by uid 99); 11 Aug 2017 15:06:05 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Aug 2017 15:06:05 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 56CB7F5CCB; Fri, 11 Aug 2017 15:06:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: git-site-role@apache.org To: commits@hbase.apache.org Date: Fri, 11 Aug 2017 15:06:45 -0000 Message-Id: In-Reply-To: <0b697391afec4a64a8a7e889132b223c@git.apache.org> References: <0b697391afec4a64a8a7e889132b223c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [44/51] [partial] hbase-site git commit: Published site at 82d554e3783372cc6b05489452c815b57c06f6cd. archived-at: Fri, 11 Aug 2017 15:06:21 -0000 http://git-wip-us.apache.org/repos/asf/hbase-site/blob/346adc37/apidocs/src-html/org/apache/hadoop/hbase/client/Scan.ReadType.html ---------------------------------------------------------------------- diff --git a/apidocs/src-html/org/apache/hadoop/hbase/client/Scan.ReadType.html b/apidocs/src-html/org/apache/hadoop/hbase/client/Scan.ReadType.html index 8f0943d..63ba3f6 100644 --- a/apidocs/src-html/org/apache/hadoop/hbase/client/Scan.ReadType.html +++ b/apidocs/src-html/org/apache/hadoop/hbase/client/Scan.ReadType.html @@ -601,634 +601,657 @@ 593 /** 594 * Get all available versions. 595 * @return this -596 */ -597 public Scan setMaxVersions() { -598 this.maxVersions = Integer.MAX_VALUE; -599 return this; -600 } -601 -602 /** -603 * Get up to the specified number of versions of each column. -604 * @param maxVersions maximum versions for each column -605 * @return this -606 */ -607 public Scan setMaxVersions(int maxVersions) { -608 this.maxVersions = maxVersions; -609 return this; -610 } -611 -612 /** -613 * Set the maximum number of cells to return for each call to next(). Callers should be aware -614 * that this is not equivalent to calling {@link #setAllowPartialResults(boolean)}. -615 * If you don't allow partial results, the number of cells in each Result must equal to your -616 * batch setting unless it is the last Result for current row. So this method is helpful in paging -617 * queries. If you just want to prevent OOM at client, use setAllowPartialResults(true) is better. -618 * @param batch the maximum number of values -619 * @see Result#mayHaveMoreCellsInRow() -620 */ -621 public Scan setBatch(int batch) { -622 if (this.hasFilter() && this.filter.hasFilterRow()) { -623 throw new IncompatibleFilterException( -624 "Cannot set batch on a scan using a filter" + -625 " that returns true for filter.hasFilterRow"); -626 } -627 this.batch = batch; -628 return this; -629 } -630 -631 /** -632 * Set the maximum number of values to return per row per Column Family -633 * @param limit the maximum number of values returned / row / CF -634 */ -635 public Scan setMaxResultsPerColumnFamily(int limit) { -636 this.storeLimit = limit; -637 return this; -638 } -639 -640 /** -641 * Set offset for the row per Column Family. -642 * @param offset is the number of kvs that will be skipped. +596 * @deprecated It is easy to misunderstand with column family's max versions, so use +597 * {@link #readAllVersions()} instead. +598 */ +599 @Deprecated +600 public Scan setMaxVersions() { +601 return readAllVersions(); +602 } +603 +604 /** +605 * Get up to the specified number of versions of each column. +606 * @param maxVersions maximum versions for each column +607 * @return this +608 * @deprecated It is easy to misunderstand with column family's max versions, so use +609 * {@link #readVersions(int)} instead. +610 */ +611 @Deprecated +612 public Scan setMaxVersions(int maxVersions) { +613 return readVersions(maxVersions); +614 } +615 +616 /** +617 * Get all available versions. +618 * @return this +619 */ +620 public Scan readAllVersions() { +621 this.maxVersions = Integer.MAX_VALUE; +622 return this; +623 } +624 +625 /** +626 * Get up to the specified number of versions of each column. +627 * @param versions specified number of versions for each column +628 * @return this +629 */ +630 public Scan readVersions(int versions) { +631 this.maxVersions = versions; +632 return this; +633 } +634 +635 /** +636 * Set the maximum number of cells to return for each call to next(). Callers should be aware +637 * that this is not equivalent to calling {@link #setAllowPartialResults(boolean)}. +638 * If you don't allow partial results, the number of cells in each Result must equal to your +639 * batch setting unless it is the last Result for current row. So this method is helpful in paging +640 * queries. If you just want to prevent OOM at client, use setAllowPartialResults(true) is better. +641 * @param batch the maximum number of values +642 * @see Result#mayHaveMoreCellsInRow() 643 */ -644 public Scan setRowOffsetPerColumnFamily(int offset) { -645 this.storeOffset = offset; -646 return this; -647 } -648 -649 /** -650 * Set the number of rows for caching that will be passed to scanners. -651 * If not set, the Configuration setting {@link HConstants#HBASE_CLIENT_SCANNER_CACHING} will -652 * apply. -653 * Higher caching values will enable faster scanners but will use more memory. -654 * @param caching the number of rows for caching -655 */ -656 public Scan setCaching(int caching) { -657 this.caching = caching; -658 return this; -659 } -660 -661 /** -662 * @return the maximum result size in bytes. See {@link #setMaxResultSize(long)} -663 */ -664 public long getMaxResultSize() { -665 return maxResultSize; -666 } -667 -668 /** -669 * Set the maximum result size. The default is -1; this means that no specific -670 * maximum result size will be set for this scan, and the global configured -671 * value will be used instead. (Defaults to unlimited). -672 * -673 * @param maxResultSize The maximum result size in bytes. -674 */ -675 public Scan setMaxResultSize(long maxResultSize) { -676 this.maxResultSize = maxResultSize; -677 return this; -678 } -679 -680 @Override -681 public Scan setFilter(Filter filter) { -682 super.setFilter(filter); -683 return this; -684 } -685 -686 /** -687 * Setting the familyMap -688 * @param familyMap map of family to qualifier -689 * @return this -690 */ -691 public Scan setFamilyMap(Map<byte [], NavigableSet<byte []>> familyMap) { -692 this.familyMap = familyMap; -693 return this; -694 } -695 -696 /** -697 * Getting the familyMap -698 * @return familyMap -699 */ -700 public Map<byte [], NavigableSet<byte []>> getFamilyMap() { -701 return this.familyMap; -702 } -703 -704 /** -705 * @return the number of families in familyMap -706 */ -707 public int numFamilies() { -708 if(hasFamilies()) { -709 return this.familyMap.size(); -710 } -711 return 0; -712 } -713 -714 /** -715 * @return true if familyMap is non empty, false otherwise -716 */ -717 public boolean hasFamilies() { -718 return !this.familyMap.isEmpty(); -719 } -720 -721 /** -722 * @return the keys of the familyMap -723 */ -724 public byte[][] getFamilies() { -725 if(hasFamilies()) { -726 return this.familyMap.keySet().toArray(new byte[0][0]); -727 } -728 return null; -729 } -730 -731 /** -732 * @return the startrow -733 */ -734 public byte [] getStartRow() { -735 return this.startRow; -736 } -737 -738 /** -739 * @return if we should include start row when scan -740 */ -741 public boolean includeStartRow() { -742 return includeStartRow; -743 } -744 -745 /** -746 * @return the stoprow -747 */ -748 public byte[] getStopRow() { -749 return this.stopRow; -750 } -751 -752 /** -753 * @return if we should include stop row when scan -754 */ -755 public boolean includeStopRow() { -756 return includeStopRow; -757 } -758 -759 /** -760 * @return the max number of versions to fetch -761 */ -762 public int getMaxVersions() { -763 return this.maxVersions; -764 } -765 -766 /** -767 * @return maximum number of values to return for a single call to next() -768 */ -769 public int getBatch() { -770 return this.batch; -771 } -772 -773 /** -774 * @return maximum number of values to return per row per CF -775 */ -776 public int getMaxResultsPerColumnFamily() { -777 return this.storeLimit; -778 } -779 -780 /** -781 * Method for retrieving the scan's offset per row per column -782 * family (#kvs to be skipped) -783 * @return row offset +644 public Scan setBatch(int batch) { +645 if (this.hasFilter() && this.filter.hasFilterRow()) { +646 throw new IncompatibleFilterException( +647 "Cannot set batch on a scan using a filter" + +648 " that returns true for filter.hasFilterRow"); +649 } +650 this.batch = batch; +651 return this; +652 } +653 +654 /** +655 * Set the maximum number of values to return per row per Column Family +656 * @param limit the maximum number of values returned / row / CF +657 */ +658 public Scan setMaxResultsPerColumnFamily(int limit) { +659 this.storeLimit = limit; +660 return this; +661 } +662 +663 /** +664 * Set offset for the row per Column Family. +665 * @param offset is the number of kvs that will be skipped. +666 */ +667 public Scan setRowOffsetPerColumnFamily(int offset) { +668 this.storeOffset = offset; +669 return this; +670 } +671 +672 /** +673 * Set the number of rows for caching that will be passed to scanners. +674 * If not set, the Configuration setting {@link HConstants#HBASE_CLIENT_SCANNER_CACHING} will +675 * apply. +676 * Higher caching values will enable faster scanners but will use more memory. +677 * @param caching the number of rows for caching +678 */ +679 public Scan setCaching(int caching) { +680 this.caching = caching; +681 return this; +682 } +683 +684 /** +685 * @return the maximum result size in bytes. See {@link #setMaxResultSize(long)} +686 */ +687 public long getMaxResultSize() { +688 return maxResultSize; +689 } +690 +691 /** +692 * Set the maximum result size. The default is -1; this means that no specific +693 * maximum result size will be set for this scan, and the global configured +694 * value will be used instead. (Defaults to unlimited). +695 * +696 * @param maxResultSize The maximum result size in bytes. +697 */ +698 public Scan setMaxResultSize(long maxResultSize) { +699 this.maxResultSize = maxResultSize; +700 return this; +701 } +702 +703 @Override +704 public Scan setFilter(Filter filter) { +705 super.setFilter(filter); +706 return this; +707 } +708 +709 /** +710 * Setting the familyMap +711 * @param familyMap map of family to qualifier +712 * @return this +713 */ +714 public Scan setFamilyMap(Map<byte [], NavigableSet<byte []>> familyMap) { +715 this.familyMap = familyMap; +716 return this; +717 } +718 +719 /** +720 * Getting the familyMap +721 * @return familyMap +722 */ +723 public Map<byte [], NavigableSet<byte []>> getFamilyMap() { +724 return this.familyMap; +725 } +726 +727 /** +728 * @return the number of families in familyMap +729 */ +730 public int numFamilies() { +731 if(hasFamilies()) { +732 return this.familyMap.size(); +733 } +734 return 0; +735 } +736 +737 /** +738 * @return true if familyMap is non empty, false otherwise +739 */ +740 public boolean hasFamilies() { +741 return !this.familyMap.isEmpty(); +742 } +743 +744 /** +745 * @return the keys of the familyMap +746 */ +747 public byte[][] getFamilies() { +748 if(hasFamilies()) { +749 return this.familyMap.keySet().toArray(new byte[0][0]); +750 } +751 return null; +752 } +753 +754 /** +755 * @return the startrow +756 */ +757 public byte [] getStartRow() { +758 return this.startRow; +759 } +760 +761 /** +762 * @return if we should include start row when scan +763 */ +764 public boolean includeStartRow() { +765 return includeStartRow; +766 } +767 +768 /** +769 * @return the stoprow +770 */ +771 public byte[] getStopRow() { +772 return this.stopRow; +773 } +774 +775 /** +776 * @return if we should include stop row when scan +777 */ +778 public boolean includeStopRow() { +779 return includeStopRow; +780 } +781 +782 /** +783 * @return the max number of versions to fetch 784 */ -785 public int getRowOffsetPerColumnFamily() { -786 return this.storeOffset; +785 public int getMaxVersions() { +786 return this.maxVersions; 787 } 788 789 /** -790 * @return caching the number of rows fetched when calling next on a scanner +790 * @return maximum number of values to return for a single call to next() 791 */ -792 public int getCaching() { -793 return this.caching; +792 public int getBatch() { +793 return this.batch; 794 } 795 796 /** -797 * @return RowFilter +797 * @return maximum number of values to return per row per CF 798 */ -799 @Override -800 public Filter getFilter() { -801 return filter; -802 } -803 -804 /** -805 * @return true is a filter has been specified, false if not -806 */ -807 public boolean hasFilter() { -808 return filter != null; -809 } -810 -811 /** -812 * Set whether blocks should be cached for this Scan. -813 * <p> -814 * This is true by default. When true, default settings of the table and -815 * family are used (this will never override caching blocks if the block -816 * cache is disabled for that family or entirely). -817 * -818 * @param cacheBlocks if false, default settings are overridden and blocks -819 * will not be cached -820 */ -821 public Scan setCacheBlocks(boolean cacheBlocks) { -822 this.cacheBlocks = cacheBlocks; -823 return this; -824 } -825 -826 /** -827 * Get whether blocks should be cached for this Scan. -828 * @return true if default caching should be used, false if blocks should not -829 * be cached -830 */ -831 public boolean getCacheBlocks() { -832 return cacheBlocks; -833 } -834 -835 /** -836 * Set whether this scan is a reversed one -837 * <p> -838 * This is false by default which means forward(normal) scan. -839 * -840 * @param reversed if true, scan will be backward order -841 * @return this -842 */ -843 public Scan setReversed(boolean reversed) { -844 this.reversed = reversed; -845 return this; -846 } -847 -848 /** -849 * Get whether this scan is a reversed one. -850 * @return true if backward scan, false if forward(default) scan -851 */ -852 public boolean isReversed() { -853 return reversed; -854 } -855 -856 /** -857 * Setting whether the caller wants to see the partial results when server returns -858 * less-than-expected cells. It is helpful while scanning a huge row to prevent OOM at client. -859 * By default this value is false and the complete results will be assembled client side -860 * before being delivered to the caller. -861 * @param allowPartialResults -862 * @return this -863 * @see Result#mayHaveMoreCellsInRow() -864 * @see #setBatch(int) +799 public int getMaxResultsPerColumnFamily() { +800 return this.storeLimit; +801 } +802 +803 /** +804 * Method for retrieving the scan's offset per row per column +805 * family (#kvs to be skipped) +806 * @return row offset +807 */ +808 public int getRowOffsetPerColumnFamily() { +809 return this.storeOffset; +810 } +811 +812 /** +813 * @return caching the number of rows fetched when calling next on a scanner +814 */ +815 public int getCaching() { +816 return this.caching; +817 } +818 +819 /** +820 * @return RowFilter +821 */ +822 @Override +823 public Filter getFilter() { +824 return filter; +825 } +826 +827 /** +828 * @return true is a filter has been specified, false if not +829 */ +830 public boolean hasFilter() { +831 return filter != null; +832 } +833 +834 /** +835 * Set whether blocks should be cached for this Scan. +836 * <p> +837 * This is true by default. When true, default settings of the table and +838 * family are used (this will never override caching blocks if the block +839 * cache is disabled for that family or entirely). +840 * +841 * @param cacheBlocks if false, default settings are overridden and blocks +842 * will not be cached +843 */ +844 public Scan setCacheBlocks(boolean cacheBlocks) { +845 this.cacheBlocks = cacheBlocks; +846 return this; +847 } +848 +849 /** +850 * Get whether blocks should be cached for this Scan. +851 * @return true if default caching should be used, false if blocks should not +852 * be cached +853 */ +854 public boolean getCacheBlocks() { +855 return cacheBlocks; +856 } +857 +858 /** +859 * Set whether this scan is a reversed one +860 * <p> +861 * This is false by default which means forward(normal) scan. +862 * +863 * @param reversed if true, scan will be backward order +864 * @return this 865 */ -866 public Scan setAllowPartialResults(final boolean allowPartialResults) { -867 this.allowPartialResults = allowPartialResults; +866 public Scan setReversed(boolean reversed) { +867 this.reversed = reversed; 868 return this; 869 } 870 871 /** -872 * @return true when the constructor of this scan understands that the results they will see may -873 * only represent a partial portion of a row. The entire row would be retrieved by -874 * subsequent calls to {@link ResultScanner#next()} -875 */ -876 public boolean getAllowPartialResults() { -877 return allowPartialResults; -878 } -879 -880 public Scan setLoadColumnFamiliesOnDemand(boolean value) { -881 return (Scan) super.setLoadColumnFamiliesOnDemand(value); -882 } -883 -884 /** -885 * Compile the table and column family (i.e. schema) information -886 * into a String. Useful for parsing and aggregation by debugging, -887 * logging, and administration tools. -888 * @return Map -889 */ -890 @Override -891 public Map<String, Object> getFingerprint() { -892 Map<String, Object> map = new HashMap<>(); -893 List<String> families = new ArrayList<>(); -894 if(this.familyMap.isEmpty()) { -895 map.put("families", "ALL"); -896 return map; -897 } else { -898 map.put("families", families); -899 } -900 for (Map.Entry<byte [], NavigableSet<byte[]>> entry : -901 this.familyMap.entrySet()) { -902 families.add(Bytes.toStringBinary(entry.getKey())); -903 } -904 return map; +872 * Get whether this scan is a reversed one. +873 * @return true if backward scan, false if forward(default) scan +874 */ +875 public boolean isReversed() { +876 return reversed; +877 } +878 +879 /** +880 * Setting whether the caller wants to see the partial results when server returns +881 * less-than-expected cells. It is helpful while scanning a huge row to prevent OOM at client. +882 * By default this value is false and the complete results will be assembled client side +883 * before being delivered to the caller. +884 * @param allowPartialResults +885 * @return this +886 * @see Result#mayHaveMoreCellsInRow() +887 * @see #setBatch(int) +888 */ +889 public Scan setAllowPartialResults(final boolean allowPartialResults) { +890 this.allowPartialResults = allowPartialResults; +891 return this; +892 } +893 +894 /** +895 * @return true when the constructor of this scan understands that the results they will see may +896 * only represent a partial portion of a row. The entire row would be retrieved by +897 * subsequent calls to {@link ResultScanner#next()} +898 */ +899 public boolean getAllowPartialResults() { +900 return allowPartialResults; +901 } +902 +903 public Scan setLoadColumnFamiliesOnDemand(boolean value) { +904 return (Scan) super.setLoadColumnFamiliesOnDemand(value); 905 } 906 907 /** -908 * Compile the details beyond the scope of getFingerprint (row, columns, -909 * timestamps, etc.) into a Map along with the fingerprinted information. -910 * Useful for debugging, logging, and administration tools. -911 * @param maxCols a limit on the number of columns output prior to truncation -912 * @return Map -913 */ -914 @Override -915 public Map<String, Object> toMap(int maxCols) { -916 // start with the fingerpring map and build on top of it -917 Map<String, Object> map = getFingerprint(); -918 // map from families to column list replaces fingerprint's list of families -919 Map<String, List<String>> familyColumns = new HashMap<>(); -920 map.put("families", familyColumns); -921 // add scalar information first -922 map.put("startRow", Bytes.toStringBinary(this.startRow)); -923 map.put("stopRow", Bytes.toStringBinary(this.stopRow)); -924 map.put("maxVersions", this.maxVersions); -925 map.put("batch", this.batch); -926 map.put("caching", this.caching); -927 map.put("maxResultSize", this.maxResultSize); -928 map.put("cacheBlocks", this.cacheBlocks); -929 map.put("loadColumnFamiliesOnDemand", this.loadColumnFamiliesOnDemand); -930 List<Long> timeRange = new ArrayList<>(2); -931 timeRange.add(this.tr.getMin()); -932 timeRange.add(this.tr.getMax()); -933 map.put("timeRange", timeRange); -934 int colCount = 0; -935 // iterate through affected families and list out up to maxCols columns -936 for (Map.Entry<byte [], NavigableSet<byte[]>> entry : -937 this.familyMap.entrySet()) { -938 List<String> columns = new ArrayList<>(); -939 familyColumns.put(Bytes.toStringBinary(entry.getKey()), columns); -940 if(entry.getValue() == null) { -941 colCount++; -942 --maxCols; -943 columns.add("ALL"); -944 } else { -945 colCount += entry.getValue().size(); -946 if (maxCols <= 0) { -947 continue; -948 } -949 for (byte [] column : entry.getValue()) { -950 if (--maxCols <= 0) { -951 continue; -952 } -953 columns.add(Bytes.toStringBinary(column)); -954 } -955 } -956 } -957 map.put("totalColumns", colCount); -958 if (this.filter != null) { -959 map.put("filter", this.filter.toString()); -960 } -961 // add the id if set -962 if (getId() != null) { -963 map.put("id", getId()); -964 } -965 return map; -966 } -967 -968 /** -969 * Enable/disable "raw" mode for this scan. -970 * If "raw" is enabled the scan will return all -971 * delete marker and deleted rows that have not -972 * been collected, yet. -973 * This is mostly useful for Scan on column families -974 * that have KEEP_DELETED_ROWS enabled. -975 * It is an error to specify any column when "raw" is set. -976 * @param raw True/False to enable/disable "raw" mode. -977 */ -978 public Scan setRaw(boolean raw) { -979 setAttribute(RAW_ATTR, Bytes.toBytes(raw)); -980 return this; -981 } -982 -983 /** -984 * @return True if this Scan is in "raw" mode. -985 */ -986 public boolean isRaw() { -987 byte[] attr = getAttribute(RAW_ATTR); -988 return attr == null ? false : Bytes.toBoolean(attr); +908 * Compile the table and column family (i.e. schema) information +909 * into a String. Useful for parsing and aggregation by debugging, +910 * logging, and administration tools. +911 * @return Map +912 */ +913 @Override +914 public Map<String, Object> getFingerprint() { +915 Map<String, Object> map = new HashMap<>(); +916 List<String> families = new ArrayList<>(); +917 if(this.familyMap.isEmpty()) { +918 map.put("families", "ALL"); +919 return map; +920 } else { +921 map.put("families", families); +922 } +923 for (Map.Entry<byte [], NavigableSet<byte[]>> entry : +924 this.familyMap.entrySet()) { +925 families.add(Bytes.toStringBinary(entry.getKey())); +926 } +927 return map; +928 } +929 +930 /** +931 * Compile the details beyond the scope of getFingerprint (row, columns, +932 * timestamps, etc.) into a Map along with the fingerprinted information. +933 * Useful for debugging, logging, and administration tools. +934 * @param maxCols a limit on the number of columns output prior to truncation +935 * @return Map +936 */ +937 @Override +938 public Map<String, Object> toMap(int maxCols) { +939 // start with the fingerpring map and build on top of it +940 Map<String, Object> map = getFingerprint(); +941 // map from families to column list replaces fingerprint's list of families +942 Map<String, List<String>> familyColumns = new HashMap<>(); +943 map.put("families", familyColumns); +944 // add scalar information first +945 map.put("startRow", Bytes.toStringBinary(this.startRow)); +946 map.put("stopRow", Bytes.toStringBinary(this.stopRow)); +947 map.put("maxVersions", this.maxVersions); +948 map.put("batch", this.batch); +949 map.put("caching", this.caching); +950 map.put("maxResultSize", this.maxResultSize); +951 map.put("cacheBlocks", this.cacheBlocks); +952 map.put("loadColumnFamiliesOnDemand", this.loadColumnFamiliesOnDemand); +953 List<Long> timeRange = new ArrayList<>(2); +954 timeRange.add(this.tr.getMin()); +955 timeRange.add(this.tr.getMax()); +956 map.put("timeRange", timeRange); +957 int colCount = 0; +958 // iterate through affected families and list out up to maxCols columns +959 for (Map.Entry<byte [], NavigableSet<byte[]>> entry : +960 this.familyMap.entrySet()) { +961 List<String> columns = new ArrayList<>(); +962 familyColumns.put(Bytes.toStringBinary(entry.getKey()), columns); +963 if(entry.getValue() == null) { +964 colCount++; +965 --maxCols; +966 columns.add("ALL"); +967 } else { +968 colCount += entry.getValue().size(); +969 if (maxCols <= 0) { +970 continue; +971 } +972 for (byte [] column : entry.getValue()) { +973 if (--maxCols <= 0) { +974 continue; +975 } +976 columns.add(Bytes.toStringBinary(column)); +977 } +978 } +979 } +980 map.put("totalColumns", colCount); +981 if (this.filter != null) { +982 map.put("filter", this.filter.toString()); +983 } +984 // add the id if set +985 if (getId() != null) { +986 map.put("id", getId()); +987 } +988 return map; 989 } 990 991 /** -992 * Set whether this scan is a small scan -993 * <p> -994 * Small scan should use pread and big scan can use seek + read seek + read is fast but can cause -995 * two problem (1) resource contention (2) cause too much network io [89-fb] Using pread for -996 * non-compaction read request https://issues.apache.org/jira/browse/HBASE-7266 On the other hand, -997 * if setting it true, we would do openScanner,next,closeScanner in one RPC call. It means the -998 * better performance for small scan. [HBASE-9488]. Generally, if the scan range is within one -999 * data block(64KB), it could be considered as a small scan. -1000 * @param small -1001 * @deprecated since 2.0.0. Use {@link #setLimit(int)} and {@link #setReadType(ReadType)} instead. -1002 * And for the one rpc optimization, now we will also fetch data when openScanner, and -1003 * if the number of rows reaches the limit then we will close the scanner -1004 * automatically which means we will fall back to one rpc. -1005 * @see #setLimit(int) -1006 * @see #setReadType(ReadType) -1007 */ -1008 @Deprecated -1009 public Scan setSmall(boolean small) { -1010 this.small = small; -1011 this.readType = ReadType.PREAD; -1012 return this; -1013 } -1014 -1015 /** -1016 * Get whether this scan is a small scan -1017 * @return true if small scan -1018 * @deprecated since 2.0.0. See the comment of {@link #setSmall(boolean)} -1019 */ -1020 @Deprecated -1021 public boolean isSmall() { -1022 return small; -1023 } -1024 -1025 @Override -1026 public Scan setAttribute(String name, byte[] value) { -1027 return (Scan) super.setAttribute(name, value); -1028 } -1029 -1030 @Override -1031 public Scan setId(String id) { -1032 return (Scan) super.setId(id); -1033 } -1034 -1035 @Override -1036 public Scan setAuthorizations(Authorizations authorizations) { -1037 return (Scan) super.setAuthorizations(authorizations); -1038 } -1039 -1040 @Override -1041 public Scan setACL(Map<String, Permission> perms) { -1042 return (Scan) super.setACL(perms); -1043 } -1044 -1045 @Override -1046 public Scan setACL(String user, Permission perms) { -1047 return (Scan) super.setACL(user, perms); -1048 } -1049 -1050 @Override -1051 public Scan setConsistency(Consistency consistency) { -1052 return (Scan) super.setConsistency(consistency); -1053 } -1054 -1055 @Override -1056 public Scan setReplicaId(int Id) { -1057 return (Scan) super.setReplicaId(Id); -1058 } -1059 -1060 @Override -1061 public Scan setIsolationLevel(IsolationLevel level) { -1062 return (Scan) super.setIsolationLevel(level); -1063 } -1064 -1065 @Override -1066 public Scan setPriority(int priority) { -1067 return (Scan) super.setPriority(priority); -1068 } -1069 -1070 /** -1071 * Enable collection of {@link ScanMetrics}. For advanced users. -1072 * @param enabled Set to true to enable accumulating scan metrics -1073 */ -1074 public Scan setScanMetricsEnabled(final boolean enabled) { -1075 setAttribute(Scan.SCAN_ATTRIBUTES_METRICS_ENABLE, Bytes.toBytes(Boolean.valueOf(enabled))); -1076 return this; -1077 } -1078 -1079 /** -1080 * @return True if collection of scan metrics is enabled. For advanced users. -1081 */ -1082 public boolean isScanMetricsEnabled() { -1083 byte[] attr = getAttribute(Scan.SCAN_ATTRIBUTES_METRICS_ENABLE); -1084 return attr == null ? false : Bytes.toBoolean(attr); -1085 } -1086 -1087 /** -1088 * @return Metrics on this Scan, if metrics were enabled. -1089 * @see #setScanMetricsEnabled(boolean) -1090 * @deprecated Use {@link ResultScanner#getScanMetrics()} instead. And notice that, please do not -1091 * use this method and {@link ResultScanner#getScanMetrics()} together, the metrics -1092 * will be messed up. -1093 */ -1094 @Deprecated -1095 public ScanMetrics getScanMetrics() { -1096 byte[] bytes = getAttribute(Scan.SCAN_ATTRIBUTES_METRICS_DATA); -1097 if (bytes == null) return null; -1098 return ProtobufUtil.toScanMetrics(bytes); -1099 } -1100 -1101 public Boolean isAsyncPrefetch() { -1102 return asyncPrefetch; -1103 } -1104 -1105 public Scan setAsyncPrefetch(boolean asyncPrefetch) { -1106 this.asyncPrefetch = asyncPrefetch; -1107 return this; +992 * Enable/disable "raw" mode for this scan. +993 * If "raw" is enabled the scan will return all +994 * delete marker and deleted rows that have not +995 * been collected, yet. +996 * This is mostly useful for Scan on column families +997 * that have KEEP_DELETED_ROWS enabled. +998 * It is an error to specify any column when "raw" is set. +999 * @param raw True/False to enable/disable "raw" mode. +1000 */ +1001 public Scan setRaw(boolean raw) { +1002 setAttribute(RAW_ATTR, Bytes.toBytes(raw)); +1003 return this; +1004 } +1005 +1006 /** +1007 * @return True if this Scan is in "raw" mode. +1008 */ +1009 public boolean isRaw() { +1010 byte[] attr = getAttribute(RAW_ATTR); +1011 return attr == null ? false : Bytes.toBoolean(attr); +1012 } +1013 +1014 /** +1015 * Set whether this scan is a small scan +1016 * <p> +1017 * Small scan should use pread and big scan can use seek + read seek + read is fast but can cause +1018 * two problem (1) resource contention (2) cause too much network io [89-fb] Using pread for +1019 * non-compaction read request https://issues.apache.org/jira/browse/HBASE-7266 On the other hand, +1020 * if setting it true, we would do openScanner,next,closeScanner in one RPC call. It means the +1021 * better performance for small scan. [HBASE-9488]. Generally, if the scan range is within one +1022 * data block(64KB), it could be considered as a small scan. +1023 * @param small +1024 * @deprecated since 2.0.0. Use {@link #setLimit(int)} and {@link #setReadType(ReadType)} instead. +1025 * And for the one rpc optimization, now we will also fetch data when openScanner, and +1026 * if the number of rows reaches the limit then we will close the scanner +1027 * automatically which means we will fall back to one rpc. +1028 * @see #setLimit(int) +1029 * @see #setReadType(ReadType) +1030 */ +1031 @Deprecated +1032 public Scan setSmall(boolean small) { +1033 this.small = small; +1034 this.readType = ReadType.PREAD; +1035 return this; +1036 } +1037 +1038 /** +1039 * Get whether this scan is a small scan +1040 * @return true if small scan +1041 * @deprecated since 2.0.0. See the comment of {@link #setSmall(boolean)} +1042 */ +1043 @Deprecated +1044 public boolean isSmall() { +1045 return small; +1046 } +1047 +1048 @Override +1049 public Scan setAttribute(String name, byte[] value) { +1050 return (Scan) super.setAttribute(name, value); +1051 } +1052 +1053 @Override +1054 public Scan setId(String id) { +1055 return (Scan) super.setId(id); +1056 } +1057 +1058 @Override +1059 public Scan setAuthorizations(Authorizations authorizations) { +1060 return (Scan) super.setAuthorizations(authorizations); +1061 } +1062 +1063 @Override +1064 public Scan setACL(Map<String, Permission> perms) { +1065 return (Scan) super.setACL(perms); +1066 } +1067 +1068 @Override +1069 public Scan setACL(String user, Permission perms) { +1070 return (Scan) super.setACL(user, perms); +1071 } +1072 +1073 @Override +1074 public Scan setConsistency(Consistency consistency) { +1075 return (Scan) super.setConsistency(consistency); +