flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From twal...@apache.org
Subject [2/2] flink git commit: [FLINK-7451] [table] Disable testing of the charset in TableTestBase
Date Wed, 15 Nov 2017 13:48:56 GMT
[FLINK-7451] [table] Disable testing of the charset in TableTestBase


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/9d347157
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/9d347157
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/9d347157

Branch: refs/heads/master
Commit: 9d34715747040352f6c0ca13c052763cd8049dad
Parents: c32fcbc
Author: twalthr <twalthr@apache.org>
Authored: Wed Nov 15 14:39:21 2017 +0100
Committer: twalthr <twalthr@apache.org>
Committed: Wed Nov 15 14:41:47 2017 +0100

----------------------------------------------------------------------
 .../flink/table/utils/TableTestBase.scala       | 33 +++++++++-----------
 1 file changed, 15 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/9d347157/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/utils/TableTestBase.scala
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/utils/TableTestBase.scala
b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/utils/TableTestBase.scala
index 5f8f5d6..3829314 100644
--- a/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/utils/TableTestBase.scala
+++ b/flink-libraries/flink-table/src/test/scala/org/apache/flink/table/utils/TableTestBase.scala
@@ -19,6 +19,7 @@
 package org.apache.flink.table.utils
 
 import org.apache.calcite.plan.RelOptUtil
+import org.apache.calcite.rel.RelNode
 import org.apache.flink.api.common.typeinfo.TypeInformation
 import org.apache.flink.api.java.{DataSet => JDataSet, ExecutionEnvironment => JExecutionEnvironment}
 import org.apache.flink.api.scala.{DataSet, ExecutionEnvironment}
@@ -85,6 +86,16 @@ abstract class TableTestUtil {
   def printTable(resultTable: Table): Unit
 
   def printSql(query: String): Unit
+
+  protected def verifyString(expected: String, optimized: RelNode) {
+    val actual = RelOptUtil.toString(optimized)
+    // we remove the charset for testing because it
+    // depends on the native machine (Little/Big Endian)
+    val actualNoCharset = actual.replace("_UTF-16LE'", "'")
+    assertEquals(
+      expected.split("\n").map(_.trim).mkString("\n"),
+      actualNoCharset.split("\n").map(_.trim).mkString("\n"))
+  }
 }
 
 object TableTestUtil {
@@ -125,7 +136,6 @@ object TableTestUtil {
   def streamTableNode(idx: Int): String = {
     s"DataStreamScan(table=[[_DataStreamTable_$idx]])"
   }
-
 }
 
 case class BatchTableTestUtil() extends TableTestUtil {
@@ -184,10 +194,7 @@ case class BatchTableTestUtil() extends TableTestUtil {
   def verifyTable(resultTable: Table, expected: String): Unit = {
     val relNode = resultTable.getRelNode
     val optimized = tableEnv.optimize(relNode)
-    val actual = RelOptUtil.toString(optimized)
-    assertEquals(
-      expected.split("\n").map(_.trim).mkString("\n"),
-      actual.split("\n").map(_.trim).mkString("\n"))
+    verifyString(expected, optimized)
   }
 
   def verifyJavaSql(query: String, expected: String): Unit = {
@@ -197,10 +204,7 @@ case class BatchTableTestUtil() extends TableTestUtil {
   def verifyJavaTable(resultTable: Table, expected: String): Unit = {
     val relNode = resultTable.getRelNode
     val optimized = javaTableEnv.optimize(relNode)
-    val actual = RelOptUtil.toString(optimized)
-    assertEquals(
-      expected.split("\n").map(_.trim).mkString("\n"),
-      actual.split("\n").map(_.trim).mkString("\n"))
+    verifyString(expected, optimized)
   }
 
   def printTable(resultTable: Table): Unit = {
@@ -273,10 +277,7 @@ case class StreamTableTestUtil() extends TableTestUtil {
   def verifyTable(resultTable: Table, expected: String): Unit = {
     val relNode = resultTable.getRelNode
     val optimized = tableEnv.optimize(relNode, updatesAsRetraction = false)
-    val actual = RelOptUtil.toString(optimized)
-    assertEquals(
-      expected.split("\n").map(_.trim).mkString("\n"),
-      actual.split("\n").map(_.trim).mkString("\n"))
+    verifyString(expected, optimized)
   }
 
   def verifyJavaSql(query: String, expected: String): Unit = {
@@ -286,10 +287,7 @@ case class StreamTableTestUtil() extends TableTestUtil {
   def verifyJavaTable(resultTable: Table, expected: String): Unit = {
     val relNode = resultTable.getRelNode
     val optimized = javaTableEnv.optimize(relNode, updatesAsRetraction = false)
-    val actual = RelOptUtil.toString(optimized)
-    assertEquals(
-      expected.split("\n").map(_.trim).mkString("\n"),
-      actual.split("\n").map(_.trim).mkString("\n"))
+    verifyString(expected, optimized)
   }
 
   // the print methods are for debugging purposes only
@@ -302,5 +300,4 @@ case class StreamTableTestUtil() extends TableTestUtil {
   def printSql(query: String): Unit = {
     printTable(tableEnv.sqlQuery(query))
   }
-
 }


Mime
View raw message