You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2020/01/29 21:13:14 UTC
[GitHub] [phoenix] tkhurana commented on a change in pull request #688:
PHOENIX-5629 Phoenix Function to return HBase row timestamp
tkhurana commented on a change in pull request #688: PHOENIX-5629 Phoenix Function to return HBase row timestamp
URL: https://github.com/apache/phoenix/pull/688#discussion_r372632437
##########
File path: phoenix-core/src/main/java/org/apache/phoenix/expression/function/RowTimestampEpochFunction.java
##########
@@ -0,0 +1,43 @@
+package org.apache.phoenix.expression.function;
+
+import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
+import org.apache.phoenix.expression.Expression;
+import org.apache.phoenix.parse.FunctionParseNode.BuiltInFunction;
+import org.apache.phoenix.schema.tuple.Tuple;
+import org.apache.phoenix.schema.types.PDataType;
+import org.apache.phoenix.schema.types.PDate;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Function to return the timestamp of the empty column which functions as the row timestamp. The
+ * result returned can be used for debugging(eg. using HBase shell), logging etc.
+ */
+@BuiltInFunction(name = RowTimestampEpochFunction.NAME, args = {})
+public class RowTimestampEpochFunction extends ScalarFunction {
+
+ public static final String NAME = "ROW_TIMESTAMP_EPOCH";
+
+ public RowTimestampEpochFunction() {
+ }
+
+ public RowTimestampEpochFunction(List<Expression> children) { super(children); }
+
+ @Override
+ public String getName() { return NAME; }
+
+ @Override
+ public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
+ assert (tuple.size() >= 1);
Review comment:
I didn't find any asserts being used in other functions. Also didn't find any functions which explicitly raise exceptions. Intuitively, an assert made most sense here because you will always expect a non empty result tuple and that's what you are asserting on.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services