You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/07/02 03:38:13 UTC

[GitHub] [incubator-kyuubi] wForget commented on a diff in pull request #2988: [KYUUBI #2984] Refactor TPCDS configurations using SparkConfParser

wForget commented on code in PR #2988:
URL: https://github.com/apache/incubator-kyuubi/pull/2988#discussion_r912314614


##########
extensions/spark/kyuubi-spark-connector-tpcds/src/main/scala/org/apache/kyuubi/spark/connector/tpcds/TPCDSTableConf.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.kyuubi.spark.connector.tpcds
+
+import org.apache.spark.sql.SparkSession
+import org.apache.spark.sql.util.CaseInsensitiveStringMap
+
+import org.apache.kyuubi.spark.connector.common.SparkConfParser
+import org.apache.kyuubi.spark.connector.tpcds.TPCDSTableConf._
+
+case class TPCDSTableConf(spark: SparkSession,
+                     options: CaseInsensitiveStringMap) {
+
+  private val confParser: SparkConfParser = SparkConfParser(options, spark.conf, null)
+  // When true, use CHAR VARCHAR; otherwise use STRING
+  lazy val useAnsiStringType: Boolean = confParser.booleanConf()
+    .option(USE_ANSI_STRING_TYPE)
+    .sessionConf(USE_ANSI_STRING_TYPE)
+    .defaultValue(USE_ANSI_STRING_TYPE_DEFAULT)
+    .parse()
+  // 09-26-2017 v2.6.0
+  // Replaced two occurrences of "c_last_review_date" with "c_last_review_date_sk" to be consistent
+  // with Table 2-14 (Customer Table Column Definitions) in section 2.4.7 of the specification
+  // (fogbugz 2046).
+  //
+  // https://www.tpc.org/tpc_documents_current_versions/pdf/tpc-ds_v3.2.0.pdf
+  lazy val useTableSchema_2_6: Boolean = confParser.booleanConf()
+    .option(USE_TABLE_SCHEMA_2_6)
+    .sessionConf(USE_TABLE_SCHEMA_2_6)
+    .defaultValue(USE_TABLE_SCHEMA_2_6_DEFAULT)
+    .parse()
+}
+
+object TPCDSTableConf{
+  val USE_ANSI_STRING_TYPE = "useAnsiStringType"
+  val USE_ANSI_STRING_TYPE_DEFAULT = false;
+  val USE_TABLE_SCHEMA_2_6 = "useTableSchema_2_6"
+  val USE_TABLE_SCHEMA_2_6_DEFAULT = true
+}

Review Comment:
   newline



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org