Rename nested struct columns in a Spark DataFrame [duplicate]Rename nested field in spark dataframeHow to sort a dataframe by multiple column(s)Selecting multiple columns in a pandas dataframeRenaming columns in pandasAdding new column to existing DataFrame in Python pandasHow to change the order of DataFrame columns?Delete column from pandas DataFrameHow to iterate over rows in a DataFrame in Pandas?Select rows from a DataFrame based on values in a column in pandasGet list from pandas DataFrame column headersscala.MatchError during Spark 2.0.2 DataFrame union
Reduce column width of table while also aligning values at decimal point
Why are there not any MRI machines available in Interstellar?
How may I concisely assign different values to a variable, depending on another variable?
What is the meaning of "you has the wind of me"?
"I you already know": is this proper English?
Is dd if=/dev/urandom of=/dev/mem safe?
401(k) investment after being fired. Do I own it?
What does "see" in "the Holy See" mean?
Is it legal to use cash pulled from a credit card to pay the monthly payment on that credit card?
How acidic does a mixture have to be for milk to curdle?
Other than a swing wing, what types of variable geometry have flown?
Why are so many countries still in the Commonwealth?
Explanation for a joke about a three-legged dog that walks into a bar
How can I receive packages while in France?
How do we explain the E major chord in this progression?
What is the lowest-speed bogey a jet fighter can intercept/escort?
Spin vs orbital angular momenta in QFT
Is it correct to translate English noun adjuncts into adjectives?
Area of parallelogram = Area of square. Shear transform
Automatic Habit of Meditation
Why isn't my platform event chain working?
Print sums of all subsets
Why was Sauron not trying to find the Ring, and instead of preparing for war?
How do I run a game when my PCs have different approaches to combat?
Rename nested struct columns in a Spark DataFrame [duplicate]
Rename nested field in spark dataframeHow to sort a dataframe by multiple column(s)Selecting multiple columns in a pandas dataframeRenaming columns in pandasAdding new column to existing DataFrame in Python pandasHow to change the order of DataFrame columns?Delete column from pandas DataFrameHow to iterate over rows in a DataFrame in Pandas?Select rows from a DataFrame based on values in a column in pandasGet list from pandas DataFrame column headersscala.MatchError during Spark 2.0.2 DataFrame union
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
This question already has an answer here:
Rename nested field in spark dataframe
1 answer
I am trying to change the names of a DataFrame columns in scala. I am easily able to change the column names for direct fields but I'm facing difficulty while converting array struct columns.
Below is my DataFrame schema.
|-- _VkjLmnVop: string (nullable = true)
|-- _KaTasLop: string (nullable = true)
|-- AbcDef: struct (nullable = true)
| |-- UvwXyz: struct (nullable = true)
| | |-- _MnoPqrstUv: string (nullable = true)
| | |-- _ManDevyIxyz: string (nullable = true)
But I need the schema like below
|-- vkj_lmn_vop: string (nullable = true)
|-- ka_tas_lop: string (nullable = true)
|-- abc_def: struct (nullable = true)
| |-- uvw_xyz: struct (nullable = true)
| | |-- mno_pqrst_uv: string (nullable = true)
| | |-- man_devy_ixyz: string (nullable = true)
For Non Struct columns I'm changing column names by below
def aliasAllColumns(df: DataFrame): DataFrame =
df.select(df.columns.map c =>
df.col(c)
.as(
c.replaceAll("_", "")
.replaceAll("([A-Z])", "_$1")
.toLowerCase
.replaceFirst("_", ""))
: _*)
aliasAllColumns(file_data_df).show(1)
How I can change Struct column names dynamically?
scala apache-spark dataframe column-alias
marked as duplicate by eliasah
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 27 at 15:58
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Rename nested field in spark dataframe
1 answer
I am trying to change the names of a DataFrame columns in scala. I am easily able to change the column names for direct fields but I'm facing difficulty while converting array struct columns.
Below is my DataFrame schema.
|-- _VkjLmnVop: string (nullable = true)
|-- _KaTasLop: string (nullable = true)
|-- AbcDef: struct (nullable = true)
| |-- UvwXyz: struct (nullable = true)
| | |-- _MnoPqrstUv: string (nullable = true)
| | |-- _ManDevyIxyz: string (nullable = true)
But I need the schema like below
|-- vkj_lmn_vop: string (nullable = true)
|-- ka_tas_lop: string (nullable = true)
|-- abc_def: struct (nullable = true)
| |-- uvw_xyz: struct (nullable = true)
| | |-- mno_pqrst_uv: string (nullable = true)
| | |-- man_devy_ixyz: string (nullable = true)
For Non Struct columns I'm changing column names by below
def aliasAllColumns(df: DataFrame): DataFrame =
df.select(df.columns.map c =>
df.col(c)
.as(
c.replaceAll("_", "")
.replaceAll("([A-Z])", "_$1")
.toLowerCase
.replaceFirst("_", ""))
: _*)
aliasAllColumns(file_data_df).show(1)
How I can change Struct column names dynamically?
scala apache-spark dataframe column-alias
marked as duplicate by eliasah
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 27 at 15:58
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
do you have the rename columns like Maps(_VkjLmnVop => vkj_lmn_vop, _KaTasLop => ka_tas_lop ) ?.
– stack0114106
Mar 26 at 17:21
@stack0114106, I've plenty of columns. So I'm thinking to change column names dynamically.
– Vijay
Mar 26 at 17:30
add a comment |
This question already has an answer here:
Rename nested field in spark dataframe
1 answer
I am trying to change the names of a DataFrame columns in scala. I am easily able to change the column names for direct fields but I'm facing difficulty while converting array struct columns.
Below is my DataFrame schema.
|-- _VkjLmnVop: string (nullable = true)
|-- _KaTasLop: string (nullable = true)
|-- AbcDef: struct (nullable = true)
| |-- UvwXyz: struct (nullable = true)
| | |-- _MnoPqrstUv: string (nullable = true)
| | |-- _ManDevyIxyz: string (nullable = true)
But I need the schema like below
|-- vkj_lmn_vop: string (nullable = true)
|-- ka_tas_lop: string (nullable = true)
|-- abc_def: struct (nullable = true)
| |-- uvw_xyz: struct (nullable = true)
| | |-- mno_pqrst_uv: string (nullable = true)
| | |-- man_devy_ixyz: string (nullable = true)
For Non Struct columns I'm changing column names by below
def aliasAllColumns(df: DataFrame): DataFrame =
df.select(df.columns.map c =>
df.col(c)
.as(
c.replaceAll("_", "")
.replaceAll("([A-Z])", "_$1")
.toLowerCase
.replaceFirst("_", ""))
: _*)
aliasAllColumns(file_data_df).show(1)
How I can change Struct column names dynamically?
scala apache-spark dataframe column-alias
This question already has an answer here:
Rename nested field in spark dataframe
1 answer
I am trying to change the names of a DataFrame columns in scala. I am easily able to change the column names for direct fields but I'm facing difficulty while converting array struct columns.
Below is my DataFrame schema.
|-- _VkjLmnVop: string (nullable = true)
|-- _KaTasLop: string (nullable = true)
|-- AbcDef: struct (nullable = true)
| |-- UvwXyz: struct (nullable = true)
| | |-- _MnoPqrstUv: string (nullable = true)
| | |-- _ManDevyIxyz: string (nullable = true)
But I need the schema like below
|-- vkj_lmn_vop: string (nullable = true)
|-- ka_tas_lop: string (nullable = true)
|-- abc_def: struct (nullable = true)
| |-- uvw_xyz: struct (nullable = true)
| | |-- mno_pqrst_uv: string (nullable = true)
| | |-- man_devy_ixyz: string (nullable = true)
For Non Struct columns I'm changing column names by below
def aliasAllColumns(df: DataFrame): DataFrame =
df.select(df.columns.map c =>
df.col(c)
.as(
c.replaceAll("_", "")
.replaceAll("([A-Z])", "_$1")
.toLowerCase
.replaceFirst("_", ""))
: _*)
aliasAllColumns(file_data_df).show(1)
How I can change Struct column names dynamically?
This question already has an answer here:
Rename nested field in spark dataframe
1 answer
scala apache-spark dataframe column-alias
scala apache-spark dataframe column-alias
edited Mar 26 at 19:13
Leo C
13.8k2 gold badges10 silver badges20 bronze badges
13.8k2 gold badges10 silver badges20 bronze badges
asked Mar 26 at 16:53
VijayVijay
4515 silver badges21 bronze badges
4515 silver badges21 bronze badges
marked as duplicate by eliasah
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 27 at 15:58
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by eliasah
StackExchange.ready(function()
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();
);
);
);
Mar 27 at 15:58
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
do you have the rename columns like Maps(_VkjLmnVop => vkj_lmn_vop, _KaTasLop => ka_tas_lop ) ?.
– stack0114106
Mar 26 at 17:21
@stack0114106, I've plenty of columns. So I'm thinking to change column names dynamically.
– Vijay
Mar 26 at 17:30
add a comment |
do you have the rename columns like Maps(_VkjLmnVop => vkj_lmn_vop, _KaTasLop => ka_tas_lop ) ?.
– stack0114106
Mar 26 at 17:21
@stack0114106, I've plenty of columns. So I'm thinking to change column names dynamically.
– Vijay
Mar 26 at 17:30
do you have the rename columns like Maps(_VkjLmnVop => vkj_lmn_vop, _KaTasLop => ka_tas_lop ) ?.
– stack0114106
Mar 26 at 17:21
do you have the rename columns like Maps(_VkjLmnVop => vkj_lmn_vop, _KaTasLop => ka_tas_lop ) ?.
– stack0114106
Mar 26 at 17:21
@stack0114106, I've plenty of columns. So I'm thinking to change column names dynamically.
– Vijay
Mar 26 at 17:30
@stack0114106, I've plenty of columns. So I'm thinking to change column names dynamically.
– Vijay
Mar 26 at 17:30
add a comment |
2 Answers
2
active
oldest
votes
You can create a recursive method to traverse the DataFrame schema for renaming the columns:
import org.apache.spark.sql.types._
def renameAllCols(schema: StructType, rename: String => String): StructType =
def recurRename(schema: StructType): Seq[StructField] = schema.fields.map
case StructField(name, dtype: StructType, nullable, meta) =>
StructField(rename(name), StructType(recurRename(dtype)), nullable, meta)
case StructField(name, dtype, nullable, meta) =>
StructField(rename(name), dtype, nullable, meta)
StructType(recurRename(schema))
Testing it with the following example:
import org.apache.spark.sql.functions._
import spark.implicits._
val renameFcn = (s: String) =>
s.replace("_", "").replaceAll("([A-Z])", "_$1").toLowerCase.dropWhile(_ == '_')
case class C(A_Bc: Int, D_Ef: Int)
val df = Seq(
(10, "a", C(1, 2)),
(20, "b", C(3, 4))
).toDF("_VkjLmnVop", "_KaTasLop", "AbcDef")
val newDF = spark.createDataFrame(df.rdd, renameAllCols(df.schema, renameFcn))
newDF.printSchema
// root
// |-- vkj_lmn_vop: integer (nullable = false)
// |-- ka_tas_lop: string (nullable = true)
// |-- abc_def: struct (nullable = true)
// | |-- a_bc: integer (nullable = false)
// | |-- d_ef: integer (nullable = false)
Hi Leo , This what I'm looking for. This is really great stuff. Thanks a lot. I'm accepting this answer.
– Vijay
Mar 26 at 17:47
add a comment |
as far as I know, it's not possible to rename nested fields directly.
From one side, you could try moving to a flat object.
However, if you need to keep the structure, you can play with spark.sql.functions.struct(*cols).
Creates a new struct column.
Parameters: cols – list of column names (string) or list of Column expressions
You will need to decompose all the schema, generate the aliases that you need and then compose it again using the struct
function.
It's not the best solution. But it's something :)
Pd: I'm attaching the PySpark doc since it contains a better explanation than the Scala one.
But I've 10 struct columns having 18 attributes in each struct? Is there any other better approach?
– Vijay
Mar 26 at 17:16
I would recommend you to code a tail recursive function, that given a schema, it generates all the replace/struct methods.
– Franzi
Mar 26 at 17:20
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can create a recursive method to traverse the DataFrame schema for renaming the columns:
import org.apache.spark.sql.types._
def renameAllCols(schema: StructType, rename: String => String): StructType =
def recurRename(schema: StructType): Seq[StructField] = schema.fields.map
case StructField(name, dtype: StructType, nullable, meta) =>
StructField(rename(name), StructType(recurRename(dtype)), nullable, meta)
case StructField(name, dtype, nullable, meta) =>
StructField(rename(name), dtype, nullable, meta)
StructType(recurRename(schema))
Testing it with the following example:
import org.apache.spark.sql.functions._
import spark.implicits._
val renameFcn = (s: String) =>
s.replace("_", "").replaceAll("([A-Z])", "_$1").toLowerCase.dropWhile(_ == '_')
case class C(A_Bc: Int, D_Ef: Int)
val df = Seq(
(10, "a", C(1, 2)),
(20, "b", C(3, 4))
).toDF("_VkjLmnVop", "_KaTasLop", "AbcDef")
val newDF = spark.createDataFrame(df.rdd, renameAllCols(df.schema, renameFcn))
newDF.printSchema
// root
// |-- vkj_lmn_vop: integer (nullable = false)
// |-- ka_tas_lop: string (nullable = true)
// |-- abc_def: struct (nullable = true)
// | |-- a_bc: integer (nullable = false)
// | |-- d_ef: integer (nullable = false)
Hi Leo , This what I'm looking for. This is really great stuff. Thanks a lot. I'm accepting this answer.
– Vijay
Mar 26 at 17:47
add a comment |
You can create a recursive method to traverse the DataFrame schema for renaming the columns:
import org.apache.spark.sql.types._
def renameAllCols(schema: StructType, rename: String => String): StructType =
def recurRename(schema: StructType): Seq[StructField] = schema.fields.map
case StructField(name, dtype: StructType, nullable, meta) =>
StructField(rename(name), StructType(recurRename(dtype)), nullable, meta)
case StructField(name, dtype, nullable, meta) =>
StructField(rename(name), dtype, nullable, meta)
StructType(recurRename(schema))
Testing it with the following example:
import org.apache.spark.sql.functions._
import spark.implicits._
val renameFcn = (s: String) =>
s.replace("_", "").replaceAll("([A-Z])", "_$1").toLowerCase.dropWhile(_ == '_')
case class C(A_Bc: Int, D_Ef: Int)
val df = Seq(
(10, "a", C(1, 2)),
(20, "b", C(3, 4))
).toDF("_VkjLmnVop", "_KaTasLop", "AbcDef")
val newDF = spark.createDataFrame(df.rdd, renameAllCols(df.schema, renameFcn))
newDF.printSchema
// root
// |-- vkj_lmn_vop: integer (nullable = false)
// |-- ka_tas_lop: string (nullable = true)
// |-- abc_def: struct (nullable = true)
// | |-- a_bc: integer (nullable = false)
// | |-- d_ef: integer (nullable = false)
Hi Leo , This what I'm looking for. This is really great stuff. Thanks a lot. I'm accepting this answer.
– Vijay
Mar 26 at 17:47
add a comment |
You can create a recursive method to traverse the DataFrame schema for renaming the columns:
import org.apache.spark.sql.types._
def renameAllCols(schema: StructType, rename: String => String): StructType =
def recurRename(schema: StructType): Seq[StructField] = schema.fields.map
case StructField(name, dtype: StructType, nullable, meta) =>
StructField(rename(name), StructType(recurRename(dtype)), nullable, meta)
case StructField(name, dtype, nullable, meta) =>
StructField(rename(name), dtype, nullable, meta)
StructType(recurRename(schema))
Testing it with the following example:
import org.apache.spark.sql.functions._
import spark.implicits._
val renameFcn = (s: String) =>
s.replace("_", "").replaceAll("([A-Z])", "_$1").toLowerCase.dropWhile(_ == '_')
case class C(A_Bc: Int, D_Ef: Int)
val df = Seq(
(10, "a", C(1, 2)),
(20, "b", C(3, 4))
).toDF("_VkjLmnVop", "_KaTasLop", "AbcDef")
val newDF = spark.createDataFrame(df.rdd, renameAllCols(df.schema, renameFcn))
newDF.printSchema
// root
// |-- vkj_lmn_vop: integer (nullable = false)
// |-- ka_tas_lop: string (nullable = true)
// |-- abc_def: struct (nullable = true)
// | |-- a_bc: integer (nullable = false)
// | |-- d_ef: integer (nullable = false)
You can create a recursive method to traverse the DataFrame schema for renaming the columns:
import org.apache.spark.sql.types._
def renameAllCols(schema: StructType, rename: String => String): StructType =
def recurRename(schema: StructType): Seq[StructField] = schema.fields.map
case StructField(name, dtype: StructType, nullable, meta) =>
StructField(rename(name), StructType(recurRename(dtype)), nullable, meta)
case StructField(name, dtype, nullable, meta) =>
StructField(rename(name), dtype, nullable, meta)
StructType(recurRename(schema))
Testing it with the following example:
import org.apache.spark.sql.functions._
import spark.implicits._
val renameFcn = (s: String) =>
s.replace("_", "").replaceAll("([A-Z])", "_$1").toLowerCase.dropWhile(_ == '_')
case class C(A_Bc: Int, D_Ef: Int)
val df = Seq(
(10, "a", C(1, 2)),
(20, "b", C(3, 4))
).toDF("_VkjLmnVop", "_KaTasLop", "AbcDef")
val newDF = spark.createDataFrame(df.rdd, renameAllCols(df.schema, renameFcn))
newDF.printSchema
// root
// |-- vkj_lmn_vop: integer (nullable = false)
// |-- ka_tas_lop: string (nullable = true)
// |-- abc_def: struct (nullable = true)
// | |-- a_bc: integer (nullable = false)
// | |-- d_ef: integer (nullable = false)
answered Mar 26 at 17:34
Leo CLeo C
13.8k2 gold badges10 silver badges20 bronze badges
13.8k2 gold badges10 silver badges20 bronze badges
Hi Leo , This what I'm looking for. This is really great stuff. Thanks a lot. I'm accepting this answer.
– Vijay
Mar 26 at 17:47
add a comment |
Hi Leo , This what I'm looking for. This is really great stuff. Thanks a lot. I'm accepting this answer.
– Vijay
Mar 26 at 17:47
Hi Leo , This what I'm looking for. This is really great stuff. Thanks a lot. I'm accepting this answer.
– Vijay
Mar 26 at 17:47
Hi Leo , This what I'm looking for. This is really great stuff. Thanks a lot. I'm accepting this answer.
– Vijay
Mar 26 at 17:47
add a comment |
as far as I know, it's not possible to rename nested fields directly.
From one side, you could try moving to a flat object.
However, if you need to keep the structure, you can play with spark.sql.functions.struct(*cols).
Creates a new struct column.
Parameters: cols – list of column names (string) or list of Column expressions
You will need to decompose all the schema, generate the aliases that you need and then compose it again using the struct
function.
It's not the best solution. But it's something :)
Pd: I'm attaching the PySpark doc since it contains a better explanation than the Scala one.
But I've 10 struct columns having 18 attributes in each struct? Is there any other better approach?
– Vijay
Mar 26 at 17:16
I would recommend you to code a tail recursive function, that given a schema, it generates all the replace/struct methods.
– Franzi
Mar 26 at 17:20
add a comment |
as far as I know, it's not possible to rename nested fields directly.
From one side, you could try moving to a flat object.
However, if you need to keep the structure, you can play with spark.sql.functions.struct(*cols).
Creates a new struct column.
Parameters: cols – list of column names (string) or list of Column expressions
You will need to decompose all the schema, generate the aliases that you need and then compose it again using the struct
function.
It's not the best solution. But it's something :)
Pd: I'm attaching the PySpark doc since it contains a better explanation than the Scala one.
But I've 10 struct columns having 18 attributes in each struct? Is there any other better approach?
– Vijay
Mar 26 at 17:16
I would recommend you to code a tail recursive function, that given a schema, it generates all the replace/struct methods.
– Franzi
Mar 26 at 17:20
add a comment |
as far as I know, it's not possible to rename nested fields directly.
From one side, you could try moving to a flat object.
However, if you need to keep the structure, you can play with spark.sql.functions.struct(*cols).
Creates a new struct column.
Parameters: cols – list of column names (string) or list of Column expressions
You will need to decompose all the schema, generate the aliases that you need and then compose it again using the struct
function.
It's not the best solution. But it's something :)
Pd: I'm attaching the PySpark doc since it contains a better explanation than the Scala one.
as far as I know, it's not possible to rename nested fields directly.
From one side, you could try moving to a flat object.
However, if you need to keep the structure, you can play with spark.sql.functions.struct(*cols).
Creates a new struct column.
Parameters: cols – list of column names (string) or list of Column expressions
You will need to decompose all the schema, generate the aliases that you need and then compose it again using the struct
function.
It's not the best solution. But it's something :)
Pd: I'm attaching the PySpark doc since it contains a better explanation than the Scala one.
answered Mar 26 at 17:06
FranziFranzi
1,03217 silver badges17 bronze badges
1,03217 silver badges17 bronze badges
But I've 10 struct columns having 18 attributes in each struct? Is there any other better approach?
– Vijay
Mar 26 at 17:16
I would recommend you to code a tail recursive function, that given a schema, it generates all the replace/struct methods.
– Franzi
Mar 26 at 17:20
add a comment |
But I've 10 struct columns having 18 attributes in each struct? Is there any other better approach?
– Vijay
Mar 26 at 17:16
I would recommend you to code a tail recursive function, that given a schema, it generates all the replace/struct methods.
– Franzi
Mar 26 at 17:20
But I've 10 struct columns having 18 attributes in each struct? Is there any other better approach?
– Vijay
Mar 26 at 17:16
But I've 10 struct columns having 18 attributes in each struct? Is there any other better approach?
– Vijay
Mar 26 at 17:16
I would recommend you to code a tail recursive function, that given a schema, it generates all the replace/struct methods.
– Franzi
Mar 26 at 17:20
I would recommend you to code a tail recursive function, that given a schema, it generates all the replace/struct methods.
– Franzi
Mar 26 at 17:20
add a comment |
do you have the rename columns like Maps(_VkjLmnVop => vkj_lmn_vop, _KaTasLop => ka_tas_lop ) ?.
– stack0114106
Mar 26 at 17:21
@stack0114106, I've plenty of columns. So I'm thinking to change column names dynamically.
– Vijay
Mar 26 at 17:30