|
| 1 | +# |
| 2 | +# Copyright 2017 PingCAP, Inc. |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +# |
| 15 | +# |
| 16 | + |
| 17 | +# Title : TiSparkR |
| 18 | +# Objective : TiSpark entry for R |
| 19 | +# Created by: novemser |
| 20 | +# Created on: 17-11-1 |
| 21 | + |
| 22 | +# Function:createTiContext |
| 23 | +# Create a new TiContext via the spark session passed in |
| 24 | +# |
| 25 | +# @return A new TiContext created on session |
| 26 | +# @param session A Spark Session for TiContext creation |
| 27 | +createTiContext <- function(session) { |
| 28 | + sparkR.newJObject("org.apache.spark.sql.TiContext", session) |
| 29 | +} |
| 30 | + |
| 31 | +# Function:tidbMapDatabase |
| 32 | +# Mapping TiContext designated database to `dbName`. |
| 33 | +# |
| 34 | +# @param tiContext TiSpark context |
| 35 | +# @param dbName Database name to map |
| 36 | +# @param isPrefix Whether to use dbName As Prefix |
| 37 | +# @param loadStatistics Whether to use statistics information from TiDB |
| 38 | +tidbMapDatabase <- function(tiContext, dbName, isPrefix=FALSE, loadStatistics=TRUE) { |
| 39 | + sparkR.callJMethod(tiContext, "tidbMapDatabase", dbName, isPrefix, loadStatistics) |
| 40 | + paste("Mapping to database:", dbName) |
| 41 | +} |
0 commit comments