You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by fh...@apache.org on 2017/02/14 14:33:59 UTC
flink git commit: [FLINK-5566] [table] Add containers for table and
column statistics.
Repository: flink
Updated Branches:
refs/heads/master d32281444 -> 663c1e3f7
[FLINK-5566] [table] Add containers for table and column statistics.
This closes #3196.
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/663c1e3f
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/663c1e3f
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/663c1e3f
Branch: refs/heads/master
Commit: 663c1e3f773ab1a19f8fb87a8fb5a7f95496cc36
Parents: d322814
Author: \u69ff\u745c <ji...@alibaba-inc.com>
Authored: Tue Jan 24 14:34:01 2017 +0800
Committer: Fabian Hueske <fh...@apache.org>
Committed: Tue Feb 14 15:33:22 2017 +0100
----------------------------------------------------------------------
.../flink/table/plan/stats/ColumnStats.scala | 54 ++++++++++++++++++++
.../flink/table/plan/stats/TableStats.scala | 30 +++++++++++
2 files changed, 84 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/663c1e3f/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/stats/ColumnStats.scala
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/stats/ColumnStats.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/stats/ColumnStats.scala
new file mode 100644
index 0000000..152bf83
--- /dev/null
+++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/stats/ColumnStats.scala
@@ -0,0 +1,54 @@
+/*
+ * 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.flink.table.plan.stats
+
+import java.lang.{Double, Long, Integer, Number}
+
+/**
+ * column statistics
+ *
+ * @param ndv number of distinct values
+ * @param nullCount number of nulls
+ * @param avgLen average length of column values
+ * @param maxLen max length of column values
+ * @param max max value of column values
+ * @param min min value of column values
+ */
+case class ColumnStats(
+ ndv: Long,
+ nullCount: Long,
+ avgLen: Double,
+ maxLen: Integer,
+ max: Number,
+ min: Number) {
+
+ override def toString: String = {
+ val columnStatsStr = Seq(
+ if (ndv != null) s"ndv=$ndv" else "",
+ if (nullCount != null) s"nullCount=$nullCount" else "",
+ if (avgLen != null) s"avgLen=$avgLen" else "",
+ if (maxLen != null) s"maxLen=$maxLen" else "",
+ if (max != null) s"max=${max}" else "",
+ if (min != null) s"min=${min}" else ""
+ ).filter(_.nonEmpty).mkString(", ")
+
+ s"ColumnStats(${columnStatsStr})"
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/663c1e3f/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/stats/TableStats.scala
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/stats/TableStats.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/stats/TableStats.scala
new file mode 100644
index 0000000..64eee95
--- /dev/null
+++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/stats/TableStats.scala
@@ -0,0 +1,30 @@
+/*
+ * 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.flink.table.plan.stats
+
+import java.lang.Long
+import java.util.{Map, HashMap}
+
+/**
+ * Table statistics
+ *
+ * @param rowCount cardinality of table
+ * @param colStats statistics of table columns
+ */
+case class TableStats(rowCount: Long, colStats: Map[String, ColumnStats] = new HashMap())