wchevreuil commented on code in PR #7593:
URL: https://github.com/apache/hbase/pull/7593#discussion_r2676194167


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/RowKeyDateTieringValueProvider.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.regionserver.compactions;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.ExtendedCell;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Provides a tiering value for compactions by extracting and parsing a date 
from the row key. This
+ * implementation uses a configurable regex and date format to locate and 
parse a date substring
+ * from the row key and returns the parsed epoch time in milliseconds. 
Configuration: -
+ * `hbase.hstore.datatiering.tieringvalueprovider.regexpattern`: Regex used to 
match the row key. -
+ * `hbase.hstore.datatiering.tieringvalueprovider.dateformat`: 
`java.text.SimpleDateFormat` pattern.
+ * - `hbase.hstore.datatiering.tieringvalueprovider.regexextractgroup`: Regex 
group index to
+ * extract. Behavior: - Requires `init(Configuration)` to be called before 
use. - Returns
+ * `Long.MAX_VALUE` if the row key does not match, extraction fails, or date 
parsing fails. - Uses
+ * strict (non\-lenient) date parsing and validates the extract group against 
the pattern.
+ */
[email protected]
+public class RowKeyDateTieringValueProvider implements 
CustomTieredCompactor.TieringValueProvider {
+  private static final Logger LOG = 
LoggerFactory.getLogger(RowKeyDateTieringValueProvider.class);
+  public static final String ROWKEY_REGEX_PATTERN =
+    "hbase.hstore.datatiering.tieringvalueprovider.regexpattern";
+  public static final String ROWKEY_DATE_FORMAT =
+    "hbase.hstore.datatiering.tieringvalueprovider.dateformat";
+  public static final String ROWKEY_REGEX_EXTRACT_GROUP =
+    "hbase.hstore.datatiering.tieringvalueprovider.regexextractgroup";

Review Comment:
   I meant, the properties names itself should follow that pattern, just like 
we do for TIERING_CELL_QUALIFIER:
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to