@@ -611,6 +611,289 @@ class SQLContext private[sql](val sparkSession: SparkSession)
611611 sessionState.catalog.listTables(databaseName).map(_.table).toArray
612612 }
613613
614+ // //////////////////////////////////////////////////////////////////////////
615+ // //////////////////////////////////////////////////////////////////////////
616+ // Deprecated methods
617+ // //////////////////////////////////////////////////////////////////////////
618+ // //////////////////////////////////////////////////////////////////////////
619+
620+ /**
621+ * @deprecated As of 1.3.0, replaced by `createDataFrame()`.
622+ */
623+ @ deprecated(" Use createDataFrame instead." , " 1.3.0" )
624+ def applySchema (rowRDD : RDD [Row ], schema : StructType ): DataFrame = {
625+ createDataFrame(rowRDD, schema)
626+ }
627+
628+ /**
629+ * @deprecated As of 1.3.0, replaced by `createDataFrame()`.
630+ */
631+ @ deprecated(" Use createDataFrame instead." , " 1.3.0" )
632+ def applySchema (rowRDD : JavaRDD [Row ], schema : StructType ): DataFrame = {
633+ createDataFrame(rowRDD, schema)
634+ }
635+
636+ /**
637+ * @deprecated As of 1.3.0, replaced by `createDataFrame()`.
638+ */
639+ @ deprecated(" Use createDataFrame instead." , " 1.3.0" )
640+ def applySchema (rdd : RDD [_], beanClass : Class [_]): DataFrame = {
641+ createDataFrame(rdd, beanClass)
642+ }
643+
644+ /**
645+ * @deprecated As of 1.3.0, replaced by `createDataFrame()`.
646+ */
647+ @ deprecated(" Use createDataFrame instead." , " 1.3.0" )
648+ def applySchema (rdd : JavaRDD [_], beanClass : Class [_]): DataFrame = {
649+ createDataFrame(rdd, beanClass)
650+ }
651+
652+ /**
653+ * Loads a Parquet file, returning the result as a `DataFrame`. This function returns an empty
654+ * `DataFrame` if no paths are passed in.
655+ *
656+ * @group specificdata
657+ * @deprecated As of 1.4.0, replaced by `read().parquet()`.
658+ */
659+ @ deprecated(" Use read.parquet() instead." , " 1.4.0" )
660+ @ scala.annotation.varargs
661+ def parquetFile (paths : String * ): DataFrame = {
662+ if (paths.isEmpty) {
663+ emptyDataFrame
664+ } else {
665+ read.parquet(paths : _* )
666+ }
667+ }
668+
669+ /**
670+ * Loads a JSON file (one object per line), returning the result as a `DataFrame`.
671+ * It goes through the entire dataset once to determine the schema.
672+ *
673+ * @group specificdata
674+ * @deprecated As of 1.4.0, replaced by `read().json()`.
675+ */
676+ @ deprecated(" Use read.json() instead." , " 1.4.0" )
677+ def jsonFile (path : String ): DataFrame = {
678+ read.json(path)
679+ }
680+
681+ /**
682+ * Loads a JSON file (one object per line) and applies the given schema,
683+ * returning the result as a `DataFrame`.
684+ *
685+ * @group specificdata
686+ * @deprecated As of 1.4.0, replaced by `read().json()`.
687+ */
688+ @ deprecated(" Use read.json() instead." , " 1.4.0" )
689+ def jsonFile (path : String , schema : StructType ): DataFrame = {
690+ read.schema(schema).json(path)
691+ }
692+
693+ /**
694+ * @group specificdata
695+ * @deprecated As of 1.4.0, replaced by `read().json()`.
696+ */
697+ @ deprecated(" Use read.json() instead." , " 1.4.0" )
698+ def jsonFile (path : String , samplingRatio : Double ): DataFrame = {
699+ read.option(" samplingRatio" , samplingRatio.toString).json(path)
700+ }
701+
702+ /**
703+ * Loads an RDD[String] storing JSON objects (one object per record), returning the result as a
704+ * `DataFrame`.
705+ * It goes through the entire dataset once to determine the schema.
706+ *
707+ * @group specificdata
708+ * @deprecated As of 1.4.0, replaced by `read().json()`.
709+ */
710+ @ deprecated(" Use read.json() instead." , " 1.4.0" )
711+ def jsonRDD (json : RDD [String ]): DataFrame = read.json(json)
712+
713+ /**
714+ * Loads an RDD[String] storing JSON objects (one object per record), returning the result as a
715+ * `DataFrame`.
716+ * It goes through the entire dataset once to determine the schema.
717+ *
718+ * @group specificdata
719+ * @deprecated As of 1.4.0, replaced by `read().json()`.
720+ */
721+ @ deprecated(" Use read.json() instead." , " 1.4.0" )
722+ def jsonRDD (json : JavaRDD [String ]): DataFrame = read.json(json)
723+
724+ /**
725+ * Loads an RDD[String] storing JSON objects (one object per record) and applies the given schema,
726+ * returning the result as a `DataFrame`.
727+ *
728+ * @group specificdata
729+ * @deprecated As of 1.4.0, replaced by `read().json()`.
730+ */
731+ @ deprecated(" Use read.json() instead." , " 1.4.0" )
732+ def jsonRDD (json : RDD [String ], schema : StructType ): DataFrame = {
733+ read.schema(schema).json(json)
734+ }
735+
736+ /**
737+ * Loads an JavaRDD[String] storing JSON objects (one object per record) and applies the given
738+ * schema, returning the result as a `DataFrame`.
739+ *
740+ * @group specificdata
741+ * @deprecated As of 1.4.0, replaced by `read().json()`.
742+ */
743+ @ deprecated(" Use read.json() instead." , " 1.4.0" )
744+ def jsonRDD (json : JavaRDD [String ], schema : StructType ): DataFrame = {
745+ read.schema(schema).json(json)
746+ }
747+
748+ /**
749+ * Loads an RDD[String] storing JSON objects (one object per record) inferring the
750+ * schema, returning the result as a `DataFrame`.
751+ *
752+ * @group specificdata
753+ * @deprecated As of 1.4.0, replaced by `read().json()`.
754+ */
755+ @ deprecated(" Use read.json() instead." , " 1.4.0" )
756+ def jsonRDD (json : RDD [String ], samplingRatio : Double ): DataFrame = {
757+ read.option(" samplingRatio" , samplingRatio.toString).json(json)
758+ }
759+
760+ /**
761+ * Loads a JavaRDD[String] storing JSON objects (one object per record) inferring the
762+ * schema, returning the result as a `DataFrame`.
763+ *
764+ * @group specificdata
765+ * @deprecated As of 1.4.0, replaced by `read().json()`.
766+ */
767+ @ deprecated(" Use read.json() instead." , " 1.4.0" )
768+ def jsonRDD (json : JavaRDD [String ], samplingRatio : Double ): DataFrame = {
769+ read.option(" samplingRatio" , samplingRatio.toString).json(json)
770+ }
771+
772+ /**
773+ * Returns the dataset stored at path as a DataFrame,
774+ * using the default data source configured by spark.sql.sources.default.
775+ *
776+ * @group genericdata
777+ * @deprecated As of 1.4.0, replaced by `read().load(path)`.
778+ */
779+ @ deprecated(" Use read.load(path) instead." , " 1.4.0" )
780+ def load (path : String ): DataFrame = {
781+ read.load(path)
782+ }
783+
784+ /**
785+ * Returns the dataset stored at path as a DataFrame, using the given data source.
786+ *
787+ * @group genericdata
788+ * @deprecated As of 1.4.0, replaced by `read().format(source).load(path)`.
789+ */
790+ @ deprecated(" Use read.format(source).load(path) instead." , " 1.4.0" )
791+ def load (path : String , source : String ): DataFrame = {
792+ read.format(source).load(path)
793+ }
794+
795+ /**
796+ * (Java-specific) Returns the dataset specified by the given data source and
797+ * a set of options as a DataFrame.
798+ *
799+ * @group genericdata
800+ * @deprecated As of 1.4.0, replaced by `read().format(source).options(options).load()`.
801+ */
802+ @ deprecated(" Use read.format(source).options(options).load() instead." , " 1.4.0" )
803+ def load (source : String , options : java.util.Map [String , String ]): DataFrame = {
804+ read.options(options).format(source).load()
805+ }
806+
807+ /**
808+ * (Scala-specific) Returns the dataset specified by the given data source and
809+ * a set of options as a DataFrame.
810+ *
811+ * @group genericdata
812+ * @deprecated As of 1.4.0, replaced by `read().format(source).options(options).load()`.
813+ */
814+ @ deprecated(" Use read.format(source).options(options).load() instead." , " 1.4.0" )
815+ def load (source : String , options : Map [String , String ]): DataFrame = {
816+ read.options(options).format(source).load()
817+ }
818+
819+ /**
820+ * (Java-specific) Returns the dataset specified by the given data source and
821+ * a set of options as a DataFrame, using the given schema as the schema of the DataFrame.
822+ *
823+ * @group genericdata
824+ * @deprecated As of 1.4.0, replaced by
825+ * `read().format(source).schema(schema).options(options).load()`.
826+ */
827+ @ deprecated(" Use read.format(source).schema(schema).options(options).load() instead." , " 1.4.0" )
828+ def load (
829+ source : String ,
830+ schema : StructType ,
831+ options : java.util.Map [String , String ]): DataFrame = {
832+ read.format(source).schema(schema).options(options).load()
833+ }
834+
835+ /**
836+ * (Scala-specific) Returns the dataset specified by the given data source and
837+ * a set of options as a DataFrame, using the given schema as the schema of the DataFrame.
838+ *
839+ * @group genericdata
840+ * @deprecated As of 1.4.0, replaced by
841+ * `read().format(source).schema(schema).options(options).load()`.
842+ */
843+ @ deprecated(" Use read.format(source).schema(schema).options(options).load() instead." , " 1.4.0" )
844+ def load (source : String , schema : StructType , options : Map [String , String ]): DataFrame = {
845+ read.format(source).schema(schema).options(options).load()
846+ }
847+
848+ /**
849+ * Construct a `DataFrame` representing the database table accessible via JDBC URL
850+ * url named table.
851+ *
852+ * @group specificdata
853+ * @deprecated As of 1.4.0, replaced by `read().jdbc()`.
854+ */
855+ @ deprecated(" Use read.jdbc() instead." , " 1.4.0" )
856+ def jdbc (url : String , table : String ): DataFrame = {
857+ read.jdbc(url, table, new Properties )
858+ }
859+
860+ /**
861+ * Construct a `DataFrame` representing the database table accessible via JDBC URL
862+ * url named table. Partitions of the table will be retrieved in parallel based on the parameters
863+ * passed to this function.
864+ *
865+ * @param columnName the name of a column of integral type that will be used for partitioning.
866+ * @param lowerBound the minimum value of `columnName` used to decide partition stride
867+ * @param upperBound the maximum value of `columnName` used to decide partition stride
868+ * @param numPartitions the number of partitions. the range `minValue`-`maxValue` will be split
869+ * evenly into this many partitions
870+ * @group specificdata
871+ * @deprecated As of 1.4.0, replaced by `read().jdbc()`.
872+ */
873+ @ deprecated(" Use read.jdbc() instead." , " 1.4.0" )
874+ def jdbc (
875+ url : String ,
876+ table : String ,
877+ columnName : String ,
878+ lowerBound : Long ,
879+ upperBound : Long ,
880+ numPartitions : Int ): DataFrame = {
881+ read.jdbc(url, table, columnName, lowerBound, upperBound, numPartitions, new Properties )
882+ }
883+
884+ /**
885+ * Construct a `DataFrame` representing the database table accessible via JDBC URL
886+ * url named table. The theParts parameter gives a list expressions
887+ * suitable for inclusion in WHERE clauses; each one defines one partition
888+ * of the `DataFrame`.
889+ *
890+ * @group specificdata
891+ * @deprecated As of 1.4.0, replaced by `read().jdbc()`.
892+ */
893+ @ deprecated(" Use read.jdbc() instead." , " 1.4.0" )
894+ def jdbc (url : String , table : String , theParts : Array [String ]): DataFrame = {
895+ read.jdbc(url, table, theParts, new Properties )
896+ }
614897}
615898
616899/**
0 commit comments